Closed code423n4 closed 2 years ago
rfa
expensive gas
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
https://remix.ethereum.org
bool private locked = true;
modifier lock() { require(locked, 'E211'); locked = false; _; locked = true; }
Similar issue reported over here #87; hence closing this
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; }