From 575f1466ac36cf743bf8f5de70b2d4acefea185b Mon Sep 17 00:00:00 2001 From: Atatakai Date: Tue, 22 Oct 2024 10:41:56 +0400 Subject: [PATCH] (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',