If the collateralToken is a fee-on-transfer token, the actual amount received by the contract will be less than the amount sent by the user. This can lead to incorrect accounting, failed transactions, or loss of funds.
Some tokens deduct a fee during transfers, meaning the actual amount received by the contract is less than the amount sent.
Some tokens automatically adjust balances (e.g., staking rewards or inflationary tokens).
Some tokens do not follow the ERC20 standard (e.g., missing return values or non-boolean return values).
PoC to demonstrate
Deploy the FeeOnTransferToken contract with a fee (e.g., 1%).
Deploy the PerpetualVault contract, passing the address of the FeeOnTransferToken contract.
Approve the PerpetualVault contract to spend tokens on behalf of the user.
Call the deposit function on the PerpetualVault contract with an amount (e.g., 100 ether).
Observe that the totalDepositAmount is less than the expected amount due to the fee.
The contract may miscalculate balances, leading to incorrect accounting or failed transactions.
The contract may not account for balance changes, leading to incorrect calculations.
Users may lose funds due to the fee, and the contract may not account for it correctly.
The contract expects a specific amount but receives less due to the fee, transactions may fail.
Manual code review
Clearly document the types of tokens supported by the contract and warn users about unsupported tokens.
Use slippage protection for swaps to account for unexpected token behavior (e.g., fee-on-transfer tokens).
Restrict the contract to work only with standard ERC20 tokens that follow the specification strictly.
Check token balances before and after transfers to account for fee-on-transfer tokens or rebasing tokens.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.