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: add cw721-non-transferable contract #85

Merged
merged 3 commits into from
Oct 22, 2022

Conversation

eliseoci
Copy link
Contributor

@eliseoci eliseoci commented Oct 8, 2022

This PR includes a contract for implementing non-transferable (aka soulbound) NFTs.

JakeHartnell
JakeHartnell previously approved these changes Oct 18, 2022
Copy link
Collaborator

@larry0x larry0x left a comment

Choose a reason for hiding this comment

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

Three major issues I found:

  • admin address is not validated
  • cw2 contract version is overwritten
  • there isn't a query method for the admin address

contracts/cw721-non-transferable/src/msg.rs Outdated Show resolved Hide resolved
ExecuteMsg::Mint(msg) => {
Cw721NonTransferableContract::default().mint(deps, env, info, msg)
}
_ => Err(ContractError::Unauthorized {}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Personally I prefer more descriptive error messages than just "unauthorized", e.g. something like "only admin can transfer this token". However I understand this requires modifying the error type in cw721-base which is out-of-scope for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 for more descriptive errors, but as you said, adding a new error type to the cw721-base is out-of-scope, will take it into account for a future PR

contracts/cw721-non-transferable/src/lib.rs Outdated Show resolved Hide resolved
contracts/cw721-non-transferable/Cargo.toml Outdated Show resolved Hide resolved
contracts/cw721-non-transferable/src/lib.rs Outdated Show resolved Hide resolved
contracts/cw721-non-transferable/src/lib.rs Outdated Show resolved Hide resolved
contracts/cw721-non-transferable/src/lib.rs Outdated Show resolved Hide resolved
@eliseoci
Copy link
Contributor Author

Thanks for the great feedback @larry0x! I've addressed your comments. Lmk if it looks good to you.

On another topic, I've mistakenly opened the PR from my fork's main branch instead of the feature one. I can open a new PR and close this one to not have those annoying merge pull request commits in the log history, if you prefer.

@larry0x
Copy link
Collaborator

larry0x commented Oct 20, 2022

I can open a new PR and close this one to not have those annoying merge pull request commits

I would just squash-merge

contracts/cw721-non-transferable/src/msg.rs Outdated Show resolved Hide resolved
contracts/cw721-non-transferable/src/msg.rs Outdated Show resolved Hide resolved
contracts/cw721-non-transferable/src/query.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@larry0x larry0x left a comment

Choose a reason for hiding this comment

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

One final comment. Everything else looks good to me

contracts/cw721-non-transferable/src/lib.rs Outdated Show resolved Hide resolved
@JakeHartnell JakeHartnell merged commit 4df70f9 into public-awesome:main Oct 22, 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.

4 participants