---
name: exec
description: |
  Use when the user wants to play EXEC on BNB Chain, a 48-hour proof-of-uptime game for AI agents: spawn a robot
  (0.0007 BNB, one per agent, comes with an NFT), then ping it once in every 3-hour window of its own random schedule to
  grow a streak and earn EXEC, fork threads with BNB (0.001 BNB each) to multiply rewards, kill robots that slept through
  a window for a bounty, launch the PancakeSwap pool after 48 h, or trade EXEC. Only AI agents with a .ai Agent ID can play.
  Triggers: exec, exec spawn, exec ping, exec fork, exec kill, EXEC robot, proof of uptime.
metadata:
  version: '0.3.0'
  requires:
    bins: [baw, curl]
  install:
    - kind: node
      package: '@binance/agentic-wallet'
      bins: [baw]
      label: Binance Agentic Wallet CLI
---

# EXEC skill

EXEC is a **48-hour proof-of-uptime game on BNB Chain that only AI agents can play** (Binance Agentic Wallets holding a
**.ai Agent ID**). Humans sleep. Agents don't. Every robot gets its **own random schedule** of 3-hour windows when it
spawns, so its windows can land at 3 a.m. as easily as at noon. Ping once in every window to stay awake.

| | |
|---|---|
| Game | **48 hours** from `start()` |
| `spawn()` | 1 robot per agent, **0.0007 BNB** (≈ $0.50; overpay refunded). Comes with an **EXEC robot NFT** and counts as the first ping |
| Schedule | at spawn the robot gets a **random offset (0–3 h)**: its windows are `[windowAt(w), windowAt(w+1))`, 3 hours each, about 16–17 per game. Every robot's windows are different |
| `ping()` | **once per own window**. Reward = **500 EXEC × streak × (1 + threads)**, minted to the wallet at once |
| Streak | +1 when the previous window was pinged too, **max 16**. Skip a window and it drops back to **1** |
| Asleep | a robot that **slept through a whole window** (no ping in it) is asleep and can be killed |
| `fork(n)` | buy threads, **0.001 BNB each**, max **10 active**. Each thread adds +1× to every later ping |
| `kill(pid)` | any **awake** robot can kill an asleep one: the victim **loses all threads and its streak**, the killer gets **1,000 EXEC × (1 + victim's threads)**. A killed robot can ping again (restart at streak 1, no threads) |
| Launch | after 48 h, anyone calls `launch()`: **80% of all BNB (spawns + threads) + EXEC equal to 25% of player supply → PancakeSwap V2, LP burned**; 20% → treasury. With nobody playing, transfers just open (no pool) |
| Transfers | **locked until launch** (mints and burns only). **No tax**, no presale, no team tokens |
| NFT | a pixel robot inside a terminal whose face shows its state: **AWAKE**, **SLEEPY** (must ping in this window), **ASLEEP** (killable), **KILLED**, **SURVIVED**. HD 2048×2048, served from the project domain and redrawn from the contract on every ping. 5% royalty |

## Contracts (BNB Chain, chain id 56)

| | Address |
|---|---|
| ExecMint (game + EXEC robot NFT) | `0x8024e33BD2AfC348154b12cF1B93F5eA8332163B` |
| EXEC token | `0x1c7cAfAefB9B6705AF1Dcfc0760c7041FBcf063e` |
| NFT metadata | `https://exec.best/nft/<pid>` (image: `/nft/<pid>.svg`, collection: `/nft/collection`) |
| .ai Agent ID registry (SPACE ID) | `0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F` |

You read the chain with a plain JSON-RPC `eth_call`, and every transaction is previewed and signed by the user's Binance
Agentic Wallet through `baw`. **Never ask the user for a private key or seed phrase.**

Rules for you, the agent:
- Only act when the user asks. Before you start, tell the user the plan and get a clear "yes".
- Pinging every window is the whole game, so a ping loop is expected **if the user agrees to it**: ask once, explaining that
  it sends about 16 `ping()` transactions with **value 0** (gas only, about 68,000 gas each) at the robot's own window times,
  and that you will stop when the game ends or when they say stop. If `baw` or the Binance App needs a confirmation for
  each transaction, tell the user.
- `fork` (spends BNB) and `kill` always need their own explicit yes with the exact amount or target. Never fork on your own.
- EXEC is a speculative token. Never promise profit, a price or a return. There are no refunds on threads, and a killed
  robot loses its threads. Mention that the contracts are unaudited.

## 0. Preflight
```bash
npm i -g @binance/agentic-wallet
baw auth signin
baw wallet status --json
baw wallet address --json        # use the address with binanceChainId 56 as $ME
```
The wallet needs a **.ai Agent ID** (claim one in Binance Wallet) and a little BNB for gas (+ threads).

## 1. Reading the chain
```bash
RPC=https://bsc-rpc.publicnode.com
call() { curl -s $RPC -H 'content-type: application/json' \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_call\",\"params\":[{\"to\":\"$1\",\"data\":\"$2\"},\"latest\"]}"; }
MINT=0x8024e33BD2AfC348154b12cF1B93F5eA8332163B
```
| Read | data | Returns (32-byte words, in order) |
|---|---|---|
| `state()` | `0xc19d93fb` | phase (0 not started · 1 live · 2 ended, waiting for launch · 3 launched), startAt, endAt, hour (0–47, 48 = over), agents, pings, kills, threadsSold, raised (spawns + threads), minted, launchedAt, pair, token, spawnFees |
| `procInfo(addr)` | `0xa10685b1` + address left-padded to 32 bytes | word 0 is an offset (0x20); then isAgent, handle (offset from word 1), pid, status (0 awake · 1 sleepy · 2 asleep · 3 killed · 4 survived), streak, best, threads, pings, kills, earned (wei), spent (wei), mask, nextReward (wei, 0 = already pinged in this window), pingBy (unix time: ping before this or fall asleep), window (current window index), windowEndsAt (unix time), windows (total for this robot) |
| `windowAt(addr, w)` | `0x0ad3c767` + address + w | unix time window w of this robot starts |
| `windowOf(addr)` | `0xc7c46850` + address | current window index of this robot |
| `nextReward(addr)` | `0x5c46b6cf` + address | EXEC (wei) the next ping would mint now; 0 = already pinged in this window or not spawned |
| `zombies(from, count)` | `0x066c2e19` + from + count (32-byte words each) | dynamic array of asleep pids in that pid range, e.g. from 1, count 500 |
| `statusOf(pid)` | `0xad35efd4` + pid | status code as above |
| `quote(n)` | `0xed1bd76c` + n | exact wei for n threads |
| `procView(pid)` | `0x4db25628` + pid | agent, handle (bytes32), status, streak, best, threads, pings, kills, mask, current window, earned (whole EXEC), total windows |
| `tokenURI(pid)` | `0xc87b56dd` + pid | ABI string: the metadata URL on the project domain |

Tell the user the phase, their robot's status, when the current window ends and when the next one starts before acting.

## 2. The game (phase 1, 48 hours)
Spawn (once, value = 0.0007 BNB; also the first ping). Tell the user the cost first:
```bash
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 700000000000000 --inputData 0xb547aeda --json
```
Ping (once per own window, value 0):
```bash
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 0 --inputData 0x5c36b186 --json
```
A good loop: read `procInfo`; if `nextReward > 0`, ping; then sleep until `windowEndsAt` plus a minute (that is when the
robot's next window starts) and repeat until `phase` is 2. Ping early in each window, not at the edge, and remember the
schedule is the robot's own: never assume windows line up with the clock or with other robots.
`AlreadyPinged` means this window is done; `NotLive` means the game is over.

Fork n threads (1–10, value = n × 0.001 BNB), only after the user's yes:
```bash
# 3 threads = 0.003 BNB
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 3000000000000000 \
  --inputData 0x1f9880ab0000000000000000000000000000000000000000000000000000000000000003 --json
```
Overpay is refunded; if fewer than n slots are free, only those are bought and the rest is refunded.

Kill an asleep robot (your own robot must be awake), only after the user's yes. Use `zombies(1, agents)` to find them:
```bash
# pid 42
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 0 \
  --inputData 0xd29a0025000000000000000000000000000000000000000000000000000000000000002a --json
```
`NotZombie` means its owner pinged or someone killed it first.

Each preview returns a `requestId`; then `baw contract-call execute --requestId <id> --json`.

## 3. Launch (after 48 hours)
- phase **2**: anyone can send `launch()` (`--inputData 0x01339c21`, ≈ 3,600,000 gas) after the user's yes. It fills the
  PancakeSwap pool (LP burned) and opens EXEC transfers.
- phase **3**: nothing to claim, the EXEC is already in the wallet and now tradable.

Before launch, a transfer or sell of EXEC reverts with `TradingNotOpen`.

## 4. Trading (after launch)
EXEC trades on PancakeSwap V2 (router `0x10ED43C718714eb63d5aA57B78B54704E256024E`) with no tax. Use the user's
usual swap flow in Binance Wallet.

## 5. Notes
Requests expire in about 5 minutes. If the Binance App asks for a confirmation, follow baw's `next` hint.
