From 1f7de982d638d5ddc2ed0d37814af81c4fa1e42a Mon Sep 17 00:00:00 2001
From: Ryan Goulding <goulding@layerzerolabs.org>
Date: Tue, 5 Dec 2023 13:40:54 -0800
Subject: [PATCH] feat: options

Signed-off-by: Ryan Goulding <goulding@layerzerolabs.org>
---
 .../contracts/DefaultOApp.sol                 |   8 +-
 .../deploy/001_bootstrap.ts                   | 112 +++++++++++++++
 .../deploy/002_oapp.ts                        |   2 +
 .../ua-utils-evm-hardhat-test/package.json    |   3 +
 .../test/__utils__/endpoint.ts                |  59 ++++++--
 .../test/endpoint/config.test.ts              |  11 +-
 .../test/oapp/options.test.ts                 | 134 ++++++++++++++++++
 .../test/task/getDefaultConfig.test.ts        |  14 +-
 .../test/task/getOAppConfig.test.ts           |  13 +-
 packages/ua-utils-evm/src/oapp/sdk.ts         |   1 -
 10 files changed, 326 insertions(+), 31 deletions(-)
 create mode 100644 packages/ua-utils-evm-hardhat-test/test/oapp/options.test.ts

diff --git a/packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol b/packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol
index 6dce66b71..c4293381a 100644
--- a/packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol
+++ b/packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol
@@ -1,10 +1,8 @@
 // SPDX-License-Identifier: UNLICENSED
 pragma solidity ^0.8.22;
 
-contract DefaultOApp {
-    mapping(uint256 => bytes32) public peers;
+import { OmniCounter as OmniCounterImpl } from "@layerzerolabs/lz-evm-oapp-v2/contracts/examples/OmniCounter.sol";
 
-    function setPeer(uint256 eid, bytes32 peer) external {
-        peers[eid] = peer;
-    }
+contract DefaultOApp is OmniCounterImpl {
+    constructor(address _endpoint) OmniCounterImpl(_endpoint) {}
 }
diff --git a/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts b/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts
index 5869d9ebc..0434aff8b 100644
--- a/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts
+++ b/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts
@@ -1,6 +1,10 @@
 import { type DeployFunction } from 'hardhat-deploy/types'
 import assert from 'assert'
 import { formatEid } from '@layerzerolabs/utils'
+import { createConnectedContractFactory, createSignerFactory } from '@layerzerolabs/utils-evm-hardhat'
+import { DeploymentsExtension } from 'hardhat-deploy/types'
+
+const DEFAULT_NATIVE_DECIMALS_RATE = '18' //ethers.utils.parseUnits('1', 18).toString()
 
 /**
  * This deploy function will deploy and configure LayerZero endpoint
@@ -31,11 +35,119 @@ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network
         args: [endpointV2Deployment.address],
     })
 
+    await Promise.all(
+        ['DefaultProxyAdmin', 'PriceFeed_Proxy', 'PriceFeed', 'PriceFeed_Implementation'].map((contractName) => {
+            deployments.delete(contractName)
+        })
+    )
+    const priceFeed = await deployments.deploy('PriceFeed', {
+        from: deployer,
+        proxy: {
+            owner: deployer,
+            proxyContract: 'OptimizedTransparentProxy',
+            execute: {
+                init: {
+                    methodName: 'initialize',
+                    args: [deployer],
+                },
+            },
+        },
+    })
+
+    await deployments.delete('ExecutorFeeLib')
+    const executorFeeLib = await deployments.deploy('ExecutorFeeLib', {
+        from: deployer,
+        args: [DEFAULT_NATIVE_DECIMALS_RATE],
+    })
+
+    await Promise.all(
+        ['Executor_Proxy', 'Executor_Implementation', 'Executor', 'ExecutorProxyAdmin'].map((contractName) =>
+            deployments.delete(contractName)
+        )
+    )
+    const executor = await deployments.deploy('Executor', {
+        from: deployer,
+        log: true,
+        skipIfAlreadyDeployed: true,
+        proxy: {
+            owner: deployer,
+            proxyContract: 'OptimizedTransparentProxy',
+            viaAdminContract: { name: 'ExecutorProxyAdmin', artifact: 'ProxyAdmin' },
+            execute: {
+                init: {
+                    methodName: 'initialize',
+                    args: [
+                        endpointV2Deployment.address, // _endpoint
+                        receiveUln302.address, // _receiveUln301
+                        [sendUln302.address], // _messageLibs
+                        priceFeed.address, // _priceFeed
+                        deployer, // _roleAdmin
+                        [deployer], // _admins
+                    ],
+                },
+                onUpgrade: {
+                    methodName: 'onUpgrade',
+                    args: [receiveUln302.address],
+                },
+            },
+        },
+    })
+
+    const signerFactory = createSignerFactory()
+    const signer = await signerFactory(network.config.eid) // local network signer
+    const connectedContractFactory = createConnectedContractFactory()
+
+    const executorContract = (
+        await connectedContractFactory({
+            eid: network.config.eid,
+            contractName: 'Executor',
+        })
+    ).contract.connect(signer.signer)
+    executorContract.functions.setWorkerFeeLib &&
+        (await executorContract.functions.setWorkerFeeLib(executorFeeLib.address, {
+            from: await signer.signer.getAddress(),
+        }))
+
+    await deployments.delete('DVN')
+    const dvn = await deployments.deploy('DVN', {
+        from: deployer,
+        args: [
+            network.config.eid, // vid
+            [sendUln302.address], // messageLibs
+            priceFeed.address, // priceFeed
+            [deployer], // signers
+            1, // quorum
+            [deployer], // admins
+        ],
+    })
+
+    await deployments.delete('DVNFeeLib')
+    const dvnFeeLib = await deployments.deploy('DVNFeeLib', {
+        from: deployer,
+        args: [DEFAULT_NATIVE_DECIMALS_RATE],
+    })
+
+    const dvnContract = (
+        await connectedContractFactory({
+            eid: network.config.eid,
+            contractName: 'DVN',
+        })
+    ).contract.connect(signer.signer)
+    dvnContract.functions.setWorkerFeeLib &&
+        (await dvnContract.functions.setWorkerFeeLib(dvnFeeLib.address, {
+            from: await signer.signer.getAddress(),
+        }))
+
     console.table({
         Network: `${network.name} (endpoint ${formatEid(network.config.eid)})`,
         EndpointV2: endpointV2Deployment.address,
         SendUln302: sendUln302.address,
         ReceiveUln302: receiveUln302.address,
+        PriceFeed: priceFeed.address,
+        Executor: executor.address,
+        ExecutorFeeLib: executorFeeLib.address,
+        DVN: dvn.address,
+        DVNFeeLib: dvnFeeLib.address,
     })
 }
 
diff --git a/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts b/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts
index b56907807..53d6453eb 100644
--- a/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts
+++ b/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts
@@ -14,8 +14,10 @@ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network
     assert(deployer, 'Missing deployer')
 
     await deployments.delete('DefaultOApp')
+    const endpointV2 = await deployments.get('EndpointV2')
     const defaultOAppDeployment = await deployments.deploy('DefaultOApp', {
         from: deployer,
+        args: [endpointV2.address],
     })
 
     console.table({
diff --git a/packages/ua-utils-evm-hardhat-test/package.json b/packages/ua-utils-evm-hardhat-test/package.json
index e4bad95ab..c50bfdbf5 100644
--- a/packages/ua-utils-evm-hardhat-test/package.json
+++ b/packages/ua-utils-evm-hardhat-test/package.json
@@ -25,8 +25,11 @@
     "@gnosis.pm/safe-service-client": "1.1.1",
     "@layerzerolabs/io-utils": "~0.0.1",
     "@layerzerolabs/lz-definitions": "~1.5.70",
+    "@layerzerolabs/lz-evm-oapp-v2": "~1.5.70",
+    "@layerzerolabs/lz-evm-protocol-v2": "~1.5.70",
     "@layerzerolabs/lz-evm-sdk-v1": "~1.5.70",
     "@layerzerolabs/lz-evm-sdk-v2": "~1.5.70",
+    "@layerzerolabs/lz-utility-v2": "~1.5.70",
     "@layerzerolabs/protocol-utils": "~0.0.1",
     "@layerzerolabs/protocol-utils-evm": "~0.0.1",
     "@layerzerolabs/toolbox-hardhat": "~0.0.1",
diff --git a/packages/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts b/packages/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts
index f54905017..7917328c5 100644
--- a/packages/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts
+++ b/packages/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts
@@ -25,20 +25,40 @@ import { formatOmniPoint } from '@layerzerolabs/utils'
 export const ethEndpoint = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'EndpointV2' }
 export const ethReceiveUln = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'ReceiveUln302' }
 export const ethSendUln = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'SendUln302' }
+export const ethExecutor = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'Executor' }
+export const ethDvn = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'DVN' }
 export const avaxEndpoint = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'EndpointV2' }
 export const avaxReceiveUln = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'ReceiveUln302' }
 export const avaxSendUln = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'SendUln302' }
+export const avaxExecutor = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'Executor' }
+export const avaxDvn = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'DVN' }
 
-export const defaultExecutorConfig: Uln302ExecutorConfig = {
-    maxMessageSize: 10000,
-    executor: '0x0000000000000000000000000000000000000001',
+export const MAX_MESSAGE_SIZE = 10000 // match on-chain value
+
+/**
+ * Helper function to generate the default Uln302ExecutorConfig for a given chain.
+ *
+ * @param executorAddress The local Executor address.
+ */
+export const getDefaultExecutorConfig = (executorAddress: string): Uln302ExecutorConfig => {
+    return {
+        maxMessageSize: MAX_MESSAGE_SIZE,
+        executor: executorAddress,
+    }
 }
 
-export const defaultUlnConfig: Uln302UlnConfig = {
-    confirmations: BigInt(1),
-    requiredDVNs: ['0x0000000000000000000000000000000000000002', '0x0000000000000000000000000000000000000003'],
-    optionalDVNs: [],
-    optionalDVNThreshold: 0,
+/**
+ * Helper function to generate the default Uln302UlnConfig for a given chain.
+ *
+ * @param dvnAddress The local DVN address.
+ */
+export const getDefaultUlnConfig = (dvnAddress: string): Uln302UlnConfig => {
+    return {
+        confirmations: BigInt(1),
+        requiredDVNs: [dvnAddress],
+        optionalDVNs: [],
+        optionalDVNThreshold: 0,
+    }
 }
 
 /**
@@ -68,6 +88,13 @@ export const setupDefaultEndpoint = async (): Promise<void> => {
     const avaxSendUlnPoint = omniContractToPoint(await contractFactory(avaxSendUln))
     const ethReceiveUlnPoint = omniContractToPoint(await contractFactory(ethReceiveUln))
     const avaxReceiveUlnPoint = omniContractToPoint(await contractFactory(avaxReceiveUln))
+    const ethExecutorPoint = omniContractToPoint(await contractFactory(ethExecutor))
+    const avaxExecutorPoint = omniContractToPoint(await contractFactory(avaxExecutor))
+    const ethDvnPoint = omniContractToPoint(await contractFactory(ethDvn))
+    const avaxDvnPoint = omniContractToPoint(await contractFactory(avaxDvn))
+
+    const ethUlnConfig: Uln302UlnConfig = getDefaultUlnConfig(ethDvnPoint.address)
+    const avaxUlnConfig: Uln302UlnConfig = getDefaultUlnConfig(avaxDvnPoint.address)
 
     // This is the graph for SendUln302
     const sendUlnConfig: OmniGraphHardhat<Uln302NodeConfig, unknown> = {
@@ -75,15 +102,19 @@ export const setupDefaultEndpoint = async (): Promise<void> => {
             {
                 contract: ethSendUln,
                 config: {
-                    defaultUlnConfigs: [[EndpointId.AVALANCHE_MAINNET, defaultUlnConfig]],
-                    defaultExecutorConfigs: [[EndpointId.AVALANCHE_MAINNET, defaultExecutorConfig]],
+                    defaultUlnConfigs: [[EndpointId.AVALANCHE_MAINNET, ethUlnConfig]],
+                    defaultExecutorConfigs: [
+                        [EndpointId.AVALANCHE_MAINNET, getDefaultExecutorConfig(ethExecutorPoint.address)],
+                    ],
                 },
             },
             {
                 contract: avaxSendUln,
                 config: {
-                    defaultUlnConfigs: [[EndpointId.ETHEREUM_MAINNET, defaultUlnConfig]],
-                    defaultExecutorConfigs: [[EndpointId.ETHEREUM_MAINNET, defaultExecutorConfig]],
+                    defaultUlnConfigs: [[EndpointId.ETHEREUM_MAINNET, avaxUlnConfig]],
+                    defaultExecutorConfigs: [
+                        [EndpointId.ETHEREUM_MAINNET, getDefaultExecutorConfig(avaxExecutorPoint.address)],
+                    ],
                 },
             },
         ],
@@ -96,14 +127,14 @@ export const setupDefaultEndpoint = async (): Promise<void> => {
             {
                 contract: ethReceiveUln,
                 config: {
-                    defaultUlnConfigs: [[EndpointId.AVALANCHE_MAINNET, defaultUlnConfig]],
+                    defaultUlnConfigs: [[EndpointId.AVALANCHE_MAINNET, ethUlnConfig]],
                     defaultExecutorConfigs: [],
                 },
             },
             {
                 contract: avaxReceiveUln,
                 config: {
-                    defaultUlnConfigs: [[EndpointId.ETHEREUM_MAINNET, defaultUlnConfig]],
+                    defaultUlnConfigs: [[EndpointId.ETHEREUM_MAINNET, avaxUlnConfig]],
                     defaultExecutorConfigs: [],
                 },
             },
diff --git a/packages/ua-utils-evm-hardhat-test/test/endpoint/config.test.ts b/packages/ua-utils-evm-hardhat-test/test/endpoint/config.test.ts
index 73dc83694..4533a2b2b 100644
--- a/packages/ua-utils-evm-hardhat-test/test/endpoint/config.test.ts
+++ b/packages/ua-utils-evm-hardhat-test/test/endpoint/config.test.ts
@@ -3,16 +3,18 @@ import { createConnectedContractFactory } from '@layerzerolabs/utils-evm-hardhat
 import type { OmniPoint } from '@layerzerolabs/utils'
 import { omniContractToPoint } from '@layerzerolabs/utils-evm'
 import { EndpointId } from '@layerzerolabs/lz-definitions'
-import { defaultUlnConfig, setupDefaultEndpoint } from '../__utils__/endpoint'
+import { getDefaultUlnConfig, setupDefaultEndpoint } from '../__utils__/endpoint'
 import { Endpoint, Uln302 } from '@layerzerolabs/protocol-utils-evm'
 
 describe('endpoint/config', () => {
     const ethEndpoint = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'EndpointV2' }
     const ethReceiveUln = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'ReceiveUln302' }
     const ethSendUln = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'SendUln302' }
+    const ethDvn = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'DVN' }
     const avaxEndpoint = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'EndpointV2' }
     const avaxReceiveUln = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'ReceiveUln302' }
     const avaxSendUln = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'SendUln302' }
+    const avaxDvn = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'DVN' }
 
     beforeEach(async () => {
         await setupDefaultEndpoint()
@@ -68,8 +70,11 @@ describe('endpoint/config', () => {
             const ethConfig = await ethSendUlnSdk.getUlnConfig(avaxSendUlnPoint.eid, avaxSendUlnPoint.address)
             const avaxConfig = await avaxSendUlnSdk.getUlnConfig(ethSendUlnPoint.eid, ethSendUlnPoint.address)
 
-            expect(ethConfig).toEqual(defaultUlnConfig)
-            expect(avaxConfig).toEqual(defaultUlnConfig)
+            const ethDvnPoint = omniContractToPoint(await connectedContractFactory(ethDvn))
+            const avaxDvnPoint = omniContractToPoint(await connectedContractFactory(avaxDvn))
+
+            expect(ethConfig).toBe(getDefaultUlnConfig(ethDvnPoint.address))
+            expect(avaxConfig).toBe(getDefaultUlnConfig(avaxDvnPoint.address))
         })
     })
 })
diff --git a/packages/ua-utils-evm-hardhat-test/test/oapp/options.test.ts b/packages/ua-utils-evm-hardhat-test/test/oapp/options.test.ts
new file mode 100644
index 000000000..a501f7f35
--- /dev/null
+++ b/packages/ua-utils-evm-hardhat-test/test/oapp/options.test.ts
@@ -0,0 +1,134 @@
+import { EndpointId } from '@layerzerolabs/lz-definitions'
+import { OmniCounterApp } from '@layerzerolabs/omnicounter-utils-evm'
+import { OmniPoint, OmniTransaction } from '@layerzerolabs/utils'
+import { omniContractToPoint } from '@layerzerolabs/utils-evm'
+import {
+    createConnectedContractFactory,
+    createContractFactory,
+    createSignerFactory,
+    OmniGraphBuilderHardhat,
+    OmniGraphHardhat,
+} from '@layerzerolabs/utils-evm-hardhat'
+
+import { Options, optionsType1 } from '@layerzerolabs/lz-utility-v2'
+import { avaxEndpoint, ethEndpoint, setupDefaultEndpoint } from '../__utils__/endpoint'
+import { deployOApp } from '../__utils__/oapp'
+import { configureOApp } from '@layerzerolabs/ua-utils'
+import { parseEther } from 'ethers/lib/utils'
+import { Endpoint } from '@layerzerolabs/protocol-utils-evm'
+
+describe('options', () => {
+    beforeEach(async () => {
+        await setupDefaultEndpoint()
+        await deployOApp()
+    })
+
+    it('should be tested', async () => {
+        const opt = Options.newOptions().addExecutorLzReceiveOption(100, 100)
+        expect(opt.toHex()).toEqual('0x0003010021010000000000000000000000000000006400000000000000000000000000000064')
+    })
+    ;[
+        {
+            it: 'addExecutorLzReceiveOption without amount',
+            options: {
+                gas: 10,
+                amount: 0,
+            },
+            expected: '0x0003010011010000000000000000000000000000000a',
+        },
+        {
+            it: 'addExecutorLzReceiveOption with 11 as amount',
+            options: {
+                gas: 10,
+                amount: 11,
+            },
+            expected: '0x0003010021010000000000000000000000000000000a0000000000000000000000000000000b',
+        },
+    ].forEach((test) => {
+        it(test.it, async () => {
+            const opt = Options.newOptions()
+            opt.addExecutorLzReceiveOption(test.options.gas, test.options.amount)
+            expect(opt.toHex()).toEqual(test.expected)
+        })
+    })
+
+    const ethContract = { eid: EndpointId.ETHEREUM_MAINNET, contractName: 'DefaultOApp' }
+    const avaxContract = { eid: EndpointId.AVALANCHE_MAINNET, contractName: 'DefaultOApp' }
+
+    // This is the OApp config that we want to use against our contracts
+    const config: OmniGraphHardhat = {
+        contracts: [
+            {
+                contract: ethContract,
+                config: undefined,
+            },
+            {
+                contract: avaxContract,
+                config: undefined,
+            },
+        ],
+        connections: [
+            {
+                from: ethContract,
+                to: avaxContract,
+                config: undefined,
+            },
+            {
+                from: avaxContract,
+                to: ethContract,
+                config: undefined,
+            },
+        ],
+    }
+
+    it('increments', async () => {
+        const contractFactory = createContractFactory()
+        const connectedContractFactory = createConnectedContractFactory(contractFactory)
+        const sdkFactory = async (point: OmniPoint) => new OmniCounterApp(await connectedContractFactory(point))
+
+        const ethPoint = omniContractToPoint(await contractFactory(ethContract))
+        const avaxPoint = omniContractToPoint(await contractFactory(avaxContract))
+
+        const builder = await OmniGraphBuilderHardhat.fromConfig(config)
+        await configureOApp(builder.graph, sdkFactory)
+        const signerFactory = createSignerFactory()
+        const ethSigner = await signerFactory(ethContract.eid)
+        const avaxSigner = await signerFactory(avaxContract.eid)
+
+        const ethSdk = await sdkFactory(ethPoint)
+        const avaxSdk = await sdkFactory(avaxPoint)
+        {
+            const ethTransaction = {
+                ...(await ethSdk.setPeer(avaxPoint.eid, avaxPoint.address)),
+                gasLimit: '1000000',
+            }
+            const ethResponse = await ethSigner.signAndSend(ethTransaction)
+            const ethReceipt = await ethResponse.wait()
+            expect(ethReceipt.from).toEqual(await ethSigner.signer.getAddress())
+        }
+
+        {
+            const tx = {
+                ...(await avaxSdk.setPeer(ethEndpoint.eid, ethPoint.address)),
+                gasLimit: '1000000',
+            }
+            const ethResponse = await avaxSigner.signAndSend(tx)
+            await ethResponse.wait()
+        }
+
+        const opt1 = Options.newOptions().addExecutorLzReceiveOption(200000)
+        const tx1: OmniTransaction = {
+            ...(await ethSdk.increment(avaxPoint.eid, 1, opt1.toHex())),
+            gasLimit: 2000001,
+            value: parseEther('1').toString(),
+        }
+        console.dir({ tx1 }, { depth: null })
+
+        const ethResponse = await ethSigner.signAndSend(tx1)
+        console.dir(ethResponse, { depth: null })
+        const ethReceipt = await ethResponse.wait()
+        expect(ethReceipt.from).toEqual(await ethSigner.signer.getAddress())
+
+        console.dir(ethResponse, { depth: null })
+    })
+})
diff --git a/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts b/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts
index 59ae0006d..6d63518aa 100644
--- a/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts
+++ b/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts
@@ -1,7 +1,9 @@
-import { defaultExecutorConfig, defaultUlnConfig, setupDefaultEndpoint } from '../__utils__/endpoint'
+import { describe } from 'mocha'
+import { getDefaultExecutorConfig, getDefaultUlnConfig, setupDefaultEndpoint } from '../__utils__/endpoint'
 import { createContractFactory, getEidForNetworkName } from '@layerzerolabs/utils-evm-hardhat'
 import hre from 'hardhat'
 import { TASK_LZ_GET_DEFAULT_CONFIG } from '@layerzerolabs/ua-utils-evm-hardhat'
+import { omniContractToPoint } from '@layerzerolabs/utils-evm'
 
 describe('task: getDefaultConfig', () => {
     beforeEach(async () => {
@@ -20,12 +22,16 @@ describe('task: getDefaultConfig', () => {
 
                 const sendUln302 = await contractFactory({ contractName: 'SendUln302', eid: localEid })
                 const receiveUln302 = await contractFactory({ contractName: 'ReceiveUln302', eid: localEid })
+                const executor = await contractFactory({ contractName: 'Executor', eid: localEid })
+                const executorPoint = await omniContractToPoint(executor)
+                const dvn = await contractFactory({ contractName: 'DVN', eid: localEid })
+                const dvnPoint = await omniContractToPoint(dvn)
 
                 expect(defaultConfig.defaultSendLibrary).toEqual(sendUln302.contract.address)
                 expect(defaultConfig.defaultReceiveLibrary).toEqual(receiveUln302.contract.address)
-                expect(defaultConfig.sendExecutorConfig).toEqual(defaultExecutorConfig)
-                expect(defaultConfig.sendUlnConfig).toEqual(defaultUlnConfig)
-                expect(defaultConfig.receiveUlnConfig).toEqual(defaultUlnConfig)
+                expect(defaultConfig.sendExecutorConfig).toEqual(getDefaultExecutorConfig(executorPoint.address))
+                expect(defaultConfig.sendUlnConfig).toEqual(getDefaultUlnConfig(dvnPoint.address))
+                expect(defaultConfig.receiveUlnConfig).toEqual(getDefaultUlnConfig(dvnPoint.address))
             }
         }
     })
diff --git a/packages/ua-utils-evm-hardhat-test/test/task/getOAppConfig.test.ts b/packages/ua-utils-evm-hardhat-test/test/task/getOAppConfig.test.ts
index 5b2e9256f..780dbc8bc 100644
--- a/packages/ua-utils-evm-hardhat-test/test/task/getOAppConfig.test.ts
+++ b/packages/ua-utils-evm-hardhat-test/test/task/getOAppConfig.test.ts
@@ -1,8 +1,9 @@
-import { defaultExecutorConfig, defaultUlnConfig, setupDefaultEndpoint } from '../__utils__/endpoint'
+import { getDefaultExecutorConfig, getDefaultUlnConfig, setupDefaultEndpoint } from '../__utils__/endpoint'
 import { createContractFactory, getEidForNetworkName } from '@layerzerolabs/utils-evm-hardhat'
 import hre from 'hardhat'
 import { AddressZero } from '@ethersproject/constants'
 import { TASK_LZ_GET_OAPP_CONFIG } from '@layerzerolabs/ua-utils-evm-hardhat'
+import { omniContractToPoint } from '@layerzerolabs/utils-evm'
 
 describe('task: getOAppConfig', () => {
     beforeEach(async () => {
@@ -25,12 +26,16 @@ describe('task: getOAppConfig', () => {
                 const defaultConfig = getDefaultConfigTask[localNetwork][remoteNetwork]
                 const sendUln302 = await contractFactory({ contractName: 'SendUln302', eid: localEid })
                 const receiveUln302 = await contractFactory({ contractName: 'ReceiveUln302', eid: localEid })
+                const executor = await contractFactory({ contractName: 'Executor', eid: localEid })
+                const executorPoint = omniContractToPoint(executor)
+                const dvn = await contractFactory({ contractName: 'DVN', eid: localEid })
+                const dvnPoint = omniContractToPoint(dvn)
 
                 expect(defaultConfig.defaultSendLibrary).toEqual(sendUln302.contract.address)
                 expect(defaultConfig.defaultReceiveLibrary).toEqual(receiveUln302.contract.address)
-                expect(defaultConfig.sendExecutorConfig).toEqual(defaultExecutorConfig)
-                expect(defaultConfig.sendUlnConfig).toEqual(defaultUlnConfig)
-                expect(defaultConfig.receiveUlnConfig).toEqual(defaultUlnConfig)
+                expect(defaultConfig.sendExecutorConfig).toEqual(getDefaultExecutorConfig(executorPoint.address))
+                expect(defaultConfig.sendUlnConfig).toEqual(getDefaultUlnConfig(dvnPoint.address))
+                expect(defaultConfig.receiveUlnConfig).toEqual(getDefaultUlnConfig(dvnPoint.address))
             }
         }
     })
diff --git a/packages/ua-utils-evm/src/oapp/sdk.ts b/packages/ua-utils-evm/src/oapp/sdk.ts
index f919d9848..dbcdcfe77 100644
--- a/packages/ua-utils-evm/src/oapp/sdk.ts
+++ b/packages/ua-utils-evm/src/oapp/sdk.ts
@@ -16,7 +16,6 @@ export class OApp implements IOApp {
 
     async setPeer(eid: EndpointId, address: Bytes32 | Address | null | undefined): Promise<OmniTransaction> {
         const data = this.contract.contract.interface.encodeFunctionData('setPeer', [eid, makeBytes32(address)])
-
         return this.createTransaction(data)
     }