From 50faedc4f5365be4371a29b370ef791b90984d3b Mon Sep 17 00:00:00 2001 From: soulBit Date: Thu, 15 Jun 2023 10:21:17 +0100 Subject: [PATCH] SOV-2530/SOV-2529: Vesting & Reward Claiming updates (#2550) * feat:separate team vesting claim tx gas limit for SOV-2529 * feat: increase maxCheckpoint in ZUSD/SOV fee claiming for SOV-2530 --- .../Vesting/VestingWithdrawForm.tsx | 19 ++++++++++++---- .../ClaimForms/FeesEarnedClaimRow/index.tsx | 22 +++++++++++++------ src/store/global/transactions-store/types.ts | 1 + src/utils/classifiers.ts | 3 +-- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/app/components/UserAssets/Vesting/VestingWithdrawForm.tsx b/src/app/components/UserAssets/Vesting/VestingWithdrawForm.tsx index 44fdc6e27c..951de61e51 100644 --- a/src/app/components/UserAssets/Vesting/VestingWithdrawForm.tsx +++ b/src/app/components/UserAssets/Vesting/VestingWithdrawForm.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useState } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useAccount } from 'app/hooks/useAccount'; import { useGetUnlockedVesting } from 'app/hooks/staking/useGetUnlockedVesting'; @@ -42,15 +42,26 @@ export const VestingWithdrawForm: React.FC = ({ VestingAbi as AbiItem[], 'withdrawTokens', ); + const vestingTxType = useMemo( + () => + vesting.type === 'team' + ? TxType.SOV_WITHDRAW_VESTING_TEAM + : TxType.SOV_WITHDRAW_VESTING, + [vesting], + ); + const handleSubmit = useCallback(() => { if (!tx.loading) { send( [address.toLowerCase()], - { from: account, gas: gasLimit[TxType.SOV_WITHDRAW_VESTING] }, - { type: TxType.SOV_WITHDRAW_VESTING }, + { + from: account, + gas: gasLimit[vestingTxType], + }, + { type: vestingTxType }, ); } - }, [account, address, send, tx]); + }, [account, address, send, tx, vestingTxType]); const [scheduleOpen, setScheduleOpen] = useState(false); const openSchedule = useCallback(event => { diff --git a/src/app/pages/RewardPage/components/ClaimForms/FeesEarnedClaimRow/index.tsx b/src/app/pages/RewardPage/components/ClaimForms/FeesEarnedClaimRow/index.tsx index 12b7ec5b9d..c70c333b4c 100644 --- a/src/app/pages/RewardPage/components/ClaimForms/FeesEarnedClaimRow/index.tsx +++ b/src/app/pages/RewardPage/components/ClaimForms/FeesEarnedClaimRow/index.tsx @@ -29,6 +29,8 @@ interface IFeesEarnedClaimRowProps extends IClaimFormProps { } const MAX_PROCESSABLE_CHECKPOINTS_RBTC = 33; +const MAX_PROCESSABLE_CHECKPOINTS_ZUSD = 300; +const MAX_PROCESSABLE_CHECKPOINTS_SOV = 200; const MAX_PROCESSABLE_CHECKPOINTS_TOKENS = 150; export const FeesEarnedClaimRow: React.FC = ({ @@ -45,13 +47,19 @@ export const FeesEarnedClaimRow: React.FC = ({ const claimFeesEarnedLocked = checkMaintenance(States.CLAIM_FEES_EARNED); const isRBTC = useMemo(() => asset === Asset.RBTC, [asset]); - const maxProcessableCheckpoints = useMemo( - () => - isRBTC - ? MAX_PROCESSABLE_CHECKPOINTS_RBTC - : MAX_PROCESSABLE_CHECKPOINTS_TOKENS, - [isRBTC], - ); + + const maxProcessableCheckpoints = useMemo(() => { + switch (asset) { + case Asset.RBTC: + return MAX_PROCESSABLE_CHECKPOINTS_RBTC; + case Asset.ZUSD: + return MAX_PROCESSABLE_CHECKPOINTS_ZUSD; + case Asset.SOV: + return MAX_PROCESSABLE_CHECKPOINTS_SOV; + default: + return MAX_PROCESSABLE_CHECKPOINTS_TOKENS; + } + }, [asset]); const { value: maxCheckpoints } = useCacheCallWithValue( 'feeSharingProxy', diff --git a/src/store/global/transactions-store/types.ts b/src/store/global/transactions-store/types.ts index 00a089f293..ab1e1da5d1 100644 --- a/src/store/global/transactions-store/types.ts +++ b/src/store/global/transactions-store/types.ts @@ -41,6 +41,7 @@ export enum TxType { SOV_CONVERT = 'sov_convert', SOV_ORIGIN_CLAIM = 'sov_origin_claim', SOV_WITHDRAW_VESTING = 'sov_withdraw_vesting', + SOV_WITHDRAW_VESTING_TEAM = 'sov_withdraw_vesting_team', ESCROW_SOV_DEPOSIT = 'escrow_sov_deposit', LM_DEPOSIT = 'lm_deposit', LOCKED_SOV_CLAIM = 'locked_sov_claim', diff --git a/src/utils/classifiers.ts b/src/utils/classifiers.ts index 9630872d26..114a4c6f8c 100644 --- a/src/utils/classifiers.ts +++ b/src/utils/classifiers.ts @@ -126,11 +126,10 @@ export const gasLimit = { [TxType.STAKING_WITHDRAW]: 1400000, [TxType.STAKING_REWARDS_CLAIM]: 6700000, [TxType.STAKING_REWARDS_CLAIM_RBTC]: 6700000, - [TxType.DEPOSIT_COLLATERAL]: 250000, [TxType.STAKING_LIQUID_SOV_CLAIM]: 3500000, - [TxType.DEPOSIT_COLLATERAL]: 250000, [TxType.CLAIM_VESTED_SOV_REWARDS]: 6000000, [TxType.SOV_WITHDRAW_VESTING]: 4000000, + [TxType.SOV_WITHDRAW_VESTING_TEAM]: 6700000, [TxType.SIMULATOR_REQUEST]: 6800000, [TxType.DEPOSIT_COLLATERAL]: 850000, [TxType.WITHDRAW_COLLATERAL]: 1400000,