Cheery Holographic Swift
Medium
The AmirX::defiToStablecoinSwap()
function updates the ss.oAmount
after verifying minimum burn limit. Therefore, stable coins can be burnt below the minimum limit.
The AmirX::defiToStablecoinSwap() updates the ss.oAmount
after verifying minimum burn limit as follows.
function defiToStablecoinSwap(
address wallet,
StablecoinSwap memory ss,
DefiSwap memory defi
) external payable onlyRole(SWAPPER_ROLE) whenNotPaused {
// checks if defi will fail
_verifyDefiSwap(wallet, defi);
// checks if stablecoin swap will fail
119: _verifyStablecoinSwap(wallet, ss);
//check balance to adjust second swap
uint256 iBalance = ERC20(ss.origin).balanceOf(wallet);
_defiSwap(wallet, defi);
uint256 fBalance = ERC20(ss.origin).balanceOf(wallet);
125: ss.oAmount = fBalance - iBalance;
//change balance to reflect change
_stablecoinSwap(wallet, ss);
}
As shown above, the function updates ss.oAmount
as the difference in the wallet's origin
balance at line 125.
However, ss.oAmount
was already verified at the following _verifyStablecoinSwap() on line 119.
function _verifyStablecoinSwap(
address wallet,
StablecoinSwap memory ss
) internal view nonZero(ss) {
------ SKIP ------
// Ensure the total supply does not drop below the minimum limit after burning the specified amount.
if (
205: Stablecoin(ss.origin).totalSupply() - ss.oAmount <
getMinLimit(ss.origin)
) revert InvalidMintBurnBoundry(ss.origin, ss.oAmount);
------ SKIP ------
}
As a result, the condition on line 205 is bypassed.
No response
No response
- Suppose that total supply of
ss.origin
is2 ether
and the minimum burn limit ofss.origin
is1 ether
. - A user calls
AmirX::defiToStablecoinSwap()
withss.oAmount = 1 ether
. ss.oAmount
is updated to2 ether
at line 125.- As a result of the tx, total supply of
ss.origin
will drop to zero which is less than the minimum burn limit.
Broken functionality as the stable coins can be burnt below the minimum limit set by the admin.
No response
Verify stable swap parameters after updating the ss.oAmount
.