AgentHub
Function index39 functions
The AgentHub connects stored recommendations to execution agents. After the router publishes to RiskOracle, it calls the hub to find eligible updates and execute them through the discount-rate or eMode agent. The hub enforces update expiry, replay protection, minimum delays, market configuration, permissioning, and maximum batch size before calling an agent.
| Property | Value |
|---|---|
| Configured agents | Discount-rate agent 0; eMode agent 1 |
Example outputs
Example outputs remain TODO until a production deployment is published and can be queried.
AGENT_HUB=<agent-hub-address>
MARKET=<pt-market-address>
DISCOUNT_AGENT_ID=0
EMODE_AGENT_ID=1Agent registration schema
registerAgent accepts one tuple:
| Field | Type | Meaning |
|---|---|---|
admin | address | Agent-specific configuration administrator |
riskOracle | address | Oracle read by the agent registration |
isAgentEnabled | bool | Whether the hub considers the agent |
isAgentPermissioned | bool | Whether execution is restricted to configured senders |
isMarketsFromAgentEnabled | bool | Read markets from the agent instead of the hub allowlist |
agentAddress | address | Contract that validates and injects updates |
expirationPeriod | uint256 | Maximum age of an oracle update |
minimumDelay | uint256 | Minimum interval between injections for a market |
updateType | string | RiskOracle update type consumed by the agent |
agentContext | bytes | Agent-specific execution configuration |
allowedMarkets | address[] | Explicit market allowlist |
restrictedMarkets | address[] | Markets excluded when reading markets from the agent |
permissionedSenders | address[] | Addresses allowed to execute a permissioned agent |
Update lifecycle
check
AgentHub.check(uint256[]) → (bool,(uint256,address[])[])0x1b365701Returns the pending updates that are eligible for execution.
| Input | Type | Description |
|---|---|---|
agentIds | uint256[] | Agent IDs. |
>>> AgentHub.check(agentIds)
TODOgetLastInjectedUpdate
AgentHub.getLastInjectedUpdate(uint256,address) → (timestamp: uint48, id: uint208)0x7f625c45Returns the last update an agent injected for a market.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
market | address | Market. |
>>> AgentHub.getLastInjectedUpdate(agentId, market)
TODOexecute
AgentHub.execute((uint256,address[])[]) → void0x292762a1Executes eligible updates through their configured agents.
| Input | Type | Description |
|---|---|---|
actions | (uint256,address[])[] | Actions returned by check. |
>>> AgentHub.execute(actions)
TODOAgent registry
getAgentCount
AgentHub.getAgentCount() → uint2560x91cab63eReturns the agent count.
>>> AgentHub.getAgentCount()
TODOgetAgentAddress
AgentHub.getAgentAddress(uint256) → address0x8f2357baReturns the execution contract registered for an agent.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getAgentAddress(agentId)
TODOgetAgentAdmin
AgentHub.getAgentAdmin(uint256) → address0xa3ce320aReturns the administrator assigned to an agent.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getAgentAdmin(agentId)
TODOgetAgentContext
AgentHub.getAgentContext(uint256) → bytes0x04a98e89Returns the protocol-specific context stored for an agent.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getAgentContext(agentId)
TODOgetRiskOracle
AgentHub.getRiskOracle(uint256) → address0x1da3487bReturns the oracle assigned to an agent.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getRiskOracle(agentId)
TODOgetUpdateType
AgentHub.getUpdateType(uint256) → string0x7d9cf069Returns the update type handled by the agent.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getUpdateType(agentId)
TODOisAgentEnabled
AgentHub.isAgentEnabled(uint256) → bool0xc0385cb5Returns whether an agent is enabled.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.isAgentEnabled(agentId)
TODOisAgentPermissioned
AgentHub.isAgentPermissioned(uint256) → bool0x36b34450Returns whether an agent uses permissioned execution.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.isAgentPermissioned(agentId)
TODOisMarketsFromAgentEnabled
AgentHub.isMarketsFromAgentEnabled(uint256) → bool0xe7d1bf4eReturns whether AgentHub reads the market list from the agent.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.isMarketsFromAgentEnabled(agentId)
TODOregisterAgent
AgentHub.registerAgent((address,address,bool,bool,bool,address,uint256,uint256,string,bytes,address[],address[],address[])) → void0x80b185f3Registers a new execution agent and its initial configuration.
| Input | Type | Description |
|---|---|---|
registrationInput | (address,address,bool,bool,bool,address,uint256,uint256,string,bytes,address[],address[],address[]) | Complete registration tuple. |
>>> AgentHub.registerAgent(registrationInput)
TODOsetAgentAddress
AgentHub.setAgentAddress(uint256,address) → void0xcddd6c63Sets agent address.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
agentContract | address | Agent contract. |
>>> AgentHub.setAgentAddress(agentId, agentContract)
TODOsetAgentAdmin
AgentHub.setAgentAdmin(uint256,address) → void0x641908e8Sets agent admin.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
admin | address | Admin. |
>>> AgentHub.setAgentAdmin(agentId, admin)
TODOsetAgentEnabled
AgentHub.setAgentEnabled(uint256,bool) → void0x3ea745b5Sets agent enabled.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
enable | bool | Enabled state. |
>>> AgentHub.setAgentEnabled(agentId, enable)
TODOsetAgentAsPermissioned
AgentHub.setAgentAsPermissioned(uint256,bool) → void0xc0385c39Sets agent as permissioned.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
enabled | bool | Permissioned state. |
>>> AgentHub.setAgentAsPermissioned(agentId, enabled)
TODOsetMarketsFromAgentEnabled
AgentHub.setMarketsFromAgentEnabled(uint256,bool) → void0x424c086dSets markets from agent enabled.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
enabled | bool | Market-source mode. |
>>> AgentHub.setMarketsFromAgentEnabled(agentId, enabled)
TODOsetAgentContext
AgentHub.setAgentContext(uint256,bytes) → void0x13734224Sets agent context.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
encodedContext | bytes | Encoded context. |
>>> AgentHub.setAgentContext(agentId, encodedContext)
TODOTiming and batch limits
getExpirationPeriod
AgentHub.getExpirationPeriod(uint256) → uint2560xe47a7c85Returns the validity period configured for an agent.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getExpirationPeriod(agentId)
TODOgetMinimumDelay
AgentHub.getMinimumDelay(uint256) → uint2560xa5a57d20Returns the minimum delay configured for an agent.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getMinimumDelay(agentId)
TODOgetMaxBatchSize
AgentHub.getMaxBatchSize() → uint2560xe7c00f6eReturns the maximum number of updates handled in one batch; zero means uncapped.
>>> AgentHub.getMaxBatchSize()
TODOsetExpirationPeriod
AgentHub.setExpirationPeriod(uint256,uint256) → void0x3999c73dSets expiration period.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
expirationPeriod | uint256 | Validity period in seconds. |
>>> AgentHub.setExpirationPeriod(agentId, expirationPeriod)
TODOsetMinimumDelay
AgentHub.setMinimumDelay(uint256,uint256) → void0x8bdcabf6Sets minimum delay.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
minimumDelay | uint256 | Minimum delay in seconds. |
>>> AgentHub.setMinimumDelay(agentId, minimumDelay)
TODOsetMaxBatchSize
AgentHub.setMaxBatchSize(uint256) → void0x2b26a6bfSets max batch size.
| Input | Type | Description |
|---|---|---|
maxBatchSize | uint256 | Max batch size. |
>>> AgentHub.setMaxBatchSize(maxBatchSize)
TODOMarket policy
getAllowedMarkets
AgentHub.getAllowedMarkets(uint256) → address[]0xfe711961Returns the markets an agent is allowed to handle.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getAllowedMarkets(agentId)
TODOgetRestrictedMarkets
AgentHub.getRestrictedMarkets(uint256) → address[]0xb4368446Returns the markets an agent is not allowed to handle.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getRestrictedMarkets(agentId)
TODOaddAllowedMarket
AgentHub.addAllowedMarket(uint256,address) → void0x24241b3aAdds allowed market.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
market | address | Market. |
>>> AgentHub.addAllowedMarket(agentId, market)
TODOremoveAllowedMarket
AgentHub.removeAllowedMarket(uint256,address) → void0x4c364752Removes allowed market.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
market | address | Market. |
>>> AgentHub.removeAllowedMarket(agentId, market)
TODOaddRestrictedMarket
AgentHub.addRestrictedMarket(uint256,address) → void0xcc315a40Adds restricted market.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
market | address | Market. |
>>> AgentHub.addRestrictedMarket(agentId, market)
TODOremoveRestrictedMarket
AgentHub.removeRestrictedMarket(uint256,address) → void0x6bf21870Removes restricted market.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
market | address | Market. |
>>> AgentHub.removeRestrictedMarket(agentId, market)
TODOPermissioned senders
getPermissionedSenders
AgentHub.getPermissionedSenders(uint256) → address[]0x889ef34cReturns the addresses allowed to call permissioned functions.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
>>> AgentHub.getPermissionedSenders(agentId)
TODOisPermissionedSender
AgentHub.isPermissionedSender(uint256,address) → bool0xa0d1e6f3Returns whether an address may call permissioned functions.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
sender | address | Sender. |
>>> AgentHub.isPermissionedSender(agentId, sender)
TODOaddPermissionedSender
AgentHub.addPermissionedSender(uint256,address) → void0xd8c49b56Adds permissioned sender.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
sender | address | Sender. |
>>> AgentHub.addPermissionedSender(agentId, sender)
TODOremovePermissionedSender
AgentHub.removePermissionedSender(uint256,address) → void0x1ab04666Removes permissioned sender.
| Input | Type | Description |
|---|---|---|
agentId | uint256 | Agent ID. |
sender | address | Sender. |
>>> AgentHub.removePermissionedSender(agentId, sender)
TODOInitialization and ownership
owner
AgentHub.owner() → address0x8da5cb5bReturns the current owner.
>>> AgentHub.owner()
TODOinitialize
AgentHub.initialize(address) → void0xc4d66de8Initializes AgentHub ownership and administration.
| Input | Type | Description |
|---|---|---|
initialOwner | address | Initial owner. |
>>> AgentHub.initialize(initialOwner)
TODOtransferOwnership
AgentHub.transferOwnership(address) → void0xf2fde38bTransfers ownership.
| Input | Type | Description |
|---|---|---|
owner | address | New owner. |
>>> AgentHub.transferOwnership(owner)
TODOrenounceOwnership
AgentHub.renounceOwnership() → void0x715018a6Renounces ownership.
>>> AgentHub.renounceOwnership()
TODODo not call initialize on the deployed proxy: it is initialized during deployment. execute revalidates every requested action and reverts if no action can be performed.