The calculateDustAmount() function fails to account for assets held in the Curve Vault, preventing dust recovery when the vault is enabled.
The RToken::calculateDustAmount() function calculates dust as the difference between the contract's balance and total obligations to token holders. However, it only checks the balance in the RToken contract itself:
The issue is that when the Curve Vault is enabled, 80% of assets are held in the vault while only 20% remain in the RToken contract. Since calculateDustAmount
only checks the RToken contract's balance, it will almost always return 0 as the contract balance will be less than total obligations.
Users deposit 100 tokens into the protocol
80 tokens are moved to Curve Vault, 20 remain in RToken contract
Some dust accumulates in the system
calculateDustAmount()
is called:
Contract balance = 20 tokens
Total obligations = 100 tokens
Returns 0 since 20 < 100
transferAccruedDust()
reverts with NoDust()
error
Dust remains trapped in the protocol
Dust cannot be recovered from the protocol when the Curve Vault is enabled
Dust accumulates without a way to be withdrawn
The transferAccruedDust
function becomes effectively unusable
Include Vault Balance
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.