From 4bc34b7fa4f8b0875c5468b57693ec248c70b13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Jakub=20Nani=C5=A1ta?= Date: Fri, 24 Nov 2023 16:36:26 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=9A=20Add=20DefaultOApp,=20an=20OApp?= =?UTF-8?q?=20placeholder=20to=20ua-utils-evm-hardhat-test=20(#40)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ua-utils-evm-hardhat-test/.gitignore | 1 + packages/ua-utils-evm-hardhat-test/README.md | 9 +++++++ .../contracts/DefaultOApp.sol | 4 +++ .../deploy/001_bootstrap.ts | 2 ++ .../deploy/002_oapp.ts | 26 +++++++++++++++++++ .../hardhat.config.ts | 3 +++ .../ua-utils-evm-hardhat-test/package.json | 1 + 7 files changed, 46 insertions(+) create mode 100644 packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol create mode 100644 packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts diff --git a/packages/ua-utils-evm-hardhat-test/.gitignore b/packages/ua-utils-evm-hardhat-test/.gitignore index 1213f1f3e..803d4166c 100644 --- a/packages/ua-utils-evm-hardhat-test/.gitignore +++ b/packages/ua-utils-evm-hardhat-test/.gitignore @@ -1,2 +1,3 @@ +artifacts cache deployments \ No newline at end of file diff --git a/packages/ua-utils-evm-hardhat-test/README.md b/packages/ua-utils-evm-hardhat-test/README.md index 451bb061c..55ba88d04 100644 --- a/packages/ua-utils-evm-hardhat-test/README.md +++ b/packages/ua-utils-evm-hardhat-test/README.md @@ -29,3 +29,12 @@ and run the command from there. For that usecase the `$DOCKER_COMPOSE_RUN_TESTS_ # To rebuild the containers before running tests from the project root DOCKER_COMPOSE_RUN_TESTS_ARGS=--build yarn test --filter=utils-evm-hardhat-test ``` + +To monitor the container logs, you'll need to `cd` into the package directory and run: + +```bash +docker compose logs -f +``` + +This allows you to see any logs coming from the containers, including detailed logs from the `hardhat` nodes +. diff --git a/packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol b/packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol new file mode 100644 index 000000000..34793de3b --- /dev/null +++ b/packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.19; + +contract DefaultOApp {} 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 288deeeec..6a2698558 100644 --- a/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts +++ b/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts @@ -11,6 +11,7 @@ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network assert(network.config.endpointId != null, `Missing endpoint ID for network ${network.name}`) const [deployer] = await getUnnamedAccounts() + assert(deployer, 'Missing deployer') const endpointV2Deployment = await deployments.deploy('EndpointV2', { from: deployer, @@ -23,6 +24,7 @@ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network }) console.table({ + Network: network.name, EndpointV2: endpointV2Deployment.address, UltraLightNode302: uln302Deployment.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 new file mode 100644 index 000000000..158553d7a --- /dev/null +++ b/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts @@ -0,0 +1,26 @@ +import { type DeployFunction } from 'hardhat-deploy/types' +import assert from 'assert' + +/** + * This deploy function will deploy and configure LayerZero endpoint + * + * @param env `HardhatRuntimeEnvironment` + */ +const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network }) => { + const [deployer] = await getUnnamedAccounts() + assert(deployer, 'Missing deployer') + + const defaultOAppDeployment = await deployments.deploy('DefaultOApp', { + from: deployer, + }) + + console.table({ + Network: network.name, + DefaultOApp: defaultOAppDeployment.address, + }) +} + +deploy.tags = ['OApp', 'DefaultOApp'] +deploy.dependencies = ['Bootstrap'] + +export default deploy diff --git a/packages/ua-utils-evm-hardhat-test/hardhat.config.ts b/packages/ua-utils-evm-hardhat-test/hardhat.config.ts index 1d9cdb36e..0346e9ade 100644 --- a/packages/ua-utils-evm-hardhat-test/hardhat.config.ts +++ b/packages/ua-utils-evm-hardhat-test/hardhat.config.ts @@ -11,6 +11,9 @@ const MNEMONIC = 'test test test test test test test test test test test test' * hardhat functionality without mocking too much */ const config: HardhatUserConfig = { + solidity: { + version: '0.8.19', + }, networks: { hardhat: { accounts: { diff --git a/packages/ua-utils-evm-hardhat-test/package.json b/packages/ua-utils-evm-hardhat-test/package.json index 3ae6e4293..2c1977aeb 100644 --- a/packages/ua-utils-evm-hardhat-test/package.json +++ b/packages/ua-utils-evm-hardhat-test/package.json @@ -25,6 +25,7 @@ "@layerzerolabs/lz-definitions": "~1.5.62", "@layerzerolabs/lz-evm-sdk-v1": "~1.5.62", "@layerzerolabs/lz-evm-sdk-v2": "~1.5.62", + "@layerzerolabs/ua-utils-evm-hardhat": "~0.0.1", "@layerzerolabs/utils-evm-hardhat": "~0.0.1", "@nomiclabs/hardhat-ethers": "^2.2.3", "@types/chai-as-promised": "^7.1.7",