You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update `hardhat.config.ts` to include your desired networks with required `ovault` configuration. Each network needs an `ovault` config object specifying which contracts to deploy and token details.
84
-
85
-
> **Note**: If your asset is already an OFT, you do not need to deploy a separate mesh. The only requirement is that the asset OFT supports the hub chain you are deploying to.
83
+
Update `hardhat.config.ts` to include your desired networks:
Configure your vault deployment in `devtools/deployConfig.ts`. This file controls which chains get which contracts and their deployment settings:
117
+
118
+
> **Note**: If your asset is already an OFT, you do not need to deploy a separate mesh. The only requirement is that the asset OFT supports the hub chain you are deploying to.
119
+
139
120
Asset and share token networks don't need to perfectly overlap. Configure based on your requirements:
140
121
141
-
-`asset` tag requires `assetToken` config
142
-
-`ovault` tag requires `isHubChain: true` and `shareToken` config
143
-
-`share` tag requires `isHubChain: false` and `shareToken` config
// Vault chain configuration (where the ERC4626 vault lives)
127
+
vault: {
128
+
eid: EndpointId.ARBSEP_V2_TESTNET, // Your hub chain
129
+
contracts: {
130
+
vault: "MyERC4626",
131
+
shareAdapter: "MyShareOFTAdapter",
132
+
composer: "MyOVaultComposer",
133
+
},
134
+
// IF YOU HAVE A PRE-DEPLOYED ASSET, SET THE ADDRESS HERE
135
+
assetAddress: undefined, // Set to '0x...' to use existing asset
136
+
},
146
137
147
-
Compile your contracts:
138
+
// Asset OFT configuration (deployed on all chains)
139
+
asset: {
140
+
contract: "MyAssetOFT",
141
+
metadata: {
142
+
name: "MyAssetOFT",
143
+
symbol: "ASSET",
144
+
},
145
+
chains: [
146
+
EndpointId.OPTSEP_V2_TESTNET,
147
+
EndpointId.BASESEP_V2_TESTNET,
148
+
EndpointId.ARBSEP_V2_TESTNET, // Include hub chain
149
+
],
150
+
},
148
151
149
-
```bash
150
-
pnpm compile
152
+
// Share OFT configuration (only on spoke chains)
153
+
share: {
154
+
contract: "MyShareOFT",
155
+
metadata: {
156
+
name: "MyShareOFT",
157
+
symbol: "SHARE",
158
+
},
159
+
chains: [
160
+
EndpointId.OPTSEP_V2_TESTNET,
161
+
EndpointId.BASESEP_V2_TESTNET,
162
+
// Do NOT include hub chain (it uses ShareOFTAdapter)
163
+
],
164
+
},
165
+
};
151
166
```
152
167
153
-
> **Testing Note**: If you're deploying the asset OFT from scratch for testing purposes, you'll need to mint an initial supply. Uncomment the `_mint` line in the `MyAssetOFT` constructor to provide initial liquidity. This ensures you have tokens to test deposit and cross-chain transfer functionality.
154
-
>
155
-
> **⚠️ Warning**: Do NOT mint share tokens directly in `MyShareOFT`. Share tokens must only be minted by the vault contract during deposits to maintain the correct share-to-asset ratio. Manually minting share tokens breaks the vault's accounting and can lead to incorrect redemption values. The mint line in `MyShareOFT` should only be uncommented for UI/integration testing, never in production.
168
+
**Key Configuration Points:**
156
169
157
-
## Deploy
170
+
-**Hub Chain**: Set `vault.eid` to your chosen hub chain's endpoint ID
171
+
-**Asset Chains**: Include all chains where you want asset OFTs (including the hub chain)
172
+
-**Share Chains**: Include only spoke chains (exclude hub, which uses the ShareOFTAdapter)
173
+
-**Pre-deployed Asset**: Set `vault.assetAddress` if using an existing asset token
174
+
175
+
The deployment scripts automatically determine what to deploy based on:
176
+
177
+
- Vault contracts (ERC4626, ShareOFTAdapter, Composer) deploy only on the hub chain
178
+
- Asset OFTs deploy on chains listed in `asset.chains` (unless using pre-deployed asset)
179
+
- Share OFTs deploy on chains listed in `share.chains`
158
180
159
-
### 1. Deploy Asset OFTs
181
+
##Build
160
182
161
-
Deploy Asset OFTs to networks with `assetToken` configuration:
183
+
Compile your contracts:
162
184
163
185
```bash
164
-
pnpm hardhat lz:deploy --tags asset
186
+
pnpm compile`
165
187
```
166
188
167
-
### 2. Deploy ERC4626 Vault System (Hub Chain Only)
189
+
>**Testing Note**: If you're deploying the asset OFT from scratch for testing purposes, you'll need to mint an initial supply. Uncomment the `_mint` line in the `MyAssetOFT` constructor to provide initial liquidity. This ensures you have tokens to test deposit and cross-chain transfer functionality.
190
+
>
191
+
>**⚠️ Warning**: Do NOT mint share tokens directly in`MyShareOFT`. Share tokens must only be minted by the vault contract during deposits to maintain the correct share-to-asset ratio. Manually minting share tokens breaks the vault's accounting and can lead to incorrect redemption values. The mint line in `MyShareOFT` should only be uncommented for UI/integration testing, never in production.
168
192
169
-
Deploy the vault, composer, and ShareOFT adapter on networks with `isHubChain: true`:
193
+
## Deploy
194
+
195
+
Deploy all vault contracts across all configured chains:
170
196
171
197
```bash
172
-
pnpm hardhat lz:deploy --networks base --tags ovault
198
+
pnpm hardhat lz:deploy --tags ovault
173
199
```
174
200
175
-
### 3. Deploy Share OFTs (Spoke Chains Only)
201
+
This single command will:
176
202
177
-
Deploy Share OFTs on networks with `isHubChain: false`:
203
+
- Deploy `AssetOFTs` to all chains in `deployConfig.asset.chains`
204
+
- Deploy the vault system (`ERC4626`, `ShareOFTAdapter`, `Composer`) on the hub chain
205
+
- Deploy `ShareOFTs` to all spoke chains in `deployConfig.share.chains`
178
206
179
-
```bash
180
-
pnpm hardhat lz:deploy --tags share
181
-
```
207
+
The deployment scripts automatically skip existing deployments, so you can safely run this command when expanding to new chains. Simply add the new chain endpoints to your `deployConfig.ts` and run the deploy command again.
182
208
183
-
The deploy scripts automatically validate your network configuration and will error if required config is missing or contracts are deployed on wrong chain types.
209
+
> **Tip**: To deploy to specific networks only, use the `--networks` flag:
**Need help?** Reach out in the [LayerZero Discord](https://discord-layerzero.netlify.app/discord) or check the [Developer Docs](https://docs.layerzero.network/).
731
+
**Need help?** Reach out in the [LayerZero Discord](https://discord-layerzero.netlify.app/discord) or check the [Developer Docs](https://docs.layerzero.network/).
0 commit comments