When a vault owner mints EUR tokens the minted amount is incremented with the fee.
When burning token the minted amount is only decremented with the amount, not including the fee. This results in left over minted amount, and then can result in undercollateralised Vault. Resulting in liquidation
The user just added 1_105_500 EUR collateral to the vault.
MaxMintable returns the following formula:
$ M = \frac{Ec \times P}{Cr}$
M: The Max Mintable amount
Ec: Total Euro Collateral of the vault
P: HUNDRED_PC, which is 100,000 or 1e5
Cr: Collateral Rate of the vault, which is set to 110_000
$ \frac{1105500 \times 100000}{110000} = 1005000$
The user then mints 1M EUR tokens
This results in a fee of 5K EUR tokens resulting in minted
as the MaxMintable()
value of 1_005_000 (this value is important).
During Bear Market the collateral token loses 80% value
eurCollateral()
now returns a collateral value of 221_100 EUR.
This results in a MaxMintable
value of 201_000
$ {1000000 - 201000} = 799000$ Eur tokens to burn
The Vault owner response is quick and burns 799_000 EUR tokens to have a possitive collateral value.
As the Vault owner burns the 799000 amount, the vault still got liquidated. This is how it happened:
The burn function burns from the minted
amount. This value was 1_005_000
$ {1005000 - 799000} = 206000$ as the minted
value.
206_000 is 5000 larger than the MaxMintable
value of 201_000.
This comes from the fee that is extra minted during mint, but not burned when calling burn. So the Vault has a higher value than the MaxMintable
value, resulting in liquidation of the vault.
The incorrect accounting of the minted amount can result in undercollateralization of the Vault, leading to potential liquidation and loss of funds.
Manual Review
To mitigate this issue, it is recommended to stay consistent with the fee when minting and burning tokens. The system should accurately track the minted amount by considering the fee in both minting and burning processes.
This code example adjusts the minting process to deduct the fee from the minted amount, ensuring accurate accounting.
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.