diff --git a/contracts/liquidity_hub/incentive-manager/src/bin/schema.rs b/contracts/liquidity_hub/incentive-manager/src/bin/schema.rs deleted file mode 100644 index 269701f56..000000000 --- a/contracts/liquidity_hub/incentive-manager/src/bin/schema.rs +++ /dev/null @@ -1,11 +0,0 @@ -use cosmwasm_schema::write_api; - -use white_whale_std::incentive_manager::{ExecuteMsg, InstantiateMsg, QueryMsg}; - -fn main() { - write_api! { - instantiate: InstantiateMsg, - execute: ExecuteMsg, - query: QueryMsg, - } -} diff --git a/contracts/liquidity_hub/incentive-manager/src/helpers.rs b/contracts/liquidity_hub/incentive-manager/src/helpers.rs index c8c0a6d63..997bf7bc9 100644 --- a/contracts/liquidity_hub/incentive-manager/src/helpers.rs +++ b/contracts/liquidity_hub/incentive-manager/src/helpers.rs @@ -14,7 +14,7 @@ pub(crate) fn process_incentive_creation_fee( config: &Config, info: &MessageInfo, incentive_creation_fee: &Coin, - params: &mut IncentiveParams, + params: &IncentiveParams, ) -> Result, ContractError> { let mut messages: Vec = vec![]; @@ -80,7 +80,6 @@ pub(crate) fn process_incentive_creation_fee( } /// Asserts the incentive asset was sent correctly, considering the incentive creation fee if applicable. -/// Returns a vector of messages to be sent (applies only when the incentive asset is a CW20 token) pub(crate) fn assert_incentive_asset( info: &MessageInfo, incentive_creation_fee: &Coin, diff --git a/contracts/liquidity_hub/incentive-manager/src/manager/commands.rs b/contracts/liquidity_hub/incentive-manager/src/manager/commands.rs index 8aef989c6..04c568831 100644 --- a/contracts/liquidity_hub/incentive-manager/src/manager/commands.rs +++ b/contracts/liquidity_hub/incentive-manager/src/manager/commands.rs @@ -3,10 +3,11 @@ use cosmwasm_std::{ Storage, Uint128, Uint64, }; -use white_whale_std::coin::{get_subdenom, is_factory_token}; +use white_whale_std::coin::{get_factory_token_subdenom, is_factory_token}; use white_whale_std::epoch_manager::hooks::EpochChangedHookMsg; use white_whale_std::incentive_manager::MIN_INCENTIVE_AMOUNT; use white_whale_std::incentive_manager::{Curve, Incentive, IncentiveParams}; +use white_whale_std::lp_common::LP_SYMBOL; use crate::helpers::{ assert_incentive_asset, process_incentive_creation_fee, validate_emergency_unlock_penalty, @@ -43,7 +44,7 @@ pub(crate) fn fill_incentive( fn create_incentive( deps: DepsMut, info: MessageInfo, - mut params: IncentiveParams, + params: IncentiveParams, ) -> Result { // check if there are any expired incentives for this LP asset let config = CONFIG.load(deps.storage)?; @@ -86,7 +87,7 @@ fn create_incentive( } ); - let incentive_creation_fee = config.create_incentive_fee.clone(); + let incentive_creation_fee = config.clone().create_incentive_fee; if incentive_creation_fee.amount != Uint128::zero() { // verify the fee to create an incentive is being paid @@ -94,7 +95,7 @@ fn create_incentive( &config, &info, &incentive_creation_fee, - &mut params, + ¶ms, )?); } @@ -304,8 +305,10 @@ pub(crate) fn on_epoch_changed( .into_iter() .filter(|asset| { if is_factory_token(asset.denom.as_str()) { - //todo remove this hardcoded uLP and point to the pool manager const, to be moved to the white-whale-std package - get_subdenom(asset.denom.as_str()) == "uLP" + match get_factory_token_subdenom(asset.denom.as_str()) { + Ok(subdenom) => subdenom == LP_SYMBOL, + Err(_) => false, + } } else { false } diff --git a/contracts/liquidity_hub/pool-manager/src/manager/commands.rs b/contracts/liquidity_hub/pool-manager/src/manager/commands.rs index 431cd2102..ca96fb52a 100644 --- a/contracts/liquidity_hub/pool-manager/src/manager/commands.rs +++ b/contracts/liquidity_hub/pool-manager/src/manager/commands.rs @@ -172,6 +172,7 @@ pub fn create_pair( let lp_symbol = format!("{pair_label}.pool.{identifier}.{LP_SYMBOL}"); let lp_asset = format!("{}/{}/{}", "factory", env.contract.address, lp_symbol); + #[allow(clippy::redundant_clone)] PAIRS.save( deps.storage, &identifier, diff --git a/packages/white-whale-std/src/coin.rs b/packages/white-whale-std/src/coin.rs index 7a89b5e72..5ca1a1dd1 100644 --- a/packages/white-whale-std/src/coin.rs +++ b/packages/white-whale-std/src/coin.rs @@ -102,11 +102,17 @@ pub fn is_factory_token(denom: &str) -> bool { } /// Gets the subdenom of a factory token. To be called after [is_factory_token] has been successful. -pub fn get_subdenom(denom: &str) -> &str { - denom - .splitn(3, '/') - .nth(2) - .expect("Expected at least three elements") +pub fn get_factory_token_subdenom(denom: &str) -> StdResult<&str> { + let subdenom = denom.splitn(3, '/').nth(2); + + subdenom.map_or_else( + || { + Err(StdError::generic_err( + "Splitting factory token subdenom failed", + )) + }, + Ok, + ) } /// Builds the label for a factory token denom in such way that it returns a label like "factory/mig...xyz/123...456". diff --git a/scripts/deployment/deploy_env/base.env b/scripts/deployment/deploy_env/base.env deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/deployment/deploy_env/base_migaloo.env b/scripts/deployment/deploy_env/base_migaloo.env deleted file mode 100644 index e69de29bb..000000000