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

feat: add NFT standard #3

Merged
merged 22 commits into from
May 20, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix response type, add error rules, add impl
  • Loading branch information
friedger authored Jan 20, 2021
commit 5f6cbd0105aeececf1daaab7a4defda7e545bc19
12 changes: 9 additions & 3 deletions sips/sips/sip-009-nft-standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ NFT smart contract shall implement the trait defined at `ST2NM3E9MAWWRNGFEKW75QR
### Trait

```

(define-trait stacks-token-nft-standard-v1
(
;; Token ID, limited to uint range
(last-token-id () uint)
(last-token-id () (response uint uint))

;; Owner of given token identifier
(get-owner? (uint) (optional principal))
(get-owner? (uint) (response (optional principal) uint))

;; Transfer from to
(transfer? (uint principal principal) (response bool (tuple (kind (string-ascii 32)) (code uint))))
Expand All @@ -54,6 +53,11 @@ NFT smart contract shall implement the trait defined at `ST2NM3E9MAWWRNGFEKW75QR
1. Contracts must use a least one nft asset. A post condition with deny mode and without any nft condition about a changed owner must fail for `transfer?` function calls.
1. After a successfull call to function `transfer?` the function `get-owner?` must return the recipient of the `transfer?` call as the new owner.
1. If a call to function `get-owner?` returns some principal `A` value then it must return the same value until `transfer?` is called with principal `A` as a sender
1. The following error codes are defined

| function | error | description |
|----------|-------|-------------|
|`transfer?`|`{kind: "nft-transfer-failed", code: from-nft-transfer}`| Error if the call failed due to the underlying asset transfer. The code `from-nft-transfer` is the error code from the native asset transfer function|

## Related Work

Expand All @@ -69,3 +73,5 @@ Not applicable
This SIP is activated as soon as 5 contracts are deployed that are using the same trait that follows this specification.

## Reference Implementations

https://github.com/friedger/clarity-smart-contracts/blob/master/contracts/sips/nft-trait.clar