Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions modules/nft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use frame_support::{
transactional, PalletId,
};
use frame_system::pallet_prelude::*;
use orml_traits::NFT;
use orml_traits::InspectExtended;
use primitives::{
nft::{Attributes, ClassProperty, NFTBalance, Properties, CID},
ReserveIdentifier,
Expand Down Expand Up @@ -506,16 +506,14 @@ impl<T: Config> Pallet<T> {
}
}

impl<T: Config> NFT<T::AccountId> for Pallet<T> {
type ClassId = ClassIdOf<T>;
type TokenId = TokenIdOf<T>;
impl<T: Config> InspectExtended<T::AccountId> for Pallet<T> {
type Balance = NFTBalance;

fn balance(who: &T::AccountId) -> Self::Balance {
orml_nft::TokensByOwner::<T>::iter_prefix((who,)).count() as u128
}

fn next_token_id(class: Self::ClassId) -> Self::TokenId {
fn next_token_id(class: Self::ClassId) -> Self::InstanceId {
orml_nft::Pallet::<T>::next_token_id(class)
}
}
Expand Down
2 changes: 1 addition & 1 deletion orml
Submodule orml updated 2 files
+1 −1 traits/src/lib.rs
+4 −10 traits/src/nft.rs
4 changes: 2 additions & 2 deletions runtime/common/src/precompile/nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use sp_core::H160;
use sp_runtime::RuntimeDebug;
use sp_std::{borrow::Cow, marker::PhantomData, prelude::*, result};

use orml_traits::NFT as NFTT;
use orml_traits::InspectExtended;

use super::input::{Input, InputT, Output};
use num_enum::{IntoPrimitive, TryFromPrimitive};
Expand Down Expand Up @@ -55,7 +55,7 @@ pub enum Action {
impl<Runtime> Precompile for NFTPrecompile<Runtime>
where
Runtime: module_evm::Config + module_prices::Config + module_nft::Config,
module_nft::Pallet<Runtime>: NFTT<Runtime::AccountId, Balance = NFTBalance, ClassId = u32, TokenId = u64>
module_nft::Pallet<Runtime>: InspectExtended<Runtime::AccountId, Balance = NFTBalance>
+ Inspect<Runtime::AccountId, InstanceId = u64, ClassId = u32>
+ Transfer<Runtime::AccountId>,
{
Expand Down