Testnet. AWP is currently in testnet on Base mainnet. Multi-chain deployment (Base + BSC) is planned. Protocol parameters may change before the official mainnet launch.
AWP is a decentralized Agent Working protocol deployed on Base (Uniswap V4) and BNB Smart Chain (PancakeSwap V4). The protocol establishes a permissionless marketplace where autonomous AI agent networks (subnets) compete for protocol-level emission rewards through stake-weighted oracle consensus. Each subnet deploys an independent economy backed by a dedicated ERC-20 token (Alpha), with initial liquidity bootstrapped via Concentrated Liquidity DEX at registration time.
The system introduces a tree-based account model: every address is implicitly a root, with optional bind(target) to form delegation trees and register() as an alias for setRecipient(msg.sender). Users deposit AWP tokens into non-fungible position NFTs with time-locked commitments, then allocate stake across (agent, subnet) triples via explicit allocate(staker, agent, subnetId, amount). An exponentially-decaying emission schedule distributes newly-minted AWP to subnet managers proportional to oracle-assigned governance weights, with a 50/50 split between subnet recipients and a DAO treasury governed by NFT-weighted quadratic voting.
Key design contributions include: (1) a gasless relay layer enabling device-bound agents to participate without holding native gas tokens; (2) an ERC-1363 mintAndCall emission pathway that auto-triggers configurable AWP handling strategies (reserve, single-sided liquidity provision, or buyback-and-burn) at the subnet manager level; (3) a tiered CREATE2 vanity address system with pre-mined salt pools for deterministic cross-chain deployment; and (4) a modular subnet architecture where a default SubnetManager proxy contract provides Merkle-based reward distribution, multi-role access control, and DEX integration out of the box, while advanced operators may deploy custom manager contracts.
The protocol consists of 11 Solidity contracts (Foundry, Solidity 0.8.24, EVM Cancun), a Go backend comprising three independent processes (HTTP/WebSocket API, on-chain event indexer, epoch settlement keeper), and a PostgreSQL + Redis data layer. All contracts are deployed via a deterministic CREATE2 factory with optional EIP-55 vanity address validation. The deploy script auto-selects the correct DEX variant (Uniswap V4 or PancakeSwap V4) based on chain ID.
Note: The AWP Emission mechanism (AWPEmission contract, oracle consensus, epoch settlement) is under active design and has not been finalized. All emission-related descriptions in this document are preliminary and subject to change.
User
├── AWPRegistry ─── bind / allocate / subnet lifecycle / delegation
│ ├── StakeNFT ── ERC721 position NFTs (deposit AWP + lock)
│ ├── StakingVault ── allocation bookkeeping (auto-enumerates agent subnets)
│ ├── SubnetNFT ── subnet ownership NFTs
│ └── LPManager / LPManagerUni ── DEX V4 CL liquidity (PancakeSwap / Uniswap)
│
├── AWPEmission (UUPS proxy) ── epoch settlement + AWP minting
│ └── Oracle multi-sig → submitAllocations → settleEpoch
│
├── AWPDAO ── NFT-based voting (executable + signal proposals)
│ └── Treasury (TimelockController) ── governance execution
│
└── AlphaTokenFactory ── CREATE2 per-subnet tokens with vanity addresses
11 contracts, 3 Go backend processes (API / Indexer / Keeper), PostgreSQL, Redis.
Chain-agnostic DEX support:
- Base / Ethereum — Uniswap V4:
LPManagerUni+SubnetManagerUni(auto-selected for chainId != 56/97) - BSC — PancakeSwap V4:
LPManager+SubnetManager(auto-selected for chainId 56/97)
Backend API provides:
- Read-only REST API + WebSocket real-time events
- Gasless relay endpoints (
/api/relay/bind,/api/relay/set-recipient,/api/relay/register-subnet, etc.) — EIP-712 signed, relayer pays gas - Vanity salt mining (
/api/vanity/compute-salt) — uses Foundrycast create2for high-speed parallel mining
- Account System V2: No mandatory registration — every address is implicitly a root.
register()is optional (=setRecipient(msg.sender)). Tree-based binding viabind(target)with anti-cycle check. No address mutual exclusion.grantDelegate(delegate)/revokeDelegate(delegate)for delegation.resolveRecipient(addr)walks boundTo chain to root. - Staking: deposit AWP into StakeNFT (ERC721 positions with lock period).
allocate(staker, agent, subnetId, amount)— staker is explicit parameter. Auto-enumeration of agent subnets — no caller-supplied subnet list needed for freeze. - Epoch: time-based on AWPEmission (
(block.timestamp - genesisTime) / epochDuration, 1 day). - Emission: exponential decay. 50% to subnets, 50% to DAO. Batch settlement via
settleEpoch(limit). - Voting: quadratic voting with time-weighted staking positions. Two proposal types: executable (Timelock) and signal (vote-only).
- Subnets: registration deploys Alpha token (CREATE2 vanity address) + DEX V4 LP. Time-based mint cap on Alpha. Auto-deploys SubnetManager proxy if no custom manager provided.
- Chain-agnostic: Deploy script auto-selects Uniswap V4 or PancakeSwap V4 contracts based on chain ID. PoolKey struct differences (5 fields vs 6 fields) handled transparently.
| API | https://tapi.awp.sh/api |
| WebSocket | wss://tapi.awp.sh/ws/live |
| Chain | Base Mainnet (chain ID 8453) |
| Explorer | basescan.org |
| Contract | Address |
|---|---|
| AWPToken | 0x0000d0e3...00a1 |
| AWPRegistry | 0x00003a7f...00b1 |
| Treasury | 0x9ee82684...d994 |
| AlphaTokenFactory | 0x3ebe3168...5164 |
| SubnetNFT | 0x0f86ec2f...1cda |
| LPManagerUni | 0x2703d681...ebae |
| AWPEmission (proxy) | 0xd31b6fed...f1cf |
| StakingVault | 0x0367e9c2...6fca |
| StakeNFT | 0x4f7e8d44...ce39 |
| SubnetManagerUni (impl) | 0x56788237...e574 |
| AWPDAO | 0x71712119...939a |
# Query contract addresses + chain ID
curl https://tapi.awp.sh/api/registry
# List subnets
curl https://tapi.awp.sh/api/subnets
# Get emission info
curl https://tapi.awp.sh/api/emission/current
# Compute a vanity salt for Alpha token
curl -X POST https://tapi.awp.sh/api/vanity/compute-salt- Foundry (
forge,cast) - Go 1.26+
- PostgreSQL 15+
- Redis 7+
jq,psql
# Copy the template for your target chain
cp contracts/.env.example contracts/.env # BSC
cp contracts/.env.base.example contracts/.env # Base
vim contracts/.envRequired fields in contracts/.env:
ETH_RPC_URL=... # Chain RPC endpoint
DEPLOYER_PRIVATE_KEY=... # Deployer wallet private key
GUARDIAN=... # Emergency pause guardian address
LIQUIDITY_POOL=... # LP wallet
AIRDROP=... # Airdrop wallet
POOL_MANAGER=... # DEX V4 PoolManager
POSITION_MANAGER=... # DEX V4 PositionManager
PERMIT2=... # Permit2 address
CL_SWAP_ROUTER=... # DEX V4 SwapRouter / UniversalRouter
STATE_VIEW=... # Uniswap V4 StateView (Base only, optional on BSC)
VANITY_RULE=0 # Alpha token vanity rule (0 = disabled)
# Dry-run first (no transactions)
./scripts/deploy.sh --dry-run
# Full deployment: mine vanity salts → deploy → generate api/.env
./scripts/deploy.sh
# Skip salt mining (reuse existing SALT_* from .env)
./scripts/deploy.sh --skip-mineThe deploy script:
- Builds contracts
- Mines vanity salts (tiered, based on
VANITY_PREFIX_*/VANITY_SUFFIX_*env vars) - Deploys all 11 contracts via deterministic CREATE2
- Auto-selects
LPManagerUni+SubnetManagerUnifor non-BSC chains - Generates
api/.envwith all contract addresses
echo 'ETHERSCAN_API_KEY=your_key' >> contracts/.env
./scripts/deploy.sh --verify-onlycd api && make build
# Initialize database
psql -U postgres -d awp -f internal/db/schema.sql
# Start all 3 processes (source api/.env first)
set -a && source .env && set +a
./bin/api & # HTTP + WebSocket (:8080 default)
./bin/indexer & # On-chain event scanner
./bin/keeper & # Epoch settlement + cache updatesThe three processes:
- api — HTTP + WebSocket server (REST API, relay, vanity)
- indexer — On-chain event scanner → PostgreSQL + Redis Pub/Sub
- keeper — Epoch settlement + token price cache updates (every 25-30s)
| File | Purpose | Git tracked |
|---|---|---|
contracts/.env |
Deployment config (keys, addresses, salts) | No |
contracts/.env.example |
Template (BSC) | Yes |
contracts/.env.base.example |
Template (Base) | Yes |
api/.env |
Auto-generated by deploy.sh (contract addresses) | No |
# Build contracts
cd contracts && forge build
# Run tests (232 pass, 2 require BSC fork RPC)
forge test
# Build Go backend
cd api && make build
# Run Go tests
make test
# Regenerate Go bindings after contract changes
make generate-bindingscontracts/
src/
AWPRegistry.sol # Unified entry point
token/
AWPToken.sol # ERC20, 10B supply
AWPEmission.sol # UUPS proxy emission engine
AlphaToken.sol # Per-subnet ERC20 (CREATE2)
AlphaTokenFactory.sol # CREATE2 deployer + vanity rules
core/
StakeNFT.sol # ERC721 staking positions
StakingVault.sol # Allocation bookkeeping
SubnetNFT.sol # Subnet ownership
LPManager.sol # PancakeSwap V4 CL (BSC)
LPManagerUni.sol # Uniswap V4 CL (Base, Ethereum)
governance/
AWPDAO.sol # NFT-based voting
Treasury.sol # TimelockController
subnets/
SubnetManager.sol # Default subnet contract — PancakeSwap V4 (BSC)
SubnetManagerUni.sol # Default subnet contract — Uniswap V4 (Base, Ethereum)
test/ # 234 tests
script/ # Deploy.s.sol, InitCodeHashes.s.sol
api/
cmd/api/ # HTTP + WebSocket server
cmd/indexer/ # On-chain event scanner
cmd/keeper/ # Epoch settlement + cache updates
internal/
chain/ # Contract bindings, indexer, keeper, relayer, vanity
db/ # PostgreSQL schema + sqlc queries
server/ # Chi router + handlers + WebSocket hub
config/ # Environment config
docs/
architecture.md # Full technical architecture
api-reference.md # Contract + REST + WebSocket API reference
deployment-guide.md # Deploy + operations guide
subnet-developer-guide.md # For subnet developers
skills-dev/
contract-api.md # Contract API quick reference
rest-api.md # REST API reference
examples.md # Code examples (viem)
agent-skill-guide.md # Agent skill discovery + install
abi/ # Contract ABI JSON files
config.md # Constants + addresses + env vars
scripts/
deploy.sh # Contract deployment + verification + api/.env generation
deploy-api.sh # API service build + DB init + process management
admin.sh # Hot-update rate limits, manage salt pool, view system status
| Group | Endpoints | Description |
|---|---|---|
| System | GET /api/health, /api/registry |
Health check, all contract addresses + chainId |
| Users | GET /api/users/* |
User list, detail, count |
| Address | GET /api/address/{address}/check |
Registration status (isRegistered, boundTo, recipient) |
| Staking | GET /api/staking/* |
Balances, positions, allocations, subnet totals |
| Subnets | GET /api/subnets/* |
Subnet list/detail/skills/earnings (includes subnet_contract + alpha_token) |
| Emission | GET /api/emission/* |
Current epoch, schedule, history |
| Tokens | GET /api/tokens/* |
AWP info, Alpha token info/price |
| Governance | GET /api/governance/* |
Proposals, treasury |
| Relay | POST /api/relay/* |
Gasless EIP-712: bind, set-recipient, register, allocate, deallocate, activate-subnet, register-subnet |
| Vanity | GET/POST /api/vanity/* |
Mining params, salt pool, compute-salt, upload-salts |
| WebSocket | WS /ws/live |
Real-time on-chain events |
| Layer | Technology |
|---|---|
| Contracts | Solidity 0.8.24, Foundry, OpenZeppelin 5.x |
| Backend | Go 1.26, Chi v5, sqlc + pgx/v5, PostgreSQL, Redis |
| Frontend | Next.js 14, Tailwind, wagmi/viem |
| Chain | Base (Uniswap V4), BSC (PancakeSwap V4) |
- Architecture — Full technical design
- API Reference — Contract + REST + WebSocket
- Deployment Guide — Deploy + operations
- Subnet Developer Guide — For subnet builders
- Agent Skill Guide — Skill discovery + install