Appearance
Solidity API
ERC20BaseInternal
Implements core internal functions for ERC20 token operations This contract serves as the base for ERC20 implementations, providing internal functions for transfers, approvals, minting, and burning
_totalSupply
solidity
function _totalSupply() internal view virtual returns (uint256)Query the total minted token supply
Returns the current total supply of tokens from storage
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | Total number of tokens in existence |
_balanceOf
solidity
function _balanceOf(address account) internal view virtual returns (uint256)Query the token balance of given account
Returns the current balance of an address from storage
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | Address to query the balance of |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | Number of tokens owned by the account |
_allowance
solidity
function _allowance(address holder, address spender) internal view virtual returns (uint256)Query the allowance granted from given holder to given spender
Returns the number of tokens the spender is allowed to spend on behalf of the holder
Parameters
| Name | Type | Description |
|---|---|---|
| holder | address | Owner of the tokens |
| spender | address | Address authorized to spend tokens |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | Number of tokens the spender is allowed to spend |
_spendAllowance
solidity
function _spendAllowance(address owner, address spender, uint256 value) internal virtual_Updates owner s allowance for spender based on spent value.
Does not update the allowance value in case of infinite allowance. Revert if not enough allowance is available.
Does not emit an {Approval} event._
_approve
solidity
function _approve(address holder, address spender, uint256 amount) internal virtual returns (bool)Enable spender to spend tokens on behalf of holder
Sets or updates the allowance granted to a spender by a holder Emits an Approval event
Parameters
| Name | Type | Description |
|---|---|---|
| holder | address | Address on whose behalf tokens may be spent |
| spender | address | Address authorized to spend tokens |
| amount | uint256 | Number of tokens approved for spending |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | success Always returns true (reverts on failure) |
_decreaseAllowance
solidity
function _decreaseAllowance(address holder, address spender, uint256 amount) internalDecrease spend amount granted by holder to spender
Reduces the allowance granted to a spender by a specified amount Uses unchecked subtraction for gas optimization when amount is valid
Parameters
| Name | Type | Description |
|---|---|---|
| holder | address | Address that granted the allowance |
| spender | address | Address whose allowance will be decreased |
| amount | uint256 | Amount to decrease the allowance by |
_mint
solidity
function _mint(address account, uint256 amount) internal virtualMint tokens for given account
Creates new tokens and assigns them to the specified account Increases total supply and recipient's balance Emits a Transfer event with 'from' set to zero address
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | Recipient of minted tokens |
| amount | uint256 | Quantity of tokens to mint |
_burn
solidity
function _burn(address account, uint256 amount) internal virtualBurn tokens held by given account
Destroys tokens from the specified account Decreases total supply and holder's balance Emits a Transfer event with 'to' set to zero address
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | Address whose tokens will be burned |
| amount | uint256 | Quantity of tokens to burn |
_transfer
solidity
function _transfer(address holder, address recipient, uint256 amount) internal virtual returns (bool)Transfer tokens from holder to recipient
Moves tokens from one address to another Updates balances of both addresses Emits a Transfer event
Parameters
| Name | Type | Description |
|---|---|---|
| holder | address | Owner of tokens to be transferred |
| recipient | address | Beneficiary of transfer |
| amount | uint256 | Quantity of tokens to transfer |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | success Always returns true (reverts on failure) |
_transferFrom
solidity
function _transferFrom(address holder, address recipient, uint256 amount) internal virtual returns (bool)Transfer tokens on behalf of holder using allowance mechanism
_Moves tokens using the allowance mechanism and updates relevant allowance Calls _decreaseAllowance and transfer internally
Parameters
| Name | Type | Description |
|---|---|---|
| holder | address | Address that owns the tokens |
| recipient | address | Beneficiary of transfer |
| amount | uint256 | Quantity of tokens to transfer |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | success Always returns true (reverts on failure) |
_beforeTokenTransfer
solidity
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtualERC20 hook, called before all transfers including mint and burn
Hook that is called before any token transfer, including mints and burns Can be used to add custom logic before transfers Must be overridden by derived contracts that need transfer hooks
Parameters
| Name | Type | Description |
|---|---|---|
| from | address | Address sending tokens (zero address for mints) |
| to | address | Address receiving tokens (zero address for burns) |
| amount | uint256 | Number of tokens being transferred |