Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
thal0x committed Oct 30, 2024
2 parents d970de8 + 0258c34 commit c4f4103
Show file tree
Hide file tree
Showing 16 changed files with 631 additions and 16 deletions.
1 change: 1 addition & 0 deletions cosmwasm/contracts/fast-transfer-gateway/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub fn instantiate(
token_denom: msg.token_denom,
address_prefix: msg.address_prefix,
mailbox_addr: msg.mailbox_addr,
hook_addr: msg.hook_addr,
};

CONFIG.save(deps.storage, &config)?;
Expand Down
10 changes: 3 additions & 7 deletions cosmwasm/contracts/fast-transfer-gateway/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cosmwasm_std::{
};
use cw_ownable::assert_owner;
use go_fast::{gateway::Config, FastTransferOrder};
use hyperlane::mailbox::{get_default_hook, DispatchMsg, ExecuteMsg as MailboxExecuteMsg};
use hyperlane::mailbox::{DispatchMsg, ExecuteMsg as MailboxExecuteMsg};

use crate::{
error::{ContractError, ContractResponse},
Expand Down Expand Up @@ -122,8 +122,6 @@ pub fn initiate_settlement(

let remote_contract_address = remote_contract_address.unwrap();

let default_hook = get_default_hook(deps.as_ref(), config.mailbox_addr.clone())?;

let settle_orders_message = SettleOrdersMessage {
repayment_address,
order_ids,
Expand All @@ -135,7 +133,7 @@ pub fn initiate_settlement(
dest_domain: source_domain,
recipient_addr: remote_contract_address.clone(),
msg_body: settle_orders_message.encode(),
hook: Some(default_hook),
hook: Some(config.hook_addr.clone()),
metadata: None,
}))?,
funds: info.funds,
Expand Down Expand Up @@ -178,8 +176,6 @@ pub fn initiate_timeout(

let remote_contract_address = remote_contract_address.unwrap();

let default_hook = get_default_hook(deps.as_ref(), config.mailbox_addr.clone())?;

let timeout_orders_message = TimeoutOrdersMessage { order_ids };

let msg = WasmMsg::Execute {
Expand All @@ -188,7 +184,7 @@ pub fn initiate_timeout(
dest_domain: source_domain,
recipient_addr: remote_contract_address.clone(),
msg_body: timeout_orders_message.encode(),
hook: Some(default_hook),
hook: Some(config.hook_addr.clone()),
metadata: None,
}))?,
funds: info.funds,
Expand Down
6 changes: 2 additions & 4 deletions cosmwasm/contracts/fast-transfer-gateway/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cosmwasm_std::{Addr, Coin, Deps, HexBinary, Order, StdError, StdResult};
use go_fast::gateway::{Config, OrderFill, RemoteDomain};
use hyperlane::mailbox::{get_default_hook, quote_dispatch, DispatchMsg};
use hyperlane::mailbox::{quote_dispatch, DispatchMsg};

use crate::{
helpers::encode_settle_order_data,
Expand Down Expand Up @@ -64,13 +64,11 @@ pub fn quote_initiate_settlement(

let remote_contract_address = remote_contract_address.unwrap();

let default_hook = get_default_hook(deps, config.mailbox_addr.clone())?;

let dispatch_msg = DispatchMsg {
dest_domain: source_domain,
recipient_addr: remote_contract_address.clone(),
msg_body: encode_settle_order_data(repayment_address, order_ids),
hook: Some(default_hook),
hook: Some(config.hook_addr.clone()),
metadata: None,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub fn default_instantiate() -> (OwnedDeps<MemoryStorage, MockApi, MockQuerier>,
)
.unwrap()
.into_string(),
hook_addr: "hook_contract_address".into(),
},
)
.unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ fn test_initiate_settlement() {
"00b8789db0c2da6b48ff31471423dc7ffa2386902c666fa2691e636c29b539936a1234"
)
.unwrap(),
hook: Some(
"osmo12pvc4v625ewl34uqqgm3ezw76durxlky5j4guz8kvhal7em3e5wqz7cnla".into()
),
hook: Some("hook_contract_address".into()),
metadata: None
}))
.unwrap(),
Expand Down Expand Up @@ -139,7 +137,7 @@ fn test_initiate_settlement_multiple_orders() {
)
.unwrap(),
hook: Some(
"osmo12pvc4v625ewl34uqqgm3ezw76durxlky5j4guz8kvhal7em3e5wqz7cnla".into()
"hook_contract_address".into()
),
metadata: None
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn test_initiate_timeout() {
)
.unwrap(),
hook: Some(
"osmo12pvc4v625ewl34uqqgm3ezw76durxlky5j4guz8kvhal7em3e5wqz7cnla".into()
"hook_contract_address".into()
),
metadata: None
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn test_instantiate() {
token_denom: "uusdc".to_string(),
address_prefix: "osmo".to_string(),
mailbox_addr: "mailbox_contract_address".into(),
hook_addr: "hook_contract_address".into(),
local_domain: 1,
};

Expand All @@ -31,6 +32,7 @@ fn test_instantiate() {
assert_eq!(config.token_denom, instantiate_msg.token_denom);
assert_eq!(config.address_prefix, instantiate_msg.address_prefix);
assert_eq!(config.mailbox_addr, instantiate_msg.mailbox_addr);
assert_eq!(config.hook_addr, instantiate_msg.hook_addr);

let local_domain = LOCAL_DOMAIN.load(deps.as_ref().storage).unwrap();
assert_eq!(local_domain, 1);
Expand Down
Loading

0 comments on commit c4f4103

Please sign in to comment.