From daa3acac5708d15e6d48ef2cfd02351f2ef54030 Mon Sep 17 00:00:00 2001 From: JayJay1024 Date: Mon, 1 Apr 2024 11:33:42 +0800 Subject: [PATCH 1/3] refactor: reset transfer alert --- src/components/transfer.tsx | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/components/transfer.tsx b/src/components/transfer.tsx index a0389129..82564a19 100644 --- a/src/components/transfer.tsx +++ b/src/components/transfer.tsx @@ -61,30 +61,8 @@ export default function Transfer() { const [balanceLoading, setBalanceLoading] = useState(false); const alert = useMemo(() => { - if ( - (sourceChain?.network === "darwinia-dvm" && targetChain?.network === "ethereum") || - (sourceChain?.network === "ethereum" && targetChain?.network === "darwinia-dvm") - ) { - return ( -
- - {`Due to the Ethereum upgrade, the Darwinia<>Ethereum bridge is temporarily unavailable. Please use the official`} -   - - - Arbitrum bridge - -  {`to route to Darwinia or Ethereum instead.`} -
- ); - } return null; - }, [sourceChain?.network, targetChain?.network]); + }, []); const bridgeOptions = useMemo( () => getAvailableBridges(sourceChain, targetChain, sourceToken), From 2627b32c2a9a64a41a0e77128219e7737962235f Mon Sep 17 00:00:00 2001 From: JayJay1024 Date: Mon, 1 Apr 2024 11:46:38 +0800 Subject: [PATCH 2/3] feat: adapt darwinia<>ethereum --- src/bridges/xtoken-next.ts | 14 ++++++++++++++ src/config/chains/ethereum.ts | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/bridges/xtoken-next.ts b/src/bridges/xtoken-next.ts index 0edf5931..d451d7fa 100644 --- a/src/bridges/xtoken-next.ts +++ b/src/bridges/xtoken-next.ts @@ -30,6 +30,12 @@ export class XTokenNextBridge extends BaseBridge { ) { backing = "0xa64D1c284280b22f921E7B2A55040C7bbfD4d9d0"; issuing = "0xf6372ab2d35B32156A19F2d2F23FA6dDeFBE58bd"; + } else if ( + (this.sourceChain?.network === "darwinia-dvm" && this.targetChain?.network === "ethereum") || + (this.sourceChain?.network === "ethereum" && this.targetChain?.network === "darwinia-dvm") + ) { + backing = "0x2B496f19A420C02490dB859fefeCCD71eDc2c046"; + issuing = "0xDc0C760c0fB4672D06088515F6446a71Df0c64C1"; } this.initContractByBackingIssuing(backing, issuing); } @@ -63,6 +69,14 @@ export class XTokenNextBridge extends BaseBridge { const source = this.sourceToken?.type === "native" ? "0x004D0dE211BC148c3Ce696C51Cbc85BD421727E9" : undefined; const target = this.targetToken?.type === "native" ? "0xA8d0E9a45249Ec839C397fa0F371f5F64eCAB7F7" : undefined; this.convertor = { source, target }; + } else if (this.sourceChain?.network === "darwinia-dvm" && this.targetChain?.network === "ethereum") { + const source = this.sourceToken?.type === "native" ? "0x092e19c46c9daab7824393f1cd9c22f5bea13560" : undefined; + const target = this.targetToken?.type === "native" ? "0xc29dCb1F12a1618262eF9FBA673b77140adc02D6" : undefined; + this.convertor = { source, target }; + } else if (this.sourceChain?.network === "ethereum" && this.targetChain?.network === "darwinia-dvm") { + const source = this.sourceToken?.type === "native" ? "0xc29dCb1F12a1618262eF9FBA673b77140adc02D6" : undefined; + const target = this.targetToken?.type === "native" ? "0x092e19c46c9daab7824393f1cd9c22f5bea13560" : undefined; + this.convertor = { source, target }; } } diff --git a/src/config/chains/ethereum.ts b/src/config/chains/ethereum.ts index 1eb17c46..9c5c756b 100644 --- a/src/config/chains/ethereum.ts +++ b/src/config/chains/ethereum.ts @@ -33,7 +33,7 @@ export const ethereumChain: ChainConfig = { type: "erc20", address: "0x9469d013805bffb7d3debe5e7839237e535ec483", outer: "0x9469d013805bffb7d3debe5e7839237e535ec483", - inner: "0x9469d013805bffb7d3debe5e7839237e535ec483", + inner: "0x81e32d4652Be82AE225DEdd1bD0bf3BCba8FEE07", logo: "ring.png", cross: [ { @@ -81,4 +81,5 @@ export const ethereumChain: ChainConfig = { ], }, ], + messager: { msgline: "0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0" }, }; From 452d91279dc5c6352401bfb8878361fe854b1b44 Mon Sep 17 00:00:00 2001 From: JayJay1024 Date: Mon, 1 Apr 2024 13:35:43 +0800 Subject: [PATCH 3/3] fix: update convertor --- src/bridges/xtoken-next.ts | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/bridges/xtoken-next.ts b/src/bridges/xtoken-next.ts index d451d7fa..8ee66b4c 100644 --- a/src/bridges/xtoken-next.ts +++ b/src/bridges/xtoken-next.ts @@ -61,6 +61,24 @@ export class XTokenNextBridge extends BaseBridge { source: "0x4CdFe9915d2c72506f4fC2363A8EaE032E82d1aA", target: "0xB3A8DB63d6FBE0f50A3D4977c3e892543D772C4A", }; + } else if ( + this.sourceChain?.network === "darwinia-dvm" && + this.targetChain?.network === "ethereum" && + this.sourceToken?.type === "native" + ) { + this.convertor = { + source: "0x092e19c46c9daab7824393f1cd9c22f5bea13560", + target: "0xc29dCb1F12a1618262eF9FBA673b77140adc02D6", + }; + } else if ( + this.sourceChain?.network === "ethereum" && + this.targetChain?.network === "darwinia-dvm" && + this.targetToken?.type === "native" + ) { + this.convertor = { + source: "0xc29dCb1F12a1618262eF9FBA673b77140adc02D6", + target: "0x092e19c46c9daab7824393f1cd9c22f5bea13560", + }; } else if (this.sourceChain?.network === "darwinia-dvm" && this.targetChain?.network === "crab-dvm") { const source = this.sourceToken?.type === "native" ? "0xA8d0E9a45249Ec839C397fa0F371f5F64eCAB7F7" : undefined; const target = this.targetToken?.type === "native" ? "0x004D0dE211BC148c3Ce696C51Cbc85BD421727E9" : undefined; @@ -69,14 +87,6 @@ export class XTokenNextBridge extends BaseBridge { const source = this.sourceToken?.type === "native" ? "0x004D0dE211BC148c3Ce696C51Cbc85BD421727E9" : undefined; const target = this.targetToken?.type === "native" ? "0xA8d0E9a45249Ec839C397fa0F371f5F64eCAB7F7" : undefined; this.convertor = { source, target }; - } else if (this.sourceChain?.network === "darwinia-dvm" && this.targetChain?.network === "ethereum") { - const source = this.sourceToken?.type === "native" ? "0x092e19c46c9daab7824393f1cd9c22f5bea13560" : undefined; - const target = this.targetToken?.type === "native" ? "0xc29dCb1F12a1618262eF9FBA673b77140adc02D6" : undefined; - this.convertor = { source, target }; - } else if (this.sourceChain?.network === "ethereum" && this.targetChain?.network === "darwinia-dvm") { - const source = this.sourceToken?.type === "native" ? "0xc29dCb1F12a1618262eF9FBA673b77140adc02D6" : undefined; - const target = this.targetToken?.type === "native" ? "0x092e19c46c9daab7824393f1cd9c22f5bea13560" : undefined; - this.convertor = { source, target }; } }