LlamaGuardOracle (EMA)
Function index37 functions
The EMA LlamaGuardOracle stores the smoothed implied rate produced by the market-state workflow and routed through LlamaguardRiskOracleRouter. The discount-rate and risk-parameter workflows read this shared state; no AgentHub agent executes EMA updates against Aave.
| Property | Value |
|---|---|
| Access model | OpenZeppelin roles; router holds WRITER_ROLE |
Example outputs
Example outputs remain TODO until a production deployment is published and can be queried.
EMA_ORACLE=<ema-oracle-address>
ROUTER=<router-address>
MARKET=<pt-market-address>Update schemas
updateLatestRiskRoundData accepts:
| Field | Type | Meaning |
|---|---|---|
referenceId | string | Calculation reference |
newValue | bytes | ABI-encoded int256 EMA implied rate |
updateType | string | Must be an authorized update type |
additionalData | bytes | Encoded EMA context consumed by downstream workflows |
deadline | uint256 | Unix timestamp after which the write reverts |
Historical reads return (timestamp, newValue, referenceId, previousValue, updateType, updateId, market, additionalData). The contract also exposes Chainlink Aggregator V2/V3-compatible round reads, with newValue decoded as the round answer.
For the PT workflow, additionalData is not arbitrary metadata: its ABI layout is part of the EMA update schema and is decoded by the downstream workflows.
Update publication and history
getLatestUpdateByParameterAndMarket
LlamaGuardOracle.getLatestUpdateByParameterAndMarket(string,address) → RiskParameterUpdate0x5decfee4Returns the latest update for an update type and market.
| Input | Type | Description |
|---|---|---|
updateType | string | Update type. |
market | address | Authorized market. |
>>> LlamaGuardOracle.getLatestUpdateByParameterAndMarket(updateType, market)
TODOgetUpdateById
LlamaGuardOracle.getUpdateById(uint256) → RiskParameterUpdate0x37759b9aReturns the update stored under an update ID.
| Input | Type | Description |
|---|---|---|
updateId | uint256 | Update ID. |
>>> LlamaGuardOracle.getUpdateById(updateId)
TODOupdateHistory
LlamaGuardOracle.updateHistory(uint256) → RiskParameterUpdate0x73ed7a90Returns the update stored under an update ID.
| Input | Type | Description |
|---|---|---|
updateId | uint256 | Update ID. |
>>> LlamaGuardOracle.updateHistory(updateId)
TODOupdateLatestRiskRoundData
LlamaGuardOracle.updateLatestRiskRoundData((string,bytes,string,bytes,uint256)) → void0x55ea1585Stores an authorized risk update as the latest oracle round.
| Input | Type | Description |
|---|---|---|
input | (string,bytes,string,bytes,uint256) | Complete update tuple. |
>>> LlamaGuardOracle.updateLatestRiskRoundData(input)
TODOAggregator interface
getLatestRoundId
LlamaGuardOracle.getLatestRoundId() → uint800x8c3b990bReturns the latest oracle round ID.
>>> LlamaGuardOracle.getLatestRoundId()
TODOlatestRoundData
LlamaGuardOracle.latestRoundData() → (uint80,int256,uint256,uint256,uint80)0xfeaf968cReturns the current latest round data.
>>> LlamaGuardOracle.latestRoundData()
TODOgetRoundData
LlamaGuardOracle.getRoundData(uint80) → (uint80,int256,uint256,uint256,uint80)0x9a6fc8f5Returns the answer and timestamps recorded for a round.
| Input | Type | Description |
|---|---|---|
roundId | uint80 | Round ID. |
>>> LlamaGuardOracle.getRoundData(roundId)
TODOlatestAnswer
LlamaGuardOracle.latestAnswer() → int2560x50d25bcdReturns the current latest answer.
>>> LlamaGuardOracle.latestAnswer()
TODOlatestTimestamp
LlamaGuardOracle.latestTimestamp() → uint2560x8205bf6aReturns the current latest timestamp.
>>> LlamaGuardOracle.latestTimestamp()
TODOlatestRound
LlamaGuardOracle.latestRound() → uint2560x668a0f02Returns the current latest round.
>>> LlamaGuardOracle.latestRound()
TODOgetAnswer
LlamaGuardOracle.getAnswer(uint256) → int2560xb5ab58dcReturns the answer recorded for a round.
| Input | Type | Description |
|---|---|---|
roundId | uint256 | Round ID. |
>>> LlamaGuardOracle.getAnswer(roundId)
TODOgetTimestamp
LlamaGuardOracle.getTimestamp(uint256) → uint2560xb633620cReturns the timestamp recorded for a round.
| Input | Type | Description |
|---|---|---|
roundId | uint256 | Round ID. |
>>> LlamaGuardOracle.getTimestamp(roundId)
TODOdecimals
LlamaGuardOracle.decimals() → uint80x313ce567Returns the current decimals.
>>> LlamaGuardOracle.decimals()
TODOdescription
LlamaGuardOracle.description() → string0x7284e416Returns the current description.
>>> LlamaGuardOracle.description()
TODOversion
LlamaGuardOracle.version() → uint2560x54fd4d50Returns the current version.
>>> LlamaGuardOracle.version()
TODOUpdate types and payloads
updateTypes
LlamaGuardOracle.updateTypes(uint256) → string0x023c8063Returns the update type stored at an array index.
| Input | Type | Description |
|---|---|---|
index | uint256 | Array index. |
>>> LlamaGuardOracle.updateTypes(index)
TODOisValidUpdateType
LlamaGuardOracle.isValidUpdateType(string) → bool0xd1a1f1bcReturns whether an update type is registered.
| Input | Type | Description |
|---|---|---|
updateType | string | Update type. |
>>> LlamaGuardOracle.isValidUpdateType(updateType)
TODOgetExpectedAdditionalDataLength
LlamaGuardOracle.getExpectedAdditionalDataLength(string) → uint2560xfb8ca9f4Returns the required additional-data length for an update type.
| Input | Type | Description |
|---|---|---|
updateType | string | Update type. |
>>> LlamaGuardOracle.getExpectedAdditionalDataLength(updateType)
TODOADDITIONAL_DATA_LENGTH_NOT_SET
LlamaGuardOracle.ADDITIONAL_DATA_LENGTH_NOT_SET() → uint2560x9fcf3aadReturns the sentinel that disables additional-data length validation.
>>> LlamaGuardOracle.ADDITIONAL_DATA_LENGTH_NOT_SET()
TODOaddUpdateType
LlamaGuardOracle.addUpdateType(string,uint256) → void0xe8a1f70eAdds update type.
| Input | Type | Description |
|---|---|---|
updateType | string | Update type. |
expectedAdditionalDataLength | uint256 | Expected additional-data length. |
>>> LlamaGuardOracle.addUpdateType(updateType, expectedAdditionaldataLength)
TODOremoveUpdateType
LlamaGuardOracle.removeUpdateType(string) → void0xc325ddc6Removes update type.
| Input | Type | Description |
|---|---|---|
updateType | string | Update type. |
>>> LlamaGuardOracle.removeUpdateType(updateType)
TODOsetExpectedAdditionalDataLength
LlamaGuardOracle.setExpectedAdditionalDataLength(string,uint256) → void0xca3fa97cSets expected additional data length.
| Input | Type | Description |
|---|---|---|
updateType | string | Update type. |
expectedLength | uint256 | Byte length or sentinel. |
>>> LlamaGuardOracle.setExpectedAdditionalDataLength(updateType, expectedLength)
TODOMarket safeguards
isAuthorizedMarket
LlamaGuardOracle.isAuthorizedMarket(address) → bool0x99079671Returns whether a market may receive updates.
| Input | Type | Description |
|---|---|---|
market | address | Market. |
>>> LlamaGuardOracle.isAuthorizedMarket(market)
TODOmaxPriceDeviation
LlamaGuardOracle.maxPriceDeviation() → uint2560x975b8662Returns the maximum price deviation in basis points; zero disables the check.
>>> LlamaGuardOracle.maxPriceDeviation()
TODOsetMaxPriceDeviation
LlamaGuardOracle.setMaxPriceDeviation(uint256) → void0x9ee4c057Sets max price deviation.
| Input | Type | Description |
|---|---|---|
newMaxDeviation | uint256 | New max deviation. |
>>> LlamaGuardOracle.setMaxPriceDeviation(newMaxDeviation)
TODOaddAuthorizedMarket
LlamaGuardOracle.addAuthorizedMarket(address) → void0x81941eb0Adds authorized market.
| Input | Type | Description |
|---|---|---|
market | address | Non-zero market. |
>>> LlamaGuardOracle.addAuthorizedMarket(market)
TODOremoveAuthorizedMarket
LlamaGuardOracle.removeAuthorizedMarket(address) → void0x335f6333Removes authorized market.
| Input | Type | Description |
|---|---|---|
market | address | Authorized market. |
>>> LlamaGuardOracle.removeAuthorizedMarket(market)
TODORoles and interface support
DEFAULT_ADMIN_ROLE
LlamaGuardOracle.DEFAULT_ADMIN_ROLE() → bytes320xa217fddfReturns the current default admin role.
>>> LlamaGuardOracle.DEFAULT_ADMIN_ROLE()
TODOREADER_ROLE
LlamaGuardOracle.READER_ROLE() → bytes320x458c4458Returns the current reader role.
>>> LlamaGuardOracle.READER_ROLE()
TODOWRITER_ROLE
LlamaGuardOracle.WRITER_ROLE() → bytes320x9beaab7bReturns the current writer role.
>>> LlamaGuardOracle.WRITER_ROLE()
TODOhasRole
LlamaGuardOracle.hasRole(bytes32,address) → bool0x91d14854Returns whether an account holds a role.
| Input | Type | Description |
|---|---|---|
role | bytes32 | Role ID. |
account | address | Account. |
>>> LlamaGuardOracle.hasRole(role, account)
TODOhasWriteAccess
LlamaGuardOracle.hasWriteAccess(address) → bool0xf7c1ec9fReturns whether an account may publish updates.
| Input | Type | Description |
|---|---|---|
account | address | Account. |
>>> LlamaGuardOracle.hasWriteAccess(account)
TODOgetRoleAdmin
LlamaGuardOracle.getRoleAdmin(bytes32) → bytes320x248a9ca3Returns the administrator role for a role ID.
| Input | Type | Description |
|---|---|---|
role | bytes32 | Role ID. |
>>> LlamaGuardOracle.getRoleAdmin(role)
TODOsupportsInterface
LlamaGuardOracle.supportsInterface(bytes4) → bool0x01ffc9a7Returns whether the contract implements an interface ID.
| Input | Type | Description |
|---|---|---|
interfaceId | bytes4 | Interface ID. |
>>> LlamaGuardOracle.supportsInterface(interfaceId)
TODOgrantRole
LlamaGuardOracle.grantRole(bytes32,address) → void0x2f2ff15dGrants a role to an account.
| Input | Type | Description |
|---|---|---|
role | bytes32 | Role ID. |
account | address | Account. |
>>> LlamaGuardOracle.grantRole(role, account)
TODOrevokeRole
LlamaGuardOracle.revokeRole(bytes32,address) → void0xd547741fRevokes a role from an account.
| Input | Type | Description |
|---|---|---|
role | bytes32 | Role ID. |
account | address | Account. |
>>> LlamaGuardOracle.revokeRole(role, account)
TODOrenounceRole
LlamaGuardOracle.renounceRole(bytes32,address) → void0x36568abeRenounces role.
| Input | Type | Description |
|---|---|---|
role | bytes32 | Role ID. |
callerConfirmation | address | Caller's address. |
>>> LlamaGuardOracle.renounceRole(role, callerConfirmation)
TODO