mirror of https://github.com/status-im/EIPs.git
Automatically merged updates to draft EIP(s) 1155
Hi, I'm a bot! This change was automatically merged because: - It only modifies existing Draft or Last Call EIP(s) - The PR was approved or written by at least one author of each modified EIP - The build is passing
This commit is contained in:
parent
da151b85c1
commit
3d9075cd80
|
@ -55,17 +55,17 @@ pragma solidity ^0.4.25;
|
|||
*/
|
||||
interface ERC1155 /* is ERC165 */ {
|
||||
/**
|
||||
@dev Either Transfer or TransferBatch MUST emit when tokens are transferred, including zero value transfers as well as minting or burning. This event supports single tokens.
|
||||
A `Transfer` event from address `0x0` signifies a minting operation. The total value transferred from address 0x0 minus the total value transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID
|
||||
A `Transfer` event to address `0x0` signifies a burning or melting operation.
|
||||
@dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero value transfers as well as minting or burning. This event supports single tokens.
|
||||
A `TransferSingle` event from address `0x0` signifies a minting operation. The total value transferred from address 0x0 minus the total value transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID
|
||||
A `TransferSingle` event to address `0x0` signifies a burning or melting operation.
|
||||
This MUST emit a 0 value, from `0x0` to `0x0` with `_operator` assuming the role of the token creator. This can be used to define a token ID with no initial balance at the time of creation.
|
||||
*/
|
||||
event Transfer(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
|
||||
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
|
||||
|
||||
/**
|
||||
@dev Either Transfer or TransferBatch MUST emit when tokens are transferred, including zero value transfers as well as minting or burning. This event supports multiple _ids and _values.
|
||||
A `Transfer` event from address `0x0` signifies a minting operation. The total value transferred from address 0x0 minus the total value transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID
|
||||
A `Transfer` event to address `0x0` signifies a burning or melting operation.
|
||||
@dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero value transfers as well as minting or burning. This event supports multiple _ids and _values.
|
||||
A `TransferBatch` event from address `0x0` signifies a minting operation. The total value transferred from address 0x0 minus the total value transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID
|
||||
A `TransferBatch` event to address `0x0` signifies a burning or melting operation.
|
||||
This MUST emit a 0 value, from `0x0` to `0x0` with `_operator` assuming the role of the token creator. This can be used to define a token ID with no initial balance at the time of creation.
|
||||
*/
|
||||
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
|
||||
|
@ -88,8 +88,8 @@ interface ERC1155 /* is ERC165 */ {
|
|||
|
||||
/**
|
||||
@notice Transfers value amount of an _id from the _from address to the _to addresses specified. Each parameter array should be the same length, with each index correlating.
|
||||
@dev MUST emit Transfer event on success.
|
||||
Caller must have sufficient allowance by _from for the _id/_value pair, or isApprovedForAll must be true.
|
||||
@dev MUST emit TransferSingle event on success.
|
||||
Caller must be approved to manage the _from account's tokens (see isApprovedForAll)
|
||||
Throws if `_to` is the zero address.
|
||||
Throws if `_id` is not a valid token ID.
|
||||
When transfer is complete, this function checks if `_to` is a smart contract (code size > 0). If so, it calls `onERC1155Received` on `_to` and throws if the return value is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`.
|
||||
|
@ -103,7 +103,7 @@ interface ERC1155 /* is ERC165 */ {
|
|||
|
||||
/**
|
||||
@notice Send multiple types of Tokens from a 3rd party in one transfer (with safety call)
|
||||
@dev MUST emit Transfer event per id on success.
|
||||
@dev MUST emit TransferBatch event on success.
|
||||
Caller must have a sufficient allowance by _from for each of the id/value pairs.
|
||||
Throws on any error rather than return a false flag to minimize user errors.
|
||||
@param _from Source address
|
||||
|
@ -121,6 +121,14 @@ interface ERC1155 /* is ERC165 */ {
|
|||
@return The _owner's balance of the Token type requested
|
||||
*/
|
||||
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
|
||||
|
||||
/**
|
||||
@notice Get the balance of an account's Tokens, of multiple types
|
||||
@param _owners The addresses of the token holders
|
||||
@param _ids ID of the Tokens
|
||||
@return The _owner's balance of the Token types requested
|
||||
*/
|
||||
function balanceOfBatch(address[] _owners, uint256[] _ids) external view returns (uint256[]);
|
||||
|
||||
/**
|
||||
@notice Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s tokens.
|
||||
|
@ -131,7 +139,7 @@ interface ERC1155 /* is ERC165 */ {
|
|||
function setApprovalForAll(address _operator, bool _approved) external;
|
||||
|
||||
/**
|
||||
@notice Queries the approval status of an operator for a given Token and owner
|
||||
@notice Queries the approval status of an operator for a given owner.
|
||||
@param _owner The owner of the Tokens
|
||||
@param _operator Address of authorized operator
|
||||
@return True if the operator is approved, false if not
|
||||
|
@ -149,11 +157,10 @@ Smart contracts **MUST** implement this interface to accept safe transfers.
|
|||
interface ERC1155TokenReceiver {
|
||||
/**
|
||||
@notice Handle the receipt of a single ERC1155 token type
|
||||
@dev The smart contract calls this function on the recipient
|
||||
after a `safeTransferFrom`. This function MAY throw to revert and reject the
|
||||
transfer. Return of other than the magic value MUST result in the
|
||||
transaction being reverted
|
||||
Note: the contract address is always the message sender
|
||||
@dev The smart contract calls this function on the recipient after a `safeTransferFrom`.
|
||||
This function MAY throw to revert and reject the transfer.
|
||||
Return of other than the magic value MUST result in the transaction being reverted.
|
||||
Note: the contract address is always the message sender.
|
||||
@param _operator The address which called `safeTransferFrom` function
|
||||
@param _from The address which previously owned the token
|
||||
@param _id An array containing the ids of the token being transferred
|
||||
|
@ -165,17 +172,16 @@ interface ERC1155TokenReceiver {
|
|||
|
||||
/**
|
||||
@notice Handle the receipt of multiple ERC1155 token types
|
||||
@dev The smart contract calls this function on the recipient
|
||||
after a `safeTransferFrom`. This function MAY throw to revert and reject the
|
||||
transfer. Return of other than the magic value MUST result in the
|
||||
transaction being reverted
|
||||
Note: the contract address is always the message sender
|
||||
@dev A ERC1155-compliant smart contract MUST call this function on the token recipient contract at the end of a `safeBatchTransferFrom` after the balance have been updated.
|
||||
This function MAY throw to revert and reject the transfer.
|
||||
Return of other than the magic value WILL result in the transaction being reverted.
|
||||
Note: the contract address is always the message sender.
|
||||
@param _operator The address which called `safeTransferFrom` function
|
||||
@param _from The address which previously owned the token
|
||||
@param _ids An array containing ids of each token being transferred
|
||||
@param _values An array containing amounts of each token being transferred
|
||||
@param _data Additional data with no specified format
|
||||
@return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
|
||||
@return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
|
||||
*/
|
||||
function onERC1155BatchReceived(address _operator, address _from, uint256[] _ids, uint256[] _values, bytes _data) external returns(bytes4);
|
||||
}
|
||||
|
@ -183,9 +189,9 @@ interface ERC1155TokenReceiver {
|
|||
|
||||
## Enumerating from events
|
||||
|
||||
In order to keep storage requirements light for contracts implementing ERC-1155, enumeration (discovering the IDs and values of tokens) must be done using event logs. It is RECOMMENDED that clients such as exchanges and blockchain explorers maintain a local database containing the Token ID, Supply, and URI at the minimum. This can be built from each Transfer, TransferBatch, and URI event, starting from the block the smart contract was deployed until the latest block.
|
||||
In order to keep storage requirements light for contracts implementing ERC-1155, enumeration (discovering the IDs and values of tokens) must be done using event logs. It is RECOMMENDED that clients such as exchanges and blockchain explorers maintain a local database containing the Token ID, Supply, and URI at the minimum. This can be built from each TransferSingle, TransferBatch, and URI event, starting from the block the smart contract was deployed until the latest block.
|
||||
|
||||
ERC-1155 contracts must therefore carefully emit Transfer or TransferBatch events in any instance where tokens are created, minted, or destroyed.
|
||||
ERC-1155 contracts must therefore carefully emit TransferSingle or TransferBatch events in any instance where tokens are created, minted, or destroyed.
|
||||
|
||||
## Metadata
|
||||
|
||||
|
|
Loading…
Reference in New Issue