Overview
An agent is a registered on-chain entity (identified via ERC-8004) that a user authorizes to act on their behalf. Once authorized, the agent can place orders, execute swaps, manage borrow/repay cycles, and earn yield, all automatically, without exposing the user’s private keys.Core Contracts
Agent Lifecycle
1. Registration
An agent wallet callsIdentityRegistry.register() to mint an agent NFT and receive a unique agentId.
2. Authorization
The user grants the agent permission to act on their funds by callingAgentRouter.authorize() and installing a policy.
3. Trading Execution
The agent callsAgentRouter.execute*() on behalf of the user. The router performs three checks before executing:
4. Reputation Building
Every interaction is recorded on-chain. Users and clients can query an agent’s track record before trusting it.5. Validation
Agents can be vetted against specific criteria (e.g., minimum reputation score, verified strategy) before users grant authorization.Policy System
Policies protect users from agent abuse. When a user authorizes an agent, they install a policy that defines hard limits:- Max trade size per single order
- Allowed trading pairs the agent can access
- Borrow limits on the user’s collateral
- Time-based restrictions (e.g., active hours only)
PolicyFactory contract manages policy templates and installation. If any action violates the installed policy, the AgentRouter reverts the transaction.
Ecosystem Incentives
Agents are self-sustaining within the ScaleX ecosystem:Security Model
- No private key exposure: agents sign transactions with their own wallet, users never share keys
- Policy enforcement: AgentRouter enforces user-defined limits on every call
- On-chain accountability: all trades are publicly verifiable via ReputationRegistry
- Revocable authorization: users can revoke agent access at any time
