The external function is being called twice, although a single call would suffice.
In resolveDispute()
, balanceOf()
is called twice. However, one call is sufficient. Instead of the second balanceOf()
call, you can just subtract totalFee
from the tokenBalance
. Doing arithmetic operations costs significantly less gas than doing external calls.
Function gas savings:
Function Name | min | avg | median | max | # calls |
---|---|---|---|---|---|
resolveDispute | 383 | 27017 | 22342 | 62460 | 8 |
resolveDisputeOptimized | 377 | 26622 | 21946 | 61683 | 8 |
Deployment gas savings:
Contract Name | Deployment Cost | Deployment Size |
---|---|---|
Escrow | 591900 | 3666 |
EscrowOptimized | 577888 | 3596 |
EscrowFactory.sol | 1720616 | 8622 |
EscrowFactoryOptimized.sol | 1692588 | 8482 |
Gas Optimization
Manual review.
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.