Coder Social home page Coder Social logo

Comments (10)

nfurfaro avatar nfurfaro commented on July 20, 2024 2

A few things that I'd like to see in an NFT contract to help keep it useful and flexible:

  • the contract should represent a collection of NFTs, not just a single token
  • every token minted should have a unique, immutable token id
  • there should be a way to find the owner of any token given its id.
  • access control for minting - the contract should store an Identity as the minter, which allows for either an address or a minter contract to be set as the entity with minting rights

from sway-applications.

nfurfaro avatar nfurfaro commented on July 20, 2024 1

Plus one on the use of erc165!
I think using the Identity type in storage, ie: as the minter, owner, token owner, etc will help to make things a bit more interoperable between EOAs and Contracts.l, but there's likely more we can do on that front.

from sway-applications.

nfurfaro avatar nfurfaro commented on July 20, 2024

A good next step for this would be to pin down what the abi looks like.

The specific implementation can follow, and will probably be able to benefit from some cool new functionality in Sway (ie: vec, improved storage interface).

from sway-applications.

nfurfaro avatar nfurfaro commented on July 20, 2024

Something along the lines of this as a start (may not be complete yet):

library nft;

use std::identity::Identity;


abi NFT {
    fn mint(to: Identity, amount: u64) ;
    fn burn(token_id: b256) ;
    fn owner_of(token_id: b256) -> Option<Identity>;
    fn balance_of(owner: Identity) -> u64;
    fn transferFrom(from: Identity, to: Identity, token_id: b256)
}

And then some supporting internal functions, ie:

  • fn generate_token_id()
  • register_new_token()
    etc...

from sway-applications.

nfurfaro avatar nfurfaro commented on July 20, 2024

Eventually, we'll want to add event logging to this as well.
This is a good reference to get some ideas: https://eips.ethereum.org/EIPS/eip-721

I don't know about the safeTransfer stuff yet, need to think on that some more.
pinging @adlerjohn @SilentCicero for input.

from sway-applications.

adlerjohn avatar adlerjohn commented on July 20, 2024

cc @simonr0204 and @pixelcircuits for input

from sway-applications.

nfurfaro avatar nfurfaro commented on July 20, 2024

A separate (but related) issue is token standards, ie: Following existing standards, or creating a new one.
I'm most familiar with ERC721 and ERC1155 (batch transfers are definitely nice to have) myself.
But probably out of scope for this issue.

from sway-applications.

pixelcircuits avatar pixelcircuits commented on July 20, 2024

We need to also make sure it's just as easy for contracts to hold NFTs as it is for EOAs. This will be necessary for cross domain bridging in the future. I also like how ERC165 allows for interface detection and we should definitely mirror that process to make for easy data crawling for marketplaces, etc.

from sway-applications.

Braqzen avatar Braqzen commented on July 20, 2024

A few things that I'd like to see in an NFT contract to help keep it useful and flexible:

  • the contract should represent a collection of NFTs, not just a single token
  • every token minted should have a unique, immutable token id
  • there should be a way to find the owner of any token given its id.
  • access control for minting - the contract should store an Identity as the minter, which allows for either an address or a minter contract to be set as the entity with minting rights

@bitzoic can you move this checklist into the description above so that GitHub does some nice tracking similar to #1 ?
Could you also add some labels to the issue?

from sway-applications.

bitzoic avatar bitzoic commented on July 20, 2024

This issue's tests are currently blocked by FuelLabs/fuels-rs#326

from sway-applications.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.