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(devnet): runtime non-fungible pallet (basic standard features) #261

Open
wants to merge 14 commits into
base: chungquantin/api-non_fungibles
Choose a base branch
from

Conversation

chungquantin
Copy link
Collaborator

@chungquantin chungquantin commented Sep 4, 2024

Runtime first implementation of the local non-fungible use case. Deliverables include:

Important

Questionable approach in the allowance method that currently forks the relevant structs to ItemDetail. The purpose of this is to get the field approvals (which is a private field in a private struct ItemDetail) by decoding.

Note

Will need to design this API to be compatible with v1.14.0 in main, currently v1.7.0 in daan/api

@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 93.38422% with 26 lines in your changes missing coverage. Please review.

Project coverage is 38.94%. Comparing base (d02e4b2) to head (3b8c91a).

Files with missing lines Patch % Lines
pallets/api/src/non_fungibles/mod.rs 67.56% 14 Missing and 10 partials ⚠️
pallets/api/src/non_fungibles/types.rs 0.00% 2 Missing ⚠️
@@                        Coverage Diff                         @@
##           chungquantin/api-non_fungibles     #261      +/-   ##
==================================================================
+ Coverage                           34.10%   38.94%   +4.84%     
==================================================================
  Files                                  34       37       +3     
  Lines                                3011     3276     +265     
  Branches                             3011     3276     +265     
==================================================================
+ Hits                                 1027     1276     +249     
- Misses                               1952     1972      +20     
+ Partials                               32       28       -4     
Files with missing lines Coverage Δ
pallets/api/src/fungibles/tests.rs 100.00% <100.00%> (ø)
pallets/api/src/mock.rs 100.00% <100.00%> (ø)
pallets/api/src/non_fungibles/tests.rs 100.00% <100.00%> (ø)
pallets/api/src/non_fungibles/types.rs 0.00% <0.00%> (ø)
pallets/api/src/non_fungibles/mod.rs 67.56% <67.56%> (ø)

... and 8 files with indirect coverage changes

@chungquantin chungquantin linked an issue Sep 5, 2024 that may be closed by this pull request
@chungquantin chungquantin self-assigned this Sep 6, 2024
@chungquantin chungquantin changed the title feat(devnet): runtime non-fungible pallet feat(devnet): runtime non-fungible pallet (basic standard features) Sep 6, 2024
@chungquantin
Copy link
Collaborator Author

chungquantin commented Oct 1, 2024

    owned_in_collection {
        let i in 0 .. 5_000;
        let (collection, caller, _) = create_collection::<T, I>();
        let items = (0..i).map(|x| mint_item::<T, I>(x as u16).0).collect::<Vec<_>>();
    } : {
        Nfts::<T, I>::owned_in_collection(&collection, &caller)
    }

Weight benchmarking result for BalanceOf.

	/// The range of component `i` is `[0, 5000]`.
	fn owned_in_collection(i: u32, ) -> Weight {
		// Proof Size summary in bytes:
		//  Measured:  `0`
		//  Estimated: `0`
		// Minimum execution time: 2_000_000 picoseconds.
		Weight::from_parts(3_905_593, 0)
			// Standard Error: 26
			.saturating_add(Weight::from_parts(469, 0).saturating_mul(i.into()))
	}

cc: @Daanvdplas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: local non-fungible use cases
2 participants