Broker: sale price runtime api (#3485)

Defines a runtime api for `pallet-broker` for getting the current price
of a core if there is an ongoing sale.

Closes: #3413

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Sergej Sakac
2024-04-06 01:29:35 +02:00
committed by GitHub
parent 05b97068f9
commit 1c85bfe901
8 changed files with 95 additions and 7 deletions
@@ -64,7 +64,7 @@ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::Block as BlockT,
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, MultiAddress, Perbill,
ApplyExtrinsicResult, DispatchError, MultiAddress, Perbill,
};
use sp_std::prelude::*;
#[cfg(feature = "std")]
@@ -593,6 +593,12 @@ impl_runtime_apis! {
}
}
impl pallet_broker::runtime_api::BrokerApi<Block, Balance> for Runtime {
fn sale_price() -> Result<Balance, DispatchError> {
Broker::current_price()
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
fn query_info(
uxt: <Block as BlockT>::Extrinsic,
@@ -64,7 +64,7 @@ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::Block as BlockT,
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, MultiAddress, Perbill,
ApplyExtrinsicResult, DispatchError, MultiAddress, Perbill,
};
use sp_std::prelude::*;
#[cfg(feature = "std")]
@@ -584,6 +584,12 @@ impl_runtime_apis! {
}
}
impl pallet_broker::runtime_api::BrokerApi<Block, Balance> for Runtime {
fn sale_price() -> Result<Balance, DispatchError> {
Broker::current_price()
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
fn query_info(
uxt: <Block as BlockT>::Extrinsic,