Erc721

Trait Erc721 

Source
pub trait Erc721 {
    // Required methods
    fn balance_of(&self, owner: &Address) -> U256;
    fn owner_of(&self, token_id: &U256) -> Address;
    fn safe_transfer_from(
        &mut self,
        from: &Address,
        to: &Address,
        token_id: &U256,
    );
    fn safe_transfer_from_with_data(
        &mut self,
        from: &Address,
        to: &Address,
        token_id: &U256,
        data: &Bytes,
    );
    fn transfer_from(&mut self, from: &Address, to: &Address, token_id: &U256);
    fn approve(&mut self, approved: &Option<Address>, token_id: &U256);
    fn set_approval_for_all(&mut self, operator: &Address, approved: bool);
    fn get_approved(&self, token_id: &U256) -> Option<Address>;
    fn is_approved_for_all(&self, owner: &Address, operator: &Address) -> bool;
}
Expand description

The ERC-721 interface as defined in the standard.

Required Methods§

Source

fn balance_of(&self, owner: &Address) -> U256

Returns the amount of tokens owned by owner.

Source

fn owner_of(&self, token_id: &U256) -> Address

Returns the owner of the token_id token.

Reverts if token_id does not exist.

Source

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.

Emits a Transfer event.

Source

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.

Emits a Transfer event.

Source

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)

Grants permission to approved to transfer token_id token. The approval is cleared when the token is transferred.

Only a single account can be approved at a time, so approving None clears the previous approval.

Source

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.

The operator cannot be the caller.

Emits a ApprovalForAll event.

Source

fn get_approved(&self, token_id: &U256) -> Option<Address>

Returns the address approved for token_id token.

Reverts if token_id does not exist.

Source

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.

Implementors§