From 0e3672ab0a6b0c85e46bbab7f823ffdad16ad11a Mon Sep 17 00:00:00 2001 From: ibrizsabin Date: Wed, 28 Aug 2024 12:14:24 +0545 Subject: [PATCH] fix: cleanup --- contracts/cw-common/Cargo.toml | 2 +- contracts/cw-common/src/hub_token_msg.rs | 2 -- .../token-contracts/cw-hub-bnusd/Cargo.toml | 2 +- .../cw-hub-bnusd/src/contract.rs | 20 +++---------------- .../cw-hub-bnusd/src/events.rs | 8 -------- 5 files changed, 5 insertions(+), 29 deletions(-) diff --git a/contracts/cw-common/Cargo.toml b/contracts/cw-common/Cargo.toml index 46c2ca4..d4807af 100644 --- a/contracts/cw-common/Cargo.toml +++ b/contracts/cw-common/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [features] -default=["injective"] +default=[] # use injective to enable injective specific code injective=[] diff --git a/contracts/cw-common/src/hub_token_msg.rs b/contracts/cw-common/src/hub_token_msg.rs index aed8ba2..6564ec4 100644 --- a/contracts/cw-common/src/hub_token_msg.rs +++ b/contracts/cw-common/src/hub_token_msg.rs @@ -82,8 +82,6 @@ pub enum ExecuteMsg { UpdateMinter { new_minter: Option }, #[cfg(feature = "injective")] SetAdapter { registry_contract: String }, - #[cfg(feature = "injective")] - MintDenom { amount: u128, address: String }, } #[cw_serde] diff --git a/contracts/token-contracts/cw-hub-bnusd/Cargo.toml b/contracts/token-contracts/cw-hub-bnusd/Cargo.toml index ecc4b26..e16f823 100644 --- a/contracts/token-contracts/cw-hub-bnusd/Cargo.toml +++ b/contracts/token-contracts/cw-hub-bnusd/Cargo.toml @@ -16,7 +16,7 @@ exclude = [ crate-type = ["cdylib", "rlib"] [features] -default=["injective"] +default=[] # for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports diff --git a/contracts/token-contracts/cw-hub-bnusd/src/contract.rs b/contracts/token-contracts/cw-hub-bnusd/src/contract.rs index e764c01..09fc5b4 100644 --- a/contracts/token-contracts/cw-hub-bnusd/src/contract.rs +++ b/contracts/token-contracts/cw-hub-bnusd/src/contract.rs @@ -176,15 +176,6 @@ pub fn execute( CW20_ADAPTER.save(deps.storage, &adapter)?; Ok(Response::new()) } - #[cfg(feature = "injective")] - ExecuteMsg::MintDenom { amount, address } => { - let mut response = Response::new(); - let adapter = CW20_ADAPTER.load(deps.storage)?; - let receiver = deps.api.addr_validate(&address)?; - let msg = adapter.receive(&receiver, amount); - response = response.add_submessage(msg); - Ok(response) - } } } @@ -233,9 +224,7 @@ mod execute { #[cfg(feature = "injective")] use crate::cw20_adapter::CW20Adapter; - use crate::events::{ - emit_adapter_call, emit_cross_transfer_event, emit_cross_transfer_revert_event, - }; + use crate::events::{emit_cross_transfer_event, emit_cross_transfer_revert_event}; use bytes::BytesMut; use cosmwasm_std::{ensure, to_binary, Addr, CosmosMsg, SubMsg}; use cw_common::{helpers::get_protocols, network_address::NetId}; @@ -386,9 +375,8 @@ mod execute { amount.into(), None, ) - .unwrap() + .expect("Failed To Increase Allowance") .add_attribute("method", "cross_transfer") - .add_event(emit_adapter_call("AdapterCall".to_string(), &info_copy)) .add_event(event); if (tf_tokens > 0) { response = response.add_submessage(adapter.redeem(tf_tokens, &info.sender)); @@ -469,7 +457,6 @@ mod execute { ); res = res .add_submessage(receive_msg) - .add_event(emit_adapter_call("AdapterCall".to_string(), &info)) .add_attribute("method", "x_cross_transfer") .add_event(event); Ok(res) @@ -534,8 +521,7 @@ mod execute { res = res .add_submessage(receive_msg) .add_attribute("method", "x_cross_transfer_revert") - .add_event(event) - .add_event(emit_adapter_call("AdapterCall".to_string(), &info)); + .add_event(event); Ok(res) } diff --git a/contracts/token-contracts/cw-hub-bnusd/src/events.rs b/contracts/token-contracts/cw-hub-bnusd/src/events.rs index c25670c..45cb912 100644 --- a/contracts/token-contracts/cw-hub-bnusd/src/events.rs +++ b/contracts/token-contracts/cw-hub-bnusd/src/events.rs @@ -22,14 +22,6 @@ pub fn emit_cross_transfer_revert_event(name: String, from: Addr, amount: u128) .add_attribute("value", amount.to_string()) } -pub fn emit_adapter_call(name: String, info: &MessageInfo) -> Event { - let mut event = Event::new(name).add_attribute("adapter_submessage", "adapter_called"); - for f in info.funds.iter() { - event = event.add_attribute(f.denom.clone(), f.amount.to_string()) - } - event -} - fn hex_encode(data: Vec) -> String { debug_println!("this is {:?}", data); if data.is_empty() {