Skip to content

RiskStewardReceiver

Contract that reads updates from a Risk Oracle, validates them with timelock and debounce, and either executes them locally via the configured RiskSteward or forwards them cross‑chain.

This page follows RiskStewardReceiver.sol at v2.15.0. On BNB mainnet at block 118369568, proxy 0x47856bFa74B71d24a5545c7506862B8FddE52baB used implementation 0xC00Ec4149eCfB60378152e05C5B896c08EA49e6E, matching the tagged artifact.

This is the origin receiver. It uses LayerZero V2 OApp endpoint IDs (uint32), unlike the older uint16 LayerZero V1 endpoint IDs in Omnichain Governance and the XVS bridge. Do not interchange their peer, fee, or retry APIs.

Period after which a proposed update becomes expired and can no longer be applied

uint256 UPDATE_EXPIRATION_TIME

Source chain LayerZero endpoint ID

uint32 LAYER_ZERO_EID

The Risk Oracle contract address

contract IRiskOracle RISK_ORACLE

Pause flag

bool paused

Mapping of supported risk configurations and their validation parameters (keyed by hashed updateType)

mapping(bytes32 => struct IRiskStewardReceiver.RiskParamConfig) riskParameterConfigs

Master storage of all registered updates by update ID

mapping(uint256 => struct IRiskStewardReceiver.RegisteredUpdate) updates

Track last processed update ID per (updateTypeKey, market)

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

Track the current registered update per (updateType, market) to avoid registering multiple updates

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

Mapping from executor address to whitelist status

mapping(address => bool) whitelistedExecutors

Disables initializers and sets the Risk Oracle and LayerZero configuration.

constructor(address riskOracle_, address endpoint_, uint32 layerZeroLzEid_) public
NameTypeDescription
riskOracle_addressThe address of the Risk Oracle contract.
endpoint_addressThe LayerZero endpoint contract used by the underlying OAppUpgradeable.
layerZeroLzEid_uint32The LayerZero endpoint ID (EID) for this chain.

Initializes the contract with the Access Control Manager and OApp owner.

function initialize(address acm_, address delegate_) external
NameTypeDescription
acm_addressThe address of the Access Control Manager
delegate_addressThe address of the OApp owner passed to __OApp_init.

Accepts native tokens (e.g., BNB) sent to this contract.

receive() external payable

Allows the owner to sweep leftover native tokens (e.g., BNB) from the contract.

function sweepNative() external
  • Emits SweepNative event.

Sets the pause status for processUpdate.

function setPaused(bool paused_) external
NameTypeDescription
paused_boolTrue to pause, false to unpause
  • Emits PauseStatusUpdated
  • Controlled by AccessControlManager

Sets the risk parameter config for a given update type

function setRiskParameterConfig(string updateType, address riskSteward, uint256 debounce, uint256 timelock) external
NameTypeDescription
updateTypestringThe type of update to configure
riskStewardaddressThe address for the risk steward contract responsible for processing the update
debounceuint256The debounce period for the update
timelockuint256The timelock period before the update can be executed
  • Emits RiskParameterConfigUpdated
  • Controlled by AccessControlManager
  • InvalidUpdateType if the update type string is empty
  • Throws InvalidDebounce if the debounce is 0
  • Throws InvalidTimelock if the timelock is greater than or equal to the expiration time
  • Throws ZeroAddressNotAllowed if the risk steward address is zero

Sets the active status of a risk parameter config

function setConfigActive(string updateType, bool active) external
NameTypeDescription
updateTypestringThe type of update to configure
activeboolThe active status to set
  • Emits ConfigActiveUpdated with the update type hash, update type, previous active status, and the active status
  • Controlled by AccessControlManager
  • Throws UnsupportedUpdateType if the update type is not supported
  • Throws ConfigStatusUnchanged if the active status is already set to the desired value

Manages the whitelist of executors that are allowed to execute timelocked registered updates.

function setWhitelistedExecutor(address executor, bool approved) external
NameTypeDescription
executoraddressThe address of the executor
approvedboolThe whitelist status to set (true to whitelist, false to remove)
  • Emits ExecutorStatusUpdated with the executor address, previous approval status, and approval status
  • Controlled by AccessControlManager
  • Throws ZeroAddressNotAllowed if the executor address is zero
  • Throws ExecutorStatusUnchanged if the executor whitelist status is already set to the desired value

Processes an update from the Risk Oracle. Validates, registers the update, and either executes immediately, registers with timelock, or forwards cross-chain.

function processUpdate(uint256 updateId) external
NameTypeDescription
updateIduint256The update ID from the oracle’s perspective
  • Emits UpdateRegistered, UpdateExecuted, or UpdateSentToDestination depending on the update type
  • Throws UpdateAlreadyResolved if the update was already processed
  • Throws UpdateIsExpired if the update has expired
  • Throws ConfigNotActive if the config is not active
  • Throws UpdateTooFrequent if the debounce period has not passed
  • Throws RegisteredUpdateTypeExist if there is a non-expired pending update of the same type

Executes a registered update. Only whitelisted executors can call this function. This function can be used for updates that have completed their timelock and are ready to execute.

function executeRegisteredUpdate(uint256 updateId) external
NameTypeDescription
updateIduint256The oracle update ID of the update to execute
  • Emits UpdateExecuted with the oracle update ID
  • Only whitelisted executors can call this function
  • Throws NotAnExecutor if the caller is not a whitelisted executor
  • Throws InvalidRegisteredUpdate if the update was never registered
  • Throws UpdateAlreadyResolved if the update was already executed or rejected
  • Throws UpdateIsExpired if the update has expired
  • Throws ConfigNotActive if the config is not active
  • Throws UpdateNotUnlocked if the unlock time has not passed

Rejects a registered update

function rejectUpdate(uint256 updateId) external
NameTypeDescription
updateIduint256The oracle update ID of the update to reject
  • Emits UpdateRejected with the oracle update ID
  • Only whitelisted executors can call this function
  • Throws UpdateAlreadyResolved if the update was already executed or rejected

Resends a remote update to the destination chain. This function is useful in case of bridge failures.

function resendRemoteUpdate(uint256 updateId, bytes options) external payable
NameTypeDescription
updateIduint256The oracle update ID to resend
optionsbytesLayerZero message options; if empty, default executor option is used
  • Emits UpdateResentToDestination with the update ID, destination chain ID, update type, and market
  • Only whitelisted executors can call this function
  • Throws NotAnExecutor if the caller is not a whitelisted executor
  • Throws InvalidUpdateToResend if the update status is not SENT_TO_DESTINATION
  • Throws UpdateIsExpired if the update has expired

Returns an array of update IDs for executable registered updates for a given update type and comptroller.

function getExecutableUpdates(string updateType, address comptroller) external view returns (uint256[] executableUpdates)
NameTypeDescription
updateTypestringThe human‑readable identifier of the update type to filter by
comptrolleraddressThe address of the Comptroller (either Core Pool or Isolated Pools) that manages the markets
NameTypeDescription
executableUpdatesuint256[]Array of update IDs that are ready to be executed

Returns whether a registered update is ready to be executed.

function isUpdateExecutable(uint256 updateId) external view returns (bool)
NameTypeDescription
updateIduint256The oracle update ID to query
NameTypeDescription
[0]boolTrue if the update is pending, not expired, active, and past its timelock

Returns the risk parameter configuration for a given update type

function getRiskParameterConfig(string updateType) external view returns (struct IRiskStewardReceiver.RiskParamConfig)
NameTypeDescription
updateTypestringThe human-readable identifier of the update type
NameTypeDescription
[0]struct IRiskStewardReceiver.RiskParamConfigThe risk parameter configuration

Returns the last processed update ID for a given update type and market

function getLastProcessedUpdate(string updateType, address market) external view returns (uint256)
NameTypeDescription
updateTypestringThe human-readable identifier of the update type
marketaddressThe address of the market
NameTypeDescription
[0]uint256The last processed update ID

Returns the last registered update ID for a given update type and market

function getLastRegisteredUpdate(string updateType, address market) external view returns (uint256)
NameTypeDescription
updateTypestringThe human-readable identifier of the update type
marketaddressThe address of the market
NameTypeDescription
[0]uint256The last registered update ID

Quotes the gas fee needed to pay for the full omnichain transaction in native gas or ZRO token.

function quote(struct RiskParameterUpdate update, bytes options, bool payInLzToken) public view returns (struct MessagingFee fee)
NameTypeDescription
updatestruct RiskParameterUpdateThe risk parameter update payload to be sent
optionsbytesMessage execution options (e.g., for sending gas to the destination)
payInLzTokenboolWhether to return the fee in ZRO token instead of native gas
NameTypeDescription
feestruct MessagingFeeA MessagingFee struct containing the calculated gas fee

Sends a RiskParameterUpdate to a destination chain via LayerZero.

function lzSend(uint32 dstEid, struct RiskParameterUpdate update, bytes options, struct MessagingFee fee, address refundAddress) public payable
NameTypeDescription
dstEiduint32Destination chain endpoint ID
updatestruct RiskParameterUpdateThe risk parameter update payload to send
optionsbytesLayerZero message options; if empty, a default executor option is used
feestruct MessagingFeeMessaging fee structure returned by quote
refundAddressaddressAddress to receive any surplus fee refunds
  • InvalidLzSendCaller if called by any address other than this contract

Starts the two-step ownership transfer used jointly by AccessControlledV8 and the LayerZero OApp base. The pending owner must call acceptOwnership.

function transferOwnership(address newOwner) public

Disables renounceOwnership function

function renounceOwnership() public pure
  • Throws RenounceOwnershipNotAllowed