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 can tell whether this loop was already closed.

  2. 2·Predicate

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

  3. 3·Get asset data

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

  4. 4·Compare two values

    Comparing the value in slot 2.1.4 against 0.055, this returns true when the USDC borrow rate is at or above the exit threshold.

  5. 5·Predicate

    Opening a conditional that runs when the comparison in slot 3.0 is true, the branch fires only when the borrow rate has reached the threshold.

  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 USDC debt.

  7. 7·Set

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

  8. 8·Compare two values

    Testing whether the USDC debt from slot 6.0 is greater than 0, this returns true when debt is outstanding.

  9. 9·Predicate

    Gating on the stored comparison in slot 7.0, the branch runs only when debt exists.

  10. 10·Set global flag

    Writes the flag from slot 0.0 to true, marking the loop 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 so it matches the USDC reserve's market.

  12. 12·Get token balance

    Reading the token balance for the token named in slot 10.1.8 held by the address wired from slot 5.1, this gives the aWETH supply position.

  13. 13·Set

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

  14. 14·Repay

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

  15. 15·Withdraw

    Withdraws the aWETH balance from slot 12.0 as WETH collateral from the market wired from slot 2.1, pulling the supplied position 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
  • Take Profit (WETH/USDC Loop)

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

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

    boolean
    aave
    evm

On other protocols · 1