Skip to content

Commit

Permalink
chore: Manual fixups for files
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFable committed Jan 31, 2024
1 parent 07a19a7 commit a9d1a8e
Show file tree
Hide file tree
Showing 44 changed files with 523 additions and 375 deletions.
405 changes: 277 additions & 128 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ anyhow = { version = "1.0.71"}
cw-controllers = { version = "1.1.0"}
cw-ownable = { version = "0.5.1"}
anybuf = { version = "0.3.0"}
sha2 = { version = "0.10.8"}
sha2 = { version = "=0.10.8"}
sha256 = { version = "1.4.0"}
protobuf = { version = "=3.2.0", features = ["with-bytes"] }
prost = { version = "0.11.9", default-features = false, features = [
Expand Down
2 changes: 1 addition & 1 deletion contracts/liquidity_hub/epoch-manager/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ use white_whale_std::epoch_manager::epoch_manager::{Config, EpochV2};
pub const CONFIG: Item<Config> = Item::new("config");
pub const ADMIN: Admin = Admin::new("admin");
pub const HOOKS: Hooks = Hooks::new("hooks");
pub const EPOCHS: Map<&[u8], Epoch> = Map::new("epochs");
pub const EPOCHS: Map<&[u8], EpochV2> = Map::new("epochs");
4 changes: 2 additions & 2 deletions contracts/liquidity_hub/epoch-manager/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cosmwasm_std::{DepsMut, MessageInfo, Response, Uint64};

use epoch_manager::contract::{execute, instantiate};
use epoch_manager::ContractError;
use white_whale::epoch_manager::epoch_manager::{Epoch, EpochConfig, ExecuteMsg, InstantiateMsg};
use white_whale_std::epoch_manager::epoch_manager::{EpochV2, EpochConfig, ExecuteMsg, InstantiateMsg};

/// Mocks contract instantiation.
pub(crate) fn mock_instantiation(
Expand All @@ -12,7 +12,7 @@ pub(crate) fn mock_instantiation(
) -> Result<Response, ContractError> {
let current_time = mock_env().block.time;
let msg = InstantiateMsg {
start_epoch: Epoch {
start_epoch: EpochV2 {
id: 123,
start_time: current_time,
},
Expand Down
4 changes: 2 additions & 2 deletions contracts/liquidity_hub/epoch-manager/tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use cw_controllers::AdminError;

use epoch_manager::contract::{execute, query};
use epoch_manager::ContractError;
use white_whale::epoch_manager::epoch_manager::{
use white_whale_std::epoch_manager::epoch_manager::{
ConfigResponse, EpochConfig, ExecuteMsg, QueryMsg,
};
use white_whale::pool_network::mock_querier::mock_dependencies;
use white_whale_std::pool_network::mock_querier::mock_dependencies;

use crate::common::mock_instantiation;

Expand Down
10 changes: 5 additions & 5 deletions contracts/liquidity_hub/epoch-manager/tests/epoch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use cosmwasm_std::testing::{mock_env, mock_info};

use epoch_manager::contract::{execute, query};
use epoch_manager::ContractError;
use white_whale::epoch_manager::epoch_manager::{Epoch, EpochResponse, ExecuteMsg, QueryMsg};
use white_whale::epoch_manager::hooks::EpochChangedHookMsg;
use white_whale::pool_network::mock_querier::mock_dependencies;
use white_whale_std::epoch_manager::epoch_manager::{EpochV2, EpochResponse, ExecuteMsg, QueryMsg};
use white_whale_std::epoch_manager::hooks::EpochChangedHookMsg;
use white_whale_std::pool_network::mock_querier::mock_dependencies;

use crate::common::{mock_add_hook, mock_instantiation};

Expand All @@ -29,7 +29,7 @@ fn create_new_epoch_successfully() {
let query_res = query(deps.as_ref(), mock_env(), QueryMsg::CurrentEpoch {}).unwrap();
let epoch_response: EpochResponse = from_json(&query_res).unwrap();

let current_epoch = Epoch {
let current_epoch = EpochV2 {
id: 124,
start_time: next_epoch_time,
};
Expand All @@ -55,7 +55,7 @@ fn create_new_epoch_successfully() {

assert_eq!(
epoch_response.epoch,
Epoch {
EpochV2 {
id: 123,
start_time: next_epoch_time.minus_nanos(86400),
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/liquidity_hub/epoch-manager/tests/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use cw_controllers::{AdminError, HookError, HooksResponse};
use crate::common::{mock_add_hook, mock_instantiation};
use epoch_manager::contract::{execute, query};
use epoch_manager::ContractError;
use white_whale::epoch_manager::epoch_manager::{ExecuteMsg, QueryMsg};
use white_whale::pool_network::mock_querier::mock_dependencies;
use white_whale_std::epoch_manager::epoch_manager::{ExecuteMsg, QueryMsg};
use white_whale_std::pool_network::mock_querier::mock_dependencies;

mod common;
#[test]
Expand Down
12 changes: 6 additions & 6 deletions contracts/liquidity_hub/epoch-manager/tests/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use cosmwasm_std::{from_json, Addr, Uint64};

use epoch_manager::contract::{instantiate, query};
use epoch_manager::ContractError;
use white_whale::epoch_manager::epoch_manager::{
ConfigResponse, Epoch, EpochConfig, InstantiateMsg, QueryMsg,
use white_whale_std::epoch_manager::epoch_manager::{
ConfigResponse, EpochV2, EpochConfig, InstantiateMsg, QueryMsg,
};
use white_whale::pool_network::mock_querier::mock_dependencies;
use white_whale_std::pool_network::mock_querier::mock_dependencies;

mod common;

Expand All @@ -17,7 +17,7 @@ fn instantiation_successful() {
let current_time = mock_env().block.time;
let info = mock_info("owner", &[]);
let msg = InstantiateMsg {
start_epoch: Epoch {
start_epoch: EpochV2 {
id: 123,
start_time: current_time,
},
Expand Down Expand Up @@ -48,7 +48,7 @@ fn instantiation_unsuccessful() {
let current_time = mock_env().block.time;
let info = mock_info("owner", &[]);
let msg = InstantiateMsg {
start_epoch: Epoch {
start_epoch: EpochV2 {
id: 123,
start_time: current_time.minus_days(1),
},
Expand All @@ -65,7 +65,7 @@ fn instantiation_unsuccessful() {
}

let msg = InstantiateMsg {
start_epoch: Epoch {
start_epoch: EpochV2 {
id: 123,
start_time: current_time.plus_days(1),
},
Expand Down
8 changes: 4 additions & 4 deletions contracts/liquidity_hub/pool-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ overflow-checks = true
# for quicker tests, cargo test --lib
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
injective = ["white-whale/injective"]
token_factory = ["white-whale/token_factory"]
osmosis_token_factory = ["white-whale/osmosis_token_factory"]
injective = ["white-whale-std/injective"]
token_factory = ["white-whale-std/token_factory"]
osmosis_token_factory = ["white-whale-std/osmosis_token_factory"]

# use library feature to disable all instantiate/execute/query exports
library = []
Expand All @@ -54,7 +54,7 @@ cw2.workspace = true
cw20.workspace = true
cw20-base.workspace = true
serde.workspace = true
white-whale.workspace = true
white-whale-std.workspace = true
thiserror.workspace = true
cw-utils.workspace = true
cw-ownable.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion contracts/liquidity_hub/pool-manager/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cosmwasm_schema::write_api;

use white_whale::pool_manager::{ExecuteMsg, InstantiateMsg, QueryMsg};
use white_whale_std::pool_manager::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
write_api! {
Expand Down
8 changes: 4 additions & 4 deletions contracts/liquidity_hub/pool-manager/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use cosmwasm_std::{
use cw2::set_contract_version;
use cw20::Cw20ReceiveMsg;
use semver::Version;
use white_whale::pool_manager::{Cw20HookMsg, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use white_whale::pool_network::asset::{Asset, AssetInfo};
use white_whale::pool_network::pair::FeatureToggle;
use white_whale_std::pool_manager::{Cw20HookMsg, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use white_whale_std::pool_network::asset::{Asset, AssetInfo};
use white_whale_std::pool_network::pair::FeatureToggle;

// version info for migration info
const CONTRACT_NAME: &str = "crates.io:ww-pool-manager";
Expand Down Expand Up @@ -336,7 +336,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result<Binary, ContractErro
#[entry_point]
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
use cw2::get_contract_version;
use white_whale::migrate_guards::check_contract_name;
use white_whale_std::migrate_guards::check_contract_name;

check_contract_name(deps.storage, CONTRACT_NAME.to_string())?;

Expand Down
8 changes: 4 additions & 4 deletions contracts/liquidity_hub/pool-manager/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use std::ops::Mul;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Decimal, Decimal256, StdError, StdResult, Storage, Uint128, Uint256};

use white_whale::pool_network::asset::{Asset, AssetInfo, PairType};
use white_whale_std::pool_network::asset::{Asset, AssetInfo, PairType};
#[cfg(feature = "token_factory")]
use white_whale::pool_network::denom::MsgCreateDenom;
use white_whale_std::pool_network::denom::MsgCreateDenom;
#[cfg(feature = "osmosis_token_factory")]
use white_whale::pool_network::denom_osmosis::MsgCreateDenom;
use white_whale::pool_network::pair::PoolFee;
use white_whale_std::pool_network::denom_osmosis::MsgCreateDenom;
use white_whale_std::pool_network::pair::PoolFee;

use crate::error::ContractError;
use crate::math::Decimal256Helper;
Expand Down
20 changes: 10 additions & 10 deletions contracts/liquidity_hub/pool-manager/src/liquidity/commands.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_std::{to_json_binary, Addr, CosmosMsg, DepsMut, Env, MessageInfo, Response, WasmMsg};
use white_whale::pool_network::asset::{Asset, AssetInfo, PairType};
use white_whale_std::pool_network::asset::{Asset, AssetInfo, PairType};

use crate::{
helpers::{self},
Expand All @@ -12,21 +12,21 @@ use crate::{
#[cfg(any(feature = "token_factory", feature = "osmosis_token_factory"))]
use cosmwasm_std::coins;
#[cfg(any(feature = "token_factory", feature = "osmosis_token_factory"))]
use white_whale::pool_network::asset::is_factory_token;
use white_whale_std::pool_network::asset::is_factory_token;
#[cfg(feature = "token_factory")]
use white_whale::pool_network::denom::MsgCreateDenom;
use white_whale_std::pool_network::denom::MsgCreateDenom;
#[cfg(feature = "osmosis_token_factory")]
use white_whale::pool_network::denom_osmosis::MsgCreateDenom;
use white_whale_std::pool_network::denom_osmosis::MsgCreateDenom;

#[cfg(feature = "token_factory")]
use white_whale::pool_network::denom::{Coin, MsgBurn, MsgMint};
use white_whale_std::pool_network::denom::{Coin, MsgBurn, MsgMint};
#[cfg(feature = "osmosis_token_factory")]
use white_whale::pool_network::denom_osmosis::{Coin, MsgBurn, MsgMint};
use white_whale_std::pool_network::denom_osmosis::{Coin, MsgBurn, MsgMint};
// After writing create_pair I see this can get quite verbose so attempting to
// break it down into smaller modules which house some things like swap, liquidity etc
use cosmwasm_std::{Decimal, OverflowError, Uint128};
use cw20::Cw20ExecuteMsg;
use white_whale::pool_network::{
use white_whale_std::pool_network::{
asset::{get_total_share, MINIMUM_LIQUIDITY_AMOUNT},
U256,
};
Expand Down Expand Up @@ -141,7 +141,7 @@ pub fn provide_liquidity(
));
}

messages.append(&mut white_whale::lp_common::mint_lp_token_msg(
messages.append(&mut white_whale_std::lp_common::mint_lp_token_msg(
liquidity_token.to_string(),
&info.sender,
&env.contract.address,
Expand Down Expand Up @@ -186,7 +186,7 @@ pub fn provide_liquidity(
total_share,
)?;

messages.append(&mut white_whale::lp_common::mint_lp_token_msg(
messages.append(&mut white_whale_std::lp_common::mint_lp_token_msg(
liquidity_token.to_string(),
&info.sender,
&env.contract.address,
Expand Down Expand Up @@ -287,7 +287,7 @@ pub fn withdraw_liquidity(
.unwrap();
}
// Burn the LP tokens
messages.push(white_whale::lp_common::burn_lp_asset_msg(
messages.push(white_whale_std::lp_common::burn_lp_asset_msg(
liquidity_token,
sender.clone(),
amount,
Expand Down
20 changes: 10 additions & 10 deletions contracts/liquidity_hub/pool-manager/src/manager/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cosmwasm_std::{
};
use cw20::MinterResponse;
use sha2::{Digest, Sha256};
use white_whale::{
use white_whale_std::{
pool_network::{
asset::{Asset, AssetInfo, PairType},
pair::PoolFee,
Expand All @@ -22,19 +22,19 @@ use crate::{
};
#[cfg(any(feature = "token_factory", feature = "osmosis_token_factory"))]
use cosmwasm_std::coins;
use white_whale::pool_manager::NPairInfo as PairInfo;
use white_whale_std::pool_manager::NPairInfo as PairInfo;
#[cfg(any(feature = "token_factory", feature = "osmosis_token_factory"))]
use white_whale::pool_network::asset::is_factory_token;
use white_whale_std::pool_network::asset::is_factory_token;
#[cfg(feature = "token_factory")]
use white_whale::pool_network::denom::MsgCreateDenom;
use white_whale_std::pool_network::denom::MsgCreateDenom;
#[cfg(feature = "osmosis_token_factory")]
use white_whale::pool_network::denom_osmosis::MsgCreateDenom;
use white_whale::pool_network::querier::query_balance;
use white_whale_std::pool_network::denom_osmosis::MsgCreateDenom;
use white_whale_std::pool_network::querier::query_balance;

#[cfg(feature = "token_factory")]
use white_whale::pool_network::denom::{Coin, MsgBurn, MsgMint};
use white_whale_std::pool_network::denom::{Coin, MsgBurn, MsgMint};
#[cfg(feature = "osmosis_token_factory")]
use white_whale::pool_network::denom_osmosis::{Coin, MsgBurn, MsgMint};
use white_whale_std::pool_network::denom_osmosis::{Coin, MsgBurn, MsgMint};
pub const MAX_ASSETS_PER_POOL: usize = 4;
pub const LP_SYMBOL: &str = "uLP";

Expand All @@ -46,8 +46,8 @@ pub const LP_SYMBOL: &str = "uLP";
///
/// ```rust
/// # use cosmwasm_std::{DepsMut, Decimal, Env, MessageInfo, Response, CosmosMsg, WasmMsg, to_binary};
/// # use white_whale::pool_network::{asset::{AssetInfo, PairType}, pair::PoolFee};
/// # use white_whale::fee::Fee;
/// # use white_whale_std::pool_network::{asset::{AssetInfo, PairType}, pair::PoolFee};
/// # use white_whale_std::fee::Fee;
/// # use pool_manager::error::ContractError;
/// # use pool_manager::manager::commands::MAX_ASSETS_PER_POOL;
/// # use pool_manager::manager::commands::create_pair;
Expand Down
4 changes: 2 additions & 2 deletions contracts/liquidity_hub/pool-manager/src/queries.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::cmp::Ordering;

use cosmwasm_std::{Decimal256, Deps, Env, Fraction, Order, StdResult, Uint128};
use white_whale::pool_manager::{SwapOperation, SwapRouteResponse};
use white_whale::pool_network::{
use white_whale_std::pool_manager::{SwapOperation, SwapRouteResponse};
use white_whale_std::pool_network::{
asset::{Asset, AssetInfo, PairType},
factory::NativeTokenDecimalsResponse,
pair::{ReverseSimulationResponse, SimulationResponse},
Expand Down
6 changes: 3 additions & 3 deletions contracts/liquidity_hub/pool-manager/src/router/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// use cosmwasm_std::{DepsMut, Env, Addr, Uint128, Decimal, Response, StdError, Deps, CosmosMsg, WasmMsg, to_binary, StdResult, Coin, MessageInfo};
// use cw20::Cw20ExecuteMsg;
// use white_whale::{pool_network::{asset::{AssetInfo, Asset}}, pool_manager::{SwapOperation, ExecuteMsg, NPairInfo}};
// use white_whale_std::{pool_network::{asset::{AssetInfo, Asset}}, pool_manager::{SwapOperation, ExecuteMsg, NPairInfo}};

// use crate::{ContractError, state::{MANAGER_CONFIG, get_pair_by_identifier, Config}};

Expand Down Expand Up @@ -159,7 +159,7 @@
// denom,
// amount: offer_asset.amount,
// }],
// msg: to_binary(&white_whale::pool_manager::ExecuteMsg::Swap {
// msg: to_binary(&white_whale_std::pool_manager::ExecuteMsg::Swap {
// offer_asset,
// belief_price: None,
// max_spread,
Expand All @@ -174,7 +174,7 @@
// msg: to_binary(&Cw20ExecuteMsg::Send {
// contract: pair_contract.to_string(),
// amount: offer_asset.amount,
// msg: to_binary(&white_whale::pool_manager::Cw20HookMsg::Swap {
// msg: to_binary(&white_whale_std::pool_manager::Cw20HookMsg::Swap {
// belief_price: None,
// max_spread,
// to,
Expand Down
6 changes: 3 additions & 3 deletions contracts/liquidity_hub/pool-manager/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Addr, Api, Deps, Order, StdResult, Storage};
use cw_storage_plus::{Bound, Index, IndexList, IndexedMap, Item, Map, UniqueIndex};
use white_whale::pool_manager::{NPairInfo, SwapOperation};
use white_whale::pool_network::asset::{Asset, AssetInfo, AssetInfoRaw};
use white_whale::pool_network::pair::FeatureToggle;
use white_whale_std::pool_manager::{NPairInfo, SwapOperation};
use white_whale_std::pool_network::asset::{Asset, AssetInfo, AssetInfoRaw};
use white_whale_std::pool_network::pair::FeatureToggle;

use crate::ContractError;
pub const LP_SYMBOL: &str = "uLP";
Expand Down
12 changes: 6 additions & 6 deletions contracts/liquidity_hub/pool-manager/src/swap/commands.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_std::{Addr, CosmosMsg, DepsMut, Env, MessageInfo, Response};
use white_whale::pool_network::asset::{Asset, AssetInfo};
use white_whale_std::pool_network::asset::{Asset, AssetInfo};

use crate::helpers;
use crate::state::{get_decimals, get_pair_by_identifier};
Expand All @@ -10,16 +10,16 @@ use crate::{
#[cfg(any(feature = "token_factory", feature = "osmosis_token_factory"))]
use cosmwasm_std::coins;
#[cfg(any(feature = "token_factory", feature = "osmosis_token_factory"))]
use white_whale::pool_network::asset::is_factory_token;
use white_whale_std::pool_network::asset::is_factory_token;
#[cfg(feature = "token_factory")]
use white_whale::pool_network::denom::MsgCreateDenom;
use white_whale_std::pool_network::denom::MsgCreateDenom;
#[cfg(feature = "osmosis_token_factory")]
use white_whale::pool_network::denom_osmosis::MsgCreateDenom;
use white_whale_std::pool_network::denom_osmosis::MsgCreateDenom;

#[cfg(feature = "token_factory")]
use white_whale::pool_network::denom::{Coin, MsgBurn, MsgMint};
use white_whale_std::pool_network::denom::{Coin, MsgBurn, MsgMint};
#[cfg(feature = "osmosis_token_factory")]
use white_whale::pool_network::denom_osmosis::{Coin, MsgBurn, MsgMint};
use white_whale_std::pool_network::denom_osmosis::{Coin, MsgBurn, MsgMint};
pub const MAX_ASSETS_PER_POOL: usize = 4;
pub const LP_SYMBOL: &str = "uLP";

Expand Down
Loading

0 comments on commit a9d1a8e

Please sign in to comment.