Skip to content

Commit

Permalink
Support polygon-zkEvm and gnosis USDT (#590)
Browse files Browse the repository at this point in the history
* Support polygon-zkEvm and gnosis USDT

* Update gnosis.png
  • Loading branch information
JayJay1024 authored Dec 4, 2023
1 parent bc73733 commit 8f68b6d
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 1 deletion.
Binary file added packages/apps/public/images/network/gnosis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/apps/public/images/token/xdai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/apps/src/config/chains/bsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const bscChain: ChainConfig = {
{ target: { network: "arbitrum", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "op", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "linea", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "polygon-zkEvm", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
],
},
{
Expand Down
56 changes: 56 additions & 0 deletions packages/apps/src/config/chains/gnosis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { ChainConfig, ChainID } from "@/types";

export const gnosisChain: ChainConfig = {
/**
* Chain
*/
id: ChainID.GNOSIS,
network: "gnosis",
name: "Gnosis Chain",
nativeCurrency: {
name: "xDai",
symbol: "xDai",
decimals: 18,
},
rpcUrls: {
default: {
http: ["https://rpc.gnosischain.com/"],
webSocket: [],
},
public: {
http: ["https://rpc.gnosischain.com/"],
webSocket: [],
},
},
blockExplorers: {
default: {
name: "GnosisScan",
url: "https://gnosisscan.io/",
},
},

/**
* Custom
*/
logo: "gnosis.png",
tokens: [
{
decimals: 18,
symbol: "xDai",
name: "xDai",
type: "native",
address: "0x0000000000000000000000000000000000000000",
logo: "xdai.svg",
cross: [],
},
{
decimals: 18,
symbol: "USDT",
name: "USDT",
type: "erc20",
address: "0x4ECaBa5870353805a9F068101A40E0f32ed605C6",
logo: "usdt.png",
cross: [{ target: { network: "bsc", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } }],
},
],
};
2 changes: 2 additions & 0 deletions packages/apps/src/config/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export * from "./optimism";
export * from "./pangolin";
export * from "./pangoro";
export * from "./polygon";
export * from "./polygon-zkevm";
export * from "./scroll";
export * from "./zksync";
export * from "./zksync-goerli";
export * from "./gnosis";
59 changes: 59 additions & 0 deletions packages/apps/src/config/chains/polygon-zkevm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { ChainConfig, ChainID } from "@/types";

export const polygonZkEvmChain: ChainConfig = {
/**
* Chain
*/
id: ChainID.POLYGON_ZKEVM,
network: "polygon-zkEvm",
name: "Polygon zkEVM",
nativeCurrency: {
name: "ETH",
symbol: "ETH",
decimals: 18,
},
rpcUrls: {
default: {
http: ["https://zkevm-rpc.com"],
webSocket: [],
},
public: {
http: ["https://zkevm-rpc.com"],
webSocket: [],
},
},
blockExplorers: {
default: {
name: "Polygonscan",
url: "https://zkevm.polygonscan.com/",
},
},

/**
* Custom
*/
logo: "polygon.png",
tokens: [
{
decimals: 18,
symbol: "ETH",
name: "ETH",
type: "native",
address: "0x0000000000000000000000000000000000000000",
logo: "eth.svg",
cross: [],
},
{
decimals: 18,
symbol: "USDT",
name: "USDT",
type: "erc20",
address: "0x1E4a5963aBFD975d8c9021ce480b42188849D41d",
logo: "usdt.png",
cross: [
{ target: { network: "polygon", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "bsc", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
],
},
],
};
9 changes: 9 additions & 0 deletions packages/apps/src/config/chains/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,14 @@ export const polygonChain: ChainConfig = {
logo: "ring.svg",
cross: [{ target: { network: "arbitrum", symbol: "RING" }, bridge: { category: "lnbridgev20-default" } }],
},
{
decimals: 18,
symbol: "USDT",
name: "USDT",
type: "erc20",
address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
logo: "usdt.png",
cross: [{ target: { network: "polygon-zkEvm", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } }],
},
],
};
4 changes: 4 additions & 0 deletions packages/apps/src/types/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ export enum ChainID {

MUMBAI = 80001,
POLYGON = 137,
POLYGON_ZKEVM = 1101,

BASE = 8453,
BASE_GOERLI = 84531,

SCROLL = 534352,
BSC = 56,
OPTIMISM = 10,
GNOSIS = 100,
}

// According to graphql indexer
Expand All @@ -50,6 +52,8 @@ export type Network =
| "mantle"
| "mantle-goerli"
| "polygon"
| "polygon-zkEvm"
| "gnosis"
| "mumbai"
| "scroll"
| "base-goerli"
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/src/types/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export type TokenSymbol =
| "xWCRAB"
| "MNT"
| "MATIC"
| "BNB";
| "BNB"
| "xDai";

export type TokenType = "native" | "erc20" | "mapping";

Expand Down
10 changes: 10 additions & 0 deletions packages/apps/src/utils/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
crabChain,
darwiniaChain,
ethereumChain,
gnosisChain,
goerliChain,
lineaChain,
lineaGoerliChain,
Expand All @@ -15,6 +16,7 @@ import {
pangolinChain,
pangoroChain,
polygonChain,
polygonZkEvmChain,
scrollChain,
zksyncChain,
zksyncGoerliChain,
Expand Down Expand Up @@ -71,6 +73,9 @@ export function getChainConfig(chainIdOrNetwork?: ChainID | Network | null): Cha
case ChainID.POLYGON:
case "polygon":
return polygonChain;
case ChainID.POLYGON_ZKEVM:
case "polygon-zkEvm":
return polygonZkEvmChain;
case ChainID.MUMBAI:
case "mumbai":
return mumbaiChain;
Expand All @@ -89,6 +94,9 @@ export function getChainConfig(chainIdOrNetwork?: ChainID | Network | null): Cha
case ChainID.OPTIMISM:
case "op":
return optimismChain;
case ChainID.GNOSIS:
case "gnosis":
return gnosisChain;
default:
return;
}
Expand All @@ -112,11 +120,13 @@ export function getChainConfigs(askAll?: boolean) {
zksyncGoerliChain,
mumbaiChain,
polygonChain,
polygonZkEvmChain,
scrollChain,
baseChain,
baseGoerliChain,
bscChain,
optimismChain,
gnosisChain,
].sort((a, b) => a.name.localeCompare(b.name));

if (askAll) {
Expand Down

0 comments on commit 8f68b6d

Please sign in to comment.