-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add custom Hardhat tasks for LayerZero V2 OFT example deployment and configuration #684
base: main
Are you sure you want to change the base?
feat: add custom Hardhat tasks for LayerZero V2 OFT example deployment and configuration #684
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! However, it's not clear why this should be included in devtools, it seems partially incomplete and specific to a particular use-case.
import { task } from 'hardhat/config'; | ||
import { getEidForNetworkName } from '@layerzerolabs/devtools-evm-hardhat'; | ||
import { addressToBytes32 } from '@layerzerolabs/lz-v2-utilities'; | ||
import { SendParam } from "../utils/typeDefinitions"; | ||
import { Options } from '@layerzerolabs/lz-v2-utilities'; | ||
import { EndpointId } from '@layerzerolabs/lz-definitions'; | ||
|
||
// Deploy the OFT example contract | ||
task('lz:deploy', 'Deploys the OFT example contract') | ||
.setAction(async (taskArgs, { ethers, deployments }) => { | ||
const OFT = await ethers.getContractFactory("OFT"); | ||
const oft = await OFT.deploy(); | ||
await oft.deployed(); | ||
console.log("OFT deployed to:", oft.address); | ||
}); | ||
|
||
export default 'deployOFT'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There already is a deploy script for the OFT, this is not necessary
import { task } from 'hardhat/config'; | ||
import { getEidForNetworkName } from '@layerzerolabs/devtools-evm-hardhat'; | ||
import { addressToBytes32 } from '@layerzerolabs/lz-v2-utilities'; | ||
import { SendParam } from "../utils/typeDefinitions"; | ||
import { Options } from '@layerzerolabs/lz-v2-utilities'; | ||
import { EndpointId } from '@layerzerolabs/lz-definitions'; | ||
|
||
// Initialize OAPP config | ||
task('lz:oapp:config:init', 'Initializes OAPP config') | ||
.setAction(async (taskArgs, { ethers, deployments }) => { | ||
console.log("Initialize OAPP config here"); | ||
// Add your custom initialization logic here | ||
}); | ||
|
||
export default 'oappConfigInit'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this task? It seems to overwrite the existing task with an empty one
import { task } from 'hardhat/config'; | ||
import { getEidForNetworkName } from '@layerzerolabs/devtools-evm-hardhat'; | ||
import { addressToBytes32 } from '@layerzerolabs/lz-v2-utilities'; | ||
import { SendParam } from "../utils/typeDefinitions"; | ||
import { Options } from '@layerzerolabs/lz-v2-utilities'; | ||
import { EndpointId } from '@layerzerolabs/lz-definitions'; | ||
|
||
// Wire OAPP config | ||
task('lz:oapp:config:wire', 'Wires OAPP config') | ||
.setAction(async (taskArgs, { ethers, deployments }) => { | ||
console.log("Wire OAPP config here"); | ||
// Add your custom wiring logic here | ||
}); | ||
|
||
export default 'oappConfigWire'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this task?
import { EndpointId } from '@layerzerolabs/lz-definitions'; | ||
|
||
// send tokens from a contract on one network to another | ||
task('lz:oft:send', 'Sends tokens from either SwellOFTAdapter or SwellOFT') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This task seems to be specific to SwellOFT
. Devtools is a collection of generic, reusable developer utilities.
Hi @janjakubnanista! Thanks for the note - the purpose of adding these Hardhat tasks is to show some more utility available to devs using the CLI tool. Then, adding a step by step overview was to help streamline the process for any devs at a hackathon/getting started with the OFT example and showing some more utilities available to them! I understand your point/question about Swell as part of the example as well... no specific reason for this OFT being the one shown, just for reference only, no particular need for that OFT or adapter to be included if perhaps you mean it would be better to use a generic, hypothetical name instead. I hope this is helpful, and just let me know your thoughts! Weston |
Overview
This PR introduces some custom Hardhat tasks to help with developers/hackathon attendees with the deployment and configuration of the LayerZero OFT example. The following tasks have been added:
Changes
tasks/deploy.ts
to handle the deployment of the OFT contract.tasks/oappConfigInit.ts
to initialize OAPP config.tasks/oappConfigWire.ts
to wire the OAPP config.tasks/sendOFT.ts
to send tokens between chains.hardhat.config.ts
to include and register the newly created Hardhat tasks.Usage
To use the new tasks: