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 5 instances of this issue.
File Link | Instance Count | Instance Links |
---|---|---|
Escrow.sol | 4 | 44,98,110,125 |
File Link | Instance Count | Instance Link |
---|---|---|
EscrowFactory.sol | 1 | 30 |
250 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.