r0gue-io / pop-node

Pop Network makes it easy for smart contract developers to use the Power of Polkadot.
The Unlicense
24 stars 6 forks source link

feat(sub0): nonfungibles pop-api + pallet implementation #353

Closed chungquantin closed 3 weeks ago

chungquantin commented 1 month ago

Nonfungible contracts size:

Original wasm size: 61.5K, Optimized: 21.7K

Description

In an effort to provide a unifying experience for developers to access runtime functionality for non-fungible tokens, APIs compliant to the PSP34 standard will be provided, as well as a set of extra functions (see Management). The interface as defined by this specification will be accessible for smart contracts via:

use pop_api::nonfungibles::<function>;

Note that the lack of version equals latest. As an example, the user could explicitly specify the version as:

use pop_api::v0::nonfungibles::<function>;

The PR includes changes made to the forked pallet-nfts following what has been discussed in the internal spec. Introducing two new pallets;

The Nonfungible API provides the contract ability to mint / burn a new item, transfer and approve following the PSP34 Standard. There are additional features to manage the Nonfungible such as create / destroy a collection, set / clear metadata, set / clear / approve / cancel_approve item attribute.

Becnhmarking:

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 79.39815% with 356 lines in your changes missing coverage. Please review.

Project coverage is 70.06%. Comparing base (0460a44) to head (1943669).

Files with missing lines Patch % Lines
pallets/nfts/src/weights.rs 3.59% 295 Missing :warning:
pallets/api/src/nonfungibles/mod.rs 70.44% 34 Missing and 13 partials :warning:
pallets/nfts/src/features/approvals.rs 93.42% 1 Missing and 4 partials :warning:
runtime/devnet/src/config/api/mod.rs 96.26% 4 Missing :warning:
pallets/nfts/src/features/transfer.rs 77.77% 2 Missing :warning:
pallets/nfts/src/lib.rs 88.88% 2 Missing :warning:
pallets/api/src/nonfungibles/types.rs 0.00% 1 Missing :warning:
@@                        Coverage Diff                        @@
##           chungquantin/sub0-pallet_nfts     #353      +/-   ##
=================================================================
+ Coverage                          67.37%   70.06%   +2.68%     
=================================================================
  Files                                 69       72       +3     
  Lines                              11731    12975    +1244     
  Branches                           11731    12975    +1244     
=================================================================
+ Hits                                7904     9091    +1187     
- Misses                              3568     3608      +40     
- Partials                             259      276      +17     
Files with missing lines Coverage Δ
pallets/api/src/fungibles/mod.rs 92.59% <ø> (ø)
pallets/api/src/fungibles/tests.rs 99.73% <100.00%> (+0.03%) :arrow_up:
pallets/api/src/mock.rs 100.00% <100.00%> (ø)
pallets/api/src/nonfungibles/tests.rs 100.00% <100.00%> (ø)
pallets/nfts/src/benchmarking.rs 85.79% <ø> (ø)
pallets/nfts/src/common_functions.rs 81.39% <100.00%> (+1.39%) :arrow_up:
...lets/nfts/src/features/create_delete_collection.rs 84.70% <100.00%> (+0.36%) :arrow_up:
pallets/nfts/src/features/create_delete_item.rs 89.56% <100.00%> (+0.35%) :arrow_up:
pallets/nfts/src/tests.rs 99.88% <100.00%> (+<0.01%) :arrow_up:
pallets/nfts/src/types.rs 67.11% <ø> (ø)
... and 9 more