Skip to content

Commit

Permalink
fix pull request suggestions
Browse files Browse the repository at this point in the history
- Use entry_point macro
- bump dependencies to alpha3
- Remove unused struct
  • Loading branch information
yihuang committed Apr 8, 2021
1 parent 829ace7 commit 60640f7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

10 changes: 5 additions & 5 deletions contracts/cw1155-base/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw1155-base"
version = "0.6.0-alpha1"
version = "0.6.0-alpha3"
authors = ["Huang Yi <huang@crypto.com>"]
edition = "2018"
description = "Basic implementation of a CosmWasm-1155 compliant token"
Expand All @@ -18,10 +18,10 @@ backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cw0 = { path = "../../packages/cw0", version = "0.6.0-alpha1" }
cw2 = { path = "../../packages/cw2", version = "0.6.0-alpha1" }
cw1155 = { path = "../../packages/cw1155", version = "0.6.0-alpha1" }
cw-storage-plus = { path = "../../packages/storage-plus", version = "0.6.0-alpha1" , features = ["iterator"]}
cw0 = { path = "../../packages/cw0", version = "0.6.0-alpha3" }
cw2 = { path = "../../packages/cw2", version = "0.6.0-alpha3" }
cw1155 = { path = "../../packages/cw1155", version = "0.6.0-alpha3" }
cw-storage-plus = { path = "../../packages/storage-plus", version = "0.6.0-alpha3" , features = ["iterator"]}
cosmwasm-std = { version = "0.14.0-beta1", features = ["iterator"] }
schemars = "0.7"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
Expand Down
8 changes: 7 additions & 1 deletion contracts/cw1155-base/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use cosmwasm_std::entry_point;
use cosmwasm_std::{
to_binary, Api, Binary, Deps, DepsMut, Env, HumanAddr, MessageInfo, Order, Response, StdResult,
Uint128, KV,
Expand All @@ -23,6 +24,7 @@ const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
const DEFAULT_LIMIT: u32 = 10;
const MAX_LIMIT: u32 = 30;

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn instantiate(
deps: DepsMut,
_env: Env,
Expand All @@ -42,6 +44,7 @@ pub struct ExecuteEnv<'a> {
info: MessageInfo,
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn execute(
deps: DepsMut,
env: Env,
Expand Down Expand Up @@ -85,7 +88,9 @@ pub fn execute(

/// When from is None: mint new coins
/// When to is None: burn coins
/// When both are None: not token balance is changed, meaningless but valid
/// When both are None: no token balance is changed, pointless but valid
///
/// Make sure permissions are checked before calling this.
fn execute_transfer_inner<'a>(
deps: &'a mut DepsMut,
from: Option<&'a HumanAddr>,
Expand Down Expand Up @@ -402,6 +407,7 @@ pub fn execute_revoke_all(env: ExecuteEnv, operator: HumanAddr) -> Result<Respon
Ok(rsp)
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn query(deps: Deps, env: Env, msg: Cw1155QueryMsg) -> StdResult<Binary> {
match msg {
Cw1155QueryMsg::Balance { owner, token_id } => {
Expand Down
3 changes: 0 additions & 3 deletions contracts/cw1155-base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ pub mod contract;
mod error;
mod msg;
mod state;

#[cfg(all(target_arch = "wasm32", not(feature = "library")))]
cosmwasm_std::create_entry_points!(contract);
10 changes: 0 additions & 10 deletions contracts/cw1155-base/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use cosmwasm_std::{CanonicalAddr, Uint128};
use cw1155::Expiration;
use cw_storage_plus::{Item, Map};

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
pub struct Approval {
/// Account that can transfer/send the token
pub spender: CanonicalAddr,
/// When the Approval expires (maybe Expiration::never)
pub expires: Expiration,
}
/// Store the minter address who have permission to mint new tokens.
pub const MINTER: Item<CanonicalAddr> = Item::new("minter");
/// Store the balance map, `(owner, token_id) -> balance`
Expand Down

0 comments on commit 60640f7

Please sign in to comment.