Solidity API
SpanningERC20ContainerUpgradeable
Implementation of the {ISpanningERC20} interface.
balances_
mapping(bytes32 => uint256) balances_
allowances_
mapping(bytes32 => mapping(bytes32 => uint256)) allowances_
totalSupply_
uint256 totalSupply_
name_
string name_
symbol_
string symbol_
__SpanningERC20Container_init
function __SpanningERC20Container_init(string nameIn, string symbolIn, address delegate) internal
Creates the instance and assigns required values.
Name | Type | Description |
---|---|---|
nameIn | string | - Desired name for the token |
symbolIn | string | - Desired symbol for the token |
delegate | address | - Legacy (local) address for the Spanning Delegate |
__SpanningERC20Container_init_unchained
function __SpanningERC20Container_init_unchained(string nameIn, string symbolIn, address delegate) internal
name
function name() public view virtual returns (string)
Name | Type | Description |
---|---|---|
[0] | string | string - Name of the token. |
symbol
function symbol() public view virtual returns (string)
Name | Type | Description |
---|---|---|
[0] | string | string - Symbol of the token. |
decimals
function decimals() public view virtual returns (uint8)
Returns the number of decimals used to get its user representation. For example, if decimals
equals 2
, a balance of 505
tokens should be displayed to a user as 5.05
(505 / 10 ** 2
).
Name | Type | Description |
---|---|---|
[0] | uint8 | uint8 - Number of decimals used to get a user representation. |
totalSupply
function totalSupply() public view virtual returns (uint256)
Name | Type | Description |
---|---|---|
[0] | uint256 | string - Total supply of the token. |
balanceOf
function balanceOf(address accountLegacyAddress) public view virtual returns (uint256)
Returns the amount of tokens owned by an account.
Name | Type | Description |
---|---|---|
accountLegacyAddress | address | - Legacy (local) address to be queried |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 - Token value for an account |
balanceOf
function balanceOf(bytes32 account) public view virtual returns (uint256)
Returns the amount of tokens owned by an account.
Name | Type | Description |
---|---|---|
account | bytes32 | - Address to be queried |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 - Token value for an account |
transfer
function transfer(address receiverLegacyAddress, uint256 amount) public virtual returns (bool)
Moves tokens from the caller's account to another account.
Name | Type | Description |
---|---|---|
receiverLegacyAddress | address | - Legacy (local) address to receive the transfer |
amount | uint256 | - Amount to transfer |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
transfer
function transfer(bytes32 receiverAddress, uint256 amount) public virtual returns (bool)
Moves tokens from the caller's account to another account.
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address to receive the transfer |
amount | uint256 | - Amount to transfer |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
allowance
function allowance(address senderLegacyAddress, address receiverLegacyAddress) public view virtual returns (uint256)
_Gets the number of authorized tokens in the allowance pair.
Note: This value can change when {approve} or {transferFrom} are called Note: The result is zero when an entry does not exist in the map_
Name | Type | Description |
---|---|---|
senderLegacyAddress | address | - Legacy (local) address of the allowance sender |
receiverLegacyAddress | address | - Legacy (local) address of the allowance receiver |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 - Number of tokens in the allowance pair |
allowance
function allowance(bytes32 senderAddress, bytes32 receiverAddress) public view virtual returns (uint256)
_Gets the number of authorized tokens in the allowance pair.
Note: This value can change when {approve} or {transferFrom} are called Note: The result is zero when an entry does not exist in the map_
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the allowance sender |
receiverAddress | bytes32 | - Address of the allowance receiver |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 - Number of tokens in the allowance pair |
approve
function approve(address receiverLegacyAddress, uint256 amount) public virtual returns (bool)
_Sets an allowance for a pair of addresses (sender and receiver).
Note: There can be race conditions due to ordering. See more: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729_
Name | Type | Description |
---|---|---|
receiverLegacyAddress | address | - Legacy (local) address of the allowance receiver |
amount | uint256 | - Amount of allowance to issue |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
approve
function approve(bytes32 receiverAddress, uint256 amount) public virtual returns (bool)
_Sets an allowance for a pair of addresses (sender and receiver).
Note: There can be race conditions due to ordering. See more: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729_
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the allowance receiver |
amount | uint256 | - Amount of allowance to issue |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
transferFrom
function transferFrom(address senderLegacyAddress, address receiverLegacyAddress, uint256 amount) public virtual returns (bool)
_Transfers tokens from from sender to receiver.
Note: This uses the allowance mechanism to transfer tokens._
Name | Type | Description |
---|---|---|
senderLegacyAddress | address | - Legacy (local) address of the allowance sender |
receiverLegacyAddress | address | - Legacy (local) address of the allowance receiver |
amount | uint256 | - Amount of allowance to issue |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
transferFrom
function transferFrom(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) public virtual returns (bool)
_Transfers tokens from from sender to receiver.
Note: This uses the allowance mechanism to transfer tokens._
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the allowance sender |
receiverAddress | bytes32 | - Address of the allowance receiver |
amount | uint256 | - Amount of allowance to issue |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
updateRecords
function updateRecords() public virtual returns (bool)
_Pulls read-only information relevant to the domain ownership from the appropriate middleware node or domain
Note: This function should be called prior to reading any information through this domain, to ensure data is up to date_
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
increaseAllowance
function increaseAllowance(address receiverLegacyAddress, uint256 addedValue) public virtual returns (bool)
_Atomically increases the allowance
This is an alternative to {approve} that can be used as a mitigation for problems described in {ISpanningERC20-approve}._
Name | Type | Description |
---|---|---|
receiverLegacyAddress | address | - Legacy (local) address of the allowance receiver |
addedValue | uint256 |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
increaseAllowance
function increaseAllowance(bytes32 receiverAddress, uint256 addedValue) public virtual returns (bool)
_Atomically increases the allowance
This is an alternative to {approve} that can be used as a mitigation for problems described in {ISpanningERC20-approve}._
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the allowance receiver |
addedValue | uint256 |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
decreaseAllowance
function decreaseAllowance(address receiverLegacyAddress, uint256 subtractedValue) public virtual returns (bool)
_Atomically decreases the allowance
This is an alternative to {approve} that can be used as a mitigation for problems described in {ISpanningERC20-approve}._
Name | Type | Description |
---|---|---|
receiverLegacyAddress | address | - Legacy (local) address of the allowance receiver |
subtractedValue | uint256 |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
decreaseAllowance
function decreaseAllowance(bytes32 receiverAddress, uint256 subtractedValue) public virtual returns (bool)
_Atomically decreases the allowance
This is an alternative to {approve} that can be used as a mitigation for problems described in {ISpanningERC20-approve}._
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address of the allowance receiver |
subtractedValue | uint256 |
Name | Type | Description |
---|---|---|
[0] | bool | bool - Indicates whether the operation succeeded |
_transfer
function _transfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Moves tokens from the caller's account to another account.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address initiating the transfer |
receiverAddress | bytes32 | - Address receiving the transfer |
amount | uint256 | - Amount to transfer |
_mint
function _mint(bytes32 receiverAddress, uint256 amount) internal virtual
Creates tokens and assigns ownership.
Name | Type | Description |
---|---|---|
receiverAddress | bytes32 | - Address receiving the minted tokens |
amount | uint256 | - Amount to mint |
_burn
function _burn(bytes32 senderAddress, uint256 amount) internal virtual
Destroys tokens and lowering total supply.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address sending tokens to burn |
amount | uint256 | - Amount to burn |
_approve
function _approve(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Sets allowance pair between two addresses
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the allowance sender |
receiverAddress | bytes32 | - Address of the allowance receiver |
amount | uint256 | - Amount to approve |
_spendAllowance
function _spendAllowance(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
_Updates senderAddress
s allowance for spender
based on spent amount
.
Does not update the allowance amount in case of infinite allowance. Revert if not enough allowance is available.
Might emit an {Approval} event._
_beforeTokenTransfer
function _beforeTokenTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called before any transfer of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address initiating the transfer |
receiverAddress | bytes32 | - Address receiving the transfer |
amount | uint256 | - Amount to transfer |
_duringTokenTransfer
function _duringTokenTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called during any transfer of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address initiating the transfer |
receiverAddress | bytes32 | - Address receiving the transfer |
amount | uint256 | - Amount to transfer |
_afterTokenTransfer
function _afterTokenTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called after any transfer of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address initiating the transfer |
receiverAddress | bytes32 | - Address receiving the transfer |
amount | uint256 | - Amount to transfer |
_beforeTokenBurn
function _beforeTokenBurn(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called before any burn of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address sending tokens to burn |
receiverAddress | bytes32 | - Unused |
amount | uint256 | - Amount to burn |
_duringTokenBurn
function _duringTokenBurn(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called during any burn of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address sending tokens to burn |
receiverAddress | bytes32 | - Unused |
amount | uint256 | - Amount to burn |
_afterTokenBurn
function _afterTokenBurn(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called after any burn of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address sending tokens to burn |
receiverAddress | bytes32 | - Unused |
amount | uint256 | - Amount to burn |
_beforeTokenMint
function _beforeTokenMint(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called before any mint of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Unused |
receiverAddress | bytes32 | - Address receiving the minted tokens |
amount | uint256 | - Amount to mint |
_duringTokenMint
function _duringTokenMint(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called during any mint of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Unused |
receiverAddress | bytes32 | - Address receiving the minted tokens |
amount | uint256 | - Amount to mint |
_afterTokenMint
function _afterTokenMint(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called after any mint of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Unused |
receiverAddress | bytes32 | - Address receiving the minted tokens |
amount | uint256 | - Amount to mint |
_beforeTokenApprove
function _beforeTokenApprove(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called before any allowance approval of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the allowance sender |
receiverAddress | bytes32 | - Address of the allowance receiver |
amount | uint256 | - Amount to approve |
_duringTokenApprove
function _duringTokenApprove(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called during any allowance approval of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the allowance sender |
receiverAddress | bytes32 | - Address of the allowance receiver |
amount | uint256 | - Amount to approve |
_afterTokenApprove
function _afterTokenApprove(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
Hook that is called after any allowance approval of tokens.
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the allowance sender |
receiverAddress | bytes32 | - Address of the allowance receiver |
amount | uint256 | - Amount to approve |
_emitTransfer
function _emitTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
_Emits both a Legacy Transfer event and Spanning Transfer event.
Note: If an input Address is not domain-local, the Legacy Transfer event field is set to 0. This avoids sending incorrect truncated data._
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address initiating the transfer |
receiverAddress | bytes32 | - Address receiving the transfer |
amount | uint256 | - Amount transferred |
_emitApproval
function _emitApproval(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual
_Emits both a Legacy Approval event and Spanning Approval event.
Note: If an input Address is not domain-local, the Legacy Approval event field is set to 0. This avoids sending incorrect truncated data._
Name | Type | Description |
---|---|---|
senderAddress | bytes32 | - Address of the allowance sender |
receiverAddress | bytes32 | - Address of the allowance receiver |
amount | uint256 | - Amount to transfer |
__gap
uint256[45] __gap
This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps We use a standard of 50 storage slots. The amount referenced below is based on: 50 - numberOfClassMemberVariables.