FIAT DAO veFDT contest - gerdusx's results

Unlock liquidity for your DeFi fixed income assets.

General Information

Platform: Code4rena

Start Date: 12/08/2022

Pot Size: $35,000 USDC

Total HM: 10

Participants: 126

Period: 3 days

Judge: Justin Goro

Total Solo HM: 3

Id: 154

League: ETH

FIAT DAO

Findings Distribution

Researcher Performance

Rank: 121/126

Findings: 1

Award: $14.95

🌟 Selected for report: 0

🚀 Solo Findings: 0

Gas Optimazations

[G-01] Use prefix not postfix in loops

Using a prefix increment (++i) instead of a postfix increment (i++) saves gas for each loop cycle and so can have a big gas impact when the loop executes on a large number of elements.

There are 4 occurrences

VotingEscrow.sol L309 for (uint256 i = 0; i < 255; i++) { L717 for (uint256 i = 0; i < 128; i++) { L739 for (uint256 i = 0; i < 128; i++) { L834 for (uint256 i = 0; i < 255; i++) {

Use prefix not postfix to increment in a loop

[G-02] Use Custom Errors instead of revert()/require()

Custom errors from Solidity 0.8.4 are cheaper than revert strings (cheaper deployment cost and runtime cost when the revert condition is met)

There are 38 occurrences

Blocklist.sol L24 require(msg.sender == manager, "Only manager"); L25 require(_isContract(addr), "Only contracts");

VotingEscrow.sol L116 require(decimals <= 18, "Exceeds max decimals"); L140 require(msg.sender == owner, "Only owner"); L147 require(msg.sender == owner, "Only owner"); L154 require(msg.sender == owner, "Only owner"); L162 require(msg.sender == owner, "Only owner"); L171 require(msg.sender == blocklist, "Only Blocklist"); L412 require(_value > 0, "Only non zero amount"); L413 require(locked_.amount == 0, "Lock exists"); L414 require(unlock_time >= locked_.end, "Only increase lock end"); // from using quitLock, user should increaseAmount instead L415 require(unlock_time > block.timestamp, "Only future lock end"); L416 require(unlock_time <= block.timestamp + MAXTIME, "Exceeds maxtime"); L425 require( L448 require(_value > 0, "Only non zero amount"); L449 require(locked_.amount > 0, "No lock"); L450 require(locked_.end > block.timestamp, "Lock expired"); L485 require( L502 require(locked_.amount > 0, "No lock"); L503 require(unlock_time > locked_.end, "Only increase lock end"); L504 require(unlock_time <= block.timestamp + MAXTIME, "Exceeds maxtime"); L529 require(locked_.amount > 0, "No lock"); L530 require(locked_.end <= block.timestamp, "Lock not expired"); L531 require(locked_.delegatee == msg.sender, "Lock delegated"); L546 require(token.transfer(msg.sender, value), "Transfer failed"); L563 require(!IBlocklist(blocklist).isBlocked(_addr), "Blocked contract"); L564 require(locked_.amount > 0, "No lock"); L565 require(locked_.delegatee != _addr, "Already delegated"); L587 require(toLocked.amount > 0, "Delegatee has no lock"); L588 require(toLocked.end > block.timestamp, "Delegatee lock expired"); L589 require(toLocked.end >= fromLocked.end, "Only delegate to longer lock"); L635 require(locked_.amount > 0, "No lock"); L636 require(locked_.end > block.timestamp, "Lock expired"); L637 require(locked_.delegatee == msg.sender, "Lock delegated"); L657 require(token.transfer(msg.sender, remainingAmount), "Transfer failed"); L676 require(token.transfer(penaltyRecipient, amount), "Transfer failed"); L776 require(_blockNumber <= block.number, "Only past block number"); L877 require(_blockNumber <= block.number, "Only past block number");

Recommended to replace revert strings with custom errors.

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