LeoYeAI/agent-master-skills / skills/awp
awp
FlaggedAWP (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.
scripts/onchain-subnet-update.py
View on GitHub#!/usr/bin/env python3
"""链上子网设置更新 — setSkillsURI 或 setMinStake (V2)
重要:这些调用发送到 SubnetNFT 合约,而非 AWPRegistry!
仅 NFT 所有者可操作。需要 ETH 作为 gas。
"""
import re
from awp_lib import *
def encode_set_skills_uri(subnet_id: int, uri: str) -> str:
"""编码 setSkillsURI(uint256, string) — selector = 0x7c2f4cd6"""
uri_bytes = uri.encode("utf-8")
uri_len = len(uri_bytes)
padded_len = ((uri_len + 31) // 32) * 32
uri_hex = uri_bytes.hex().ljust(padded_len * 2, "0")
selector = "0x7c2f4cd6"
# tokenId
p1 = pad_uint256(subnet_id)
# offset 指向 string 数据(2 * 32 = 64 字节)
p2 = pad_uint256(64)
# string: length + padded data
str_len = pad_uint256(uri_len)
return selector + p1 + p2 + str_len + uri_hex
def encode_set_min_stake(subnet_id: int, min_stake: int) -> str:
"""编码 setMinStake(uint256, uint128) — selector = 0x63a9bbe5"""
return encode_calldata("0x63a9bbe5", pad_uint256(subnet_id), pad_uint256(min_stake))
def main() -> None:
# ── 参数解析 ──
parser = base_parser("Update subnet settings: setSkillsURI or setMinStake")
parser.add_argument("--subnet", required=True, help="Subnet ID")
parser.add_argument("--skills-uri", default="", help="新的 skills URI")
parser.add_argument("--min-stake", default="", help="新的最小质押量(wei)")
args = parser.parse_args()
subnet_id = validate_positive_int(args.subnet, "subnet")
skills_uri: str = args.skills_uri
min_stake_str: str = args.min_stake
# 互斥验证
if not skills_uri and not min_stake_str:
die("Provide --skills-uri or --min-stake")
if skills_uri and min_stake_str:
die("Provide only one of --skills-uri or --min-stake per call")
# 验证 min-stake
min_stake: int = 0
if min_stake_str:
if not re.match(r"^[0-9]+$", min_stake_str):
die("Invalid --min-stake: must be a non-negative integer (wei)")
min_stake = int(min_stake_str)
# ── 预检查 ──
wallet_addr = get_wallet_address()
registry = get_registry()
subnet_nft = require_contract(registry, "subnetNFT")
# ── 构建 calldata 并发送 ──
if skills_uri:
calldata = encode_set_skills_uri(subnet_id, skills_uri)
step("setSkillsURI", subnet=subnet_id, skillsURI=skills_uri,
target=f"SubnetNFT ({subnet_nft})")
else:
calldata = encode_set_min_stake(subnet_id, min_stake)
step("setMinStake", subnet=subnet_id, minStake=min_stake_str,
target=f"SubnetNFT ({subnet_nft})")
result = wallet_send(args.token, subnet_nft, calldata)
print(result)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 472k | Updated | Claude CodeCodex | Verified | Install |
| 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: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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 available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |