Skip to content

Commit f3d4f71

Browse files
authored
chore: remove staking restrictions (#260)
1 parent a3b9bc2 commit f3d4f71

File tree

5 files changed

+9
-106
lines changed

5 files changed

+9
-106
lines changed

src/constants/staking.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// SPDX-License-Identifier: ice License 1.0
22

3-
export const STAKING_YEARS_MIN = 1;
3+
export const STAKING_YEARS_MIN = 0;
44

55
export const STAKING_YEARS_MAX = 5;
66

77
export const STAKING_YEARS_DEFAULT = 2;
88

9-
export const STAKING_ALLOCATION_MIN = 1;
9+
export const STAKING_ALLOCATION_MIN = 0;
1010

1111
export const STAKING_ALLOCATION_MAX = 100;
1212

@@ -15,6 +15,7 @@ export const STAKING_ALLOCATION_DEFAULT = 75;
1515
export const STAKING_RATE_PERCENTAGES_MAX = 250;
1616

1717
export const PRE_STAKING_BONUS_FOR_YEARS = {
18+
0: 0,
1819
1: 35,
1920
2: 70,
2021
3: 115,

src/screens/Staking/components/Calculator/hooks/useCalculatorSliderValues.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ export const useCalculatorSliderValues = () => {
1717
const preStakingSummary = useSelector(preStakingSummarySelector, () => true);
1818

1919
return useMemo(() => {
20-
const availableStakingYearsMin = Math.max(
21-
STAKING_YEARS_MIN,
22-
preStakingSummary?.years ?? 0,
23-
);
20+
const availableStakingYearsMin = STAKING_YEARS_MIN;
2421
const availableStakingYearsMax = STAKING_YEARS_MAX;
2522
const availableYearsPercentage =
2623
100 -
@@ -30,10 +27,7 @@ export const useCalculatorSliderValues = () => {
3027
const stakingYearsInitialValue =
3128
preStakingSummary?.years ?? STAKING_YEARS_DEFAULT;
3229

33-
const availableAllocationMin = Math.max(
34-
STAKING_ALLOCATION_MIN,
35-
preStakingSummary?.allocation ?? 0,
36-
);
30+
const availableAllocationMin = STAKING_ALLOCATION_MIN;
3731
const availableAllocationMax = STAKING_ALLOCATION_MAX;
3832
const availableAllocationPercentage =
3933
100 -

src/screens/Staking/components/Footer/components/InfoRow/index.tsx

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/screens/Staking/components/Footer/index.tsx

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,29 @@ import {CheckBox} from '@components/CheckBox';
66
import {IceLabel} from '@components/Labels/IceLabel';
77
import {COLORS} from '@constants/colors';
88
import {LINKS} from '@constants/links';
9-
import {STAKING_ALLOCATION_MAX, STAKING_YEARS_MAX} from '@constants/staking';
109
import {SCREEN_SIDE_OFFSET} from '@constants/styles';
1110
import {MainNavigationParams} from '@navigation/Main';
1211
import {useNavigation} from '@react-navigation/native';
1312
import {NativeStackNavigationProp} from '@react-navigation/native-stack';
1413
import {usePreStaking} from '@screens/Staking/hooks/usePreStaking';
15-
import {balanceSummarySelector} from '@store/modules/Tokenomics/selectors';
1614
import {CoinsStackIcon} from '@svg/CoinsStackIcon';
17-
import {YearsOutlineIcon} from '@svg/YearsOutlineIcon';
18-
import {isRTL, replaceString, t, tagRegex} from '@translations/i18n';
15+
import {replaceString, t, tagRegex} from '@translations/i18n';
1916
import {openLinkWithInAppBrowser} from '@utils/device';
20-
import {formatNumberString} from '@utils/numbers';
2117
import {font} from '@utils/styles';
2218
import React, {memo, RefObject, useMemo, useState} from 'react';
2319
import {StyleSheet, Text, View} from 'react-native';
24-
import {useSelector} from 'react-redux';
2520
import {isAndroid, rem} from 'rn-units';
2621

27-
import {InfoRow} from './components/InfoRow';
28-
2922
type Props = {
3023
parameters: RefObject<{years: number; allocation: number} | null>;
3124
};
3225

3326
export const Footer = memo(({parameters}: Props) => {
3427
const navigation =
3528
useNavigation<NativeStackNavigationProp<MainNavigationParams>>();
36-
const {preStakingSummary, preStakingLoading, confirmPreStaking} =
37-
usePreStaking();
29+
const {preStakingLoading, confirmPreStaking} = usePreStaking();
3830
const [termsAccepted, setTermsAccepted] = useState(false);
39-
const maxValuesSet =
40-
preStakingSummary?.years === STAKING_YEARS_MAX &&
41-
preStakingSummary.allocation === STAKING_ALLOCATION_MAX;
42-
const buttonDisabled = !termsAccepted || maxValuesSet;
43-
44-
const balanceSummary = useSelector(balanceSummarySelector);
31+
const buttonDisabled = !termsAccepted;
4532

4633
const onStakePress = () => {
4734
navigation.navigate({
@@ -90,29 +77,6 @@ export const Footer = memo(({parameters}: Props) => {
9077
));
9178
}, []);
9279

93-
if (maxValuesSet) {
94-
return (
95-
<>
96-
<InfoRow
97-
key={'staking.period'}
98-
style={[styles.infoRowContainer, styles.infoRowContainerTop]}
99-
Icon={YearsOutlineIcon}
100-
label={t('staking.period_label')}
101-
value={preStakingSummary?.years ?? '0'}
102-
unit={t('global.years').toLowerCase()}
103-
/>
104-
<InfoRow
105-
key={'staking.balance'}
106-
style={styles.infoRowContainer}
107-
Icon={CoinsStackIcon}
108-
label={t('staking.balance_label')}
109-
value={formatNumberString(balanceSummary?.preStaking ?? '0')}
110-
unit={<IceLabel reversed={isRTL} color={COLORS.primaryLight} />}
111-
/>
112-
</>
113-
);
114-
}
115-
11680
return (
11781
<View style={styles.container}>
11882
<View style={styles.checkboxRow}>

src/store/modules/Tokenomics/sagas/startPreStaking.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function* startOrUpdatePreStakingSaga({
1919
typeof Api.tokenomics.startOrUpdatePreStaking
2020
> = yield call(Api.tokenomics.startOrUpdatePreStaking, {
2121
userId,
22-
years,
22+
years: allocation !== 0 ? years : 0,
2323
allocation,
2424
});
2525
yield put(

0 commit comments

Comments
 (0)