diff --git a/precompile/binaries/stdlib/minitswap.mv b/precompile/binaries/stdlib/minitswap.mv index a79ed333..a835ec55 100644 Binary files a/precompile/binaries/stdlib/minitswap.mv and b/precompile/binaries/stdlib/minitswap.mv differ diff --git a/precompile/modules/initia_stdlib/sources/ibctesting/ibctesting.move b/precompile/modules/initia_stdlib/sources/ibctesting/ibctesting.move index 2f0e6d95..47c5a28a 100644 --- a/precompile/modules/initia_stdlib/sources/ibctesting/ibctesting.move +++ b/precompile/modules/initia_stdlib/sources/ibctesting/ibctesting.move @@ -205,7 +205,7 @@ module initia_std::ibctesting { check_dispatch_type_compatibility_for_testing( &dispatchable_ibc_timeout_function_info(), &function_info ); - dispatchable_ibc_timeout(async_callback.id, &function_info); + dispatchable_ibc_timeout((async_callback.id as u64), &function_info); } else if (option::is_some(&result.async_callback)) { let async_callback = option::destroy_some(result.async_callback); let function_info = @@ -218,7 +218,7 @@ module initia_std::ibctesting { &dispatchable_ibc_ack_function_info(), &function_info ); dispatchable_ibc_ack( - async_callback.id, result.success, &function_info + (async_callback.id as u64), result.success, &function_info ); }; } @@ -401,7 +401,7 @@ module initia_std::ibctesting { } struct MoveAsyncCallback has copy, drop, store { - id: u64, + id: u32, module_address: address, module_name: String } diff --git a/precompile/modules/initia_stdlib/sources/minitswap.move b/precompile/modules/initia_stdlib/sources/minitswap.move index 687c03fb..2ed18e7f 100644 --- a/precompile/modules/initia_stdlib/sources/minitswap.move +++ b/precompile/modules/initia_stdlib/sources/minitswap.move @@ -2315,17 +2315,34 @@ module initia_std::minitswap { evm: Option } + struct IBCMemoV2 has copy, drop { + _move_: MemoMoveV2, + wasm: Option, + evm: Option + } + struct MemoMove has copy, drop { message: Option, async_callback: MemoAsyncCallback } + struct MemoMoveV2 has copy, drop { + message: Option, + async_callback: MemoAsyncCallbackV2 + } + struct MemoAsyncCallback has copy, drop { id: u64, module_address: address, module_name: String } + struct MemoAsyncCallbackV2 has copy, drop { + id: u32, // Use u32 instead of u64 to keep it as number type after json marshal. + module_address: address, + module_name: String + } + struct MemoMoveMessage has copy, drop { module_address: String, module_name: String, @@ -2381,11 +2398,11 @@ module initia_std::minitswap { op_denom: String, amount: u64 ): (String, String) { - let memo = IBCMemo { - _move_: MemoMove { + let memo = IBCMemoV2 { + _move_: MemoMoveV2 { message: option::none(), - async_callback: MemoAsyncCallback { - id: batch_index, + async_callback: MemoAsyncCallbackV2 { + id: (batch_index as u32), module_address: @initia_std, module_name: string::utf8(b"minitswap") } @@ -3419,7 +3436,7 @@ module initia_std::minitswap { assert!( memo == string::utf8( - b"{\"evm\":null,\"move\":{\"async_callback\":{\"id\":\"1\",\"module_address\":\"0x1\",\"module_name\":\"minitswap\"},\"message\":{\"args\":[\"CG9wX2Rlbm9t\",\"QEIPAAAAAAA=\",\"CHJlY2VpdmVy\"],\"function_name\":\"minitswap_hook\",\"module_address\":\"0x1\",\"module_name\":\"minitswap_hook\",\"type_args\":[]}},\"wasm\":null}" + b"{\"evm\":null,\"move\":{\"async_callback\":{\"id\":1,\"module_address\":\"0x1\",\"module_name\":\"minitswap\"},\"message\":{\"args\":[\"CG9wX2Rlbm9t\",\"QEIPAAAAAAA=\",\"CHJlY2VpdmVy\"],\"function_name\":\"minitswap_hook\",\"module_address\":\"0x1\",\"module_name\":\"minitswap_hook\",\"type_args\":[]}},\"wasm\":null}" ), 1 ); @@ -3438,7 +3455,7 @@ module initia_std::minitswap { assert!( memo == string::utf8( - b"{\"evm\":null,\"move\":{\"async_callback\":{\"id\":\"1\",\"module_address\":\"0x1\",\"module_name\":\"minitswap\"},\"message\":null},\"wasm\":{\"message\":{\"contracts\":\"cosmwasm_contract_addr\",\"funds\":[{\"amount\":\"1000000\",\"denom\":\"op_denom\"}],\"msg\":{\"minitswap_hook\":{\"receiver\":\"receiver\"}}}}}" + b"{\"evm\":null,\"move\":{\"async_callback\":{\"id\":1,\"module_address\":\"0x1\",\"module_name\":\"minitswap\"},\"message\":null},\"wasm\":{\"message\":{\"contracts\":\"cosmwasm_contract_addr\",\"funds\":[{\"amount\":\"1000000\",\"denom\":\"op_denom\"}],\"msg\":{\"minitswap_hook\":{\"receiver\":\"receiver\"}}}}}" ), 3 ); diff --git a/precompile/modules/initia_stdlib/tests/ibc_transfer_tests.move b/precompile/modules/initia_stdlib/tests/ibc_transfer_tests.move index 69481bdd..c1a822a5 100644 --- a/precompile/modules/initia_stdlib/tests/ibc_transfer_tests.move +++ b/precompile/modules/initia_stdlib/tests/ibc_transfer_tests.move @@ -285,7 +285,7 @@ module cafe::ibc_transfer_tests { }, timeout_timestamp: 0u64, // timeout timestamp is not used in this test memo: string::utf8( - b"{\"move\":{\"async_callback\":{\"id\": \"103\", \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" + b"{\"move\":{\"async_callback\":{\"id\": 103, \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" ) }; @@ -362,7 +362,7 @@ module cafe::ibc_transfer_tests { }, timeout_timestamp: 0u64, // timeout timestamp is not used in this test memo: string::utf8( - b"{\"move\":{\"async_callback\":{\"id\": \"103\", \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" + b"{\"move\":{\"async_callback\":{\"id\": 103, \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" ) }; @@ -441,7 +441,7 @@ module cafe::ibc_transfer_tests { }, timeout_timestamp: 0u64, // timeout timestamp is not used in this test memo: string::utf8( - b"{\"move\":{\"async_callback\":{\"id\": \"103\", \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" + b"{\"move\":{\"async_callback\":{\"id\": 103, \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" ) }; diff --git a/precompile/modules/minitia_stdlib/sources/ibctesting/ibctesting.move b/precompile/modules/minitia_stdlib/sources/ibctesting/ibctesting.move index 826d6045..b18e9e40 100644 --- a/precompile/modules/minitia_stdlib/sources/ibctesting/ibctesting.move +++ b/precompile/modules/minitia_stdlib/sources/ibctesting/ibctesting.move @@ -205,7 +205,7 @@ module minitia_std::ibctesting { check_dispatch_type_compatibility_for_testing( &dispatchable_ibc_timeout_function_info(), &function_info ); - dispatchable_ibc_timeout(async_callback.id, &function_info); + dispatchable_ibc_timeout((async_callback.id as u64), &function_info); } else if (option::is_some(&result.async_callback)) { let async_callback = option::destroy_some(result.async_callback); let function_info = @@ -218,7 +218,7 @@ module minitia_std::ibctesting { &dispatchable_ibc_ack_function_info(), &function_info ); dispatchable_ibc_ack( - async_callback.id, result.success, &function_info + (async_callback.id as u64), result.success, &function_info ); }; } @@ -401,7 +401,7 @@ module minitia_std::ibctesting { } struct MoveAsyncCallback has copy, drop, store { - id: u64, + id: u32, module_address: address, module_name: String } diff --git a/precompile/modules/minitia_stdlib/tests/ibc_transfer_tests.move b/precompile/modules/minitia_stdlib/tests/ibc_transfer_tests.move index 69481bdd..c1a822a5 100644 --- a/precompile/modules/minitia_stdlib/tests/ibc_transfer_tests.move +++ b/precompile/modules/minitia_stdlib/tests/ibc_transfer_tests.move @@ -285,7 +285,7 @@ module cafe::ibc_transfer_tests { }, timeout_timestamp: 0u64, // timeout timestamp is not used in this test memo: string::utf8( - b"{\"move\":{\"async_callback\":{\"id\": \"103\", \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" + b"{\"move\":{\"async_callback\":{\"id\": 103, \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" ) }; @@ -362,7 +362,7 @@ module cafe::ibc_transfer_tests { }, timeout_timestamp: 0u64, // timeout timestamp is not used in this test memo: string::utf8( - b"{\"move\":{\"async_callback\":{\"id\": \"103\", \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" + b"{\"move\":{\"async_callback\":{\"id\": 103, \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" ) }; @@ -441,7 +441,7 @@ module cafe::ibc_transfer_tests { }, timeout_timestamp: 0u64, // timeout timestamp is not used in this test memo: string::utf8( - b"{\"move\":{\"async_callback\":{\"id\": \"103\", \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" + b"{\"move\":{\"async_callback\":{\"id\": 103, \"module_address\": \"0xcafe\", \"module_name\": \"ibc_transfer_tests_helpers\"}}}" ) };