The Oracle module sets, retrieves, and stores USD prices (USD per asset) for underlying, collateral, and strike assets
manages pricers that are used for different assets
-
migrateOracle(address _asset, uint256[] _expiries, uint256[] _prices) (external)
-
endMigration() (external)
-
setAssetPricer(address _asset, address _pricer) (external)
-
setLockingPeriod(address _pricer, uint256 _lockingPeriod) (external)
-
setDisputePeriod(address _pricer, uint256 _disputePeriod) (external)
-
setDisputer(address _disputer) (external)
-
setStablePrice(address _asset, uint256 _price) (external)
-
disputeExpiryPrice(address _asset, uint256 _expiryTimestamp, uint256 _price) (external)
-
setExpiryPrice(address _asset, uint256 _expiryTimestamp, uint256 _price) (external)
-
getPrice(address _asset) (external)
-
getExpiryPrice(address _asset, uint256 _expiryTimestamp) (external)
-
getPricer(address _asset) (external)
-
getDisputer() (external)
-
getPricerLockingPeriod(address _pricer) (external)
-
getPricerDisputePeriod(address _pricer) (external)
-
getChainlinkRoundData(address _asset, uint80 _roundId) (external)
-
isLockingPeriodOver(address _asset, uint256 _expiryTimestamp) (public)
-
isDisputePeriodOver(address _asset, uint256 _expiryTimestamp) (public)
-
DisputerUpdated(address newDisputer)
-
PricerUpdated(address asset, address pricer)
-
PricerLockingPeriodUpdated(address pricer, uint256 lockingPeriod)
-
PricerDisputePeriodUpdated(address pricer, uint256 disputePeriod)
-
ExpiryPriceUpdated(address asset, uint256 expiryTimestamp, uint256 price, uint256 onchainTimestamp)
-
ExpiryPriceDisputed(address asset, uint256 expiryTimestamp, uint256 disputedPrice, uint256 newPrice, uint256 disputeTimestamp)
-
StablePriceUpdated(address asset, uint256 price)
function to mgirate asset prices from old oracle to new deployed oracle
this can only be called by owner, should be used at the deployment time before setting Oracle module into AddressBook
-
_asset
: asset address -
_expiries
: array of expiries timestamps -
_prices
: array of prices
end migration process
can only be called by owner, should be called before setting Oracle module into AddressBook
sets the pricer for an asset
can only be called by the owner
-
_asset
: asset address -
_pricer
: pricer address
sets the locking period for a pricer
can only be called by the owner
-
_pricer
: pricer address -
_lockingPeriod
: locking period
sets the dispute period for a pricer
can only be called by the owner
for a composite pricer (ie CompoundPricer) that depends on or calls other pricers, ensure
that the dispute period for the composite pricer is longer than the dispute period for the
asset pricer that it calls to ensure safe usage as a dispute in the other pricer will cause
the need for a dispute with the composite pricer's price
-
_pricer
: pricer address -
_disputePeriod
: dispute period
set the disputer address
can only be called by the owner
_disputer
: disputer address
set stable asset price
price should be scaled by 1e8
-
_asset
: asset address -
_price
: price
dispute an asset price during the dispute period
only the disputer can dispute a price during the dispute period, by setting a new one
-
_asset
: asset address -
_expiryTimestamp
: expiry timestamp -
_price
: the correct price
submits the expiry price to the oracle, can only be set from the pricer
asset price can only be set after the locking period is over and before the dispute period has started
-
_asset
: asset address -
_expiryTimestamp
: expiry timestamp -
_price
: asset price at expiry
get a live asset price from the asset's pricer contract
_asset
: asset address
- price scaled by 1e8, denominated in USD
e.g. 17568900000 => 175.689 USD
get the asset price at specific expiry timestamp
-
_asset
: asset address -
_expiryTimestamp
: expiry timestamp
-
price scaled by 1e8, denominated in USD
-
isFinalized True, if the price is finalized, False if not
get the pricer for an asset
_asset
: asset address
- pricer address
get the disputer address
- disputer address
get a pricer's locking period
locking period is the period of time after the expiry timestamp where a price can not be pushed
during the locking period an expiry price can not be submitted to this contract
_pricer
: pricer address
- locking period
get a pricer's dispute period
dispute period is the period of time after an expiry price has been pushed where a price can be disputed
during the dispute period, the disputer can dispute the submitted price and modify it
_pricer
: pricer address
- dispute period
get historical asset price and timestamp
if asset is a stable asset, will return stored price and timestamp equal to now
-
_asset
: asset address to get it's historical price -
_roundId
: chainlink round id
- price and round timestamp
check if the locking period is over for setting the asset price at a particular expiry timestamp
-
_asset
: asset address -
_expiryTimestamp
: expiry timestamp
- True if locking period is over, False if not
check if the dispute period is over
-
_asset
: asset address -
_expiryTimestamp
: expiry timestamp
- True if dispute period is over, False if not
emits an event when the disputer is updated
emits an event when the pricer is updated for an asset
emits an event when the locking period is updated for a pricer
emits an event when the dispute period is updated for a pricer
Event ExpiryPriceUpdated(address asset, uint256 expiryTimestamp, uint256 price, uint256 onchainTimestamp)
emits an event when an expiry price is updated for a specific asset
Event ExpiryPriceDisputed(address asset, uint256 expiryTimestamp, uint256 disputedPrice, uint256 newPrice, uint256 disputeTimestamp)
emits an event when the disputer disputes a price during the dispute period
emits an event when a stable asset price changes