From 48a1695559fa744ab3ac91be118bba245cebeee4 Mon Sep 17 00:00:00 2001 From: Atatakai Date: Mon, 21 Oct 2024 22:41:12 +0400 Subject: [PATCH 1/2] (launch, govern) feat: support mode network --- .env.example | 2 + apps/govern/common-util/config/wagmi.ts | 8 +-- apps/govern/common-util/constants/rpcs.ts | 19 ------- .../common-util/functions/frontend-library.ts | 2 +- apps/govern/common-util/functions/requests.ts | 2 +- .../components/Contracts/EditVotes/index.tsx | 2 +- apps/govern/jest.setup.js | 3 +- apps/govern/tenderly.config.ts | 52 +++---------------- apps/launch/common-util/config/wagmi.ts | 10 ++-- apps/launch/common-util/constants/rpcs.ts | 7 --- .../common-util/constants/stakingContract.ts | 10 +++- .../common-util/functions/frontend-library.ts | 4 +- apps/launch/jest.setup.js | 3 +- apps/launch/tenderly.config.ts | 9 +++- libs/common-middleware/src/lib/cspHeader.ts | 2 + libs/util-constants/src/lib/chains.ts | 4 +- libs/util-constants/src/lib/rpcUrls.ts | 6 ++- .../util-constants/src/lib/tenderly.config.ts | 15 ++++++ .../src/lib/abiAndAddresses/stakingFactory.js | 3 +- 19 files changed, 71 insertions(+), 92 deletions(-) delete mode 100644 apps/govern/common-util/constants/rpcs.ts delete mode 100644 apps/launch/common-util/constants/rpcs.ts diff --git a/.env.example b/.env.example index a63ed635..3a1266da 100644 --- a/.env.example +++ b/.env.example @@ -11,12 +11,14 @@ NEXT_PUBLIC_WALLET_PROJECT_ID=__URL__ NEXT_PUBLIC_SOLANA_MAINNET_BETA_URL=__value__ NEXT_PUBLIC_AUTONOLAS_SUB_GRAPH_URL=__URL__ NEXT_PUBLIC_OPTIMISM_URL=__URL__ +NEXT_PUBLIC_MODE_URL=__URL__ NEXT_PUBLIC_IS_CONNECTED_TO_LOCAL=__TRUE_OR_FALSE__ # testnets NEXT_PUBLIC_MAINNET_TEST_RPC=__URL__ NEXT_PUBLIC_GNOSIS_TEST_RPC=__URL__ NEXT_PUBLIC_POLYGON_TEST_RPC=__URL__ +NEXT_PUBLIC_MODE_TEST_RPC=__URL__ NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET= # registry diff --git a/apps/govern/common-util/config/wagmi.ts b/apps/govern/common-util/config/wagmi.ts index 3aaf37b7..7f71b121 100644 --- a/apps/govern/common-util/config/wagmi.ts +++ b/apps/govern/common-util/config/wagmi.ts @@ -9,12 +9,12 @@ import { mainnet, optimism, polygon, + mode, } from 'wagmi/chains'; import { coinbaseWallet, injected, safe, walletConnect } from 'wagmi/connectors'; -import { RPC_URLS } from 'common-util/constants/rpcs'; - -import { virtualGnosis, virtualMainnet, virtualPolygon } from '../../tenderly.config'; +import { virtualGnosis, virtualMainnet, virtualPolygon, virtualMode } from '../../tenderly.config'; +import { RPC_URLS } from 'libs/util-constants/src'; const mainnetChain = process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' ? virtualMainnet : mainnet; @@ -22,11 +22,13 @@ const gnosisChain = process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' ? virtualGnosis : gnosis; const polygonChain = process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' ? virtualPolygon : polygon; +const modeChain = process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' ? virtualMode : mode; export const SUPPORTED_CHAINS: [Chain, ...Chain[]] = [ mainnetChain, gnosisChain, polygonChain, + modeChain, optimism, base, arbitrum, diff --git a/apps/govern/common-util/constants/rpcs.ts b/apps/govern/common-util/constants/rpcs.ts deleted file mode 100644 index 215695f2..00000000 --- a/apps/govern/common-util/constants/rpcs.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { gnosis, mainnet, polygon } from 'wagmi/chains'; - -import { STAGING_CHAIN_ID } from '@autonolas/frontend-library'; - -export const RPC_URLS: Record = { - 1: - (process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' - ? process.env.NEXT_PUBLIC_MAINNET_TEST_RPC - : process.env.NEXT_PUBLIC_MAINNET_URL) ?? mainnet.rpcUrls.default.http[0], - 100: - (process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' - ? process.env.NEXT_PUBLIC_GNOSIS_TEST_RPC - : process.env.NEXT_PUBLIC_GNOSIS_URL) ?? gnosis.rpcUrls.default.http[0], - 137: - (process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' - ? process.env.NEXT_PUBLIC_POLYGON_TEST_RPC - : process.env.NEXT_PUBLIC_POLYGON_URL) ?? polygon.rpcUrls.default.http[0], - [STAGING_CHAIN_ID]: 'http://127.0.0.1:8545', -}; diff --git a/apps/govern/common-util/functions/frontend-library.ts b/apps/govern/common-util/functions/frontend-library.ts index 708db2aa..5fc97622 100644 --- a/apps/govern/common-util/functions/frontend-library.ts +++ b/apps/govern/common-util/functions/frontend-library.ts @@ -5,7 +5,7 @@ import { } from '@autonolas/frontend-library'; import { SUPPORTED_CHAINS } from 'common-util/config/wagmi'; -import { RPC_URLS } from 'common-util/constants/rpcs'; +import { RPC_URLS } from 'libs/util-constants/src'; export const getProvider = () => { const provider = getProviderFn(SUPPORTED_CHAINS, RPC_URLS); diff --git a/apps/govern/common-util/functions/requests.ts b/apps/govern/common-util/functions/requests.ts index b19bda8c..104e1567 100644 --- a/apps/govern/common-util/functions/requests.ts +++ b/apps/govern/common-util/functions/requests.ts @@ -12,7 +12,6 @@ import { import { getEstimatedGasLimit, sendTransaction } from 'libs/util-functions/src'; import { SUPPORTED_CHAINS, wagmiConfig } from 'common-util/config/wagmi'; -import { RPC_URLS } from 'common-util/constants/rpcs'; import { getAddressFromBytes32 } from './addresses'; import { getUnixNextWeekStartTimestamp } from './time'; @@ -24,6 +23,7 @@ import { getVeOlasContract, getVoteWeightingContract, } from './web3'; +import { RPC_URLS } from 'libs/util-constants/src'; type VoteForNomineeWeightsParams = { account: Address | undefined; diff --git a/apps/govern/components/Contracts/EditVotes/index.tsx b/apps/govern/components/Contracts/EditVotes/index.tsx index 7ebf221b..c4913615 100644 --- a/apps/govern/components/Contracts/EditVotes/index.tsx +++ b/apps/govern/components/Contracts/EditVotes/index.tsx @@ -74,7 +74,7 @@ const getColumns = ( value={allocations[index].weight} status={isError ? 'error' : undefined} onChange={(value) => { - if (value) { + if (typeof value === 'number') { setAllocation(value, index); } }} diff --git a/apps/govern/jest.setup.js b/apps/govern/jest.setup.js index 82a0abdc..151d1a25 100644 --- a/apps/govern/jest.setup.js +++ b/apps/govern/jest.setup.js @@ -21,7 +21,7 @@ Object.defineProperty(window, 'matchMedia', { })), }); -const { mainnet, optimism, gnosis, polygon, base, arbitrum, celo } = require('viem/chains'); +const { mainnet, optimism, gnosis, polygon, base, arbitrum, celo, mode } = require('viem/chains'); jest.mock('wagmi/chains', () => ({ mainnet, @@ -31,4 +31,5 @@ jest.mock('wagmi/chains', () => ({ base, arbitrum, celo, + mode, })); diff --git a/apps/govern/tenderly.config.ts b/apps/govern/tenderly.config.ts index 505d447d..7d46cce7 100644 --- a/apps/govern/tenderly.config.ts +++ b/apps/govern/tenderly.config.ts @@ -1,46 +1,8 @@ -import { defineChain } from 'viem'; +import { + virtualGnosis, + virtualMainnet, + virtualPolygon, + virtualMode, +} from 'libs/util-constants/src'; -export const virtualMainnet = defineChain({ - id: 1, - name: 'Virtual Mainnet', - nativeCurrency: { name: 'vETH', symbol: 'vETH', decimals: 18 }, - rpcUrls: { - default: { http: [`${process.env.NEXT_PUBLIC_MAINNET_TEST_RPC}`] }, - }, - blockExplorers: { - default: { - name: 'Tenderly Explorer', - url: '', - }, - }, -}); - -export const virtualGnosis = defineChain({ - id: 100, - name: 'Virtual Gnosis Chain', - nativeCurrency: { name: 'vXDAI', symbol: 'vXDAI', decimals: 18 }, - rpcUrls: { - default: { http: [`${process.env.NEXT_PUBLIC_GNOSIS_TEST_RPC}`] }, - }, - blockExplorers: { - default: { - name: 'Tenderly Explorer', - url: '', - }, - }, -}); - -export const virtualPolygon = defineChain({ - id: 137, - name: 'Virtual Polygon', - nativeCurrency: { name: 'vMATIC', symbol: 'vMATIC', decimals: 18 }, - rpcUrls: { - default: { http: [`${process.env.NEXT_PUBLIC_POLYGON_TEST_RPC}`] }, - }, - blockExplorers: { - default: { - name: 'Tenderly Explorer', - url: '', - }, - }, -}); +export { virtualGnosis, virtualMainnet, virtualPolygon, virtualMode }; diff --git a/apps/launch/common-util/config/wagmi.ts b/apps/launch/common-util/config/wagmi.ts index 6b2965d4..1849f39a 100644 --- a/apps/launch/common-util/config/wagmi.ts +++ b/apps/launch/common-util/config/wagmi.ts @@ -9,12 +9,12 @@ import { mainnet, optimism, polygon, + mode, } from 'wagmi/chains'; import { coinbaseWallet, injected, safe, walletConnect } from 'wagmi/connectors'; -import { LAUNCH_RPC_URLS } from 'common-util/constants/rpcs'; - -import { virtualGnosis, virtualMainnet, virtualPolygon } from '../../tenderly.config'; +import { virtualGnosis, virtualMainnet, virtualPolygon, virtualMode } from '../../tenderly.config'; +import { RPC_URLS } from 'libs/util-constants/src'; const mainnetChain = process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' ? virtualMainnet : mainnet; @@ -22,11 +22,13 @@ const gnosisChain = process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' ? virtualGnosis : gnosis; const polygonChain = process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' ? virtualPolygon : polygon; +const modeChain = process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' ? virtualMode : mode; export const SUPPORTED_CHAINS: [Chain, ...Chain[]] = [ mainnetChain, gnosisChain, polygonChain, + modeChain, optimism, base, arbitrum, @@ -56,7 +58,7 @@ export const wagmiConfig = createConfig({ }), ], transports: SUPPORTED_CHAINS.reduce( - (acc, chain) => Object.assign(acc, { [chain.id]: http(LAUNCH_RPC_URLS[chain.id]) }), + (acc, chain) => Object.assign(acc, { [chain.id]: http(RPC_URLS[chain.id]) }), {}, ), }); diff --git a/apps/launch/common-util/constants/rpcs.ts b/apps/launch/common-util/constants/rpcs.ts deleted file mode 100644 index 23ca4281..00000000 --- a/apps/launch/common-util/constants/rpcs.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { RPC_URLS } from 'libs/util-constants/src'; - -export const LAUNCH_RPC_URLS: Record = { - 1: RPC_URLS[1], - 100: RPC_URLS[100], - 137: RPC_URLS[137], -}; diff --git a/apps/launch/common-util/constants/stakingContract.ts b/apps/launch/common-util/constants/stakingContract.ts index 6934da17..9441e172 100644 --- a/apps/launch/common-util/constants/stakingContract.ts +++ b/apps/launch/common-util/constants/stakingContract.ts @@ -1,5 +1,5 @@ import { Address } from 'viem'; -import { arbitrum, base, celo, gnosis, mainnet, optimism, polygon } from 'viem/chains'; +import { arbitrum, base, celo, gnosis, mainnet, optimism, polygon, mode } from 'viem/chains'; export const CONTRACT_TEMPLATES = [ { @@ -37,7 +37,8 @@ export type ChainId = | typeof polygon.id | typeof base.id | typeof arbitrum.id - | typeof celo.id; + | typeof celo.id + | typeof mode.id; type Addresses = { [key in ChainId]: Address; @@ -51,6 +52,7 @@ export const IMPLEMENTATION_ADDRESSES: Addresses = { [base.id]: '0xEB5638eefE289691EcE01943f768EDBF96258a80', [arbitrum.id]: '0x04b0007b2aFb398015B76e5f22993a1fddF83644', [celo.id]: '0xe1E1B286EbE95b39F785d8069f2248ae9C41b7a9', + [mode.id]: '0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA', }; export const SERVICE_REGISTRY_ADDRESSES: Addresses = { @@ -61,6 +63,7 @@ export const SERVICE_REGISTRY_ADDRESSES: Addresses = { [base.id]: '0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE', [arbitrum.id]: '0xE3607b00E75f6405248323A9417ff6b39B244b50', [celo.id]: '0xE3607b00E75f6405248323A9417ff6b39B244b50', + [mode.id]: '0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE', }; export const SERVICE_REGISTRY_TOKEN_UTILITY_ADDRESSES: Addresses = { @@ -71,6 +74,7 @@ export const SERVICE_REGISTRY_TOKEN_UTILITY_ADDRESSES: Addresses = { [base.id]: '0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5', [arbitrum.id]: '0x3d77596beb0f130a4415df3D2D8232B3d3D31e44', [celo.id]: '0x3d77596beb0f130a4415df3D2D8232B3d3D31e44', + [mode.id]: '0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5', }; export const STAKING_TOKEN_ADDRESSES: Addresses = { @@ -81,6 +85,7 @@ export const STAKING_TOKEN_ADDRESSES: Addresses = { [base.id]: '0x54330d28ca3357F294334BDC454a032e7f353416', [arbitrum.id]: '0x3d77596beb0f130a4415df3D2D8232B3d3D31e44', [celo.id]: '0xaCFfAe8e57Ec6E394Eb1b41939A8CF7892DbDc51', + [mode.id]: '0xcfD1D50ce23C46D3Cf6407487B2F8934e96DC8f9', }; export const isSupportedChainId = (chainId: number): chainId is ChainId => { @@ -99,4 +104,5 @@ export const blockNumbers: BlockNumbers = { [base.id]: 17310019, [arbitrum.id]: 233883523, [celo.id]: 26748574, + [mode.id]: 14444647, }; diff --git a/apps/launch/common-util/functions/frontend-library.ts b/apps/launch/common-util/functions/frontend-library.ts index 2882118e..224f57a8 100644 --- a/apps/launch/common-util/functions/frontend-library.ts +++ b/apps/launch/common-util/functions/frontend-library.ts @@ -7,10 +7,10 @@ import { } from '@autonolas/frontend-library'; import { SUPPORTED_CHAINS } from 'common-util/config/wagmi'; -import { LAUNCH_RPC_URLS } from 'common-util/constants/rpcs'; +import { RPC_URLS } from 'libs/util-constants/src'; export const getProvider = () => { - const provider = getProviderFn(SUPPORTED_CHAINS, LAUNCH_RPC_URLS); + const provider = getProviderFn(SUPPORTED_CHAINS, RPC_URLS); // not connected, return fallback URL if (typeof provider === 'string') return provider; // coinbase injected multi wallet provider diff --git a/apps/launch/jest.setup.js b/apps/launch/jest.setup.js index 6f63434e..79a09935 100644 --- a/apps/launch/jest.setup.js +++ b/apps/launch/jest.setup.js @@ -21,7 +21,7 @@ Object.defineProperty(window, 'matchMedia', { })), }); -const { mainnet, optimism, gnosis, polygon, base, arbitrum, celo } = require('viem/chains'); +const { mainnet, optimism, gnosis, polygon, base, arbitrum, celo, mode } = require('viem/chains'); jest.mock('wagmi/chains', () => ({ mainnet, @@ -31,6 +31,7 @@ jest.mock('wagmi/chains', () => ({ base, arbitrum, celo, + mode, })); jest.mock('common-util/config/wagmi', () => ({ diff --git a/apps/launch/tenderly.config.ts b/apps/launch/tenderly.config.ts index 6518e016..7d46cce7 100644 --- a/apps/launch/tenderly.config.ts +++ b/apps/launch/tenderly.config.ts @@ -1,3 +1,8 @@ -import { virtualGnosis, virtualMainnet, virtualPolygon } from 'libs/util-constants/src'; +import { + virtualGnosis, + virtualMainnet, + virtualPolygon, + virtualMode, +} from 'libs/util-constants/src'; -export { virtualGnosis, virtualMainnet, virtualPolygon }; +export { virtualGnosis, virtualMainnet, virtualPolygon, virtualMode }; diff --git a/libs/common-middleware/src/lib/cspHeader.ts b/libs/common-middleware/src/lib/cspHeader.ts index 49361338..e116a032 100644 --- a/libs/common-middleware/src/lib/cspHeader.ts +++ b/libs/common-middleware/src/lib/cspHeader.ts @@ -62,11 +62,13 @@ const ALLOWED_ORIGINS = [ 'https://alfajores-forno.celo-testnet.org', 'https://api.web3modal.com/', 'https://rpc.ankr.com/', + 'https://mainnet.mode.network/', // tenderly 'https://virtual.mainnet.rpc.tenderly.co/', 'https://virtual.gnosis.rpc.tenderly.co/', 'https://virtual.polygon.rpc.tenderly.co/', + 'https://virtual.mode.rpc.tenderly.co/', 'https://rpc.tenderly.co/fork/', // others 'https://api.thegraph.com/', diff --git a/libs/util-constants/src/lib/chains.ts b/libs/util-constants/src/lib/chains.ts index 2b8b39e1..93dae81a 100644 --- a/libs/util-constants/src/lib/chains.ts +++ b/libs/util-constants/src/lib/chains.ts @@ -1,4 +1,4 @@ -import { Chain, arbitrum, base, celo, gnosis, mainnet, optimism, polygon } from 'viem/chains'; +import { Chain, arbitrum, base, celo, gnosis, mainnet, mode, optimism, polygon } from 'viem/chains'; export const CHAIN_NAMES: Record = { 1: mainnet.name, @@ -6,6 +6,7 @@ export const CHAIN_NAMES: Record = { 100: gnosis.name, 137: polygon.name, 8_453: base.name, + 34_443: mode.name, 42_161: arbitrum.name, 42_220: celo.name, }; @@ -16,6 +17,7 @@ export const CHAINS: Record = { 100: gnosis, 137: polygon, 8_453: base, + 34_443: mode, 42_161: arbitrum, 42_220: celo, }; diff --git a/libs/util-constants/src/lib/rpcUrls.ts b/libs/util-constants/src/lib/rpcUrls.ts index 44882a46..d9c31798 100644 --- a/libs/util-constants/src/lib/rpcUrls.ts +++ b/libs/util-constants/src/lib/rpcUrls.ts @@ -1,4 +1,4 @@ -import { arbitrum, base, celo, gnosis, mainnet, optimism, polygon } from 'wagmi/chains'; +import { arbitrum, base, celo, gnosis, mainnet, optimism, polygon, mode } from 'wagmi/chains'; import { STAGING_CHAIN_ID } from '@autonolas/frontend-library'; @@ -18,6 +18,10 @@ export const RPC_URLS: Record = { ? process.env.NEXT_PUBLIC_POLYGON_TEST_RPC : process.env.NEXT_PUBLIC_POLYGON_URL) ?? polygon.rpcUrls.default.http[0], 8453: process.env.NEXT_PUBLIC_BASE_URL ?? base.rpcUrls.default.http[0], + 34443: + (process.env.NEXT_PUBLIC_IS_CONNECTED_TO_TEST_NET === 'true' + ? process.env.NEXT_PUBLIC_MODE_TEST_RPC + : process.env.NEXT_PUBLIC_MODE_URL) ?? mode.rpcUrls.default.http[0], 42161: process.env.NEXT_PUBLIC_ARBITRUM_URL ?? arbitrum.rpcUrls.default.http[0], 42220: process.env.NEXT_PUBLIC_CELO_URL ?? celo.rpcUrls.default.http[0], [STAGING_CHAIN_ID]: 'http://127.0.0.1:8545', diff --git a/libs/util-constants/src/lib/tenderly.config.ts b/libs/util-constants/src/lib/tenderly.config.ts index 658169bd..92e24ed1 100644 --- a/libs/util-constants/src/lib/tenderly.config.ts +++ b/libs/util-constants/src/lib/tenderly.config.ts @@ -44,3 +44,18 @@ export const virtualPolygon = defineChain({ }, }, }); + +export const virtualMode = defineChain({ + id: 34443, + name: 'Mode Mainnet', + nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, + rpcUrls: { + default: { http: [`${process.env.NEXT_PUBLIC_MODE_TEST_RPC}`] }, + }, + blockExplorers: { + default: { + name: 'Tenderly Explorer', + url: '', + }, + }, +}); diff --git a/libs/util-contracts/src/lib/abiAndAddresses/stakingFactory.js b/libs/util-contracts/src/lib/abiAndAddresses/stakingFactory.js index 0e42372c..b76e2ece 100644 --- a/libs/util-contracts/src/lib/abiAndAddresses/stakingFactory.js +++ b/libs/util-contracts/src/lib/abiAndAddresses/stakingFactory.js @@ -1,4 +1,4 @@ -import { arbitrum, base, celo, gnosis, mainnet, optimism, polygon } from 'viem/chains'; +import { arbitrum, base, celo, gnosis, mainnet, optimism, polygon, mode } from 'viem/chains'; export const STAKING_FACTORY = { contractName: 'StakingFactory', @@ -10,6 +10,7 @@ export const STAKING_FACTORY = { [base.id]: '0x1cEe30D08943EB58EFF84DD1AB44a6ee6FEff63a', [arbitrum.id]: '0xEB5638eefE289691EcE01943f768EDBF96258a80', [celo.id]: '0x1c2cD884127b080F940b7546c1e9aaf525b1FA55', + [mode.id]: '0x75D529FAe220bC8db714F0202193726b46881B76', }, abi: [ { From 575f1466ac36cf743bf8f5de70b2d4acefea185b Mon Sep 17 00:00:00 2001 From: Atatakai Date: Tue, 22 Oct 2024 10:41:56 +0400 Subject: [PATCH 2/2] (launch) chore: rename addresses constants, fix tests --- apps/launch/common-util/constants/stakingContract.ts | 6 +++--- apps/launch/common-util/functions/stakingContract.ts | 4 ++-- .../components/MyStakingContracts/Create/index.spec.tsx | 2 +- apps/launch/components/MyStakingContracts/Create/index.tsx | 4 ++-- apps/launch/components/MyStakingContracts/Details/index.tsx | 4 ++-- apps/launch/jest.config.js | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/launch/common-util/constants/stakingContract.ts b/apps/launch/common-util/constants/stakingContract.ts index 9441e172..f9923157 100644 --- a/apps/launch/common-util/constants/stakingContract.ts +++ b/apps/launch/common-util/constants/stakingContract.ts @@ -44,7 +44,7 @@ type Addresses = { [key in ChainId]: Address; }; -export const IMPLEMENTATION_ADDRESSES: Addresses = { +export const STAKING_TOKEN_ADDRESSES: Addresses = { [mainnet.id]: '0x0Dc23eEf3bC64CF3cbd8f9329B57AE4C4f28d5d2', [optimism.id]: '0x63C2c53c09dE534Dd3bc0b7771bf976070936bAC', [gnosis.id]: '0xEa00be6690a871827fAfD705440D20dd75e67AB1', @@ -77,7 +77,7 @@ export const SERVICE_REGISTRY_TOKEN_UTILITY_ADDRESSES: Addresses = { [mode.id]: '0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5', }; -export const STAKING_TOKEN_ADDRESSES: Addresses = { +export const OLAS_ADDRESSES: Addresses = { [mainnet.id]: '0x0001A500A6B18995B03f44bb040A5fFc28E45CB0', [optimism.id]: '0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527', [gnosis.id]: '0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f', @@ -89,7 +89,7 @@ export const STAKING_TOKEN_ADDRESSES: Addresses = { }; export const isSupportedChainId = (chainId: number): chainId is ChainId => { - return chainId in IMPLEMENTATION_ADDRESSES; + return chainId in STAKING_TOKEN_ADDRESSES; }; type BlockNumbers = { diff --git a/apps/launch/common-util/functions/stakingContract.ts b/apps/launch/common-util/functions/stakingContract.ts index 9903d4d7..e1180612 100644 --- a/apps/launch/common-util/functions/stakingContract.ts +++ b/apps/launch/common-util/functions/stakingContract.ts @@ -10,7 +10,7 @@ import { ChainId, SERVICE_REGISTRY_ADDRESSES, SERVICE_REGISTRY_TOKEN_UTILITY_ADDRESSES, - STAKING_TOKEN_ADDRESSES, + OLAS_ADDRESSES, } from 'common-util/constants/stakingContract'; type StakingContractValues = { @@ -65,7 +65,7 @@ export const getStakingContractInitPayload = ({ const contractInterface = new ethers.Interface(STAKING_TOKEN.abi); const serviceRegistryTokenUtilityAddress = SERVICE_REGISTRY_TOKEN_UTILITY_ADDRESSES[chainId]; - const tokenAddress = STAKING_TOKEN_ADDRESSES[chainId]; + const tokenAddress = OLAS_ADDRESSES[chainId]; const encodedPayload = contractInterface.encodeFunctionData('initialize', [ stakingParams, diff --git a/apps/launch/components/MyStakingContracts/Create/index.spec.tsx b/apps/launch/components/MyStakingContracts/Create/index.spec.tsx index dceb794c..49672a56 100644 --- a/apps/launch/components/MyStakingContracts/Create/index.spec.tsx +++ b/apps/launch/components/MyStakingContracts/Create/index.spec.tsx @@ -146,7 +146,7 @@ describe('', () => { await clickCreateContractButton(); expect( - screen.getByText('Minimum service staking deposit, OLAS must be at least 1 and at most 1000'), + screen.getByText(/Minimum service staking deposit, OLAS must be at least 1 and at most 1000/), ).toBeInTheDocument(); }); diff --git a/apps/launch/components/MyStakingContracts/Create/index.tsx b/apps/launch/components/MyStakingContracts/Create/index.tsx index be89c244..9e693597 100644 --- a/apps/launch/components/MyStakingContracts/Create/index.tsx +++ b/apps/launch/components/MyStakingContracts/Create/index.tsx @@ -25,7 +25,7 @@ import { ErrorAlert } from 'common-util/ErrorAlert'; import { CONTRACT_DEFAULT_VALUES, CONTRACT_TEMPLATES, - IMPLEMENTATION_ADDRESSES, + STAKING_TOKEN_ADDRESSES, isSupportedChainId, } from 'common-util/constants/stakingContract'; import { URL } from 'common-util/constants/urls'; @@ -147,7 +147,7 @@ export const CreateStakingContract = () => { try { const metadataHash = await getIpfsHash({ name: contractName, description }); - const implementation = IMPLEMENTATION_ADDRESSES[chain.id]; + const implementation = STAKING_TOKEN_ADDRESSES[chain.id]; const initPayload = getStakingContractInitPayload({ metadataHash, maxNumServices, diff --git a/apps/launch/components/MyStakingContracts/Details/index.tsx b/apps/launch/components/MyStakingContracts/Details/index.tsx index 0a585454..d95fda3d 100644 --- a/apps/launch/components/MyStakingContracts/Details/index.tsx +++ b/apps/launch/components/MyStakingContracts/Details/index.tsx @@ -7,7 +7,7 @@ import styled from 'styled-components'; import { EXPLORER_URLS, GOVERN_URL, UNICODE_SYMBOLS } from 'libs/util-constants/src'; import { truncateAddress } from 'libs/util-functions/src'; -import { ChainId, IMPLEMENTATION_ADDRESSES } from 'common-util/constants/stakingContract'; +import { ChainId, STAKING_TOKEN_ADDRESSES } from 'common-util/constants/stakingContract'; import { URL } from 'common-util/constants/urls'; import { useAppSelector } from 'store/index'; import { MyStakingContract } from 'types/index'; @@ -128,7 +128,7 @@ const Template: FC<{ template: string }> = ({ template }) => { {networkId ? ( /util/$1',