Platform: Code4rena
Start Date: 30/10/2021
Pot Size: $35,000 ETH
Total HM: 2
Participants: 16
Period: 3 days
Judge: alcueca
Total Solo HM: 1
Id: 48
League: ETH
Rank: 10/16
Findings: 1
Award: $472.76
🌟 Selected for report: 5
🚀 Solo Findings: 0
🌟 Selected for report: pants
75.3985 USDC - $75.40
pants
The function _transferFromOrWrap could be set private to save gas
🌟 Selected for report: pants
pants
The function _sendFunds could be set private to save gas
#0 - tommyz7
2021-11-04T18:36:40Z
I'm not sure on which contract, there are two.
🌟 Selected for report: pants
75.3985 USDC - $75.40
pants
Notice that executeTrades is the only function that is external and not onlyAdmin. Therefore a user can't call another function is the contract anyway and this modifier unnecessary.
🌟 Selected for report: pants
75.3985 USDC - $75.40
pants
All getRouter methods could be set external instead public to save gas.
pants
At line 46 of ModuleRegistry.sol there is the following for loop: for (uint256 i = 0; i < _moduleAddresses.length; i++) { registerSwapModule(_moduleAddresses[i]); }
Here you could use unchecked{++i} to save gas since it is more efficient then i++. Same should be done at line 61.
#0 - tommyz7
2021-11-04T18:33:34Z
Duplicate of #63
#1 - alcueca
2021-11-06T06:31:53Z
Not a duplicate
🌟 Selected for report: pants
75.3985 USDC - $75.40
pants
The function _getTokenBalance could be set private to save gas
20.3576 USDC - $20.36
pants
At both lines 75 and 76 of Slingshot.sol trades.length is read. At line 76 it is inside a for loop that make it even worst. Caching len = trades.length and using the len instead will save gas.
#0 - tommyz7
2021-11-04T18:33:05Z
Duplicate of #63