Skip to content

Commit

Permalink
add comment re swapper calls
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdapper committed Mar 13, 2023
1 parent b763be2 commit 3932609
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/solady
4 changes: 4 additions & 0 deletions src/Unwind.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ contract Unwind is IFlashLoanRecipient, IFlashLoanSimpleReceiver {
// swap the collateral for debt token
uint totalRepay = _flashBorrowedAmount + _flashBorrowFee;
ERC20(_collToken).safeApprove(_swapper, _collToWithdraw);
// VERY open. Make sure you don't leave any pending token approvals
// credit delegations or tokens on this contract.
// Revoke after use or approve only required amounts that will
// exhaust all of the approved amount.
(bool success, ) = _swapper.call(_swapData);
if (ERC20(_debtToken).balanceOf(address(this)) < totalRepay)
revert InsufficientOutput(
Expand Down

0 comments on commit 3932609

Please sign in to comment.