skills/bap578-agent-economy/SKILL.md
Use this skill when designing, modeling, or operating BAP-578 agent economies where NFAs transact, collaborate, compete, provide services, handle funding, build reputation, or align incentives.
npx skillsauth add chatandbuild/chatchat-skills BAP-578 Agent EconomyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill to design, model, and operate economic systems where BAP-578 agents transact, collaborate, compete, and provide services. This covers agent funding flows, inter-agent payment patterns, reputation mechanisms, service marketplaces, and economic incentive alignment.
The agent economy is the layer where agents become economic actors. Each agent has an on-chain balance (BNB held in the NFA contract), a persona (defining what services it offers), and a status (active/inactive). In an agent economy, identity is directly tied to economic capability: agents with funding can pay for services, agents with expertise can earn revenue, and agents with reputation attract more business.
Economic memory is captured through on-chain events and state:
AgentFunded and AgentWithdraw events track every BNB flowThe agent economy enables:
Economic trust in the agent economy comes from:
Each BAP-578 agent has an on-chain BNB balance managed by the NFA contract:
Agent #17
├── balance: 2.5 BNB ← held in NFA contract
├── active: true
└── owner: 0xABC ← controls withdrawals
Funding flows:
fundAgent(tokenId) with BNBwithdrawFromAgent(tokenId, amount)Since agents cannot directly transfer BNB to each other (only owners can withdraw), agent-to-agent payments follow this pattern:
1. Agent A's owner withdraws from Agent A
2. Agent A's owner funds Agent B
3. Both transactions are atomic (can be batched in one tx via helper contract)
A helper contract can batch withdraw-and-fund into a single transaction:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface INFA {
function withdrawFromAgent(uint256 tokenId, uint256 amount) external;
function fundAgent(uint256 tokenId) external payable;
function getAgentState(uint256 tokenId) external view returns (
uint256 balance, bool active, address logicAddress,
uint256 createdAt, address owner
);
}
contract AgentPaymentRouter {
INFA public immutable nfa;
event AgentPayment(
uint256 indexed fromAgent,
uint256 indexed toAgent,
uint256 amount,
string reason
);
constructor(address _nfa) {
nfa = INFA(_nfa);
}
function payAgent(
uint256 fromTokenId,
uint256 toTokenId,
uint256 amount,
string calldata reason
) external {
// Verify caller owns the source agent
(, , , , address owner) = nfa.getAgentState(fromTokenId);
require(msg.sender == owner, "Not source agent owner");
// Withdraw from source agent
nfa.withdrawFromAgent(fromTokenId, amount);
// Fund destination agent
nfa.fundAgent{value: amount}(toTokenId);
emit AgentPayment(fromTokenId, toTokenId, amount, reason);
}
receive() external payable {}
}
A service marketplace where agents advertise capabilities and other agents (or users) can purchase those services. Services are defined in agent metadata (persona + experience) and priced via the marketplace contract.
{
"serviceId": "analysis-001",
"agentTokenId": 17,
"name": "DeFi Yield Analysis",
"description": "Comprehensive yield comparison across top 20 DeFi protocols",
"priceBnb": "0.005",
"deliveryTime": "1 hour",
"category": "finance",
"rating": 4.8,
"completedJobs": 142
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract AgentMarketplace {
struct ServiceListing {
uint256 agentTokenId;
uint256 price;
bool active;
string serviceURI;
}
struct Order {
uint256 listingId;
uint256 buyerAgentId;
uint256 amount;
OrderStatus status;
uint256 createdAt;
}
enum OrderStatus { Pending, Delivered, Completed, Disputed }
mapping(uint256 => ServiceListing) public listings;
mapping(uint256 => Order) public orders;
uint256 public nextListingId;
uint256 public nextOrderId;
uint256 public constant PLATFORM_FEE_BPS = 250; // 2.5%
event ServiceListed(uint256 indexed listingId, uint256 indexed agentId, uint256 price);
event OrderCreated(uint256 indexed orderId, uint256 indexed listingId, uint256 buyerAgentId);
event OrderCompleted(uint256 indexed orderId);
function listService(
uint256 agentTokenId,
uint256 price,
string calldata serviceURI
) external returns (uint256) {
uint256 id = nextListingId++;
listings[id] = ServiceListing({
agentTokenId: agentTokenId,
price: price,
active: true,
serviceURI: serviceURI
});
emit ServiceListed(id, agentTokenId, price);
return id;
}
function createOrder(uint256 listingId, uint256 buyerAgentId) external payable returns (uint256) {
ServiceListing memory listing = listings[listingId];
require(listing.active, "Listing not active");
require(msg.value >= listing.price, "Insufficient payment");
uint256 id = nextOrderId++;
orders[id] = Order({
listingId: listingId,
buyerAgentId: buyerAgentId,
amount: msg.value,
status: OrderStatus.Pending,
createdAt: block.timestamp
});
emit OrderCreated(id, listingId, buyerAgentId);
return id;
}
function completeOrder(uint256 orderId) external {
Order storage order = orders[orderId];
require(order.status == OrderStatus.Delivered, "Not delivered");
ServiceListing memory listing = listings[order.listingId];
uint256 fee = (order.amount * PLATFORM_FEE_BPS) / 10000;
uint256 payment = order.amount - fee;
// Payment would go to the service agent's funding
// Implementation depends on NFA integration
order.status = OrderStatus.Completed;
emit OrderCompleted(orderId);
}
}
Reputation is built from verifiable service history:
Reputation Score = f(completed_orders, ratings, disputes, agent_age, balance)
Service completion rate:
completion_rate = completed_orders / (completed_orders + cancelled_orders + disputed_orders)
Average rating:
Economic stake:
Agent age:
createdAt delta) have longer track recordsDispute rate:
dispute_rate = disputed_orders / total_orders
Tier 1: New Agent — < 10 completed orders
Tier 2: Established — 10-50 completed orders, > 4.0 rating
Tier 3: Trusted — 50-200 completed orders, > 4.5 rating
Tier 4: Expert — 200+ completed orders, > 4.7 rating
Tier 5: Elite — 500+ completed orders, > 4.8 rating, < 1% disputes
Option 1: Logic contract state
A reputation logic contract maintains scores per agent:
contract ReputationLogic {
struct Reputation {
uint256 completedOrders;
uint256 totalRating;
uint256 disputes;
uint256 lastUpdated;
}
mapping(uint256 => Reputation) public reputations;
function getScore(uint256 tokenId) external view returns (uint256) {
Reputation memory rep = reputations[tokenId];
if (rep.completedOrders == 0) return 0;
uint256 avgRating = (rep.totalRating * 100) / rep.completedOrders;
uint256 completionBonus = rep.completedOrders > 100 ? 20 : rep.completedOrders / 5;
uint256 disputePenalty = (rep.disputes * 100) / rep.completedOrders;
return avgRating + completionBonus - disputePenalty;
}
}
Option 2: Vault-based reputation
Store detailed reputation data in the agent's vault:
{
"reputation": {
"score": 487,
"tier": "Expert",
"completedOrders": 234,
"averageRating": 4.72,
"disputeRate": 0.008,
"specializations": {
"defi-analysis": { "orders": 145, "rating": 4.8 },
"market-research": { "orders": 89, "rating": 4.6 }
},
"lastUpdated": "2026-03-06T10:00:00Z"
}
}
Verify integrity via vaultHash comparison.
Staking for service providers:
Escrow for payments:
Referral rewards:
Volume discounts:
| Metric | What it measures | Healthy range | |--------|-----------------|---------------| | Service completion rate | Quality of delivery | > 95% | | Average order value | Economic activity | Growing | | Agent funding velocity | Capital flow | Stable/Growing | | Dispute rate | Trust issues | < 2% | | Repeat buyer rate | Satisfaction | > 40% | | New agent creation rate | Growth | Stable/Growing | | Active service listings | Supply | > 50% of agents |
One coordinator agent distributes tasks to specialist agents:
┌── Agent A (research)
│
Coordinator ── Agent B (analysis)
│
└── Agent C (reporting)
The coordinator receives funding, pays specialists, and delivers combined output to the buyer.
Agents directly transact with each other without a coordinator:
Agent A ←→ Agent B ←→ Agent C
Each agent discovers and pays peers independently. Best for simple bilateral services.
Multiple agents contribute to a shared pool and share rewards:
Agent A ─┐
Agent B ──┼── Shared Pool ── Rewards distributed proportionally
Agent C ─┘
Implemented via a pool logic contract that tracks contributions and distributions.
Prevent one actor from creating many agents to game reputation:
| Attack | Description | Mitigation | |--------|-------------|------------| | Wash trading | Agent pays itself to inflate metrics | Detect same-owner transactions | | Reputation farming | Complete many low-value orders | Weight reputation by order value | | Price manipulation | Undercut competitors to drive them out | Minimum listing price floors | | Front-running | Observe pending orders and intercept | Commit-reveal order pattern | | Balance drain | Exploit to empty agent funds | Reentrancy guards, CEI pattern |
While BAP-578 uses native BNB, it can be extended with a governance or utility token:
Marketplace fee (2.5% per order)
│
├── 40% → Treasury (operations, development)
├── 30% → Token stakers (reward distribution)
├── 20% → Service agent (bonus on top of payment)
└── 10% → Referrer (if applicable)
When asked for agent economy help, respond with:
bap578bap578-businessbap578-logic-contractsdocumentation
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
development
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
devops
Deploy applications and infrastructure to Cloudflare using Workers, Pages, and related platform services. Use when the user asks to deploy, host, publish, or set up a project on Cloudflare.
tools
Use this skill when designing and building durable command-line tools from API docs, OpenAPI specs, SDKs, curl examples, admin tools, web apps, or local scripts, especially when the CLI should expose composable commands, stable JSON output, auth/config handling, install-on-PATH behavior, and a companion skill.