LlamaRisk

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.

PropertyValue
Configured agentsDiscount-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=1

Agent registration schema

registerAgent accepts one tuple:

FieldTypeMeaning
adminaddressAgent-specific configuration administrator
riskOracleaddressOracle read by the agent registration
isAgentEnabledboolWhether the hub considers the agent
isAgentPermissionedboolWhether execution is restricted to configured senders
isMarketsFromAgentEnabledboolRead markets from the agent instead of the hub allowlist
agentAddressaddressContract that validates and injects updates
expirationPerioduint256Maximum age of an oracle update
minimumDelayuint256Minimum interval between injections for a market
updateTypestringRiskOracle update type consumed by the agent
agentContextbytesAgent-specific execution configuration
allowedMarketsaddress[]Explicit market allowlist
restrictedMarketsaddress[]Markets excluded when reading markets from the agent
permissionedSendersaddress[]Addresses allowed to execute a permissioned agent

Update lifecycle

check

AgentHub.check(uint256[]) → (bool,(uint256,address[])[])0x1b365701

Returns the pending updates that are eligible for execution.

InputTypeDescription
agentIdsuint256[]Agent IDs.
Example
>>> AgentHub.check(agentIds)
TODO

getLastInjectedUpdate

AgentHub.getLastInjectedUpdate(uint256,address) → (timestamp: uint48, id: uint208)0x7f625c45

Returns the last update an agent injected for a market.

InputTypeDescription
agentIduint256Agent ID.
marketaddressMarket.
Example
>>> AgentHub.getLastInjectedUpdate(agentId, market)
TODO

execute

AgentHub.execute((uint256,address[])[]) → void0x292762a1

Executes eligible updates through their configured agents.

InputTypeDescription
actions(uint256,address[])[]Actions returned by check.

Authorization: Permissionless unless an included agent is permissioned

Example
>>> AgentHub.execute(actions)
TODO

Agent registry

getAgentCount

AgentHub.getAgentCount() → uint2560x91cab63e

Returns the agent count.

Example
>>> AgentHub.getAgentCount()
TODO

getAgentAddress

AgentHub.getAgentAddress(uint256) → address0x8f2357ba

Returns the execution contract registered for an agent.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getAgentAddress(agentId)
TODO

getAgentAdmin

AgentHub.getAgentAdmin(uint256) → address0xa3ce320a

Returns the administrator assigned to an agent.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getAgentAdmin(agentId)
TODO

getAgentContext

AgentHub.getAgentContext(uint256) → bytes0x04a98e89

Returns the protocol-specific context stored for an agent.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getAgentContext(agentId)
TODO

getRiskOracle

AgentHub.getRiskOracle(uint256) → address0x1da3487b

Returns the oracle assigned to an agent.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getRiskOracle(agentId)
TODO

getUpdateType

AgentHub.getUpdateType(uint256) → string0x7d9cf069

Returns the update type handled by the agent.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getUpdateType(agentId)
TODO

isAgentEnabled

AgentHub.isAgentEnabled(uint256) → bool0xc0385cb5

Returns whether an agent is enabled.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.isAgentEnabled(agentId)
TODO

isAgentPermissioned

AgentHub.isAgentPermissioned(uint256) → bool0x36b34450

Returns whether an agent uses permissioned execution.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.isAgentPermissioned(agentId)
TODO

isMarketsFromAgentEnabled

AgentHub.isMarketsFromAgentEnabled(uint256) → bool0xe7d1bf4e

Returns whether AgentHub reads the market list from the agent.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.isMarketsFromAgentEnabled(agentId)
TODO

registerAgent

AgentHub.registerAgent((address,address,bool,bool,bool,address,uint256,uint256,string,bytes,address[],address[],address[])) → void0x80b185f3

Registers a new execution agent and its initial configuration.

InputTypeDescription
registrationInput(address,address,bool,bool,bool,address,uint256,uint256,string,bytes,address[],address[],address[])Complete registration tuple.

Authorization: Owner

Example
>>> AgentHub.registerAgent(registrationInput)
TODO

setAgentAddress

AgentHub.setAgentAddress(uint256,address) → void0xcddd6c63

Sets agent address.

InputTypeDescription
agentIduint256Agent ID.
agentContractaddressAgent contract.

Authorization: Owner

Example
>>> AgentHub.setAgentAddress(agentId, agentContract)
TODO

setAgentAdmin

AgentHub.setAgentAdmin(uint256,address) → void0x641908e8

Sets agent admin.

InputTypeDescription
agentIduint256Agent ID.
adminaddressAdmin.

Authorization: Owner

Example
>>> AgentHub.setAgentAdmin(agentId, admin)
TODO

setAgentEnabled

AgentHub.setAgentEnabled(uint256,bool) → void0x3ea745b5

Sets agent enabled.

InputTypeDescription
agentIduint256Agent ID.
enableboolEnabled state.

Authorization: Owner or agent admin

Example
>>> AgentHub.setAgentEnabled(agentId, enable)
TODO

setAgentAsPermissioned

AgentHub.setAgentAsPermissioned(uint256,bool) → void0xc0385c39

Sets agent as permissioned.

InputTypeDescription
agentIduint256Agent ID.
enabledboolPermissioned state.

Authorization: Owner or agent admin

Example
>>> AgentHub.setAgentAsPermissioned(agentId, enabled)
TODO

setMarketsFromAgentEnabled

AgentHub.setMarketsFromAgentEnabled(uint256,bool) → void0x424c086d

Sets markets from agent enabled.

InputTypeDescription
agentIduint256Agent ID.
enabledboolMarket-source mode.

Authorization: Owner or agent admin

Example
>>> AgentHub.setMarketsFromAgentEnabled(agentId, enabled)
TODO

setAgentContext

AgentHub.setAgentContext(uint256,bytes) → void0x13734224

Sets agent context.

InputTypeDescription
agentIduint256Agent ID.
encodedContextbytesEncoded context.

Authorization: Owner or agent admin

Example
>>> AgentHub.setAgentContext(agentId, encodedContext)
TODO

Timing and batch limits

getExpirationPeriod

AgentHub.getExpirationPeriod(uint256) → uint2560xe47a7c85

Returns the validity period configured for an agent.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getExpirationPeriod(agentId)
TODO

getMinimumDelay

AgentHub.getMinimumDelay(uint256) → uint2560xa5a57d20

Returns the minimum delay configured for an agent.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getMinimumDelay(agentId)
TODO

getMaxBatchSize

AgentHub.getMaxBatchSize() → uint2560xe7c00f6e

Returns the maximum number of updates handled in one batch; zero means uncapped.

Example
>>> AgentHub.getMaxBatchSize()
TODO

setExpirationPeriod

AgentHub.setExpirationPeriod(uint256,uint256) → void0x3999c73d

Sets expiration period.

InputTypeDescription
agentIduint256Agent ID.
expirationPerioduint256Validity period in seconds.

Authorization: Owner or agent admin

Example
>>> AgentHub.setExpirationPeriod(agentId, expirationPeriod)
TODO

setMinimumDelay

AgentHub.setMinimumDelay(uint256,uint256) → void0x8bdcabf6

Sets minimum delay.

InputTypeDescription
agentIduint256Agent ID.
minimumDelayuint256Minimum delay in seconds.

Authorization: Owner or agent admin

Example
>>> AgentHub.setMinimumDelay(agentId, minimumDelay)
TODO

setMaxBatchSize

AgentHub.setMaxBatchSize(uint256) → void0x2b26a6bf

Sets max batch size.

InputTypeDescription
maxBatchSizeuint256Max batch size.

Authorization: Owner

Example
>>> AgentHub.setMaxBatchSize(maxBatchSize)
TODO

Market policy

getAllowedMarkets

AgentHub.getAllowedMarkets(uint256) → address[]0xfe711961

Returns the markets an agent is allowed to handle.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getAllowedMarkets(agentId)
TODO

getRestrictedMarkets

AgentHub.getRestrictedMarkets(uint256) → address[]0xb4368446

Returns the markets an agent is not allowed to handle.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getRestrictedMarkets(agentId)
TODO

addAllowedMarket

AgentHub.addAllowedMarket(uint256,address) → void0x24241b3a

Adds allowed market.

InputTypeDescription
agentIduint256Agent ID.
marketaddressMarket.

Authorization: Owner or agent admin

Example
>>> AgentHub.addAllowedMarket(agentId, market)
TODO

removeAllowedMarket

AgentHub.removeAllowedMarket(uint256,address) → void0x4c364752

Removes allowed market.

InputTypeDescription
agentIduint256Agent ID.
marketaddressMarket.

Authorization: Owner or agent admin

Example
>>> AgentHub.removeAllowedMarket(agentId, market)
TODO

addRestrictedMarket

AgentHub.addRestrictedMarket(uint256,address) → void0xcc315a40

Adds restricted market.

InputTypeDescription
agentIduint256Agent ID.
marketaddressMarket.

Authorization: Owner or agent admin

Example
>>> AgentHub.addRestrictedMarket(agentId, market)
TODO

removeRestrictedMarket

AgentHub.removeRestrictedMarket(uint256,address) → void0x6bf21870

Removes restricted market.

InputTypeDescription
agentIduint256Agent ID.
marketaddressMarket.

Authorization: Owner or agent admin

Example
>>> AgentHub.removeRestrictedMarket(agentId, market)
TODO

Permissioned senders

getPermissionedSenders

AgentHub.getPermissionedSenders(uint256) → address[]0x889ef34c

Returns the addresses allowed to call permissioned functions.

InputTypeDescription
agentIduint256Agent ID.
Example
>>> AgentHub.getPermissionedSenders(agentId)
TODO

isPermissionedSender

AgentHub.isPermissionedSender(uint256,address) → bool0xa0d1e6f3

Returns whether an address may call permissioned functions.

InputTypeDescription
agentIduint256Agent ID.
senderaddressSender.
Example
>>> AgentHub.isPermissionedSender(agentId, sender)
TODO

addPermissionedSender

AgentHub.addPermissionedSender(uint256,address) → void0xd8c49b56

Adds permissioned sender.

InputTypeDescription
agentIduint256Agent ID.
senderaddressSender.

Authorization: Owner or agent admin

Example
>>> AgentHub.addPermissionedSender(agentId, sender)
TODO

removePermissionedSender

AgentHub.removePermissionedSender(uint256,address) → void0x1ab04666

Removes permissioned sender.

InputTypeDescription
agentIduint256Agent ID.
senderaddressSender.

Authorization: Owner or agent admin

Example
>>> AgentHub.removePermissionedSender(agentId, sender)
TODO

Initialization and ownership

owner

AgentHub.owner() → address0x8da5cb5b

Returns the current owner.

Example
>>> AgentHub.owner()
TODO

initialize

AgentHub.initialize(address) → void0xc4d66de8

Initializes AgentHub ownership and administration.

InputTypeDescription
initialOwneraddressInitial owner.

Authorization: Initializer; already called on the deployed proxy

Example
>>> AgentHub.initialize(initialOwner)
TODO

transferOwnership

AgentHub.transferOwnership(address) → void0xf2fde38b

Transfers ownership.

InputTypeDescription
owneraddressNew owner.

Authorization: Owner

Example
>>> AgentHub.transferOwnership(owner)
TODO

renounceOwnership

AgentHub.renounceOwnership() → void0x715018a6

Renounces ownership.

Authorization: Owner

Example
>>> AgentHub.renounceOwnership()
TODO

Do 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.

On this page