code-423n4 / 2022-01-trader-joe-findings

2 stars 0 forks source link

Cheaper operation should be done first in an if statement #319

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pedroais

Vulnerability details

Impact

Save gas

Proof of Concept

The cheaper operation should be done first to save gas . auctionStart == 0 is cheaper than block.timestamp < auctionStart https://github.com/code-423n4/2022-01-trader-joe/blob/a1579f6453bc4bf9fb0db9c627beaa41135438ed/contracts/LaunchEvent.sol#L291

cryptofish7 commented 2 years ago

Fix: https://github.com/traderjoe-xyz/rocket-joe/pull/148