Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference implementation for proposed Multi-token spec (NEP-245) #776

Closed
wants to merge 3 commits into from

Conversation

jriemann
Copy link

@jriemann jriemann commented Apr 1, 2022

This is a reference implementation of the current draft Multi-token spec (NEP-245) - near/NEPs#245 . I am sending this out now to be reviewed in conjunction with that PR so that reviewers can start looking it over.

The work is based on the repo started by @i3ima who deserves credit for getting the ball rolling - https://github.com/i3ima/nep-246 . I have filled in the gaps and it should now be close to the draft spec.

  • Core MT contract
  • Approvals
  • Enumeration
  • Metadata

Not fully complete yet:

  • simulation tests for the XCCs soon. I have included boilerplate but am still learning how to convey what I need to test.
  • Logic for re-granting approvals in case of *transfer_call failures.

@zcstarr
Copy link
Contributor

zcstarr commented Apr 1, 2022

@austinabell this is the token standard I mentioned a while ago coming down the pipeline. PTAL when you get a chance @jriemann is doing the development on this one so feel free to ping him, I'm around to talk spec things if needed .

@austinabell
Copy link
Contributor

@jlogelin will likely review the logical components and how they match the spec. I'll be more than happy to review this once I have some time also


#[tokio::test]
async fn test_total_supply() -> anyhow::Result<()> {
// TODO: Write simulation tests involving cross-contract calls (mt_transfer_call, etc).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, you'll probably use workspaces tests based on what's above, but just a warning to not invest time into sim tests (near-sdk-sim) as it will be deprecated soon in favor of workspaces.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha

@jriemann
Copy link
Author

jriemann commented Apr 4, 2022

@telezhnaya pinging you since you were active on the NEP-245 review & this is related. Could you take a look as well, if you have time?
This is a large PR but a good amount of it is boilerplate code similar to the existing NFT stuff. If any areas are unclear, let me know.

Copy link
Contributor

@telezhnaya telezhnaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add tests that we produce valid event logs on each mint/transfer/burn?

/// Take some action after receiving a multi-token's
///
/// ## Requirements:
/// * Contract MUST restrict calls to this function to a set of whitelisted NFT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// * Contract MUST restrict calls to this function to a set of whitelisted NFT
/// * Contract MUST restrict calls to this function to a set of whitelisted MT

enum Nep245EventKind<'a> {
MtMint(&'a [MtMint<'a>]),
MtTransfer(&'a [MtTransfer<'a>]),
// NftBurn(&'a [NftBurn<'a>]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// NftBurn(&'a [NftBurn<'a>]),

@uint
Copy link
Contributor

uint commented Jul 11, 2023

Closing as work seems to have been continued here: #950

@uint uint closed this Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants