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
f8425673a1
commit
77000b43ae
|
@ -55,12 +55,12 @@ pragma solidity ^0.4.25;
|
|||
*/
|
||||
interface ERC1155 /* is ERC165 */ {
|
||||
/**
|
||||
@dev MUST emit when tokens are transferred, including zero value transfers as well as minting or burning.
|
||||
@dev MUST emit when tokens are transferred, including zero value transfers as well as minting or burning. Supports single or 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.
|
||||
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 _operator, address indexed _from, address indexed _to, uint256 indexed _id, uint256 _value);
|
||||
event Transfer(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
|
||||
|
||||
/**
|
||||
@dev MUST emit when an approval is updated
|
||||
|
@ -133,6 +133,46 @@ interface ERC1155 /* is ERC165 */ {
|
|||
```
|
||||
</details>
|
||||
|
||||
## ERC-1155 Token Receiver
|
||||
|
||||
Smart contracts **MUST** implement this interface to accept safe transfers.
|
||||
|
||||
```solidity
|
||||
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
|
||||
@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
|
||||
@param _value An array containing the amount of tokens being transferred
|
||||
@param _data Additional data with no specified format
|
||||
@return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
|
||||
*/
|
||||
function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _value, bytes _data) external returns(bytes4);
|
||||
|
||||
/**
|
||||
@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
|
||||
@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)"))`
|
||||
*/
|
||||
function onERC1155BatchReceived(address _operator, address _from, uint256[] _ids, uint256[] _values, bytes _data) external returns(bytes4);
|
||||
}
|
||||
```
|
||||
|
||||
## 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 and URI event, starting from the block the smart contract was deployed until the latest block.
|
||||
|
@ -181,6 +221,10 @@ This JSON schema is loosely based on the "ERC721 Metadata JSON Schema", but incl
|
|||
"type": "string",
|
||||
"description": "Identifies the asset to which this token represents",
|
||||
},
|
||||
"decimals": {
|
||||
"type": "integer",
|
||||
"description": "The number of decimal places that the token amount should display - e.g. 18, means to divide the token amount by 1000000000000000000 to get its user representation.",
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Describes the asset to which this token represents",
|
||||
|
@ -226,30 +270,6 @@ An example of an ERC-1155 Metadata JSON file follows. The properties array propo
|
|||
}
|
||||
```
|
||||
|
||||
## ERC-1155 Token Receiver
|
||||
|
||||
Smart contracts **MUST** implement this interface to accept safe transfers.
|
||||
|
||||
```solidity
|
||||
interface ERC1155TokenReceiver {
|
||||
/**
|
||||
@notice Handle the receipt of an ERC1155 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
|
||||
@param _operator The address which called `safeTransferFrom` function
|
||||
@param _from The address which previously owned the token
|
||||
@param _id The identifier of the token being transferred
|
||||
@param _value The amount of the token being transferred
|
||||
@param _data Additional data with no specified format
|
||||
@return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
|
||||
*/
|
||||
function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _value, bytes _data) external returns(bytes4);
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
Non-Fungible Tokens</summary>
|
||||
|
|
Loading…
Reference in New Issue