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

Move shared Balance struct to cw20 #118

Merged
merged 1 commit into from
Oct 12, 2020
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
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed the reference, but I don't see the file removed in this diff

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh.... nevermind, it was moved to cw20. Excellent!


#[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