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

allow minting directly to nft #178

Merged
merged 9 commits into from
Jul 7, 2022
Merged

allow minting directly to nft #178

merged 9 commits into from
Jul 7, 2022

Conversation

bmacer
Copy link
Contributor

@bmacer bmacer commented Jun 10, 2022

This is basic implementation but some missing pieces

  • need to add tests:
  • mint to nft works,
  • mint to nft fails if nft doesn't exist,
  • mint to non-owned nft results in pending state
  • other tests?
  • currently i think minting to a non-owned nft with resources will leave each resource in pending state, which is likely undesirable. we want the resources accepted on minted adds. two possible solutions: (1) implement an auto-accept right after the resource add inside of the mint [con: bunch of events, maybe more weight], (2) add an during_mint parameter to resource_add, which would override the requirement for sender to equal owner. i'd vote for option 2.

@bmacer
Copy link
Contributor Author

bmacer commented Jun 11, 2022

Fixed the last issue, where ALICE mints an NFT with resources to a BOB-owned NFT. The issue is that these resources would all be in a pending state (because BOB is not the rootowner of the collection). Not ideal, the resources should be auto-accepted (after all the NFT itself is already in a pending state, no need to require an accept for every resource in addition to the NFT itself (again only in the case of a mint_nft extrinsic.

@bmacer bmacer requested a review from ilionic June 11, 2022 22:33
@bmacer
Copy link
Contributor Author

bmacer commented Jun 12, 2022

Fixes #173

@HashWarlock
Copy link
Contributor

We should create a separate function for this instead.

Copy link
Contributor

@ilionic ilionic left a comment

Choose a reason for hiding this comment

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

Works well, thank you.

@ilionic
Copy link
Contributor

ilionic commented Jun 22, 2022

@HashWarlock can you please clarify about separate function.

@HashWarlock
Copy link
Contributor

@HashWarlock can you please clarify about separate function.

We should have a function that mints an NFT to an owner and separate function to mint to an NFT. This keeps from one function doing too much.

@bmacer
Copy link
Contributor Author

bmacer commented Jun 24, 2022

@HashWarlock can you please clarify about separate function.

We should have a function that mints an NFT to an owner and separate function to mint to an NFT. This keeps from one function doing too much.

I think I disagree with this making things too complicated, but will trust your judgment. Working on decoupling the enum and implementing fix.

@bmacer
Copy link
Contributor Author

bmacer commented Jun 24, 2022

after a mighty long struggle with decoupling efforts, i've come to agree that decoupling is best. @HashWarlock can you take a peak again when you get a chance?

@bmacer bmacer requested review from ilionic and HashWarlock June 24, 2022 20:51
fn nft_mint_directly_to_nft(
sender: T::AccountId,
owner: (CollectionId, NftId),
collection_id: CollectionId,
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't collection_id redundant now, because it's already part of owner tuple?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, owner is the identifier of the NFT that will own the new NFT, collection_id is where the NFT should be minted into. I'd expect we don't want to require these collections be the same.

@bmacer bmacer merged commit 4b04e9f into main Jul 7, 2022
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.

3 participants