Skip to content

Commit

Permalink
Update dotenv to access .env mnemonic, example rpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
TRileySchwarz committed Feb 6, 2024
1 parent 820e7c2 commit 1862437
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/oapp/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MNEMONIC="test test test test test test test test test test test junk"
30 changes: 29 additions & 1 deletion examples/oapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<p align="center">Template project for getting started with LayerZero's <code>OApp</code> contract development.</p>

### Getting Started
## 1) Developing Contracts

#### Installing dependencies

Expand Down Expand Up @@ -73,3 +73,31 @@ Or adjust the `package.json` to for example remove `hardhat` tests:
- "test:hardhat": "$npm_execpath hardhat test"
+ "test": "forge test"
```

## 2) Deploying Contracts

Set up deployer wallet/account:

> - Rename `.env.example` -> `.env`
> - Replace the existing 12 word mnemonic with yours, this will be used to deploy your contracts.
> - 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:

```bash
npx hardhat lz:deploy
```

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

```bash
npx hardhat lz:deploy --help
```

By following these steps, you can focus more on creating innovative omnichain solutions and less on the complexities of cross-chain communication.

<br></br>

<p align="center">
Join our community on <a href="https://discord-layerzero.netlify.app/discord" style="color: #a77dff">Discord</a> | Follow us on <a href="https://twitter.com/LayerZero_Labs" style="color: #a77dff">Twitter</a>
</p>
5 changes: 3 additions & 2 deletions examples/oapp/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dotenv/config'
import 'hardhat-deploy'
import 'hardhat-contract-sizer'
import '@nomiclabs/hardhat-ethers'
Expand Down Expand Up @@ -32,14 +33,14 @@ const config: HardhatUserConfig = {
},
fuji: {
eid: EndpointId.AVALANCHE_V2_TESTNET,
url: 'https://api.avax-test.network/',
url: 'https://rpc.ankr.com/avalanche_fuji',
accounts: {
mnemonic: MNEMONIC,
},
},
mumbai: {
eid: EndpointId.POLYGON_V2_TESTNET,
url: 'https://rpc-mumbai.matic.today',
url: 'https://rpc.ankr.com/polygon_mumbai',
accounts: {
mnemonic: MNEMONIC,
},
Expand Down
1 change: 1 addition & 0 deletions examples/oapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"chai": "^4.4.1",
"dotenv": "^16.4.1",
"ethers": "^5.7.2",
"hardhat": "^2.19.5",
"hardhat-contract-sizer": "^2.10.0",
Expand Down
1 change: 1 addition & 0 deletions examples/oft/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MNEMONIC="test test test test test test test test test test test junk"
30 changes: 29 additions & 1 deletion examples/oft/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<p align="center">Template project for getting started with LayerZero's <code>OFT</code> contract development.</p>

### Getting Started
## 1) Developing Contracts

#### Installing dependencies

Expand Down Expand Up @@ -73,3 +73,31 @@ Or adjust the `package.json` to for example remove `hardhat` tests:
- "test:hardhat": "$npm_execpath hardhat test"
+ "test": "forge test"
```

## 2) Deploying Contracts

Set up deployer wallet/account:

> - Rename `.env.example` -> `.env`
> - Replace the existing 12 word mnemonic with yours, this will be used to deploy your contracts.
> - 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:

```bash
npx hardhat lz:deploy
```

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

```bash
npx hardhat lz:deploy --help
```

By following these steps, you can focus more on creating innovative omnichain solutions and less on the complexities of cross-chain communication.

<br></br>

<p align="center">
Join our community on <a href="https://discord-layerzero.netlify.app/discord" style="color: #a77dff">Discord</a> | Follow us on <a href="https://twitter.com/LayerZero_Labs" style="color: #a77dff">Twitter</a>
</p>
5 changes: 3 additions & 2 deletions examples/oft/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dotenv/config'
import 'hardhat-deploy'
import 'hardhat-contract-sizer'
import '@nomiclabs/hardhat-ethers'
Expand Down Expand Up @@ -32,14 +33,14 @@ const config: HardhatUserConfig = {
},
fuji: {
eid: EndpointId.AVALANCHE_V2_TESTNET,
url: 'https://api.avax-test.network/',
url: 'https://rpc.ankr.com/avalanche_fuji',
accounts: {
mnemonic: MNEMONIC,
},
},
mumbai: {
eid: EndpointId.POLYGON_V2_TESTNET,
url: 'https://rpc-mumbai.matic.today',
url: 'https://rpc.ankr.com/polygon_mumbai',
accounts: {
mnemonic: MNEMONIC,
},
Expand Down
1 change: 1 addition & 0 deletions examples/oft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"chai": "^4.4.1",
"dotenv": "^16.4.1",
"ethers": "^5.7.2",
"hardhat": "^2.19.5",
"hardhat-contract-sizer": "^2.10.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-lz-oapp/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const PACKAGE_MANAGERS: PackageManager[] = [
id: 'pnpm',
executable: 'pnpm',
args: ['install'],
label: 'pnpm',
label: 'pnpm (recommended)',
},
{
id: 'bun',
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1862437

Please sign in to comment.