-
Notifications
You must be signed in to change notification settings - Fork 116
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
[x/programs] Add NFT program example #511
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good a few notes. As I noted offline I think implementing this as an example/test in go will answer my other questions.
3eea9c6
to
e56de4d
Compare
GOAL: Can we implement this with just Rust/YAML once simulator is merged? |
Sounds good. Just waiting for #567 to land first. |
c3a03f6
to
e158dda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major comment is that there doesn't seem to be anything non-fungible about the NFT program. Maybe I'm missing something though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just some q's 👍
Updated the PR per the latest round of reviews. #537 will land and then we can hook everything up for testing. Both the program and the test are now 100% in Rust. |
Per @patrick-ogrady this program will be an example of a single unique NFT, for example a building or a unique piece of art. A subsequent NFT program will add support for collections. This NFT program is the first one to land and should remain as simple and readable as possible. At this point the program is ready to go after testing. I will also add a README. |
Currently waiting on support for |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
wasmlanche_sdk = { version = "0.1.0", path = "../../wasmlanche_sdk", features = ["simulator"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is simulator
a dev-dependency
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature is tracked in rust-lang/cargo#7916. It's in nightly but not sure if it's in stable.
|
||
assert_eq!(counter, 0, "init already called"); | ||
|
||
// Set token name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything below this line in this function is a perfect example of what I meant by "batch" ops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My impression was batch ops are something that the underlying SDK would add support for behind the scenes? I am not aware of changes that should be made to the program to support batching.
"balance must be greater than or equal to amount burned" | ||
); | ||
|
||
let counter = program |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Counter is never updated but you check against it when burning? Is it supposed to be the total count ever created or the current supply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Counter is the total count of outstanding NFTs. It goes up but does not go down. Basically it's there to ensure that the max supply is never exceeded. Burning an NFT does not decrement the counter because the NFT itself is gone at that point and should not be able to be re-minted.
24bb366
to
b1e6e8a
Compare
Signed-off-by: Dan Sover <dan.sover@avalabs.org>
Adds a WIP example of a basic ERC-721 program. Support for the standard NFT metadata is included.
This implementation is just an example and will be subject to change.