Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOV-3602: custom _maxCheckpoints #735

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { t } from 'i18next';

import { SupportedTokens, getProtocolContract } from '@sovryn/contracts';
import { getProvider } from '@sovryn/ethers-provider';
import { Button, ButtonType, ButtonStyle } from '@sovryn/ui';
import { Button, ButtonType, ButtonStyle, Input, FormGroup } from '@sovryn/ui';

import { defaultChainId } from '../../../../../../../config/chains';

Expand All @@ -28,10 +28,10 @@ type WithdrawFeeProps = {
refetch: () => void;
};

const MAX_CHECKPOINTS = 150;
const MAX_NEXT_POSITIVE_CHECKPOINT = 75;

export const WithdrawAllFees: FC<WithdrawFeeProps> = ({ fees, refetch }) => {
const [maxCheckpoints, setMaxCheckpoints] = useState(1);
const { account } = useAccount();
const [loading, setLoading] = useState(false);
const { setTransactions, setIsOpen, setTitle } = useTransactionContext();
Expand Down Expand Up @@ -115,7 +115,7 @@ export const WithdrawAllFees: FC<WithdrawFeeProps> = ({ fees, refetch }) => {
nonRbtcRegular,
rbtcRegular,
tokensWithSkippedCheckpoints,
MAX_CHECKPOINTS,
maxCheckpoints,
account,
],
gasLimit: GAS_LIMIT.REWARDS_CLAIM,
Expand All @@ -131,23 +131,35 @@ export const WithdrawAllFees: FC<WithdrawFeeProps> = ({ fees, refetch }) => {
account,
feeSharing,
fees,
maxCheckpoints,
onComplete,
setIsOpen,
setTitle,
setTransactions,
]);

return (
<Button
type={ButtonType.button}
style={ButtonStyle.secondary}
text={t(translations.rewardPage.stabilityPool.actions.withdrawAll)}
onClick={onSubmit}
disabled={isClaimDisabled || loading}
loading={loading}
className="w-full lg:w-auto whitespace-nowrap"
dataAttribute="rewards-withdraw"
/>
<div>
<Button
type={ButtonType.button}
style={ButtonStyle.secondary}
text={t(translations.rewardPage.stabilityPool.actions.withdrawAll)}
onClick={onSubmit}
disabled={isClaimDisabled || loading}
loading={loading}
className="w-full lg:w-auto whitespace-nowrap"
dataAttribute="rewards-withdraw"
/>
<FormGroup className="my-2" label="Max checkpoints">
<Input
type="number"
min="0"
className="w-20"
onChange={e => setMaxCheckpoints(parseInt(e.target.value || '0'))}
value={maxCheckpoints.toString()}
/>
</FormGroup>
</div>
);
};

Expand Down
Loading