difftreelog
Whitelist to allowlist renamed
in: master
9 files changed
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -123,7 +123,7 @@
.checked_sub(amount)
.ok_or(<CommonError<T>>::TokenValueTooLow)?;
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
collection.check_allowlist(owner)?;
}
@@ -161,7 +161,7 @@
<CommonError<T>>::TransferNotAllowed
);
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
collection.check_allowlist(from)?;
collection.check_allowlist(to)?;
}
@@ -305,7 +305,7 @@
spender: &T::CrossAccountId,
amount: u128,
) -> DispatchResult {
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
collection.check_allowlist(&owner)?;
collection.check_allowlist(&spender)?;
}
@@ -333,7 +333,7 @@
if spender == from {
return Self::transfer(collection, from, to, amount);
}
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
// `from`, `to` checked in [`transfer`]
collection.check_allowlist(spender)?;
}
@@ -365,7 +365,7 @@
if spender == from {
return Self::burn(collection, from, amount);
}
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
// `from` checked in [`burn`]
collection.check_allowlist(spender)?;
}
pallets/nft/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nft/src/benchmarking.rs
+++ b/pallets/nft/src/benchmarking.rs
@@ -55,23 +55,23 @@
let collection = create_nft_collection::<T>(caller.clone())?;
}: _(RawOrigin::Signed(caller.clone()), collection)
- add_to_white_list {
+ add_to_allow_list {
let caller: T::AccountId = account("caller", 0, SEED);
let whitelist_account: T::AccountId = account("admin", 0, SEED);
let collection = create_nft_collection::<T>(caller.clone())?;
}: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(whitelist_account))
- remove_from_white_list {
+ remove_from_allow_list {
let caller: T::AccountId = account("caller", 0, SEED);
let whitelist_account: T::AccountId = account("admin", 0, SEED);
let collection = create_nft_collection::<T>(caller.clone())?;
- <Pallet<T>>::add_to_white_list(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(whitelist_account.clone()))?;
+ <Pallet<T>>::add_to_allow_list(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(whitelist_account.clone()))?;
}: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(whitelist_account))
set_public_access_mode {
let caller: T::AccountId = account("caller", 0, SEED);
let collection = create_nft_collection::<T>(caller.clone())?;
- }: _(RawOrigin::Signed(caller.clone()), collection, AccessMode::WhiteList)
+ }: _(RawOrigin::Signed(caller.clone()), collection, AccessMode::AllowList)
set_mint_permission {
let caller: T::AccountId = account("caller", 0, SEED);
pallets/nft/src/lib.rsdiffbeforeafterboth--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -274,9 +274,9 @@
/// * collection_id.
///
/// * address.
- #[weight = <SelfWeightOf<T>>::add_to_white_list()]
+ #[weight = <SelfWeightOf<T>>::add_to_allow_list()]
#[transactional]
- pub fn add_to_white_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
+ pub fn add_to_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
let collection = <CollectionHandle<T>>::try_get(collection_id)?;
@@ -303,9 +303,9 @@
/// * collection_id.
///
/// * address.
- #[weight = <SelfWeightOf<T>>::remove_from_white_list()]
+ #[weight = <SelfWeightOf<T>>::remove_from_allow_list()]
#[transactional]
- pub fn remove_from_white_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
+ pub fn remove_from_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
let collection = <CollectionHandle<T>>::try_get(collection_id)?;
pallets/nft/src/tests.rsdiffbeforeafterboth--- a/pallets/nft/src/tests.rs
+++ b/pallets/nft/src/tests.rs
@@ -485,19 +485,19 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
1,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(1)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(2)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(3)
@@ -549,19 +549,19 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
1,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(1)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(2)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(3)
@@ -609,19 +609,19 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
1,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(1)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(2)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(3)
@@ -765,9 +765,9 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(1)
@@ -952,19 +952,19 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
1,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(1)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(2)
));
- assert_ok!(TemplateModule::add_to_white_list(origin1, 1, account(3)));
+ assert_ok!(TemplateModule::add_to_allow_list(origin1, 1, account(3)));
assert_ok!(TemplateModule::transfer_from(
origin2,
@@ -992,7 +992,7 @@
let collection_id = create_test_collection(&CollectionMode::NFT, 1);
let origin1 = Origin::signed(1);
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1,
collection_id,
account(2)
@@ -1013,7 +1013,7 @@
collection_id,
account(2)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin2,
collection_id,
account(3)
@@ -1029,7 +1029,7 @@
let origin2 = Origin::signed(2);
assert_noop!(
- TemplateModule::add_to_white_list(origin2, collection_id, account(3)),
+ TemplateModule::add_to_allow_list(origin2, collection_id, account(3)),
Error::<Test>::NoPermission
);
});
@@ -1041,7 +1041,7 @@
let origin1 = Origin::signed(1);
assert_noop!(
- TemplateModule::add_to_white_list(origin1, 1, account(2)),
+ TemplateModule::add_to_allow_list(origin1, 1, account(2)),
Error::<Test>::CollectionNotFound
);
});
@@ -1058,7 +1058,7 @@
collection_id
));
assert_noop!(
- TemplateModule::add_to_white_list(origin1, collection_id, account(2)),
+ TemplateModule::add_to_allow_list(origin1, collection_id, account(2)),
Error::<Test>::CollectionNotFound
);
});
@@ -1071,12 +1071,12 @@
let collection_id = create_test_collection(&CollectionMode::NFT, 1);
let origin1 = Origin::signed(1);
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(2)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1,
collection_id,
account(2)
@@ -1091,12 +1091,12 @@
let collection_id = create_test_collection(&CollectionMode::NFT, 1);
let origin1 = Origin::signed(1);
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(2)
));
- assert_ok!(TemplateModule::remove_from_white_list(
+ assert_ok!(TemplateModule::remove_from_allow_list(
origin1,
collection_id,
account(2)
@@ -1118,12 +1118,12 @@
account(2)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1,
collection_id,
account(3)
));
- assert_ok!(TemplateModule::remove_from_white_list(
+ assert_ok!(TemplateModule::remove_from_allow_list(
origin2,
collection_id,
account(3)
@@ -1139,13 +1139,13 @@
let origin1 = Origin::signed(1);
let origin2 = Origin::signed(2);
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1,
collection_id,
account(2)
));
assert_noop!(
- TemplateModule::remove_from_white_list(origin2, collection_id, account(2)),
+ TemplateModule::remove_from_allow_list(origin2, collection_id, account(2)),
Error::<Test>::NoPermission
);
assert!(TemplateModule::white_list(collection_id, 2));
@@ -1158,7 +1158,7 @@
let origin1 = Origin::signed(1);
assert_noop!(
- TemplateModule::remove_from_white_list(origin1, 1, account(2)),
+ TemplateModule::remove_from_allow_list(origin1, 1, account(2)),
Error::<Test>::CollectionNotFound
);
});
@@ -1171,14 +1171,14 @@
let origin1 = Origin::signed(1);
let origin2 = Origin::signed(2);
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(2)
));
assert_ok!(TemplateModule::destroy_collection(origin1, collection_id));
assert_noop!(
- TemplateModule::remove_from_white_list(origin2, collection_id, account(2)),
+ TemplateModule::remove_from_allow_list(origin2, collection_id, account(2)),
Error::<Test>::CollectionNotFound
);
assert!(!TemplateModule::white_list(collection_id, 2));
@@ -1192,17 +1192,17 @@
let collection_id = create_test_collection(&CollectionMode::NFT, 1);
let origin1 = Origin::signed(1);
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(2)
));
- assert_ok!(TemplateModule::remove_from_white_list(
+ assert_ok!(TemplateModule::remove_from_allow_list(
origin1.clone(),
collection_id,
account(2)
));
- assert_ok!(TemplateModule::remove_from_white_list(
+ assert_ok!(TemplateModule::remove_from_allow_list(
origin1,
collection_id,
account(2)
@@ -1225,9 +1225,9 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(2)
@@ -1252,14 +1252,14 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(1)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(2)
@@ -1275,7 +1275,7 @@
));
assert_eq!(TemplateModule::approved(1, (1, 1, 1)), 1);
- assert_ok!(TemplateModule::remove_from_white_list(
+ assert_ok!(TemplateModule::remove_from_allow_list(
origin1.clone(),
1,
account(1)
@@ -1302,9 +1302,9 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
1,
account(1)
@@ -1330,14 +1330,14 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(1)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(2)
@@ -1353,7 +1353,7 @@
));
assert_eq!(TemplateModule::approved(1, (1, 1, 1)), 1);
- assert_ok!(TemplateModule::remove_from_white_list(
+ assert_ok!(TemplateModule::remove_from_allow_list(
origin1.clone(),
collection_id,
account(2)
@@ -1380,7 +1380,7 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_noop!(
TemplateModule::burn_item(origin1.clone(), 1, 1, 5),
@@ -1403,7 +1403,7 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
// do approve
@@ -1429,14 +1429,14 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(1)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(2)
@@ -1459,14 +1459,14 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(1)
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(2)
@@ -1503,7 +1503,7 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_ok!(TemplateModule::set_mint_permission(
origin1,
@@ -1528,7 +1528,7 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_ok!(TemplateModule::set_mint_permission(
origin1.clone(),
@@ -1563,14 +1563,14 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_ok!(TemplateModule::set_mint_permission(
origin1.clone(),
collection_id,
false
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1,
collection_id,
account(2)
@@ -1595,7 +1595,7 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_ok!(TemplateModule::set_mint_permission(
origin1,
@@ -1621,7 +1621,7 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_ok!(TemplateModule::set_mint_permission(
origin1,
@@ -1646,7 +1646,7 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_ok!(TemplateModule::set_mint_permission(
origin1.clone(),
@@ -1681,7 +1681,7 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_ok!(TemplateModule::set_mint_permission(
origin1,
@@ -1708,14 +1708,14 @@
assert_ok!(TemplateModule::set_public_access_mode(
origin1.clone(),
collection_id,
- AccessMode::WhiteList
+ AccessMode::AllowList
));
assert_ok!(TemplateModule::set_mint_permission(
origin1.clone(),
collection_id,
true
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1,
collection_id,
account(2)
@@ -2056,7 +2056,7 @@
collection_id,
true
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin1.clone(),
collection_id,
account(1)
@@ -2124,7 +2124,7 @@
collection_id,
true
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin2.clone(),
collection_id,
account(1)
@@ -2177,7 +2177,7 @@
collection_id,
true
));
- assert_ok!(TemplateModule::add_to_white_list(
+ assert_ok!(TemplateModule::add_to_allow_list(
origin2.clone(),
collection_id,
account(1)
pallets/nft/src/weights.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_nft4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2021-10-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 12889// Executed Command:10// target/release/nft11// benchmark12// --pallet13// pallet-nft14// --wasm-execution15// compiled16// --extrinsic17// *18// --template19// .maintain/frame-weight-template.hbs20// --steps=5021// --repeat=2022// --output=./pallets/nft/src/weights.rs232425#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]27#![allow(unused_imports)]2829use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};30use sp_std::marker::PhantomData;3132/// Weight functions needed for pallet_nft.33pub trait WeightInfo {34 fn create_collection() -> Weight;35 fn destroy_collection() -> Weight;36 fn add_to_white_list() -> Weight;37 fn remove_from_white_list() -> Weight;38 fn set_public_access_mode() -> Weight;39 fn set_mint_permission() -> Weight;40 fn change_collection_owner() -> Weight;41 fn add_collection_admin() -> Weight;42 fn remove_collection_admin() -> Weight;43 fn set_collection_sponsor() -> Weight;44 fn confirm_sponsorship() -> Weight;45 fn remove_collection_sponsor() -> Weight;46 fn set_transfers_enabled_flag() -> Weight;47 fn set_offchain_schema(b: u32, ) -> Weight;48 fn set_const_on_chain_schema(b: u32, ) -> Weight;49 fn set_variable_on_chain_schema(b: u32, ) -> Weight;50 fn set_schema_version() -> Weight;51 fn set_collection_limits() -> Weight;52 fn set_meta_update_permission_flag() -> Weight;53}5455/// Weights for pallet_nft using the Substrate node and recommended hardware.56pub struct SubstrateWeight<T>(PhantomData<T>);57impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {58 // Storage: Common CreatedCollectionCount (r:1 w:1)59 // Storage: Common DestroyedCollectionCount (r:1 w:0)60 // Storage: System Account (r:2 w:2)61 // Storage: Common CollectionById (r:0 w:1)62 fn create_collection() -> Weight {63 (23_803_000 as Weight)64 .saturating_add(T::DbWeight::get().reads(4 as Weight))65 .saturating_add(T::DbWeight::get().writes(4 as Weight))66 }67 // Storage: Common CollectionById (r:1 w:1)68 // Storage: Common DestroyedCollectionCount (r:1 w:1)69 // Storage: Nonfungible TokensMinted (r:0 w:1)70 // Storage: Nonfungible TokensBurnt (r:0 w:1)71 fn destroy_collection() -> Weight {72 (27_831_000 as Weight)73 .saturating_add(T::DbWeight::get().reads(2 as Weight))74 .saturating_add(T::DbWeight::get().writes(4 as Weight))75 }76 // Storage: Common CollectionById (r:1 w:0)77 // Storage: Common Allowlist (r:0 w:1)78 fn add_to_white_list() -> Weight {79 (6_629_000 as Weight)80 .saturating_add(T::DbWeight::get().reads(1 as Weight))81 .saturating_add(T::DbWeight::get().writes(1 as Weight))82 }83 // Storage: Common CollectionById (r:1 w:0)84 // Storage: Common Allowlist (r:0 w:1)85 fn remove_from_white_list() -> Weight {86 (6_596_000 as Weight)87 .saturating_add(T::DbWeight::get().reads(1 as Weight))88 .saturating_add(T::DbWeight::get().writes(1 as Weight))89 }90 // Storage: Common CollectionById (r:1 w:1)91 fn set_public_access_mode() -> Weight {92 (6_338_000 as Weight)93 .saturating_add(T::DbWeight::get().reads(1 as Weight))94 .saturating_add(T::DbWeight::get().writes(1 as Weight))95 }96 // Storage: Common CollectionById (r:1 w:1)97 fn set_mint_permission() -> Weight {98 (6_383_000 as Weight)99 .saturating_add(T::DbWeight::get().reads(1 as Weight))100 .saturating_add(T::DbWeight::get().writes(1 as Weight))101 }102 // Storage: Common CollectionById (r:1 w:1)103 fn change_collection_owner() -> Weight {104 (6_493_000 as Weight)105 .saturating_add(T::DbWeight::get().reads(1 as Weight))106 .saturating_add(T::DbWeight::get().writes(1 as Weight))107 }108 // Storage: Common CollectionById (r:1 w:0)109 // Storage: Common IsAdmin (r:0 w:1)110 fn add_collection_admin() -> Weight {111 (6_850_000 as Weight)112 .saturating_add(T::DbWeight::get().reads(1 as Weight))113 .saturating_add(T::DbWeight::get().writes(1 as Weight))114 }115 // Storage: Common CollectionById (r:1 w:0)116 // Storage: Common IsAdmin (r:0 w:1)117 fn remove_collection_admin() -> Weight {118 (6_615_000 as Weight)119 .saturating_add(T::DbWeight::get().reads(1 as Weight))120 .saturating_add(T::DbWeight::get().writes(1 as Weight))121 }122 // Storage: Common CollectionById (r:1 w:1)123 fn set_collection_sponsor() -> Weight {124 (6_430_000 as Weight)125 .saturating_add(T::DbWeight::get().reads(1 as Weight))126 .saturating_add(T::DbWeight::get().writes(1 as Weight))127 }128 // Storage: Common CollectionById (r:1 w:1)129 fn confirm_sponsorship() -> Weight {130 (6_125_000 as Weight)131 .saturating_add(T::DbWeight::get().reads(1 as Weight))132 .saturating_add(T::DbWeight::get().writes(1 as Weight))133 }134 // Storage: Common CollectionById (r:1 w:1)135 fn remove_collection_sponsor() -> Weight {136 (6_236_000 as Weight)137 .saturating_add(T::DbWeight::get().reads(1 as Weight))138 .saturating_add(T::DbWeight::get().writes(1 as Weight))139 }140 // Storage: Common CollectionById (r:1 w:1)141 fn set_transfers_enabled_flag() -> Weight {142 (6_500_000 as Weight)143 .saturating_add(T::DbWeight::get().reads(1 as Weight))144 .saturating_add(T::DbWeight::get().writes(1 as Weight))145 }146 // Storage: Common CollectionById (r:1 w:1)147 fn set_offchain_schema(_b: u32, ) -> Weight {148 (6_538_000 as Weight)149 .saturating_add(T::DbWeight::get().reads(1 as Weight))150 .saturating_add(T::DbWeight::get().writes(1 as Weight))151 }152 // Storage: Common CollectionById (r:1 w:1)153 fn set_const_on_chain_schema(_b: u32, ) -> Weight {154 (6_542_000 as Weight)155 .saturating_add(T::DbWeight::get().reads(1 as Weight))156 .saturating_add(T::DbWeight::get().writes(1 as Weight))157 }158 // Storage: Common CollectionById (r:1 w:1)159 fn set_variable_on_chain_schema(b: u32, ) -> Weight {160 (6_092_000 as Weight)161 // Standard Error: 0162 .saturating_add((2_000 as Weight).saturating_mul(b as Weight))163 .saturating_add(T::DbWeight::get().reads(1 as Weight))164 .saturating_add(T::DbWeight::get().writes(1 as Weight))165 }166 // Storage: Common CollectionById (r:1 w:1)167 fn set_schema_version() -> Weight {168 (6_470_000 as Weight)169 .saturating_add(T::DbWeight::get().reads(1 as Weight))170 .saturating_add(T::DbWeight::get().writes(1 as Weight))171 }172 // Storage: Common CollectionById (r:1 w:1)173 fn set_collection_limits() -> Weight {174 (6_841_000 as Weight)175 .saturating_add(T::DbWeight::get().reads(1 as Weight))176 .saturating_add(T::DbWeight::get().writes(1 as Weight))177 }178 // Storage: Common CollectionById (r:1 w:1)179 fn set_meta_update_permission_flag() -> Weight {180 (6_278_000 as Weight)181 .saturating_add(T::DbWeight::get().reads(1 as Weight))182 .saturating_add(T::DbWeight::get().writes(1 as Weight))183 }184}185186// For backwards compatibility and tests187impl WeightInfo for () {188 // Storage: Common CreatedCollectionCount (r:1 w:1)189 // Storage: Common DestroyedCollectionCount (r:1 w:0)190 // Storage: System Account (r:2 w:2)191 // Storage: Common CollectionById (r:0 w:1)192 fn create_collection() -> Weight {193 (23_803_000 as Weight)194 .saturating_add(RocksDbWeight::get().reads(4 as Weight))195 .saturating_add(RocksDbWeight::get().writes(4 as Weight))196 }197 // Storage: Common CollectionById (r:1 w:1)198 // Storage: Common DestroyedCollectionCount (r:1 w:1)199 // Storage: Nonfungible TokensMinted (r:0 w:1)200 // Storage: Nonfungible TokensBurnt (r:0 w:1)201 fn destroy_collection() -> Weight {202 (27_831_000 as Weight)203 .saturating_add(RocksDbWeight::get().reads(2 as Weight))204 .saturating_add(RocksDbWeight::get().writes(4 as Weight))205 }206 // Storage: Common CollectionById (r:1 w:0)207 // Storage: Common Allowlist (r:0 w:1)208 fn add_to_white_list() -> Weight {209 (6_629_000 as Weight)210 .saturating_add(RocksDbWeight::get().reads(1 as Weight))211 .saturating_add(RocksDbWeight::get().writes(1 as Weight))212 }213 // Storage: Common CollectionById (r:1 w:0)214 // Storage: Common Allowlist (r:0 w:1)215 fn remove_from_white_list() -> Weight {216 (6_596_000 as Weight)217 .saturating_add(RocksDbWeight::get().reads(1 as Weight))218 .saturating_add(RocksDbWeight::get().writes(1 as Weight))219 }220 // Storage: Common CollectionById (r:1 w:1)221 fn set_public_access_mode() -> Weight {222 (6_338_000 as Weight)223 .saturating_add(RocksDbWeight::get().reads(1 as Weight))224 .saturating_add(RocksDbWeight::get().writes(1 as Weight))225 }226 // Storage: Common CollectionById (r:1 w:1)227 fn set_mint_permission() -> Weight {228 (6_383_000 as Weight)229 .saturating_add(RocksDbWeight::get().reads(1 as Weight))230 .saturating_add(RocksDbWeight::get().writes(1 as Weight))231 }232 // Storage: Common CollectionById (r:1 w:1)233 fn change_collection_owner() -> Weight {234 (6_493_000 as Weight)235 .saturating_add(RocksDbWeight::get().reads(1 as Weight))236 .saturating_add(RocksDbWeight::get().writes(1 as Weight))237 }238 // Storage: Common CollectionById (r:1 w:0)239 // Storage: Common IsAdmin (r:0 w:1)240 fn add_collection_admin() -> Weight {241 (6_850_000 as Weight)242 .saturating_add(RocksDbWeight::get().reads(1 as Weight))243 .saturating_add(RocksDbWeight::get().writes(1 as Weight))244 }245 // Storage: Common CollectionById (r:1 w:0)246 // Storage: Common IsAdmin (r:0 w:1)247 fn remove_collection_admin() -> Weight {248 (6_615_000 as Weight)249 .saturating_add(RocksDbWeight::get().reads(1 as Weight))250 .saturating_add(RocksDbWeight::get().writes(1 as Weight))251 }252 // Storage: Common CollectionById (r:1 w:1)253 fn set_collection_sponsor() -> Weight {254 (6_430_000 as Weight)255 .saturating_add(RocksDbWeight::get().reads(1 as Weight))256 .saturating_add(RocksDbWeight::get().writes(1 as Weight))257 }258 // Storage: Common CollectionById (r:1 w:1)259 fn confirm_sponsorship() -> Weight {260 (6_125_000 as Weight)261 .saturating_add(RocksDbWeight::get().reads(1 as Weight))262 .saturating_add(RocksDbWeight::get().writes(1 as Weight))263 }264 // Storage: Common CollectionById (r:1 w:1)265 fn remove_collection_sponsor() -> Weight {266 (6_236_000 as Weight)267 .saturating_add(RocksDbWeight::get().reads(1 as Weight))268 .saturating_add(RocksDbWeight::get().writes(1 as Weight))269 }270 // Storage: Common CollectionById (r:1 w:1)271 fn set_transfers_enabled_flag() -> Weight {272 (6_500_000 as Weight)273 .saturating_add(RocksDbWeight::get().reads(1 as Weight))274 .saturating_add(RocksDbWeight::get().writes(1 as Weight))275 }276 // Storage: Common CollectionById (r:1 w:1)277 fn set_offchain_schema(_b: u32, ) -> Weight {278 (6_538_000 as Weight)279 .saturating_add(RocksDbWeight::get().reads(1 as Weight))280 .saturating_add(RocksDbWeight::get().writes(1 as Weight))281 }282 // Storage: Common CollectionById (r:1 w:1)283 fn set_const_on_chain_schema(_b: u32, ) -> Weight {284 (6_542_000 as Weight)285 .saturating_add(RocksDbWeight::get().reads(1 as Weight))286 .saturating_add(RocksDbWeight::get().writes(1 as Weight))287 }288 // Storage: Common CollectionById (r:1 w:1)289 fn set_variable_on_chain_schema(b: u32, ) -> Weight {290 (6_092_000 as Weight)291 // Standard Error: 0292 .saturating_add((2_000 as Weight).saturating_mul(b as Weight))293 .saturating_add(RocksDbWeight::get().reads(1 as Weight))294 .saturating_add(RocksDbWeight::get().writes(1 as Weight))295 }296 // Storage: Common CollectionById (r:1 w:1)297 fn set_schema_version() -> Weight {298 (6_470_000 as Weight)299 .saturating_add(RocksDbWeight::get().reads(1 as Weight))300 .saturating_add(RocksDbWeight::get().writes(1 as Weight))301 }302 // Storage: Common CollectionById (r:1 w:1)303 fn set_collection_limits() -> Weight {304 (6_841_000 as Weight)305 .saturating_add(RocksDbWeight::get().reads(1 as Weight))306 .saturating_add(RocksDbWeight::get().writes(1 as Weight))307 }308 // Storage: Common CollectionById (r:1 w:1)309 fn set_meta_update_permission_flag() -> Weight {310 (6_278_000 as Weight)311 .saturating_add(RocksDbWeight::get().reads(1 as Weight))312 .saturating_add(RocksDbWeight::get().writes(1 as Weight))313 }314}pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -169,7 +169,7 @@
<CommonError<T>>::NoPermission
);
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
collection.check_allowlist(sender)?;
}
@@ -227,7 +227,7 @@
<CommonError<T>>::NoPermission
);
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
collection.check_allowlist(from)?;
collection.check_allowlist(to)?;
}
@@ -445,7 +445,7 @@
token: TokenId,
spender: Option<&T::CrossAccountId>,
) -> DispatchResult {
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
collection.check_allowlist(&sender)?;
if let Some(spender) = spender {
collection.check_allowlist(&spender)?;
@@ -480,7 +480,7 @@
if spender == from {
return Self::transfer(collection, from, to, token);
}
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
// `from`, `to` checked in [`transfer`]
collection.check_allowlist(spender)?;
}
@@ -508,7 +508,7 @@
if spender == from {
return Self::burn(collection, from, token);
}
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
// `from` checked in [`burn`]
collection.check_allowlist(spender)?;
}
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -272,7 +272,7 @@
<CommonError<T>>::TransferNotAllowed
);
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
collection.check_allowlist(from)?;
collection.check_allowlist(to)?;
}
@@ -483,7 +483,7 @@
token: TokenId,
amount: u128,
) -> DispatchResult {
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
collection.check_allowlist(&sender)?;
collection.check_allowlist(&spender)?;
}
@@ -514,7 +514,7 @@
if spender == from {
return Self::transfer(collection, from, to, token, amount);
}
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
// `from`, `to` checked in [`transfer`]
collection.check_allowlist(spender)?;
}
@@ -547,7 +547,7 @@
if spender == from {
return Self::burn(collection, from, token, amount);
}
- if collection.access == AccessMode::WhiteList {
+ if collection.access == AccessMode::AllowList {
// `from` checked in [`burn`]
collection.check_allowlist(spender)?;
}
primitives/nft/src/lib.rsdiffbeforeafterboth--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -141,7 +141,7 @@
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub enum AccessMode {
Normal,
- WhiteList,
+ AllowList,
}
impl Default for AccessMode {
fn default() -> Self {
runtime/src/chain_extension.rsdiffbeforeafterboth--- a/runtime/src/chain_extension.rs
+++ b/runtime/src/chain_extension.rs
@@ -75,10 +75,10 @@
}
#[derive(Debug, PartialEq, Encode, Decode, MaxEncodedLen)]
-pub struct NFTExtToggleWhiteList<AccountId> {
+pub struct NFTExtToggleAllowList<AccountId> {
pub collection_id: u32,
pub address: AccountId,
- pub whitelisted: bool,
+ pub allowlisted: bool,
}
/// The chain Extension of NFT pallet
@@ -213,8 +213,8 @@
6 => {
// Toggle whitelist
let mut env = env.buf_in_buf_out();
- let input: NFTExtToggleWhiteList<AccountIdOf<C>> = env.read_as()?;
- env.charge_weight(NftWeightInfoOf::<C>::add_to_white_list())?;
+ let input: NFTExtToggleAllowList<AccountIdOf<C>> = env.read_as()?;
+ env.charge_weight(NftWeightInfoOf::<C>::add_to_allow_list())?;
let collection = pallet_nft::Module::<C>::get_collection(input.collection_id)?;
@@ -222,7 +222,7 @@
&C::CrossAccountId::from_sub(env.ext().address().clone()),
&collection,
&C::CrossAccountId::from_sub(input.address),
- input.whitelisted,
+ input.allowlisted,
)?;
collection.submit_logs()?;