Skip to content

Commit

Permalink
Merge pull request #147 from nation3/build/sepolia
Browse files Browse the repository at this point in the history
feat: support sepolia
  • Loading branch information
TTNguyenDev authored Mar 2, 2024
2 parents a992626 + 2da7baa commit 4d699a1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
21 changes: 21 additions & 0 deletions packages/web-app/hooks/useTokenList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ const mainnetTokens = [
},
];

const sepoliaTokens = [
{
name: "Nation3",
symbol: "NATION",
address: "0x23Ca3002706b71a440860E3cf8ff64679A00C9d7",
decimals: 18,
icon: "/tokens/nation3.png",
},
{
name: "Wrapped Ether",
symbol: "WETH",
address: "0x7b79995e5f793a07bc00c21412e50ecae098e7f9",
decimals: 18,
icon: "/tokens/weth.png",
},
];

const empty = {
name: "?",
symbol: "?",
Expand All @@ -48,6 +65,8 @@ export const useTokenList = (): Token[] => {
switch (chain?.id) {
case 1:
return mainnetTokens;
case 11155111:
return sepoliaTokens;
default:
return mainnetTokens;
}
Expand All @@ -63,6 +82,8 @@ export const useFindToken = (tokenSymbol: string): Token => {
switch (chain?.id) {
case 1:
return mainnetTokens.find((token) => token.symbol === tokenSymbol);
case 11155111:
return mainnetTokens.find((token) => token.symbol === tokenSymbol);
default:
return mainnetTokens.find((token) => token.symbol === tokenSymbol);
}
Expand Down
9 changes: 6 additions & 3 deletions packages/web-app/lib/connectors.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { getDefaultWallets } from "@rainbow-me/rainbowkit";
import { providers } from "ethers";
import { Chain, configureChains } from "wagmi";
import { mainnet } from "wagmi/chains";
import { mainnet, sepolia } from "wagmi/chains";
import { publicProvider } from "wagmi/providers/public";

type FallbackProviderConfig = Omit<providers.FallbackProviderConfig, "provider">;

const customAlchemyProvider = ({ priority, stallTimeout, weight }: FallbackProviderConfig) => {
return (chain: Chain) => {
const apiKey = process.env.NEXT_PUBLIC_ALCHEMY_API_KEY; //mainnet
let apiKey = process.env.NEXT_PUBLIC_ALCHEMY_API_KEY;
if (chain?.id == 11155111) {
apiKey = process.env.NEXT_PUBLIC_ALCHEMY_API_KEY_SEPOLIA;
}
if (!apiKey || !chain.rpcUrls.alchemy) return null;

return {
Expand Down Expand Up @@ -49,7 +52,7 @@ export const providersToUse = () => {
};

export const chainsToUse = () => {
return [mainnet];
return [mainnet, sepolia];
};

export const { chains, provider, webSocketProvider } = configureChains(
Expand Down
5 changes: 4 additions & 1 deletion packages/web-app/lib/constants/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { BigNumber } from "ethers";
import * as mainnet from "./mainnet";
import * as sepolia from "./sepolia";

export { mainnet };
export { mainnet, sepolia };

export interface Constants {
permit2Address: `0x${string}`;
Expand All @@ -18,6 +19,8 @@ const constants = (chainId: number) => {
switch (chainId) {
case 1:
return { ...mainnet };
case 11155111:
return { ...sepolia };
default:
return { ...mainnet };
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app/lib/constants/mainnet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
export const NATION = "0x333A4823466879eeF910A04D473505da62142069";
export const frameworkAddress = "0x2e41383506a6715da7dd0985dc401fe720e473c0";
export const arbitratorAddress = "0x1dBEFF62DFa113f7254AaB5772F1AC6E66F94e7e";
export const cohortAddress = "0xee8F0B89983aF83598E6Fb503B9f6e5eaf23b243";
export const cohortAddress = "0xee8F0B89983aF83598E6Fb503B9f6e5eaf23b243"; //GnosisSafeProxy
export const safeTxServiceUrl = "https://safe-transaction-mainnet.safe.global";
export const subgraphURI = process.env.NEXT_PUBLIC_GRAPH_API_URL;
export const appealCost = BigNumber.from("1000000000000000000");
10 changes: 10 additions & 0 deletions packages/web-app/lib/constants/sepolia.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { BigNumber } from "ethers";

export const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
export const NATION = "0x23Ca3002706b71a440860E3cf8ff64679A00C9d7";
export const frameworkAddress = "0xD96aA6e2568f4e9632D2A5234Bb8410ca7609a27";
export const arbitratorAddress = "0xBe67cEdCD1FE38aac8a5781A51250FDeFB344E6C";
export const cohortAddress = "0x2F957C3D949b4e3967E1ddF646614b77BF46057e"; //GnosisSafeProxy
export const safeTxServiceUrl = "https://safe-transaction-sepolia.safe.global";
export const subgraphURI = process.env.NEXT_PUBLIC_GRAPH_API_URL_SEPOLIA;
export const appealCost = BigNumber.from("1000000000000000000");

0 comments on commit 4d699a1

Please sign in to comment.