Read global flag
Read global flag

Boolean · Acts onchain

Reads a boolean flag from the socket's global storage by key. The flag lives in socket-scoped storage that persists across transactions and is shared by every plug the socket runs. The read returns the committed value, so a set earlier in the same transaction is not reflected until it lands. Reach for it to coordinate plugs: read a flag another plug set, then branch on it with a predicate, so one run can mark a milestone and later runs react to it.

Strategy: Loop WETH/USDC at Target HF + Stop Loss

boolean
aave
evm
8actions
  1. 1·Read global flag

    Reads the boolean flag exited_weth/usdc_swarm from the socket's global storage so the plug knows whether the position has already been exited.

  2. 2·Predicate

    Requires that the exited flag is equal to false, halting the whole run if the position was already exited so nothing executes on a closed position.

  3. 3·Get asset data

    Fetches Aave reserve data for WETH at address 0x2f39d218133afab8f2b819b1066c7e434ad94e9e, pulling live rates and token addresses for later use.

  4. 4·Get token balance

    Reads the token balance held by 0x484428507A212cA56D71baa27Ca6089a6dB63a88 for the token identified in slot 2.1.8, which comes from the WETH reserve data just read.

  5. 5·Get asset data

    Pulls Aave reserve data for USDC, with the reserve target wired from slot 2.1 rather than a fixed address.

  6. 6·Use

    Composes the sub-plug Supply if aToken Balance is 0, which supplies only when no aToken position exists yet.

  7. 7·Use

    Runs the sub-plug Wind or Unwind to Maintain Target HF, adjusting leverage to hold the health factor at its target.

  8. 8·Use

    Executes the sub-plug Stop Loss to unwind the position if the loss threshold is hit.

Read global flag
Get asset data of in
Get balance of held by
Get asset data of in
Use where
supply_tokenis
aave_marketis
holder_walletis
supply_amountis
Use where
aave_marketis
supply_tokenis
target_health_factoris
borrow_tokenis
Use where
supply_tokenis
aave_marketis
holder_walletis
stop_loss_priceis
global_flag_keyis
borrow_tokenis
  • Strategy: Loop WETH/USDC at Target HF + Stop Loss

    boolean
    aave
    evm
  • Borrow Rate Exit Guard (WETH/USDC Loop)

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

    boolean
    aave
    evm
  • Stop Loss (WETH/USDC Loop)

    boolean
    aave
    evm
  • Take Profit (WETH/USDC Loop)

    boolean
    aave
    evm
  • Trailing Stop Loss (WETH/USDC Loop)

    boolean
    aave
    evm

On other protocols · 1