From ee45b0f7cef933d0c94cf68bbae019910109f127 Mon Sep 17 00:00:00 2001 From: truemiller Date: Thu, 29 Aug 2024 10:54:30 +0100 Subject: [PATCH 1/5] refactor: remove iteration as it's too volatile, error prone --- frontend/components/ManageStakingPage/index.tsx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/frontend/components/ManageStakingPage/index.tsx b/frontend/components/ManageStakingPage/index.tsx index 310d19eca..804abfaa5 100644 --- a/frontend/components/ManageStakingPage/index.tsx +++ b/frontend/components/ManageStakingPage/index.tsx @@ -1,8 +1,6 @@ import { CloseOutlined } from '@ant-design/icons'; import { Button, Card } from 'antd'; -import { Chain } from '@/client'; -import { SERVICE_STAKING_TOKEN_MECH_USAGE_CONTRACT_ADDRESSES } from '@/constants/contractAddresses'; import { Pages } from '@/enums/PageState'; import { StakingProgram } from '@/enums/StakingProgram'; import { usePageState } from '@/hooks/usePageState'; @@ -26,15 +24,10 @@ export const ManageStakingPage = () => { } > - {Object.entries( - SERVICE_STAKING_TOKEN_MECH_USAGE_CONTRACT_ADDRESSES[Chain.GNOSIS], - ).map(([stakingProgram, contractAddress]) => ( - - ))} + {/* Pearl Beta */} + + {/* Pearl alpha */} + ); }; From 65f98d94e889c9424e8b9078dfe3f18c2ac21abe Mon Sep 17 00:00:00 2001 From: truemiller Date: Thu, 29 Aug 2024 10:55:06 +0100 Subject: [PATCH 2/5] refactor: only show migrate button on beta, or future contracts --- .../StakingContractSection/index.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/components/ManageStakingPage/StakingContractSection/index.tsx b/frontend/components/ManageStakingPage/StakingContractSection/index.tsx index 856a5648f..1971f8cc8 100644 --- a/frontend/components/ManageStakingPage/StakingContractSection/index.tsx +++ b/frontend/components/ManageStakingPage/StakingContractSection/index.tsx @@ -1,9 +1,10 @@ import { Button, Flex, Popover, theme, Typography } from 'antd'; import { useMemo, useState } from 'react'; -import { DeploymentStatus } from '@/client'; +import { Chain, DeploymentStatus } from '@/client'; import { OpenAddFundsSection } from '@/components/MainPage/sections/AddFundsSection'; import { CardSection } from '@/components/styled/CardSection'; +import { SERVICE_STAKING_TOKEN_MECH_USAGE_CONTRACT_ADDRESSES } from '@/constants/contractAddresses'; import { STAKING_PROGRAM_META } from '@/constants/stakingProgramMeta'; import { UNICODE_SYMBOLS } from '@/constants/symbols'; import { Pages } from '@/enums/PageState'; @@ -17,7 +18,6 @@ import { useServiceTemplates } from '@/hooks/useServiceTemplates'; import { useStakingContractInfo } from '@/hooks/useStakingContractInfo'; import { useStakingProgram } from '@/hooks/useStakingProgram'; import { ServicesService } from '@/service/Services'; -import { Address } from '@/types/Address'; import { getMinimumStakedAmountRequired } from '@/utils/service'; import { @@ -54,10 +54,8 @@ const { useToken } = theme; export const StakingContractSection = ({ stakingProgram, - contractAddress, }: { stakingProgram: StakingProgram; - contractAddress: Address; }) => { const { goto } = usePageState(); const { @@ -76,6 +74,11 @@ export const StakingContractSection = ({ useStakingContractInfo(); const [isFundingSectionOpen, setIsFundingSectionOpen] = useState(false); + const stakingContractAddress = + SERVICE_STAKING_TOKEN_MECH_USAGE_CONTRACT_ADDRESSES[Chain.GNOSIS][ + stakingProgram + ]; + const stakingContractInfoForStakingProgram = stakingContractInfoRecord?.[stakingProgram]; @@ -258,7 +261,7 @@ export const StakingContractSection = ({ // here instead of isSelected we should check that the contract is not the old staking contract // but the one from staking factory (if we want to open govern) @@ -286,7 +289,7 @@ export const StakingContractSection = ({ {cantMigrateAlert} {/* Switch to program button */} - { + {stakingProgram !== StakingProgram.Alpha && (