Skip to content

Commit dd65c2b

Browse files
committed
chore: staking for rsk only
1 parent 3810cd0 commit dd65c2b

File tree

3 files changed

+61
-19
lines changed

3 files changed

+61
-19
lines changed

apps/frontend/src/app/5_pages/StakePage/StakePage.tsx

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ import React, { FC, useMemo } from 'react';
22

33
import { t } from 'i18next';
44
import { Helmet } from 'react-helmet-async';
5+
import { Trans } from 'react-i18next';
56

7+
import { Icon, IconNames } from '@sovryn/ui';
8+
9+
import { RSK_CHAIN_ID } from '../../../config/chains';
10+
11+
import { useRequiredChain } from '../../../hooks/chain/useRequiredChain';
612
import { useAccount } from '../../../hooks/useAccount';
713
import { useCurrentChain } from '../../../hooks/useChainStore';
814
import { translations } from '../../../locales/i18n';
9-
import { isRskChain } from '../../../utils/chain';
15+
import { getChainLabel, isRskChain } from '../../../utils/chain';
1016
import { AddStakeRenderer } from './components/AddStakeRenderer/AddStakeRenderer';
1117
import { PersonalStakingStatistics } from './components/PersonalStakingStatistics/PersonalStakingStatistics';
1218
import { useGetPersonalStakingStatistics } from './components/PersonalStakingStatistics/hooks/useGetPersonalStakingStatistics';
@@ -22,32 +28,69 @@ const StakePage: FC = () => {
2228
const hasStakedValue = useMemo(() => Number(balance) > 0, [balance]);
2329
const hasVotingPower = useMemo(() => votingPower > 0, [votingPower]);
2430

31+
const isRsk = isRskChain(chainId);
32+
33+
const { updateChain } = useRequiredChain(RSK_CHAIN_ID);
34+
2535
return (
2636
<>
2737
<Helmet>
2838
<title>{t(translations.stakePage.meta.title)}</title>
2939
</Helmet>
3040

31-
<div className="px-0 container md:mx-9 mx-0">
32-
<div className="flex md:flex-row flex-col items-center mb-6 gap-4">
33-
<StakingStatistics />
34-
<StakingRewards />
41+
{!isRsk && (
42+
<div>
43+
<div
44+
onClick={updateChain}
45+
className={'mx-auto w-full text-center cursor-pointer mb-4'}
46+
>
47+
<div className="flex flex-col sm:flex-row justify-center items-center bg-gray-60 rounded-lg text-white px-4 py-2">
48+
<div className="flex flex-row items-center w-full text-left sm:text-center">
49+
<div className="grow">
50+
<div className="flex items-center justify-center">
51+
<div>
52+
<Icon icon={IconNames.INFO} size={18} />
53+
</div>
54+
<div className="ml-2 text-center text-sm">
55+
<Trans
56+
i18nKey={t('stakePage.networkSwitch.content')}
57+
values={{ network: getChainLabel(RSK_CHAIN_ID) }}
58+
components={[
59+
<span className="underline text-primary-75">
60+
switching to
61+
</span>,
62+
]}
63+
/>
64+
</div>
65+
</div>
66+
</div>
67+
</div>
68+
</div>
69+
</div>
3570
</div>
71+
)}
3672

37-
{account && (hasStakedValue || hasVotingPower) && (
38-
<PersonalStakingStatistics />
39-
)}
73+
{isRsk && (
74+
<div className="px-0 container md:mx-9 mx-0">
75+
<div className="flex md:flex-row flex-col items-center mb-6 gap-4">
76+
<StakingStatistics />
77+
<StakingRewards />
78+
</div>
4079

41-
<div className="w-full md:bg-gray-90 md:py-7 md:px-6 rounded mb-6">
42-
<StakesFrame />
80+
{account && (hasStakedValue || hasVotingPower) && (
81+
<PersonalStakingStatistics />
82+
)}
4383

44-
{isRskChain(chainId) && <VestingStakesFrame />}
45-
</div>
84+
<div className="w-full md:bg-gray-90 md:py-7 md:px-6 rounded mb-6">
85+
<StakesFrame />
86+
<VestingStakesFrame />
87+
</div>
4688

47-
<div className="md:hidden block w-full">
48-
{account && <AddStakeRenderer hasStakedValue={hasStakedValue} />}
89+
<div className="md:hidden block w-full">
90+
{account && <AddStakeRenderer hasStakedValue={hasStakedValue} />}
91+
</div>
4992
</div>
50-
</div>
93+
)}
5194
</>
5295
);
5396
};

apps/frontend/src/locales/en/translations.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,9 @@
697697
"emailNotifications": "Email notifications",
698698
"doNotShowAgain": "Don't show again",
699699
"signUp": "Sign up"
700+
},
701+
"networkSwitch": {
702+
"content": "Staking is available on {{network}}. Continue by <0>switching to</0> {{network}} chain."
700703
}
701704
},
702705
"fixedInterestPage": {

packages/contracts/src/contracts/protocol/bob.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { AsyncContractConfigData } from '../../types';
22

33
export const bob: Record<string, AsyncContractConfigData> = {
4-
staking: {
5-
address: '0xc17C6462cEAFE9A8819258c6bA168BEF5544Fc21',
6-
getAbi: async () => (await import('../../abis/staking.json')).default,
7-
},
84
merkleDistributor: {
95
address: '0x21a373286104acC8Fd8BFdCbe6714FEb4da30AeF',
106
getAbi: async () =>

0 commit comments

Comments
 (0)