Brilliant Cotton Puma
High
Whenever a stablecoin swap occurs it is validated that the total supply of the token, which is getting burned, is not less than a minimum value. The issue is that this validation can be bypassed, whenever a stabelcoin swap occurs through AmirX.
In the swap
and defiToStablecoinSwap
functions of AmirX the _verifyStablecoinSwap
is called at the beginning of the function, with the ss.oAmount
supplied by the swapper. However, ss.oAmount
is later changed:
if (fBalance - iBalance != 0) ss.oAmount = fBalance - iBalance;
Thus, if the new value is more than the initial, the total supply of the origin stablecoin may be less than the getMinLimit(ss.origin)
.
No response
No response
- The minimum total supply of the origin token is 1e18, and the current total supply is 2e18
- A swapper calls
swap
, setting thess.oAmount
to 0.5e18, passing the validation in_verifyStablecoinSwap
- However, the
ss.oAmount
increases to 1.1e18, causing the total supply of the origin token to be less than the minimum limit
A stabelcoin's total supply goes below the minimum limit, which should never happen.
No response
Call _verifyStablecoinSwap
after ss.oAmount
has been updated.