Fraxlend (Frax Finance) contest - Ruhum'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: 96/120

Findings: 1

Award: $21.17

🌟 Selected for report: 0

🚀 Solo Findings: 0

Gas Report

G-01: use constant

G-02: use immutable

G-03: use unchecked when incrementing a loop's iterator

Realistically the iterator can't overflow because of the loop's condition. Incrementing it within an unchecked block will save gas.

for (uint i; i < length;) {
    unchecked {
        ++i;
    }
}
./src/contracts/FraxlendPair.sol:289: for (uint256 i = 0; i < _lenders.length; i++) { ./src/contracts/FraxlendPair.sol:308: for (uint256 i = 0; i < _borrowers.length; i++) { ./src/contracts/libraries/SafeERC20.sol:27: for (i = 0; i < 32 && data[i] != 0; i++) { ./src/contracts/FraxlendWhitelist.sol:53: for (uint256 i = 0; i < _addresses.length; i++) { ./src/contracts/FraxlendWhitelist.sol:68: for (uint256 i = 0; i < _addresses.length; i++) { ./src/contracts/FraxlendWhitelist.sol:83: for (uint256 i = 0; i < _addresses.length; i++) { ./src/contracts/FraxlendPairCore.sol:265: for (uint256 i = 0; i < _approvedBorrowers.length; ++i) { ./src/contracts/FraxlendPairCore.sol:270: for (uint256 i = 0; i < _approvedLenders.length; ++i) {

G-04: use ++i

++i is cheaper than i++ when incrementing a loop's iterator.

./src/contracts/FraxlendPairDeployer.sol:131: i++; ./src/contracts/FraxlendPairDeployer.sol:159: i++; ./src/contracts/FraxlendPair.sol:289: for (uint256 i = 0; i < _lenders.length; i++) { ./src/contracts/FraxlendPair.sol:308: for (uint256 i = 0; i < _borrowers.length; i++) { ./src/contracts/libraries/SafeERC20.sol:24: i++; ./src/contracts/libraries/SafeERC20.sol:27: for (i = 0; i < 32 && data[i] != 0; i++) { ./src/contracts/FraxlendWhitelist.sol:53: for (uint256 i = 0; i < _addresses.length; i++) { ./src/contracts/FraxlendWhitelist.sol:68: for (uint256 i = 0; i < _addresses.length; i++) {
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