Skip to content

Commit

Permalink
Merge pull request #196 from Consensys/feat/deployment-mainnet
Browse files Browse the repository at this point in the history
Feat/deployment mainnet
  • Loading branch information
Julink-eth authored Jul 13, 2024
2 parents ecdd509 + 53b004f commit 79bde5a
Show file tree
Hide file tree
Showing 46 changed files with 16,197 additions and 13 deletions.
20 changes: 16 additions & 4 deletions packages/linea-ens-app/src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { addEnsContracts } from '@ensdomains/ensjs'
import type { Register } from '@app/local-contracts'
import { makeLocalhostChainWithEns } from '@app/utils/chains/makeLocalhostChainWithEns'

import { lineaMainnet, lineaMainnetEnsAddresses } from './lineaMainnet'
import { lineaSepolia, lineaSepoliaEnsAddresses } from './lineaSepolia'

export const deploymentAddresses = JSON.parse(
Expand All @@ -17,7 +18,7 @@ export const localhostWithEns = makeLocalhostChainWithEns<typeof localhost>(
localhost,
deploymentAddresses,
)
// TODO: Replace by linea mainnet after deployment is done
// This has to stay for the test files to be able to compile
export const mainnetWithEns = addEnsContracts(mainnet)

const addCustomEnsContracts = <const TChain extends Chain>(
Expand Down Expand Up @@ -82,17 +83,28 @@ export const lineaSepoliaWithEns = addCustomEnsContracts(
'https://linea-poh-api-verifier.sepolia.linea.build',
)

export const chainsWithEns = [lineaSepoliaWithEns, localhostWithEns] as const
export const lineaMainnetWithEns = addCustomEnsContracts(
lineaMainnet,
lineaMainnetEnsAddresses,
'https://api.studio.thegraph.com/query/69290/ens-linea-mainnet/version/latest',
'linea',
'https://linea-poh-signer-api.linea.build',
)

export const chainsWithEns = [lineaMainnetWithEns, lineaSepoliaWithEns, localhostWithEns] as const

export const getSupportedChainById = (chainId: number | undefined) => {
return chainId ? chainsWithEns.find((c) => c.id === chainId) : undefined
}

export const getBaseDomain = (chain?: Chain) => {
return chain?.custom?.baseDomain ? chain.custom.baseDomain : 'linea-sepolia'
return chain?.custom?.baseDomain ? chain.custom.baseDomain : 'linea'
}

export type SupportedChain = typeof localhostWithEns | typeof lineaSepoliaWithEns
export type SupportedChain =
| typeof localhostWithEns
| typeof lineaSepoliaWithEns
| typeof lineaMainnetWithEns

type EnsAddresses = {
ensRegistry: {
Expand Down
83 changes: 83 additions & 0 deletions packages/linea-ens-app/src/constants/lineaMainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { Address, defineChain } from 'viem'

export const lineaMainnet = defineChain({
id: 59_144,
name: 'Linea Mainnet',
network: 'linea-mainnet',
nativeCurrency: { name: 'Linea Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: {
infura: {
http: ['https://linea-mainnet.infura.io/v3'],
webSocket: ['wss://linea-mainnet.infura.io/ws/v3'],
},
default: {
http: ['https://rpc.linea.build'],
webSocket: ['wss://rpc.linea.build'],
},
public: {
http: ['https://rpc.linea.build'],
webSocket: ['wss://rpc.linea.build'],
},
},
blockExplorers: {
default: {
name: 'Etherscan',
url: 'https://lineascan.build',
},
etherscan: {
name: 'Etherscan',
url: 'https://lineascan.build',
},
blockscout: {
name: 'Blockscout',
url: 'https://explorer.linea.build',
},
},
contracts: {
ensRegistry: {
address: '0x50130b669B28C339991d8676FA73CF122a121267',
},
ensUniversalResolver: {
address: '0x3aA974fb3f8C1E02796048BDCdeD79e9D53a6965',
blockCreated: 6_683_000,
},
multicall3: {
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
blockCreated: 42,
},
},
testnet: false,
})

export const lineaMainnetEnsAddresses = {
ensBaseRegistrarImplementation: {
address: '0x6e84390dCc5195414eC91A8c56A5c91021B95704' as Address,
},
ensBulkRenewal: {
address: '0x236Eaa636f518d1c2252F408FdeaCe2FFfAC79Dc' as Address,
},
ensDnsRegistrar: {
address: '0x103bd37229246c58243b7741DB8b3a22dC578511' as Address,
},
ensDnssecImpl: {
address: '0xBE4C2Cb297Eab1614c43e4Aa9cDCDE71b2678204' as Address,
},
ensEthRegistrarController: {
address: '0xDb75Db974B1F2bD3b5916d503036208064D18295' as Address,
},
ensNameWrapper: {
address: '0xA53cca02F98D590819141Aa85C891e2Af713C223' as Address,
},
ensPublicResolver: {
address: '0x86c5AED9F27837074612288610fB98ccC1733126' as Address,
},
ensRegistry: {
address: '0x50130b669B28C339991d8676FA73CF122a121267' as Address,
},
ensReverseRegistrar: {
address: '0x08D3fF6E65f680844fd2465393ff6f0d742b67D5' as Address,
},
ensUniversalResolver: {
address: '0x3aA974fb3f8C1E02796048BDCdeD79e9D53a6965' as Address,
},
}
21 changes: 20 additions & 1 deletion packages/linea-ens-app/src/constants/resolverAddressData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Address } from 'viem'

import { deploymentAddresses } from './chains'
import { lineaMainnetEnsAddresses } from './lineaMainnet'
import { lineaSepoliaEnsAddresses } from './lineaSepolia'
import { RESOLVER_INTERFACE_IDS, ResolverInterfaceId } from './resolverInterfaceIds'

Expand Down Expand Up @@ -389,7 +390,25 @@ export const KNOWN_RESOLVER_DATA: KnownResolverData = {
RESOLVER_INTERFACE_IDS.VersionableResolver,
],
},
// TODO add for linea mainnet when deployed
],
'59144': [
{
address: lineaMainnetEnsAddresses.ensPublicResolver.address,
deployer: 'Consensys',
tag: 'latest',
isNameWrapperAware: true,
supportedInterfaces: [
RESOLVER_INTERFACE_IDS.AddressResolver,
RESOLVER_INTERFACE_IDS.MultiCoinAddressResolver,
RESOLVER_INTERFACE_IDS.NameResolver,
RESOLVER_INTERFACE_IDS.AbiResolver,
RESOLVER_INTERFACE_IDS.TextResolver,
RESOLVER_INTERFACE_IDS.ContentHashResolver,
RESOLVER_INTERFACE_IDS.DnsRecordResolver,
RESOLVER_INTERFACE_IDS.InterfaceResolver,
RESOLVER_INTERFACE_IDS.VersionableResolver,
],
},
],
...(process.env.NEXT_PUBLIC_ETH_NODE === 'anvil'
? {
Expand Down
5 changes: 4 additions & 1 deletion packages/linea-ens-app/src/utils/query/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { FallbackTransport, HttpTransport } from 'viem'
import { createConfig, createStorage, fallback, http } from 'wagmi'
import { localhost } from 'wagmi/chains'

import { lineaSepoliaWithEns, localhostWithEns } from '@app/constants/chains'
import { lineaMainnetWithEns, lineaSepoliaWithEns, localhostWithEns } from '@app/constants/chains'
import { lineaMainnet } from '@app/constants/lineaMainnet'
import { lineaSepolia } from '@app/constants/lineaSepolia'

import { WC_PROJECT_ID } from '../constants'
Expand Down Expand Up @@ -75,6 +76,7 @@ const localStorageWithInvertMiddleware = (): Storage | undefined => {

const chains = [
...(isLocalProvider ? ([localhostWithEns] as const) : ([] as const)),
lineaMainnetWithEns,
lineaSepoliaWithEns,
] as const

Expand All @@ -100,6 +102,7 @@ const wagmiConfig_ = createConfig({
[localhost.id]: HttpTransport
})),

[lineaMainnet.id]: initialiseTransports('linea-mainnet', [infuraUrl]),
[lineaSepolia.id]: initialiseTransports('linea-sepolia', [infuraUrl]),
},
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
59144
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ens": 1720768988,
"root": 1720768990,
"setupRoot": 1720769069,
"legacy-controller": 1720769150
}
Loading

0 comments on commit 79bde5a

Please sign in to comment.