|
| 1 | +# Launch New Chain Skill |
| 2 | + |
| 3 | +Deploy a new spoke chain to the Everclear staging environment. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +``` |
| 8 | +/launch-new-chain <chain-name> <chain-id> |
| 9 | +``` |
| 10 | + |
| 11 | +Example: `/launch-new-chain Mantle 5000` |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Complete Staging Deployment Workflow |
| 16 | + |
| 17 | +### Phase 1: Pre-Deployment Config Updates (Monorepo) |
| 18 | + |
| 19 | +| Step | File | Action | |
| 20 | +|------|------|--------| |
| 21 | +| 1 | `packages/contracts/script/MainnetStaging.sol` | Add chain abstract contract | |
| 22 | +| 2 | `packages/contracts/cli/config/domains.json` | Add domain entry | |
| 23 | + |
| 24 | +### Phase 2: Contract Deployment (CLI) |
| 25 | + |
| 26 | +| Step | Command | Description | |
| 27 | +|------|---------|-------------| |
| 28 | +| 3 | `forge script deploy/Spoke.s.sol` | Deploy Spoke, SpokeGateway, FeeAdapter | |
| 29 | +| 4 | `cast send` (initialize) | Initialize Spoke, set message gas limit | |
| 30 | +| 5 | `cast send` (hub registration) | Register domain on Hub (setDomain, setGateway) | |
| 31 | +| 6 | `cast send` (assets) | Add assets to Spoke | |
| 32 | + |
| 33 | +### Phase 3: Post-Deployment Config Updates |
| 34 | + |
| 35 | +| Step | File | Action | |
| 36 | +|------|------|--------| |
| 37 | +| 7 | `packages/contracts/cli/config/spoke.json` | Add spoke entry | |
| 38 | +| 8 | `packages/contracts/deployments/staging/{chainId}/` | Create EverclearSpoke.json, SpokeGateway.json | |
| 39 | +| 9 | `packages/contracts/deployments/index.ts` | Add imports + exports | |
| 40 | +| 10 | `packages/subgraph/config/everclear-spoke-staging.json` | Add subgraph entry | |
| 41 | +| 11 | `ops/mainnet/staging/backend/config.tf` | Add terraform config | |
| 42 | + |
| 43 | +### Phase 4: External Repo Updates |
| 44 | + |
| 45 | +| Step | Repo | File | Action | |
| 46 | +|------|------|------|--------| |
| 47 | +| 12 | chaindata | `everclear.mainnet.staging.json` | Add chain entry | |
| 48 | +| 13 | api | `src/config/config.ts` | Add chain config | |
| 49 | + |
| 50 | +### Phase 5: Deployment & PRs |
| 51 | + |
| 52 | +| Step | Command | Description | |
| 53 | +|------|---------|-------------| |
| 54 | +| 14 | `goldsky deploy` | Deploy subgraph | |
| 55 | +| 15 | `gh pr create` | Create PRs for monorepo, chaindata, api | |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## Config File Patterns |
| 60 | + |
| 61 | +### 1. MainnetStaging.sol - Abstract Contract |
| 62 | + |
| 63 | +Location: `packages/contracts/script/MainnetStaging.sol` |
| 64 | + |
| 65 | +```solidity |
| 66 | +abstract contract {{ChainName}} { |
| 67 | + uint32 public constant {{CHAIN_NAME}} = {{chainId}}; |
| 68 | + IMailbox public {{CHAIN_NAME}}_MAILBOX = IMailbox({{mailboxAddress}}); |
| 69 | +
|
| 70 | + IEverclearSpoke public {{CHAIN_NAME}}_SPOKE = IEverclearSpoke({{spokeAddress}}); |
| 71 | + ISpokeGateway public {{CHAIN_NAME}}_SPOKE_GATEWAY = ISpokeGateway({{gatewayAddress}}); |
| 72 | + ICallExecutor public {{CHAIN_NAME}}_EXECUTOR = ICallExecutor({{executorAddress}}); |
| 73 | + address public constant {{CHAIN_NAME}}_FEE_ADAPTER = {{feeAdapterAddress}}; |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +Also update: |
| 78 | +- `MainnetStagingDomains` - add to inheritance list |
| 79 | +- `MainnetStagingSupportedDomainsAndGateways` constructor - add domain entry |
| 80 | +- `MainnetStagingEnvironment.SUPPORTED_DOMAINS` array |
| 81 | + |
| 82 | +### 2. domains.json - Domain Entry |
| 83 | + |
| 84 | +Location: `packages/contracts/cli/config/domains.json` |
| 85 | + |
| 86 | +```json |
| 87 | +{ |
| 88 | + "name": "{{ChainName}}", |
| 89 | + "id": {{chainId}}, |
| 90 | + "rpc": "{{rpcUrl}}", |
| 91 | + "verifierUrl": "{{explorerApiUrl}}", |
| 92 | + "environments": ["MainnetStaging"], |
| 93 | + "realm": "spoke" |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +### 3. spoke.json - Spoke Entry |
| 98 | + |
| 99 | +Location: `packages/contracts/cli/config/spoke.json` |
| 100 | + |
| 101 | +```json |
| 102 | +{ |
| 103 | + "address": "{{spokeAddress}}", |
| 104 | + "feeAdapterAddress": "{{feeAdapterAddress}}", |
| 105 | + "domainName": "{{ChainName}}", |
| 106 | + "domainId": {{chainId}}, |
| 107 | + "environment": "MainnetStaging" |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +### 4. Deployment JSON Files |
| 112 | + |
| 113 | +Location: `packages/contracts/deployments/staging/{{chainId}}/` |
| 114 | + |
| 115 | +Create `EverclearSpoke.json`: |
| 116 | +```json |
| 117 | +{ |
| 118 | + "address": "{{spokeAddress}}", |
| 119 | + "abi": [...], |
| 120 | + "transactionHash": "{{deployTxHash}}", |
| 121 | + "receipt": {...}, |
| 122 | + "args": [...] |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +Create `SpokeGateway.json`: |
| 127 | +```json |
| 128 | +{ |
| 129 | + "address": "{{gatewayAddress}}", |
| 130 | + "abi": [...], |
| 131 | + "transactionHash": "{{deployTxHash}}", |
| 132 | + "receipt": {...}, |
| 133 | + "args": [...] |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +### 5. deployments/index.ts - Imports and Exports |
| 138 | + |
| 139 | +Location: `packages/contracts/deployments/index.ts` |
| 140 | + |
| 141 | +Add imports in "Mainnet Staging Deployments" section: |
| 142 | +```typescript |
| 143 | +import StagingEverclearSpoke{{ChainName}} from './staging/{{chainId}}/EverclearSpoke.json'; |
| 144 | +import StagingSpokeGateway{{ChainName}} from './staging/{{chainId}}/SpokeGateway.json'; |
| 145 | +``` |
| 146 | + |
| 147 | +Add to `Deployments.staging` object: |
| 148 | +```typescript |
| 149 | +{{chainId}}: { |
| 150 | + everclear: StagingEverclearSpoke{{ChainName}}, |
| 151 | + gateway: StagingSpokeGateway{{ChainName}}, |
| 152 | +}, |
| 153 | +``` |
| 154 | + |
| 155 | +### 6. Subgraph Config Entry |
| 156 | + |
| 157 | +Location: `packages/subgraph/config/everclear-spoke-staging.json` |
| 158 | + |
| 159 | +```json |
| 160 | +{ |
| 161 | + "subgraphName": "everclear-spoke-{{chain-name}}", |
| 162 | + "domain": "{{chainId}}", |
| 163 | + "environment": "staging", |
| 164 | + "network": "{{goldsky-network-name}}", |
| 165 | + "indexers": ["goldsky"] |
| 166 | +} |
| 167 | +``` |
| 168 | + |
| 169 | +### 7. Terraform Config |
| 170 | + |
| 171 | +Location: `ops/mainnet/staging/backend/config.tf` |
| 172 | + |
| 173 | +Add to `local_cartographer_config.chains`: |
| 174 | +```hcl |
| 175 | +"{{chainId}}" = { |
| 176 | + providers = [ |
| 177 | + "{{rpcUrlWithApiKey}}" |
| 178 | + ] |
| 179 | +} |
| 180 | +``` |
| 181 | + |
| 182 | +### 8. Chaindata Entry |
| 183 | + |
| 184 | +Repo: `connext/chaindata` |
| 185 | +File: `everclear.mainnet.staging.json` |
| 186 | + |
| 187 | +Add under `chains`: |
| 188 | +```json |
| 189 | +"{{chainId}}": { |
| 190 | + "network": "evm", |
| 191 | + "providers": ["{{rpcUrl}}"], |
| 192 | + "subgraphUrls": ["https://api.goldsky.com/api/public/project_clssc64y57n5r010yeoly05up/subgraphs/everclear-spoke-{{chain-name}}/latest/gn"], |
| 193 | + "deployments": { |
| 194 | + "everclear": "{{spokeAddress}}", |
| 195 | + "gateway": "{{gatewayAddress}}", |
| 196 | + "feeAdapter": "{{feeAdapterAddress}}" |
| 197 | + }, |
| 198 | + "confirmations": {{confirmations}}, |
| 199 | + "messageGasLimit": { "base": 0, "extraIntent": 0 }, |
| 200 | + "assets": {} |
| 201 | +} |
| 202 | +``` |
| 203 | + |
| 204 | +### 9. API Config |
| 205 | + |
| 206 | +Repo: `everclear/api` |
| 207 | +File: `src/config/config.ts` |
| 208 | + |
| 209 | +Add chain configuration following existing patterns. |
| 210 | + |
| 211 | +--- |
| 212 | + |
| 213 | +## Confirmation Thresholds Reference |
| 214 | + |
| 215 | +| Chain Type | Confirmations | Examples | |
| 216 | +|------------|---------------|----------| |
| 217 | +| Ethereum Mainnet | 15 | Ethereum | |
| 218 | +| OP Stack L2s | 5-10 | Optimism, Base, Blast | |
| 219 | +| Arbitrum | 5 | Arbitrum One | |
| 220 | +| Fast Finality | 3 | BNB, Polygon, Avalanche | |
| 221 | +| zkEVM | 5-17 | Linea, Scroll | |
| 222 | + |
| 223 | +--- |
| 224 | + |
| 225 | +## Verification Checklist |
| 226 | + |
| 227 | +After deployment, verify: |
| 228 | + |
| 229 | +- [ ] Contracts verified on block explorer |
| 230 | +- [ ] `cast call spoke owner()` returns expected owner |
| 231 | +- [ ] `cast call spoke gateway()` returns gateway address |
| 232 | +- [ ] `cast call hub domains(chainId)` shows domain registered |
| 233 | +- [ ] Subgraph indexing (`goldsky subgraph status everclear-spoke-{{chain-name}}`) |
| 234 | +- [ ] Chaindata has new chain entry |
| 235 | +- [ ] API returns chain in supported chains list |
| 236 | + |
| 237 | +--- |
| 238 | + |
| 239 | +## Required Information |
| 240 | + |
| 241 | +When launching a new chain, gather: |
| 242 | + |
| 243 | +1. **Chain Info** |
| 244 | + - Chain name (PascalCase for contracts, lowercase for subgraph) |
| 245 | + - Chain ID |
| 246 | + - RPC URL |
| 247 | + - Block explorer API URL |
| 248 | + |
| 249 | +2. **Hyperlane Info** |
| 250 | + - Mailbox address (from Hyperlane registry) |
| 251 | + |
| 252 | +3. **Deploy Addresses** (from deployment) |
| 253 | + - Spoke address |
| 254 | + - SpokeGateway address |
| 255 | + - FeeAdapter address |
| 256 | + - CallExecutor address |
| 257 | + |
| 258 | +4. **Config Values** |
| 259 | + - Confirmation threshold |
| 260 | + - Message gas limits |
| 261 | + |
| 262 | +--- |
| 263 | + |
| 264 | +## Example: Adding Mantle to Staging |
| 265 | + |
| 266 | +```bash |
| 267 | +# Chain info |
| 268 | +CHAIN_NAME="Mantle" |
| 269 | +CHAIN_ID=5000 |
| 270 | +RPC_URL="https://rpc.mantle.xyz" |
| 271 | +EXPLORER_API="https://api.mantlescan.xyz/api" |
| 272 | +MAILBOX="0x..." # from Hyperlane registry |
| 273 | + |
| 274 | +# After deployment |
| 275 | +SPOKE_ADDRESS="0x..." |
| 276 | +GATEWAY_ADDRESS="0x..." |
| 277 | +FEE_ADAPTER_ADDRESS="0x..." |
| 278 | +``` |
| 279 | + |
| 280 | +Files to update: |
| 281 | +1. `packages/contracts/script/MainnetStaging.sol` |
| 282 | +2. `packages/contracts/cli/config/domains.json` |
| 283 | +3. `packages/contracts/cli/config/spoke.json` |
| 284 | +4. `packages/contracts/deployments/staging/5000/EverclearSpoke.json` |
| 285 | +5. `packages/contracts/deployments/staging/5000/SpokeGateway.json` |
| 286 | +6. `packages/contracts/deployments/index.ts` |
| 287 | +7. `packages/subgraph/config/everclear-spoke-staging.json` |
| 288 | +8. `ops/mainnet/staging/backend/config.tf` |
| 289 | +9. `chaindata/everclear.mainnet.staging.json` (external) |
| 290 | +10. `api/src/config/config.ts` (external) |
0 commit comments