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: 9/16
Findings: 2
Award: $588.84
π Selected for report: 0
π Solo Findings: 0
π Selected for report: WatchPug
Also found by: daejunpark, gpersoon, hickuphh3, kenzo, pmerkleplant
588.8441 USDC - $588.84
gpersoon
The function executeTrades() of Slingshot.sol calulates the initialBalance and finalBalance in a different way. If toToken == nativeToken then:
This could lead to different problems:
Possible solutions:
Calculate initialBalance in the same way as finalBalance: if (toToken == nativeToken) { initialBalance = _getTokenBalance(address(wrappedNativeToken)); } else { initialBalance = _getTokenBalance(toToken); }
Sum the amount of nativeToken and wrappedNativeToken:
function _getTokenBalance(address token) internal view returns (uint256 balance) {
if (token == nativeToken) {
balance = address(executioner).balance;
token = address(wrappedNativeToken);
}
balance += IERC20(token).balanceOf(address(executioner));
}
Ignore the initialBalance because the executioner isn't supposed to have any tokens anyway
#0 - tommyz7
2021-11-03T14:29:49Z
good finding, however, I disagree on risk. No user funds are at risk. This is medium riks.
#1 - alcueca
2021-11-06T06:05:13Z
Griefing attacks are severity 2