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

scripts/onchain-register-and-stake.sh

View on GitHub
#!/usr/bin/env bash
# One-click registerAndStake: register + deposit + allocate in a single tx
# Usage: ./onchain-register-and-stake.sh --token <T> --amount <AWP_human> --lock-days <days> --agent <address> --subnet <id> --allocate-amount <AWP_human>
# Requires ETH for gas. Handles approve (to AWP_REGISTRY) + registerAndStake in sequence.
set -euo pipefail

API_BASE="${AWP_API_URL:-https://tapi.awp.sh/api}"
TOKEN=""
AMOUNT=""
LOCK_DAYS=""
AGENT=""
SUBNET=""
ALLOCATE_AMOUNT=""
while [[ $# -gt 0 ]]; do
  case $1 in
    --token) TOKEN="$2"; shift 2 ;;
    --amount) AMOUNT="$2"; shift 2 ;;
    --lock-days) LOCK_DAYS="$2"; shift 2 ;;
    --agent) AGENT="$2"; shift 2 ;;
    --subnet) SUBNET="$2"; shift 2 ;;
    --allocate-amount) ALLOCATE_AMOUNT="$2"; shift 2 ;;
    *) echo '{"error": "Unknown arg: '"$1"'"}' >&2; exit 1 ;;
  esac
done
[[ -z "$TOKEN" || -z "$AMOUNT" || -z "$LOCK_DAYS" || -z "$AGENT" || -z "$SUBNET" || -z "$ALLOCATE_AMOUNT" ]] && \
  { echo '{"error": "Missing required flags: --token, --amount, --lock-days, --agent, --subnet, --allocate-amount"}' >&2; exit 1; }

# Validate numeric inputs (shell regex, no python3 injection risk)
[[ "$AMOUNT" =~ ^[0-9]+\.?[0-9]*$ && "$AMOUNT" != "0" && "$AMOUNT" != "0.0" && "$AMOUNT" != "0.00" ]] || { echo '{"error": "Invalid --amount: must be a positive number"}' >&2; exit 1; }
[[ "$LOCK_DAYS" =~ ^[0-9]+\.?[0-9]*$ ]] || { echo '{"error": "Invalid --lock-days: must be a positive number"}' >&2; exit 1; }
[[ "$ALLOCATE_AMOUNT" =~ ^[0-9]+\.?[0-9]*$ ]] || { echo '{"error": "Invalid --allocate-amount: must be a positive number"}' >&2; exit 1; }
[[ "$AGENT" =~ ^0x[0-9a-fA-F]{40}$ ]] || { echo '{"error": "Invalid --agent: must be 0x + 40 hex chars"}' >&2; exit 1; }
[[ "$SUBNET" =~ ^[0-9]+$ ]] && [[ "$SUBNET" -gt 0 ]] || { echo '{"error": "Invalid --subnet: must be a positive integer"}' >&2; exit 1; }

# Pre-flight: fetch wallet address
WALLET_ADDR=$(awp-wallet status --token "$TOKEN" | jq -r '.address')
[[ -z "$WALLET_ADDR" || "$WALLET_ADDR" == "null" ]] && { echo '{"error": "Invalid token"}' >&2; exit 1; }

# Fetch registry addresses
REGISTRY=$(curl -s "$API_BASE/registry")
AWP_TOKEN=$(echo "$REGISTRY" | jq -r '.awpToken')
AWP_REGISTRY=$(echo "$REGISTRY" | jq -r '.awpRegistry')
[[ -z "$AWP_REGISTRY" || "$AWP_REGISTRY" == "null" ]] && { echo '{"error": "Failed to get contract address from /registry"}' >&2; exit 1; }

# Convert units: human-readable amounts to wei, days to seconds
AMOUNT_WEI=$(python3 -c "print(int(float('$AMOUNT') * 10**18))")
LOCK_SECONDS=$(python3 -c "print(int(float('$LOCK_DAYS') * 86400))")
ALLOCATE_WEI=$(python3 -c "print(int(float('$ALLOCATE_AMOUNT') * 10**18))")

# Step 1: Approve AWP to AWP_REGISTRY (NOT StakeNFT — registerAndStake pulls tokens via AWPRegistry)
echo '{"step": "approve", "spender": "'"$AWP_REGISTRY"'", "note": "Approve target is AWP_REGISTRY, NOT StakeNFT", "amount": "'"$AMOUNT"' AWP"}' >&2
awp-wallet approve --token "$TOKEN" --asset "$AWP_TOKEN" --spender "$AWP_REGISTRY" --amount "$AMOUNT" --chain base

# Step 2: registerAndStake(uint256 depositAmount, uint64 lockDuration, address agent, uint256 subnetId, uint256 allocateAmount)
# selector = keccak256("registerAndStake(uint256,uint64,address,uint256,uint256)")[:4] = 0x34426564
# ABI encoding: 5 params, each 32-byte padded (address left-padded, uint64 left-padded to 32 bytes)
CALLDATA=$(python3 -c "
selector = '0x34426564'
deposit_amount = int('$AMOUNT_WEI')
lock_duration = int('$LOCK_SECONDS')
agent = '$AGENT'.lower().replace('0x', '')
subnet_id = int('$SUBNET')
allocate_amount = int('$ALLOCATE_WEI')
print(selector
    + hex(deposit_amount)[2:].zfill(64)
    + hex(lock_duration)[2:].zfill(64)
    + agent.zfill(64)
    + hex(subnet_id)[2:].zfill(64)
    + hex(allocate_amount)[2:].zfill(64))
")

echo '{"step": "registerAndStake", "to": "'"$AWP_REGISTRY"'", "deposit_amount_wei": "'"$AMOUNT_WEI"'", "lock_seconds": '"$LOCK_SECONDS"', "agent": "'"$AGENT"'", "subnet": '"$SUBNET"', "allocate_amount_wei": "'"$ALLOCATE_WEI"'"}' >&2
awp-wallet send --token "$TOKEN" --to "$AWP_REGISTRY" --data "$CALLDATA" --chain base
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 CodeCodexUnverifiedInstall
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