Skip to content

Commit

Permalink
🪚 Add DefaultOApp, an OApp placeholder to ua-utils-evm-hardhat-test (#40
Browse files Browse the repository at this point in the history
)
  • Loading branch information
janjakubnanista authored Nov 25, 2023
1 parent 071fc29 commit 4bc34b7
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ua-utils-evm-hardhat-test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
artifacts
cache
deployments
9 changes: 9 additions & 0 deletions packages/ua-utils-evm-hardhat-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
.
4 changes: 4 additions & 0 deletions packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

contract DefaultOApp {}
2 changes: 2 additions & 0 deletions packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -23,6 +24,7 @@ const deploy: DeployFunction = async ({ getUnnamedAccounts, deployments, network
})

console.table({
Network: network.name,
EndpointV2: endpointV2Deployment.address,
UltraLightNode302: uln302Deployment.address,
})
Expand Down
26 changes: 26 additions & 0 deletions packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions packages/ua-utils-evm-hardhat-test/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions packages/ua-utils-evm-hardhat-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 4bc34b7

Please sign in to comment.