FlashSwapExecutorV2
Write Methods
runFlashSwap
solidity
function runFlashSwap(
address vault,
DataTypes.BorrowParams calldata borrowParams,
uint256 swapAmountOut,
address borrower
) external
FlashSwapExecutorV2.sol uses a Uniswap Pair to make a Flash swap. The borrower calls the runFlashSwap to take a loan using leverage. This internally calls the createLoan to deploy a loan using the flash-swapped collateral asset. There's a fee associated with the Flashswap. The fee is paid using the borrowed asset after the loan is created.
Parameters
Name | Type | Description |
---|---|---|
vault | address | The address of vault from which borrower wants to borrow |
borrowParams | BorrowParams | The borrow params set by the borrower |
swapAmountOut | uint256 | The amount of collateral for which the borrower wants to take a flashswap |
borrower | address | Address of the borrower |
repayWithSwap
solidity
function repayWithSwap(ILoan loan, uint256 repayAmt) external
Borrower calls the repayWithSwap to repay a loan using leverage. This internally calls the repay function on the Loan contract. The fee associated with the flashswap is paid from the collateral that the borrower receives back.
Parameters
Name | Type | Description |
---|---|---|
loan | ILoan | The loan which must be repaid |
repayAmt | uint256 | The repay amount |