Oracle

The ShiftCTRL Tab Protocol relies on two essential contracts for oracle management: the PriceOracleManager and PriceOracle contracts.

PriceOracleManager contract

The PriceOracleManager contract is responsible for storing oracle-related configurations and managing oracle feed providers for the Tab Protocol.

Each oracle feed provider is whitelisted through a governance proposal, which involves executing the addPriceOracleProvider function in the GovernanceAction contract. It’s important to note that oracle feed providers are responsible for proposing the reward they wish to receive in CTRL tokens. The community then considers this reward when deciding whether to whitelist them.

addPriceOracleProvider(
  address provider,
  address paymentTokenAddress,
  uint256 paymentAmtPerFeed,
  uint256 blockCountPerFeed,
  uint256 feedSize,
  bytes32 whitelistedIPAddr
)

Once an oracle feed provider is successfully whitelisted, it can be managed through corresponding GovernanceAction functions, which are mapped to the functions within the PriceOracleManager contract.

GovernanceAction contract
PriceOracleManager contract

addPriceOracleProvider

addProvider

configurePriceOracleProvider

configureProvider

removePriceOracleProvider

disableProvider

pausePriceOracleProvider

pauseProvider

unpausePriceOracleProvider

unpauseProvider

The Tab Oracle Offchain module monitors the performance of each feed provider and interacts with the PriceOracleManager at fixed intervals. This interaction increases the feed provider's payment value based on the number of feeds submitted.

submitProviderFeedCount(
  address[10] calldata _providerList,
  uint256[10] calldata _feedCount,
  uint256 _timestamp
)

Feed providers' payments are calculated and stored according to their paymentAmtPerFeed setting.

Feed providers can then call the PriceOracleManager function:

withdrawPayment(address _withdrawToAddr)

at any time to claim their payment.

Note: It is the responsibility of community governance to ensure that sufficient CTRL tokens are allocated to the PriceOracleManager contract. This ensures that feed providers receive their rewards, and that the oracle system operates seamlessly.

Note: The updatePrice function is now obsolete. The Tab Oracle module has discontinued its use, no longer calling it at fixed intervals to update Tab rates in batches. This change was made to reduce operational costs. Instead, the protocol has adopted an on-demand rate update mechanism, where live rates are retrieved whenever a function requiring a live rate is called.

By default, this contract is configured with a movementDelta of 0.5% and an inactivePeriod of 1 hour. This means that a Tab's rate may remain unchanged (inactive) for up to 1 hour if market fluctuations are minimal (delta < 0.5%) during that period.

After 1 hour of inactivity, the Tab Oracle Offchain module will force an update of the median rate to the latest rate, regardless of the fluctuation level. These values can be adjusted using the PriceOracleManager contract's updateConfig function.

PriceOracle contract

The PriceOracle contract stores all active Tab rates as BTC/TAB pairs.

To save operational costs, Tab rates are updated on-demand. When a user performs a vault operation requiring a Tab rate, the transaction is submitted along with the signed latest Tab price to the VaultManager contract. The signed Tab price is then passed to the PriceOracle by calling the updatePrice function.

Note: The setPrice is now obsolete. The Tab Oracle module no longer calls updatePrice at fixed intervals, and as a result, the setPrice function is no longer utilized.

Last updated