Title : Using short reason string can be used for saving more gas
Every reason string takes at least 32 bytes. Use short reason strings that fits in 32 bytes or it will become more expensive.
Tool Used
Manual Review
Occurances
contracts/protocol/modules/v1/NotionalTradeModule.sol#L169 "Send token must be an index component"
contracts/protocol/modules/v1/NotionalTradeModule.sol#L199 "FCash to redeem must be an index component"
contracts/protocol/modules/v1/NotionalTradeModule.sol#L378 "WrappedfCash not deployed for given parameters"
contracts/protocol/modules/v1/NotionalTradeModule.sol#L485 "Not enough received amount"
contracts/protocol/modules/v1/NotionalTradeModule.sol#L573 "Token is neither asset nor underlying token"
Title : Using ++i than i++ for saving more gas
Using i++ instead ++i for all the loops, the variable i is incremented using i++. It is known that implementation by using ++i costs less gas per iteration than i++ .
Tools Used
Manual Review
Occurances
contracts/protocol/modules/v1/NotionalTradeModule.sol#L238 for(uint256 i = 0; i < modules.length; i++) {
contracts/protocol/modules/v1/NotionalTradeModule.sol#L254 for(uint256 i = 0; i < modules.length; i++) {
contracts/protocol/modules/v1/NotionalTradeModule.sol#L393 for(uint256 i = 0; i < positionsLength; i++) {
contracts/protocol/modules/v1/NotionalTradeModule.sol#L605 for(uint256 i = 0; i < positionsLength; i++) {
contracts/protocol/modules/v1/NotionalTradeModule.sol#L618 for(uint256 i = 0; i < positionsLength; i++) {
and this can be used prefix instead of used postfix
TItle : Change uint256 i = 0 into uint256 i for saving more gas
Using this implementation can saving more gas for each loops.
Tool Used
Manual Review
Recommended Mitigation
Change it
Occurances
contracts/protocol/modules/v1/NotionalTradeModule.sol#L238 for(uint256 i = 0; i < modules.length; i++) {
contracts/protocol/modules/v1/NotionalTradeModule.sol#L254 for(uint256 i = 0; i < modules.length; i++) {
contracts/protocol/modules/v1/NotionalTradeModule.sol#L393 for(uint256 i = 0; i < positionsLength; i++) {
contracts/protocol/modules/v1/NotionalTradeModule.sol#L605 for(uint256 i = 0; i < positionsLength; i++) {
contracts/protocol/modules/v1/NotionalTradeModule.sol#L618 for(uint256 i = 0; i < positionsLength; i++) {
Every reason string takes at least 32 bytes. Use short reason strings that fits in 32 bytes or it will become more expensive.
Tool Used
Manual Review
Occurances
++i
thani++
for saving more gasUsing
i++
instead++i
for all the loops, the variable i is incremented using i++. It is known that implementation by using++i
costs less gas per iteration thani++
.Tools Used
Manual Review
Occurances
and this can be used prefix instead of used postfix
uint256 i = 0
intouint256 i
for saving more gasUsing this implementation can saving more gas for each loops.
Tool Used
Manual Review
Recommended Mitigation
Change it
Occurances