diff --git a/cosmwasm/contracts/fast-transfer-gateway/src/contract.rs b/cosmwasm/contracts/fast-transfer-gateway/src/contract.rs index 6b59fa4..8c7a842 100644 --- a/cosmwasm/contracts/fast-transfer-gateway/src/contract.rs +++ b/cosmwasm/contracts/fast-transfer-gateway/src/contract.rs @@ -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)?; diff --git a/cosmwasm/contracts/fast-transfer-gateway/src/execute.rs b/cosmwasm/contracts/fast-transfer-gateway/src/execute.rs index b286b20..961db9d 100644 --- a/cosmwasm/contracts/fast-transfer-gateway/src/execute.rs +++ b/cosmwasm/contracts/fast-transfer-gateway/src/execute.rs @@ -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}, @@ -114,8 +114,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, @@ -127,7 +125,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, @@ -169,8 +167,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 { @@ -179,7 +175,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, diff --git a/cosmwasm/contracts/fast-transfer-gateway/src/query.rs b/cosmwasm/contracts/fast-transfer-gateway/src/query.rs index 8eba695..768584c 100644 --- a/cosmwasm/contracts/fast-transfer-gateway/src/query.rs +++ b/cosmwasm/contracts/fast-transfer-gateway/src/query.rs @@ -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, @@ -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, }; diff --git a/cosmwasm/contracts/fast-transfer-gateway/tests/common/mod.rs b/cosmwasm/contracts/fast-transfer-gateway/tests/common/mod.rs index 419743c..3678044 100644 --- a/cosmwasm/contracts/fast-transfer-gateway/tests/common/mod.rs +++ b/cosmwasm/contracts/fast-transfer-gateway/tests/common/mod.rs @@ -29,6 +29,7 @@ pub fn default_instantiate() -> (OwnedDeps, token_denom: "uusdc".to_string(), address_prefix: "osmo".to_string(), mailbox_addr: "mailbox_contract_address".into(), + hook_addr: "hook_contract_address".into(), }, ) .unwrap(); diff --git a/cosmwasm/contracts/fast-transfer-gateway/tests/test_initiate_settlement.rs b/cosmwasm/contracts/fast-transfer-gateway/tests/test_initiate_settlement.rs index 82033f6..613b3f1 100644 --- a/cosmwasm/contracts/fast-transfer-gateway/tests/test_initiate_settlement.rs +++ b/cosmwasm/contracts/fast-transfer-gateway/tests/test_initiate_settlement.rs @@ -56,9 +56,7 @@ fn test_initiate_settlement() { "00b8789db0c2da6b48ff31471423dc7ffa2386902c666fa2691e636c29b539936a1234" ) .unwrap(), - hook: Some( - "osmo12pvc4v625ewl34uqqgm3ezw76durxlky5j4guz8kvhal7em3e5wqz7cnla".into() - ), + hook: Some("hook_contract_address".into()), metadata: None })) .unwrap(), @@ -129,7 +127,7 @@ fn test_initiate_settlement_multiple_orders() { ) .unwrap(), hook: Some( - "osmo12pvc4v625ewl34uqqgm3ezw76durxlky5j4guz8kvhal7em3e5wqz7cnla".into() + "hook_contract_address".into() ), metadata: None })) diff --git a/cosmwasm/contracts/fast-transfer-gateway/tests/test_initiate_timeout.rs b/cosmwasm/contracts/fast-transfer-gateway/tests/test_initiate_timeout.rs index 59ebe6d..e0ceab5 100644 --- a/cosmwasm/contracts/fast-transfer-gateway/tests/test_initiate_timeout.rs +++ b/cosmwasm/contracts/fast-transfer-gateway/tests/test_initiate_timeout.rs @@ -81,7 +81,7 @@ fn test_initiate_timeout() { ) .unwrap(), hook: Some( - "osmo12pvc4v625ewl34uqqgm3ezw76durxlky5j4guz8kvhal7em3e5wqz7cnla".into() + "hook_contract_address".into() ), metadata: None })) diff --git a/cosmwasm/contracts/fast-transfer-gateway/tests/test_instantiate.rs b/cosmwasm/contracts/fast-transfer-gateway/tests/test_instantiate.rs index 7134129..6f8cde2 100644 --- a/cosmwasm/contracts/fast-transfer-gateway/tests/test_instantiate.rs +++ b/cosmwasm/contracts/fast-transfer-gateway/tests/test_instantiate.rs @@ -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, }; @@ -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); diff --git a/cosmwasm/packages/gofast/.idea/editor.xml b/cosmwasm/packages/gofast/.idea/editor.xml new file mode 100644 index 0000000..55d1bc1 --- /dev/null +++ b/cosmwasm/packages/gofast/.idea/editor.xml @@ -0,0 +1,483 @@ + + + + + \ No newline at end of file diff --git a/cosmwasm/packages/gofast/.idea/gofast.iml b/cosmwasm/packages/gofast/.idea/gofast.iml new file mode 100644 index 0000000..ca5ba2d --- /dev/null +++ b/cosmwasm/packages/gofast/.idea/gofast.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/cosmwasm/packages/gofast/.idea/modules.xml b/cosmwasm/packages/gofast/.idea/modules.xml new file mode 100644 index 0000000..479272f --- /dev/null +++ b/cosmwasm/packages/gofast/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/cosmwasm/packages/gofast/.idea/vcs.xml b/cosmwasm/packages/gofast/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/cosmwasm/packages/gofast/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/cosmwasm/packages/gofast/.idea/workspace.xml b/cosmwasm/packages/gofast/.idea/workspace.xml new file mode 100644 index 0000000..9a5f395 --- /dev/null +++ b/cosmwasm/packages/gofast/.idea/workspace.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1730175640537 + + + + + + \ No newline at end of file diff --git a/cosmwasm/packages/gofast/src/gateway.rs b/cosmwasm/packages/gofast/src/gateway.rs index 67164b0..3d7b403 100644 --- a/cosmwasm/packages/gofast/src/gateway.rs +++ b/cosmwasm/packages/gofast/src/gateway.rs @@ -8,6 +8,7 @@ pub struct Config { pub token_denom: String, pub address_prefix: String, pub mailbox_addr: String, + pub hook_addr: String, } #[cw_serde] @@ -28,6 +29,7 @@ pub struct InstantiateMsg { pub token_denom: String, pub address_prefix: String, pub mailbox_addr: String, + pub hook_addr: String, pub local_domain: u32, } diff --git a/cosmwasm/scripts/deploy.ts b/cosmwasm/scripts/deploy.ts index 84168ae..7387f2c 100644 --- a/cosmwasm/scripts/deploy.ts +++ b/cosmwasm/scripts/deploy.ts @@ -13,6 +13,8 @@ const tokenDenom = "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4"; const mailboxAddr = "osmo1jjf788v9m5pcqghe0ky2hf4llxxe37dqz6609eychuwe3xzzq9eql969h3"; +const hookAddr = + "osmo13yswqchwtmv2ln9uz4w3865sfy5k8x0wg9qrv4vxflxjg0kuwwyqqpvqxz"; const remoteDomain = 42161; const remoteAddr = "000000000000000000000000F7ceC3d387384bB6cE5792dAb161a65cFaCf8aB4"; @@ -21,6 +23,7 @@ interface InstantiateMsg { token_denom: string; address_prefix: string; mailbox_addr: string; + hook_addr: string, remote_domain: number; remote_addr: string; } @@ -57,6 +60,7 @@ async function main() { token_denom: tokenDenom, address_prefix: CHAIN_PREFIX, mailbox_addr: mailboxAddr, + hook_addr: hookAddr, remote_domain: remoteDomain, remote_addr: remoteAddr, }; diff --git a/cosmwasm/scripts/fill.ts b/cosmwasm/scripts/fill.ts index 52e27c7..53f0286 100644 --- a/cosmwasm/scripts/fill.ts +++ b/cosmwasm/scripts/fill.ts @@ -21,6 +21,7 @@ interface InstantiateMsg { token_denom: string; address_prefix: string; mailbox_addr: string; + hook_addr: string; remote_domain: number; remote_addr: string; } diff --git a/cosmwasm/scripts/settle.ts b/cosmwasm/scripts/settle.ts index 97060bd..1fcf2ee 100644 --- a/cosmwasm/scripts/settle.ts +++ b/cosmwasm/scripts/settle.ts @@ -21,6 +21,7 @@ interface InstantiateMsg { token_denom: string; address_prefix: string; mailbox_addr: string; + hook_addr: string; remote_domain: number; remote_addr: string; }