Skip to content

aavegotchi/ghst-oft

Repository files navigation

LayerZero

Homepage | Docs | Developers

OFT Example

Quickstart | Configuration | Message Execution Options | Endpoint Addresses

Template project for getting started with LayerZero's OFT contract development.

1) Developing Contracts

Installing dependencies

We recommend using pnpm as a package manager (but you can of course use a package manager of your choice):

pnpm install

Compiling your contracts

This project supports both hardhat and forge compilation. By default, the compile command will execute both:

pnpm compile

If you prefer one over the other, you can use the tooling-specific commands:

pnpm compile:forge
pnpm compile:hardhat

Or adjust the package.json to for example remove forge build:

- "compile": "$npm_execpath run compile:forge && $npm_execpath run compile:hardhat",
- "compile:forge": "forge build",
- "compile:hardhat": "hardhat compile",
+ "compile": "hardhat compile"

Running tests

Similarly to the contract compilation, we support both hardhat and forge tests. By default, the test command will execute both:

pnpm test

If you prefer one over the other, you can use the tooling-specific commands:

pnpm test:forge
pnpm test:hardhat

Or adjust the package.json to for example remove hardhat tests:

- "test": "$npm_execpath test:forge && $npm_execpath test:hardhat",
- "test:forge": "forge test",
- "test:hardhat": "$npm_execpath hardhat test"
+ "test": "forge test"

2) Deploying Contracts

Set up deployer wallet/account:

  • Rename .env.example -> .env
  • Choose your preferred means of setting up your deployer wallet/account:
MNEMONIC="test test test test test test test test test test test junk"
or...
PRIVATE_KEY="0xabc...def"
  • Fund this address with the corresponding chain's native tokens you want to deploy to.

To deploy your contracts to your desired blockchains, run the following command in your project's folder:

npx hardhat lz:deploy

More information about available CLI arguments can be found using the --help flag:

npx hardhat lz:deploy --help

GHST specific deployment

  • For testimg purposes, the deploy script assumes two forks running locally on ports 8545 and 8546 respectively. These forks should be used to simulate the Polygon and Base chains locally. The script will deploy the contracts to these forks and then run tests on them.

  • DEPLOYING TO POLYGON

        npx hardhat lz:deploy --networks fork_polygon
  • use the GHSTOFTAdapter script tag, this deploys the GHSTOFTAdapter to the local simulation of polygon mainnet

  • DEPLOYING TO BASE

        npx hardhat lz:deploy --networks fork_base
  • use the GHSTOFT script tag, this deploys the GHSTOFT to the local simulation of base mainnet

  • WIRING CONTRACTS contracts need to be wired together to set them as peers after deployment, the layerzero.config.ts as been configured to wire the GHSTOFTAdapter on polygon to the GHSTOFT on base.

   npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published