code-423n4 / 2021-10-mochi-findings

0 stars 0 forks source link

Duplicate math operations #158

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

pauliax

Vulnerability details

Impact

Duplicate math operations can be cached to reduce gas usage, e.g. no need to calculate updatedFee / 2 twice here: operationShare += updatedFee / 2; veCRVShare += updatedFee / 2;

or here: mochi.transfer(msg.sender, _amount / 2); mochi.transfer(address(vMochi), _amount / 2);

Recommended Mitigation Steps

Eliminate useless duplicate calculations.