Open code423n4 opened 2 years ago
Public function visibility can be made external a. Summary: Functions should have the strictest visibility possible. Public functions may lead to more gas usage by forcing the copy of their parameters to memory from calldata. b. Details: If a function is never called from the contract it should be marked as external. This will save gas. c. Github Permalinks: https://github.com/code-423n4/2022-06-notional-coop/tree/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L210-L212 d. Mitigation: Consider changing visibility from public to external.
Gas optimization by not initialising loop indices a. Summary: Loop indices need not be initialised to 0. b. Details: Loop indices are 0 valued by default and there is no need to explicitly initialise them again to 0. This saves gas. c. Github Permalinks:https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L238 https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L254 https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L393 https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L605 https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L618
d. Mitigation: Remove explicit initialization to 0 for loop indices.
Public function visibility can be made external a. Summary: Functions should have the strictest visibility possible. Public functions may lead to more gas usage by forcing the copy of their parameters to memory from calldata. b. Details: If a function is never called from the contract it should be marked as external. This will save gas. c. Github Permalinks: https://github.com/code-423n4/2022-06-notional-coop/tree/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L210-L212 d. Mitigation: Consider changing visibility from public to external.
Gas optimization by not initialising loop indices a. Summary: Loop indices need not be initialised to 0. b. Details: Loop indices are 0 valued by default and there is no need to explicitly initialise them again to 0. This saves gas. c. Github Permalinks:https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L238 https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L254 https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L393 https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L605 https://github.com/code-423n4/2022-06-notional-coop/blob/main/index-coop-notional-trade-module/contracts/protocol/modules/v1/NotionalTradeModule.sol#L618
d. Mitigation: Remove explicit initialization to 0 for loop indices.