User depositing a fee-on-transfer (FoT) token to its account will see its account credited with the complete amount, while it should only be credited by amount - fee
, as the protocol will not receive the fee
part.\
This is also the case for stETH because of its 1-2 wei corner case even though here amount are less, this will still break the accounting.
The TradingAccountBranch::depositMargin
function allow users to deposit tokens to an account.
The function takes an amount
parameter which is then converted to the protocol decimal system L328
as amountX18
The issue happen L346
and L349
.
For FoT tokens, The safeTransferFrom
will decrease user balance by amount
, but the recipient will receive amount - fee
Then, tradingAccount is credited with amountX18
which do not take the fee
into account.
Wrong accounting of protocol owned assets compared to users balances.
Manual review
Credit the real received amount to the user rather than the raw amount.
This can be done by measuring contract balance before and after the transfer, and credit the difference.
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.