diff --git a/packages/common/package.json b/packages/common/package.json index 3443df139f..296a2b2c08 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -19,7 +19,7 @@ "@allo-team/allo-v2-sdk": "^1.0.78", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/providers": "^5.7.2", - "@gitcoin/gitcoin-chain-data": "^1.0.33", + "@gitcoin/gitcoin-chain-data": "^1.0.34", "@gitcoinco/passport-sdk-types": "^0.2.0", "@openzeppelin/merkle-tree": "^1.0.2", "@rainbow-me/rainbowkit": "2.1.2", diff --git a/packages/common/src/allo/backends/allo-v2.ts b/packages/common/src/allo/backends/allo-v2.ts index 3771f45261..17a10886af 100644 --- a/packages/common/src/allo/backends/allo-v2.ts +++ b/packages/common/src/allo/backends/allo-v2.ts @@ -83,67 +83,6 @@ export function getAlloAddress(chainId: number) { return allo.address(); } -export function getDirectAllocationPoolId(chainId: number) { - switch (chainId) { - case 11155111: - return 386; - case 10: - return 58; - case 42161: - return 390; - case 42220: - return 12; - case 8453: - return 36; - case 43114: - return 15; - case 534352: - case 534353: - return 22; - case 250: - return 4; - case 1: - return 11; - case 1329: - case 808: - return 8; - case 42: - return 3; - case 1088: - return 1; - default: - return undefined; - } -} - -export function getDirectAllocationStrategyAddress(chainId: number) { - // This should be the strategy address, once the pool is created - switch (chainId) { - case 11155111: - return "0xd60BCfa8714949c478d88da51A7450703A32Cf35"; - case 10: - return "0x91ad709fe04e214ef53218572d8d8690a8b4fdd0"; - case 42161: - return "0x91ad709fe04e214ef53218572d8d8690a8b4fdd0"; - case 42220: - return "0x9da0a7978b7bd826e06800427cbf1ec1200393e3"; - case 8453: - return "0xef78f18f49dea8b8a5caa41633bb50b0666d40f1"; - case 43114: - return "0xcdf62dd1f9f9f412485dba39b491af9e09d81652"; - case 250: - return "0xf4ad959b0eceab17648cb964c3a1feadba8a5053"; - case 1: - return "0xef78f18f49dea8b8a5caa41633bb50b0666d40f1"; - case 42: - return "0x471168a823d909fd3ffa5641757d9bb83ba5e35c"; - case 1088: - return "0xef78f18f49dea8b8a5caa41633bb50b0666d40f1"; - default: - return undefined; - } -} - export class AlloV2 implements Allo { private transactionSender: TransactionSender; private ipfsUploader: IpfsUploader; @@ -1586,7 +1525,8 @@ export class AlloV2 implements Allo { poolId: poolId, }); - const strategyAddress = getDirectAllocationStrategyAddress(this.chainId); + const strategyAddress = getChainById(this.chainId).contracts + .directAllocationStrategyAddress; if (strategyAddress === undefined) { return error(new AlloError("Direct allocation strategy not found")); diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index b13f0e6ce4..f4d09bc85c 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -477,25 +477,6 @@ export function isChainIdSupported(chainId: number) { return getChainById(chainId) !== undefined; } -const gg20Rounds = [ - //GG20 rounds - { roundId: "23", chainId: 42161 }, // Hackathon Alumni - { roundId: "24", chainId: 42161 }, // ENS - { roundId: "25", chainId: 42161 }, // dApps & Apps - { roundId: "26", chainId: 42161 }, // WEB3 Infrastructure - { roundId: "27", chainId: 42161 }, // Developer Tooling - { roundId: "28", chainId: 42161 }, // Hypercerts Ecosystem - { roundId: "29", chainId: 42161 }, // Climate Solutions - { roundId: "31", chainId: 42161 }, // Open Civics - { roundId: "36", chainId: 42161 }, // Regenerative Land Projects - { roundId: "39", chainId: 42161 }, // DeSci - { roundId: "9", chainId: 10 }, // Token Engineering Commons (TEC) -]; - -export function isGG20Round(roundId: string, chainId: number) { - return gg20Rounds.some((r) => r.roundId === roundId && r.chainId === chainId); -} - export function isLitUnavailable(chainId: number) { return [ 4201, // LUKSO_TESTNET, diff --git a/packages/grant-explorer/src/features/projects/ViewProject.tsx b/packages/grant-explorer/src/features/projects/ViewProject.tsx index 3ba5496693..9752e7eefc 100644 --- a/packages/grant-explorer/src/features/projects/ViewProject.tsx +++ b/packages/grant-explorer/src/features/projects/ViewProject.tsx @@ -47,7 +47,6 @@ import { getVotingTokenOptions } from "../api/utils"; import ErrorModal from "../common/ErrorModal"; import ProgressModal, { errorModalDelayMs } from "../common/ProgressModal"; import { useDirectAllocation } from "./hooks/useDirectAllocation"; -import { getDirectAllocationPoolId } from "common/dist/allo/backends/allo-v2"; import { Address, getAddress, zeroAddress } from "viem"; import GenericModal from "../common/GenericModal"; import { InformationCircleIcon } from "@heroicons/react/24/outline"; @@ -105,7 +104,8 @@ export default function ViewProject() { const [tokenBalances, setTokenBalances] = useState< { token: Address; balance: bigint }[] >([]); - const directAllocationPoolId = getDirectAllocationPoolId(chainId ?? 1); + const directAllocationPoolId = getChainById(chainId ?? 1).contracts + .directAllocationPoolId; const [transactionReplaced, setTransactionReplaced] = useState(false); const { projectId } = useParams(); @@ -455,7 +455,8 @@ export default function ViewProject() { if ( directDonationAmount === undefined || allo === null || - payoutToken === undefined + payoutToken === undefined || + directAllocationPoolId === undefined ) { return; } @@ -466,7 +467,7 @@ export default function ViewProject() { try { let requireTokenApproval = false; - const poolId = getDirectAllocationPoolId(chainId ?? 1)?.toString(); + const poolId = directAllocationPoolId.toString(); const recipient = project?.roles?.filter( (role) => role.role === "OWNER" diff --git a/packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx b/packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx index 7dcb2b4359..b4c3e03851 100644 --- a/packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx +++ b/packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx @@ -8,7 +8,7 @@ import { UploadIcon, } from "@heroicons/react/solid"; import { useDropzone } from "react-dropzone"; -import { classNames, isGG20Round, getPayoutTokens, TToken } from "common"; +import { classNames, getPayoutTokens, TToken } from "common"; import { Button } from "common/src/styles"; import { useDebugMode, useRoundMatchingFunds } from "../../../hooks"; import { @@ -384,9 +384,8 @@ function ViewRoundResults({ const disableRoundSaturationControls = Math.round(roundSaturation) >= 100; - const sybilDefense = isGG20Round(round.id, chain.id) - ? "passport-mbds" - : round.roundMetadata?.quadraticFundingConfig?.sybilDefense; + const sybilDefense = + round.roundMetadata?.quadraticFundingConfig?.sybilDefense; const isCustomResults = (sybilDefense === "passport-mbds" && isRecommendedDistribution) || diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af25d3e43d..a0b94c9f60 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -380,8 +380,8 @@ importers: specifier: ^5.7.2 version: 5.7.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@gitcoin/gitcoin-chain-data': - specifier: ^1.0.33 - version: 1.0.33(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.8) + specifier: ^1.0.34 + version: 1.0.34(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.8) '@gitcoinco/passport-sdk-types': specifier: ^0.2.0 version: 0.2.0 @@ -3319,8 +3319,8 @@ packages: '@foundry-rs/easy-foundryup@0.1.3': resolution: {integrity: sha512-Funb4hrSBeikKCmccFT/d3Ud5o92tlIZHTJeMCVk5b54/+CHZHr4g7MmtvO5xrGhxrOebQ0L+ojIj+VixgW7ug==} - '@gitcoin/gitcoin-chain-data@1.0.33': - resolution: {integrity: sha512-ihyGB444GlM+2OrPHaGpO8t8hwO9ltZPSxHqdj8/n5XaiXIilIK96pTg/VvyfH1qaRS3NyZBYZn2oTK0AlwYcA==} + '@gitcoin/gitcoin-chain-data@1.0.34': + resolution: {integrity: sha512-7KZmz/hFOfKhRgnKYiIZ7QGazpiETNpKn+cGC/sntjaoV25N2zoESeVsiTwhqlsS6X1ajyuE4d4xjSgsoUoVCg==} engines: {node: '>=16.15.0', npm: '>=8.5.5'} peerDependencies: typescript: ^5.0.0 @@ -18181,7 +18181,7 @@ snapshots: command-exists: 1.2.9 ts-interface-checker: 0.1.13 - '@gitcoin/gitcoin-chain-data@1.0.33(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.8)': + '@gitcoin/gitcoin-chain-data@1.0.34(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.8)': dependencies: typescript: 5.4.5 viem: 2.13.10(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.8)