Skip to content

Commit

Permalink
Allow use of leftover component dust in FlashMintWrapped issuance
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoopmann committed Dec 12, 2024
1 parent 67b7445 commit 7fa8c1e
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions contracts/exchangeIssuance/FlashMintWrapped.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7fa8c1e

Please sign in to comment.