Instead of using address(this)
, it is more gas-efficient to pre-calculate and use the predefined address. Foundry's script.sol
and Solmate's LibRlp.sol
contracts can help pre-determine the address (see computeCreateAddress). The address can be passed in via a constructor argument and assigned to an immutable variable (rather than using a hardcoded constant) so that the code can remain the same across deployments on different networks.
There are 13 instances of this issue.
File Link | Instance Count | Instance Links |
---|---|---|
Fees.sol | 3 | 28,35,43 |
File Link | Instance Count | Instance Links |
---|---|---|
Lender.sol | 6 | 154,189,273,319,644,665 |
File Link | Instance Count | Instance Links |
---|---|---|
Staking.sol | 4 | 39,57,62,64 |
650 gas
baudit: a custom static code analysis tool; manual review
Use predefined address instead of address(this)
.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.