Skip to content

Commit

Permalink
Merge pull request #303 from mstable/feat/add-insurance-links-to-trad…
Browse files Browse the repository at this point in the history
…ing-deposit-panel

feat: add insurance links to trading deposit panel
  • Loading branch information
dimlbc authored May 16, 2024
2 parents 8db5a20 + c2a870b commit eb6e29f
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ import {
useMinReceiveText,
} from '@dhedge/core-ui-kit/hooks/trading';
import { formatToUsd } from '@dhedge/core-ui-kit/utils';
import { INSUR_ACE_LINK, OPEN_COVER_LINK } from '@frontend/shared-constants';
import { useLogAnalyticsEvent } from '@frontend/shared-providers';
import { CollapsibleSection, InfoTooltip } from '@frontend/shared-ui';
import {
CollapsibleSection,
InfoTooltip,
TokenIconRevamp,
} from '@frontend/shared-ui';
import {
Box,
CircularProgress,
Divider,
Link,
Stack,
Typography,
} from '@mui/material';
Expand Down Expand Up @@ -146,6 +152,30 @@ export const TradingTransactionOverview: FC<StackProps> = (props) => {
})}
value={minReceivedText}
/>
{isDeposit && (
<OverviewItem
label="Insurance"
tooltipText="Deposits can be covered for certain types of hacks"
value={
<Stack direction="row" gap={1}>
<Link
href={OPEN_COVER_LINK}
target="_blank"
rel="noopener noreferrer"
>
<TokenIconRevamp symbols={['opencover']} />
</Link>
<Link
href={INSUR_ACE_LINK}
target="_blank"
rel="noopener noreferrer"
>
<TokenIconRevamp symbols={['insur']} />
</Link>
</Stack>
}
/>
)}
{showMinRecommendedSlippage && (
<OverviewItem
label={intl.formatMessage({
Expand Down
8 changes: 5 additions & 3 deletions libs/shared/constants/src/core-vaults/optimism/mhrvst.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { BRIDGED_USDC_OPTIMISM, optimism } from '@dhedge/core-ui-kit/const';
import { optimism } from '@dhedge/core-ui-kit/const';

import { USDC_OPTIMISM } from '../../tokens';

import type { PoolConfig } from '@dhedge/core-ui-kit/types';

Expand All @@ -9,10 +11,10 @@ export const MHRVST_OPTIMISM: PoolConfig = {
symbol: 'mHRVST',
address: '0x9c6de13d4648a6789017641f6b1a025816e66228',
depositParams: {
customTokens: [BRIDGED_USDC_OPTIMISM],
customTokens: [],
},
withdrawParams: {
customTokens: [BRIDGED_USDC_OPTIMISM],
customTokens: [USDC_OPTIMISM],
},
};

Expand Down
6 changes: 6 additions & 0 deletions libs/shared/constants/src/mstable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ export const MEDIUM = 'https://medium.com/mstable';
export const EMAIL = 'mailto:[email protected]';
export const MSTABLE_LANDING_PAGE_URL = 'https://mstable.org/';
export const DHEDGE = 'https://dhedge.org/';

export const OPEN_COVER_LINK =
'https://opencover.com/app/?invite=DH100K&cover=126';

export const INSUR_ACE_LINK =
'https://app.insurace.io/Insurance/BuyCovers?referrer=212511352154979513002532245935614371628988752555';
1 change: 1 addition & 0 deletions libs/shared/constants/src/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { toksPolygonMumbai } from './polygonMumbai';

import type { Token } from './types';

export * from './optimism';
export * from './types';

export const tokens = {
Expand Down
9 changes: 9 additions & 0 deletions libs/shared/constants/src/tokens/optimism.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { MTA, Optimism, USDC } from '@frontend/shared-icons';
import { erc20ABI } from 'wagmi';
import { optimism } from 'wagmi/chains';

import type { TradingToken } from '@dhedge/core-ui-kit/types';

import type { Token } from './types';

export const toksOptimism: Token[] = [
Expand Down Expand Up @@ -32,3 +34,10 @@ export const toksOptimism: Token[] = [
abi: erc20ABI,
},
];

export const USDC_OPTIMISM: TradingToken = {
address: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
symbol: 'USDC',
decimals: 6,
value: '',
};

0 comments on commit eb6e29f

Please sign in to comment.