Oracle Module
Last updated
Last updated
The Price Aggregator module enables us to obtain price data from BandChain via IBC and stores the most recent prices in our store.
This allows us to retrieve asset prices when users deposit collateral to mint $oUSD and to recalculate the collateral ratio of each vault after every epoch.
Below is the example of workflow for when users deposit $ATOM as a collateral asset to mint $oUSD.
Step 1: User transfers $ATOM via IBC to the Onomy Network.
Step 2: User creates a vault by depositing $ATOM as a collateral asset to Onomy to mint $oUSD.
Step 3: The Price Aggregator
module of Onomy requests the spot price of $ATOM from BandChain, then mints $oUSD for the user.
To gain a deeper understanding of how Onomy retrieves asset prices from BandChain to support the Vault module in minting $oUSD, we can refer to the diagram below:
Step 1: The Price Aggregator
module creates an IBC packet (contains OracleRequestPacketData)
to request data from BandChain
Step 2, 3: Relayers will pick up the IBC packet and relay it on BandChain
Step 4, 5: After BandChain process the request, it will send an acknowledgement along with request_id
back (The Price Aggregator
module will keep this request_id
to get the data from BandChain later. If the acknowledgement fails, all processes will be cancelled).
Step 6, 7: When the result of the request price is finalized, BandChain will send a new IBC packet (contains OracleResponsePacketData
) that contains the final data back (prices we need), and relayers will listen and pick up those packets and relay them to Onomy.
After retrieving the collateral asset prices, the Vault module
uses this data to mint $oUSD for users. At regular intervals, the Price Aggregator
module updates the asset prices from BandChain, enabling the Vault module
to adjust the collateral ratios for users vaults accordingly.
We plan to add additional price feeders to support our Price Aggregator
module, reducing single-party reliability and improving overall project security and decentralization. Candidates include ChainLink, Stork Oracles, SupraOracles, and more.