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

cleanup and minor changes #173

Merged
merged 13 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
13 changes: 11 additions & 2 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ documentation = "https://docs.cosmwasm.com"
rust-version = "1.78"

[workspace.dependencies]
anyhow = "^1.0"
bech32 = "^0.11"
cosmwasm-schema = "^1.5"
cosmwasm-std = "^1.5"
cw2 = "^1.1"
Expand All @@ -30,6 +32,7 @@ cw-storage-plus = "^1.1"
cw-utils = "^1.0"
schemars = "^0.8"
serde = { version = "^1.0", default-features = false, features = ["derive"] }
sha2 = "^0.10"
thiserror = "^1.0"
url = "^2.5"

Expand Down
12 changes: 0 additions & 12 deletions build.sh

This file was deleted.

10 changes: 4 additions & 6 deletions contracts/cw2981-royalties/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ pub type MetadataWithRoyaltyMsg = MetadataWithRoyalty;
impl StateFactory<MetadataWithRoyalty> for MetadataWithRoyaltyMsg {
fn create(
&self,
deps: Option<Deps>,
env: Option<&Env>,
deps: Deps,
env: &Env,
info: Option<&MessageInfo>,
current: Option<&MetadataWithRoyalty>,
) -> Result<MetadataWithRoyalty, Cw721ContractError> {
Expand Down Expand Up @@ -303,16 +303,15 @@ impl StateFactory<MetadataWithRoyalty> for MetadataWithRoyaltyMsg {

fn validate(
&self,
deps: Option<Deps>,
_env: Option<&Env>,
deps: Deps,
_env: &Env,
info: Option<&MessageInfo>,
current: Option<&MetadataWithRoyalty>,
) -> Result<(), Cw721ContractError> {
// assert here is different to NFT Info:
// - creator and minter can create NFT metadata
// - only creator can update NFT metadata
if current.is_none() {
let deps = deps.ok_or(Cw721ContractError::NoDeps)?;
let info = info.ok_or(Cw721ContractError::NoInfo)?;
// current is none: minter and creator can create new NFT metadata
let minter_check = assert_minter(deps.storage, &info.sender);
Expand All @@ -321,7 +320,6 @@ impl StateFactory<MetadataWithRoyalty> for MetadataWithRoyaltyMsg {
return Err(Cw721ContractError::NotMinterOrCreator {});
}
} else {
let deps = deps.ok_or(Cw721ContractError::NoDeps)?;
let info = info.ok_or(Cw721ContractError::NoInfo)?;
// current is some: only creator can update NFT metadata
assert_creator(deps.storage, &info.sender)?;
Expand Down
13 changes: 7 additions & 6 deletions contracts/cw721-base/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_schema::{export_schema_with_title, remove_schemas, schema_for};
use cosmwasm_schema::{remove_schemas, write_api};
use cw721_base::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use std::env::current_dir;
use std::fs::create_dir_all;
Expand All @@ -9,9 +9,10 @@ fn main() {
create_dir_all(&out_dir).unwrap();
remove_schemas(&out_dir).unwrap();

// entry points - generate always with title for avoiding name suffixes like "..._empty_for_..." due to generics
export_schema_with_title(&schema_for!(InstantiateMsg), &out_dir, "InstantiateMsg");
export_schema_with_title(&schema_for!(ExecuteMsg), &out_dir, "ExecuteMsg");
export_schema_with_title(&schema_for!(QueryMsg), &out_dir, "QueryMsg");
export_schema_with_title(&schema_for!(MigrateMsg), &out_dir, "MigrateMsg");
write_api! {
instantiate: InstantiateMsg,
execute: ExecuteMsg,
query: QueryMsg,
migrate: MigrateMsg,
}
}
Loading