// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
/**
* @dev Interface of ERC1155 in the Spanning Protocol
*/
interface ISpanningERC1155 is IERC1155 {
/**
* @dev Emitted when `amount` tokens of token type `id` are transferred from `senderAddress` to `receiverAddress` by `operatorAddress`.
*
* @param operatorAddress - Spanning Address of the operator
* @param senderAddress - Spanning Address to initiate the transfer
* @param receiverAddress - Spanning Address to receive the transfer
* @param id - token type
* @param amount - Amount to transfer
*/
event SpanningTransferSingle(
bytes32 indexed operatorAddress,
bytes32 indexed senderAddress,
bytes32 indexed receiverAddress,
uint256 id,
uint256 amount
);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operatorAddress`, `senderAddress` and `receiverAddress` are the same for all
* transfers.
*
* @param operatorAddress - Spanning Address of the operator
* @param senderAddress - Spanning Address to initiate the transfer
* @param receiverAddress - Spanning Address to receive the transfer
* @param ids - a batch of token type
* @param amounts - a batch of amounts
*/
event SpanningTransferBatch(
bytes32 indexed operatorAddress,
bytes32 indexed senderAddress,
bytes32 indexed receiverAddress,
uint256[] ids,
uint256[] amounts
);
/**
* @dev Emitted when `senderAddress` grants or revokes permission to `receiverAddress` to transfer their tokens, according to
* `approved`.
*
* @param senderAddress - Spanning Address to grants or revokes permission
* @param receiverAddress - Spanning Address to receive permission
* @param approved - grants or revokes permission
*/
event SpanningApprovalForAll(
bytes32 indexed senderAddress,
bytes32 indexed receiverAddress,
bool approved
);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* @param account - Spanning Address to be queried
* @param id - Token type
* @return Token value of token type `id` for an account
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(bytes32 account, uint256 id)
external
view
returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* @param accounts - a batch of Spanning Address to be queried
* @param ids - a batch of Token type
* @return a batch of token value of token type `ids` for a batch of accounts
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(bytes32[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `receiverAddress` to transfer the caller's tokens, according to `approved`,
*
* @param receiverAddress - Spanning Address to receive permission
* @param approved - grants or revokes permission
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `receiverAddress` cannot be the caller.
*/
function setApprovalForAll(bytes32 receiverAddress, bool approved) external;
/**
* @dev Returns true if `receiverAddress` is approved to transfer ``senderAddress``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(bytes32 senderAddress, bytes32 receiverAddress)
external
view
returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `senderAddress` to `receiverAddress`.
*
* Emits a {TransferSingle} event.
*
* @param senderAddress - Spanning Address to initiate the transfer
* @param receiverAddress - Spanning Address to receive the transfer
* @param id - Token type
* @param amount - Amount to transfer
*
* Requirements:
*
* - `receiverAddress` cannot be the zero address.
* - If the caller is not `senderAddress`, it must be have been approved to spend ``senderAddress``'s tokens via {setApprovalForAll}.
* - `senderAddress` must have a balance of tokens of type `id` of at least `amount`.
* - If `receiverAddress` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
bytes32 senderAddress,
bytes32 receiverAddress,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* @param senderAddress - Spanning Address to initiate the transfer
* @param receiverAddress - Spanning Address to receive the transfer
* @param ids - a batch of Token type
* @param amounts - a batch of amounts
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `receiverAddress` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
bytes32 senderAddress,
bytes32 receiverAddress,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
|