PythOracle
PythOracle
PythOracle contract reads prices from actual Pyth oracle contract which accepts, verifies and stores the updated prices from external sources
Solidity API
EXP_SCALE
Exponent scale (decimal precision) of prices
BNB_ADDR
Set this as asset address for BNB. This is the underlying for vBNB
underlyingPythOracle
The actual pyth oracle address fetch & store the prices
tokenConfigs
Token configs by asset address
constructor
Constructor for the implementation contract.
initialize
Initializes the owner of the contract and sets required contracts
Parameters
Name | Type | Description |
---|---|---|
underlyingPythOracle_ | address | Address of the Pyth oracle |
accessControlManager_ | address | Address of the access control manager contract |
setTokenConfigs
Batch set token configs
Parameters
Name | Type | Description |
---|---|---|
tokenConfigs_ | struct PythOracle.TokenConfig[] | Token config array |
⛔️ Access Requirements
Only Governance
❌ Errors
Zero length error is thrown if length of the array in parameter is 0
setUnderlyingPythOracle
Set the underlying Pyth oracle contract address
Parameters
Name | Type | Description |
---|---|---|
underlyingPythOracle_ | contract IPyth | Pyth oracle contract address |
📅 Events
Emits PythOracleSet event with address of Pyth oracle.
⛔️ Access Requirements
Only Governance
❌ Errors
NotNullAddress error thrown if underlyingPythOracle_ address is zero
setTokenConfig
Set single token config. maxStalePeriod
cannot be 0 and asset
cannot be a null address
Parameters
Name | Type | Description |
---|---|---|
tokenConfig | struct PythOracle.TokenConfig | Token config struct |
⛔️ Access Requirements
Only Governance
❌ Errors
Range error is thrown if max stale period is zero
NotNullAddress error is thrown if asset address is null
getPrice
Gets the price of a asset from the pyth oracle
Parameters
Name | Type | Description |
---|---|---|
asset | address | Address of the asset |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Price in USD |
Last updated