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

fix(contract-standards): remove mint function from exposed nft standard and trait #525

Merged
merged 7 commits into from
Aug 19, 2021

Conversation

austinabell
Copy link
Contributor

@austinabell austinabell commented Aug 10, 2021

Seems like the nft example uses a wrapper definition of mint which is marked as payable, meaning the base impl function is broken. Going to dig a bit deeper into this, but opening for expediency to make sure if wrong that it makes it in for the next release.

Hides mint function from being exposed and removes it from the NonFungibleTokenCore trait, as it is not part of the standard.

Closes #522

@austinabell
Copy link
Contributor Author

Actually, this is somewhat of a bigger issue, the mint function is exposed as part of the API of any contract which uses the standard, when it really shouldn't be. I'm wondering why mint is part of the trait.

@austinabell austinabell changed the title fix(contract-standards): add payable annotation to mint token standard fix(contract-standards): remove mint function from exposed nft standard and trait Aug 10, 2021
/// * token_id must be unique
///
/// Returns the newly minted token
pub fn mint(
Copy link
Contributor

Choose a reason for hiding this comment

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

still need to mark it as payable i think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, this is doing the opposite, which is not exposing this function for external calls at all.

Looking at this again, I think this function can just be removed altogether, the mint functionality can still be called through the NonFungibleToken as the NFT example does. I was just trying to mitigate breaking changes but I think this just causes more issues for no benefit.

Any objections from removing this function from the NFT trait which is not part of the standard and this no longer by default exposes the mint function which is currently broken anyway on its current version? cc @mikedotexe

Copy link
Contributor

@danielwpz danielwpz Aug 12, 2021

Choose a reason for hiding this comment

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

got your point.
still prefer to keep this function, mark it as payable (other mechanism shall be used to make it internal), in order to avoid any breaking changes. But if you guys are ok to remove this function totally I'm good with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got your point.
still prefer to keep this function, mark it as payable (other mechanism shall be used to make it internal), in order to avoid any breaking changes. But if you guys are ok to remove this function totally I'm good with it.

well, the only breaking change is no longer externally exposing a function that was broken and should not have been included in the standard in the first place. You can still use the mint functionality as the example does, too. I'll wait on @mikedotexe's take or maybe @chadoh since he worked on the standard also.

@danielwpz
Copy link
Contributor

Hey, moving mint function out of the core trait looks good to me!
However we still need to mark it as payable to make it callable.

Copy link
Contributor

@mikedotexe mikedotexe left a comment

Choose a reason for hiding this comment

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

Thanks for catching this, I had no idea it was in the NonFungibleTokenCore. My memory was that mint was only in lib.rs and never in the near-contract-standards crate at all. Good catch and thanks for the patience.

@mikedotexe mikedotexe merged commit 42c7734 into master Aug 19, 2021
@mikedotexe mikedotexe deleted the austin/nft_mint_payable branch August 19, 2021 01:57
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.

NFT mint not payable
3 participants