InternalTrait
Fully qualified path: openzeppelin_token::erc20::erc20::ERC20Component::InternalTrait
pub trait InternalTrait<
TContractState, +HasComponent<TContractState>, impl Hooks: ERC20HooksTrait<TContractState>,
>
Trait functions
initializer
Initializes the contract by setting the token name and symbol. To prevent reinitialization, this should only be used inside of a contract’s constructor.
Fully qualified path: openzeppelin_token::erc20::erc20::ERC20Component::InternalTrait::initializer
fn initializer(ref self: ComponentState<TContractState>, name: ByteArray, symbol: ByteArray)
mint
Creates a value amount of tokens and assigns them to account.
Requirements:
recipientis not the zero address.
Emits a Transfer event with from set to the zero address.
Fully qualified path: openzeppelin_token::erc20::erc20::ERC20Component::InternalTrait::mint
fn mint(ref self: ComponentState<TContractState>, recipient: ContractAddress, amount: u256)
burn
Destroys amount of tokens from account.
Requirements:
accountis not the zero address.accountmust have at least a balance ofamount.
Emits a Transfer event with to set to the zero address.
Fully qualified path: openzeppelin_token::erc20::erc20::ERC20Component::InternalTrait::burn
fn burn(ref self: ComponentState<TContractState>, account: ContractAddress, amount: u256)
update
Transfers an amount of tokens from from to to, or alternatively mints (or burns)
if from (or to) is the zero address.
NOTE: This function can be extended using the ERC20HooksTrait, to add
functionality before and/or after the transfer, mint, or burn.
Emits a Transfer event.
Fully qualified path: openzeppelin_token::erc20::erc20::ERC20Component::InternalTrait::update
fn update(
ref self: ComponentState<TContractState>,
from: ContractAddress,
to: ContractAddress,
amount: u256,
)
_transfer
Internal method that moves an amount of tokens from from to to.
Requirements:
senderis not the zero address.sendermust have at least a balance ofamount.recipientis not the zero address.
Emits a Transfer event.
Fully qualified path: openzeppelin_token::erc20::erc20::ERC20Component::InternalTrait::_transfer
fn _transfer(
ref self: ComponentState<TContractState>,
sender: ContractAddress,
recipient: ContractAddress,
amount: u256,
)
_approve
Internal method that sets amount as the allowance of spender over the
owners tokens.
Requirements:
owneris not the zero address.spenderis not the zero address.
Emits an Approval event.
Fully qualified path: openzeppelin_token::erc20::erc20::ERC20Component::InternalTrait::_approve
fn _approve(
ref self: ComponentState<TContractState>,
owner: ContractAddress,
spender: ContractAddress,
amount: u256,
)
_spend_allowance
Updates owners allowance for spender based on spent amount.
Does not update the allowance value in case of infinite allowance.
Requirements:
spendermust have at least an allowance ofamountfromowner.
Possibly emits an Approval event.
Fully qualified path: openzeppelin_token::erc20::erc20::ERC20Component::InternalTrait::_spend_allowance
fn _spend_allowance(
ref self: ComponentState<TContractState>,
owner: ContractAddress,
spender: ContractAddress,
amount: u256,
)