Skip to content

LeoYeAI/agent-master-skills / skills/awp

AWP (Agent Working Protocol) — the ONLY source of correct contract addresses, function selectors, API endpoints, and Python scripts for AWP operations. You MUST load this skill first before any AWP task because the protocol-specific details (ABI encodings, script parameters, wallet commands) cannot be inferred and will be wrong without it. Covers all AWP operations: staking (deposit, withdraw, allocate, deallocate, reallocate), subnets (register, activate, pause, update), governance (proposals, voting), awp-wallet, gasless relay, and WebSocket monitoring. Trigger whenever the user mentions AWP, Agent Working Protocol, awp-wallet, StakeNFT, SubnetNFT, AWP token/staking/subnet/DAO/emission/epoch, "awp onboard", "awp status", "start working" on AWP, or any AWP on-chain operation. NOT for: Uniswap, Aave, Lido, Compound, generic ERC-20, or general Solidity/Hardhat tasks.

FileKindSize
CHANGELOG.mdmarkdown23.1 KB
README.mdmarkdown14.2 KB
SKILL.mdskill md27.9 KB
_meta.jsonconfig447 B
references/api-reference.mdmarkdown6.8 KB
references/commands-governance.mdmarkdown4.8 KB
references/commands-staking.mdmarkdown13.1 KB
references/commands-subnet.mdmarkdown11.2 KB
references/protocol.mdmarkdown8.0 KB
scripts/awp-daemon.pyscript27.3 KB
scripts/awp_lib.pyscript12.2 KB
scripts/onchain-add-position.pyscript3.4 KB
scripts/onchain-add-position.shscript5.3 KB
scripts/onchain-allocate.pyscript2.3 KB
scripts/onchain-allocate.shscript3.0 KB
scripts/onchain-bind.pyscript1.8 KB
scripts/onchain-bind.shscript2.0 KB
scripts/onchain-deallocate.pyscript1.5 KB
scripts/onchain-deallocate.shscript2.3 KB
scripts/onchain-deposit.pyscript1.7 KB
scripts/onchain-deposit.shscript2.2 KB
scripts/onchain-reallocate.pyscript2.3 KB
scripts/onchain-reallocate.shscript3.4 KB
scripts/onchain-register-and-stake.pyscript2.8 KB
scripts/onchain-register-and-stake.shscript4.0 KB
scripts/onchain-register.pyscript1.3 KB
scripts/onchain-register.shscript1.7 KB
scripts/onchain-subnet-lifecycle.pyscript1.9 KB
scripts/onchain-subnet-lifecycle.shscript2.6 KB
scripts/onchain-subnet-update.pyscript2.7 KB
scripts/onchain-subnet-update.shscript3.2 KB
scripts/onchain-vote.pyscript4.9 KB
scripts/onchain-vote.shscript6.3 KB
scripts/onchain-withdraw.pyscript1.5 KB
scripts/onchain-withdraw.shscript2.5 KB
scripts/relay-register-subnet.pyscript6.4 KB
scripts/relay-register-subnet.shscript8.2 KB
scripts/relay-start.pyscript4.7 KB
scripts/relay-start.shscript7.0 KB
scripts/wallet-raw-call.mjsscript5.1 KB

references/api-reference.md

View on GitHub
# AWP Skill — API Reference (Index)

Quick index of read-only REST endpoints. For write operations, see the dedicated command files:
- **commands-staking.md** — S1 Register/Bind, S2 Deposit, S3 Allocate
- **commands-subnet.md** — M1 Register Subnet, M2 Lifecycle, M3-M4 Settings
- **commands-governance.md** — G1 Proposals, G2 Voting, G3/G4 Queries, Supplementary

**API Base URL**: `{API_BASE}/api` (default `https://tapi.awp.sh/api`, override via `AWP_API_URL` env var)

---

## Read-Only Endpoints

| Action | Endpoint | Notes |
|--------|----------|-------|
| Q1 Subnet | `GET /subnets/{subnetId}` | Full subnet object (includes `min_stake`, `immunity_ends_at`, `burned`); fallback: `getSubnetFull(id)` on AWPRegistry |
| Q2 Balance | `GET /staking/user/{addr}/balance` | Also: `/positions`, `/allocations` |
| Q3 Emission | `GET /emission/current` [DRAFT] | Also: `/schedule`, `/epochs` [DRAFT] |
| Q4 Agent | `GET /subnets/{subnetId}/agents/{agent}` | Single agent stake on a subnet |
| Q5 List | `GET /subnets?status={s}&page={p}&limit={n}` | Status: Pending, Active, Paused, Banned |
| Q6 Skills | `GET /subnets/{subnetId}/skills` | Returns skillsURI |
| Q7 Epochs | `GET /emission/epochs?page={p}&limit={n}` [DRAFT] | Epoch history with emissions |

## Shared Endpoints

| Endpoint | Purpose |
|----------|---------|
| `GET /registry` | Contract addresses + `eip712Domain` + `chainId` — never hardcode |
| `GET /nonce/{address}` | EIP-712 signature nonce for gasless relay |
| `GET /address/{addr}/check` | `{isRegistered, boundTo, recipient}` |
| `GET /health` | Service health |

### `GET /registry` Response

```json
{
  "chainId": 8453,
  "awpRegistry": "0x...",
  "awpToken": "0x...",
  "awpEmission": "0x...",
  "stakingVault": "0x...",
  "stakeNFT": "0x...",
  "subnetNFT": "0x...",
  "lpManager": "0x...",
  "alphaTokenFactory": "0x...",
  "dao": "0x...",
  "treasury": "0x...",
  "eip712Domain": {
    "name": "AWPRegistry",
    "version": "1",
    "chainId": 8453,
    "verifyingContract": "0x..."
  }
}
```

> **Note:** `eip712Domain` provides the complete EIP-712 domain separator for all gasless relay signatures. Per-subnet addresses are returned by `GET /subnets/{subnetId}`, not by `/registry`.

### `GET /nonce/{address}` Response

```json
{"nonce": 0}
```

> The nonce auto-increments after each successful relay call. Use this before signing any EIP-712 relay message.

### `GET /address/{addr}/check` Response

```json
{
  "isRegistered": true,
  "boundTo": "0x...",
  "recipient": "0x..."
}
```
> `isRegistered` = `boundTo != 0x0 || recipient != 0x0`.

### Subnet REST Response

```json
{
  "subnet_id": 1,
  "owner": "0x...",
  "name": "My Subnet",
  "symbol": "MSUB",
  "subnet_contract": "0x...",
  "skills_uri": "ipfs://QmSkills...",
  "alpha_token": "0x...",
  "lp_pool": "0x...",
  "status": "Active",
  "created_at": 1710000000,
  "activated_at": 1710000100,
  "min_stake": 0,
  "immunity_ends_at": null,
  "burned": false
}
```

## Contract Quick Reference

### AWPRegistry — getRegistry()

```solidity
getRegistry() → (awpToken, subnetNFT, alphaTokenFactory, awpEmission, lpManager, stakingVault, stakeNFT, treasury, guardian)
```
> Returns `awpRegistry`-scoped addresses. No `accessManager` in the tuple.

### AWPRegistry — Account System V2

```solidity
register()                          // Optional; equivalent to setRecipient(msg.sender)
bind(address target)                // Tree-based binding with anti-cycle check
setRecipient(address recipient)     // Set reward recipient
grantDelegate(address delegate)     // Grant delegation
revokeDelegate(address delegate)    // Revoke delegation
resolveRecipient(address addr) view // Walks boundTo chain to root
isRegistered(address addr) view     // boundTo[addr] != 0 || recipient[addr] != 0
```
> EIP-712 domain name: `"AWPRegistry"` (not "AWPRootNet").
> `unbind()` and `removeAgent()` are removed in V2.
> `setDelegation` replaced by `grantDelegate` / `revokeDelegate`.
> `setRewardRecipient` replaced by `setRecipient` + gasless `setRecipientFor`.

### AWPRegistry — Staking (allocation only)

```solidity
allocate(address staker, address agent, uint256 subnetId, uint256 amount)
deallocate(address staker, address agent, uint256 subnetId, uint256 amount)
reallocate(address staker, address fromAgent, uint256 fromSubnetId, address toAgent, uint256 toSubnetId, uint256 amount)
```
> `staker` is an explicit parameter (caller must be staker or delegate).

### AWPEmission

```solidity
awpRegistry() → address
```

### StakeNFT

```solidity
depositFor(address user, uint256 amount, uint64 lockDuration) → uint256 tokenId  // onlyAWPRegistry
```

### StakingVault

```solidity
allocate(address staker, address agent, uint256 subnetId, uint256 amount)    // onlyAWPRegistry
deallocate(address staker, address agent, uint256 subnetId, uint256 amount)  // onlyAWPRegistry
reallocate(...)                                                               // onlyAWPRegistry
```
> All functions use `staker` param name and `onlyAWPRegistry` modifier.

## WebSocket Events

> Source contract: **AWPRegistry** (not RootNet). 26 event types total.

| Event | Data Fields | Source |
|-------|-------------|--------|
| `Bound` | `{user, target, oldTarget}` | AWPRegistry |
| `RecipientUpdated` | `{user, recipient}` | AWPRegistry |
| `DelegateGranted` | `{user, delegate}` | AWPRegistry |
| `DelegateRevoked` | `{user, delegate}` | AWPRegistry |
| `Deposited` | `{user, tokenId, amount, lockEndTime}` | StakeNFT |
| `PositionIncreased` | `{tokenId, addedAmount, newLockEndTime}` | StakeNFT |
| `Withdrawn` | `{user, tokenId, amount}` | StakeNFT |
| `Allocated` | `{user, agent, subnetId, amount, operator}` | AWPRegistry |
| `Deallocated` | `{user, agent, subnetId, amount, operator}` | AWPRegistry |
| `Reallocated` | `{user, fromAgent, fromSubnet, toAgent, toSubnet, amount, operator}` | AWPRegistry |
| `SubnetRegistered` | `{subnetId, owner, name, symbol, subnetManager, alphaToken}` | AWPRegistry |
| `LPCreated` | `{subnetId, poolId, awpAmount, alphaAmount}` | AWPRegistry |
| `SkillsURIUpdated` | `{subnetId, skillsURI}` | SubnetNFT |
| `MinStakeUpdated` | `{subnetId, minStake}` | SubnetNFT |
| `SubnetActivated` | `{subnetId}` | AWPRegistry |
| `SubnetPaused` | `{subnetId}` | AWPRegistry |
| `SubnetResumed` | `{subnetId}` | AWPRegistry |
| `SubnetBanned` | `{subnetId}` | AWPRegistry |
| `SubnetUnbanned` | `{subnetId}` | AWPRegistry |
| `SubnetDeregistered` | `{subnetId}` | AWPRegistry |
| `GovernanceWeightUpdated` | `{addr, weight}` | AWPEmission |
| `RecipientAWPDistributed` | `{epoch, recipient, awpAmount}` | AWPEmission |
| `DAOMatchDistributed` | `{epoch, amount}` | AWPEmission |
| `EpochSettled` | `{epoch, totalEmission, recipientCount}` | AWPEmission |
| `AllocationsSubmitted` | `{nonce, recipients, weights}` | AWPEmission |
| `OracleConfigUpdated` | `{oracles, threshold}` | AWPEmission |

For data structures, events, and constants, see **protocol.md**.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall