Skip to content

Commit

Permalink
feat: add redstone/garnet chains (#2713)
Browse files Browse the repository at this point in the history
* feat: redstone/garnet chains

* Update src/chains/definitions/garnet.ts

* export garnet

* chore: up

* Create soft-boxes-reply.md

---------

Co-authored-by: jxom <[email protected]>
  • Loading branch information
holic and jxom authored Sep 11, 2024
1 parent ca2909a commit 35220f1
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/soft-boxes-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"viem": patch
---

Added Garnet chain.
Updated Redstone chain.
49 changes: 49 additions & 0 deletions src/chains/definitions/garnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { chainConfig } from '../../op-stack/chainConfig.js'
import { defineChain } from '../../utils/chain/defineChain.js'

const sourceId = 17000 // Holesky testnet

export const garnet = defineChain({
...chainConfig,
name: 'Garnet Testnet',
testnet: true,
id: 17069,
sourceId,
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: {
default: {
http: ['https://rpc.garnetchain.com'],
webSocket: ['wss://rpc.garnetchain.com'],
},
},
blockExplorers: {
default: {
name: 'Blockscout',
url: 'https://explorer.garnetchain.com',
},
},
contracts: {
...chainConfig.contracts,
multicall3: {
address: '0xca11bde05977b3631167028862be2a173976ca11',
},
portal: {
[sourceId]: {
address: '0x57ee40586fbE286AfC75E67cb69511A6D9aF5909',
blockCreated: 1274684,
},
},
l2OutputOracle: {
[sourceId]: {
address: '0xCb8E7AC561b8EF04F2a15865e9fbc0766FEF569B',
blockCreated: 1274684,
},
},
l1StandardBridge: {
[sourceId]: {
address: '0x09bcDd311FE398F80a78BE37E489f5D440DB95DE',
blockCreated: 1274684,
},
},
},
})
42 changes: 35 additions & 7 deletions src/chains/definitions/redstone.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,48 @@
import { chainConfig } from '../../op-stack/chainConfig.js'
import { defineChain } from '../../utils/chain/defineChain.js'

const sourceId = 1 // Ethereum mainnet

export const redstone = defineChain({
id: 690,
...chainConfig,
name: 'Redstone',
nativeCurrency: {
decimals: 18,
name: 'Ether',
symbol: 'ETH',
},
id: 690,
sourceId,
nativeCurrency: { decimals: 18, name: 'Ether', symbol: 'ETH' },
rpcUrls: {
default: {
http: ['https://rpc.redstonechain.com'],
webSocket: ['wss://rpc.redstonechain.com'],
},
},
blockExplorers: {
default: { name: 'Explorer', url: ' https://explorer.redstone.xyz' },
default: {
name: 'Blockscout',
url: 'https://explorer.redstone.xyz',
},
},
contracts: {
...chainConfig.contracts,
multicall3: {
address: '0xca11bde05977b3631167028862be2a173976ca11',
},
portal: {
[sourceId]: {
address: '0xC7bCb0e8839a28A1cFadd1CF716de9016CdA51ae',
blockCreated: 19578329,
},
},
l2OutputOracle: {
[sourceId]: {
address: '0xa426A052f657AEEefc298b3B5c35a470e4739d69',
blockCreated: 19578337,
},
},
l1StandardBridge: {
[sourceId]: {
address: '0xc473ca7E02af24c129c2eEf51F2aDf0411c1Df69',
blockCreated: 19578331,
},
},
},
})
1 change: 1 addition & 0 deletions src/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export { iotexTestnet } from './definitions/iotexTestnet.js'
export { jbc } from './definitions/jbc.js'
export { jbcTestnet } from './definitions/jbcTestnet.js'
export { karura } from './definitions/karura.js'
export { garnet } from './definitions/garnet.js'
export { gobi } from './definitions/gobi.js'
export { goerli } from './definitions/goerli.js'
export { gnosis } from './definitions/gnosis.js'
Expand Down

0 comments on commit 35220f1

Please sign in to comment.