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:
- How is vToken Exchange Price calculated and verified in the Bifrost parachain?
Copy
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,
});
https://docs.bifrost.io/~gitbook/image?url=https%3A%2F%2F757947912-files.gitbook.io%2F~%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FJFtVsA5N3spWTWKvFvv0%252Fuploads%252Fl5QqpXIyW09jyzs4LirJ%252Fimage.png%3Falt%3Dmedia%26token%3D6edb1cba-32d0-4273-babe-0b4df81ae2ea&width=768&dpr=4&quality=100&sign=707168f5&sv=1
https://docs.bifrost.io/~gitbook/image?url=https%3A%2F%2F757947912-files.gitbook.io%2F~%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FJFtVsA5N3spWTWKvFvv0%252Fuploads%252F1pm87NUmiq60bvxzddOh%252Fimage.png%3Falt%3Dmedia%26token%3De08ff6ec-d6e0-40ee-b3de-38aa44fa4d01&width=768&dpr=4&quality=100&sign=f84b7a78&sv=1
https://docs.bifrost.io/~gitbook/image?url=https%3A%2F%2F757947912-files.gitbook.io%2F~%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FJFtVsA5N3spWTWKvFvv0%252Fuploads%252FFPiLgqhFTlN7UWyvyVdz%252Fimage.png%3Falt%3Dmedia%26token%3De19d46cb-052b-4925-a9c3-48955bc66108&width=768&dpr=4&quality=100&sign=b61fa215&sv=1