A price index oracle for bitcoin and argon prices, as well as a target argon price derive from the us cpi change since start
Price Index
The US CPI is retrieved programmatically on a schedule. Values retrieved are clamped based on the historically 5% and 95th percentile of changes from month to month. The change is then flattened into a flat amount added per tick so that the changes are smoothed out over the month. The number of days between cpi releases is determined from the public schedule here: https://www.bls.gov/schedule/news_release/cpi.htm. We are currently unable to programmatically retrieve this, but will create a datastore with these values in the future.
The argon cpi is determined by the formula (target argon price / actual price) - 1. This is performed by the mainchain with the given prices supplied by the price index.
Test Schedule
The test version of the argon price lookup performs scheduled changes to the argon that allow us to simulate scenarios. The schedule is in EST and can be found in the function simulate_price_change in argon_price.rs.
Clamping Values
The price oracle is also clamped by the mainchain. If a value is retrieved that is out of tick order, it will be rejected (to avoid a node trying to use an old submission). Any changes to the argon price that are "away" from the target price are clamped at 1 centagon per tick. The target price (as determined by the us cpi changes) is also clamped at 1 centagon per tick.
BTC is determined from multiple sources and does not currently have any clamping. This might be something we wish to add in the future as a security measure.
Running Oracles
The oracles are designed to be run separately (one for bitcoin and one for price index). This is to simplify the key management of each, as well as to allow flexibility to run this adjacent to a bitcoin full node.
It's expected that each oracle will use a proxy account to the registered oracle. This proxy account would be installed as a hot wallet into the keystore on a machine, and we will start the node with the desired address to sign with.
This PR adds two oracles:
Price Index
The US CPI is retrieved programmatically on a schedule. Values retrieved are clamped based on the historically 5% and 95th percentile of changes from month to month. The change is then flattened into a flat amount added per tick so that the changes are smoothed out over the month. The number of days between cpi releases is determined from the public schedule here: https://www.bls.gov/schedule/news_release/cpi.htm. We are currently unable to programmatically retrieve this, but will create a datastore with these values in the future.
The argon cpi is determined by the formula
(target argon price / actual price) - 1
. This is performed by the mainchain with the given prices supplied by the price index.Test Schedule
The test version of the argon price lookup performs scheduled changes to the argon that allow us to simulate scenarios. The schedule is in EST and can be found in the function
simulate_price_change
in argon_price.rs.Clamping Values
The price oracle is also clamped by the mainchain. If a value is retrieved that is out of tick order, it will be rejected (to avoid a node trying to use an old submission). Any changes to the argon price that are "away" from the target price are clamped at 1 centagon per tick. The target price (as determined by the us cpi changes) is also clamped at 1 centagon per tick.
BTC is determined from multiple sources and does not currently have any clamping. This might be something we wish to add in the future as a security measure.
Running Oracles
The oracles are designed to be run separately (one for bitcoin and one for price index). This is to simplify the key management of each, as well as to allow flexibility to run this adjacent to a bitcoin full node.
It's expected that each oracle will use a proxy account to the registered oracle. This proxy account would be installed as a hot wallet into the keystore on a machine, and we will start the node with the desired address to sign with.