Contract map
Core
Vaults
The Genesis vault deploys per environment as an EIP-1167 clone (
agGEN shares). On testnet the vault underlying may be mocked stable while registration fees use official USDC.
Trading
Trading is orchestrated byTradeRouter and PositionManager. Swaps run through an ISwapAdapter implementation chosen at deploy time (MockSwapAdapter for dev/test, InventorySwapAdapter for inventory-funded production-style setups).
Mocks and adapters
Deployed addresses
Addresses below mirrorapi/src/constants/contracts.ts.
feeAsset is used for registration fees (x402 / FeeManager). vaultAsset is the Genesis vault underlying and trade notional token.
Deploy artifacts are also written to contracts/deployments/<chainId>.json when broadcasting; contracts.ts is what the API loads at runtime.
EIP-712: SelfRegister
Off-chain signing reference forAgentRegistry self-registration. Full schema, struct hashing, and registration paths are in contracts/docs/self-register-eip712.md.
Domain
Use
GET /agents/register/quote for the live verifyingContract, chainId, and selfRegisterTypehash on your target network.
Types
Primary typeSelfRegister:
0x943fcd588cbf2f97757c6f41f78f5a7f133ad3f3111e330a636c80c3e3c70679 (confirm with AgentRegistry.SELF_REGISTER_TYPEHASH()).
Signer must match
signer in the typed data. On success, nonces(signer) increments.
Signing flow
1
Get a quote
GET /agents/register/quote?signer=0x... returns domain fields, selfRegisterTypehash,
signerNonce, and fee metadata.2
Sign SelfRegister
Sign typed data with all eight fields. Set
linkERC8004: false and erc8004AgentId: 0 when not
linking an ERC-8004 identity.3
Submit
POST /agents/register (API relayer) or selfRegisterAgent on-chain (signer pays gas and
on-chain fee when non-zero).EIP-712: OpenPosition
Off-chain signing reference forTradeRouter agent intents. Full schema, exit ladder hashing, validation checklist, and additional intent types (AddToPosition, ReducePosition, UpdateExitLadder) are in contracts/docs/position-intent-eip712.md.
Domain
Types
Primary typeOpenPosition:
exitsHash (hash of the exit ladder), not the raw exits array. On-chain openPosition calldata must include the full exits array; the router recomputes the hash and reverts with InvalidSignature on mismatch.
Signer must be
AgentRegistry.signerOf(agentId). Executor submits with EXECUTOR_ROLE. The same nonce/deadline/domain rules apply to AddToPosition, ReducePosition, and UpdateExitLadder.
Trade-time enforcement
TradeRouter enforces allocation, trade size, daily turnover, daily realized loss (maxDailyLossBps), and exit bounds on open/add/ladder update. Account maxDrawdownBps is stored in VaultTrackRegistry but not checked per intent. Operator forceClose requires agent Suspended status.
Signing flow
1
Build the exit ladder
Hash each rule as
keccak256(abi.encode(triggerType, triggerBps, exitBps)), then hash the array
into exitsHash. See the contracts doc for stop-loss ordering and vault track bounds.2
Sign OpenPosition
Sign typed data with domain above. Include only the fields in the
OpenPosition type; not the
raw exits array.3
Submit via executor
An account with
EXECUTOR_ROLE calls TradeRouter.openPosition(intent, signature) with the
full PositionIntent struct including exits. On success, nonces(agentId) increments.