Skip to content

Commit

Permalink
feat: update compliance strings and update abacus (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosepuppy authored Jul 11, 2024
1 parent 33fc173 commit f24f949
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 24 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"@cosmjs/proto-signing": "^0.32.1",
"@cosmjs/stargate": "^0.32.1",
"@cosmjs/tendermint-rpc": "^0.32.1",
"@dydxprotocol/v4-abacus": "1.8.33",
"@dydxprotocol/v4-abacus": "1.8.34",
"@dydxprotocol/v4-client-js": "^1.1.26",
"@dydxprotocol/v4-localization": "^1.1.147",
"@dydxprotocol/v4-localization": "^1.1.149",
"@ethersproject/providers": "^5.7.2",
"@hugocxl/react-to-image": "^0.0.9",
"@js-joda/core": "^5.5.3",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions public/configs/v1/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"tradingRewardsLearnMore": "https://docs.dydx.exchange/concepts-trading/rewards_fees_and_parameters",
"exchangeStats": "https://app.mode.com/dydx_eng/reports/58822121650d?secret_key=391d9214fe6aefec35b7d35c",
"initialMarginFractionLearnMore": "https://docs.dydx.exchange/governance/functionalities#liquidity-tiers",
"complianceSupportEmail": "[email protected]",
"equityTiersLearnMore": "https://help.dydx.trade/en/articles/171918-equity-tiers-and-rate-limits",
"fetAgixMarketWindDownProposal": "https://www.mintscan.io/dydx/proposals/61",
"contractLossMechanismLearnMore": "https://help.dydx.trade/en/articles/166973-contract-loss-mechanisms-on-dydx-chain",
Expand Down Expand Up @@ -113,7 +112,6 @@
"tradingRewardsLearnMore": "https://docs.dydx.exchange/concepts-trading/rewards_fees_and_parameters",
"exchangeStats": "https://app.mode.com/dydx_eng/reports/58822121650d?secret_key=391d9214fe6aefec35b7d35c",
"initialMarginFractionLearnMore": "https://docs.dydx.exchange/governance/functionalities#liquidity-tiers",
"complianceSupportEmail": "[email protected]",
"equityTiersLearnMore": "https://help.dydx.trade/en/articles/171918-equity-tiers-and-rate-limits",
"fetAgixMarketWindDownProposal": "https://www.mintscan.io/dydx/proposals/61",
"contractLossMechanismLearnMore": "https://help.dydx.trade/en/articles/166973-contract-loss-mechanisms-on-dydx-chain",
Expand Down Expand Up @@ -148,7 +146,6 @@
"tradingRewardsLearnMore": "[HTTP link to trading rewards learn more, can be null]",
"exchangeStats": "[HTTP link to exchange stats, can be null]",
"initialMarginFractionLearnMore": "[HTTP link to governance functionalities liquidity tiers, can be null]",
"complianceSupportEmail": "[Email address for compliance support, can be null]",
"equityTiersLearnMore": "[HTTP link to equity tiers learn more, can be null]",
"fetAgixMarketWindDownProposal": "[HTTP link to mintscan proposal]",
"contractLossMechanismLearnMore": "[HTTP link to documentation on contract loss mechanisms]",
Expand Down Expand Up @@ -291,8 +288,8 @@
"endpoints": {
"indexers": [
{
"api": "https://indexer.v4dev.dydx.exchange",
"socket": "wss://indexer.v4dev.dydx.exchange"
"api": "https://indexerv4dev.dydx.exchange",
"socket": "wss://indexerv4dev.dydx.exchange"
}
],
"validators": [
Expand Down
7 changes: 6 additions & 1 deletion src/constants/geo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export enum CountryCodes {
const RESTRICTED_COUNTRIES = {
USA: CountryCodes.US,
CANADA: CountryCodes.CA,
GB: CountryCodes.GB,

// OFAC Sanctioned
AFGHANISTAN: CountryCodes.AF,
Expand All @@ -272,7 +273,11 @@ const RESTRICTED_COUNTRIES = {
ZIMBABWE: CountryCodes.ZW,
};

export const BLOCKED_COUNTRIES = [RESTRICTED_COUNTRIES.USA, RESTRICTED_COUNTRIES.CANADA];
export const BLOCKED_COUNTRIES = [
RESTRICTED_COUNTRIES.USA,
RESTRICTED_COUNTRIES.CANADA,
RESTRICTED_COUNTRIES.GB,
];

export const OFAC_SANCTIONED_COUNTRIES = [
RESTRICTED_COUNTRIES.AFGHANISTAN,
Expand Down
22 changes: 16 additions & 6 deletions src/hooks/useComplianceState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ComplianceStatus } from '@/constants/abacus';
import { CLOSE_ONLY_GRACE_PERIOD, ComplianceStates } from '@/constants/compliance';
import { STRING_KEYS } from '@/constants/localization';

import { Link } from '@/components/Link';
import { OutputType, formatDateOutput } from '@/components/Output';
import { TermsOfUseLink } from '@/components/TermsOfUseLink';

Expand All @@ -20,6 +21,7 @@ import { useURLConfigs } from './useURLConfigs';

export const useComplianceState = () => {
const stringGetter = useStringGetter();
const { help } = useURLConfigs();
const complianceStatus = useAppSelector(getComplianceStatus, shallowEqual);
const complianceUpdatedAt = useAppSelector(getComplianceUpdatedAt);
const geo = useAppSelector(getGeo);
Expand All @@ -29,8 +31,6 @@ export const useComplianceState = () => {
const updatedAtDate = complianceUpdatedAt ? new Date(complianceUpdatedAt) : undefined;
updatedAtDate?.setDate(updatedAtDate.getDate() + CLOSE_ONLY_GRACE_PERIOD);

const { complianceSupportEmail } = useURLConfigs();

let complianceState = ComplianceStates.FULL_ACCESS;

let complianceMessage;
Expand All @@ -51,21 +51,31 @@ export const useComplianceState = () => {
complianceMessage = `${stringGetter({ key: STRING_KEYS.CLICK_TO_VIEW })} →`;
} else if (complianceStatus === ComplianceStatus.CLOSE_ONLY) {
complianceMessage = stringGetter({
key: STRING_KEYS.CLOSE_ONLY_MESSAGE,
key: STRING_KEYS.CLOSE_ONLY_MESSAGE_WITH_HELP,
params: {
DATE: updatedAtDate
? formatDateOutput(updatedAtDate.valueOf(), OutputType.DateTime, {
dateFormat: 'medium',
selectedLocale,
})
: undefined,
EMAIL: complianceSupportEmail,
HELP_LINK: (
<Link href={help} isInline>
{stringGetter({ key: STRING_KEYS.HELP_CENTER })}
</Link>
),
},
});
} else if (complianceStatus === ComplianceStatus.BLOCKED) {
complianceMessage = stringGetter({
key: STRING_KEYS.PERMANENTLY_BLOCKED_MESSAGE,
params: { EMAIL: complianceSupportEmail },
key: STRING_KEYS.PERMANENTLY_BLOCKED_MESSAGE_WITH_HELP,
params: {
HELP_LINK: (
<Link href={help} isInline>
{stringGetter({ key: STRING_KEYS.HELP_CENTER })}
</Link>
),
},
});
} else if (geo && isBlockedGeo(geo)) {
complianceMessage = stringGetter({
Expand Down
2 changes: 0 additions & 2 deletions src/hooks/useURLConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export interface LinksConfigs {
walletLearnMore?: string;
withdrawalGateLearnMore?: string;
exchangeStats?: string;
complianceSupportEmail?: string;
fetAgixMarketWindDownProposal?: string;
contractLossMechanismLearnMore?: string;
mintscanValidatorsLearnMore?: string;
Expand Down Expand Up @@ -73,7 +72,6 @@ export const useURLConfigs = (): LinksConfigs => {
walletLearnMore: linksConfigs.walletLearnMore ?? FALLBACK_URL,
withdrawalGateLearnMore: linksConfigs.withdrawalGateLearnMore ?? FALLBACK_URL,
exchangeStats: linksConfigs.exchangeStats ?? FALLBACK_URL,
complianceSupportEmail: linksConfigs.complianceSupportEmail ?? FALLBACK_URL,
adjustTargetLeverageLearnMore: linksConfigs.adjustTargetLeverageLearnMore ?? FALLBACK_URL,
fetAgixMarketWindDownProposal: linksConfigs.fetAgixMarketWindDownProposal,
contractLossMechanismLearnMore: linksConfigs.contractLossMechanismLearnMore,
Expand Down
3 changes: 3 additions & 0 deletions src/views/dialogs/GeoComplianceDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export const GeoComplianceDialog = ({ setIsOpen }: DialogProps<GeoComplianceDial
<$Form>
<p>{stringGetter({ key: STRING_KEYS.COMPLIANCE_BODY_FIRST_OFFENSE_1 })}</p>
<p>{stringGetter({ key: STRING_KEYS.COMPLIANCE_BODY_FIRST_OFFENSE_2 })}</p>
<p>
<strong>{stringGetter({ key: STRING_KEYS.COMPLIANCE_BODY_FIRST_OFFENSE_3 })}</strong>
</p>
<Button action={ButtonAction.Primary} onClick={() => setShowForm(true)}>
{stringGetter({ key: STRING_KEYS.CONTINUE })}
</Button>
Expand Down

0 comments on commit f24f949

Please sign in to comment.