Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

InternalTrait

Fully qualified path: openzeppelin_token::common::erc2981::erc2981::ERC2981Component::InternalTrait

pub trait InternalTrait<
    TContractState,
    +HasComponent<TContractState>,
    impl Immutable: ImmutableConfig,
    impl SRC5: HasComponent<TContractState>,
    +Drop<TContractState>,
>

Trait functions

initializer

Initializes the contract by setting the default royalty.

Requirements:

  • default_receiver cannot be the zero address.
  • default_royalty_fraction cannot be greater than the fee denominator.
  • The fee denominator must be greater than 0.

NOTE: The fee denominator is set by the contract using the Immutable Component Config.

Fully qualified path: openzeppelin_token::common::erc2981::erc2981::ERC2981Component::InternalTrait::initializer

fn initializer(
    ref self: ComponentState<TContractState>,
    default_receiver: ContractAddress,
    default_royalty_fraction: u128,
)

_default_royalty

Returns the royalty information that all ids in this contract will default to.

The returned tuple contains:

  • t.0: The receiver of the royalty payment.
  • t.1: The numerator of the royalty fraction.
  • t.2: The denominator of the royalty fraction.

Fully qualified path: openzeppelin_token::common::erc2981::erc2981::ERC2981Component::InternalTrait::_default_royalty

fn _default_royalty(self: @ComponentState<TContractState>) -> (ContractAddress, u128, u128)

_set_default_royalty

Sets the royalty information that all ids in this contract will default to.

Requirements:

  • receiver cannot be the zero address.
  • fee_numerator cannot be greater than the fee denominator.

Fully qualified path: openzeppelin_token::common::erc2981::erc2981::ERC2981Component::InternalTrait::_set_default_royalty

fn _set_default_royalty(
    ref self: ComponentState<TContractState>, receiver: ContractAddress, fee_numerator: u128,
)

_delete_default_royalty

Sets the default royalty percentage and receiver to zero.

Fully qualified path: openzeppelin_token::common::erc2981::erc2981::ERC2981Component::InternalTrait::_delete_default_royalty

fn _delete_default_royalty(ref self: ComponentState<TContractState>)

_token_royalty

Returns the royalty information specific to a token. If no specific royalty information is set for the token, the default is returned.

The returned tuple contains:

  • t.0: The receiver of the royalty payment.
  • t.1: The numerator of the royalty fraction.
  • t.2: The denominator of the royalty fraction.

Fully qualified path: openzeppelin_token::common::erc2981::erc2981::ERC2981Component::InternalTrait::_token_royalty

fn _token_royalty(
    self: @ComponentState<TContractState>, token_id: u256,
) -> (ContractAddress, u128, u128)

_set_token_royalty

Sets the royalty information for a specific token id that takes precedence over the global default.

Requirements:

  • receiver cannot be the zero address.
  • fee_numerator cannot be greater than the fee denominator.

Fully qualified path: openzeppelin_token::common::erc2981::erc2981::ERC2981Component::InternalTrait::_set_token_royalty

fn _set_token_royalty(
    ref self: ComponentState<TContractState>,
    token_id: u256,
    receiver: ContractAddress,
    fee_numerator: u128,
)

_reset_token_royalty

Resets royalty information for the token id back to unset.

Fully qualified path: openzeppelin_token::common::erc2981::erc2981::ERC2981Component::InternalTrait::_reset_token_royalty

fn _reset_token_royalty(ref self: ComponentState<TContractState>, token_id: u256)