From 1f07a21db1762d7b5652d16f461a2d09d578056e Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 19 Jul 2024 15:37:25 -0700 Subject: [PATCH] feat: add notification for rndr proposal (#837) --- package.json | 2 +- pnpm-lock.yaml | 8 ++-- public/configs/v1/env.json | 9 ++-- src/constants/notifications.ts | 1 + src/hooks/useNotificationTypes.tsx | 67 +++++++----------------------- src/hooks/useURLConfigs.ts | 4 +- 6 files changed, 26 insertions(+), 65 deletions(-) diff --git a/package.json b/package.json index 1d6fc5c14..952fddfff 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@cosmjs/tendermint-rpc": "^0.32.1", "@dydxprotocol/v4-abacus": "1.8.54", "@dydxprotocol/v4-client-js": "^1.1.27", - "@dydxprotocol/v4-localization": "^1.1.158", + "@dydxprotocol/v4-localization": "^1.1.159", "@ethersproject/providers": "^5.7.2", "@hugocxl/react-to-image": "^0.0.9", "@js-joda/core": "^5.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0703a7aa9..0100869d3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,8 +36,8 @@ dependencies: specifier: ^1.1.27 version: 1.1.27 '@dydxprotocol/v4-localization': - specifier: ^1.1.158 - version: 1.1.158 + specifier: ^1.1.159 + version: 1.1.159 '@ethersproject/providers': specifier: ^5.7.2 version: 5.7.2 @@ -3239,8 +3239,8 @@ packages: - utf-8-validate dev: false - /@dydxprotocol/v4-localization@1.1.158: - resolution: {integrity: sha512-tFL00Fj33dL+GdMlJHKtSJ2YI59o93pfrsdmaPmnItPVQPGOd1vnuadxXT52/5sZWLt9ea+b8hrIX+aVHfFayA==} + /@dydxprotocol/v4-localization@1.1.159: + resolution: {integrity: sha512-tIjxVXrK8drd9ilm5kNS7n6LR1kqEH45kvi04SiSI+0edDCQ8DbkQxu+68HjDIaFjj4X6Kr4q+gWq2LQjy7+wA==} dev: false /@dydxprotocol/v4-proto@5.0.0-dev.0: diff --git a/public/configs/v1/env.json b/public/configs/v1/env.json index c5f8d34d3..dc84924a6 100644 --- a/public/configs/v1/env.json +++ b/public/configs/v1/env.json @@ -79,12 +79,12 @@ "exchangeStats": "https://app.mode.com/dydx_eng/reports/58822121650d?secret_key=391d9214fe6aefec35b7d35c", "initialMarginFractionLearnMore": "https://docs.dydx.exchange/governance/functionalities#liquidity-tiers", "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", "isolatedMarginLearnMore": "https://help.dydx.trade/en/articles/172975-isolated-margin", "mintscanValidatorsLearnMore": "https://www.mintscan.io/dydx/validators", "protocolStaking": "https://protocolstaking.info/", - "stakingAndClaimingRewardsLearnMore": "https://help.dydx.trade/en/articles/178571-staking-and-unstaking-dydx-and-claiming-staking-rewards" + "stakingAndClaimingRewardsLearnMore": "https://help.dydx.trade/en/articles/178571-staking-and-unstaking-dydx-and-claiming-staking-rewards", + "rndrParamProposal": "https://www.mintscan.io/dydx/proposals/61" }, "dydx-testnet-4": { "tos": "https://dydx.exchange/v4-terms", @@ -113,12 +113,12 @@ "exchangeStats": "https://app.mode.com/dydx_eng/reports/58822121650d?secret_key=391d9214fe6aefec35b7d35c", "initialMarginFractionLearnMore": "https://docs.dydx.exchange/governance/functionalities#liquidity-tiers", "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", "isolatedMarginLearnMore": "https://help.dydx.trade/en/articles/172975-isolated-margin", "mintscanValidatorsLearnMore": "https://www.mintscan.io/dydx/validators", "protocolStaking": "https://protocolstaking.info/", - "stakingAndClaimingRewardsLearnMore": "https://help.dydx.trade/en/articles/178571-staking-and-unstaking-dydx-and-claiming-staking-rewards" + "stakingAndClaimingRewardsLearnMore": "https://help.dydx.trade/en/articles/178571-staking-and-unstaking-dydx-and-claiming-staking-rewards", + "rndrParamProposal": "https://www.mintscan.io/dydx/proposals/61" }, "[mainnet chain id]": { "tos": "[HTTP link to TOS]", @@ -147,7 +147,6 @@ "exchangeStats": "[HTTP link to exchange stats, can be null]", "initialMarginFractionLearnMore": "[HTTP link to governance functionalities liquidity tiers, 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]", "isolatedMarginLearnMore": "[HTTP link to documentation on isolated margin]", "mintscanValidatorsLearnMore": "[HTTP link to mintscan info on validators]", diff --git a/src/constants/notifications.ts b/src/constants/notifications.ts index 26607d53f..f1fd2704f 100644 --- a/src/constants/notifications.ts +++ b/src/constants/notifications.ts @@ -225,6 +225,7 @@ export const INCENTIVES_DISTRIBUTED_NOTIFICATION_ID = export enum MarketWindDownNotificationIds { MarketWindDownFetAgix = 'market-wind-down-fet-agix', MarketWindDownProposalFetAgix = 'market-wind-down-proposal-fet-agix', + MarketUpdateProposalRndr = 'market-update-proposal-rndr', } /** diff --git a/src/hooks/useNotificationTypes.tsx b/src/hooks/useNotificationTypes.tsx index ee3e32b6e..ad776a4fc 100644 --- a/src/hooks/useNotificationTypes.tsx +++ b/src/hooks/useNotificationTypes.tsx @@ -36,7 +36,6 @@ import { useLocalNotifications } from '@/hooks/useLocalNotifications'; import { AssetIcon } from '@/components/AssetIcon'; import { Icon, IconName } from '@/components/Icon'; import { Link } from '@/components/Link'; -import { Output, OutputType } from '@/components/Output'; // eslint-disable-next-line import/no-cycle import { BlockRewardNotification } from '@/views/notifications/BlockRewardNotification'; import { IncentiveSeasonDistributionNotification } from '@/views/notifications/IncentiveSeasonDistributionNotification'; @@ -466,77 +465,43 @@ export const notificationTypes: NotificationTypeConfig[] = [ useTrigger: ({ trigger }) => { const stringGetter = useStringGetter(); - const { fetAgixMarketWindDownProposal, contractLossMechanismLearnMore } = useURLConfigs(); + const { rndrParamProposal } = useURLConfigs(); - const marketWindDownProposalExpirationDate = '2024-06-11T16:53:00'; - const marketWindDownDate = marketWindDownProposalExpirationDate; - const marketWindDownExpirationDate = '2024-07-11T16:53:00'; // 30 days after wind down const currentDate = new Date(); - const outputDate = <$Output type={OutputType.DateTime} value={marketWindDownDate} />; + const RNDNProposalTriggerDate = new Date('2024-07-20T22:00:00.000Z'); + const RNDNProposalExpireDate = new Date('2024-08-20T22:00:00.000Z'); - const firstMarket = 'FET-USD'; - const secondMarket = 'AGIX-USD'; - - useEffect(() => { - if (currentDate <= new Date(marketWindDownProposalExpirationDate)) { - trigger(MarketWindDownNotificationIds.MarketWindDownProposalFetAgix, { - title: stringGetter({ - key: 'NOTIFICATIONS.TWO_MARKET_WIND_DOWN_PROPOSAL.TITLE', - params: { - MARKET_1: firstMarket, - MARKET_2: secondMarket, - }, - }), - body: stringGetter({ - key: 'NOTIFICATIONS.TWO_MARKET_WIND_DOWN_PROPOSAL.BODY', - params: { - MARKET_1: firstMarket, - MARKET_2: secondMarket, - DATE: outputDate, - HERE_LINK: ( - - {stringGetter({ key: STRING_KEYS.HERE })} - - ), - }, - }), - toastSensitivity: 'foreground', - groupKey: MarketWindDownNotificationIds.MarketWindDownProposalFetAgix, - }); - } - }, [stringGetter]); + const RNDRMarket = 'RNDR-USD'; useEffect(() => { if ( - currentDate >= new Date(marketWindDownDate) && - currentDate <= new Date(marketWindDownExpirationDate) + rndrParamProposal && + currentDate >= RNDNProposalTriggerDate && + currentDate <= RNDNProposalExpireDate ) { trigger( - MarketWindDownNotificationIds.MarketWindDownFetAgix, + MarketWindDownNotificationIds.MarketUpdateProposalRndr, { title: stringGetter({ - key: 'NOTIFICATIONS.TWO_MARKET_WIND_DOWN.TITLE', + key: 'NOTIFICATIONS.MARKET_PARAM_UPDATE.TITLE', params: { - MARKET_1: firstMarket, - MARKET_2: secondMarket, + MARKET: RNDRMarket, }, }), body: stringGetter({ - key: 'NOTIFICATIONS.TWO_MARKET_WIND_DOWN.BODY', + key: 'NOTIFICATIONS.MARKET_PARAM_UPDATE.BODY', params: { - MARKET_1: firstMarket, - MARKET_2: secondMarket, - DATE: outputDate, + MARKET: RNDRMarket, HERE_LINK: ( - + {stringGetter({ key: STRING_KEYS.HERE })} ), }, }), toastSensitivity: 'foreground', - groupKey: MarketWindDownNotificationIds.MarketWindDownFetAgix, + groupKey: MarketWindDownNotificationIds.MarketUpdateProposalRndr, }, [] ); @@ -708,7 +673,3 @@ const $Icon = styled.img` const $WarningIcon = styled(Icon)` color: var(--color-warning); `; - -const $Output = styled(Output)` - display: inline-block; -`; diff --git a/src/hooks/useURLConfigs.ts b/src/hooks/useURLConfigs.ts index 9ac8af29c..79d8e8af2 100644 --- a/src/hooks/useURLConfigs.ts +++ b/src/hooks/useURLConfigs.ts @@ -33,12 +33,12 @@ export interface LinksConfigs { walletLearnMore?: string; withdrawalGateLearnMore?: string; exchangeStats?: string; - fetAgixMarketWindDownProposal?: string; contractLossMechanismLearnMore?: string; mintscanValidatorsLearnMore?: string; protocolStaking: string; stakingAndClaimingRewardsLearnMore?: string; vaultsLearnMore: string; + rndrParamProposal?: string; } export const useURLConfigs = (): LinksConfigs => { @@ -73,7 +73,6 @@ export const useURLConfigs = (): LinksConfigs => { withdrawalGateLearnMore: linksConfigs.withdrawalGateLearnMore ?? FALLBACK_URL, exchangeStats: linksConfigs.exchangeStats ?? FALLBACK_URL, adjustTargetLeverageLearnMore: linksConfigs.adjustTargetLeverageLearnMore ?? FALLBACK_URL, - fetAgixMarketWindDownProposal: linksConfigs.fetAgixMarketWindDownProposal, contractLossMechanismLearnMore: linksConfigs.contractLossMechanismLearnMore, mintscanValidatorsLearnMore: linksConfigs.mintscanValidatorsLearnMore, protocolStaking: linksConfigs.protocolStaking, @@ -81,5 +80,6 @@ export const useURLConfigs = (): LinksConfigs => { linksConfigs.stakingAndClaimingRewardsLearnMore ?? FALLBACK_URL, // todo add to the link configs objects vaultsLearnMore: linksConfigs.vaultsLearnMore ?? FALLBACK_URL, + rndrParamProposal: linksConfigs.rndrParamProposal, }; };