From 7fa8c1e605b3adf7663971e11d9464f8ef64d589 Mon Sep 17 00:00:00 2001 From: ckoopmann Date: Thu, 12 Dec 2024 13:53:45 +0800 Subject: [PATCH] Allow use of leftover component dust in FlashMintWrapped issuance --- contracts/exchangeIssuance/FlashMintWrapped.sol | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/contracts/exchangeIssuance/FlashMintWrapped.sol b/contracts/exchangeIssuance/FlashMintWrapped.sol index a4c44da8..129c06a4 100644 --- a/contracts/exchangeIssuance/FlashMintWrapped.sol +++ b/contracts/exchangeIssuance/FlashMintWrapped.sol @@ -686,9 +686,6 @@ contract FlashMintWrapped is Ownable, ReentrancyGuard { continue; } - // snapshot balance of required component before swap and wrap operations - uint256 componentBalanceBefore = IERC20(_requiredComponents[i]).balanceOf(address(this)); - // swap input token to underlying token _swapToExact( _inputToken, // input @@ -708,11 +705,7 @@ contract FlashMintWrapped is Ownable, ReentrancyGuard { ); } - // ensure obtained component amount covers required component amount for issuance - // this is not already covered through _swapToExact because it does not take wrapping into consideration - uint256 componentBalanceAfter = IERC20(_requiredComponents[i]).balanceOf(address(this)); - uint256 componentAmountObtained = componentBalanceAfter.sub(componentBalanceBefore); - require(componentAmountObtained >= requiredAmount, "FlashMint: UNDERBOUGHT_COMPONENT"); + require(componentBalanceAfter >= requiredAmount, "FlashMint: INSUFFICIENT_COMPONENT_BALANCE"); } // ensure left over input token amount covers issuance for component if input token is one of the Set components