Skip to content

Commit

Permalink
Merge pull request #118 from CosmWasm/move-balance-struct
Browse files Browse the repository at this point in the history
Move shared Balance struct to cw20
  • Loading branch information
ethanfrey authored Oct 12, 2020
2 parents d87c3ae + 666f265 commit 8a8058a
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

3 changes: 1 addition & 2 deletions contracts/cw20-atomic-swap/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ use sha2::{Digest, Sha256};

use cw0::calc_range_start_string;
use cw2::set_contract_version;
use cw20::{Cw20Coin, Cw20CoinHuman, Cw20HandleMsg, Cw20ReceiveMsg};
use cw20::{Balance, Cw20Coin, Cw20CoinHuman, Cw20HandleMsg, Cw20ReceiveMsg};

use crate::balance::Balance;
use crate::error::ContractError;
use crate::msg::{
is_valid_name, BalanceHuman, CreateMsg, DetailsResponse, HandleMsg, InitMsg, ListResponse,
Expand Down
1 change: 0 additions & 1 deletion contracts/cw20-atomic-swap/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod balance;
pub mod contract;
mod error;
pub mod msg;
Expand Down
3 changes: 1 addition & 2 deletions contracts/cw20-atomic-swap/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::balance::Balance;
use cosmwasm_std::{
Binary, BlockInfo, CanonicalAddr, Order, ReadonlyStorage, StdError, StdResult, Storage,
};
use cosmwasm_storage::{bucket, bucket_read, prefixed_read, Bucket, ReadonlyBucket};
use cw20::Expiration;
use cw20::{Balance, Expiration};

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Default)]
pub struct AtomicSwap {
Expand Down
1 change: 0 additions & 1 deletion contracts/cw20-escrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cw20-atomic-swap = { path = "../cw20-atomic-swap", version = "0.2.3", default-features=false, features = ["library"] }
cw0 = { path = "../../packages/cw0", version = "0.2.3" }
cw2 = { path = "../../packages/cw2", version = "0.2.3" }
cw20 = { path = "../../packages/cw20", version = "0.2.3" }
Expand Down
3 changes: 1 addition & 2 deletions contracts/cw20-escrow/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use cosmwasm_std::{
};

use cw2::set_contract_version;
use cw20::{Cw20Coin, Cw20CoinHuman, Cw20HandleMsg, Cw20ReceiveMsg};
use cw20_atomic_swap::balance::Balance;
use cw20::{Balance, Cw20Coin, Cw20CoinHuman, Cw20HandleMsg, Cw20ReceiveMsg};

use crate::error::ContractError;
use crate::msg::{
Expand Down
3 changes: 1 addition & 2 deletions contracts/cw20-escrow/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use cosmwasm_std::{
};
use cosmwasm_storage::{bucket, bucket_read, prefixed_read, Bucket, ReadonlyBucket};

use cw20::Cw20Coin;
use cw20_atomic_swap::balance::Balance;
use cw20::{Balance, Cw20Coin};

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug, Default)]
pub struct GenericBalance {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use serde::{Deserialize, Serialize};

use cosmwasm_std::Coin;
use cw0::NativeBalance;
use cw20::Cw20Coin;

use crate::Cw20Coin;

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
Expand Down
2 changes: 2 additions & 0 deletions packages/cw20/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod balance;
mod coin;
mod helpers;
mod msg;
Expand All @@ -6,6 +7,7 @@ mod receiver;

pub use cw0::Expiration;

pub use crate::balance::Balance;
pub use crate::coin::{Cw20Coin, Cw20CoinHuman};
pub use crate::helpers::{Cw20CanonicalContract, Cw20Contract};
pub use crate::msg::Cw20HandleMsg;
Expand Down

0 comments on commit 8a8058a

Please sign in to comment.