Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Adapt Darwinia<>Ethereum (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 authored Apr 1, 2024
1 parent 5757a0c commit a4d4a0e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
24 changes: 24 additions & 0 deletions src/bridges/xtoken-next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -55,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;
Expand Down
24 changes: 1 addition & 23 deletions src/components/transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="flex flex-wrap items-center justify-center rounded-2xl bg-inner px-3 py-middle text-center text-sm font-medium text-app-orange">
<span>
{`Due to the Ethereum upgrade, the Darwinia<>Ethereum bridge is temporarily unavailable. Please use the official`}
&nbsp;
</span>
<a
href="https://bridge.arbitrum.io/?destinationChain=ethereum&sourceChain=arbitrum-one"
rel="noopener noreferrer"
target="_blank"
className=" text-primary hover:underline"
>
Arbitrum bridge
</a>
<span>&nbsp;{`to route to Darwinia or Ethereum instead.`}</span>
</div>
);
}
return null;
}, [sourceChain?.network, targetChain?.network]);
}, []);

const bridgeOptions = useMemo(
() => getAvailableBridges(sourceChain, targetChain, sourceToken),
Expand Down
3 changes: 2 additions & 1 deletion src/config/chains/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ethereumChain: ChainConfig = {
type: "erc20",
address: "0x9469d013805bffb7d3debe5e7839237e535ec483",
outer: "0x9469d013805bffb7d3debe5e7839237e535ec483",
inner: "0x9469d013805bffb7d3debe5e7839237e535ec483",
inner: "0x81e32d4652Be82AE225DEdd1bD0bf3BCba8FEE07",
logo: "ring.png",
cross: [
{
Expand Down Expand Up @@ -81,4 +81,5 @@ export const ethereumChain: ChainConfig = {
],
},
],
messager: { msgline: "0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0" },
};

0 comments on commit a4d4a0e

Please sign in to comment.