Skip to content

Solidity API

SpanningERC20Container

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_

constructor

constructor(string nameIn, string symbolIn, address delegate) internal

Creates the instance and assigns required values.

NameTypeDescription
nameInstring- Desired name for the token
symbolInstring- Desired symbol for the token
delegateaddress- Legacy (local) address for the Spanning Delegate

name

function name() public view virtual returns (string)
NameTypeDescription
[0]stringstring - Name of the token.

symbol

function symbol() public view virtual returns (string)
NameTypeDescription
[0]stringstring - 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).

NameTypeDescription
[0]uint8uint8 - Number of decimals used to get a user representation.

totalSupply

function totalSupply() public view virtual returns (uint256)
NameTypeDescription
[0]uint256string - Total supply of the token.

balanceOf

function balanceOf(address accountLegacyAddress) public view virtual returns (uint256)

Returns the amount of tokens owned by an account.

NameTypeDescription
accountLegacyAddressaddress- Legacy (local) address to be queried
NameTypeDescription
[0]uint256uint256 - Token value for an account

balanceOf

function balanceOf(bytes32 account) public view virtual returns (uint256)

Returns the amount of tokens owned by an account.

NameTypeDescription
accountbytes32- Address to be queried
NameTypeDescription
[0]uint256uint256 - 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.

NameTypeDescription
receiverLegacyAddressaddress- Legacy (local) address to receive the transfer
amountuint256- Amount to transfer
NameTypeDescription
[0]boolbool - 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.

NameTypeDescription
receiverAddressbytes32- Address to receive the transfer
amountuint256- Amount to transfer
NameTypeDescription
[0]boolbool - 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_

NameTypeDescription
senderLegacyAddressaddress- Legacy (local) address of the allowance sender
receiverLegacyAddressaddress- Legacy (local) address of the allowance receiver
NameTypeDescription
[0]uint256uint256 - 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_

NameTypeDescription
senderAddressbytes32- Address of the allowance sender
receiverAddressbytes32- Address of the allowance receiver
NameTypeDescription
[0]uint256uint256 - 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_

NameTypeDescription
receiverLegacyAddressaddress- Legacy (local) address of the allowance receiver
amountuint256- Amount of allowance to issue
NameTypeDescription
[0]boolbool - 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_

NameTypeDescription
receiverAddressbytes32- Address of the allowance receiver
amountuint256- Amount of allowance to issue
NameTypeDescription
[0]boolbool - 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._

NameTypeDescription
senderLegacyAddressaddress- Legacy (local) address of the allowance sender
receiverLegacyAddressaddress- Legacy (local) address of the allowance receiver
amountuint256- Amount of allowance to issue
NameTypeDescription
[0]boolbool - 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._

NameTypeDescription
senderAddressbytes32- Address of the allowance sender
receiverAddressbytes32- Address of the allowance receiver
amountuint256- Amount of allowance to issue
NameTypeDescription
[0]boolbool - 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_

NameTypeDescription
[0]boolbool - 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}._

NameTypeDescription
receiverLegacyAddressaddress- Legacy (local) address of the allowance receiver
addedValueuint256
NameTypeDescription
[0]boolbool - 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}._

NameTypeDescription
receiverAddressbytes32- Address of the allowance receiver
addedValueuint256
NameTypeDescription
[0]boolbool - 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}._

NameTypeDescription
receiverLegacyAddressaddress- Legacy (local) address of the allowance receiver
subtractedValueuint256
NameTypeDescription
[0]boolbool - 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}._

NameTypeDescription
receiverAddressbytes32- Address of the allowance receiver
subtractedValueuint256
NameTypeDescription
[0]boolbool - 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.

NameTypeDescription
senderAddressbytes32- Address initiating the transfer
receiverAddressbytes32- Address receiving the transfer
amountuint256- Amount to transfer

_mint

function _mint(bytes32 receiverAddress, uint256 amount) internal virtual

Creates tokens and assigns ownership.

NameTypeDescription
receiverAddressbytes32- Address receiving the minted tokens
amountuint256- Amount to mint

_burn

function _burn(bytes32 senderAddress, uint256 amount) internal virtual

Destroys tokens and lowering total supply.

NameTypeDescription
senderAddressbytes32- Address sending tokens to burn
amountuint256- Amount to burn

_approve

function _approve(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Sets allowance pair between two addresses

NameTypeDescription
senderAddressbytes32- Address of the allowance sender
receiverAddressbytes32- Address of the allowance receiver
amountuint256- 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.

NameTypeDescription
senderAddressbytes32- Address initiating the transfer
receiverAddressbytes32- Address receiving the transfer
amountuint256- Amount to transfer

_duringTokenTransfer

function _duringTokenTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called during any transfer of tokens.

NameTypeDescription
senderAddressbytes32- Address initiating the transfer
receiverAddressbytes32- Address receiving the transfer
amountuint256- Amount to transfer

_afterTokenTransfer

function _afterTokenTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called after any transfer of tokens.

NameTypeDescription
senderAddressbytes32- Address initiating the transfer
receiverAddressbytes32- Address receiving the transfer
amountuint256- Amount to transfer

_beforeTokenBurn

function _beforeTokenBurn(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called before any burn of tokens.

NameTypeDescription
senderAddressbytes32- Address sending tokens to burn
receiverAddressbytes32- Unused
amountuint256- Amount to burn

_duringTokenBurn

function _duringTokenBurn(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called during any burn of tokens.

NameTypeDescription
senderAddressbytes32- Address sending tokens to burn
receiverAddressbytes32- Unused
amountuint256- Amount to burn

_afterTokenBurn

function _afterTokenBurn(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called after any burn of tokens.

NameTypeDescription
senderAddressbytes32- Address sending tokens to burn
receiverAddressbytes32- Unused
amountuint256- Amount to burn

_beforeTokenMint

function _beforeTokenMint(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called before any mint of tokens.

NameTypeDescription
senderAddressbytes32- Unused
receiverAddressbytes32- Address receiving the minted tokens
amountuint256- Amount to mint

_duringTokenMint

function _duringTokenMint(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called during any mint of tokens.

NameTypeDescription
senderAddressbytes32- Unused
receiverAddressbytes32- Address receiving the minted tokens
amountuint256- Amount to mint

_afterTokenMint

function _afterTokenMint(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called after any mint of tokens.

NameTypeDescription
senderAddressbytes32- Unused
receiverAddressbytes32- Address receiving the minted tokens
amountuint256- Amount to mint

_beforeTokenApprove

function _beforeTokenApprove(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called before any allowance approval of tokens.

NameTypeDescription
senderAddressbytes32- Address of the allowance sender
receiverAddressbytes32- Address of the allowance receiver
amountuint256- Amount to approve

_duringTokenApprove

function _duringTokenApprove(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called during any allowance approval of tokens.

NameTypeDescription
senderAddressbytes32- Address of the allowance sender
receiverAddressbytes32- Address of the allowance receiver
amountuint256- Amount to approve

_afterTokenApprove

function _afterTokenApprove(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) internal virtual

Hook that is called after any allowance approval of tokens.

NameTypeDescription
senderAddressbytes32- Address of the allowance sender
receiverAddressbytes32- Address of the allowance receiver
amountuint256- 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._

NameTypeDescription
senderAddressbytes32- Address initiating the transfer
receiverAddressbytes32- Address receiving the transfer
amountuint256- 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._

NameTypeDescription
senderAddressbytes32- Address of the allowance sender
receiverAddressbytes32- Address of the allowance receiver
amountuint256- Amount to transfer