Hatom Price Oracle Infrastructure
Introduction The Hatom Price Oracle is a robust infrastructure composed of Oracle Bots that feed prices into a Price Aggregator Smart Contract, similar to the Chainlink Oracle system. This smart contract makes prices available on-chain, enabling the Lending Price Oracle Smart Contract to provide reliable pricing when users interact with the Lending Protocol.
Oracle Bots Oracle Bots are autonomous, containerized entities responsible for submitting prices to the Price Aggregator Smart Contract. Each bot has a unique private key, and the corresponding public key is granted Oracle status on the Price Aggregator whitelist, allowing it to introduce new prices. Each bot is linked to a specific set of price providers, which may overlap with others.
The Oracle Bots execute two key tasks:
Heartbeat Task: Runs less frequently, according to the round time of the Price Aggregator, to ensure regular price submissions.
Threshold Task: Runs more frequently, fetching prices from sources like Binance, Cryptocompare, HitBTC, Huobi, and Kraken. It compares new prices to previously submitted prices and resubmits them if they exceed a predefined threshold.
Price Aggregator Smart Contract The Price Aggregator compiles price submissions from whitelisted Oracles that pull data from reputable exchanges. Once a certain number of submissions are received (fewer than the total number of Oracles), the Price Aggregator calculates a new median price and announces it. Similar to Chainlink’s price feeds, these Oracles submit prices in "rounds," typically occurring every 30 minutes to an hour. However, if a price change surpasses a set Threshold, oracles must resubmit a price, regardless of the last submission time.
Price Oracle Smart Contract The Hatom Price Oracle Smart Contract supplies prices to the Controller Smart Contract to ensure all assets are represented in a common unit (typically EGLD). It sources information from:
xExchange DEX Price Feeds and AshSwap Aggregator Price Feeds, which include current and time-weighted average prices (the Safe Price) of specific assets.
Price Aggregator Smart Contract Feeds, which aggregate data from multiple sources such as Binance, Gemini, OKX, HitBTC, Huobi, and Kraken.
When the Hatom Oracle Smart Contract receives a price request, it compares the Safe Price from xExchange DEX with the price from the Price Aggregator. If the difference is within an acceptable range, the Price Aggregator’s value is deemed valid and sent to the Controller Smart Contract. If the difference exceeds a predefined limit:
If the initial tolerance is surpassed: The price is marked invalid, and the Oracle issues an alert to the community. The most recent valid price is sent to the Controller Smart Contract. Future calls to Oracle will revert unless the prices fall within the tolerance range.
If the final tolerance is surpassed: The price is marked invalid, an alert is issued, and Oracle sends the most recent valid price to the Controller Smart Contract. The Oracle is then suspended, and subsequent price requests will fail until a Guardian manually intervenes to unpause the Oracle.
Last updated