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
ca4c1aed05
commit
a720c364b9
|
@ -23,13 +23,15 @@ The `_id` parameter is contained in each function's parameters and indicates a s
|
|||
|
||||
Tokens standards like ERC-20 and ERC-721 require a separate contract to be deployed for each fungible or NFT token/collection. This places a lot of redundant bytecode on the Ethereum blockchain and limits certain functionality by the nature of separating each token contract into its own permissioned address. With the rise of crypto games and platforms like [Enjin Coin](https://enjincoin.io/), game developers may be creating thousands of tokens, and a new type of token standard is needed to support this.
|
||||
|
||||
New functionality is possible with this design, such as transferring or approving multiple token types at once, saving on transaction costs. Trading (escrow / atomic swaps) of multiple tokens can be built on top of this standard and it removes the need to "approve" individual tokens separately. It is also easy to describe and mix multiple fungible or non-fungible tokens in a single contract.
|
||||
New functionality is possible with this design, such as transferring multiple token types at once, saving on transaction costs. Trading (escrow / atomic swaps) of multiple tokens can be built on top of this standard and it removes the need to "approve" individual token contracts separately. It is also easy to describe and mix multiple fungible or non-fungible tokens in a single contract.
|
||||
|
||||
### Batch Transfers
|
||||
|
||||
The `safeBatchTransferFrom` function allows for batch transfers of multiple token ids and values. Gas savings improves with the number of token types in the batch transfer, compared to single transfers with multiple transactions.
|
||||
|
||||
The `safeMulticastTransferFrom` function allows for multicast transfers to and from multiple addresses. It's also possible to create a simple atomic swap, including any fee structure required, by obtaining approvals from the source and destination parties.
|
||||
### Approval
|
||||
|
||||
Single-token based approval of specific token values has been dropped in favor of the function `setApprovalForAll` which allows an operator to manage one's entire set of tokens on behalf of the approver. To scope an approval to a specific set or quantity of tokens, we recommend deploying a contract that contains the desired rules, and directing end-users to approve this contract to manage their set of tokens.
|
||||
|
||||
### Backwards Compatibility
|
||||
|
||||
|
@ -63,29 +65,19 @@ interface ERC1155 /* is ERC165 */ {
|
|||
/**
|
||||
@dev MUST emit when an approval is updated
|
||||
*/
|
||||
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved, bytes32 indexed _scope);
|
||||
|
||||
/**
|
||||
@dev MUST emit when adding an approval scope
|
||||
*/
|
||||
event AddToScope(bytes32 indexed _scope, uint256 indexed _startId, uint256 indexed _endId);
|
||||
|
||||
/**
|
||||
@dev MUST emit when removing an existing approval scope
|
||||
*/
|
||||
event RemoveFromScope(bytes32 indexed _scope, uint256 indexed _startId, uint256 indexed _endId);
|
||||
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
|
||||
|
||||
/**
|
||||
@dev Emits when the URI is updated for a token ID.
|
||||
The URI may point to a JSON file that conforms to the "ERC-1155 Metadata JSON Schema".
|
||||
*/
|
||||
event URI(string _value, uint256 indexed _id);
|
||||
|
||||
|
||||
/**
|
||||
@dev Emits when the Name is updated for a token ID
|
||||
*/
|
||||
event Name(string _value, uint256 indexed _id);
|
||||
|
||||
|
||||
/**
|
||||
@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.
|
||||
|
@ -99,8 +91,8 @@ interface ERC1155 /* is ERC165 */ {
|
|||
@param _value transfer amounts
|
||||
@param _data Additional data with no specified format, sent in call to `_to`
|
||||
*/
|
||||
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes _data) external payable;
|
||||
|
||||
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes _data) external;
|
||||
|
||||
/**
|
||||
@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.
|
||||
|
@ -112,18 +104,8 @@ interface ERC1155 /* is ERC165 */ {
|
|||
@param _values Transfer amounts per token type
|
||||
@param _data Additional data with no specified format, sent in call to `_to`
|
||||
*/
|
||||
function safeBatchTransferFrom(address _from, address _to, uint256[] _ids, uint256[] _values, bytes _data) external payable;
|
||||
|
||||
/**
|
||||
@dev Send multiple types of Tokens in one transfer from multiple sources.
|
||||
@param _from Source addresses
|
||||
@param _to Transfer destination addresses
|
||||
@param _ids Types of Tokens
|
||||
@param _values Transfer amounts
|
||||
@param _data Additional data with no specified format, sent in call to each `_to[]` address
|
||||
*/
|
||||
function safeMulticastTransferFrom(address[] _from, address[] _to, uint256[] _ids, uint256[] _values, bytes _data) external payable;
|
||||
|
||||
function safeBatchTransferFrom(address _from, address _to, uint256[] _ids, uint256[] _values, bytes _data) external;
|
||||
|
||||
/**
|
||||
@notice Get the balance of an account's Tokens
|
||||
@param _owner The address of the token holder
|
||||
|
@ -131,25 +113,22 @@ 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 Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s tokens.
|
||||
@dev MUST emit the ApprovalForAll event on success.
|
||||
@param _operator Address to add to the set of authorized operators
|
||||
@param _approved True if the operator is approved, false to revoke approval
|
||||
@param _scope Optional argument allowing to scope approval to a set of ids. Passing a value of 0
|
||||
gives approval for all ids. MUST throw if the _scope value is not a supported scope.
|
||||
*/
|
||||
function setApprovalForAll(address _operator, bool _approved, bytes32 _scope) external;
|
||||
|
||||
function setApprovalForAll(address _operator, bool _approved) external;
|
||||
|
||||
/**
|
||||
@notice Queries the approval status of an operator for a given Token and owner
|
||||
@param _owner The owner of the Tokens
|
||||
@param _operator Address of authorized operator
|
||||
@param _scope A scope of 0 refers to all IDs
|
||||
@return True if the operator is approved, false if not
|
||||
*/
|
||||
function isApprovedForAll(address _owner, address _operator, bytes32 _scope) view returns (bool);
|
||||
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
|
Loading…
Reference in New Issue