Skip to content

Commit

Permalink
feat: warning mKNC
Browse files Browse the repository at this point in the history
  • Loading branch information
namgold committed Oct 27, 2023
1 parent 7075972 commit f3e72fa
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/components/SwapForm/MultichainKNCNote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Currency } from '@kyberswap/ks-sdk-core'
import { Trans } from '@lingui/macro'
import { FC } from 'react'
import { Text } from 'rebass'
import styled from 'styled-components'

import WarningNote from 'components/WarningNote'
import { mKNC } from 'constants/tokens'
import { useActiveWeb3React } from 'hooks'

const TextUnderlineColor = styled(Text)`
border-bottom: 1px solid ${({ theme }) => theme.text};
width: fit-content;
cursor: pointer;
color: ${({ theme }) => theme.text};
font-weight: 500;
margin-right: 0.5ch;
`

type Props = {
currencyIn: Currency | undefined
currencyOut: Currency | undefined
}

const MultichainKNCNote: FC<Props> = ({ currencyIn, currencyOut }) => {
const { chainId } = useActiveWeb3React()
if ([currencyIn?.wrapped.address, currencyOut?.wrapped.address].includes(mKNC[chainId])) {
const shortText = (
<div>
<Trans>
Multichain team ceased operations, and we discourage user interaction with the deployed Wrapped KNC token
contracts on various chains. See more{' '}
<TextUnderlineColor
style={{ minWidth: 'max-content' }}
as="a"
href="https://twitter.com/MultichainOrg/status/1679768407628185600"
target="_blank"
rel="noreferrer"
>
here
</TextUnderlineColor>
</Trans>
</div>
)
return <WarningNote shortText={shortText} />
}

return null
}

export default MultichainKNCNote
2 changes: 2 additions & 0 deletions src/components/SwapForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { MEDIA_WIDTHS } from 'theme'
import { DetailedRouteSummary } from 'types/route'
import { currencyId } from 'utils/currencyId'

import MultichainKNCNote from './MultichainKNCNote'
import PriceImpactNote from './PriceImpactNote'
import RefreshButton from './RefreshButton'
import ReverseTokenSelectionButton from './ReverseTokenSelectionButton'
Expand Down Expand Up @@ -261,6 +262,7 @@ const SwapForm: React.FC<SwapFormProps> = props => {
{!isWrapOrUnwrap && <SlippageWarningNote rawSlippage={slippage} isStablePairSwap={isStablePairSwap} />}

<PriceImpactNote priceImpact={routeSummary?.priceImpact} isDegenMode={isDegenMode} showLimitOrderLink />
<MultichainKNCNote currencyIn={currencyIn} currencyOut={currencyOut} />

<GasPriceNote gasUsd={routeSummary?.gasUsd} />

Expand Down
5 changes: 5 additions & 0 deletions src/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,8 @@ export const DEFAULT_OUTPUT_TOKEN_BY_CHAIN: Partial<Record<ChainId, Token>> = {

export const DEFAULT_SWAP_FEE_STABLE_PAIRS = 4
export const DEFAULT_SWAP_FEE_NOT_STABLE_PAIRS = 10

export const mKNC: { [chain in ChainId]?: string } = {
[ChainId.ARBITRUM]: '0x316772cFEc9A3E976FDE42C3Ba21F5A13aAaFf12',
[ChainId.AVAXMAINNET]: '0x39fC9e94Caeacb435842FADeDeCB783589F50f5f',
}

0 comments on commit f3e72fa

Please sign in to comment.