code-423n4 / 2021-12-amun-findings

0 stars 0 forks source link

Pack structs tightly #260

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

structs can be optimized, e.g. inputAmount and outputAmount could be stored in uint112, as that is what Uniswap like exchanges use: https://github.com/Uniswap/v2-core/blob/master/contracts/UniswapV2Pair.sol#L22-L23

'deadline' also usually fits in a reasonable limit of at least uint32 or uint64. 'entryFee', 'exitFee', etc are also capped, so you should consider revisiting structs to find optimal sizes and orders of the variables.