--- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -75,9 +75,17 @@ ) -> Result; #[rpc(name = "nft_adminlist")] - fn adminlist(&self, collection: CollectionId, at: Option) -> Result>; + fn adminlist( + &self, + collection: CollectionId, + at: Option, + ) -> Result>; #[rpc(name = "nft_allowlist")] - fn allowlist(&self, collection: CollectionId, at: Option) -> Result>; + fn allowlist( + &self, + collection: CollectionId, + at: Option, + ) -> Result>; #[rpc(name = "nft_lastTokenId")] fn last_token_id(&self, collection: CollectionId, at: Option) -> Result; } @@ -150,7 +158,7 @@ pass_method!(balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> String => |v| v.to_string()); pass_method!(allowance(collection: CollectionId, sender: CrossAccountId, spender: CrossAccountId, token: TokenId) -> String => |v| v.to_string()); - pass_method!(adminlist(collection: CollectionId) -> Vec); - pass_method!(allowlist(collection: CollectionId) -> Vec); + pass_method!(adminlist(collection: CollectionId) -> Vec); + pass_method!(allowlist(collection: CollectionId) -> Vec); pass_method!(last_token_id(collection: CollectionId) -> TokenId); } --- a/pallets/common/src/account.rs +++ b/pallets/common/src/account.rs @@ -19,6 +19,8 @@ fn from_sub(account: AccountId) -> Self; fn from_eth(account: H160) -> Self; + + fn conv_eq(&self, other: &Self) -> bool; } #[derive(Encode, Decode, Serialize, Deserialize, TypeInfo)] @@ -28,7 +30,7 @@ Ethereum(H160), } -#[derive(Eq)] +#[derive(PartialEq, Eq)] pub struct BasicCrossAccountId { /// If true - then ethereum is canonical encoding from_ethereum: bool, @@ -77,18 +79,6 @@ } } -impl PartialEq for BasicCrossAccountId { - fn eq(&self, other: &Self) -> bool { - if self.from_ethereum == other.from_ethereum { - self.substrate == other.substrate && self.ethereum == other.ethereum - } else if self.from_ethereum { - // ethereum is canonical encoding, but we need to compare derived address - self.substrate == other.substrate - } else { - self.ethereum == other.ethereum - } - } -} impl Clone for BasicCrossAccountId { fn clone(&self) -> Self { Self { @@ -158,6 +148,16 @@ from_ethereum: true, } } + fn conv_eq(&self, other: &Self) -> bool { + if self.from_ethereum == other.from_ethereum { + self.substrate == other.substrate && self.ethereum == other.ethereum + } else if self.from_ethereum { + // ethereum is canonical encoding, but we need to compare derived address + self.substrate == other.substrate + } else { + self.ethereum == other.ethereum + } + } } impl From> for BasicCrossAccountId { fn from(repr: BasicCrossAccountIdRepr) -> Self { --- a/pallets/common/src/lib.rs +++ b/pallets/common/src/lib.rs @@ -98,7 +98,7 @@ pub fn is_owner_or_admin(&self, subject: &T::CrossAccountId) -> Result { self.consume_sload()?; - Ok(*subject.as_sub() == self.owner || >::get((self.id, subject.as_sub()))) + Ok(*subject.as_sub() == self.owner || >::get((self.id, subject))) } pub fn check_is_owner_or_admin(&self, subject: &T::CrossAccountId) -> DispatchResult { ensure!(self.is_owner_or_admin(subject)?, >::NoPermission); @@ -114,7 +114,7 @@ self.consume_sload()?; ensure!( - >::get((self.id, user.as_sub())), + >::get((self.id, user)), >::AddressNotInAllowlist ); Ok(()) @@ -139,8 +139,7 @@ #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::{pallet_prelude::*}; - use frame_support::{Blake2_128Concat, storage::Key}; + use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key}; use account::{EvmBackwardsAddressMapping, CrossAccountId}; use frame_support::traits::Currency; use nft_data_structs::TokenId; @@ -311,7 +310,7 @@ pub type IsAdmin = StorageNMap< Key = ( Key, - Key, + Key, ), Value = bool, QueryKind = ValueQuery, @@ -322,7 +321,7 @@ pub type Allowlist = StorageNMap< Key = ( Key, - Key, + Key, ), Value = bool, QueryKind = ValueQuery, --- a/pallets/fungible/src/common.rs +++ b/pallets/fungible/src/common.rs @@ -2,9 +2,7 @@ use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight}; use nft_data_structs::TokenId; -use pallet_common::{ - CommonCollectionOperations, CommonWeightInfo, account::CrossAccountId, with_weight, -}; +use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight}; use sp_runtime::ArithmeticError; use sp_std::{vec::Vec, vec}; @@ -188,7 +186,7 @@ } fn account_tokens(&self, account: T::CrossAccountId) -> Vec { - if >::get((self.id, account.as_sub())) != 0 { + if >::get((self.id, account)) != 0 { vec![TokenId::default()] } else { vec![] @@ -218,7 +216,7 @@ } fn account_balance(&self, account: T::CrossAccountId) -> u32 { - if >::get((self.id, account.as_sub())) != 0 { + if >::get((self.id, account)) != 0 { 1 } else { 0 @@ -229,7 +227,7 @@ if token != TokenId::default() { return 0; } - >::get((self.id, account.as_sub())) + >::get((self.id, account)) } fn allowance( @@ -241,6 +239,6 @@ if token != TokenId::default() { return 0; } - >::get((self.id, sender.as_sub(), spender.as_sub())) + >::get((self.id, sender, spender)) } } --- a/pallets/fungible/src/erc.rs +++ b/pallets/fungible/src/erc.rs @@ -52,7 +52,7 @@ } fn balance_of(&self, owner: address) -> Result { let owner = T::CrossAccountId::from_eth(owner); - let balance = >::get((self.id, owner.as_sub())); + let balance = >::get((self.id, owner)); Ok(balance.into()) } fn transfer(&mut self, caller: caller, to: address, amount: uint256) -> Result { @@ -92,7 +92,7 @@ let owner = T::CrossAccountId::from_eth(owner); let spender = T::CrossAccountId::from_eth(spender); - Ok(>::get((self.id, owner.as_sub(), spender.as_sub())).into()) + Ok(>::get((self.id, owner, spender)).into()) } } --- a/pallets/fungible/src/lib.rs +++ b/pallets/fungible/src/lib.rs @@ -55,7 +55,7 @@ pub(super) type Balance = StorageNMap< Key = ( Key, - Key, + Key, ), Value = u128, QueryKind = ValueQuery, @@ -65,8 +65,8 @@ pub(super) type Allowance = StorageNMap< Key = ( Key, - Key, - Key, + Key, + Key, ), Value = u128, QueryKind = ValueQuery, @@ -119,7 +119,7 @@ .checked_sub(amount) .ok_or(>::TokenValueTooLow)?; - let balance = >::get((collection.id, owner.as_sub())) + let balance = >::get((collection.id, owner)) .checked_sub(amount) .ok_or(>::TokenValueTooLow)?; @@ -130,9 +130,9 @@ // ========= if balance == 0 { - >::remove((collection.id, owner.as_sub())); + >::remove((collection.id, owner)); } else { - >::insert((collection.id, owner.as_sub()), balance); + >::insert((collection.id, owner), balance); } >::insert(collection.id, total_supply); @@ -167,12 +167,12 @@ } >::ensure_correct_receiver(to)?; - let balance_from = >::get((collection.id, from.as_sub())) + let balance_from = >::get((collection.id, from)) .checked_sub(amount) .ok_or(>::TokenValueTooLow)?; let balance_to = if from != to { Some( - >::get((collection.id, to.as_sub())) + >::get((collection.id, to)) .checked_add(amount) .ok_or(ArithmeticError::Overflow)?, ) @@ -190,11 +190,11 @@ if let Some(balance_to) = balance_to { // from != to if balance_from == 0 { - >::remove((collection.id, from.as_sub())); + >::remove((collection.id, from)); } else { - >::insert((collection.id, from.as_sub()), balance_from); + >::insert((collection.id, from), balance_from); } - >::insert((collection.id, to.as_sub()), balance_to); + >::insert((collection.id, to), balance_to); } collection.log_infallible(ERC20Events::Transfer { @@ -242,7 +242,7 @@ collection.consume_sload()?; let balance = balances .entry(user.clone()) - .or_insert_with(|| >::get((collection.id, user.as_sub()))); + .or_insert_with(|| >::get((collection.id, user))); *balance = (*balance) .checked_add(amount) .ok_or(ArithmeticError::Overflow)?; @@ -259,7 +259,7 @@ >::insert(collection.id, total_supply); for (user, amount) in balances { - >::insert((collection.id, user.as_sub()), amount); + >::insert((collection.id, &user), amount); collection.log_infallible(ERC20Events::Transfer { from: H160::default(), @@ -283,7 +283,7 @@ spender: &T::CrossAccountId, amount: u128, ) { - >::insert((collection.id, owner.as_sub(), spender.as_sub()), amount); + >::insert((collection.id, owner, spender), amount); collection.log_infallible(ERC20Events::Approval { owner: *owner.as_eth(), @@ -310,7 +310,7 @@ collection.check_allowlist(&spender)?; } - if >::get((collection.id, owner.as_sub())) < amount { + if >::get((collection.id, owner)) < amount { ensure!( collection.ignores_owned_amount(owner)?, >::CantApproveMoreThanOwned @@ -330,7 +330,7 @@ to: &T::CrossAccountId, amount: u128, ) -> DispatchResult { - if spender == from { + if spender.conv_eq(from) { return Self::transfer(collection, from, to, amount); } if collection.access == AccessMode::WhiteList { @@ -338,8 +338,7 @@ collection.check_allowlist(spender)?; } - let allowance = >::get((collection.id, from.as_sub(), spender.as_sub())) - .checked_sub(amount); + let allowance = >::get((collection.id, from, spender)).checked_sub(amount); if allowance.is_none() { ensure!( collection.ignores_allowance(spender)?, @@ -362,7 +361,7 @@ from: &T::CrossAccountId, amount: u128, ) -> DispatchResult { - if spender == from { + if spender.conv_eq(from) { return Self::burn(collection, from, amount); } if collection.access == AccessMode::WhiteList { @@ -370,8 +369,7 @@ collection.check_allowlist(spender)?; } - let allowance = >::get((collection.id, from.as_sub(), spender.as_sub())) - .checked_sub(amount); + let allowance = >::get((collection.id, from, spender)).checked_sub(amount); if allowance.is_none() { ensure!( collection.ignores_allowance(spender)?, --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -948,12 +948,12 @@ // TODO: limit returned entries? impl Pallet { - pub fn adminlist(collection: CollectionId) -> Vec { + pub fn adminlist(collection: CollectionId) -> Vec { >::iter_prefix((collection,)) .map(|(a, _)| a) .collect() } - pub fn allowlist(collection: CollectionId) -> Vec { + pub fn allowlist(collection: CollectionId) -> Vec { >::iter_prefix((collection,)) .map(|(a, _)| a) .collect() --- a/pallets/nonfungible/src/common.rs +++ b/pallets/nonfungible/src/common.rs @@ -2,9 +2,7 @@ use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight}; use nft_data_structs::TokenId; -use pallet_common::{ - CommonCollectionOperations, CommonWeightInfo, account::CrossAccountId, with_weight, -}; +use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight}; use sp_runtime::DispatchError; use sp_std::vec::Vec; @@ -200,7 +198,7 @@ } fn account_tokens(&self, account: T::CrossAccountId) -> Vec { - >::iter_prefix((self.id, account.as_sub())) + >::iter_prefix((self.id, account)) .map(|(id, _)| id) .collect() } @@ -234,7 +232,7 @@ } fn account_balance(&self, account: T::CrossAccountId) -> u32 { - >::get((self.id, account.as_sub())) + >::get((self.id, account)) } fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 { --- a/pallets/nonfungible/src/erc.rs +++ b/pallets/nonfungible/src/erc.rs @@ -93,7 +93,7 @@ impl NonfungibleHandle { fn balance_of(&self, owner: address) -> Result { let owner = T::CrossAccountId::from_eth(owner); - let balance = >::get((self.id, owner.as_sub())); + let balance = >::get((self.id, owner)); Ok(balance.into()) } fn owner_of(&self, token_id: uint256) -> Result
{ --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -80,7 +80,7 @@ pub(super) type Owned = StorageNMap< Key = ( Key, - Key, + Key, Key, ), Value = bool, @@ -91,7 +91,7 @@ pub(super) type AccountBalance = StorageNMap< Key = ( Key, - Key, + Key, ), Value = u32, QueryKind = ValueQuery, @@ -179,7 +179,7 @@ // ========= - >::remove((collection.id, token_data.owner.as_sub(), token)); + >::remove((collection.id, &token_data.owner, token)); >::insert(collection.id, burnt); >::remove((collection.id, token)); let old_spender = >::take((collection.id, token)); @@ -234,11 +234,11 @@ } >::ensure_correct_receiver(to)?; - let balance_from = >::get((collection.id, from.as_sub())) + let balance_from = >::get((collection.id, from)) .checked_sub(1) .ok_or(>::TokenValueTooLow)?; let balance_to = if from != to { - let balance_to = >::get((collection.id, to.as_sub())) + let balance_to = >::get((collection.id, to)) .checked_add(1) .ok_or(ArithmeticError::Overflow)?; @@ -268,13 +268,13 @@ if let Some(balance_to) = balance_to { // from != to if balance_from == 0 { - >::remove((collection.id, from.as_sub())); + >::remove((collection.id, from)); } else { - >::insert((collection.id, from.as_sub()), balance_from); + >::insert((collection.id, from), balance_from); } - >::insert((collection.id, to.as_sub()), balance_to); - >::remove((collection.id, from.as_sub(), token)); - >::insert((collection.id, to.as_sub(), token), true); + >::insert((collection.id, to), balance_to); + >::remove((collection.id, from, token)); + >::insert((collection.id, to, token), true); } Self::set_allowance_unchecked(collection, from, token, None, true); @@ -336,8 +336,8 @@ let mut balances = BTreeMap::new(); for data in &data { let balance = balances - .entry(data.owner.as_sub()) - .or_insert_with(|| >::get((collection.id, data.owner.as_sub()))); + .entry(&data.owner) + .or_insert_with(|| >::get((collection.id, &data.owner))); *balance = balance.checked_add(1).ok_or(ArithmeticError::Overflow)?; ensure!( @@ -364,7 +364,7 @@ owner: data.owner.clone(), }, ); - >::insert((collection.id, data.owner.as_sub(), token), true); + >::insert((collection.id, &data.owner, token), true); collection.log_infallible(ERC721Events::Transfer { from: H160::default(), @@ -481,7 +481,7 @@ to: &T::CrossAccountId, token: TokenId, ) -> DispatchResult { - if spender == from { + if spender.conv_eq(from) { return Self::transfer(collection, from, to, token); } if collection.access == AccessMode::WhiteList { @@ -509,7 +509,7 @@ from: &T::CrossAccountId, token: TokenId, ) -> DispatchResult { - if spender == from { + if spender.conv_eq(from) { return Self::burn(collection, from, token); } if collection.access == AccessMode::WhiteList { --- a/pallets/refungible/src/common.rs +++ b/pallets/refungible/src/common.rs @@ -3,9 +3,7 @@ use sp_std::collections::btree_map::BTreeMap; use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight}; use nft_data_structs::TokenId; -use pallet_common::{ - CommonCollectionOperations, CommonWeightInfo, account::CrossAccountId, with_weight, -}; +use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight}; use sp_runtime::DispatchError; use sp_std::vec::Vec; @@ -196,7 +194,7 @@ } fn account_tokens(&self, account: T::CrossAccountId) -> Vec { - >::iter_prefix((self.id, account.as_sub())) + >::iter_prefix((self.id, account)) .map(|(id, _)| id) .collect() } @@ -224,11 +222,11 @@ } fn account_balance(&self, account: T::CrossAccountId) -> u32 { - >::get((self.id, account.as_sub())) + >::get((self.id, account)) } fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 { - >::get((self.id, token, account.as_sub())) + >::get((self.id, token, account)) } fn allowance( @@ -237,6 +235,6 @@ spender: T::CrossAccountId, token: TokenId, ) -> u128 { - >::get((self.id, token, sender.as_sub(), spender)) + >::get((self.id, token, sender, spender)) } } --- a/pallets/refungible/src/lib.rs +++ b/pallets/refungible/src/lib.rs @@ -83,7 +83,7 @@ pub(super) type Owned = StorageNMap< Key = ( Key, - Key, + Key, Key, ), Value = bool, @@ -95,7 +95,7 @@ Key = ( Key, // Owner - Key, + Key, ), Value = u32, QueryKind = ValueQuery, @@ -107,7 +107,7 @@ Key, Key, // Owner - Key, + Key, ), Value = u128, QueryKind = ValueQuery, @@ -119,7 +119,7 @@ Key, Key, // Owner - Key, + Key, // Spender Key, ), @@ -206,18 +206,18 @@ if total_supply == 0 { // Ensure user actually owns this amount ensure!( - >::get((collection.id, token, owner.as_sub())) == amount, + >::get((collection.id, token, owner)) == amount, >::TokenValueTooLow ); - let account_balance = >::get((collection.id, owner.as_sub())) + let account_balance = >::get((collection.id, owner)) .checked_sub(1) // Should not occur .ok_or(ArithmeticError::Underflow)?; // ========= - >::remove((collection.id, owner.as_sub(), token)); - >::insert((collection.id, owner.as_sub()), account_balance); + >::remove((collection.id, owner, token)); + >::insert((collection.id, owner), account_balance); Self::burn_token(collection, token)?; >::deposit_event(CommonEvent::ItemDestroyed( collection.id, @@ -228,11 +228,11 @@ return Ok(()); } - let balance = >::get((collection.id, token, owner.as_sub())) + let balance = >::get((collection.id, token, owner)) .checked_sub(amount) .ok_or(>::TokenValueTooLow)?; let account_balance = if balance == 0 { - >::get((collection.id, owner.as_sub())) + >::get((collection.id, owner)) .checked_sub(1) // Should not occur .ok_or(ArithmeticError::Underflow)? @@ -243,11 +243,11 @@ // ========= if balance == 0 { - >::remove((collection.id, owner.as_sub(), token)); - >::remove((collection.id, token, owner.as_sub())); - >::insert((collection.id, owner.as_sub()), account_balance); + >::remove((collection.id, owner, token)); + >::remove((collection.id, token, owner)); + >::insert((collection.id, owner), account_balance); } else { - >::insert((collection.id, token, owner.as_sub()), balance); + >::insert((collection.id, token, owner), balance); } >::insert((collection.id, token), total_supply); // TODO: ERC20 transfer event @@ -278,13 +278,13 @@ } >::ensure_correct_receiver(to)?; - let balance_from = >::get((collection.id, token, from.as_sub())) + let balance_from = >::get((collection.id, token, from)) .checked_sub(amount) .ok_or(>::TokenValueTooLow)?; let mut create_target = false; let from_to_differ = from != to; let balance_to = if from != to { - let old_balance = >::get((collection.id, token, to.as_sub())); + let old_balance = >::get((collection.id, token, to)); if old_balance == 0 { create_target = true; } @@ -299,7 +299,7 @@ let account_balance_from = if balance_from == 0 { Some( - >::get((collection.id, from.as_sub())) + >::get((collection.id, from)) .checked_sub(1) // Should not occur .ok_or(ArithmeticError::Underflow)?, @@ -310,7 +310,7 @@ // Account data is created in token, AccountBalance should be increased // But only if from != to as we shouldn't check overflow in this case let account_balance_to = if create_target && from_to_differ { - let account_balance_to = >::get((collection.id, to.as_sub())) + let account_balance_to = >::get((collection.id, to)) .checked_add(1) .ok_or(ArithmeticError::Overflow)?; ensure!( @@ -328,18 +328,18 @@ if let Some(balance_to) = balance_to { // from != to if balance_from == 0 { - >::remove((collection.id, token, from.as_sub())); + >::remove((collection.id, token, from)); } else { - >::insert((collection.id, token, from.as_sub()), balance_from); + >::insert((collection.id, token, from), balance_from); } - >::insert((collection.id, token, to.as_sub()), balance_to); + >::insert((collection.id, token, to), balance_to); if let Some(account_balance_from) = account_balance_from { - >::insert((collection.id, from.as_sub()), account_balance_from); - >::remove((collection.id, from.as_sub(), token)); + >::insert((collection.id, from), account_balance_from); + >::remove((collection.id, from, token)); } if let Some(account_balance_to) = account_balance_to { - >::insert((collection.id, to.as_sub()), account_balance_to); - >::insert((collection.id, to.as_sub(), token), true); + >::insert((collection.id, to), account_balance_to); + >::insert((collection.id, to, token), true); } } @@ -412,8 +412,8 @@ for data in &data { for (owner, _) in &data.users { let balance = balances - .entry(owner.as_sub()) - .or_insert_with(|| >::get((collection.id, owner.as_sub()))); + .entry(owner) + .or_insert_with(|| >::get((collection.id, owner))); *balance = balance.checked_add(1).ok_or(ArithmeticError::Overflow)?; ensure!( @@ -444,8 +444,8 @@ if amount == 0 { continue; } - >::insert((collection.id, token_id, user.as_sub()), amount); - >::insert((collection.id, user.as_sub(), TokenId(token_id)), true); + >::insert((collection.id, token_id, &user), amount); + >::insert((collection.id, &user, TokenId(token_id)), true); // TODO: ERC20 transfer event >::deposit_event(CommonEvent::ItemCreated( collection.id, @@ -465,7 +465,7 @@ token: TokenId, amount: u128, ) { - >::insert((collection.id, token, sender.as_sub(), spender), amount); + >::insert((collection.id, token, sender, spender), amount); // TODO: ERC20 approval event >::deposit_event(CommonEvent::Approved( collection.id, @@ -490,7 +490,7 @@ >::ensure_correct_receiver(spender)?; - if >::get((collection.id, token, sender.as_sub())) < amount { + if >::get((collection.id, token, sender)) < amount { ensure!( collection.ignores_owned_amount(sender)? && Self::token_exists(collection, token), >::CantApproveMoreThanOwned @@ -511,7 +511,7 @@ token: TokenId, amount: u128, ) -> DispatchResult { - if spender == from { + if spender.conv_eq(from) { return Self::transfer(collection, from, to, token, amount); } if collection.access == AccessMode::WhiteList { @@ -519,8 +519,8 @@ collection.check_allowlist(spender)?; } - let allowance = >::get((collection.id, token, from.as_sub(), &spender)) - .checked_sub(amount); + let allowance = + >::get((collection.id, token, from, &spender)).checked_sub(amount); if allowance.is_none() { ensure!( collection.ignores_allowance(spender)?, @@ -544,7 +544,7 @@ token: TokenId, amount: u128, ) -> DispatchResult { - if spender == from { + if spender.conv_eq(from) { return Self::burn(collection, from, token, amount); } if collection.access == AccessMode::WhiteList { @@ -552,8 +552,8 @@ collection.check_allowlist(spender)?; } - let allowance = >::get((collection.id, token, from.as_sub(), &spender)) - .checked_sub(amount); + let allowance = + >::get((collection.id, token, from, &spender)).checked_sub(amount); if allowance.is_none() { ensure!( collection.ignores_allowance(spender)?, --- a/primitives/rpc/src/lib.rs +++ b/primitives/rpc/src/lib.rs @@ -30,8 +30,8 @@ /// Used for ethereum integration fn eth_contract_code(account: H160) -> Option>; - fn adminlist(collection: CollectionId) -> Vec; - fn allowlist(collection: CollectionId) -> Vec; + fn adminlist(collection: CollectionId) -> Vec; + fn allowlist(collection: CollectionId) -> Vec; fn last_token_id(collection: CollectionId) -> TokenId; } } --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -1033,12 +1033,14 @@ } fn eth_contract_code(account: H160) -> Option> { - >::get_code(&account).or_else(|| >::get_code(&account)).or_else(|| >::get_code(&account)) + >::get_code(&account) + .or_else(|| >::get_code(&account)) + .or_else(|| >::get_code(&account)) } - fn adminlist(collection: CollectionId) -> Vec { + fn adminlist(collection: CollectionId) -> Vec { >::adminlist(collection) } - fn allowlist(collection: CollectionId) -> Vec { + fn allowlist(collection: CollectionId) -> Vec { >::allowlist(collection) } fn last_token_id(collection: CollectionId) -> TokenId {