Struct odra_modules::erc721::erc721_base::Erc721Base
source · pub struct Erc721Base {
pub balances: Mapping<Address, U256>,
pub owners: Mapping<U256, Option<Address>>,
pub token_approvals: Mapping<U256, Option<Address>>,
pub operator_approvals: Mapping<(Address, Address), bool>,
/* private fields */
}Expand description
The ERC721 base implementation.
Fields§
§balances: Mapping<Address, U256>§owners: Mapping<U256, Option<Address>>§token_approvals: Mapping<U256, Option<Address>>§operator_approvals: Mapping<(Address, Address), bool>Implementations§
source§impl Erc721Base
impl Erc721Base
sourcepub fn is_approved_or_owner(&self, spender: &Address, token_id: &U256) -> bool
pub fn is_approved_or_owner(&self, spender: &Address, token_id: &U256) -> bool
Returns true if the spender is the owner or an operator of the token_id token.
sourcepub fn clear_approval(&mut self, token_id: &U256)
pub fn clear_approval(&mut self, token_id: &U256)
Revokes permission to transfer the token_id token.
sourcepub fn assert_exists(&self, token_id: &U256)
pub fn assert_exists(&self, token_id: &U256)
Reverts with [Error::InvalidTokenId] if the token_id token does not exist.
Trait Implementations§
source§impl Erc721 for Erc721Base
impl Erc721 for Erc721Base
source§fn balance_of(&self, owner: &Address) -> U256
fn balance_of(&self, owner: &Address) -> U256
Returns the amount of tokens owned by
owner.source§fn safe_transfer_from(&mut self, from: &Address, to: &Address, token_id: &U256)
fn safe_transfer_from(&mut self, from: &Address, to: &Address, token_id: &U256)
Safely transfers
token_id token from from to to, checking the recipient contract uses
Erc721Receiver. Read moresource§fn safe_transfer_from_with_data(
&mut self,
from: &Address,
to: &Address,
token_id: &U256,
data: &Bytes
)
fn safe_transfer_from_with_data( &mut self, from: &Address, to: &Address, token_id: &U256, data: &Bytes )
Safely transfers
token_id token from from to to, checking the recipient contract uses
Erc721Receiver, passes additional data. Read morefn transfer_from(&mut self, from: &Address, to: &Address, token_id: &U256)
source§fn approve(&mut self, approved: &Option<Address>, token_id: &U256)
fn approve(&mut self, approved: &Option<Address>, token_id: &U256)
Grants permission to
approved to transfer token_id token. The approval is cleared when the token is transferred. Read moresource§fn set_approval_for_all(&mut self, operator: &Address, approved: bool)
fn set_approval_for_all(&mut self, operator: &Address, approved: bool)
Approves or removes operator for the caller. Operators can call
transfer_from or safe_transfer_from for all
tokens owned by the caller. Read moresource§fn get_approved(&self, token_id: &U256) -> Option<Address>
fn get_approved(&self, token_id: &U256) -> Option<Address>
Returns the address approved for
token_id token. Read moresource§fn is_approved_for_all(&self, owner: &Address, operator: &Address) -> bool
fn is_approved_for_all(&self, owner: &Address, operator: &Address) -> bool
Returns if the
operator is allowed to manage all of the tokens of owner.Auto Trait Implementations§
impl !RefUnwindSafe for Erc721Base
impl !Send for Erc721Base
impl !Sync for Erc721Base
impl Unpin for Erc721Base
impl !UnwindSafe for Erc721Base
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.§impl<T> Pipe for T
impl<T> Pipe for T
§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
§impl<T> PipeDeref for T
impl<T> PipeDeref for T
§impl<T> PipeRef for T
impl<T> PipeRef for T
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Pipes a reference into a function that cannot ordinarily be called in
suffix position. Read more
§fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Pipes a mutable reference into a function that cannot ordinarily be
called in suffix position. Read more
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_dbg<F, R>(self, func: F) -> Self
fn tap_dbg<F, R>(self, func: F) -> Self
Calls
tap in debug builds, and does nothing in release builds.§fn tap_mut_dbg<F, R>(self, func: F) -> Self
fn tap_mut_dbg<F, R>(self, func: F) -> Self
Calls
tap_mut in debug builds, and does nothing in release builds.§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
§fn tap_ref_dbg<F, R>(self, func: F) -> Self
fn tap_ref_dbg<F, R>(self, func: F) -> Self
Calls
tap_ref in debug builds, and does nothing in release builds.§fn tap_ref_mut<F, R>(self, func: F) -> Self
fn tap_ref_mut<F, R>(self, func: F) -> Self
Provides mutable access to the reference for modification.
§fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self
Calls
tap_ref_mut in debug builds, and does nothing in release builds.§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
§fn tap_borrow<F, R>(self, func: F) -> Self
fn tap_borrow<F, R>(self, func: F) -> Self
Provides immutable access to the borrow for inspection. Read more
§fn tap_borrow_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_dbg<F, R>(self, func: F) -> Self
Calls
tap_borrow in debug builds, and does nothing in release builds.§fn tap_borrow_mut<F, R>(self, func: F) -> Self
fn tap_borrow_mut<F, R>(self, func: F) -> Self
Provides mutable access to the borrow for modification.
§fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self
Calls
tap_borrow_mut in debug builds, and does nothing in release
builds.§impl<T> TapDeref for T
impl<T> TapDeref for T
§fn tap_deref_dbg<F, R>(self, func: F) -> Self
fn tap_deref_dbg<F, R>(self, func: F) -> Self
Calls
tap_deref in debug builds, and does nothing in release builds.§fn tap_deref_mut<F, R>(self, func: F) -> Self
fn tap_deref_mut<F, R>(self, func: F) -> Self
Mutably dereferences
self for modification.§fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self
Calls
tap_deref_mut in debug builds, and does nothing in release
builds.