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

Nonfungible Token Standard #4

Closed
wants to merge 27 commits into from
Closed
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
418a5d5
NEP-1 incomplete draft with notes
behaviary Jun 28, 2019
1794e1e
minor typo
behaviary Jun 28, 2019
7649150
add details
behaviary Jun 28, 2019
64dfbad
update standard with transfer callback
behaviary Jul 9, 2019
cf1b305
changing ids to use u64 instead of strings
behaviary Jul 10, 2019
f9f8cd4
add descriptions to headings
behaviary Jul 23, 2019
135e78a
clarify on transfer
behaviary Jul 23, 2019
43af15d
'be'
behaviary Jul 23, 2019
37158dd
Merge branch 'master' of github.com:nearprotocol/NEPs into nep-4
behaviary Jul 31, 2019
eb91fd1
Merge branch 'master' of github.com:nearprotocol/NEPs into nep-4
behaviary Sep 26, 2019
e3e9183
nep-4: clean up comments and add examples
behaviary Sep 26, 2019
cc6284d
merge master
behaviary May 15, 2020
00e57ba
Merge branch 'master' of github.com:nearprotocol/NEPs into nep-4
behaviary May 15, 2020
8b15509
update NFT standard
behaviary May 15, 2020
df7772c
change syntax to match Rust-style contract calls and update example
behaviary May 17, 2020
c2f0c10
add to links
behaviary May 17, 2020
8878dc1
clarifications and typos
behaviary May 19, 2020
f1aef35
fix minor typos/grammar issues
chadoh May 19, 2020
7c7b5c9
add missing backtick
chadoh May 19, 2020
e17e086
outdent example AssemblyScript
chadoh May 19, 2020
c6dada6
rearrange block spacing in example AssemblyScript
chadoh May 19, 2020
7670ce9
Update non-fungible-token format: remove owner_id from transfer_from
janedegtiareva May 22, 2020
3c73461
cleanup and changing params for check_access
behaviary May 27, 2020
9167868
Update specs/Standards/Tokens/NonFungibleToken.md
behaviary May 28, 2020
f31e223
Minor changes to transfer (move back to transfer_from and transfer)
janedegtiareva May 28, 2020
39fbef5
Typo in specs/Standards/Tokens/NonFungibleToken.md
behaviary Jun 4, 2020
3c23a47
Grammar in specs/Standards/Tokens/NonFungibleToken.md
behaviary Jun 4, 2020
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
123 changes: 123 additions & 0 deletions 0004-market-integration-token-standard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
- Proposal Name: "marketplace_integrated_token_standard"
- Start Date: 2019-06-24
- NEP PR: [nearprotocol/neps#0000](https://github.com/nearprotocol/neps/pull/0000)

# Summary
[summary]: #summary

A standard interface for non-fungible tokens allowing for ownership and transfer, specifically targeting third-party marketplace integration.

# Motivation
[motivation]: #motivation

Non-fungible tokens (NFTs) have been described in many ways: digital goods, collectible items, unique online assets etc. The current core use case for NFTs is speculating on value and trading unique items. The use case of trading NFTs should natively supported for this emerging market.

The idea of a marketplace-integrated NFT is to make it as easy as possible to merge new services with existing tokens that use the standard. Existing NFT standards still require some customization on the part of third party integrators, which becomes a burden with each NFT integrated. This standard will allow anyone to build a marketplace on top of any number of tokens, not just allowing but promoting trading and extension. These marketplaces can be built into games and apps that use the specific metadata in whatever way they choose.

Prior art:
ERC-20 standard: https://eips.ethereum.org/EIPS/eip-20
ERC-721 standard: https://eips.ethereum.org/EIPS/eip-721
ERC-1155 standard: https://eips.ethereum.org/EIPS/eip-1155


# Guide-level explanation
[guide-level-explanation]: #guide-level-explanation

Example of minting a token

```TypeScript
[...]
let corgiToken = generateRandomCorgiToken(tokenDetails);
// corgiToken.id === null
let mintedCorgiToken = mintToken(corgiToken);
near.log(mintedCorgiToken.tokenType.name);
// "CorgiToken"

getTokenValue(corgiToken.id)
// In most cases, value should be determined by market, however there are cases where it is important that value be set by the developer.

```

For user-facing NEPs this section should focus on user stories.

# Reference-level explanation
[reference-level-explanation]: #reference-level-explanation

The NEAR marketplace-integrated token standard

Template for smart contract.
Note that as of this writing, interfaces are unimplemented in AssemblyScript.

```TypeScript
class MarketStandardToken {
getTokenTypes():TokenType[]
getToken(tokenId:string):Token
getTokensByOwner(ownerId:string):Token[]

// getCount is equivalent of balanceOf
getCount(tokenType: TokenType, ownerId: string)
getTokenValue(tokenId:string):u64
behaviary marked this conversation as resolved.
Show resolved Hide resolved
getTokenData(tokenId:string):bytes

// It's up to the developer of a token to decide how tokens are generated.
// Minting should return the Token with a unique ID attached.
mintToken(token:Token):Token

// Note that transferring can be done on 1 or more tokens
transfer(recipientId:string, ownerId:string, tokenIds:string[]):void
behaviary marked this conversation as resolved.
Show resolved Hide resolved

//*** Researching the following methods ***//
lockToken(tokenId:string):void;
// Permissioned setting of value
private setValue(tokenId:string, value:u64)
}
```

Models

```TypeScript

class Token {
id: string;
tokenType: TokenType;
supply: u64;
data: bytes;
}

class TokenType {
id: string;
name: string;
totalSupply: u64;
}

```

# Drawbacks
[drawbacks]: #drawbacks

Why should we *not* do this?

### TODO

# Rationale and alternatives
[rationale-and-alternatives]: #rationale-and-alternatives

- Why is this design the best in the space of possible designs?
- What other designs have been considered and what is the rationale for not choosing them?
- What is the impact of not doing this?

### TODO

# Unresolved questions
[unresolved-questions]: #unresolved-questions

- What parts of the design do you expect to resolve through the NEP process before this gets merged?
- What parts of the design do you expect to resolve through the implementation of this feature before stabilization?
- What related issues do you consider out of scope for this NEP that could be addressed in the future independently of the solution that comes out of this NEP?

### TODO

# Future possibilities
[future-possibilities]: #future-possibilities

### TODO