Skip to content

Commit

Permalink
support scroll usdt
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Nov 8, 2023
1 parent be5125a commit 37bbf74
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 1 deletion.
Binary file added packages/apps/public/images/network/scroll.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/mantle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const mantleChain: ChainConfig = {
cross: [
{ target: { network: "arbitrum", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "zksync", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "scroll", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
],
},
],
Expand Down
43 changes: 43 additions & 0 deletions packages/apps/src/config/chains/scroll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { ChainConfig, ChainID } from "@/types/chain";

export const scrollChain: ChainConfig = {
id: ChainID.SCROLL,
network: "scroll",
name: "Scroll",
logo: "scroll.png",
nativeCurrency: {
name: "ETH",
symbol: "ETH",
decimals: 18,
},
rpcUrls: {
default: {
http: ["https://rpc.scroll.io"],
webSocket: [],
},
public: {
http: ["https://rpc.scroll.io"],
webSocket: [],
},
},
blockExplorers: {
default: {
name: "Scrollscan",
url: "https://scrollscan.com",
},
},
tokens: [
{
decimals: 6,
symbol: "USDT",
name: "USDT",
type: "erc20",
address: "0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df",
logo: "usdt.svg",
cross: [
{ target: { network: "mantle", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "zksync", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
],
},
],
};
1 change: 1 addition & 0 deletions packages/apps/src/config/chains/zksync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const zksyncChain: ChainConfig = {
cross: [
{ target: { network: "arbitrum", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "mantle", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
{ target: { network: "scroll", symbol: "USDT" }, bridge: { category: "lnbridgev20-default" } },
],
},
],
Expand Down
3 changes: 3 additions & 0 deletions packages/apps/src/providers/rainbow-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { darwiniaChain } from "@/config/chains/darwinia";
import { crabChain } from "@/config/chains/crab";
import { polygonChain } from "@/config/chains/polygon";
import { mumbaiChain } from "@/config/chains/mumbai";
import { scrollChain } from "@/config/chains/scroll";

const projectId = process.env.NEXT_PUBLIC_WALLET_CONNECT_ID || "";
const appName = "Helix Bridge";
Expand All @@ -30,6 +31,7 @@ const { tokens: _1, ...darwinia } = darwiniaChain;
const { tokens: _2, ...crab } = crabChain;
const { tokens: _3, ...polygon } = polygonChain;
const { tokens: _4, ...mumbai } = mumbaiChain;
const { tokens: _5, ...scroll } = scrollChain;

export default function RainbowProvider({ children }: PropsWithChildren<unknown>) {
const { chains, publicClient } = configureChains(
Expand All @@ -48,6 +50,7 @@ export default function RainbowProvider({ children }: PropsWithChildren<unknown>
crab,
polygon,
mumbai,
scroll,
],
[publicProvider()],
);
Expand Down
5 changes: 4 additions & 1 deletion packages/apps/src/types/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export enum ChainID {

MUMBAI = 80001,
POLYGON = 137,

SCROLL = 534352,
}

// According to graphql indexer
Expand All @@ -44,7 +46,8 @@ export type Network =
| "mantle"
| "mantle-goerli"
| "polygon"
| "mumbai";
| "mumbai"
| "scroll";

export interface ChainConfig extends Chain {
id: ChainID;
Expand Down
5 changes: 5 additions & 0 deletions packages/apps/src/utils/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ChainConfig, ChainID, Network } from "@/types/chain";
import { isProduction } from "./env";
import { polygonChain } from "@/config/chains/polygon";
import { mumbaiChain } from "@/config/chains/mumbai";
import { scrollChain } from "@/config/chains/scroll";

export function getChainConfig(chainIdOrNetwork?: ChainID | Network | null): ChainConfig | undefined {
switch (chainIdOrNetwork) {
Expand Down Expand Up @@ -67,6 +68,9 @@ export function getChainConfig(chainIdOrNetwork?: ChainID | Network | null): Cha
case ChainID.MUMBAI:
case "mumbai":
return mumbaiChain;
case ChainID.SCROLL:
case "scroll":
return scrollChain;
default:
return;
}
Expand All @@ -90,6 +94,7 @@ export function getChainsConfig() {
zksyncGoerliChain,
mumbaiChain,
polygonChain,
scrollChain,
];

if (isProduction()) {
Expand Down

0 comments on commit 37bbf74

Please sign in to comment.