-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ERC-1372 Multi-Class Token Standard vNext #1372
Comments
You can losslessly cast back and forth between bytes32 and uint256. Neither ERC-1155, nor ERC-1203 impose a format on the class value. A hash can be used without using bytes32. An added benefit is that operations on uint256 cost less gas then bytes32. |
@ericbinet good arguments, thanks! Is it possible to do implicit cast between those types? For instance function expects uint256, but I sent bytes32 (string). What kind of operations do you mean in the particular case? Is there any cost differences for access by index for different index's types? |
Using bytes32 in various cases is more expensive than using uint256. For example, simply passing a bytes32 value in a function parameter (like bytes32 _class in this standard) will be more expensive than a uint256 parameter. |
As far as implicit casts go, this would be handled by your client code. If you use Web3 in JavaScript, all numbers are sent to Ethereum as BigNumbers. Conversion is handled by the library. If you rely on On Web3 1.0, this function is named |
@aquiladev Thanks for citing my EIP-1203 :) Glad to see my idea being validated by others and as @ericbinet pointed out, our differences may be trivial. Frankly though, I have essentially stopped working on EIP-1203 after giving another pass on EIP-1155 by @coinfork and found it to be a superset of what I was trying to do. In the comment section, there is a (very) lengthy discussion on standardizing the _class (or _id) bit packing format. The TL;DR version is that we're leaning toward moving that to its own standard (personally think it'll be a series of, with common business logic embedded for different sectors which is really cool) and leave EIP-1155 focused on addressing the multi-class part. Take a look and see if you agree that we can all join force behind one proposal. |
fair arguments, I think the proposal is no longer needed |
Simple Summary
A standard interface for multi-class tokens (MCTs).
Abstract
The following standard allows for the implementation of a standard API for MCTs within smart contracts. This standard provides basic functionality to track, transfer, and convert MCTs.
Personal motivation
Token factory is the first name of the concept. After the investigation I found the similar multi-class token concept. It has been bothering me for the last 3 months. I am familiar with #1155, #1178, #1203 proposals, but there is one tiny issue that makes me worried, which actually motivated me to write the proposal of my own. In my opinion the above-mentioned proposals have a small flaw which opens a room for improvement.
In my proposal I'm going to cover only the MCT. It is up to the community to discuss, decline, accept, change or merge the proposal with the existing ones.
Explanation is based on #1203
Motivation
I completely agree with general motivation from #1203
Key
The tiny difference and at the same time the biggest advantage of the proposal is the access key (class in #1155, #1178, #1203 proposals).
I'm proposing to use bytes32 type as a key for a token, whereas all proposals use uint265 type.
Why is it so important?
It is much easier to use rule based keys than index keys.
Here are some examples of the key's rule:
In order to create the key we can utilize
keccak256(rule)
. Default key can bekeccak256('')
Specification
Credits
Thanks to all the authors of the related proposals.
I would appreciate to discuss the proposal with @coinfork (#1155) @achon22 (#1178) @jeffishjeff (#1203) and co-authors.
Copyright
Copyright and related rights waived via CC0.
The text was updated successfully, but these errors were encountered: