code-423n4 / 2022-07-swivel-findings

0 stars 1 forks source link

Gas Optimizations #152

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

++i costs less gas than i++, especially when it's used in for-loops (--i/i-- too)

Line 50: current++;

https://github.com/Swivel-Finance/swivel/blob/2471ea5cda53568df5e5515153c6962f151bf358/contracts/v2/destributor/Destributor.sol#L50

Line 46: bytes32 hashStruct = Hash.permit(o, spender, a, nonces[o]++, d);

https://github.com/Swivel-Finance/swivel/blob/2471ea5cda53568df5e5515153c6962f151bf358/contracts/v2/marketplace/Erc2612.sol#L46

Line 19: for (uint256 i = 0; i < len; i++) {

https://github.com/Swivel-Finance/swivel/blob/2471ea5cda53568df5e5515153c6962f151bf358/contracts/v2/destributor/MerkleProof.sol#L19