The DSCEngine
contract overcalculates the collateral when operating with fee-on-transfer tokens, which can lead to too many DSC
tokens being minted.
The competition description mentions that while the first use-case for the system will be a WETH/WBTC backed stablecoin, the system is supposed to generally work with any collateral tokens. If one or more collateral tokens are fee-on-transfer tokens, i.e., when transferring X
tokens, only X - F
tokens arrive at the recipient side, where F
denotes the transfer fee, depositors get credited too much collateral, meaning more DSC
tokens can get minted, which leads to a potential depeg.
The root cause is the depositCollateral
function in DSCEngine
:
As can be seen in line
the contract assumes that the full amountCollateral
is received, which might not be the case with fee-on-transfer tokens.
When the contract operates with fee-on-transfer tokens as collateral, too many DSC
tokens can get minted based on the overcalculated collateral, potentially leading to a depeg.
None
Check the actual amount of received 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.