Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrizsabin committed Aug 28, 2024
1 parent d7aa203 commit 0e3672a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 29 deletions.
2 changes: 1 addition & 1 deletion contracts/cw-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
crate-type = ["cdylib", "rlib"]

[features]
default=["injective"]
default=[]
# use injective to enable injective specific code
injective=[]

Expand Down
2 changes: 0 additions & 2 deletions contracts/cw-common/src/hub_token_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ pub enum ExecuteMsg {
UpdateMinter { new_minter: Option<String> },
#[cfg(feature = "injective")]
SetAdapter { registry_contract: String },
#[cfg(feature = "injective")]
MintDenom { amount: u128, address: String },
}

#[cw_serde]
Expand Down
2 changes: 1 addition & 1 deletion contracts/token-contracts/cw-hub-bnusd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 3 additions & 17 deletions contracts/token-contracts/cw-hub-bnusd/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down
8 changes: 0 additions & 8 deletions contracts/token-contracts/cw-hub-bnusd/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>) -> String {
debug_println!("this is {:?}", data);
if data.is_empty() {
Expand Down

0 comments on commit 0e3672a

Please sign in to comment.