Aave: Wind or Unwind Position
0x484428507A212cA56D71baa27Ca6089a6dB63a88

What this does

This plug winds or unwinds an Aave leveraged position in a single flash-loaned transaction. It asks the caller for supply_amount, supply_token, aave_market, borrow_amount, borrow_token, and the is_winding flag. When is_winding equals 1 it flash loans, supplies, and borrows; otherwise it flash loans, repays, and withdraws, routing tokens through the solver each way. Each branch requires the routed gain to cover the flash loan owed, so an unfunded or stale routing quote reverts the whole transaction.

Actions · 30

  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • Flash loan
    Flash loan from
    Borrows an asset from an Aave market with no collateral, repaid inside this transaction.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Supply
    Supply to
    Supplies an asset to an Aave market, minting aTokens to the wallet.
  • Borrow
    Borrow from
    Borrows an asset from an Aave market against collateral you have supplied.
  • Get address
    Get
    Holds an address as a named value that later steps reference.
  • Get token balance
    Get balance of held by
    Reads a token balance held by an address, native or ERC-20.
  • Transfer tokens
    Transfer to
    Sends a token from the socket to another address, native or ERC-20.
  • Get solution
    Get solution
    Hands tokens already transferred to the solver over for routing, then verifies the outcome.
  • Get token balance
    Get balance of held by
    Reads a token balance held by an address, native or ERC-20.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.
  • Else branch
    Else
    Opens the else branch of a conditional.
  • Flash loan
    Flash loan from
    Borrows an asset from an Aave market with no collateral, repaid inside this transaction.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Withdraw
    Withdraw from
    Withdraws a supplied asset from an Aave market back to the socket.
  • Get address
    Get
    Holds an address as a named value that later steps reference.
  • Get token balance
    Get balance of held by
    Reads a token balance held by an address, native or ERC-20.
  • Transfer tokens
    Transfer to
    Sends a token from the socket to another address, native or ERC-20.
  • Get solution
    Get solution
    Hands tokens already transferred to the solver over for routing, then verifies the outcome.
  • Get token balance
    Get balance of held by
    Reads a token balance held by an address, native or ERC-20.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.

Related plugs · 8