feat: pallet asset-rate (#13608)

* poc

* fix: remove AssetIdParameter

* tests: add

* docs: add pallet description

* feat: add benches

* refactor: UnknownAssetId

* fix: normalize mock cfg

* fix: benchmarks

* chore: add weights

* refactor: remove storage getter

* chore: apply suggestions from code review

* docs: add native balance to calls

* chore: apply suggestions from code review

* chore: apply ConversionFromAssetBalance

* tests: update balance mock

* chore: apply suggestions from code review

* ci: set publish to false

* docs: fix missing rustdoc

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
William Freudenberger
2023-04-19 09:49:42 +02:00
committed by GitHub
parent cbc8e5f7df
commit 9eb63f216c
10 changed files with 762 additions and 0 deletions
+13
View File
@@ -1131,6 +1131,17 @@ impl pallet_treasury::Config for Runtime {
type SpendOrigin = EnsureWithSuccess<EnsureRoot<AccountId>, AccountId, MaxBalance>;
}
impl pallet_asset_rate::Config for Runtime {
type CreateOrigin = EnsureRoot<AccountId>;
type RemoveOrigin = EnsureRoot<AccountId>;
type UpdateOrigin = EnsureRoot<AccountId>;
type Balance = Balance;
type Currency = Balances;
type AssetId = u32;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_asset_rate::weights::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
pub const BountyValueMinimum: Balance = 5 * DOLLARS;
@@ -1765,6 +1776,7 @@ construct_runtime!(
TechnicalMembership: pallet_membership::<Instance1>,
Grandpa: pallet_grandpa,
Treasury: pallet_treasury,
AssetRate: pallet_asset_rate,
Contracts: pallet_contracts,
Sudo: pallet_sudo,
ImOnline: pallet_im_online,
@@ -1922,6 +1934,7 @@ mod benches {
[pallet_tips, Tips]
[pallet_transaction_storage, TransactionStorage]
[pallet_treasury, Treasury]
[pallet_asset_rate, AssetRate]
[pallet_uniques, Uniques]
[pallet_nfts, Nfts]
[pallet_utility, Utility]