Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of leftover component dust in FlashMintWrapped issuance #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading