-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Features needed for reserve-backed stablecoins #7152
Changes from 45 commits
944c129
911795a
ddf83eb
9c79b6d
b8ef2fb
1888155
8bae97f
4df1054
aef1d0c
e302a0e
b173c37
6263beb
fd75591
3d03358
8aa7cc5
347f2db
2d5f752
760ba44
b630906
39a54ea
4d173bc
4664812
8954764
87f311e
d12fe90
e29b3fa
85443d2
b53c1ba
6de272f
27353a7
bbdce2e
0b5fa74
89cbf7e
1eff995
1fe69b1
76f2e40
a452393
402835d
373f4d7
d8b840a
13a0cc0
e65a75c
dc0839d
d0f1829
45f3c04
0286497
927bcc6
a1c43f9
82bbd66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -890,6 +890,22 @@ impl pallet_vesting::Trait for Runtime { | |
type WeightInfo = pallet_vesting::weights::SubstrateWeight<Runtime>; | ||
} | ||
|
||
parameter_types! { | ||
pub const AssetDepositBase: Balance = 100 * DOLLARS; | ||
pub const AssetDepositPerZombie: Balance = 1 * DOLLARS; | ||
} | ||
|
||
impl pallet_assets::Trait for Runtime { | ||
type Event = Event; | ||
type Balance = u64; | ||
type AssetId = u32; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: this should probably be a publicly defined type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One extra line for near zero gain. Sounds less like a nit-pick and more like a bikeshed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤷 |
||
type Currency = Balances; | ||
type ForceOrigin = EnsureRoot<AccountId>; | ||
type AssetDepositBase = AssetDepositBase; | ||
type AssetDepositPerZombie = AssetDepositPerZombie; | ||
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>; | ||
} | ||
|
||
construct_runtime!( | ||
pub enum Runtime where | ||
Block = Block, | ||
|
@@ -927,6 +943,7 @@ construct_runtime!( | |
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>}, | ||
Proxy: pallet_proxy::{Module, Call, Storage, Event<T>}, | ||
Multisig: pallet_multisig::{Module, Call, Storage, Event<T>}, | ||
Assets: pallet_assets::{Module, Call, Storage, Event<T>}, | ||
} | ||
); | ||
|
||
|
@@ -1193,6 +1210,7 @@ impl_runtime_apis! { | |
let mut batches = Vec::<BenchmarkBatch>::new(); | ||
let params = (&config, &whitelist); | ||
|
||
add_benchmark!(params, batches, pallet_assets, Assets); | ||
add_benchmark!(params, batches, pallet_babe, Babe); | ||
add_benchmark!(params, batches, pallet_balances, Balances); | ||
add_benchmark!(params, batches, pallet_collective, Council); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) 2020 Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! Weights for pallet_assets | ||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 | ||
//! DATE: 2020-10-16, STEPS: [50], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] | ||
|
||
#![allow(unused_parens)] | ||
#![allow(unused_imports)] | ||
|
||
use frame_support::{traits::Get, weights::Weight}; | ||
use sp_std::marker::PhantomData; | ||
|
||
pub struct WeightInfo<T>(PhantomData<T>); | ||
impl<T: frame_system::Trait> pallet_assets::WeightInfo for WeightInfo<T> { | ||
fn create() -> Weight { | ||
(58_069_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
} | ||
fn force_create() -> Weight { | ||
(30_401_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
} | ||
fn destroy(z: u32, ) -> Weight { | ||
(0 as Weight) | ||
.saturating_add((1_151_000 as Weight).saturating_mul(z as Weight)) | ||
.saturating_add(T::DbWeight::get().reads(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(z as Weight))) | ||
} | ||
fn force_destroy(z: u32, ) -> Weight { | ||
(0 as Weight) | ||
.saturating_add((1_151_000 as Weight).saturating_mul(z as Weight)) | ||
.saturating_add(T::DbWeight::get().reads(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(z as Weight))) | ||
} | ||
fn mint() -> Weight { | ||
(44_772_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(2 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(2 as Weight)) | ||
} | ||
fn burn() -> Weight { | ||
(39_564_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(2 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(2 as Weight)) | ||
} | ||
fn transfer() -> Weight { | ||
(58_453_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(4 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(3 as Weight)) | ||
} | ||
fn force_transfer() -> Weight { | ||
(58_704_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(4 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(3 as Weight)) | ||
} | ||
fn freeze() -> Weight { | ||
(43_141_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(2 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
} | ||
fn thaw() -> Weight { | ||
(42_965_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(2 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
} | ||
fn transfer_ownership() -> Weight { | ||
(30_110_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
} | ||
fn set_team() -> Weight { | ||
(30_704_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
} | ||
fn set_max_zombies() -> Weight { | ||
(56_445_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(1 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(1 as Weight)) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incompatible with the standard
type Balance = u128
defined in the standard Substrate node and node-template. This should use theBalance
type to be compatible.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u128
is not a "standard" and there is no reason to think that fungible asset pallet balances should necessarily be the same type as a balance elsewhere in the chain.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmh, I guess I would expect a runtime to follow the convention of only having one type named
Balance
to avoid confusion. I see your point that they can be different in principle, though.maybe standard was the wrong word, I meant standard as in "default" or "configured" or "example"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JesseAbram and I tried setting a Substrate chain up with
u64
as the assetsBalance
type, but polkadot-js assumes thatT::Balance
equalsBalance
(the globally defined type), so in practice we are not able to interact with the chain. (This is a similar issue to the other issue you already addressed.)We'll get in touch with Jaco about improving polkadot-js on this, but until then we need to configure it to be the same concrete type or change the name.
Edit: never mind, we found the
typesAlias
stuff.