Mandate weight annotation (#5357)

* Disallow default weight

* Fix build and test

* Fix tests

* Fix another beloved ui test.

* fix beloved trybuild tests

* fix treasury?

* Final test fix

* Fix build

* Fix another one

* Fix

* More doctest fix
This commit is contained in:
Kian Paimani
2020-03-26 11:17:05 +01:00
committed by GitHub
parent 7cbadd73be
commit a0772117ac
27 changed files with 111 additions and 48 deletions
+6
View File
@@ -360,12 +360,14 @@ decl_module! {
fn deposit_event() = default;
/// Create a new kind of asset.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
fn create(origin, options: AssetOptions<T::Balance, T::AccountId>) -> DispatchResult {
let origin = ensure_signed(origin)?;
Self::create_asset(None, Some(origin), options)
}
/// Transfer some liquid free balance to another account.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
pub fn transfer(origin, #[compact] asset_id: T::AssetId, to: T::AccountId, #[compact] amount: T::Balance) {
let origin = ensure_signed(origin)?;
ensure!(!amount.is_zero(), Error::<T>::ZeroAmount);
@@ -375,6 +377,7 @@ decl_module! {
/// Updates permission for a given `asset_id` and an account.
///
/// The `origin` must have `update` permission.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
fn update_permission(
origin,
#[compact] asset_id: T::AssetId,
@@ -397,6 +400,7 @@ decl_module! {
/// Mints an asset, increases its total issuance.
/// The origin must have `mint` permissions.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
fn mint(origin, #[compact] asset_id: T::AssetId, to: T::AccountId, amount: T::Balance) -> DispatchResult {
let who = ensure_signed(origin)?;
Self::mint_free(&asset_id, &who, &to, &amount)?;
@@ -406,6 +410,7 @@ decl_module! {
/// Burns an asset, decreases its total issuance.
/// The `origin` must have `burn` permissions.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
fn burn(origin, #[compact] asset_id: T::AssetId, to: T::AccountId, amount: T::Balance) -> DispatchResult {
let who = ensure_signed(origin)?;
Self::burn_free(&asset_id, &who, &to, &amount)?;
@@ -415,6 +420,7 @@ decl_module! {
/// Can be used to create reserved tokens.
/// Requires Root call.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
fn create_reserved(
origin,
asset_id: T::AssetId,