Flash loan
Flash loan

Aave · Acts onchain

Borrows an asset from an Aave market with no collateral, repaid inside this transaction. The action opens a block: the steps inside it spend the borrowed funds, and before the block ends the socket must hold the principal plus Aave's flash premium, surfaced as the owed output, or the whole transaction reverts. Approval for the repayment is handled here. Reach for it to refinance debt between markets without capital, to unwind a leveraged position by repaying before withdrawing collateral, or to fund an arbitrage across venues. Coil owed into a comparison so a predicate requires the balance covers it before the block closes.

Wind

plug
aave
evm
19actions
  1. 1·Take

    Declares supply_amount as a caller-supplied parameter, the quantity to be supplied.

  2. 2·Take

    Declares supply_token as a caller-supplied parameter, naming the asset to supply.

  3. 3·Take

    Names aave_market as a caller-supplied parameter identifying the market used throughout.

  4. 4·Take

    Adds borrow_amount as a caller-supplied parameter, the quantity to borrow.

  5. 5·Take

    Rounds out the inputs with borrow_token as a caller-supplied parameter, the asset to borrow.

  6. 6·Flash loan

    Takes a flash loan of [supply_amount] in [supply_token] from [aave_market], to be repaid within this same transaction.

  7. 7·Set

    Saves the flash loan repayment obligation from slot 5.5 into wind_loan_owed for a later check.

  8. 8·Supply

    Supplies [supply_amount] of [supply_token] into [aave_market], minting aTokens to the socket as collateral.

  9. 9·Borrow

    Borrows [borrow_amount] of [borrow_token] from [aave_market] against the collateral just supplied.

  10. 10·Get address

    Loads the solver address into a named value for use as a transfer destination.

  11. 11·Get token balance

    Reads the [supply_token] balance held by 0x4844...3a88 before routing.

  12. 12·Transfer tokens

    Sends [borrow_amount] of [borrow_token] to [the solver] to be routed.

  13. 13·Get solution

    Hands the transferred tokens to the solver for routing, then verifies the outcome.

  14. 14·Get token balance

    Reads the [supply_token] balance held by 0x4844...3a88 again after routing.

  15. 15·Calculate

    Subtracts the pre-routing balance in slot 10.1 from the post-routing balance in slot 13.1 to measure how much [supply_token] was gained.

  16. 16·Compare two values

    Checks whether that gain is greater than or equal to wind_loan_owed.

  17. 17·Predicate

    Requires that comparison to hold true, aborting the transaction if the gain does not cover the loan owed.

  18. 18·End block

    Closes the innermost open block.

  19. 19·End block

    Closes the remaining open block.

Take
Take
Take
Take
Take
Flash loan from
Set to
Supply to
Borrow from
Get
Get balance of held by
Transfer to
Get solution
Get balance of held by
Calculate
Is
End block
End block
  • Aave: Wind or Unwind Position

    plug
    boolean
    aave
  • Wind

    plug
    aave
    evm
  • Unwind

    plug
    aave
    evm

On other protocols · 2