Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 27 additions & 16 deletions app/src/pagePartials/bridge/bridgeForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { UnifiedBridgeButton } from './button/UnifiedBridgeButton'
import { useRouter } from 'next/router'
import { useSanitizedQuery } from '@/src/hooks/useSanitizedQuery'
import { isBlockedToken } from '@/src/utils/blockedTokens'
import { XdaiWarning } from './warnings/xDaiWarning'

const Title = styled.h2`
align-items: center;
Expand Down Expand Up @@ -253,8 +254,14 @@ const Main = () => {
? true
: false

console.log('tokenIn', formState.token)
console.log('tokenOut', tokenOut)
// console.log('tokenIn', formState.token)
// console.log('tokenOut', tokenOut)

const isXdai =
(formState.fromChainId === Chains.mainnet &&
isSameString(formState.token?.address || '', '0x6B175474E89094C44Da98b954EedeAC495271d0F')) ||
(formState.fromChainId === Chains.gnosis &&
isSameString(formState.token?.address || '', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'))

return (
<Wrapper>
Expand Down Expand Up @@ -296,6 +303,7 @@ const Main = () => {
</InnerCardFrom>
<InnerCard>
<Title>Transfer to</Title>
{isXdai && <XdaiWarning />}
{isUsdcEth && <UsdcEthWarning />}
{isUsdceGC && <UsdcEGcWarning />}
{unwrapFirst && <UnwrapFirst symbol={formState.token?.symbol} />}
Expand All @@ -306,7 +314,7 @@ const Main = () => {
<NotBridgedERC20Warning />
)}

{!unwrapFirst && !sendToExternalBridge && !isNotBridgedErc20 && (
{!unwrapFirst && !sendToExternalBridge && !isNotBridgedErc20 && !isXdai && (
<>
<OnChainInfo>
<Chain chainId={formState.toChainId} />
Expand Down Expand Up @@ -341,7 +349,8 @@ const Main = () => {
formState.token &&
tokenOut &&
address &&
walletChainId == formState.fromChainId && (
walletChainId == formState.fromChainId &&
!isXdai && (
<BridgeSummary
amount={amountBN}
fromChainId={formState.fromChainId}
Expand All @@ -354,18 +363,20 @@ const Main = () => {
/>
)}
</FormCards>
<UnifiedBridgeButton
amount={amountBN}
fromChainId={formState.fromChainId}
fromToken={formState.token}
isUsdceGC={isUsdceGC}
receiveNativeToken={formState.receiveNativeToken}
recipient={formState.recipient}
sendToExternalBridge={sendToExternalBridge}
toChainId={formState.toChainId}
toToken={tokenOut}
userAddress={address}
/>
{!isXdai && (
<UnifiedBridgeButton
amount={amountBN}
fromChainId={formState.fromChainId}
fromToken={formState.token}
isUsdceGC={isUsdceGC}
receiveNativeToken={formState.receiveNativeToken}
recipient={formState.recipient}
sendToExternalBridge={sendToExternalBridge}
toChainId={formState.toChainId}
toToken={tokenOut}
userAddress={address}
/>
)}
</Form>
</FormWrapper>
</Wrapper>
Expand Down
49 changes: 49 additions & 0 deletions app/src/pagePartials/bridge/bridgeForm/warnings/xDaiWarning.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import styled from 'styled-components'
import { Warning } from '@/src/components/assets/Warning'
import React from 'react'

const Contents = styled.div`
display: flex;
align-items: center;
gap: calc(var(--theme-common-space) * 2);
min-height: 80px;

.warning {
color: ${({ theme: { colors } }) => colors.warning};
}
`

const Text = styled.span`
color: ${({ theme: { colors } }) => colors.textColor};
font-size: 1.6rem;
line-height: 1.4;
`

const Link = styled.a`
color: ${({ theme: { colors } }) => colors.textColor};
`

export const XdaiWarning: React.FC = () => {
return (
<Contents>
<Warning />
<Text>
We are currently working on resolving the UI issues.
<br />
Thank you for your patience. In the meantime, you can still interact directly with the smart
contract to relay DAI and xDAI via the xDAI Bridge. For the contract address, please refer
to{' '}
<Link
href={
'https://docs.gnosischain.com/bridges/About%20Token%20Bridges/xdai-bridge#key-contracts'
}
rel="noreferrer"
target="_blank"
>
documentation
</Link>{' '}
page
</Text>
</Contents>
)
}