Illuminate contest - Noah3o6's results

Your Sole Source For Fixed-Yields.

General Information

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

Illuminate

Findings Distribution

Researcher Performance

Rank: 79/88

Findings: 1

Award: $63.08

🌟 Selected for report: 0

🚀 Solo Findings: 0

-> X = X + Y IS CHEAPER THAN X += Y (Same for X = X - Y is cheaper than X -= Y)

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=Track%20accumulated%20fees-,totalFee%20%2B%3D%20fee%3B,-//%20Amount%20lent%20for

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=mint)%20minus%20fees-,lent%20%2B%3D%20amountLent%3B,-//%20Sum%20the%20total

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=returned%20%2B%3D%20amountLent%20*%20order.premium%20/%20order.principal%3B294

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=fees%5Bu%5D%20%2B%3D%20calculateFee(a)%3B

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=calculateFee(a)%3B-,fees%5Bu%5D%20%2B%3D%20fee%3B,-address%5B%5D%20memory

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=%3D%20calculateFee(a)%3B-,fees%5Bu%5D%20%2B%3D%20fee%3B,-//%20Swap%20on%20the%20Tempus

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=to%20the%20total-,fees%5Bu%5D%20%2B%3D%20fee%3B,-//%20Determine%20lent%20amount

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=to%20the%20total-,fees%5Bu%5D%20%2B%3D%20fee%3B,-//%20Determine%20the%20amount

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=%3D%20calculateFee(a)%3B-,fees%5Bu%5D%20%2B%3D%20fee%3B,-//%20Swap%20on%20the%20Notional

->STATE VARIABLES ONLY SET IN THE CONSTRUCTOR SHOULD BE DECLARED IMMUTABLE Avoids a Gsset (20000 gas) in the constructor, and replaces each Gwarmacces (100 gas) with a PUSH32 (3 gas)

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=address%20public%20immutable%20pendleAddr%3B

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=address%20public%20immutable%20tempusAddr%3B

-> COMPARISON OPERATORS Problem

In the EVM, there is no opcode for >= or <=. When using greater than or equal, two operations are performed: > and =. Using strict comparison operators hence saves gas

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=require%20(block.timestamp%20%3E%3D%20when%2C%20%27withdrawal%20still%20on%20hold%27)%3B

-> DEFAULT VALUE INITIALIZATION If a variable is not set/initialized, it is assumed to have the default value (0, false, 0x0 etc depending on the data type). Explicitly initializing it with its default value is an anti-pattern and wastes gas.

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20o.length%3B%20)

-> ++i costs less gas compared to i++ or i += 1 (Also --i costs less gas compared to i--- or i -= 1)

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=token)%2C%20r%2C%20max)%3B-,%7D,%7D,-return%20true%3B

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=a%5Bi%5D%2C%20max)%3B-,%7D,%7D,-return%20true%3B

https://github.com/code-423n4/2022-06-illuminate/blob/main/lender/Lender.sol#:~:text=/%20order.principal%3B-,%7D,%7D,-//%20Track%20accumulated%20fee

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