Skip to content

Commit 6bdb10b

Browse files
authored
SOV-4267: zero redemptions (#958)
* feat: zero redemption dialog * feat: redemption button * fix: enforce zero route to 200 minimum * chore: disabled redemption route * chore: add about wiki link
1 parent 8d41bc7 commit 6bdb10b

10 files changed

Lines changed: 421 additions & 3 deletions

File tree

.changeset/healthy-pants-judge.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sovryn/sdk': patch
3+
---
4+
5+
fix: add minimum amount to zero smart swap route

apps/frontend/src/app/2_molecules/LOCStatus/LOCStatus.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import CountUp from 'react-countup';
77
import { Button, ButtonSize, ButtonStyle } from '@sovryn/ui';
88
import { Decimal } from '@sovryn/utils';
99

10+
import { RedemptionDialogButton } from '../../5_pages/ZeroPage/components/RedemptionDialog/RedemptionDialogButton';
1011
import {
1112
BITCOIN,
1213
BTC_RENDER_PRECISION,
@@ -128,6 +129,8 @@ export const LOCStatus: FC<LOCStatusProps> = ({
128129
/>
129130
</>
130131
)}
132+
133+
<RedemptionDialogButton size={ButtonSize.large} />
131134
</div>
132135
</div>
133136
);

apps/frontend/src/app/5_pages/ConvertPage/ConvertPage.constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const SWAP_ROUTES = [
1616
smartRoutes.myntFixedRateRoute,
1717
smartRoutes.mocIntegrationSwapRoute,
1818
smartRoutes.ambientRoute,
19-
smartRoutes.zeroRedemptionSwapRoute,
19+
// smartRoutes.zeroRedemptionSwapRoute,
2020
];
2121

2222
export const SMART_ROUTER_RSK = new SmartRouter(

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ import { useMaintenance } from '../../../hooks/useMaintenance';
4646
import { translations } from '../../../locales/i18n';
4747
import { decimalic } from '../../../utils/math';
4848
import { OpenLocButton } from './components/OpenLocButton/OpenLocButton';
49+
import { RedemptionDialog } from './components/RedemptionDialog/RedemptionDialog';
50+
import { RedemptionDialogButton } from './components/RedemptionDialog/RedemptionDialogButton';
4951
import { useClaimCollateralSurplus } from './hooks/useClaimCollateralSurplus';
5052
import { useHandleTrove } from './hooks/useHandleTrove';
5153
import { useLiquityBaseParams } from './hooks/useLiquityBaseParams';
@@ -148,6 +150,8 @@ const ZeroPage: FC<ZeroPageProps> = ({ deferred: [price] }) => {
148150
</Helmet>
149151
<div className="px-0 container lg:mx-8 mb-7">
150152
<NetworkBanner requiredChainId={RSK_CHAIN_ID}>
153+
<RedemptionDialog />
154+
151155
{!account && <div className="mt-6 lg:mt-12"></div>}
152156
{account && !showWelcomeBanner && !isLoading && (
153157
<LOCStatus
@@ -163,8 +167,9 @@ const ZeroPage: FC<ZeroPageProps> = ({ deferred: [price] }) => {
163167
/>
164168
)}
165169
{account && showWelcomeBanner && !isLoading && !openLocLocked && (
166-
<div className="mt-6 lg:mt-12">
167-
<OpenLocButton openLOC={toggle} className="mb-10 md:mb-4" />
170+
<div className="mt-6 lg:mt-12 flex justify-end gap-x-4 mb-10 md:mb-4">
171+
<OpenLocButton openLOC={toggle} />
172+
<RedemptionDialogButton />
168173
</div>
169174
)}
170175

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react';
2+
3+
import { t } from 'i18next';
4+
5+
import { Dialog, DialogBody, DialogHeader, DialogSize } from '@sovryn/ui';
6+
7+
import { translations } from '../../../../../locales/i18n';
8+
import { RedemptionForm } from './RedemptionForm';
9+
import { useRedemptionDialog } from './useRedemptionDialog';
10+
11+
export const RedemptionDialog = () => {
12+
const { isOpen, setOpen } = useRedemptionDialog();
13+
14+
return (
15+
<Dialog width={DialogSize.sm} isOpen={isOpen} disableFocusTrap>
16+
<DialogHeader
17+
title={t(translations.zeroPage.redeem.title)}
18+
onClose={() => setOpen(false)}
19+
/>
20+
<DialogBody>{isOpen && <RedemptionForm />}</DialogBody>
21+
</Dialog>
22+
);
23+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React, { FC } from 'react';
2+
3+
import classNames from 'classnames';
4+
import { t } from 'i18next';
5+
6+
import { Button, ButtonSize, ButtonStyle } from '@sovryn/ui';
7+
8+
import { translations } from '../../../../../locales/i18n';
9+
import { useRedemptionDialog } from './useRedemptionDialog';
10+
11+
type RedemptionDialogButtonProps = {
12+
size?: ButtonSize;
13+
};
14+
15+
export const RedemptionDialogButton: FC<RedemptionDialogButtonProps> = ({
16+
size,
17+
}) => {
18+
const { setOpen } = useRedemptionDialog();
19+
return (
20+
<div className={classNames('flex justify-center md:justify-end mb-9')}>
21+
<Button
22+
className="flex-1 md:flex-initial max-w-[20.5rem] md:max-w-none"
23+
onClick={() => setOpen(true)}
24+
text={t(translations.zeroPage.redeem.cta)}
25+
dataAttribute="zero-loc-open"
26+
style={ButtonStyle.secondary}
27+
size={size}
28+
/>
29+
</div>
30+
);
31+
};

0 commit comments

Comments
 (0)