Closed code423n4 closed 2 years ago
hyh
Gas is overspent first of all on function call
wavaxReserve * 10**token.decimals() is computed twise when the condition is true:
wavaxReserve * 10**token.decimals()
https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L396-398
Consider saving wavaxReserve * 10**token.decimals() to memory and reuse inside the if statement
Duplicate of #236
Handle
hyh
Vulnerability details
Impact
Gas is overspent first of all on function call
Proof of Concept
wavaxReserve * 10**token.decimals()
is computed twise when the condition is true:https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L396-398
Recommended Mitigation Steps
Consider saving
wavaxReserve * 10**token.decimals()
to memory and reuse inside the if statement