20,000 USDC
View results
Submission Details
Severity: gas
Valid

[G-01] - Do not add the data which is alreday included in the tx to save users gas cost.

Details

In the Borrowed event we added the startTimestamp and gave it the value block.timestamp. This increases the gas of users and because this data is already present in the transaction then we can save users gas costs by removing it from the event information.

Each emits event will save 273 units of gas

Calculation Type Before After Gas Saved
Avg 364364 364091 273
emit Borrowed(
msg.sender,
pool.lender,
loans.length - 1,
debt,
collateral,
pool.interestRate,
- block.timestamp
+ pool.interestRate
);

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.