Platform: Code4rena
Start Date: 04/01/2022
Pot Size: $75,000 USDC
Total HM: 17
Participants: 33
Period: 7 days
Judge: 0xean
Total Solo HM: 14
Id: 74
League: ETH
Rank: 31/33
Findings: 1
Award: $12.21
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: WatchPug
Also found by: Dravee, PPrieditis, csanuragjain, gzeon
12.2141 USDC - $12.21
csanuragjain
Gas savings
Navigate to contract at https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol
Observe the mint function
Below statements are not required:
a. require(block.timestamp < maturity, 'E202'); as next statement is a require(maturity - block.timestamp < 0x100000000, 'E208'); which will fail if block.timestamp > maturity
b. Line 161, In pool.state.totalLiquidity += liquidityTotal; += is not required as pool.state.totalLiquidity is 0 as per if condition. It could simply be pool.state.totalLiquidity = liquidityTotal;
#0 - Mathepreneur
2022-01-08T09:15:49Z
We will still include the require(block.timestamp < maturity, 'E202') so that we will have a nicer error message. This is also for consistency as all main functions have the same error message.
We agree with changing line 161 to pool.state.totalLiquidity = liquidityTotal. We will do the same with line 162 to pool.liquidities[factory.owner()] = liquidityTotal - liquidityOut.
#1 - Mathepreneur
2022-01-17T16:47:09Z
Duplicate of #155
#2 - Mathepreneur
2022-01-17T16:47:18Z
Duplicate of #155