Skip to content

RiskOracle

Contract for managing and publishing risk parameter updates for Risk-Steward Updates

This API is pinned to RiskOracle.sol at v2.15.0. On BNB mainnet at block 118369568, proxy 0x0E3E51958b0Daa8C57c949675975CBEDd7b5a1a1 used implementation 0x34045517284cB1Ac2806Fe3298a39886DA29De48, matching the tagged artifact.

The proxy surface also includes inherited two-step ownership, AccessControlManager, and upgrade selectors. Publishing authorization is determined by authorizedSenders and active update types; ABI presence alone does not authorize a caller.

Counter to keep track of the total number of updates

uint256 updateCounter

Array to store all update types

string[] allUpdateTypes

Whitelist of valid update type identifiers, keyed by updateType hash

mapping(bytes32 => bool) activeUpdateTypes

Mapping from unique update ID to the update details

mapping(uint256 => struct RiskParameterUpdate) updatesById

Authorized accounts capable of proposing updates

mapping(address => bool) authorizedSenders

Mapping to store the latest update ID for each combination of update type key and market

mapping(bytes32 => mapping(address => uint256)) latestUpdateIdByMarketAndType

Disables initializers

constructor() public

Initializes the contract with access control manager

function initialize(address accessControlManager_) external
NameTypeDescription
accessControlManager_addressAddress of the access control manager
  • Reverts with “invalid acess control manager address” if accessControlManager_ is zero address

Adds a new sender to the list of addresses authorized to perform updates

function addAuthorizedSender(address sender) external
NameTypeDescription
senderaddressAddress to be authorized
  • Emits AuthorizedSenderAdded when sender is successfully added
  • Controlled by AccessControlManager
  • Throws ZeroAddressNotAllowed if sender is zero address
  • Throws SenderAlreadyAuthorized if sender is already authorized
  • Throws Unauthorized if caller is not allowed by AccessControlManager

Removes an address from the list of authorized senders

function removeAuthorizedSender(address sender) external
NameTypeDescription
senderaddressAddress to be unauthorized
  • Emits AuthorizedSenderRemoved when sender is successfully removed
  • Controlled by AccessControlManager
  • Throws SenderNotAuthorized if sender is not currently authorized
  • Throws Unauthorized if caller is not allowed by AccessControlManager

Adds a new type of update to the list of authorized update types

function addUpdateType(string newUpdateType) external
NameTypeDescription
newUpdateTypestringNew type of update to allow
  • Emits UpdateTypeAdded when update type is successfully added
  • Controlled by AccessControlManager
  • Throws InvalidUpdateTypeString if update type string is empty or exceeds 64 characters
  • Throws UpdateTypeAlreadyExists if update type already exists
  • Throws Unauthorized if caller is not allowed by AccessControlManager

Sets the active status of an existing update type

function setUpdateTypeActive(string updateType, bool active) external
NameTypeDescription
updateTypestringThe update type to set active status for
activeboolTrue to activate, false to deactivate
  • Emits UpdateTypeActiveStatusChanged when status is successfully changed
  • Controlled by AccessControlManager
  • Throws UpdateTypeNotFound if update type doesn’t exist
  • Throws UpdateTypeStatusUnchanged if status is already set to the desired value
  • Throws Unauthorized if caller is not allowed by AccessControlManager

Publishes a new risk parameter update

function publishRiskParameterUpdate(string referenceId, bytes newValue, string updateType, address market, uint96 poolId, uint32 dstEid, bytes additionalData) external
NameTypeDescription
referenceIdstringAn external reference ID associated with the update
newValuebytesThe new value of the risk parameter being updated
updateTypestringType of update performed, must be previously authorized
marketaddressAddress for market of the parameter update
poolIduint96Pool identifier for eMode-style collateral configuration (0 for regular markets)
dstEiduint32Destination endpoint ID for cross-chain routing
additionalDatabytesAdditional data for the update
  • Emits UpdatePublished when update is successfully published
  • Throws SenderNotAuthorized if caller is not an authorized sender
  • Throws UpdateTypeNotActive if update type is not active
  • Throws ZeroAddressNotAllowed if market is zero address

Publishes multiple risk parameter updates in a single transaction

function publishBulkRiskParameterUpdates(string[] referenceIds, bytes[] newValues, string[] updateTypes, address[] markets, uint96[] poolIds, uint32[] dstEid, bytes[] additionalData) external
NameTypeDescription
referenceIdsstring[]Array of external reference IDs
newValuesbytes[]Array of new values for each update
updateTypesstring[]Array of types for each update, all must be authorized
marketsaddress[]Array of addresses for markets of the parameter updates
poolIdsuint96[]Array of pool identifiers for eMode-style collateral configuration (0 for regular markets)
dstEiduint32[]Array of destination endpoint IDs for cross-chain routing
additionalDatabytes[]Array of additional data for the updates
  • Emits UpdatePublished for each successfully published update
  • Throws SenderNotAuthorized if caller is not an authorized sender
  • Throws ArrayLengthMismatch if the array lengths do not match or if no updates are provided
  • Throws UpdateTypeNotActive if any update type is not active
  • Throws ZeroAddressNotAllowed if any market is zero address

Fetches the most recent update for a specific parameter in a specific market

function getLatestUpdateByTypeAndMarket(string updateType, address market) external view returns (struct RiskParameterUpdate)
NameTypeDescription
updateTypestringThe identifier for the parameter
marketaddressThe market identifier
NameTypeDescription
[0]struct RiskParameterUpdateThe most recent RiskParameterUpdate for the specified parameter and market
  • Throws NoUpdateFound if no update exists for the specified parameter and market

Fetches the update for a provided updateId

function getUpdateById(uint256 updateId) external view returns (struct RiskParameterUpdate)
NameTypeDescription
updateIduint256Update ID
NameTypeDescription
[0]struct RiskParameterUpdateThe RiskParameterUpdate for the specified id
  • Throws InvalidUpdateId if updateId is 0 or greater than updateCounter

Returns the total number of update types in the allUpdateTypes array

function allUpdateTypesLength() external view returns (uint256)
NameTypeDescription
[0]uint256The length of the allUpdateTypes array

Gets the latest update ID for a specific market and update type (string) combination

function getLatestUpdateIdByTypeAndMarket(string updateType, address market) external view returns (uint256)
NameTypeDescription
updateTypestringThe update type string
marketaddressThe market address
NameTypeDescription
[0]uint256The latest update ID for the given market and update type, or 0 if none exists

Checks if a given update type is currently active.

function getActiveUpdateTypes(string updateType) external view returns (bool)
NameTypeDescription
updateTypestringThe update type string to check
NameTypeDescription
[0]boolTrue if the update type is active, false otherwise

Returns all update types in the allUpdateTypes array

function getAllUpdateTypes() external view returns (string[])
NameTypeDescription
[0]string[]An array of all update type strings

Disables renounceOwnership function

function renounceOwnership() public pure
  • Throws RenounceOwnershipNotAllowed