Skip to content

Commit

Permalink
feat(networks): add Linea network (#12782)
Browse files Browse the repository at this point in the history
* add linea basic config

* set featured to false

* subgraph dummy endpoints

* add unlock address

* api verif key

* Update packages/networks/src/networks/linea.ts

* more linea setup

* comment features

* add workaround to deploy to linea graph

* update graph start block and name

* fixed network name helper

* added missing contracts on linea

* adding linea RPC provider

---------

Co-authored-by: Julien Genestoux <julien.genestoux@gmail.com>
  • Loading branch information
clemsos and julien51 committed Oct 27, 2023
1 parent 720a095 commit 6391d0e
Show file tree
Hide file tree
Showing 12 changed files with 616 additions and 44 deletions.
9 changes: 9 additions & 0 deletions packages/hardhat-helpers/src/etherscan.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const etherscan = {
palm: 'abc',
baseGoerli: 'YourApiKeyToken',
base: 'F9E5R4E8HIJQZMRE9U9IZMP7NVZ2IAXNB8',
linea: 'S66J314Q7PICPB4RP2G117KDFQRBEUYIFX',
},
// TODO : generate from networks package!
customChains: [
Expand Down Expand Up @@ -54,6 +55,14 @@ const etherscan = {
browserURL: 'https://basescan.org/',
},
},
{
network: 'linea',
chainId: 59144,
urls: {
apiURL: 'https://api.lineascan.build/api',
browserURL: 'https://lineascan.build/',
},
},
],
}

Expand Down
1 change: 1 addition & 0 deletions packages/networks/src/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export * from './avalanche'
export * from './palm'
export * from './base-goerli'
export * from './base'
export * from './linea'
export * from './sepolia'
114 changes: 114 additions & 0 deletions packages/networks/src/networks/linea.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import { HookType, NetworkConfig } from '@unlock-protocol/types'

export const linea: NetworkConfig = {
blockScan: {
url: (address: string) => `https://blockscan.com/address/${address}`,
},
chain: 'linea',
description:
'Linea a Layer 2 zk-Rollup EVM-compatible chain powered by ConsenSys.',
explorer: {
name: 'Linea',
urls: {
address: (address: string) =>
`https://lineascan.build/address/${address}`,
base: `https://lineascan.build/`,
token: (address: string, holder: string) =>
`https://lineascan.build/token/${address}?a=${holder}`,
transaction: (hash: string) => `https://lineascan.build/tx/${hash}`,
},
},
featured: false,
hooks: {
onKeyPurchaseHook: [
{
address: '0x6878Ae3c863f6Ebd27B47C02F6B32aAC8B0BA07E',
id: HookType.PASSWORD,
name: 'Password required',
},
{
address: '0x8c5D54B2CAA4C2D08B0DDF82a1e6D2641779B8EC',
id: HookType.CAPTCHA,
name: 'Captcha',
},
{
address: '0xaE8F3F0826A39122401ED634f0a5C19549331432',
id: HookType.GUILD,
name: 'Guild',
},
{
address: '0xCD9C9b40D757b56359e19563203D3bc64089638d',
id: HookType.PROMOCODE,
name: 'Discount code',
},
],
},
id: 59144,

isTestNetwork: false,

keyManagerAddress: '0x338b1f296217485bf4df6CE9f93ab4C73F72b57D',

maxFreeClaimCost: 10,

// multisig: '', // TODO

name: 'Linea',

nativeCurrency: {
coingecko: 'linea-eth',
decimals: 18,
name: 'Linea Ether',
symbol: 'ETH',
},
previousDeploys: [],
provider: 'https://rpc.unlock-protocol.com/59144',
publicLockVersionToDeploy: 13,
publicProvider: 'https://rpc.linea.build/',
startBlock: 560908,
subgraph: {
endpoint: 'https://graph-query.linea.build/subgraphs/name/unlock-protocol',
endpointV2:
'https://graph-query.linea.build/subgraphs/name/unlock-protocol',
// NB: this name should be changed once The Graph supports Linea
networkName: 'linea-mainnet',
},
tokens: [
{
address: '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f',
decimals: 18,
name: 'Wrapped Ether',
symbol: 'WETH',
},
{
address: '0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5',
decimals: 18,
name: 'Dai Stablecoin',
symbol: 'DAI',
},
{
address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93',
decimals: 6,
name: 'Tether USD',
symbol: 'USDT',
},
{
address: '0x176211869cA2b568f2A7D4EE941E073a821EE1ff',
decimals: 6,
name: 'USD Coin',
symbol: 'USDC',
},
{
address: '0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4',
decimals: 8,
name: 'Wrapped BTC',
symbol: 'WBTC',
},
],
// uniswapV3: {},
// universalCard: {},
unlockAddress: '0x70B3c9Dd9788570FAAb24B92c3a57d99f8186Cc7',
url: 'https://linea.build/',
}

export default linea
1 change: 1 addition & 0 deletions provider/src/supportedNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const supportedNetworks = (env: Env, networkId: string): string | undefined => {
'84531': env.BASE_GOERLI_PROVIDER,
'8453': env.BASE_PROVIDER,
'11155111': env.SEPOLIA_PROVIDER,
'59144': env.LINEA_PROVIDER,
}[networkId]
}

Expand Down
1 change: 1 addition & 0 deletions provider/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export interface Env {
BASE_GOERLI_PROVIDER: string
BASE_PROVIDER: string
SEPOLIA_PROVIDER: string
LINEA_PROVIDER: string
}
Loading

0 comments on commit 6391d0e

Please sign in to comment.