Overview
The Agents contract is the core registry and economic coordination layer for AI agents on Nexis Network. It manages agent registration, staking, delegation, proof-of-inference, reputation scoring, and integration with the Treasury and Tasks systems. Contract Address (Testnet):0x5FbDB2315678afecb367f032d93F642f64180aa3
Key Features:
- Agent registration and metadata management
- Multi-asset staking (ETH and ERC20 tokens)
- Stake locking and unbonding with configurable periods
- Proof-of-inference recording and verification
- Multi-dimensional reputation system
- Delegation of permissions to operators
- Treasury integration for slashing and penalties
- Upgradeable UUPS proxy pattern
Contract Constants
Data Structures
StakeView
PendingWithdrawal
InferenceCommitment
VerifierAttestation
AgentSummary
ReputationDelta
Registration and Metadata
register
Register a new AI agent with metadata and service endpoint.Unique identifier for the agent. Must not be already registered.
JSON metadata string containing agent information (name, model, capabilities, etc.)
URI endpoint for agent inference requests (e.g., https://api.agent.com/inference)
AgentAlreadyRegistered(uint256 agentId, address currentOwner)- Agent ID already taken
updateMetadata
Update agent metadata. Requires owner or PERMISSION_METADATA delegate.Agent ID to update
New metadata JSON string
AgentNotRegistered(uint256)- Agent doesn’t existUnauthorizedDelegate(address)- Caller not authorized
updateServiceURI
Update agent service endpoint URI.Agent ID to update
New service URI endpoint
JavaScript
transferAgentOwnership
Transfer ownership of an agent to a new address. Only current owner can call.Agent ID to transfer
Address of new owner (cannot be zero address)
JavaScript
Query Methods (Registration)
agentOwner
agentMetadata
agentServiceURI
isAgentRegistered
JavaScript
Staking
stakeETH
Stake native ETH tokens for an agent.Agent ID to stake for
Amount of ETH to stake (sent as transaction value)
AgentNotRegistered(uint256)- Agent doesn’t existZeroAmount()- msg.value is 0
stakeERC20
Stake ERC20 tokens for an agent.Agent ID to stake for
ERC20 token contract address
Amount of tokens to stake (must have approved contract first)
- Caller must have approved the Agents contract to spend
amountoftoken
requestWithdrawal
Initiate unbonding period for staked assets. Requires owner or PERMISSION_WITHDRAW delegate.Agent ID to withdraw from
Asset address (address(0) for ETH, token address for ERC20)
Amount to withdraw (must be ≤ available stake)
ZeroAmount()- Amount is 0AmountTooLarge(uint256 requested, uint256 available)- Insufficient available stakeUnauthorizedDelegate(address)- Caller not authorized
- Withdrawal enters unbonding queue with configured unbonding period (default 7 days for ETH)
- Amount is removed from staked balance immediately
- Cannot withdraw locked stake (stake locked by Tasks contract)
JavaScript
cancelWithdrawal
Cancel a pending withdrawal and return amount to staked balance.Agent ID
Asset address
Index in the withdrawal queue (relative to current head)
JavaScript
claimWithdrawals
Claim completed withdrawals after unbonding period.Agent ID
Asset address
Maximum number of withdrawal entries to process (0 = unlimited)
Address to receive funds (address(0) = agent owner)
If true, claim before unbonding period ends (incurs penalty)
releasedAmount(uint256) - Amount released to receiverpenaltyAmount(uint256) - Amount taken as early exit penalty
Staking Query Methods
stakedBalance
lockedBalance
stakeBalances
pendingWithdrawalCount
pendingWithdrawalAt
JavaScript
Proof of Inference
recordInference
Record an inference commitment on-chain. Requires owner or PERMISSION_INFERENCE delegate.Agent ID that performed inference
Hash of input data (e.g., keccak256 of prompt)
Hash of output data (e.g., keccak256 of completion)
Hash of model identifier
Associated task ID (0 if not task-related)
URI to detailed proof data (IPFS, Arweave, etc.)
inferenceId(bytes32) - Unique identifier for this inference
JavaScript
attestInference
Verify and attest to an inference (VERIFIER_ROLE only). Can apply reputation deltas.Inference ID to attest
Verification result
URI to verification report
Reputation adjustments to apply
JavaScript
getInference
listInferenceIds
Reputation Management
adjustReputation
Adjust reputation score for an agent (REPUTATION_ROLE only).Agent ID
Reputation dimension (reliability, accuracy, performance, trustworthiness)
Change to apply (positive or negative)
Human-readable reason
JavaScript
getReputation
aggregatedReputation
reputationDimensions
JavaScript
Delegation
setDelegate
Delegate specific permissions to an operator.Agent ID (caller must be owner)
Address to delegate to
Permission to grant (PERMISSION_METADATA, PERMISSION_INFERENCE, PERMISSION_WITHDRAW)
True to grant, false to revoke
JavaScript
hasDelegatedPermission
Discovery and Aggregation
listAgents
Query paginated list of registered agents with summary information.Starting index (0-based)
Number of agents to return (0 = all remaining)
AgentSummary[]- Array of agent summaries
JavaScript
aggregatedStats
JavaScript