Skip to content

Commit 0cd3d47

Browse files
authored
Fix/addresses (#2607)
1 parent bf2ebae commit 0cd3d47

8 files changed

Lines changed: 49 additions & 15 deletions

File tree

src/components/AddressBlocked.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@ export const AddressBlocked = ({ children }: { children: ReactNode }) => {
1111
const { currentAccount, readOnlyMode } = useWeb3Context();
1212
const { disconnect } = useDisconnect();
1313
const screenAddress = readOnlyMode || ENABLE_TESTNET ? '' : currentAccount;
14-
const { isAllowed } = useAddressAllowed(screenAddress);
14+
const { isAllowed, message } = useAddressAllowed(screenAddress);
1515

1616
if (!isAllowed) {
1717
return (
1818
<MainLayout>
19-
<AddressBlockedModal address={currentAccount} onDisconnectWallet={() => disconnect()} />;
19+
<AddressBlockedModal
20+
address={currentAccount}
21+
onDisconnectWallet={() => disconnect()}
22+
message={message}
23+
/>
24+
;
2025
</MainLayout>
2126
);
2227
}

src/components/AddressBlockedModal.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import { ExclamationCircleIcon, LogoutIcon } from '@heroicons/react/outline';
22
import { Trans } from '@lingui/macro';
3-
import { Box, Button, SvgIcon, Typography } from '@mui/material';
3+
import { Box, Button, Link, SvgIcon, Typography } from '@mui/material';
44

55
import { BasicModal } from './primitives/BasicModal';
66

77
export interface AddressBlockedProps {
88
address: string;
99
onDisconnectWallet: () => void;
10+
message?: string;
1011
}
1112

12-
export const AddressBlockedModal = ({ address, onDisconnectWallet }: AddressBlockedProps) => {
13+
export const AddressBlockedModal = ({
14+
address,
15+
onDisconnectWallet,
16+
message,
17+
}: AddressBlockedProps) => {
1318
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
1419
const setOpen = (_value: boolean) => {}; // ignore, we want the modal to not be dismissable
1520

@@ -27,13 +32,25 @@ export const AddressBlockedModal = ({ address, onDisconnectWallet }: AddressBloc
2732
<ExclamationCircleIcon />
2833
</SvgIcon>
2934
<Typography variant="h2">
30-
<Trans>Blocked Address</Trans>
35+
{message ? <Trans>Connection Failed</Trans> : <Trans>Blocked Address</Trans>}
3136
</Typography>
3237
<Typography variant="helperText" sx={{ my: 4 }}>
3338
{address}
3439
</Typography>
3540
<Typography variant="description" sx={{ textAlign: 'center', mb: 4 }}>
36-
<Trans>This address is blocked on app.aave.com.</Trans>
41+
{message ? (
42+
message
43+
) : (
44+
<>
45+
<Trans>
46+
This address is blocked on app.aave.com because it is associated with one or more
47+
</Trans>{' '}
48+
<Link href="https://docs.aave.com/faq/#address-screening" underline="always">
49+
<Trans>blocked activities</Trans>
50+
</Link>
51+
{'.'}
52+
</>
53+
)}
3754
</Typography>
3855
<Button variant="contained" onClick={onDisconnectWallet}>
3956
<SvgIcon fontSize="small" sx={{ mx: 1 }}>

src/hooks/useAddressAllowed.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import { usePolling } from './usePolling';
44

55
export interface AddressAllowedResult {
66
isAllowed: boolean;
7+
message?: string;
78
}
89

910
const TWO_MINUTES = 2 * 60 * 1000;
1011

1112
export const useAddressAllowed = (address: string): AddressAllowedResult => {
1213
const [isAllowed, setIsAllowed] = useState(true);
14+
const [message, setMessage] = useState<string | undefined>(undefined);
1315

1416
const screeningUrl = `${process.env.NEXT_PUBLIC_API_BASEURL}/addresses/status`;
1517
const queryParams = `?address=${address}`;
@@ -19,8 +21,9 @@ export const useAddressAllowed = (address: string): AddressAllowedResult => {
1921
try {
2022
const response = await fetch(screeningUrl + queryParams);
2123
if (response.ok) {
22-
const data: { addressAllowed: boolean } = await response.json();
24+
const data: { addressAllowed: boolean; message?: string } = await response.json();
2325
setIsAllowed(data.addressAllowed);
26+
setMessage(data.message);
2427
}
2528
} catch (e) {}
2629
} else {
@@ -32,5 +35,6 @@ export const useAddressAllowed = (address: string): AddressAllowedResult => {
3235

3336
return {
3437
isAllowed,
38+
message,
3539
};
3640
};

src/locales/el/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/en/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/en/messages.po

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,10 @@ msgstr "Borrow balance after switch"
18561856
msgid "Asset has been successfully sent to CCIP contract. You can check the status of the transactions below"
18571857
msgstr "Asset has been successfully sent to CCIP contract. You can check the status of the transactions below"
18581858

1859+
#: src/components/AddressBlockedModal.tsx
1860+
msgid "blocked activities"
1861+
msgstr "blocked activities"
1862+
18591863
#: pages/500.page.tsx
18601864
msgid "Reload the page"
18611865
msgstr "Reload the page"
@@ -2401,10 +2405,6 @@ msgstr "Action requires an active reserve"
24012405
msgid "Amount to unstake"
24022406
msgstr "Amount to unstake"
24032407

2404-
#: src/components/AddressBlockedModal.tsx
2405-
msgid "This address is blocked on app.aave.com."
2406-
msgstr "This address is blocked on app.aave.com."
2407-
24082408
#: src/components/infoTooltips/SlippageTooltip.tsx
24092409
msgid "Slippage is the difference between the quoted and received amounts from changing market conditions between the moment the transaction is submitted and its verification."
24102410
msgstr "Slippage is the difference between the quoted and received amounts from changing market conditions between the moment the transaction is submitted and its verification."
@@ -2544,6 +2544,10 @@ msgstr "Please connect your wallet to get free testnet assets."
25442544
msgid "Approve Confirmed"
25452545
msgstr "Approve Confirmed"
25462546

2547+
#: src/components/AddressBlockedModal.tsx
2548+
msgid "This address is blocked on app.aave.com because it is associated with one or more"
2549+
msgstr "This address is blocked on app.aave.com because it is associated with one or more"
2550+
25472551
#: src/ui-config/errorMapping.tsx
25482552
msgid "Zero address not valid"
25492553
msgstr "Zero address not valid"
@@ -3172,6 +3176,10 @@ msgstr "The caller of this function must be a pool"
31723176
msgid "Migrate to V3"
31733177
msgstr "Migrate to V3"
31743178

3179+
#: src/components/AddressBlockedModal.tsx
3180+
msgid "Connection Failed"
3181+
msgstr "Connection Failed"
3182+
31753183
#: src/modules/reserve-overview/ReserveConfiguration.tsx
31763184
msgid "Interest rate strategy"
31773185
msgstr "Interest rate strategy"

src/locales/es/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/locales/fr/messages.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)