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

examples: add NEP11 Divisible token example #2333

Merged
merged 3 commits into from
Jan 24, 2022
Merged

Conversation

AnnaShaleva
Copy link
Member

Seems that #2292 is almost ready, so there will be no painful rebases anymore and I can safely open this PR.

Close #1940.

examples/nft-d/go.mod Outdated Show resolved Hide resolved
examples/nft-d/nft.go Outdated Show resolved Hide resolved
examples/nft-d/nft.go Outdated Show resolved Hide resolved
Package nft_d contains divisible non-fungible NEP-11-compatible token
implementation. This token can be minted with GAS transfer to contract address,
it will retrieve company name from the transfer data and produce NFT which
represents shares of the specified company.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shares are so naturally fungible, that we might consider using something else. Although that might be a problem of divisible NFTs in general, each of them could easily be proper NEP-17, but somehow they're NFTs. Usually I'm thinking of some real estate in this case, each object is unique, there are lots of them (unlike publicly traded companies) and each can be owned by a set of owners. Not sure it makes for a good example.

Copy link
Member Author

@AnnaShaleva AnnaShaleva Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it's a good example, but possibly it has the same problem as shares, because if you share a part of a flat (e.g. 10m² out of 30m²), then you still can't locate the particular part of this flat and say that it's 10m² of a kitchen or 10m² of a bathroom, you just own 1/3 of a flat which is also naturally fungible.

And also I remember the neo-project/proposals#130 (comment), but looks like it's also a problem of all NEP11-divisible tokens.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, just discussed --- imagine a NeoFS object, a perfect NFT. You can theoretically give access to it only to its owner, but what if you want to give access to a number of people? That's where divisible NFTs might be handy, you give 0.00001 part of this NFT to the user and he can access it now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

examples/nft-d/nft.go Show resolved Hide resolved
@AnnaShaleva AnnaShaleva force-pushed the examples/nep11-d branch 2 times, most recently from 4d1aab8 to 3028471 Compare January 21, 2022 09:48
Method `ownerOf` returns iterator which should be of the type
InteropInterface.
It's possible that overloaded method is marked as `safe` in manifest, so
that it must have `save` field set to true after its name was
overwritten.
examples/nft-d/nft.go Outdated Show resolved Hide resolved
examples/nft-d/nft.go Outdated Show resolved Hide resolved
examples/nft-d/nft.go Outdated Show resolved Hide resolved
examples/nft-d/nft.go Show resolved Hide resolved
examples/nft-d/nft.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jan 24, 2022

Codecov Report

Merging #2333 (9f4e7fd) into master (613a23c) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 9f4e7fd differs from pull request most recent head 5561b94. Consider uploading reports for the commit 5561b94 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2333      +/-   ##
==========================================
+ Coverage   84.72%   84.74%   +0.01%     
==========================================
  Files         286      286              
  Lines       29890    29894       +4     
==========================================
+ Hits        25325    25333       +8     
+ Misses       3129     3127       -2     
+ Partials     1436     1434       -2     
Impacted Files Coverage Δ
pkg/compiler/debug.go 94.02% <100.00%> (+0.09%) ⬆️
pkg/smartcontract/manifest/standard/comply.go 100.00% <100.00%> (ø)
pkg/services/oracle/oracle.go 86.36% <0.00%> (-1.82%) ⬇️
pkg/core/storage/memcached_store.go 91.37% <0.00%> (-1.73%) ⬇️
pkg/services/oracle/request.go 63.97% <0.00%> (-0.54%) ⬇️
pkg/network/server.go 76.00% <0.00%> (+0.11%) ⬆️
pkg/consensus/consensus.go 73.07% <0.00%> (+0.54%) ⬆️
pkg/services/stateroot/validators.go 84.88% <0.00%> (+8.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 613a23c...5561b94. Read the comment docs.

examples/nft-d/nft.go Outdated Show resolved Hide resolved
@AnnaShaleva AnnaShaleva force-pushed the examples/nep11-d branch 2 times, most recently from 0aafe4f to 9f4e7fd Compare January 24, 2022 09:13
examples/nft-d/nft.go Outdated Show resolved Hide resolved
@roman-khimov roman-khimov merged commit f9e8dcb into master Jan 24, 2022
@roman-khimov roman-khimov deleted the examples/nep11-d branch January 24, 2022 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NEP11 divisible example
2 participants