Skip to main content

For AI agents: the complete documentation index is at llms.txt. Markdown versions of pages are available by appending .md to the URL or sending Accept: text/markdown.

PriceAdapterRegistry

PriceAdapterRegistry​

Price Adapter Registry using UUPS upgradeable pattern

This contract allows the configuration of price adapters for various assets in the investment universe.

configAddress​

address configAddress

Orion Config contract address

underlyingAsset​

address underlyingAsset

Underlying asset address

priceAdapterDecimals​

uint8 priceAdapterDecimals

Price Adapter Precision

adapterOf​

mapping(address => contract IPriceAdapter) adapterOf

Mapping of asset addresses to their corresponding price adapters

upgradeTimelock​

address upgradeTimelock

Address of the upgrade timelock that must authorise all implementation upgrades

onlyConfig​

modifier onlyConfig()

constructor​

constructor() public

Constructor that disables initializers for the implementation contract

initialize​

function initialize(address configAddress_) public

Initializer function (replaces constructor)

Parameters​

NameTypeDescription
configAddress_addressThe address of the OrionConfig contract

setPriceAdapter​

function setPriceAdapter(address asset, contract IPriceAdapter adapter) external

Register or replace the price adapter for an asset.

Parameters​

NameTypeDescription
assetaddressThe address of the asset.
adaptercontract IPriceAdapterThe price adapter for the asset.

getPrice​

function getPrice(address asset) external view returns (uint256)

Returns the price of the given asset via its assigned price adapter.

The asset shall be whitelisted in the OrionConfig contract, therefore assigned an adapter in adapterOf. Returned value is always expected to have priceAdapterDecimals decimals.

Parameters​

NameTypeDescription
assetaddressThe address of the asset.

Return Values​

NameTypeDescription
[0]uint256The price of the asset, normalized to priceAdapterDecimals decimals.

setUpgradeTimelock​

function setUpgradeTimelock(address newTimelock) external

Sets the upgrade timelock address.

If no timelock is set yet, only the protocol admin may call this. Once a timelock is active, only the timelock itself may replace it, preventing the admin from bypassing the delay.

Parameters​

NameTypeDescription
newTimelockaddressThe new timelock address (e.g. OpenZeppelin TimelockController); address(0) not permitted

_authorizeUpgrade​

function _authorizeUpgrade(address) internal view

Authorizes an upgrade to a new implementation

Requires the caller to be the upgrade timelock (if set) or the protocol admin (during initial bootstrapping before a timelock has been configured).