Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Base mainnet as a network on Grants Stack #2737

Merged
merged 15 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/builder/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ REACT_APP_SUBGRAPH_PGN_API="https://graph-gitcoin-mainnet.hirenodes.io/subgraphs
REACT_APP_SUBGRAPH_PGN_TESTNET_API="https://graph-gitcoin-testnet.hirenodes.io/subgraphs/name/gitcoin/allo"
REACT_APP_SUBGRAPH_POLYGON_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-polygon"
REACT_APP_SUBGRAPH_POLYGON_MUMBAI_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-mumbai"
REACT_APP_SUBGRAPH_BASE_API="https://api.studio.thegraph.com/query/45391/grants-round-base/v0.0.1"

# Variables below are optional for local development
REACT_APP_DATADOG_APPLICATION_ID=
Expand Down
1 change: 1 addition & 0 deletions packages/builder/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ REACT_APP_SUBGRAPH_PGN_TESTNET_API="https://graph-gitcoin-testnet.hirenodes.io/s
REACT_APP_SUBGRAPH_POLYGON_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-polygon"
REACT_APP_SUBGRAPH_POLYGON_MUMBAI_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-mumbai"
REACT_APP_GRANTS_STACK_SEARCH_API_BASE_URL="https://gitcoin-search-dev.fly.dev"
REACT_APP_SUBGRAPH_BASE_API="https://api.studio.thegraph.com/query/45391/grants-round-base/v0.0.1"

REACT_APP_PINATA_GATEWAY="https://pinata-gateway.com"
REACT_APP_PINATA_JWT="abcedfg"
Expand Down
4 changes: 4 additions & 0 deletions packages/builder/src/contracts/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const chains = {
43113: "fuji",
137: "polygon",
80001: "polygonMumbai",
8453: "base",
} as const;

export type ChainName = (typeof chains)[keyof typeof chains];
Expand Down Expand Up @@ -80,6 +81,9 @@ export const addresses: DeploymentAddressesMap = {
polygonMumbai: {
projectRegistry: "0x545B282A50EaeA01A619914d44105437036CbB36",
},
base: {
projectRegistry: "0xA78Daa89fE9C1eC66c5cB1c5833bC8C6Cb307918",
},
};

export const addressesByChainID = (chainId: ChainId): DeploymentAddresses => {
Expand Down
3 changes: 3 additions & 0 deletions packages/builder/src/utils/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
avalanche,
avalancheFuji,
fantom,
base,
fantomTestnet,
customOptimism,
customPolygon,
Expand All @@ -29,6 +30,7 @@ const availableChains: { [key: string]: Chain } = {
arbitrum,
avalanche,
polygon: customPolygon,
base,
fantomTestnet,
pgnTestnet,
arbitrumGoerli,
Expand Down Expand Up @@ -61,6 +63,7 @@ const productionChains = [
arbitrum,
avalanche,
customPolygon,
base,
];

export function getEnabledChainsAndProviders() {
Expand Down
3 changes: 3 additions & 0 deletions packages/builder/src/utils/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const networkPrettyNames: { [key in ChainName]: string } = {
fuji: "Fuji (Avalanche Testnet)",
polygon: "Polygon PoS",
polygonMumbai: "Polygon Mumbai",
base: "Base",
};

export const networkIcon: { [key in ChainName]: string } = {
Expand All @@ -62,6 +63,7 @@ export const networkIcon: { [key in ChainName]: string } = {
fuji: AVAXIcon,
polygon: POLIcon,
polygonMumbai: POLIcon,
base: EthDiamondGlyph,
};

export const payoutIcon: { [key in ChainName]: string } = {
Expand All @@ -80,6 +82,7 @@ export const payoutIcon: { [key in ChainName]: string } = {
polygonMumbai: POLIcon,
avalanche: AVAXIcon,
fuji: AVAXIcon,
base: EthDiamondGlyph,
};

export function getNetworkIcon(chainId: ChainId): string {
Expand Down
3 changes: 2 additions & 1 deletion packages/common/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ REACT_APP_SUBGRAPH_PGN_API="https://graph-gitcoin-mainnet.hirenodes.io/subgraphs
REACT_APP_SUBGRAPH_PGN_TESTNET_API="https://graph-gitcoin-testnet.hirenodes.io/subgraphs/name/gitcoin/allo"
REACT_APP_SUBGRAPH_POLYGON_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-polygon"
REACT_APP_SUBGRAPH_POLYGON_MUMBAI_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-mumbai"
REACT_APP_GRANTS_STACK_SEARCH_API_BASE_URL="https://gitcoin-search-dev.fly.dev"
REACT_APP_GRANTS_STACK_SEARCH_API_BASE_URL="https://gitcoin-search-dev.fly.dev"
REACT_APP_SUBGRAPH_BASE_API="https://api.studio.thegraph.com/query/45391/grants-round-base/v0.0.1"
1 change: 1 addition & 0 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@ethersproject/providers": "^5.7.2",
"@rainbow-me/rainbowkit": "^0.12.16",
"@wagmi/chains": "^1.8.0",
"data-layer": "workspace:*",
"dompurify": "^2.4.3",
"ethers": "^5.6.5",
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/chain-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum ChainId {
FUJI = 43113,
POLYGON = 137,
POLYGON_MUMBAI = 80001,
BASE = 8453,
DEV1 = 313371,
DEV2 = 313372,
}
15 changes: 14 additions & 1 deletion packages/common/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
avalancheFuji as avalancheFujiOriginal,
fantom as fantomOriginal,
fantomTestnet as fantomTestnetOriginal,
} from "wagmi/chains";
base as baseOriginal,
} from "@wagmi/chains";
import FantomFTMLogo from "./assets/fantom-ftm-logo.png";
import { ChainId } from "./chain-ids";
import { getConfig } from "./config";
Expand Down Expand Up @@ -50,6 +51,18 @@ export const avalancheFuji: Chain = {
},
};

export const base: Chain = {
...baseOriginal,
rpcUrls: {
default: {
http: ["https://mainnet.base.org/"],
},
public: {
http: ["https://mainnet.base.org/"],
},
},
};

export const avalanche: Chain = {
...avalancheOriginal,
rpcUrls: {
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export function getConfig(): Config {
[ChainId.POLYGON_MUMBAI]: z
.string()
.parse(process.env.REACT_APP_SUBGRAPH_POLYGON_MUMBAI_API),
[ChainId.BASE]: z
.string()
.parse(process.env.REACT_APP_SUBGRAPH_BASE_API),
},
},
pinata: {
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export const graphQlEndpoints: Record<ChainId, string> = {
[ChainId.AVALANCHE]: process.env.REACT_APP_SUBGRAPH_AVALANCHE_API!,
[ChainId.POLYGON]: process.env.REACT_APP_SUBGRAPH_POLYGON_API!,
[ChainId.POLYGON_MUMBAI]: process.env.REACT_APP_SUBGRAPH_POLYGON_MUMBAI_API!,
[ChainId.BASE]: process.env.REACT_APP_SUBGRAPH_BASE_API!,
};

/**
Expand Down
1 change: 1 addition & 0 deletions packages/grant-explorer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ REACT_APP_SUBGRAPH_PGN_API="https://graph-gitcoin-mainnet.hirenodes.io/subgraphs
REACT_APP_SUBGRAPH_PGN_TESTNET_API="https://graph-gitcoin-testnet.hirenodes.io/subgraphs/name/gitcoin/allo"
REACT_APP_SUBGRAPH_POLYGON_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-polygon"
REACT_APP_SUBGRAPH_POLYGON_MUMBAI_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-mumbai"
REACT_APP_SUBGRAPH_BASE_API="https://api.studio.thegraph.com/query/45391/grants-round-base/v0.0.1"

# Variables below are optional for local development
REACT_APP_DATADOG_APPLICATION_ID=
Expand Down
1 change: 1 addition & 0 deletions packages/grant-explorer/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ REACT_APP_SUBGRAPH_POLYGON_API="https://api.thegraph.com/subgraphs/name/allo-pro
REACT_APP_SUBGRAPH_POLYGON_MUMBAI_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-mumbai"
REACT_APP_GRANTS_STACK_SEARCH_API_BASE_URL="https://gitcoin-search-dev.fly.dev"
REACT_APP_ENV="test"
REACT_APP_SUBGRAPH_BASE_API="https://api.studio.thegraph.com/query/45391/grants-round-base/v0.0.1"
3 changes: 2 additions & 1 deletion packages/grant-explorer/src/app/chainConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
polygonMumbai,
} from "wagmi/chains";
import { arbitrum, arbitrumGoerli } from "viem/chains";
import { pgnTestnet, pgn } from "common/src/chains";
import { pgnTestnet, pgn, base } from "common/src/chains";
import { ChainId } from "common/src/chain-ids";

const ensureValidChainId = (chain: Chain) => {
Expand All @@ -36,6 +36,7 @@ const MAINNET_CHAINS = [
arbitrum,
avalanche,
polygon,
base,
{ ...fantom, iconUrl: "/logos/fantom-logo.svg" },
].map(ensureValidChainId);

Expand Down
1 change: 1 addition & 0 deletions packages/grant-explorer/src/features/api/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export const MRC_CONTRACTS: Record<ChainId, Hex> = {
[ChainId.AVALANCHE]: "0xe04d9e9CcDf65EB1Db51E56C04beE4c8582edB73",
[ChainId.POLYGON]: "0xe04d9e9CcDf65EB1Db51E56C04beE4c8582edB73",
[ChainId.POLYGON_MUMBAI]: "0x8e1bD5Da87C14dd8e08F7ecc2aBf9D1d558ea174",
[ChainId.BASE]: "0x7C24f3494CC958CF268a92b45D7e54310d161794",
};
32 changes: 32 additions & 0 deletions packages/grant-explorer/src/features/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ export const CHAINS: Record<
name: "Polygon Mumbai",
logo: "./logos/pol-logo.svg",
},
[ChainId.BASE]: {
id: ChainId.BASE,
name: "Base",
logo: "./logos/ethereum-eth-logo.svg",
},
};

export const TokenNamesAndLogos = {
Expand Down Expand Up @@ -274,6 +279,29 @@ const PGN_MAINNET_TOKENS: VotingToken[] = [
},
];

const BASE_TOKENS: VotingToken[] = [
{
name: "ETH",
chainId: ChainId.BASE,
address: zeroAddress,
decimal: 18,
logo: TokenNamesAndLogos["ETH"],
redstoneTokenId: RedstoneTokenIds["ETH"],
defaultForVoting: true,
canVote: true,
},
{
name: "USDC",
chainId: ChainId.BASE,
address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
decimal: 6,
logo: TokenNamesAndLogos["USDC"],
redstoneTokenId: RedstoneTokenIds["USDC"],
defaultForVoting: false,
canVote: true,
},
];

const ARBITRUM_TOKENS: VotingToken[] = [
{
name: "ETH",
Expand Down Expand Up @@ -430,6 +458,7 @@ export const votingTokens = [
...FUJI_TOKENS,
...POLYGON_TOKENS,
...POLYGON_MUMBAI_TOKENS,
...BASE_TOKENS,
];

type VotingTokensMap = Record<ChainId, VotingToken[]>;
Expand All @@ -450,6 +479,7 @@ export const votingTokensMap: VotingTokensMap = {
[ChainId.FUJI]: FUJI_TOKENS,
[ChainId.POLYGON]: POLYGON_TOKENS,
[ChainId.POLYGON_MUMBAI]: POLYGON_MUMBAI_TOKENS,
[ChainId.BASE]: BASE_TOKENS,
};

export const getVotingTokenOptions = (chainId: ChainId): VotingToken[] =>
Expand Down Expand Up @@ -480,6 +510,7 @@ export const txExplorerLinks: Record<ChainId, string> = {
[ChainId.POLYGON_MUMBAI]: "https://mumbai.polygonscan.com/tx/",
[ChainId.FUJI]: "https://snowtrace.io/tx/",
[ChainId.AVALANCHE]: "https://testnet.snowtrace.io/txt/",
[ChainId.BASE]: "https://basescan.org/tx/",
};

/**
Expand Down Expand Up @@ -635,6 +666,7 @@ export function getChainIds(): number[] {
Number(ChainId.ARBITRUM),
Number(ChainId.AVALANCHE),
Number(ChainId.POLYGON),
Number(ChainId.BASE),
];
} else {
return Object.values(ChainId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("useFilterRounds", () => {

await waitFor(() => sleep(100));

expect(result?.current.data?.length).toBe(MOCKED_ROUNDS * 7);
expect(result?.current.data?.length).toBe(MOCKED_ROUNDS * 8);
});
it("filterRoundsWithProjects", async () => {
expect(filterRoundsWithProjects([mockedRounds[0]]).length).toBe(1);
Expand Down
3 changes: 2 additions & 1 deletion packages/round-manager/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ REACT_APP_SUBGRAPH_PGN_API="https://graph-gitcoin-mainnet.hirenodes.io/subgraphs
REACT_APP_SUBGRAPH_PGN_TESTNET_API="https://graph-gitcoin-testnet.hirenodes.io/subgraphs/name/gitcoin/allo"
REACT_APP_SUBGRAPH_POLYGON_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-polygon"
REACT_APP_SUBGRAPH_POLYGON_MUMBAI_API="https://api.thegraph.com/subgraphs/name/allo-protocol/grants-round-mumbai"
REACT_APP_GRANTS_STACK_SEARCH_API_BASE_URL="https://gitcoin-search-dev.fly.dev"
REACT_APP_GRANTS_STACK_SEARCH_API_BASE_URL="https://gitcoin-search-dev.fly.dev"
REACT_APP_SUBGRAPH_BASE_API="https://api.studio.thegraph.com/query/45391/grants-round-base/v0.0.1"
3 changes: 2 additions & 1 deletion packages/round-manager/src/app/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
polygonMumbai,
} from "wagmi/chains";

import { pgn, pgnTestnet } from "common/src/chains";
import { pgn, pgnTestnet, base } from "common/src/chains";
import { publicProvider } from "wagmi/providers/public";
import { infuraProvider } from "wagmi/providers/infura";
import { alchemyProvider } from "wagmi/providers/alchemy";
Expand All @@ -45,6 +45,7 @@ const mainnetChains = () => {
arbitrum,
avalanche,
polygon,
base,
{ ...fantom, iconUrl: "/logos/fantom-logo.svg" },
];
};
Expand Down
11 changes: 11 additions & 0 deletions packages/round-manager/src/features/api/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const projectRegistryMap: ChainIdToStringMap = {
[ChainId.AVALANCHE]: "0xDF9BF58Aa1A1B73F0e214d79C652a7dd37a6074e",
[ChainId.POLYGON]: "0x5C5E2D94b107C7691B08E43169fDe76EAAB6D48b",
[ChainId.POLYGON_MUMBAI]: "0x545B282A50EaeA01A619914d44105437036CbB36",
[ChainId.BASE]: "0xA78Daa89fE9C1eC66c5cB1c5833bC8C6Cb307918",
};

/* GrantHub's ProjectRegistry */
Expand Down Expand Up @@ -66,6 +67,7 @@ const programFactoryMap: ChainIdToStringMap = {
[ChainId.AVALANCHE]: "0xd07D54b0231088Ca9BF7DA6291c911B885cBC140",
[ChainId.POLYGON]: "0xF7c101A95Ea4cBD5DA0Ab9827D7B2C9857440143",
[ChainId.POLYGON_MUMBAI]: "0xDF9BF58Aa1A1B73F0e214d79C652a7dd37a6074e",
[ChainId.BASE]: "0xDF9BF58Aa1A1B73F0e214d79C652a7dd37a6074e",
};
/* ProgramFactory */
export const programFactoryContract = (chainId: ChainId): Contract => {
Expand Down Expand Up @@ -96,6 +98,7 @@ const roundFactoryMap: ChainIdToStringMap = {
[ChainId.AVALANCHE]: "0x8eC471f30cA797FD52F9D37A47Be2517a7BD6912",
[ChainId.POLYGON]: "0x5ab68dCdcA37A1C2b09c5218e28eB0d9cc3FEb03",
[ChainId.POLYGON_MUMBAI]: "0xE1c5812e9831bc1d5BDcF50AAEc1a47C4508F3fA",
[ChainId.BASE]: "0xc7722909fEBf7880E15e67d563E2736D9Bb9c1Ab",
};
/* RoundFactory */
export const roundFactoryContract = (
Expand Down Expand Up @@ -133,6 +136,7 @@ const qfVotingStrategyFactoryMap: ChainIdToStringMap = {
[ChainId.AVALANCHE]: "0x2AFA4bE0f2468347A2F086c2167630fb1E58b725",
[ChainId.POLYGON]: "0xc1a26b0789C3E93b07713e90596Cad8d0442C826",
[ChainId.POLYGON_MUMBAI]: "0xF7c101A95Ea4cBD5DA0Ab9827D7B2C9857440143",
[ChainId.BASE]: "0xC3A195EEa198e74D67671732E1B8F8A23781D735",
};
/* QuadraticFundingVotingStrategy */
export const qfVotingStrategyFactoryContract = (
Expand Down Expand Up @@ -206,6 +210,10 @@ export const dgVotingStrategyDummyContract = (chainId: ChainId): string => {
address = "0xA78Daa89fE9C1eC66c5cB1c5833bC8C6Cb307918";
break;
}
case ChainId.BASE: {
address = "0x73AB205af1476Dc22104A6B8b3d4c273B58C6E27";
break;
}
default: {
address = "0x717A2cCDD81944e64c8BD9BB1D179A241dE14B46";
break;
Expand Down Expand Up @@ -236,6 +244,7 @@ const merklePayoutStrategyFactoryMap: ChainIdToStringMap = {
[ChainId.AVALANCHE]: "0x27efa1C90e097c980c669AB1a6e326AD4164f1Cb",
[ChainId.POLYGON]: "0xD0e19DBF9b896199F35Df255A1bf8dB3C787531c",
[ChainId.POLYGON_MUMBAI]: "0xc1a26b0789C3E93b07713e90596Cad8d0442C826",
[ChainId.BASE]: "0xF7c101A95Ea4cBD5DA0Ab9827D7B2C9857440143",
};
export const merklePayoutStrategyFactoryContract = (
chainId: ChainId
Expand Down Expand Up @@ -268,6 +277,7 @@ const alloSettingsContractMap: ChainIdToStringMap = {
[ChainId.AVALANCHE]: "",
[ChainId.POLYGON]: "",
[ChainId.POLYGON_MUMBAI]: "",
[ChainId.BASE]: "",
};

/* AlloSettingsContract */
Expand Down Expand Up @@ -301,6 +311,7 @@ const directPayoutStrategyFactoryContractMap: ChainIdToStringMap = {
[ChainId.AVALANCHE]: "0x8AdFcF226dfb2fA73788Ad711C958Ba251369cb3",
[ChainId.POLYGON]: "0xF2a07728107B04266015E67b1468cA0a536956C8",
[ChainId.POLYGON_MUMBAI]: "0xD9B7Ce1F68A93dF783A8519ed52b74f5DcF5AFE1",
[ChainId.BASE]: "0x74c3665540FC8B92Dd06a7e56a51eCa038C18180",
};

/* DirectPayoutStrategyFactoryContract */
Expand Down
Loading