Skip to content

Commit

Permalink
Merge pull request #72 from CosmWasm/fix-44
Browse files Browse the repository at this point in the history
  • Loading branch information
shanev authored Jul 23, 2022
2 parents 93ee310 + e398df1 commit a8dbfaf
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 43 deletions.
66 changes: 34 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contracts/cw2981-royalties/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cw2 = "0.13.4"
cw721 = { path = "../../packages/cw721", version = "0.13.4" }
cw721-base = { path = "../cw721-base", version = "0.13.4", features = [
"library",
Expand Down
18 changes: 13 additions & 5 deletions contracts/cw2981-royalties/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
pub mod msg;
pub mod query;

use cosmwasm_std::to_binary;
pub use query::{check_royalties, query_royalties_info};

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::msg::Cw2981QueryMsg;
use cosmwasm_std::Empty;
use cosmwasm_std::{to_binary, Empty};
use cw2::set_contract_version;
use cw721_base::Cw721Contract;
pub use cw721_base::{ContractError, InstantiateMsg, MintMsg, MinterResponse};

// Version info for migration
const CONTRACT_NAME: &str = "crates.io:cw2981-royalties";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Default)]
pub struct Trait {
pub display_type: Option<String>,
Expand Down Expand Up @@ -56,12 +60,16 @@ pub mod entry {

#[entry_point]
pub fn instantiate(
deps: DepsMut,
mut deps: DepsMut,
env: Env,
info: MessageInfo,
msg: InstantiateMsg,
) -> StdResult<Response> {
Cw2981Contract::default().instantiate(deps, env, info, msg)
) -> Result<Response, ContractError> {
let res = Cw2981Contract::default().instantiate(deps.branch(), env, info, msg)?;
// Explicitly set contract name and version, otherwise set to cw721-base info
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)
.map_err(ContractError::Std)?;
Ok(res)
}

#[entry_point]
Expand Down
2 changes: 1 addition & 1 deletion contracts/cw721-base/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::error::ContractError;
use crate::msg::{ExecuteMsg, InstantiateMsg, MintMsg};
use crate::state::{Approval, Cw721Contract, TokenInfo};

// version info for migration info
// Version info for migration
const CONTRACT_NAME: &str = "crates.io:cw721-base";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

Expand Down
1 change: 1 addition & 0 deletions contracts/cw721-metadata-onchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cw2 = "0.13.4"
cw721 = { path = "../../packages/cw721", version = "0.13.4" }
cw721-base = { path = "../cw721-base", version = "0.13.4", features = [
"library",
Expand Down
17 changes: 12 additions & 5 deletions contracts/cw721-metadata-onchain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use cosmwasm_std::Empty;
use cw2::set_contract_version;
pub use cw721_base::{ContractError, InstantiateMsg, MintMsg, MinterResponse, QueryMsg};

// Version info for migration
const CONTRACT_NAME: &str = "crates.io:cw721-metadata-onchain";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Default)]
pub struct Trait {
pub display_type: Option<String>,
Expand Down Expand Up @@ -37,17 +42,19 @@ pub mod entry {
use cosmwasm_std::entry_point;
use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult};

// This is a simple type to let us handle empty extensions

// This makes a conscious choice on the various generics used by the contract
#[entry_point]
pub fn instantiate(
deps: DepsMut,
mut deps: DepsMut,
env: Env,
info: MessageInfo,
msg: InstantiateMsg,
) -> StdResult<Response> {
Cw721MetadataContract::default().instantiate(deps, env, info, msg)
) -> Result<Response, ContractError> {
let res = Cw721MetadataContract::default().instantiate(deps.branch(), env, info, msg)?;
// Explicitly set contract name and version, otherwise set to cw721-base info
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)
.map_err(ContractError::Std)?;
Ok(res)
}

#[entry_point]
Expand Down

0 comments on commit a8dbfaf

Please sign in to comment.