Stop Loss (WETH/USDC Loop)
0x484428507A212cA56D71baa27Ca6089a6dB63a88

What this does

This plug unwinds a leveraged WETH/USDC position on the Aave market at 0x2f39d218133afab8f2b819b1066c7e434ad94e9e by repaying outstanding USDC debt and withdrawing aWETH collateral to the socket. It reads reserve data, the aWETH balance, and the vUSDC debt for the account at 0x484428507A212cA56D71baa27Ca6089a6dB63a88. It fires only when the exited_weth/usdc_loop flag is false, a supply position exists, and the oracle WETH price is at or below 2000, then sets the flag true. Doing this by hand or on a stale price risks missing the stop level and holding losses.

Actions · 17

  • Read global flag
    Read global flag
    Reads a boolean flag from the socket's global storage by key.
  • 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.
  • 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 price
    Get price of in
    Reads the price the market's own oracle assigns to an asset.
  • 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.
  • Set global flag
    Set global flag to
    Writes a boolean flag to the socket's global storage under a 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.
  • End block
    End block
    Closes the innermost open block, whether a conditional branch or a loop.

Related plugs · 8