code-423n4 / 2022-01-timeswap-findings

2 stars 0 forks source link

more efficient lock() modifier #92

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

rfa

Vulnerability details

Impact

expensive gas

Proof of Concept

https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L43

if we change locked data type to boolean . it can save gas.

https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L122

Tools Used

https://remix.ethereum.org

Recommended Mitigation Steps

bool private locked = true;

modifier lock() { require(locked, 'E211'); locked = false; _; locked = true; }

amateur-dev commented 2 years ago

Similar issue reported over here #87; hence closing this