Supply
Supply

Aave · Acts onchain

Supplies an asset to an Aave market, minting aTokens to the wallet. The socket approves the pool and deposits the amount on the wallet's behalf; the aToken balance then accrues the supply rate every block and can be enabled as collateral. Reach for it to earn yield on idle balance, to post collateral before a borrow, or as the second half of a loop where borrowed funds are swapped and supplied again in the same transaction. Follow it with the collateral status action when the deposit needs to back a borrow.

Aave: Wind or Unwind Position

plug
boolean
aave
36actions
  1. 1·Take

    Declaring supply_amount as a caller parameter, this takes the collateral figure supplied at execution time.

  2. 2·Take

    Taking supply_token from the caller names the collateral asset the flow acts on.

  3. 3·Take

    Resolving aave_market as a caller parameter binds every Aave action here to one market.

  4. 4·Take

    Next borrow_amount is declared, the caller-supplied figure sizing the debt leg.

  5. 5·Take

    Rounding out the assets, borrow_token is taken from the caller, naming the debt asset.

  6. 6·Take

    Finally is_winding is declared as a caller parameter, the flag that picks between the wind and unwind paths.

  7. 7·Predicate

    An if opens on is_winding equaling 1 (true), routing into the wind branch only when the caller set the flag.

  8. 8·Flash loan

    On the wind side, a flash loan pulls the supply_amount of supply_token from aave_market, repaid within this transaction.

  9. 9·Set

    The repayment obligation returned by that flash loan is saved into wind_loan_owed for the coverage check below.

  10. 10·Supply

    Supplying the supply_amount of supply_token to aave_market mints aTokens to the socket as collateral.

  11. 11·Borrow

    Against that collateral, the borrow_amount of borrow_token is borrowed from aave_market.

  12. 12·Get address

    Holding the solver address as a named value sets the destination for the transfer that follows.

  13. 13·Get token balance

    Reading the supply_token balance held by 0x4844...3a88 captures the holding before routing begins.

  14. 14·Transfer tokens

    Sending the borrow_amount of borrow_token to the solver hands the borrowed funds over for routing.

  15. 15·Get solution

    The solver takes the transferred tokens for routing, then the outcome is verified.

  16. 16·Get token balance

    After routing, the supply_token balance held by 0x4844...3a88 is read again.

  17. 17·Calculate

    Subtracting the pre-routing balance from the post-routing balance measures how much supply_token routing produced.

  18. 18·Compare two values

    Comparing that gain against wind_loan_owed tests whether it is greater than or equal to the loan owed.

  19. 19·Predicate

    A require enforces that comparison be true, aborting if the gain fails to cover wind_loan_owed.

  20. 20·End block

    Closing the innermost open block ends the wind coverage check.

  21. 21·End block

    Ending the next open block closes the wind branch.

  22. 22·Else branch

    Else opens the path taken when is_winding was not 1, the unwind side.

  23. 23·Flash loan

    On unwind, a flash loan pulls the borrow_amount of borrow_token from aave_market, repaid within this transaction.

  24. 24·Set

    The repayment obligation returned by that flash loan is saved into unwind_loan_owed for the coverage check below.

  25. 25·Withdraw

    Using the flash-loaned funds, the supply_amount of supply_token is withdrawn from aave_market back to the socket.

  26. 26·Get address

    Holding the solver address as a named value sets the destination for the transfer that follows.

  27. 27·Get token balance

    Reading the borrow_token balance held by 0x4844...3a88 captures the holding before routing begins.

  28. 28·Transfer tokens

    Sending the supply_amount of supply_token to the solver hands the withdrawn collateral over for routing.

  29. 29·Get solution

    The solver takes the transferred tokens for routing, then the outcome is verified.

  30. 30·Get token balance

    After routing, the borrow_token balance held by 0x4844...3a88 is read again.

  31. 31·Calculate

    Subtracting the pre-routing balance from the post-routing balance measures how much borrow_token routing produced.

  32. 32·Compare two values

    Comparing that gain against unwind_loan_owed tests whether it is greater than or equal to the loan owed.

  33. 33·Predicate

    A require enforces that comparison be true, aborting if the gain fails to cover unwind_loan_owed.

  34. 34·End block

    Closing the innermost open block ends the unwind coverage check.

  35. 35·End block

    Ending the next open block closes the else branch.

  36. 36·End block

    Closing the remaining open block completes the composed wind-or-unwind transaction.

Take
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
Else
Flash loan from
Set to
Withdraw from
Get
Get balance of held by
Transfer to
Get solution
Get balance of held by
Calculate
Is
End block
End block
End block
  • Aave: Wind or Unwind Position

    plug
    boolean
    aave
  • Wind

    plug
    aave
    evm
  • Supply if a Token Balance Is 0

    plug
    aave
    evm
  • Wind or Unwind to Maintain Target HF

    plug
    aave
    math
  • Supply Idle Balance Weekly

    time
    evm
    boolean
  • Borrow + Weekly Repayments

    time
    aave
    evm
  • Loop at Target HF + Borrow Rate Entry & Exit Guard

    aave
    boolean
    evm
  • Loop WETH/USDC at Target HF

    aave
    evm
    boolean
  • Borrow + Term Repayment Schedule

    time
    database
    boolean
  • Loop at Target HF + Borrow Rate Exit Guard

    database
    boolean
    aave
  • Loop at Target HF + Trailing Stop Loss

    database
    boolean
    aave
  • Swarm: Loop WETH/USDC at Target HF

    boolean
    aave
    evm

On other protocols · 4