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>The token balances.
owners: Mapping<U256, Option<Address>>The token owners.
token_approvals: Mapping<U256, Option<Address>>The token approvals.
operator_approvals: Mapping<(Address, Address), bool>The operator approvals.
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 transfer(&mut self, from: &Address, to: &Address, token_id: &U256)
pub fn transfer(&mut self, from: &Address, to: &Address, token_id: &U256)
Transfers the token_id token from from to to.
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 moreSource§fn transfer_from(&mut self, from: &Address, to: &Address, token_id: &U256)
fn transfer_from(&mut self, from: &Address, to: &Address, token_id: &U256)
Transfers a specific NFT
tokenId from one account from to another to.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§impl HasEvents for Erc721Base
impl HasEvents for Erc721Base
Source§impl Module for Erc721Base
impl Module for Erc721Base
Source§fn new(env: Rc<ContractEnv>) -> Self
fn new(env: Rc<ContractEnv>) -> Self
Creates a new instance of the module with the given contract environment.
Source§fn env(&self) -> Rc<ContractEnv>
fn env(&self) -> Rc<ContractEnv>
Returns the contract environment associated with the module.
Source§impl SchemaErrors for Erc721Base
impl SchemaErrors for Erc721Base
Source§impl SchemaEvents for Erc721Base
impl SchemaEvents for Erc721Base
Source§fn custom_types() -> Vec<Option<CustomType>>
fn custom_types() -> Vec<Option<CustomType>>
Returns a vector of CustomTypes. Read more
Auto Trait Implementations§
impl Freeze for Erc721Base
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more