Fraxlend (Frax Finance) contest - asutorufos's results

Fraxlend: A permissionless lending platform and the final piece of the Frax Finance Defi Trinity.

General Information

Platform: Code4rena

Start Date: 12/08/2022

Pot Size: $50,000 USDC

Total HM: 15

Participants: 120

Period: 5 days

Judge: Justin Goro

Total Solo HM: 6

Id: 153

League: ETH

Frax Finance

Findings Distribution

Researcher Performance

Rank: 66/120

Findings: 2

Award: $67.00

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

L-1 SAFEMINT() SHOULD BE USED RATHER THAN _MINT() WHEREVER POSSIBLE _mint() is discouraged in favor of _safeMint() which ensures that the recipient is either an EOA or implements IERC721Receiver. Both OpenZeppelin and solmate have versions of this function

FraxlendPairCore.sol L#570

L-2 EVENT SHOULD BE EMITTED IN SETTERS FraxlendPairDeployer.sol L#170

N-1 EVENTS INDEXING Each event should three indexed fields if there are three or more firleds

FraxlendPair.sol L#228

G-1 <ARRAY>.LENGTH SHOULD NOT BE LOOKED UP IN EVERY LOOP OF A FOR-LOOP The overheads outlined below are PER LOOP, excluding the first loop

storage arrays incur a Gwarmaccess (100 gas) memory arrays use MLOAD (3 gas) calldata arrays use CALLDATALOAD (3 gas) Caching the length changes each of these to a DUP<N> (3 gas), and gets rid of the extra DUP<N> needed to store the stack offset

FraxlendPair.sol L#289 FraxlendPair.sol L#308

FraxlendPairCore.sol L#265

FraxlendPairCore.sol L#270 G-2 ++I/I++ SHOULD BE UNCHECKED{++I}/UNCHECKED{I++} WHEN IT IS NOT POSSIBLE FOR THEM TO OVERFLOW, AS IS THE CASE WHEN USED IN FOR- AND WHILE-LOOPS The unchecked keyword is new in solidity version 0.8.0, so this only applies to that version or higher, which these instances are. This saves 30-40 gas per loop FraxlendPair.sol L#289 FraxlendPair.sol L#308 FraxlendPairCore.sol L#265

FraxlendPairCore.sol L#270

G-3 IT COSTS MORE GAS TO INITIALIZE NON-CONSTANT/NON-IMMUTABLE VARIABLES TO ZERO THAN TO LET THE DEFAULT OF ZERO BE APPLIED

FraxlendPair.sol L#289 FraxlendPair.sol L#308

FraxlendPairCore.sol L#265

FraxlendPairCore.sol L#270 G-4 ++I COSTS LESS GAS THAN I++, ESPECIALLY WHEN IT’S USED IN FOR-LOOPS (--I/I-- TOO) FraxlendPair.sol L#289 FraxlendPair.sol L#308

FraxlendPairCore.sol L#265

FraxlendPairCore.sol L#270

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter