Set global flag

Set global flag on Boolean

Ethereum
Ethereum
Base
Base

Acts onchain

Ready to run on Base

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.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

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 has already been closed.

  2. 2·Predicate

    Requiring that flag to equal false, this halts the entire plug when 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

    Testing whether the value in slot 2.1.4 is greater than or equal to 0.055, this returns true when the USDC borrow rate has reached the exit trigger.

  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 climbed to the threshold.

  6. 6·Get token balance

    Looks up the token balance for the token named in slot 2.1.10 held by your wallet, giving the outstanding USDC debt.

  7. 7·Set

    Stores that debt figure into the named variable vUSDC_debt_balance so the repay step can reference it.

  8. 8·Compare two values

    Comparing the vUSDC debt from slot 6.0 against 0, this returns true when debt is still outstanding.

  9. 9·Predicate

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

  10. 10·Set global flag

    Writes the exited_weth/usdc_loop 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 figure 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 debt token from step 2.

  15. 15·Withdraw

    Withdraws the aWETH balance from slot 12.0 as the collateral token from step 10 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

More plugs on Base

Dollar-cost average on Base · 4 plugs

Posts · 1

More on Boolean · 4

On other protocols · 1