Skip to content

Commit

Permalink
Merge pull request #107 from CosmWasm/migrate-to-v0.11-2
Browse files Browse the repository at this point in the history
Migrate to v0.11 2
  • Loading branch information
ethanfrey authored Oct 7, 2020
2 parents 17b5781 + f564e65 commit b575937
Show file tree
Hide file tree
Showing 14 changed files with 352 additions and 392 deletions.
206 changes: 63 additions & 143 deletions Cargo.lock

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

11 changes: 5 additions & 6 deletions contracts/cw20-escrow/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use cosmwasm_std::{
attr, from_binary, to_binary, Api, BankMsg, Binary, CosmosMsg, Env, Extern, HandleResponse,
HumanAddr, InitResponse, Querier, StdResult, Storage, WasmMsg,
};
use cosmwasm_storage::prefixed;

use cw2::set_contract_version;
use cw20::{Cw20Coin, Cw20CoinHuman, Cw20HandleMsg, Cw20ReceiveMsg};
Expand All @@ -12,7 +11,7 @@ use crate::error::ContractError;
use crate::msg::{
CreateMsg, DetailsResponse, HandleMsg, InitMsg, ListResponse, QueryMsg, ReceiveMsg,
};
use crate::state::{all_escrow_ids, escrows, escrows_read, Escrow, GenericBalance, PREFIX_ESCROW};
use crate::state::{all_escrow_ids, escrows, escrows_read, Escrow, GenericBalance};

// version info for migration info
const CONTRACT_NAME: &str = "crates.io:cw20-escrow";
Expand Down Expand Up @@ -157,8 +156,8 @@ pub fn try_approve<S: Storage, A: Api, Q: Querier>(
} else if escrow.is_expired(&env) {
Err(ContractError::Expired {})
} else {
// we delete the escrow (TODO: expose this in Bucket for simpler API)
prefixed(&mut deps.storage, PREFIX_ESCROW).remove(id.as_bytes());
// we delete the escrow
escrows(&mut deps.storage).remove(id.as_bytes());

let rcpt = deps.api.human_address(&escrow.recipient)?;

Expand Down Expand Up @@ -188,8 +187,8 @@ pub fn try_refund<S: Storage, A: Api, Q: Querier>(
{
Err(ContractError::Unauthorized {})
} else {
// we delete the escrow (TODO: expose this in Bucket for simpler API)
prefixed(&mut deps.storage, PREFIX_ESCROW).remove(id.as_bytes());
// we delete the escrow
escrows(&mut deps.storage).remove(id.as_bytes());

let rcpt = deps.api.human_address(&escrow.source)?;

Expand Down
Loading

0 comments on commit b575937

Please sign in to comment.