Platform: Code4rena
Start Date: 24/06/2021
Pot Size: $80,000 USDC
Total HM: 18
Participants: 12
Period: 7 days
Judge: cemozer
Total Solo HM: 11
Id: 16
League: ETH
Rank: 9/12
Findings: 3
Award: $1,362.16
π Selected for report: 1
π Solo Findings: 0
152.8313 USDC - $152.83
s1m0
The smart contract doesn't check the return value of token.transfer() and token.transferFrom(), some erc20 token might not revert in case of error but return false. In the TracerPerpetualSwaps:deposit and Insurance:deposit this would allow a user to deposit for free. Other places: TracerPerpetualSwaps: withdraw TracerPerpetualSwaps:withdrawFees SafetyWithdraw:withdrawERC20Token Insurance:withdraw
Wrap the call into a require() or use openzeppelin's SafeERC20 library.
s1m0
The smart contract doesn't behave correctly if deployed with token that have decimals > 18.
The functions tokenToWad and wadToToken revert if the tokenDecimals is > 18. These functions are called in critical places like deposit() and withdraw.
Consider checking in the constructor that _tokenDecimals is <= 18.
#0 - raymogg
2021-07-05T06:41:54Z
Duplicate of #116
#1 - loudoguno
2021-08-24T16:35:37Z
changed risk from 1 to 2 as per judges sheet
s1m0
The chainId for eip-712 signature is hardcoded in the code, in case of a hard fork the contract would exist on both the chains which make signature replay possible between them.
The most efficient mitigation is to use a cachedDomainSeparator to not recompute it every time but only check the current block.chainid with a cachedChainId, you can follow the openzeppelin's implementation
#0 - raymogg
2021-07-05T06:38:25Z
Duplicate of #67