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

0 stars 1 forks source link

Gas Optimizations #52

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

PREFIX INCREMENTS

IMPACT Prefix increments are cheaper than postfix increments.

Instance: https://github.com/code-423n4/2022-07-swivel/blob/main/Creator/Erc20.sol#L154 nonces[owner]++,

Instance: https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L100 unchecked {i++;}

Instance: https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L269 unchecked {i++;}

Instance: https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L418 i++;

Instance: https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L511 x++;

Instance: https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L564 i++;

Instance: https://github.com/code-423n4/2022-07-swivel/blob/main/Marketplace/Erc20.sol#L154 nonces[owner]++,

Instance: https://github.com/code-423n4/2022-07-swivel/blob/main/Tokens/Erc20.sol#L154 nonces[owner]++,

Mitigation: replace foo++ to ++foo

JeeberC4 commented 2 years ago

Warden submitted multiple Gas Optimizations. Will not be judged.