Open zcstarr opened 3 years ago
Wait I need this and would love for this to come along!
Hey guys, could you provide updates on the status of the Multi Token Standard? This is a very much useful feature to have for the Near dev toolkit ! Thanks ! :)
Hi, @zcstarr, @riqi, @jriemann, @marco-sundsk, Is anyone from this list still interested in co-authoring?
I want to take over authorship and push to finalize this spec and its standard implementation.
Hi @mikedotexe, @volovyks, This PR shows Mike as the designated Reviewer for this NEP. Are you guys ok to review and push this into the Final Call, or is there someone else you'd assign to do this instead?
There are a few bugs in this NEP that I found when reviewing it with my friend @uncle-T0ny. We'd like to fix them and propose an implementation to be included in NEAR standards.
@alexastrum It would be awesome if you could sum up what work is left to be done. I see this draft implementation for near-sdk-rs: https://github.com/near/near-sdk-rs/pull/776
@
Hi @mikedotexe, @volovyks, This PR shows Mike as the designated Reviewer for this NEP. Are you guys ok to review and push this into the Final Call, or is there someone else you'd assign to do this instead?
There are a few bugs in this NEP that I found when reviewing it with my friend @uncle-T0ny. We'd like to fix them and propose an implementation to be included in NEAR standards.
@alexastrum and @uncle-T0ny, would be great if you would post what you found as issues to the PR for the spec. or drop it here to open the convo up. I'd be curious to know what you hit. and would probably be in line with the new review process @frol ?
The original PR by @jriemann was done, but was unable to be merged in due to lack of time for anyone to actually review it.
The list of the issues that I found:
function mt_is_approved(
token_ids: [string],
approved_account_id: string,
amounts: [string],
approval_ids: number[]|null
): boolean {}
and in the current implementation owner_id (an account that granted approval) we get from env::predecessor_account_id(), which means the method can't be viewable. As a solution, we should update the spec, and add owner_id param to the args.
Proposals:
Based on https://github.com/near/near-sdk-rs/pull/776 we're working on an updated version of the
ref. implementation that includes: fixes of mentioned above issues, near-sdk-rs updates with the relevant fixes, added more tests.
We would like to finalize this reference implementation and help the near community to receive the new standard. As soon as possible
I want to take over authorship and push to finalize this spec and its standard implementation.
@alexastrum I think you can go ahead and prepare a PR, and this way we will continue the evolution of the standard. The best way to collaborate is to provide context and suggest solutions.
This PR shows Mike as the designated Reviewer for this NEP. Are you guys ok to review and push this into the Final Call, or is there someone else you'd assign to do this instead?
@near/wg-contract-standards will do the final review, but before we get there, the hope is to see a healthy discussion driven by the stakeholders of this standard.
@frol, @zcstarr
This PR https://github.com/near/near-sdk-rs/pull/950 is based on https://github.com/near/near-sdk-rs/pull/776 with the updated codebase and the improvements.
The improvements list (by commits): 1) https://github.com/near/near-sdk-rs/pull/950/commits/6d79045ba304ed745fdcf102faf9f581309a502f
We used https://github.com/near/near-sdk-rs/pull/776 but in our forked near-sdk-rs because we needed to use the up-to-date codebase.
2) https://github.com/near/near-sdk-rs/pull/950/commits/c22daf61bec86656c371b01e23fac2ca607970bd
3) https://github.com/near/near-sdk-rs/pull/950/commits/e7cabb4734ecc6a6983b8f2317214ca821dc9ae1
4) https://github.com/near/near-sdk-rs/pull/950/commits/438ec7ac3213e899df50dcafd7cdea33f730efc9
5) https://github.com/near/near-sdk-rs/pull/950/commits/8ff8d46d0427515ae4975571c4c345061722251f
Could you please give us some advice on how to continue the MT finalization in the best way?
As part of our bridge using IBC, we definitely need this standard to be merged. @frol
(I am cross-posting this message for visibility from here: https://github.com/near/NEPs/pull/245#issuecomment-1351844674)
Hey folks, I want to give an update here as it seems that the work regarding this NEP is not visible in this PR.
Thanks to @uncle-T0ny, there is a solid PR with the implementation in near-sdk-rs (https://github.com/near/near-sdk-rs/pull/950). The implementation was partially reviewed and @uncle-T0ny took it offline to test this implementation in his own contract before proceeding with submitting a NEP extension with the identified shortcomings to the current MT standard. Feel free to review the implementation and test it out!
Excellent, we will be checking this out next quarter as we would like to help get this going and finalised. Will be playing around with it then.
Now, we have a revision of this standard. This time, we focus on the combination of FT and NFT in those core functions cause we noticed some misunderstandings on FT and NFT workflow on near network in those interfaces. Beside that, we also make a supplement to the nep-0245.md to include all the extensions while leaving the one in specs untouched as a comparision base point, so that you could have a clear view about what have been changed in this revision.
To save your breath, we have a summary here to outline those key modifications and reasons behind them.
Token
type completed.
We add all possible items from those extensions (mainly metadata) with optional to make it neat as usual. owner_id
from approval
field in transfer related interfaces.
For a FT, owner must be the sender. For a NFT, owner is not necessary to give in params, token contracts could find and only trust what they got from their on-chain status.owner_id
in approvals to the upper level and rename as previous_owner_ids
in mt_resolve_transfer
.
Approvals is an extension to NFT, but previous_owner of the NFT is key to the interface otherwise the revert could NOT successfully work. amount
in approvals to the upper level in mt_resolve_transfer
.
Here, amounts
is used here for FT, shouldn't be placed inside approval
part. copies
from MTBaseTokenMetadata
to MTTokenMetadata
.
Here copies
usually collaberate with media
to support such as multiple tokens with the same picture. It should stay with media
.base_id
to MTTokenMetadataAll
type to enable unified response of metadata queries.
Normally, token contracts should return with full content in base
field to save clients from extral query on base info. But in some special cases, base_id
could be returned instead of base
to shrink output size. It's token contract's call depending on their own situation.amount
in approval extension.
On near, for FT, no approval is needed thanks to NEP-141. Meanwhile, NFT does care about amount. So, amount is not necessary in approval extension.Now, the plan is to have an agreement on nep-0245.md first, then the corresponding fix would be applied to those in specs. And the standard code implementation would be the last.
Summary
A standard interface for a multi token standard that supports fungible, semi-fungible, and tokens of any type, allowing for ownership, transfer, and batch transfer of tokens generally regardless of specific type. This standard aims to make it possible to represent these multi tokens in a way that allows these tokens to be represented across chains.
Motivation
Having a single contract represent both NFTs and FTs can greatly improve efficiency as demonstrated by Enjin Coin. The ability to make batch requests with multiple asset classes can reduce a many transactions, transaction to a single transaction to trade around both NFTs and FTs that are a part of same token contract. Moreover, this flexibility has led to building proper infrastructure for ecosystems, that often have to issue many tokens under management such as games.
Finally on other chains, such as Ethereum it would be nice to be able to bridge a token contract from near to ETH or to other chains. Having a multi token standard that can represent many different classes of tokens is highly desirable
Background
Current NEP PR:
Prior art:
EIP-1155 : https://github.com/ethereum/EIPs/issues/1155
This NEP derives some examples and format from: https://github.com/near/NEPs/pull/21
Example of an NFT Series: https://github.com/near-apps/gnr8
Things from the NFT Discussions: https://github.com/near/NEPs/discussions/171
Things from the NFT Discussions: https://gov.near.org/t/nft-standard-discussion/853
Discussions out of band:
WIP/impl:
Core Trait
Receiver Trait
Notes
Resolver Trait
Notes
TokenId is of type String
Storage Management Trait
Notes
This is semi necessary for ft token types to be able to refund users for storage of many different token types like gold/silver... this might be slightly out of scope
Metadata Trait
PR #245