diff --git a/smart-contracts/osmosis/contracts/cl-vault/src/helpers/coinlist.rs b/smart-contracts/osmosis/contracts/cl-vault/src/helpers/coinlist.rs index d452503f6..e7ba57450 100644 --- a/smart-contracts/osmosis/contracts/cl-vault/src/helpers/coinlist.rs +++ b/smart-contracts/osmosis/contracts/cl-vault/src/helpers/coinlist.rs @@ -135,13 +135,13 @@ impl CoinList { CoinList(coins) } - pub fn find_coin(&self, denom: String) -> Coin { + pub fn find(&self, denom: &str) -> Coin { self.0 .iter() .find(|c| c.denom == denom) .cloned() .unwrap_or(Coin { - denom, + denom: denom.to_string(), amount: 0u128.into(), }) } diff --git a/smart-contracts/osmosis/contracts/cl-vault/src/helpers/getters.rs b/smart-contracts/osmosis/contracts/cl-vault/src/helpers/getters.rs index 8706f08ca..7627970ac 100644 --- a/smart-contracts/osmosis/contracts/cl-vault/src/helpers/getters.rs +++ b/smart-contracts/osmosis/contracts/cl-vault/src/helpers/getters.rs @@ -212,13 +212,10 @@ pub fn get_unused_pair_balances( env: &Env, pool_config: &PoolConfig, ) -> Result, ContractError> { - // Get unused balances from the contract. This is the amount of tokens that are not currently in a position. - // This amount already includes the withdrawn amounts from previous steps as in this reply those funds already compose the contract balance. let unused_balances = get_unused_balances(&deps.querier, env)?; - // Use the unused balances to get the token0 and token1 amounts that we can use to create a new position - let base = unused_balances.find_coin(pool_config.token0.clone()); - let quote = unused_balances.find_coin(pool_config.token1.clone()); + let base = unused_balances.find(&pool_config.token0); + let quote = unused_balances.find(&pool_config.token1); Ok(vec![base, quote]) } diff --git a/smart-contracts/osmosis/contracts/cl-vault/src/query.rs b/smart-contracts/osmosis/contracts/cl-vault/src/query.rs index f4dfde817..9da35e720 100644 --- a/smart-contracts/osmosis/contracts/cl-vault/src/query.rs +++ b/smart-contracts/osmosis/contracts/cl-vault/src/query.rs @@ -190,7 +190,7 @@ pub fn query_total_assets(deps: Deps, env: Env) -> Result Result