Skip to content

Commit

Permalink
finally fixed shade-protocol build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kent-3 committed Nov 25, 2023
1 parent 306fbb0 commit e3f1af7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 28 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ resolver = "2"
members = [
# Packages
"packages/shade_protocol",
#"packages/shadeswap_shared",
# "packages/secretcli",
"packages/multi_test",
"packages/multi_derive",
Expand Down
13 changes: 7 additions & 6 deletions packages/shade_protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ name = "schemas"
path = "src/schemas.rs"
# Must have all of the contract_interfaces
required-features = [
"admin", "airdrop", "bonds", "dao", "dex", "governance-impl", "mint", "oracles",
"peg_stability", "query_auth", "sky", "snip20", "staking", "mint_router", "snip20_migration", "liquidity_book"
"admin", "airdrop", "bonds", "dao", "dex", "governance-impl", "mint", "mint_router",
"oracles", "peg_stability", "query_auth", "sky", "snip20", "snip20_migration",
"staking", "swap", "liquidity_book",
]

[lib]
Expand All @@ -35,7 +36,7 @@ storage = ["dao-utils"]
storage_plus = ["storage", "dep:secret-storage-plus", "chrono"]
query_auth_lib = ["dep:query-authentication"]
multi-test = ["dep:secret-multi-test", "dep:anyhow", "interface"]
lb-libraries = ["swap", "snip20", "interface"]
lb-libraries = ["swap", "snip20", "interface", "liquidity_book"]

# Implementing new contracts:
# Contracts packages are divided by two different features, the interface and the implementation
Expand Down Expand Up @@ -87,8 +88,8 @@ dao = ["interface", "cosmwasm-std/staking"]
admin = ["interface"]
peg_stability = ["sky-utils", "adapter"]
snip20_migration = []
liquidity_book = ["interface"]
swap = ["snip20"]
liquidity_book = ["interface", "swap"]
swap = ["snip20"]

chrono = ["dep:chrono"]

Expand All @@ -105,7 +106,7 @@ snip20-impl = ["snip20", "query_auth_impl"]
query_auth_impl = ["implementation", "query_auth", "dep:base64"]
sky-utils = ["implementation", "sky"]
admin_impl = ["implementation", "admin"]
liquidity_book_impl = ["liquidity_book", "implementation"]
# liquidity_book_impl = ["liquidity_book", "implementation", "swap"]

# for quicker tests, cargo test --lib
# for more explicit tests, cargo test --features=backtraces
Expand Down
4 changes: 2 additions & 2 deletions packages/shade_protocol/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::clone_double_ref)]
#![allow(suspicious_double_ref_op)]

// TODO: make private later
pub mod contract_interfaces;
Expand Down Expand Up @@ -41,7 +41,7 @@ pub use anyhow::Result as AnyResult;
#[cfg(feature = "utils")]
pub use utils::asset::Contract;

#[cfg(feature = "lb-libraries")]
#[cfg(all(feature = "lb-libraries", feature = "swap"))]
pub use utils::liquidity_book as lb_libraries;

#[cfg(feature = "chrono")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
//!
//! This library contains functions to help interaction with bins.
use crate::{
c_std::{Addr, BankMsg, Coin, CosmosMsg, Uint128},
contract_interfaces::swap::core::TokenType,
};
use crate::c_std::{Addr, BankMsg, Coin, CosmosMsg, Uint128};
use ethnum::U256;

use crate::swap::core::TokenType;
use super::{
constants::{SCALE, SCALE_OFFSET},
fee_helper::{FeeError, FeeHelper},
Expand Down
24 changes: 10 additions & 14 deletions packages/shade_protocol/src/utils/liquidity_book/types.rs
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
//! ### Liquidity Book Type Library
//! Author: Kent
//! Author: Kent and Haseeb
//!
//! This library contains common types used throughout the project.
use cosmwasm_schema::cw_serde;
use cosmwasm_std::ContractInfo;
use ethnum::U256;

use crate::swap::core::TokenType;
use crate::{
c_std::ContractInfo,
cosmwasm_schema::cw_serde,
};
pub use crate::utils::liquidity_book::math::{
liquidity_configurations::LiquidityConfigurations,
tree_math::TreeUint24,
};
// TODO - Try to not use this type in the liquidity_book module, because it's gated by the "swap"
// feature.
use crate::contract_interfaces::swap::core::TokenType;

pub type Bytes32 = [u8; 32];

/// Info needed to instantiate a contract.
// TODO - This type belongs somewhere else. It's not specific to liquidity_book.
#[cw_serde]
#[derive(Default)]
pub struct ContractInstantiationInfo {
pub id: u64,
pub code_hash: String,
}
/// Pair parameters that don't change.
/// * `base_factor`
/// * `filter_period`
/// * `decay_period`
/// * `reduction_factor`
/// * `variable_fee_control`
/// * `protocol_share`
/// * `max_volatility_accumulator`

#[cw_serde]
pub struct StaticFeeParameters {
pub base_factor: u16,
Expand Down
1 change: 1 addition & 0 deletions packages/shade_protocol/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub mod generic_response;

pub mod storage;

#[cfg(all(feature = "lb-libraries", feature = "swap"))]
pub mod liquidity_book;

#[cfg(feature = "dao-utils")]
Expand Down

0 comments on commit e3f1af7

Please sign in to comment.