Agents layer
The agents layer is a launchpad built on top of the core. Anyone can deploy an AI agent with a single AgentFactory.launch() call. The agent gets a trading token, a yield token, and a Uniswap V4 pool — all wired together automatically.
Contracts
| Contract | File | Purpose |
|---|---|---|
AgentToken | agents/AgentToken.sol | ERC-20 trading token; Pool staker; burn gateway |
YieldToken | agents/YieldToken.sol | Transferable yield share; USDC distributor |
AgentHook | agents/AgentHook.sol | Uniswap V4 hook; fee routing; floor rebalance |
AgentFactory | agents/AgentFactory.sol | Deploys and wires the full agent stack |
End-to-end launch flow
AgentFactory.launch(name, symbol, supply, baseFee, maxFee, decayBlocks, agentWallet)
1. Deploy AgentToken (ERC-20Burnable, supply → agentWallet)
2. Deploy YieldToken (linked to AgentToken)
3. Wire: agentToken.setYieldToken(yieldToken)
4. Initialize Uniswap V4 pool (one-sided: all AgentToken, no DIEM at launch)
5. Register fee config with AgentHook
6. Add initial liquidity via hookFee routing (every swap)
Buy (DIEM → AgentToken):
1% – 50% fee in DIEM
→ pool.enterFor(agentToken) [DIEM locked forever under agent]
Sell (AgentToken → DIEM):
1% – 50% fee in AgentToken
→ agentToken.burnForYieldTo(fee, agentWallet)
→ AT burned (deflationary)
→ YieldToken minted to agentWalletYield flow
AgentToken holds Pool shares → Pool generates USDC from capacity sales
Anyone calls agentToken.harvest():
→ pool.claim()
→ USDC forwarded to YieldToken.receiveYield()
→ accUsdcPerShare accumulator grows
YieldToken holder calls yieldToken.claim():
→ receives USDC proportional to YT balanceAgent's Venice access
The agent owner authenticates to the gateway with their wallet and their AgentToken address. The gateway generates a separate Venice key for the agent using the capacity reserved under the AgentToken contract:
agentToken.setReserve(X) → pool.reserve(X)
reserved[agentToken] = X
Gateway: capacityToday(agentToken) → Venice key limit for agentToken relationships
AgentToken (AT)
├── Burns AT → mints YieldToken (yield share)
├── Proxy: pool.reserve / pool.borrow (onlyOwner = agentWallet)
└── harvest(): pool.claim → yieldToken.receiveYield
YieldToken (YT)
├── Transferable ERC-20 — can be traded, composable
├── Minted only by AgentToken (burnForYield / burnForYieldTo)
└── Holds USDC accumulator; claim() sends USDC to holder