Skip to content

Commit

Permalink
SOV-2530/SOV-2529: Vesting & Reward Claiming updates (#2550)
Browse files Browse the repository at this point in the history
* feat:separate team vesting claim tx gas limit for SOV-2529

* feat: increase maxCheckpoint in ZUSD/SOV fee claiming for SOV-2530
  • Loading branch information
soulBit authored Jun 15, 2023
1 parent c8db418 commit 50faedc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
19 changes: 15 additions & 4 deletions src/app/components/UserAssets/Vesting/VestingWithdrawForm.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -42,15 +42,26 @@ export const VestingWithdrawForm: React.FC<VestingWithdrawFormProps> = ({
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 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<IFeesEarnedClaimRowProps> = ({
Expand All @@ -45,13 +47,19 @@ export const FeesEarnedClaimRow: React.FC<IFeesEarnedClaimRowProps> = ({
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',
Expand Down
1 change: 1 addition & 0 deletions src/store/global/transactions-store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 1 addition & 2 deletions src/utils/classifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 50faedc

Please sign in to comment.