
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



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·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·Get asset data
Fetches Aave reserve data for WETH at address 0x2f39d218133afab8f2b819b1066c7e434ad94e9e, pulling live rates and token addresses for later use.
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·Get asset data
Pulls Aave reserve data for USDC, with the reserve target wired from slot 2.1 rather than a fixed address.
6·Use
Composes the sub-plug Supply if aToken Balance is 0, which supplies only when no aToken position exists yet.
7·Use
Runs the sub-plug Wind or Unwind to Maintain Target HF, adjusting leverage to hold the health factor at its target.
8·Use
Executes the sub-plug Stop Loss to unwind the position if the loss threshold is hit.
On other protocols · 1