Platform: Code4rena
Start Date: 21/06/2022
Pot Size: $55,000 USDC
Total HM: 29
Participants: 88
Period: 5 days
Judge: gzeon
Total Solo HM: 7
Id: 134
League: ETH
Rank: 64/88
Findings: 1
Award: $85.23
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: defsec
Also found by: 0x1f8b, 0x29A, 0xDjango, 0xNazgul, 0xNineDec, 0xf15ers, 0xkowloon, 0xmint, Bnke0x0, BowTiedWardens, Chom, ElKu, Funen, GalloDaSballo, GimelSec, IllIllI, JC, Kenshin, Kulk0, Lambda, Limbooo, MadWookie, Metatron, Picodes, Soosh, StErMi, TomJ, WatchPug, Waze, Yiko, _Adam, ak1, asutorufos, aysha, bardamu, catchup, datapunk, delfin454000, dipp, fatherOfBlocks, grGred, hake, hansfriese, hyh, joestakey, kebabsec, kenzo, kirk-baird, oyc_109, pashov, poirots, rfa, robee, saian, sashik_eth, shenwilly, simon135, slywaters, z3s, zeesaw, zer0dot
85.2275 USDC - $85.23
Variables can be longer and descriptive which will improve readability of the contracts
All funtion parameters in the contract
/// @param u underlying token's address, used to define the market being approved /// @param m maturity of the underlying token, used to define the market being approved /// @param r the address being approved, in this case the redeemer contract /// @return bool true if the approval was successful, false otherwise function approve( address u, uint256 m, address r
Integer constant can be stored and used in a descriptive constant variable instead of using it directly
for (uint8 i; i < 9; ) {
mapping(address => mapping(uint256 => address[9])) public markets;
The math expression for uint256 max can be replaced with type.max, or a constant MAX_UINT = type(uint).max
uint256 max = 2**256 - 1;
Input validation is missing in functions that set storage variables, variables can be accidentally set to wrong values
Functions that change critical parameter of contracts should emit events, this helps users to easily monitor changes in the protocol
function setAdmin(address a) external authorized(admin) returns (bool) { admin = a; return true; }
function setFee(uint256 f) external authorized(admin) returns (bool) { feenominator = f; return true; }
function pause(uint8 p, bool b) external authorized(admin) returns (bool) { paused[p] = b; return true; }
function setAdmin(address a) external authorized(admin) returns (bool) { admin = a; return true; }
should be set swivel address
/// @notice sets the feenominator to the given value /// @param s the address of the Swivel.sol Router /// @return bool true if successful function setSwivel(address s) external authorized(admin) returns (bool) {