LogoLogo
HomeDappGithub
  • 🌈What is Bifrost
    • Bifrost vs Others
    • Bifrost cross-chain architecture
    • Bifrost security model
  • 🧬Tokenomics 2.0
    • Overview
    • Protocol Growth Flywheel
    • Core - bbBNC
      • How to maximize your bbBNC yield?
      • How to get or redeem?
    • BNC
    • vBNC
    • Treasury
  • 📚FAQ
    • Glossary
    • What are vTokens?
      • vETH
      • vKSM
      • vDOT
      • vFIL
      • vGLMR & vMOVR
      • vMANTA
      • vASTR
      • Validator Governance
      • XCM V3 in Bifrost
      • Mint/Redeem vToken without Dapp
    • What is LoopStake?
      • LoopStake Lending Parameters
    • What is LST Governance?
    • What is LST Stable Swap?
    • What is vToken Delegation Voting?
  • 🏃Dapp Tutorials & use cases
    • Liquid Staking on Bifrost
    • Liquid Staking on Omni LS
    • Loop Stake (Leverage Staking)
    • Governance with vDOT & vKSM
    • Providing Liquidity on DEX/Perp DEX
    • Supplying Liquidity on Money Market
    • Yield DCA
    • Farming
    • Unstaking
  • 🦸For the Community
    • Ambassadors
    • Governance
      • Overview
      • Proposal Guidelines (polkadot.js)
      • Proposal Guidelines (Subsquare)
      • OpenGov Components
      • OpenGov Tracks
        • Root
        • WhitelistedCaller
        • Liquid Staking
      • Proposal Template
        • HRMP
        • Validator Boost List
      • Bifrost Fellowship
      • On-chain Identity
    • Rainbow Boost
  • ⚒️For Builders
    • Build with SLPx
      • Overview
      • Supported Networks
        • Soneium
        • Astar
        • Manta Pacific
        • Moonbeam
        • Moonriver
        • Ethereum
      • XCM Oracle
    • vToken APIs
    • Builder Programs
      • Grants and Funding Program
      • Open Bounties
      • Bug Bounty
  • 🧩For Partners
    • Reward-Share Program (RSP)
      • Why RSP?
      • Integrate RSP
      • Claim RSP Rewards
      • Terms & Conditions
      • FAQ
    • Join The Program
    • Validator Boost List (VBL)
  • ⚖️For Collators
    • Requirement
    • Run a Collator
    • Stop Collating
  • 📦Resources
    • Tools
    • Audit Report
    • Press Kit
    • Token Icon
Powered by GitBook
On this page
  • What is Bifrost XCM Oracle?
  • How to verify that XCM Oracle uses XCM to synchronize messages to the target chain?

Was this helpful?

  1. For Builders
  2. Build with SLPx

XCM Oracle

What is Bifrost XCM Oracle?

In order to facilitate easy querying of Bifrost vToken Exchange Price on other chains at the Pallet and Contract levels, a scheduled price feed task sent by Bifrost SLPx Pallet is needed. Hence, Bifrost Runtime will automatically send XCM messages to the SLPx Contract of the target chain to update the Exchange Price of vTokens in the Contract.

Below link will help you quickly understand the relevant concepts:

- SLPx XCM Oracle Tech Doc

- How is vToken Exchange Price calculated and verified in the Bifrost parachain?

- What is SLPx?

- What is XCM?


How to verify that XCM Oracle uses XCM to synchronize messages to the target chain?

  1. The SLPx Pallet synchronizes the vToken Exchange Price on Bifrost and sends it to the target chain at regular intervals. Link to the code base

let configuration = XcmEthereumCallConfiguration::<T>::get();
				match configuration {
					Some(mut configuration) => {
						let currency_id = currency_list[0];
						let token_amount = T::VtokenMintingInterface::get_token_pool(currency_id);
						// It's impossible to go wrong.
						let vcurrency_id = T::VtokenMintingInterface::vtoken_id(currency_id)
							.expect("Error convert vcurrency_id");
						let vtoken_amount = T::MultiCurrency::total_issuance(vcurrency_id);

						if configuration.last_block + configuration.period < n {
							let encoded_call = Self::encode_transact_call(
								configuration.contract,
								currency_id,
								token_amount,
								vtoken_amount,
							);

							let result = Self::send_xcm_to_set_token_amount(
								encoded_call,
								configuration.xcm_weight,
								configuration.xcm_fee,
							);

							if result.is_err() {
								return weight
									.saturating_add(T::DbWeight::get().reads_writes(4, 0));
							}
							Self::deposit_event(Event::XcmSetTokenAmount {
								currency_id,
								token_amount,
								vcurrency_id,
								vtoken_amount,
							});
  1. Query messages sent by Bifrost XCM Oracle: Link to Bifrost Subscan. The capture below includes the total amount of DOT (Token2:0) and vDOT (vToken2:0) in Bifrost liquid staking. (Check other token index in the Library.)

  1. Query XCM Oracle transactions in XCM Message: Here is a case.

  1. View Bifrost Parachain Address (mapped by Moonbeam EVM) transactions synchronizing price information to the Oracle contract on Moonbeam or Moonriver: Link to Moonscan

  1. Query the latest price of vToken in the XCM Oracle contract on Moonbeam or Moonriver:

- Moonriver

- Moonbeam

For example, querying the price of vDOT by DOT with 10 decimals.

PreviousEthereumNextvToken APIs

Last updated 1 year ago

Was this helpful?

⚒️