This plug rebalances a socket's Aave position toward a debt target set by the collateral's liquidation LTV divided by a chosen health factor. It asks the caller for the Aave market, the supply_token used as collateral, the borrow_token, and the target_health_factor. When current debt exceeds target it repays borrow_token and withdraws supply_token, otherwise it supplies supply_token and borrows borrow_token to lever up. Acting on a stale oracle price or LTV missizes the repay, withdraw, supply, or borrow amounts.
Actions · 23
Getdatain
Reads an address's overall position in an Aave market: collateral, debt, borrow capacity, and health factor.
Getpriceofin
Reads the price the market's own oracle assigns to an asset.
GetliquidationLTVofin
Reads the liquidation threshold of an asset in an Aave market.
Calculateof
Calculates a proportion of a value using percent, basis points, WAD, or RAY units.
Setto
Assigns a value to a named variable that later steps reference.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Setto
Assigns a value to a named variable that later steps reference.
Is
Compares two values with a chosen operator and returns a boolean.
Steers control flow by comparing two values: branch, loop, or require the condition holds.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Setto
Assigns a value to a named variable that later steps reference.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Setto
Assigns a value to a named variable that later steps reference.
Repayto
Repays borrowed assets to an Aave market from the socket's balance.
Withdrawfrom
Withdraws a supplied asset from an Aave market back to the socket.
Else
Opens the else branch of a conditional.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Setto
Assigns a value to a named variable that later steps reference.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Setto
Assigns a value to a named variable that later steps reference.
Supplyto
Supplies an asset to an Aave market, minting aTokens to the wallet.
Borrowfrom
Borrows an asset from an Aave market against collateral you have supplied.
Endblock
Closes the innermost open block, whether a conditional branch or a loop.
Related plugs · 8
Not ready to run as it stands: it waits on values or a position of your own.