-
Notifications
You must be signed in to change notification settings - Fork 181
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
Make cw721-base minter updatable via two-step ownership transfer. #109
Conversation
This makes a breaking change to cw721-base in that it makes the `minter` field on `cw721_base::MinterResponse` optional. Before: ```rust pub struct MinterResponse { pub minter: String, } ``` After: ```rust pub struct MinterResponse { pub minter: Option<String>, } ``` It also makes a breaking change to the `ContractError` enum in that it removes the `Unauthorized` variant in favor of cw-ownable's more descriptive `OwnershipError`. It then extends the `cw721_base`, but not the `cw721` standard's, `ExecuteMsg` with [`cw-ownable`](https://crates.io/crates/cw-ownable)'s `UpdateOwnership` enum variant, and extends the `QueryMsg` with `cw-ownable`'s `Ownership {}` query. Using these messages, the current minter on the contract may nominate a new minter, who may accept or reject this nomination.
@shanev , @JakeHartnell , @larry0x - i'd be interested in your feedback about this. we'd like to use something like this in DAO DAO to allow NFT DAOs to bootstrap themselves. ICS-721 would possibly also benefit from a more flexible ownership scheme as it could allow the owner to control rate-limits and other parameters relevant to their collection moving to other chains (where they could lose royalty protections, for example, when leaving Stargaze). the change i've made here tries to limit API breakage by not renaming the |
Damn, I really want to do this but feel it would be a pain for a lot of folks... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay cw-ownable adoption!
Opinions from @shanev @jhernandezb should be the most important regarding API breakages... What do you guys think about:
|
@0xekez I think you can consider adding (For context: cw-ownable uses a syntax only available since Rust 1.65) |
626443c
to
44fc891
Compare
44fc891
to
21e0c3e
Compare
7cc7bd3
to
153fe5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully support this since Stargaze NFT DAOs will also need this to bootstrap themselves. My only concern is that use of the term ownership
can be confused with NFT ownership.
I think it would be nice to have an example of how to migrate a contract from previous versions in case someone misses it and leaves a contract uninitialized. |
The way I suggest to do this is to create an
Each To migrate a custom cw721 contract from v0.16 to v0.17, simply do: #[entry_point]
fn migrate(deps: Deps, env: Env, msg: MigrateMsg) -> Result<Response, ContractError> {
cw721_base::migrations::v0_17::migrate(deps, env, msg)?;
Ok(Response::new())
} |
I can imagine this would be tricky for Stargaze tho... Since each NFT collection is a separate contract, we have to migrate each one of them. It may be useful to create an sdk module that registers each collection, and provide a governance-gated message to migrate them all together. |
I governance proposal would be a nice one to have, currently creators have admin and can do the migration themselves through our studio UI. Your proposed solution sounds good to me |
3178a72
to
ec5e60b
Compare
good idea, i've added migration logic and added this to the README: Updating the minterFor contract versions
Before 0.16: pub struct MinterResponse {
pub minter: String,
} After 0.16: pub struct MinterResponse {
pub minter: Option<String>,
} NFTs on version 0.16 may upgrade via |
i'll merge this tomorrow if there are no more comments before then |
263036d
to
6b934b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xekez The additions of MIGRATING.md
and v0_16.rs
look good! I left a two comments.
@0xekez @JakeHartnell I'd say this PR is ready to be merged! However, please don't cut a release for 0.17 yet. I say we include #106, perhaps also #107, and I also have a suggestion to how we do cw2 versioning in cw721-base which I'll do a PR shortly. |
Co-authored-by: Larry Engineer <[email protected]>
This makes a breaking change to cw721-base in that it makes the
minter
field oncw721_base::MinterResponse
optional.Before:
After:
It also makes a breaking change to the
ContractError
enum in that it removes theUnauthorized
variant in favor of cw-ownable's more descriptiveOwnershipError
.It then extends the
cw721_base
, but not thecw721
standard's,ExecuteMsg
withcw-ownable
'sUpdateOwnership
enum variant, and extends theQueryMsg
withcw-ownable
'sOwnership {}
query. Using these messages, the current minter on the contract may nominate a new minter, who may accept or reject this nomination.