From 2390617ddda489e2bb22beea96440e5b3c100fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pr=C3=A9vost?= <998369+prevostc@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:38:38 +0100 Subject: [PATCH] Add lisk --- package.json | 4 +- src/lib/config.ts | 29 ++++++++++- src/lib/rpc-client.ts | 2 + yarn.lock | 114 ++++++++++++++++++++++++------------------ 4 files changed, 98 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index a5e939d..fe5cd59 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@openzeppelin/contracts": "^4.9.3", "async-lock": "^1.4.0", "axios": "^1.5.0", - "blockchain-addressbook": "^0.47.54", + "blockchain-addressbook": "^0.47.98", "dotenv": "^16.3.1", "lodash": "^4.17.21", "pg": "^8.11.3", @@ -50,7 +50,7 @@ "pg-format": "^1.0.4", "pino": "^8.15.1", "table": "^6.8.1", - "viem": "^2.21.34", + "viem": "^2.21.54", "yaml": "^2.3.2", "yargs": "^17.7.2" }, diff --git a/src/lib/config.ts b/src/lib/config.ts index 78d3890..9d7df4d 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -33,7 +33,7 @@ export const DISABLE_COLLECTOR_FOR_CHAINS: Chain[] = ( process.env.DISABLE_COLLECTOR_FOR_CHAINS ? process.env.DISABLE_COLLECTOR_FOR_CHAINS.split(',') : [] ).filter(chain => allChainIds.includes(chain as Chain)) as Chain[]; export const DISCORD_REPORT_WEBHOOK_URL = process.env.DISCORD_REPORT_WEBHOOK_URL || null; -export const DISCORD_REPORT_ONLY_FOR_CHAINS: Chain[] = ['rootstock']; +export const DISCORD_REPORT_ONLY_FOR_CHAINS: Chain[] = ['lisk']; export const ADD_RP_TVL_TO_CLM_TVL = process.env.ADD_RP_TVL_TO_CLM_TVL === 'true'; export const ADD_RP_VAULT_TVL_TO_CLM_TVL = process.env.ADD_RP_VAULT_TVL_TO_CLM_TVL === 'true'; @@ -546,6 +546,27 @@ export const RPC_CONFIG: Record = { forceGasLimit: 593_200n, }, }, + lisk: { + ...defaultConfig, + url: RPC_FORCE_URL || process.env.LISK_RPC_URL || 'https://rpc.ankr.com/lisk', + contracts: { + ...defaultContracts, + harvestLens: '0x507c863E3d2FDca55054b90966f1fbA107CEb318', + }, + transaction: { + ...defaultTransactionConfig, + type: 'eip1559', + }, + unwrap: { + ...defaultUnwrapConfig, + minAmountOfWNativeWei: bigintMultiplyFloat(ONE_ETHER, 0.005), + maxAmountOfNativeWei: bigintMultiplyFloat(ONE_ETHER, 0.005), + }, + revenueBridgeHarvest: { + ...defaultRevenueBridgeHarvestConfig, + enabled: false, + }, + }, manta: { ...defaultConfig, url: RPC_FORCE_URL || process.env.MANTA_RPC_URL || 'https://pacific-rpc.manta.network/http', @@ -1014,6 +1035,12 @@ export const EXPLORER_CONFIG: Record = { apiKey: process.env.LINEA_EXPLORER_API_KEY || '', type: 'etherscan', }, + lisk: { + addressLinkTemplate: 'https://blockscout.lisk.com/address/${address}', + transactionLinkTemplate: 'https://blockscout.lisk.com/tx/${hash}', + apiUrl: process.env.LISK_EXPLORER_API_URL || 'https://blockscout.lisk.com/api?', + type: 'blockscout', + }, manta: { addressLinkTemplate: 'https://pacific-explorer.manta.network/address/${address}', transactionLinkTemplate: 'https://pacific-explorer.manta.network//tx/${hash}', diff --git a/src/lib/rpc-client.ts b/src/lib/rpc-client.ts index 9b4c95e..4343329 100644 --- a/src/lib/rpc-client.ts +++ b/src/lib/rpc-client.ts @@ -18,6 +18,7 @@ import { harmonyOne, kava, linea, + lisk, mainnet, manta, mantle, @@ -74,6 +75,7 @@ const VIEM_CHAINS: Record = { heco: null, kava: applyConfig('kava', kava), linea: applyConfig('linea', linea), + lisk: applyConfig('lisk', lisk), manta: applyConfig('manta', manta), mantle: applyConfig('mantle', mantle), metis: applyConfig('metis', metis), diff --git a/yarn.lock b/yarn.lock index 15544b8..359735f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@adraffy/ens-normalize@1.11.0": +"@adraffy/ens-normalize@^1.10.1": version "1.11.0" resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz#42cc67c5baa407ac25059fcd7d405cc5ecdb0c33" integrity sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg== @@ -628,12 +628,12 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@noble/curves@1.6.0", "@noble/curves@~1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b" - integrity sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ== +"@noble/curves@1.7.0", "@noble/curves@^1.6.0", "@noble/curves@~1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.7.0.tgz#0512360622439256df892f21d25b388f52505e45" + integrity sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw== dependencies: - "@noble/hashes" "1.5.0" + "@noble/hashes" "1.6.0" "@noble/curves@^1.4.0": version "1.4.2" @@ -647,10 +647,15 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== -"@noble/hashes@1.5.0", "@noble/hashes@~1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0" - integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA== +"@noble/hashes@1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.6.0.tgz#d4bfb516ad6e7b5111c216a5cc7075f4cf19e6c5" + integrity sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ== + +"@noble/hashes@1.6.1", "@noble/hashes@^1.5.0", "@noble/hashes@~1.6.0": + version "1.6.1" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.6.1.tgz#df6e5943edcea504bac61395926d6fd67869a0d5" + integrity sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -756,27 +761,27 @@ "@pnpm/network.ca-file" "^1.0.1" config-chain "^1.1.11" -"@scure/base@~1.1.7", "@scure/base@~1.1.8": - version "1.1.9" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" - integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== +"@scure/base@~1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.2.1.tgz#dd0b2a533063ca612c17aa9ad26424a2ff5aa865" + integrity sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ== -"@scure/bip32@1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.5.0.tgz#dd4a2e1b8a9da60e012e776d954c4186db6328e6" - integrity sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw== +"@scure/bip32@1.6.0", "@scure/bip32@^1.5.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.6.0.tgz#6dbc6b4af7c9101b351f41231a879d8da47e0891" + integrity sha512-82q1QfklrUUdXJzjuRU7iG7D7XiFx5PHYVS0+oeNKhyDLT7WPqs6pBcM2W5ZdwOwKCwoE1Vy1se+DHjcXwCYnA== dependencies: - "@noble/curves" "~1.6.0" - "@noble/hashes" "~1.5.0" - "@scure/base" "~1.1.7" + "@noble/curves" "~1.7.0" + "@noble/hashes" "~1.6.0" + "@scure/base" "~1.2.1" -"@scure/bip39@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.4.0.tgz#664d4f851564e2e1d4bffa0339f9546ea55960a6" - integrity sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw== +"@scure/bip39@1.5.0", "@scure/bip39@^1.4.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.5.0.tgz#c8f9533dbd787641b047984356531d84485f19be" + integrity sha512-Dop+ASYhnrwm9+HA/HwXg7j2ZqM6yk2fyLWb5znexjctFY3+E+eU8cIWI0Pql0Qx4hPZCijlGq4OL71g+Uz30A== dependencies: - "@noble/hashes" "~1.5.0" - "@scure/base" "~1.1.8" + "@noble/hashes" "~1.6.0" + "@scure/base" "~1.2.1" "@sigstore/bundle@^1.0.0": version "1.0.0" @@ -997,10 +1002,10 @@ abbrev@^1.0.0: resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== -abitype@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.6.tgz#76410903e1d88e34f1362746e2d407513c38565b" - integrity sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A== +abitype@1.0.7, abitype@^1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.7.tgz#876a0005d211e1c9132825d45bcee7b46416b284" + integrity sha512-ZfYYSktDQUwc2eduYu8C4wOs+RDPmnRYMh7zNfzeMtGGgb0U+6tLGjixUic6mXf5xKKCcgT5Qp6cv39tOARVFw== abort-controller@^3.0.0: version "3.0.0" @@ -1248,10 +1253,10 @@ base64-js@^1.3.1: resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -blockchain-addressbook@^0.47.54: - version "0.47.54" - resolved "https://registry.yarnpkg.com/blockchain-addressbook/-/blockchain-addressbook-0.47.54.tgz#1c117509c0ac410be5eab2e1bd4ec8bb952187f9" - integrity sha512-NP91iyX1HsiVO8R6wHFNQ7BjESga/XMO1JGf7n9DG+9hg4WMAkx7V4egEV6mNvJOrvWc4Etl3Xi0IJflQnaTAw== +blockchain-addressbook@^0.47.98: + version "0.47.98" + resolved "https://registry.yarnpkg.com/blockchain-addressbook/-/blockchain-addressbook-0.47.98.tgz#d42cddd3b7e6add7cc78f7c81044f9147ccbccec" + integrity sha512-U4FbqU3pb3ZN+/tC+NlL+6V5KUnliOcHnmYbq7Ft3+VuuJaqLoMeC/w1GnfzJvBnd7fSv3FdFTFS3o7nVyYHJA== boxen@^7.0.0: version "7.1.1" @@ -1787,9 +1792,9 @@ event-target-shim@^5.0.0: resolved "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -eventemitter3@^5.0.1: +eventemitter3@5.0.1, eventemitter3@^5.0.1: version "5.0.1" - resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== events@^3.3.0: @@ -3472,6 +3477,19 @@ onetime@^6.0.0: dependencies: mimic-fn "^4.0.0" +ox@0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ox/-/ox-0.1.2.tgz#0f791be2ccabeaf4928e6d423498fe1c8094e560" + integrity sha512-ak/8K0Rtphg9vnRJlbOdaX9R7cmxD2MiSthjWGaQdMk3D7hrAlDoM+6Lxn7hN52Za3vrXfZ7enfke/5WjolDww== + dependencies: + "@adraffy/ens-normalize" "^1.10.1" + "@noble/curves" "^1.6.0" + "@noble/hashes" "^1.5.0" + "@scure/bip32" "^1.5.0" + "@scure/bip39" "^1.4.0" + abitype "^1.0.6" + eventemitter3 "5.0.1" + p-cancelable@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz" @@ -4703,18 +4721,18 @@ validate-npm-package-name@^5.0.0: dependencies: builtins "^5.0.0" -viem@^2.21.34: - version "2.21.34" - resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.34.tgz#5206148a6aa659113d7844db53247a411d28569e" - integrity sha512-IR8ucya4dkVJv1jzv/qBz1TxYbSoXZuJPuqQk1/AybU9VuGdMUayittYwr0Navs97XFNml6UWGVya07apoaBmQ== - dependencies: - "@adraffy/ens-normalize" "1.11.0" - "@noble/curves" "1.6.0" - "@noble/hashes" "1.5.0" - "@scure/bip32" "1.5.0" - "@scure/bip39" "1.4.0" - abitype "1.0.6" +viem@^2.21.54: + version "2.21.54" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.54.tgz#76d6f86ab8809078f1ac140ac1a2beadbc86b9f6" + integrity sha512-G9mmtbua3UtnVY9BqAtWdNp+3AO+oWhD0B9KaEsZb6gcrOWgmA4rz02yqEMg+qW9m6KgKGie7q3zcHqJIw6AqA== + dependencies: + "@noble/curves" "1.7.0" + "@noble/hashes" "1.6.1" + "@scure/bip32" "1.6.0" + "@scure/bip39" "1.5.0" + abitype "1.0.7" isows "1.0.6" + ox "0.1.2" webauthn-p256 "0.0.10" ws "8.18.0"