// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: Copyright (C) 2022 Spanning Labs Inc.
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @dev Interface of ERC20 in the Spanning Protocol
*/
interface ISpanningERC20 is IERC20 {
/**
* @dev Returns the amount of tokens owned by an account.
*
* @param account - Address to be queried
*
* @return uint256 - Token value for an account
*/
function balanceOf(bytes32 account) external view returns (uint256);
/**
* @dev Moves tokens from the caller's account to another account.
*
* @param receiverAddress - Address to receive the transfer
* @param amount - Amount to transfer
*
* @return bool - Indicates whether the operation succeeded
*/
function transfer(bytes32 receiverAddress, uint256 amount)
external
returns (bool);
/**
* @dev 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
*
* @param senderAddress - Address of the allowance sender
* @param receiverAddress - Address of the allowance receiver
*
* @return uint256 - Number of tokens in the allowance pair
*/
function allowance(bytes32 senderAddress, bytes32 receiverAddress)
external
view
returns (uint256);
/**
* @dev 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
*
* @param receiverAddress - Address of the allowance receiver
* @param amount - Amount of allowance to issue
*
* @return bool - Indicates whether the operation succeeded
*/
function approve(bytes32 receiverAddress, uint256 amount)
external
returns (bool);
/**
* @dev Transfers tokens from from sender to receiver.
*
* Note: This uses the allowance mechanism to transfer tokens.
*
* @param senderAddress - Address of the allowance sender
* @param receiverAddress - Address of the allowance receiver
* @param amount - Amount of allowance to issue
* @return bool - Indicates whether the operation succeeded
*/
function transferFrom(
bytes32 senderAddress,
bytes32 receiverAddress,
uint256 amount
) external returns (bool);
/**
* @dev 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
*
* @return bool - Indicates whether the operation succeeded
*/
function updateRecords() external returns (bool);
/**
* @dev Emitted tokens are transferred
*
* Note that `amount` may be zero.
*
* @param senderAddress - Address initiating the transfer
* @param receiverAddress - Address receiving the transfer
* @param amount - Amount to transfer
*/
event Transfer(
bytes32 indexed senderAddress,
bytes32 indexed receiverAddress,
uint256 amount
);
/**
* @dev Emitted when an allowance pair changes.
*
* @param senderAddress - Address of the allowance sender
* @param receiverAddress - Address of the allowance receiver
* @param amount - Amount to approve
*/
event Approval(
bytes32 indexed senderAddress,
bytes32 indexed receiverAddress,
uint256 amount
);
}
|