Set global flag
Set global flag

Boolean · Acts onchain

Writes a boolean flag to the socket's global storage under a key. The value persists across transactions in socket-scoped storage shared by every plug the socket runs, and any later plug can read it back with the read flag action. Reach for it to record state across executions: mark that a one-time setup has run, that a position was opened, or that a threshold was crossed, so a later run can branch on it instead of repeating work.

Borrow Rate Exit Guard (WETH/USDC Loop)

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

    Reads the boolean flag exited_weth/usdc_loop from the socket's global storage so the run knows whether this loop was already closed.

  2. 2·Predicate

    Requires that flag to equal false, halting the whole plug if the position has already been exited so nothing runs against a closed loop.

  3. 3·Get asset data

    Fetches Aave reserve data for USDC at 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 in the market at 0x2f39d218133afab8f2b819b1066c7e434ad94e9e, pulling live rates and token addresses for later steps.

  4. 4·Compare two values

    Testing the value in slot 2.1.4 against 0.055, this returns true when that rate sits at or above the threshold, the borrow rate trigger for this loop.

  5. 5·Predicate

    Opening a conditional that runs when the value in slot 3.0 is true, the branch proceeds only when that trigger condition holds.

  6. 6·Get token balance

    Looks up the token balance for the token named in slot 2.1.10 held by 0x484428507A212cA56D71baa27Ca6089a6dB63a88, giving the outstanding position.

  7. 7·Set

    Stores that balance into the named variable vUSDC_debt_balance so later steps can reference it.

  8. 8·Compare two values

    Compares the vUSDC_debt against 0, returning true when the debt is above zero.

  9. 9·Predicate

    Requiring the value in slot 7.0 to be true, this proceeds only when a nonzero debt exists.

  10. 10·Set global flag

    Writes the flag from slot 0.0 to true, marking the position as exited inside this branch.

  11. 11·Get asset data

    Pulls Aave reserve data for WETH at 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, with the market wired from slot 2.1.

  12. 12·Get token balance

    Reads the token balance for the token named in slot 10.1.8 held by the address wired from slot 5.1, giving the aWETH supply position.

  13. 13·Set

    Assigns that aWETH figure to the named variable aWETH_supply_balance for the withdraw step.

  14. 14·Repay

    Repays the vUSDC_debt to the market from slot 2.1, using the debt token wired from slot 2.0.

  15. 15·Withdraw

    Withdraws the aWETH balance from step 12 as the collateral token from slot 10.0 from the market wired from slot 2.1, pulling the supplied collateral back to the socket.

  16. 16·End block

    Closes the inner conditional branch opened in step 9.

  17. 17·End block

    Closes the conditional branch opened in step 5.

Read global flag
Get asset data of in
Is
Get balance of held by
Set to
Is
Set global flag to
Get asset data of in
Get balance of held by
Set to
Repay to
Withdraw from
End block
End block
  • Borrow Rate Exit Guard (WETH/USDC Loop)

    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