Loop at Target HF + Trailing Stop Loss
0x484428507A212cA56D71baa27Ca6089a6dB63a88

What this does

This plug maintains a WETH-collateralized USDC loop on Aave at 0x2f39d218133afab8f2b819b1066c7e434ad94e9e, tracking a trailing peak price and rebalancing debt toward the liquidation ceiling divided by 1.5. It reads only stored flags and live Aave reserve, oracle, and account data. It fires when supply is empty, price sets a new peak, price falls to 10 percent below the peak, or debt drifts off target, and halts otherwise. Running this by hand or on a stale price risks missing the stop or rebalancing against an outdated peak.

Actions · 67

  • Read stored value
    Read stored value of in
    Reads a stored value from the socket's persistent storage by key.
  • 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.
  • Get asset data
    Get asset data of in
    Reads an Aave reserve's live rates and token addresses, with supply and borrow APYs.
  • Get token balance
    Get balance of held by
    Reads a token balance held by an address, native or ERC-20.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Get price
    Get price of in
    Reads the price the market's own oracle assigns to an asset.
  • Get account data
    Get data in
    Reads an address's overall position in an Aave market: collateral, debt, borrow capacity, and health factor.
  • Get liquidation LTV
    Get liquidation LTV of in
    Reads the liquidation threshold of an asset in an Aave market.
  • Read stored value
    Read stored value of in
    Reads a stored value from the socket's persistent storage by key.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Calculate proportional value
    Calculate of
    Calculates a proportion of a value using percent, basis points, WAD, or RAY units.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Compare two values
    Is
    Compares two values with a chosen operator and returns a boolean.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • Supply
    Supply to
    Supplies an asset to an Aave market, minting aTokens to the wallet.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • Set stored value
    Set stored value of in to
    Writes a value to the socket's persistent storage under a scope and key.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • Set stored value
    Set stored value of in to
    Writes a value to the socket's persistent storage under a scope and key.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.
  • Predicate
    Steers control flow by comparing two values: branch, loop, or require the condition holds.
  • Set stored value
    Set stored value of in to
    Writes a value to the socket's persistent storage under a scope and key.
  • Get asset data
    Get asset data of in
    Reads an Aave reserve's live rates and token addresses, with supply and borrow APYs.
  • Get token balance
    Get balance of held by
    Reads a token balance held by an address, native or ERC-20.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Repay
    Repay to
    Repays borrowed assets to an Aave market from the socket's balance.
  • Withdraw
    Withdraw from
    Withdraws a supplied asset from an Aave market back to the socket.
  • Else branch
    Else
    Opens the else branch of a conditional.
  • 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.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Repay
    Repay to
    Repays borrowed assets to an Aave market from the socket's balance.
  • Withdraw
    Withdraw from
    Withdraws a supplied asset from an Aave market back to the socket.
  • Else branch
    Else
    Opens the else branch of a conditional.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • 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.
  • 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