Skip to content

Solidity API

ISpanningERC20

Interface of ERC20 in the Spanning Protocol

balanceOf

function balanceOf(bytes32 account) external view 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(bytes32 receiverAddress, uint256 amount) external 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(bytes32 senderAddress, bytes32 receiverAddress) external view 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(bytes32 receiverAddress, uint256 amount) external 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(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount) external 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() external 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

Events

Transfer

event Transfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount)

Emitted tokens are transferred. Note that amount may be zero.

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

Approval

event Approval(bytes32 senderAddress, bytes32 receiverAddress, uint256 amount)

Emitted when an allowance pair changes.

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