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

feat: sdai wrapping #1869

Merged
merged 57 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
46e5eb6
feat: basic repay
JoaquinBattilana Aug 8, 2023
5a302ec
Merge branch 'main' into feat/repay-bundle
JoaquinBattilana Aug 22, 2023
448260c
feat: repay bundle
JoaquinBattilana Aug 24, 2023
8d4c5d8
Merge branch 'main' into feat/repay-bundle
grothem Sep 6, 2023
2aafd9f
fix: temp package
grothem Sep 6, 2023
94b1ebd
feat: approved amount fetching (#1777)
grothem Sep 7, 2023
97c2445
fix: query key name
grothem Sep 7, 2023
13d516c
fix: disable approval until first load
grothem Sep 8, 2023
a284a0e
fix: don't subscribe to entire store
grothem Sep 8, 2023
9b016a3
fix: bundle size
grothem Sep 8, 2023
3f6bdb0
fix: don't require approval if repaying with aTokens
grothem Sep 11, 2023
423ce22
fix: lazy load services
grothem Oct 4, 2023
a4b4a8d
fix: use latest temp utils
grothem Oct 5, 2023
83fe81c
chore: bump aave utilities
JoaquinBattilana Oct 10, 2023
48929a2
chore: merged with remote
JoaquinBattilana Oct 11, 2023
abd7af7
chore: merged with main
JoaquinBattilana Oct 11, 2023
0ec4bdf
chore: upgraded package utilities
JoaquinBattilana Oct 11, 2023
6e588fb
feat: handle -1 in approve methods
JoaquinBattilana Oct 13, 2023
664e37a
chore: merged with main
JoaquinBattilana Oct 17, 2023
bb4ff51
feat: fixed approval error
JoaquinBattilana Oct 17, 2023
30c8225
feat: added -1 to options
JoaquinBattilana Oct 17, 2023
650eda9
feat: added max uint to approve
JoaquinBattilana Oct 17, 2023
ba54f02
feat: fixed approve
JoaquinBattilana Oct 17, 2023
951f83c
feat: updated utilitiers version
JoaquinBattilana Oct 17, 2023
3f27df4
fix: symbol in success modal
grothem Oct 5, 2023
999c851
feat: use optimized path
grothem Oct 25, 2023
1c468e6
Merge branch 'main' into feat/repay-bundle
grothem Oct 25, 2023
9447207
fix: remove abpt from staking test coverage
MareskoY Oct 25, 2023
09f485c
fix: import
MareskoY Oct 25, 2023
e42c342
Merge branch 'main' into feat/repay-bundle
MareskoY Oct 25, 2023
e0ee8c9
feat: wip
grothem Sep 5, 2023
b6f8fa2
feat: wip
grothem Sep 6, 2023
8d47eb8
feat: wip
grothem Oct 26, 2023
d20282e
fix: bad merge
grothem Oct 26, 2023
6e57858
feat: token wrapping wip
grothem Oct 26, 2023
882e7c4
feat: wrapped tokens refactoring
grothem Nov 1, 2023
872550e
feat: misc fixes
grothem Nov 1, 2023
ba05a55
feat: wrapped token mobile views
grothem Nov 1, 2023
7626a3b
feat: wrapped config
grothem Nov 2, 2023
e0f1a14
WIP fetcing reserve info cross market
grothem Nov 3, 2023
3dfeb9f
feat: cleaning up token wrapping
grothem Nov 21, 2023
d230bc0
fix: disable permit
grothem Nov 22, 2023
6ffafe5
fix: cleanup
grothem Nov 22, 2023
9c07996
Merge branch 'main' into feat/token-wrapping
grothem Nov 27, 2023
47c5d03
chore: utils
grothem Feb 13, 2024
d8dad7e
chore: config
grothem Feb 13, 2024
5fcef34
Merge branch 'main' into feat/token-wrapping
grothem Feb 13, 2024
605f17e
chore: cleanup
grothem Feb 13, 2024
1014271
Merge branch 'main' into feat/token-wrapping
grothem Feb 14, 2024
c4f6309
chore: refactore
grothem Feb 14, 2024
e7c19af
chore: cleanup dead code
grothem Feb 14, 2024
69a222b
chore: cleanup
grothem Feb 14, 2024
ae4b4f6
chore: fixes
grothem Feb 14, 2024
fc52ec3
fix: exchange rate query
grothem Feb 15, 2024
90559ad
fix: success modal
grothem Feb 15, 2024
c5bd0c9
chore: utils
grothem Feb 22, 2024
4598b7d
Merge branch 'main' into feat/token-wrapping
grothem Feb 23, 2024
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"test:coverage": "jest --coverage"
},
"dependencies": {
"@aave/contract-helpers": "1.24.0",
"@aave/math-utils": "1.24.0",
"@aave/contract-helpers": "1.25.0",
"@aave/math-utils": "1.25.0",
"@bgd-labs/aave-address-book": "^2.19.0",
"@emotion/cache": "11.10.3",
"@emotion/react": "11.10.4",
Expand Down
65 changes: 65 additions & 0 deletions src/components/infoTooltips/WrappedTokenToolTipContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { ArrowNarrowRightIcon } from '@heroicons/react/solid';
import { Trans } from '@lingui/macro';
import { Box, Skeleton, Stack, SvgIcon, Typography } from '@mui/material';
import { useTokenOutForTokenIn } from 'src/hooks/token-wrapper/useTokenWrapper';

import { FormattedNumber } from '../primitives/FormattedNumber';

export const WrappedTokenTooltipContent = ({
decimals,
tokenWrapperAddress,
tokenInSymbol,
tokenOutSymbol,
}: {
decimals: number;
tokenWrapperAddress: string;
tokenInSymbol: string;
tokenOutSymbol: string;
}) => {
const { isLoading: loadingExchangeRate, data: exchangeRate } = useTokenOutForTokenIn(
'1',
decimals,
tokenWrapperAddress
);

return (
<Stack direction="column" gap={3}>
<Typography variant="tooltip">
<Trans>
DAI balance will be converted via DSR contracts and then supplied as sDAI. Switching
incurs no additional costs and no slippage.
</Trans>
</Typography>
<Stack direction="row" alignItems="center" justifyContent="space-between">
<Box>
<Typography variant="secondary12">
<Trans>Exchange rate</Trans>
</Typography>
</Box>
{loadingExchangeRate ? (
<Skeleton variant="rectangular" width={120} height={14} />
) : (
<Stack direction="row" alignItems="center" gap={1}>
<FormattedNumber
value="1"
visibleDecimals={0}
variant="secondary12"
color="text.primary"
/>
<Typography variant="tooltip">{tokenInSymbol}</Typography>
<SvgIcon color="primary" sx={{ fontSize: '12px' }}>
<ArrowNarrowRightIcon />
</SvgIcon>
<FormattedNumber
value={exchangeRate || '0'}
visibleDecimals={4}
variant="secondary12"
color="text.primary"
/>
<Typography variant="tooltip">{tokenOutSymbol}</Typography>
</Stack>
)}
</Stack>
</Stack>
);
};
21 changes: 17 additions & 4 deletions src/components/transactions/AssetInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export interface AssetInputProps<T extends Asset = Asset> {
selectOptionHeader?: ReactNode;
selectOption?: (asset: T) => ReactNode;
sx?: BoxProps;
exchangeRateComponent?: ReactNode;
}

export const AssetInput = <T extends Asset = Asset>({
Expand All @@ -106,6 +107,7 @@ export const AssetInput = <T extends Asset = Asset>({
selectOptionHeader,
selectOption,
sx = {},
exchangeRateComponent,
}: AssetInputProps<T>) => {
const theme = useTheme();
const trackEvent = useRootStore((store) => store.trackEvent);
Expand All @@ -131,13 +133,12 @@ export const AssetInput = <T extends Asset = Asset>({

<Box
sx={(theme) => ({
p: '8px 12px',
border: `1px solid ${theme.palette.divider}`,
borderRadius: '6px',
mb: 1,
overflow: 'hidden',
})}
>
<Box sx={{ display: 'flex', alignItems: 'center', mb: 0.5 }}>
<Box sx={{ display: 'flex', alignItems: 'center', mb: 0.5, px: 3, py: 2 }}>
{loading ? (
<Box sx={{ flex: 1 }}>
<CircularProgress color="inherit" size="16px" />
Expand Down Expand Up @@ -284,7 +285,7 @@ export const AssetInput = <T extends Asset = Asset>({
)}
</Box>

<Box sx={{ display: 'flex', alignItems: 'center', height: '16px' }}>
<Box sx={{ display: 'flex', alignItems: 'center', height: '16px', px: 3, py: 2, mb: 1 }}>
{loading ? (
<Box sx={{ flex: 1 }} />
) : (
Expand Down Expand Up @@ -330,6 +331,18 @@ export const AssetInput = <T extends Asset = Asset>({
</>
)}
</Box>
{exchangeRateComponent && (
<Box
sx={{
background: theme.palette.background.surface,
borderTop: `1px solid ${theme.palette.divider}`,
px: 3,
py: 2,
}}
>
{exchangeRateComponent}
</Box>
)}
</Box>
</Box>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/transactions/Supply/SupplyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ModalContextType, ModalType, useModalContext } from 'src/hooks/useModal

import { BasicModal } from '../../primitives/BasicModal';
import { ModalWrapper } from '../FlowCommons/ModalWrapper';
import { SupplyModalContent } from './SupplyModalContent';
import { SupplyModalContentWrapper } from './SupplyModalContent';

export const SupplyModal = () => {
const { type, close, args } = useModalContext() as ModalContextType<{
Expand All @@ -20,7 +20,7 @@ export const SupplyModal = () => {
underlyingAsset={args.underlyingAsset}
requiredPermission={PERMISSION.DEPOSITOR}
>
{(params) => <SupplyModalContent {...params} />}
{(params) => <SupplyModalContentWrapper {...params} />}
</ModalWrapper>
</BasicModal>
);
Expand Down
Loading
Loading