Comments (10)
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 theminter
, which allows for either an address or a minter contract to be set as the entity with minting rights
from sway-applications.
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.
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.
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.
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.
cc @simonr0204 and @pixelcircuits for input
from sway-applications.
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.
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.
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 theminter
, 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.
This issue's tests are currently blocked by FuelLabs/fuels-rs#326
from sway-applications.
Related Issues (20)
- Update and reintroduce `fractional-NFT` HOT 1
- Multisig: SRC-2
- Multisig: remove arbitary data from hash functions
- Multisig: move `Bytes` implementation
- Update Applications to meet SRC-2 Inline Docs Standard
- Bump all apps
- Token README typo
- Split CI to run Sway, Rust or both test suites
- Unarchive AMM app
- Implement releases to make applications accessible as dependencies
- something unrelated HOT 1
- Add ownership/pausing functionality to Asset and NFT examples
- Create the Sway-Apps Book
- <title>I want to use Python to bridge Sepolia's ETH across chains to Fuel HOT 2
- native asset link is broken
- Bump all apps to latest versions
- Setup Nightly Tests Using Latest Version of forc and libs
- Improve Test Coverage for Sway-Apps
- Update multisig-wallet to latest versions
- Use dynamic base asset id in tests instead of static zero
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sway-applications.