diff --git a/examples/oft-adapter-initia/.gitignore b/examples/oft-adapter-initia/.gitignore index 3fcd075f0..41e89b301 100644 --- a/examples/oft-adapter-initia/.gitignore +++ b/examples/oft-adapter-initia/.gitignore @@ -30,3 +30,4 @@ shell-scripts transactions/* !transactions/.gitkeep +deployments diff --git a/examples/oft-adapter-initia/README.md b/examples/oft-adapter-initia/README.md index cf988b447..69a852a1f 100644 --- a/examples/oft-adapter-initia/README.md +++ b/examples/oft-adapter-initia/README.md @@ -22,7 +22,7 @@ https://docs.initia.xyz/build-on-initia/initiad After installation, generate a new key and add it to the keyring: ```bash -initiad keys add --key-type secp256k1 --coin-type 118 --keyring-backend test +initiad keys add --keyring-backend test ``` For more information on key management please reference the Initiad docs: https://docs.initia.xyz/build-on-initia/initiad#managing-keys @@ -92,7 +92,7 @@ pnpm run lz:sdk:move:build --oapp-config move.layerzero.config.ts --oapp-type of To build and deploy the contracts, run the following command: ```bash -pnpm run lz:sdk:move:deploy --oapp-config move.layerzero.config.ts --address-name oft --move-deploy-script deploy-move/OFTInitParams.ts --oapp-type oft +pnpm run lz:sdk:move:deploy --oapp-config move.layerzero.config.ts --address-name oft --move-deploy-script deploy-move/OFTAdapterInitParams.ts --oapp-type oft ``` ## EVM Deployment @@ -110,6 +110,7 @@ First modify deploy-move/OFTAdapterInitParams.ts and replace the oftMetadata wit ```ts const oftMetadata = { move_vm_fa_address: "", + localDecimals: 6, }; ``` @@ -275,12 +276,13 @@ pnpm run lz:sdk:move:mint-to-move-oft --oapp-config move.layerzero.config.ts --a ```bash pnpm run lz:sdk:move:send-from-move-oft \ + --oapp-config move.layerzero.config.ts \ --amount-ld \ --min-amount-ld \ --src-address \ --to-address \ --gas-limit \ - --dst-eid \ + --dst-eid ``` ## Send from EVM diff --git a/examples/oft-adapter-initia/deploy-move/OFTAdapterInitParams.ts b/examples/oft-adapter-initia/deploy-move/OFTAdapterInitParams.ts index 35b9e572d..78d3e7f47 100644 --- a/examples/oft-adapter-initia/deploy-move/OFTAdapterInitParams.ts +++ b/examples/oft-adapter-initia/deploy-move/OFTAdapterInitParams.ts @@ -2,6 +2,7 @@ import { OFTAdapterFaInitParams } from '@layerzerolabs/oft-move' const oftMetadata: OFTAdapterFaInitParams = { move_vm_fa_address: '', + localDecimals: 6, } export default oftMetadata diff --git a/examples/oft-adapter-initia/deploy/MyEVMOFT.ts b/examples/oft-adapter-initia/deploy/MyEVMOFT.ts index bcbdeb19b..69783993f 100644 --- a/examples/oft-adapter-initia/deploy/MyEVMOFT.ts +++ b/examples/oft-adapter-initia/deploy/MyEVMOFT.ts @@ -43,6 +43,7 @@ const deploy: DeployFunction = async (hre) => { ], log: true, skipIfAlreadyDeployed: false, + gasLimit: 3_000_000, }) console.log(`Deployed contract: ${contractName}, network: ${hre.network.name}, address: ${address}`) diff --git a/examples/oft-adapter-initia/hardhat.config.ts b/examples/oft-adapter-initia/hardhat.config.ts index 2dccc261f..7faa5bacb 100644 --- a/examples/oft-adapter-initia/hardhat.config.ts +++ b/examples/oft-adapter-initia/hardhat.config.ts @@ -52,14 +52,9 @@ const config: HardhatUserConfig = { ], }, networks: { - 'arbitrum-sepolia': { - eid: EndpointId.ARBSEP_V2_TESTNET, - url: process.env.RPC_URL_ARBITRUM_SEPOLIA || 'https://arbitrum-sepolia.gateway.tenderly.co', - accounts, - }, - 'sepolia-testnet': { - eid: EndpointId.SEPOLIA_V2_TESTNET, - url: process.env.RPC_URL_SEPOLIA || 'https://sepolia.infura.io/v3/', + 'bsc-testnet': { + eid: EndpointId.BSC_V2_TESTNET, + url: process.env.RPC_URL_BSC_TESTNET || 'https://data-seed-prebsc-1-s1.binance.org:8545', accounts, }, hardhat: { diff --git a/examples/oft-adapter-initia/move.layerzero.config.ts b/examples/oft-adapter-initia/move.layerzero.config.ts index 6d21d93d8..57641657b 100644 --- a/examples/oft-adapter-initia/move.layerzero.config.ts +++ b/examples/oft-adapter-initia/move.layerzero.config.ts @@ -9,7 +9,7 @@ enum MsgType { } const bscContract: OmniPointHardhat = { - eid: EndpointId.ARBSEP_V2_TESTNET, + eid: EndpointId.BSC_V2_TESTNET, contractName: 'MyOFT', } @@ -90,7 +90,7 @@ const config: OAppOmniGraphHardhat = { receiveConfig: { ulnConfig: { // The number of block confirmations to expect from the `to` chain. - confirmations: BigInt(5), + confirmations: BigInt(10), // The address of the DVNs your `receiveConfig` expects to receive verifications from on the `from` chain. // The `from` chain's OApp will wait until the configured threshold of `requiredDVNs` verify the message. requiredDVNs: ['0x3f12330ba9e26a604e2149b4b67c0710d32fcbc3de0bea76dd43dbb6b747bc8c'], @@ -136,14 +136,14 @@ const config: OAppOmniGraphHardhat = { executor: '0x31894b190a8bAbd9A067Ce59fde0BfCFD2B18470', }, ulnConfig: { - confirmations: BigInt(5), + confirmations: BigInt(10), requiredDVNs: ['0x0eE552262f7B562eFcED6DD4A7e2878AB897d405'], optionalDVNThreshold: 0, }, }, receiveConfig: { ulnConfig: { - confirmations: BigInt(10), + confirmations: BigInt(2), requiredDVNs: ['0x0eE552262f7B562eFcED6DD4A7e2878AB897d405'], optionalDVNThreshold: 0, }, diff --git a/examples/oft-adapter-initia/sources/oft_implementation/oft_adapter_fa.move b/examples/oft-adapter-initia/sources/oft_implementation/oft_adapter_fa.move index bc161497b..446b6998d 100644 --- a/examples/oft-adapter-initia/sources/oft_implementation/oft_adapter_fa.move +++ b/examples/oft-adapter-initia/sources/oft_implementation/oft_adapter_fa.move @@ -279,7 +279,8 @@ module oft::oft_adapter_fa { public entry fun initialize( account: &signer, token_metadata_address: address, - shared_decimals: u8 + shared_decimals: u8, + local_decimals: Option ) acquires OftImpl { // Only the admin can initialize the OFT assert_admin(address_of(account)); @@ -289,8 +290,14 @@ module oft::oft_adapter_fa { let metadata = address_to_object(token_metadata_address); store_mut().metadata = option::some(metadata); + // compute the local decimals + let local_decimals = if (option::is_some(&local_decimals)) { + *option::borrow(&local_decimals) + } else { + fungible_asset::decimals(metadata) + }; + // Initialize the OFT Core - let local_decimals = fungible_asset::decimals(metadata); oft_core::initialize(local_decimals, shared_decimals); } diff --git a/examples/oft-adapter-initia/tests/implementations/oft_adapter_fa_tests.move b/examples/oft-adapter-initia/tests/implementations/oft_adapter_fa_tests.move index aa0a54fee..967f87f5e 100644 --- a/examples/oft-adapter-initia/tests/implementations/oft_adapter_fa_tests.move +++ b/examples/oft-adapter-initia/tests/implementations/oft_adapter_fa_tests.move @@ -54,6 +54,7 @@ module oft::oft_adapter_fa_tests { // Some of the tests expect that that shared decimals is 6. If this is changed, the tests will need to be // updated (specifically the values need to be adjusted for dust) 6, + option::none(), ); mint_ref diff --git a/examples/oft-adapter-initia/tests/oapp_receive_using_oft_adapter_fa_tests.move b/examples/oft-adapter-initia/tests/oapp_receive_using_oft_adapter_fa_tests.move index 26e6ebccd..e1c4140dc 100644 --- a/examples/oft-adapter-initia/tests/oapp_receive_using_oft_adapter_fa_tests.move +++ b/examples/oft-adapter-initia/tests/oapp_receive_using_oft_adapter_fa_tests.move @@ -3,6 +3,7 @@ module oft::oapp_receive_using_oft_adapter_fa_tests { use std::account::create_signer_for_test; use std::event::was_event_emitted; use std::fungible_asset::{Self, MintRef}; + use std::option; use std::primary_fungible_store; use std::string::utf8; @@ -38,7 +39,7 @@ module oft::oapp_receive_using_oft_adapter_fa_tests { // Generates a fungible asset with 8 decimals let (fa, _, mint_ref) = create_fa(b"My Test Token"); - oft_adapter_fa::initialize(oft_admin, fa, 6); + oft_adapter_fa::initialize(oft_admin, fa, 6, option::none()); oapp_core::set_peer(oft_admin, SRC_EID, from_bytes32(from_address(@1234))); oapp_core::set_peer(oft_admin, DST_EID, from_bytes32(from_address(@4321))); diff --git a/examples/oft-adapter-initia/tests/oft_using_oft_adapter_fa_tests.move b/examples/oft-adapter-initia/tests/oft_using_oft_adapter_fa_tests.move index ddf7b6c5d..c4e15a68b 100644 --- a/examples/oft-adapter-initia/tests/oft_using_oft_adapter_fa_tests.move +++ b/examples/oft-adapter-initia/tests/oft_using_oft_adapter_fa_tests.move @@ -44,7 +44,7 @@ module oft::oft_using_oft_adapter_fa_tests { // Generates a fungible asset with 8 decimals let (fa, _, mint_ref) = create_fa(b"My Test Token"); - oft_adapter_fa::initialize(oft_admin, fa, 6); + oft_adapter_fa::initialize(oft_admin, fa, 6, option::none()); let remote_oapp = from_address(@2000); set_peer(oft_admin, DST_EID, from_bytes32(remote_oapp)); diff --git a/examples/oft-initia/.gitignore b/examples/oft-initia/.gitignore index 738da4dab..e1af08214 100644 --- a/examples/oft-initia/.gitignore +++ b/examples/oft-initia/.gitignore @@ -31,3 +31,4 @@ shell-scripts transactions/* !transactions/.gitkeep +deployments diff --git a/examples/oft-initia/README.md b/examples/oft-initia/README.md index cce9b3d45..34da9f2f9 100644 --- a/examples/oft-initia/README.md +++ b/examples/oft-initia/README.md @@ -22,7 +22,7 @@ https://docs.initia.xyz/build-on-initia/initiad After installation, generate a new key and add it to the keyring: ```bash -initiad keys add --key-type secp256k1 --coin-type 118 --keyring-backend test +initiad keys add --keyring-backend test ``` For more information on key management please reference the Initiad docs: https://docs.initia.xyz/build-on-initia/initiad#managing-keys @@ -293,12 +293,13 @@ pnpm run lz:sdk:move:mint-to-move-oft --oapp-config move.layerzero.config.ts --a ```bash pnpm run lz:sdk:move:send-from-move-oft \ + --oapp-config move.layerzero.config.ts \ --amount-ld \ --min-amount-ld \ --src-address \ --to-address \ --gas-limit \ - --dst-eid \ + --dst-eid ``` ## Send from EVM diff --git a/examples/oft-initia/hardhat.config.ts b/examples/oft-initia/hardhat.config.ts index d43efd454..7faa5bacb 100644 --- a/examples/oft-initia/hardhat.config.ts +++ b/examples/oft-initia/hardhat.config.ts @@ -52,14 +52,9 @@ const config: HardhatUserConfig = { ], }, networks: { - 'arbitrum-sepolia': { - eid: EndpointId.ARBSEP_V2_TESTNET, - url: process.env.RPC_URL_ARB_SEPOLIA || 'https://arbitrum-sepolia.gateway.tenderly.co', - accounts, - }, - 'base-sepolia': { - eid: EndpointId.BASESEP_V2_TESTNET, - url: process.env.RPC_URL_BASE_SEPOLIA || 'https://base-sepolia.gateway.tenderly.co', + 'bsc-testnet': { + eid: EndpointId.BSC_V2_TESTNET, + url: process.env.RPC_URL_BSC_TESTNET || 'https://data-seed-prebsc-1-s1.binance.org:8545', accounts, }, hardhat: { diff --git a/examples/oft-initia/move.layerzero.config.ts b/examples/oft-initia/move.layerzero.config.ts index 8900222a4..57641657b 100644 --- a/examples/oft-initia/move.layerzero.config.ts +++ b/examples/oft-initia/move.layerzero.config.ts @@ -9,7 +9,7 @@ enum MsgType { } const bscContract: OmniPointHardhat = { - eid: EndpointId.ARBSEP_V2_TESTNET, + eid: EndpointId.BSC_V2_TESTNET, contractName: 'MyOFT', } @@ -74,7 +74,7 @@ const config: OAppOmniGraphHardhat = { }, ulnConfig: { // The number of block confirmations to wait on Initia before emitting the message from the source chain. - confirmations: BigInt(1_000_000), + confirmations: BigInt(10), // The address of the DVNs you will pay to verify a sent message on the source chain. // The destination tx will wait until ALL `requiredDVNs` verify the message. requiredDVNs: ['0x3f12330ba9e26a604e2149b4b67c0710d32fcbc3de0bea76dd43dbb6b747bc8c'], @@ -90,7 +90,7 @@ const config: OAppOmniGraphHardhat = { receiveConfig: { ulnConfig: { // The number of block confirmations to expect from the `to` chain. - confirmations: BigInt(5), + confirmations: BigInt(10), // The address of the DVNs your `receiveConfig` expects to receive verifications from on the `from` chain. // The `from` chain's OApp will wait until the configured threshold of `requiredDVNs` verify the message. requiredDVNs: ['0x3f12330ba9e26a604e2149b4b67c0710d32fcbc3de0bea76dd43dbb6b747bc8c'], @@ -111,13 +111,13 @@ const config: OAppOmniGraphHardhat = { { msgType: MsgType.SEND, optionType: ExecutorOptionType.LZ_RECEIVE, - gas: 300_000, // gas limit in wei for EndpointV2.lzReceive + gas: 5_000, // gas limit in wei for EndpointV2.lzReceive value: 0, // msg.value in wei for EndpointV2.lzReceive }, { msgType: MsgType.SEND_AND_CALL, optionType: ExecutorOptionType.LZ_RECEIVE, - gas: 300_000, // gas limit in wei for EndpointV2.lzCompose + gas: 5_000, // gas limit in wei for EndpointV2.lzCompose value: 0, // msg.value in wei for EndpointV2.lzCompose }, ], @@ -132,18 +132,18 @@ const config: OAppOmniGraphHardhat = { // }, sendConfig: { executorConfig: { - maxMessageSize: 100_000, + maxMessageSize: 10_000, executor: '0x31894b190a8bAbd9A067Ce59fde0BfCFD2B18470', }, ulnConfig: { - confirmations: BigInt(5), + confirmations: BigInt(10), requiredDVNs: ['0x0eE552262f7B562eFcED6DD4A7e2878AB897d405'], optionalDVNThreshold: 0, }, }, receiveConfig: { ulnConfig: { - confirmations: BigInt(1_000_000), + confirmations: BigInt(2), requiredDVNs: ['0x0eE552262f7B562eFcED6DD4A7e2878AB897d405'], optionalDVNThreshold: 0, }, diff --git a/examples/oft-initia/package.json b/examples/oft-initia/package.json index 2c7f48d32..937431afa 100644 --- a/examples/oft-initia/package.json +++ b/examples/oft-initia/package.json @@ -44,7 +44,6 @@ "hardhat-deploy": "^0.12.1" }, "dependencies": { - "@initia/initia.js": "^0.2.28", "@types/glob": "^8.1.0", "glob": "^11.0.1" }, diff --git a/packages/devtools-move/package.json b/packages/devtools-move/package.json index f6b093c3b..af0088b20 100644 --- a/packages/devtools-move/package.json +++ b/packages/devtools-move/package.json @@ -39,7 +39,7 @@ }, "devDependencies": { "@aptos-labs/ts-sdk": "^1.33.1", - "@initia/initia.js": "^0.2.28", + "@initia/initia.js": "^1.0.0", "@jest/globals": "^29.7.0", "@layerzerolabs/devtools-extensible-cli": "^0.0.7", "@layerzerolabs/io-devtools": "^0.3.2", diff --git a/packages/devtools-move/sdk/IOFT.ts b/packages/devtools-move/sdk/IOFT.ts index 0b1a51902..f2504a41c 100644 --- a/packages/devtools-move/sdk/IOFT.ts +++ b/packages/devtools-move/sdk/IOFT.ts @@ -35,7 +35,8 @@ export interface IOFT { initializeAdapterFAPayload( tokenMetadataAddress: string, - sharedDecimals: number + sharedDecimals: number, + localDecimals?: number ): TypedInputGenerateTransactionPayloadData createSetRateLimitTx( diff --git a/packages/devtools-move/sdk/aptosOFT.ts b/packages/devtools-move/sdk/aptosOFT.ts index aaab9e7b8..97f8bbfaa 100644 --- a/packages/devtools-move/sdk/aptosOFT.ts +++ b/packages/devtools-move/sdk/aptosOFT.ts @@ -67,12 +67,13 @@ export class aptosOFT implements IOFT { initializeAdapterFAPayload( tokenMetadataAddress: string, - sharedDecimals: number + sharedDecimals: number, + localDecimals?: number ): TypedInputGenerateTransactionPayloadData { return { function: `${this.oft_address}::oft_adapter_fa::initialize`, - functionArguments: [tokenMetadataAddress, sharedDecimals], - types: ['address', 'u8'], + functionArguments: [tokenMetadataAddress, sharedDecimals, localDecimals || 0], + types: ['address', 'u8', 'u8'], } } diff --git a/packages/devtools-move/sdk/initiaOFT.ts b/packages/devtools-move/sdk/initiaOFT.ts index 4be835c1b..8b9d7fe7f 100644 --- a/packages/devtools-move/sdk/initiaOFT.ts +++ b/packages/devtools-move/sdk/initiaOFT.ts @@ -583,7 +583,8 @@ export class InitiaOFT implements IOFT { initializeAdapterFAPayload( tokenMetadataAddress: string, - sharedDecimals: number + sharedDecimals: number, + localDecimals?: number ): TypedInputGenerateTransactionPayloadData { const msg = new MsgExecute( this.accountAddress, @@ -591,11 +592,15 @@ export class InitiaOFT implements IOFT { 'oft_adapter_fa', 'initialize', [], - [bcs.address().serialize(tokenMetadataAddress).toBase64(), bcs.u8().serialize(sharedDecimals).toBase64()] + [ + bcs.address().serialize(tokenMetadataAddress).toBase64(), + bcs.u8().serialize(sharedDecimals).toBase64(), + bcs.option(bcs.u8()).serialize(localDecimals).toBase64(), + ] ) return Object.assign(msg, { - types: ['address', 'u8'], - multiSigArgs: [tokenMetadataAddress, sharedDecimals], + types: ['address', 'u8', 'u8'], + multiSigArgs: [tokenMetadataAddress, sharedDecimals, localDecimals || 0], }) } diff --git a/packages/devtools-move/sdk/oft.ts b/packages/devtools-move/sdk/oft.ts index ad6f5008b..d02482e4f 100644 --- a/packages/devtools-move/sdk/oft.ts +++ b/packages/devtools-move/sdk/oft.ts @@ -71,12 +71,13 @@ export class OFT { initializeAdapterFAPayload( tokenMetadataAddress: string, - sharedDecimals: number + sharedDecimals: number, + localDecimals?: number ): TypedInputGenerateTransactionPayloadData { return { function: `${this.oft_address}::oft_adapter_fa::initialize`, - functionArguments: [tokenMetadataAddress, sharedDecimals], - types: ['address', 'u8'], + functionArguments: [tokenMetadataAddress, sharedDecimals, localDecimals || 0], + types: ['address', 'u8', 'u8'], } } diff --git a/packages/devtools-move/tasks/move/build.ts b/packages/devtools-move/tasks/move/build.ts index a79631986..9e09d926f 100644 --- a/packages/devtools-move/tasks/move/build.ts +++ b/packages/devtools-move/tasks/move/build.ts @@ -3,7 +3,7 @@ import { spawn } from 'child_process' import fs from 'fs' import path from 'path' import { DeployTaskContext } from '../../sdk/baseTaskHelper' -import { getAptosCLICommand, checkInitiaCLIVersion } from './utils/config' +import { getAptosCLICommand } from './utils/config' let stdErr = '' @@ -70,7 +70,6 @@ async function getCLICmd(chain: string, stage: string) { if (chain === 'aptos' || chain === 'movement') { return await getAptosCLICommand(chain, stage) } else if (chain === 'initia') { - await checkInitiaCLIVersion() return 'initiad' } else { throw new Error(`Chain ${chain}-${stage} not supported for build.`) diff --git a/packages/devtools-move/tasks/move/deploy.ts b/packages/devtools-move/tasks/move/deploy.ts index 577421e4c..12ba4fb7d 100644 --- a/packages/devtools-move/tasks/move/deploy.ts +++ b/packages/devtools-move/tasks/move/deploy.ts @@ -7,7 +7,7 @@ import { deploymentFile } from '../shared/types' import path from 'path' import type { OAppOmniGraphHardhat } from '@layerzerolabs/toolbox-hardhat' import { DeployTaskContext } from '../../sdk/baseTaskHelper' -import { getAptosCLICommand, checkInitiaCLIVersion } from './utils/config' +import { getAptosCLICommand } from './utils/config' let stdOut = '' let stdErr = '' @@ -36,7 +36,6 @@ async function deployMovementContracts( `--named-addresses=${namedAddresses}`, ] } else if (chainName === 'initia') { - checkInitiaCLIVersion() const userAccountName = getInitiaKeyName() cmd = 'initiad' diff --git a/packages/devtools-move/tasks/move/utils/config.ts b/packages/devtools-move/tasks/move/utils/config.ts index 7777f4e82..a25153ba1 100644 --- a/packages/devtools-move/tasks/move/utils/config.ts +++ b/packages/devtools-move/tasks/move/utils/config.ts @@ -292,28 +292,6 @@ async function getAptosVersion(aptosCommand: string): Promise { }) } -async function getInitiaVersion(): Promise { - return new Promise((resolve, reject) => { - const childProcess = spawn('initiad', ['version']) - let stdout = '' - - childProcess.stdout?.on('data', (data) => { - stdout += data.toString() - }) - - childProcess.on('close', (code) => { - if (code === 0) { - const versionMatch = stdout.match(/v(\d+\.\d+\.\d+)/) - versionMatch ? resolve(versionMatch[1]) : reject(new Error(`Could not parse version`)) - } else { - reject(new Error(`initiad version exited with code ${code}`)) - } - }) - - childProcess.on('error', reject) - }) -} - async function promptVersionWarningConfirmation(): Promise { const { shouldContinue } = await inquirer.prompt([ { @@ -368,17 +346,6 @@ export async function getAptosCLICommand(chain: string, stage: string): Promise< return aptosCommand } -export async function checkInitiaCLIVersion(): Promise { - const version = await getInitiaVersion() - const SUPPORTED_VERSIONS = ['0.7.2', '0.7.3'] - - if (SUPPORTED_VERSIONS.includes(version)) { - console.log(`šŸš€ Initia CLI version ${version} is compatible.`) - } else { - throw new Error(`āŒ Initia CLI version ${version} is not supported. Required: ${SUPPORTED_VERSIONS}`) - } -} - export function isVersionGreaterOrEqualTo(installed: string, required: string): boolean { const installedParts = installed.split('.').map(Number) const requiredParts = required.split('.').map(Number) diff --git a/packages/oft-move/cli/operations/init-move-oft-fa-adapter.ts b/packages/oft-move/cli/operations/init-move-oft-fa-adapter.ts index 1377dfe12..9a1eaca0b 100644 --- a/packages/oft-move/cli/operations/init-move-oft-fa-adapter.ts +++ b/packages/oft-move/cli/operations/init-move-oft-fa-adapter.ts @@ -22,7 +22,12 @@ class InitOFTFAAdapter implements INewOperation { const taskContext = await initializeTaskContext(args.oapp_config) - await initOFTAdapterFA(taskContext, oftMetadata.move_vm_fa_address, oftMetadata.sharedDecimals) + await initOFTAdapterFA( + taskContext, + oftMetadata.move_vm_fa_address, + oftMetadata.sharedDecimals, + oftMetadata.localDecimals + ) } } diff --git a/packages/oft-move/tasks/initOFTAdapterFA.ts b/packages/oft-move/tasks/initOFTAdapterFA.ts index 182bf475f..2e7a01b66 100644 --- a/packages/oft-move/tasks/initOFTAdapterFA.ts +++ b/packages/oft-move/tasks/initOFTAdapterFA.ts @@ -1,11 +1,22 @@ import { sendInitTransaction, TaskContext } from '@layerzerolabs/devtools-move' -async function initOFTAdapterFA(taskContext: TaskContext, move_vm_fa_address: string, sharedDecimals: number = 6) { +async function initOFTAdapterFA( + taskContext: TaskContext, + move_vm_fa_address: string, + sharedDecimals: number = 6, + localDecimals?: number +) { console.log(`\n⚔ Initializing OFT Adapter`) console.log(` Address: ${taskContext.oAppAddress}\n`) - console.log(`${taskContext.chain} FA Address: ${move_vm_fa_address}`) + console.log(` ${taskContext.chain} FA Address: ${move_vm_fa_address}`) + console.log(` Shared Decimals: ${sharedDecimals}`) + console.log(` Local Decimals: ${localDecimals}`) - const initializePayload = taskContext.oft.initializeAdapterFAPayload(move_vm_fa_address, sharedDecimals) + const initializePayload = taskContext.oft.initializeAdapterFAPayload( + move_vm_fa_address, + sharedDecimals, + localDecimals + ) const payloads = [ { payload: initializePayload, description: `Initialize ${taskContext.chain} OFT`, eid: taskContext.srcEid }, diff --git a/packages/oft-move/types/OFTAdapterFAInitParams.ts b/packages/oft-move/types/OFTAdapterFAInitParams.ts index 8e7180c88..527db400c 100644 --- a/packages/oft-move/types/OFTAdapterFAInitParams.ts +++ b/packages/oft-move/types/OFTAdapterFAInitParams.ts @@ -1,4 +1,5 @@ export type OFTAdapterFaInitParams = { move_vm_fa_address: string sharedDecimals?: number + localDecimals?: number } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 317bae13d..680fa8cc4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2186,9 +2186,6 @@ importers: examples/oft-initia: dependencies: - '@initia/initia.js': - specifier: ^0.2.28 - version: 0.2.32(typescript@5.5.3) '@types/glob': specifier: ^8.1.0 version: 8.1.0 @@ -4026,8 +4023,8 @@ importers: specifier: ^1.33.1 version: 1.33.2 '@initia/initia.js': - specifier: ^0.2.28 - version: 0.2.32(typescript@5.5.3) + specifier: ^1.0.0 + version: 1.0.5(typescript@5.5.3) '@jest/globals': specifier: ^29.7.0 version: 29.7.0 @@ -4855,7 +4852,7 @@ importers: version: 5.0.2(@openzeppelin/contracts@5.0.2) rimraf: specifier: ^6.0.1 - version: 6.0.1 + version: 6.1.0 packages/ovault-evm: dependencies: @@ -7344,7 +7341,7 @@ packages: /@bitcoinerlab/secp256k1@1.2.0: resolution: {integrity: sha512-jeujZSzb3JOZfmJYI0ph1PVpCRV5oaexCgy+RvCXV8XlY+XFB/2n3WOcvBsKLsOw78KYgnQrQWb2HrKE4be88Q==} dependencies: - '@noble/curves': 1.8.1 + '@noble/curves': 1.9.6 /@chainlink/contracts-ccip@0.7.6(ethers@5.7.2): resolution: {integrity: sha512-yNbCBFpLs3R+ALymto9dQYKz3vatnjqYGu1pnMD0i2fHEMthiXe0+otaNCGNht6n8k7ruNaA0DNpz3F+2jHQXw==} @@ -9121,7 +9118,7 @@ packages: '@ledgerhq/hw-transport': 6.31.4 '@ledgerhq/hw-transport-webhid': 6.30.0 '@ledgerhq/hw-transport-webusb': 6.29.4 - '@mysten/bcs': 1.2.0 + '@mysten/bcs': 1.8.0 axios: 1.8.4 bech32: 2.0.0 bignumber.js: 9.1.2 @@ -9132,12 +9129,13 @@ packages: ripemd160: 2.0.2 secp256k1: 5.0.1 semver: 7.6.3 - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.18.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - debug - typescript - utf-8-validate + dev: true /@initia/initia.js@1.0.4(typescript@5.5.3): resolution: {integrity: sha512-oFfj8heWUFxK/OFAAa8A9NzcBB3M7r6hG1lMLHwGbMLPRbhK4iVY/V1FxcBjspKAuLNsdsb/k+Oc/JUl0iyixQ==} @@ -9149,7 +9147,7 @@ packages: '@ledgerhq/hw-transport': 6.31.4 '@ledgerhq/hw-transport-webhid': 6.30.0 '@ledgerhq/hw-transport-webusb': 6.29.4 - '@mysten/bcs': 1.2.0 + '@mysten/bcs': 1.8.0 axios: 1.8.4 bech32: 2.0.0 bignumber.js: 9.1.2 @@ -9160,7 +9158,7 @@ packages: ripemd160: 2.0.2 secp256k1: 5.0.1 semver: 7.6.3 - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.18.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - debug @@ -9177,7 +9175,7 @@ packages: '@ledgerhq/hw-transport': 6.31.4 '@ledgerhq/hw-transport-webhid': 6.30.0 '@ledgerhq/hw-transport-webusb': 6.29.4 - '@mysten/bcs': 1.2.0 + '@mysten/bcs': 1.8.0 axios: 1.8.4 bech32: 2.0.0 bignumber.js: 9.1.2 @@ -9188,7 +9186,7 @@ packages: ripemd160: 2.0.2 secp256k1: 5.0.1 semver: 7.6.3 - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.18.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - debug @@ -9620,6 +9618,18 @@ packages: dependencies: multiformats: 9.9.0 + /@isaacs/balanced-match@4.0.1: + resolution: {integrity: sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==} + engines: {node: 20 || >=22} + dev: true + + /@isaacs/brace-expansion@5.0.0: + resolution: {integrity: sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==} + engines: {node: 20 || >=22} + dependencies: + '@isaacs/balanced-match': 4.0.1 + dev: true + /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -12326,7 +12336,7 @@ packages: '@ton/crypto': 3.3.0 '@ton/sandbox': 0.22.0(@ton/core@0.59.0)(@ton/crypto@3.3.0) '@ton/test-utils': 0.4.2(@jest/globals@29.7.0)(@ton/core@0.59.0)(chai@4.5.0) - axios: 1.7.9 + axios: 1.8.4 dataloader: 2.2.2 symbol.inspect: 1.0.1 teslabot: 1.5.0 @@ -12354,7 +12364,7 @@ packages: '@ton/crypto': 3.3.0 '@ton/sandbox': 0.22.0(@ton/core@0.59.0)(@ton/crypto@3.3.0) '@ton/test-utils': 0.4.2(@ton/core@0.59.0)(chai@4.4.1) - axios: 1.7.9 + axios: 1.8.4 dataloader: 2.2.2 symbol.inspect: 1.0.1 teslabot: 1.5.0 @@ -12411,7 +12421,7 @@ packages: '@ton/crypto': 3.3.0 '@ton/sandbox': 0.22.0(@ton/core@0.59.0)(@ton/crypto@3.3.0) '@ton/test-utils': 0.4.2(@jest/globals@29.7.0)(@ton/core@0.59.0)(chai@4.5.0) - axios: 1.7.9 + axios: 1.8.4 dataloader: 2.2.2 symbol.inspect: 1.0.1 teslabot: 1.5.0 @@ -12929,11 +12939,6 @@ packages: multiformats: 9.9.0 murmurhash3js-revisited: 3.0.0 - /@mysten/bcs@1.2.0: - resolution: {integrity: sha512-LuKonrGdGW7dq/EM6U2L9/as7dFwnhZnsnINzB/vu08Xfrj0qzWwpLOiXagAa5yZOPLK7anRZydMonczFkUPzA==} - dependencies: - bs58: 6.0.0 - /@mysten/bcs@1.8.0: resolution: {integrity: sha512-bDoLN1nN+XPONsvpNyNyqYHndM3PKWS419GLeRnbLoWyNm4bnyD1X4luEpJLLDq400hBuXiCan4RWjofvyTUIQ==} dependencies: @@ -13975,6 +13980,7 @@ packages: /@scure/base@1.2.4: resolution: {integrity: sha512-5Yy9czTO47mqz+/J8GM6GIId4umdCk1wc1q8rKERQulIoc8VP9pzDcghv10Tl2E7R96ZUx/PhND3ESYUQX8NuQ==} + dev: true /@scure/base@1.2.6: resolution: {integrity: sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==} @@ -16672,8 +16678,8 @@ packages: resolution: {integrity: sha512-5hVFGrdCnF8GB1Lj2eEo4PRE7+jp+3xBLnfNjydivOkMvKmUKeJ9GG8uOy8prmWl3Oh154uzgfudR1FRkNBudA==} engines: {node: '>=18.0.0'} dependencies: - '@noble/hashes': 1.7.1 - '@scure/base': 1.2.4 + '@noble/hashes': 1.8.0 + '@scure/base': 1.2.6 uint8array-tools: 0.0.8 valibot: 0.37.0(typescript@5.5.3) wif: 5.0.0 @@ -17790,6 +17796,15 @@ packages: shebang-command: 2.0.0 which: 2.0.2 + /cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + /crypt@0.0.2: resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} dev: false @@ -19821,6 +19836,14 @@ packages: cross-spawn: 7.0.5 signal-exit: 4.1.0 + /foreground-child@3.3.1: + resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} + engines: {node: '>=14'} + dependencies: + cross-spawn: 7.0.6 + signal-exit: 4.1.0 + dev: true + /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} @@ -20170,6 +20193,20 @@ packages: minipass: 7.1.2 package-json-from-dist: 1.0.0 path-scurry: 2.0.0 + dev: false + + /glob@11.0.3: + resolution: {integrity: sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==} + engines: {node: 20 || >=22} + hasBin: true + dependencies: + foreground-child: 3.3.1 + jackspeak: 4.1.1 + minimatch: 10.1.1 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 2.0.0 + dev: true /glob@7.1.7: resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} @@ -21480,7 +21517,7 @@ packages: peerDependencies: ws: '*' dependencies: - ws: 8.18.3 + ws: 8.18.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) dev: false /isstream@0.1.2: @@ -21620,6 +21657,14 @@ packages: '@isaacs/cliui': 8.0.2 optionalDependencies: '@pkgjs/parseargs': 0.11.0 + dev: false + + /jackspeak@4.1.1: + resolution: {integrity: sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==} + engines: {node: 20 || >=22} + dependencies: + '@isaacs/cliui': 8.0.2 + dev: true /jake@10.9.2: resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==} @@ -23302,6 +23347,14 @@ packages: engines: {node: 20 || >=22} dependencies: brace-expansion: 2.0.1 + dev: false + + /minimatch@10.1.1: + resolution: {integrity: sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==} + engines: {node: 20 || >=22} + dependencies: + '@isaacs/brace-expansion': 5.0.0 + dev: true /minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -24018,6 +24071,10 @@ packages: /package-json-from-dist@1.0.0: resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==} + /package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + dev: true + /package-json@8.1.1: resolution: {integrity: sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA==} engines: {node: '>=14.16'} @@ -25036,13 +25093,13 @@ packages: glob: 10.3.10 dev: true - /rimraf@6.0.1: - resolution: {integrity: sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==} + /rimraf@6.1.0: + resolution: {integrity: sha512-DxdlA1bdNzkZK7JiNWH+BAx1x4tEJWoTofIopFo6qWUU94jYrFZ0ubY05TqH3nWPJ1nKa1JWVFDINZ3fnrle/A==} engines: {node: 20 || >=22} hasBin: true dependencies: - glob: 11.0.1 - package-json-from-dist: 1.0.0 + glob: 11.0.3 + package-json-from-dist: 1.0.1 dev: true /ripemd160@2.0.2: @@ -25126,7 +25183,7 @@ packages: buffer: 6.0.3 eventemitter3: 5.0.1 uuid: 8.3.2 - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.18.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) optionalDependencies: bufferutil: 4.0.8 utf-8-validate: 5.0.10 @@ -27270,7 +27327,7 @@ packages: isows: 1.0.7(ws@8.18.3) ox: 0.9.1(typescript@5.5.3)(zod@3.22.4) typescript: 5.5.3 - ws: 8.18.3 + ws: 8.18.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -27834,8 +27891,8 @@ packages: optional: true dev: true - /ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): - resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} + /ws@8.18.3(bufferutil@4.0.8)(utf-8-validate@5.0.10): + resolution: {integrity: sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 @@ -27849,19 +27906,6 @@ packages: bufferutil: 4.0.8 utf-8-validate: 5.0.10 - /ws@8.18.3: - resolution: {integrity: sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: false - /xhr-request-promise@0.1.3: resolution: {integrity: sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg==} dependencies: