Because of a rounding error in the mint(), burn() and swap() function in the SmartVaultV3.sol contract, we can borrow and redeem assets without having to pay fees.
The burn and mint functions both calculate the fee in the same manner:
uint256 fee = _amount * ISmartVaultManagerV3(manager).mintFeeRate() / ISmartVaultManagerV3(manager).HUNDRED_PC();
If the product of amount * mintFeeRate()
is strictly smaller than HUNDRED_PC(100_000)
the fee
will be 0. The fee can be changed but is currently set at 500.
So by doing an equation we can figure out what is the maximum amount we can get away with without paying a fee.
So while amount is smaller than 200 we won't be charged any fee for minting or burning.
Here below is a Foundry test that simulates the fee calculation, the function has been modified to only portray the fee, but the logic remains the same.
The log :
indicates that the fee will be indeed 0
The impact is quite severe as users theoretically don't have to pay any fees to the protocol and can borrow EUROs
for "free".
Foundry
Critical thinking
In order to mitigate this issue, a minimum burn
and mint
amount should be imposed.
Please do the same for the burn()
and swap() functions.
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.