public-awesome / cw-nfts

Examples and helpers to build NFT contracts on CosmWasm
Apache License 2.0
188 stars 180 forks source link

Cw721-base: Minter attribute #137

Closed Morgandri1 closed 1 year ago

Morgandri1 commented 1 year ago

Hey guys, i'm super new to this and came across this issue when testing:

error[E0609]: no field `minter` on type `cw721_base::Cw721Contract<'_, T, C, E, Q>`
  --> src/upgrades/v0_17.rs:15:26
   |
15 |     let minter = tract16.minter.load(deps.storage)?;
   |                          ^^^^^^ unknown field
   |
   = note: available fields are: `contract_info`, `token_count`, `operators`, `tokens`

error[E0609]: no field `minter` on type `cw721_base::Cw721Contract<'_, T, C, E, Q>`
  --> src/upgrades/v0_17.rs:16:13
   |
16 |     tract16.minter.remove(deps.storage);
   |             ^^^^^^ unknown field
   |
   = note: available fields are: `contract_info`, `token_count`, `operators`, `tokens`

For more information about this error, try `rustc --explain E0609`.
error: could not compile `injective721` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0308]: mismatched types
   --> src/multi_tests.rs:134:5
    |
134 |     assert_eq!(m.minter, admin().to_string());
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     expected `Option<String>`, found `String`
    |     expected because this is `std::option::Option<std::string::String>`
    |
    = note: expected enum `std::option::Option<std::string::String>`
             found struct `std::string::String`
    = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in `Some`
   --> /Users/metatron/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/macros/mod.rs:40:35
    |
40  |                 if !(*left_val == Some(*right_val)) {
    |                                   +++++          +

Some errors have detailed explanations: E0308, E0609.
For more information about an error, try `rustc --explain E0308`.

It seems the default contract wasnt fully migrated? let me know. thanks

taitruong commented 1 year ago

Assuming you are upgrading to v0.18.0. This might be related to https://github.com/CosmWasm/cw-nfts/issues/132

taitruong commented 1 year ago

Simply said, migration logic expects contract to be version v0.16.0, but most likely contract is v0.17 or later.