PriceOracle
performs two necessary functions for the SIREN protocol:PriceOracle
stores the settlement price at expiration for every Series' underlying asset. On every Friday at 8am UTC, an offchain bot process is scheduled to fetch and set the current price for every asset traded on the SIREN protocol. Since all Series'
expiration dates are aligned to Friday 8am UTC, this allows any expired Series to fetch the settlement price of the underlying token at expiration and use it along with the Series'
strike price to calculate the payouts for bToken
and wToken
holders.PriceOracle
gives all other protocol contracts a single place to access onchain price data. Currently we use only Chainlink's oracles, but other's like Uniswap V3 could easily be used. Contracts like the MinterAmm
and SeriesController
use the PriceOracle
to fetch the current price for the tokens they use. It simplifies the protocol when all other contracts need only have a single address with a known interface for fetching onchain prices.addTokenPair](#addTokenPair) exist so that as [
MinterAmm`s with new underlying tokens and price tokens are deployed, we can add the correct price oracles for these token pairs. If this function was callable by any address, than a malicious address could set their own malicious price oracle, and attack the protocol.updateImplementation
and transferOwnership
exist so that the owners can update the contracts in the event of a critical vulnerability that puts user's funds at risk.settlementDate
. The SeriesController](series-controller.md#overview) uses this price to compute the [payouts](glossary.md#option-payouts) for [option tokens](glossary.md#option-tokens). Only token pairs which have been previously added by an admin-only call to [
addTokenPair` will execute successfully.underlyingToken
ERC20
token addresspriceToken
ERC20
token addresssettlementDate
isSet
true
if a call to [setSettlementPrice](#setSettlementPrice) has previously been executed and set the price to a non-zero value, otherwise it is
false`settlementPrice
settlementDate
WBTC
was $34,000, then the value returned by PriceOracle.getCurrentPrice
for a WBTC
Series would be 34_000 * 1e8
. Only token pairs which have been previously added by an admin-only call to addTokenPair
will execute successfully. The PriceOracle
fetches this price from an onchain oracle, which for now our all Chainlink Oracles.underlyingToken
ERC20
token addresspriceToken
ERC20
token address_timestamp
. The SeriesController
uses this function to ensure the expiration dates of each of its Series is aligned to Friday 8am UTC. The SIREN protocol uses a single date for each week's expiration dates in order to standardize the times at which its Series expire._timestamp
underlyingToken
denominated in units of priceToken
, and setting all previous unset settlement dates. This function is intended to be called immediately after every Friday 8am UTC for each of the PriceOracle
's token pairs, so that every Series that has their expiration date on that Frodau 8am UTC date will have the correct settlement date set. For now, an offchain bot process managed by the Siren team is scheduled to call this function for each token pair.underlyingToken
ERC20
token addresspriceToken
ERC20
token addressoracle
as the price oracle to use for the given token pair of underlyingToken
and priceToken
. This function uses the onlyOwner
modifier in order to prevent an malicious address from setting a malicious oracle for a given token pair. Once a token pair has been added with addTokenPair
, the getCurrentPrice
, setSettlementPrice
and getSettlementPrice
functions can be called with the given token pair.underlyingToken
ERC20
token addresspriceToken
ERC20
token addressoracle
PriceOracle
's logic contract. The SIREN protocol's contracts use the EIP-1822 standard for implementing upgradeable contracts. This allows us to update vulnerable contracts and keep users' option tokens safe. When the SIREN protocol has reached a certain level of stability, we can remove these safety guards and ensure no one on the Siren team can swap out the smart contract functionality._newImplementation
PriceOracle
's function implementationsnewOwner
address. See the onlyOwner
modifier for the permissions granted to the protocol admin.newOwner