Skip to content

Commit 1806aad

Browse files
Merge pull request #3611 from gitcoinco/fetch-da-chain-data
feat: fetch direct donation contracts from chain data package
2 parents 3e40e73 + b76062c commit 1806aad

File tree

6 files changed

+16
-95
lines changed

6 files changed

+16
-95
lines changed

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@allo-team/allo-v2-sdk": "^1.0.78",
2020
"@ethersproject/abstract-signer": "^5.7.0",
2121
"@ethersproject/providers": "^5.7.2",
22-
"@gitcoin/gitcoin-chain-data": "^1.0.33",
22+
"@gitcoin/gitcoin-chain-data": "^1.0.34",
2323
"@gitcoinco/passport-sdk-types": "^0.2.0",
2424
"@openzeppelin/merkle-tree": "^1.0.2",
2525
"@rainbow-me/rainbowkit": "2.1.2",

packages/common/src/allo/backends/allo-v2.ts

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -83,67 +83,6 @@ export function getAlloAddress(chainId: number) {
8383
return allo.address();
8484
}
8585

86-
export function getDirectAllocationPoolId(chainId: number) {
87-
switch (chainId) {
88-
case 11155111:
89-
return 386;
90-
case 10:
91-
return 58;
92-
case 42161:
93-
return 390;
94-
case 42220:
95-
return 12;
96-
case 8453:
97-
return 36;
98-
case 43114:
99-
return 15;
100-
case 534352:
101-
case 534353:
102-
return 22;
103-
case 250:
104-
return 4;
105-
case 1:
106-
return 11;
107-
case 1329:
108-
case 808:
109-
return 8;
110-
case 42:
111-
return 3;
112-
case 1088:
113-
return 1;
114-
default:
115-
return undefined;
116-
}
117-
}
118-
119-
export function getDirectAllocationStrategyAddress(chainId: number) {
120-
// This should be the strategy address, once the pool is created
121-
switch (chainId) {
122-
case 11155111:
123-
return "0xd60BCfa8714949c478d88da51A7450703A32Cf35";
124-
case 10:
125-
return "0x91ad709fe04e214ef53218572d8d8690a8b4fdd0";
126-
case 42161:
127-
return "0x91ad709fe04e214ef53218572d8d8690a8b4fdd0";
128-
case 42220:
129-
return "0x9da0a7978b7bd826e06800427cbf1ec1200393e3";
130-
case 8453:
131-
return "0xef78f18f49dea8b8a5caa41633bb50b0666d40f1";
132-
case 43114:
133-
return "0xcdf62dd1f9f9f412485dba39b491af9e09d81652";
134-
case 250:
135-
return "0xf4ad959b0eceab17648cb964c3a1feadba8a5053";
136-
case 1:
137-
return "0xef78f18f49dea8b8a5caa41633bb50b0666d40f1";
138-
case 42:
139-
return "0x471168a823d909fd3ffa5641757d9bb83ba5e35c";
140-
case 1088:
141-
return "0xef78f18f49dea8b8a5caa41633bb50b0666d40f1";
142-
default:
143-
return undefined;
144-
}
145-
}
146-
14786
export class AlloV2 implements Allo {
14887
private transactionSender: TransactionSender;
14988
private ipfsUploader: IpfsUploader;
@@ -1586,7 +1525,8 @@ export class AlloV2 implements Allo {
15861525
poolId: poolId,
15871526
});
15881527

1589-
const strategyAddress = getDirectAllocationStrategyAddress(this.chainId);
1528+
const strategyAddress = getChainById(this.chainId).contracts
1529+
.directAllocationStrategyAddress;
15901530

15911531
if (strategyAddress === undefined) {
15921532
return error(new AlloError("Direct allocation strategy not found"));

packages/common/src/index.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -477,25 +477,6 @@ export function isChainIdSupported(chainId: number) {
477477
return getChainById(chainId) !== undefined;
478478
}
479479

480-
const gg20Rounds = [
481-
//GG20 rounds
482-
{ roundId: "23", chainId: 42161 }, // Hackathon Alumni
483-
{ roundId: "24", chainId: 42161 }, // ENS
484-
{ roundId: "25", chainId: 42161 }, // dApps & Apps
485-
{ roundId: "26", chainId: 42161 }, // WEB3 Infrastructure
486-
{ roundId: "27", chainId: 42161 }, // Developer Tooling
487-
{ roundId: "28", chainId: 42161 }, // Hypercerts Ecosystem
488-
{ roundId: "29", chainId: 42161 }, // Climate Solutions
489-
{ roundId: "31", chainId: 42161 }, // Open Civics
490-
{ roundId: "36", chainId: 42161 }, // Regenerative Land Projects
491-
{ roundId: "39", chainId: 42161 }, // DeSci
492-
{ roundId: "9", chainId: 10 }, // Token Engineering Commons (TEC)
493-
];
494-
495-
export function isGG20Round(roundId: string, chainId: number) {
496-
return gg20Rounds.some((r) => r.roundId === roundId && r.chainId === chainId);
497-
}
498-
499480
export function isLitUnavailable(chainId: number) {
500481
return [
501482
4201, // LUKSO_TESTNET,

packages/grant-explorer/src/features/projects/ViewProject.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import { getVotingTokenOptions } from "../api/utils";
4747
import ErrorModal from "../common/ErrorModal";
4848
import ProgressModal, { errorModalDelayMs } from "../common/ProgressModal";
4949
import { useDirectAllocation } from "./hooks/useDirectAllocation";
50-
import { getDirectAllocationPoolId } from "common/dist/allo/backends/allo-v2";
5150
import { Address, getAddress, zeroAddress } from "viem";
5251
import GenericModal from "../common/GenericModal";
5352
import { InformationCircleIcon } from "@heroicons/react/24/outline";
@@ -105,7 +104,8 @@ export default function ViewProject() {
105104
const [tokenBalances, setTokenBalances] = useState<
106105
{ token: Address; balance: bigint }[]
107106
>([]);
108-
const directAllocationPoolId = getDirectAllocationPoolId(chainId ?? 1);
107+
const directAllocationPoolId = getChainById(chainId ?? 1).contracts
108+
.directAllocationPoolId;
109109
const [transactionReplaced, setTransactionReplaced] = useState(false);
110110
const { projectId } = useParams();
111111

@@ -455,7 +455,8 @@ export default function ViewProject() {
455455
if (
456456
directDonationAmount === undefined ||
457457
allo === null ||
458-
payoutToken === undefined
458+
payoutToken === undefined ||
459+
directAllocationPoolId === undefined
459460
) {
460461
return;
461462
}
@@ -466,7 +467,7 @@ export default function ViewProject() {
466467
try {
467468
let requireTokenApproval = false;
468469

469-
const poolId = getDirectAllocationPoolId(chainId ?? 1)?.toString();
470+
const poolId = directAllocationPoolId.toString();
470471

471472
const recipient = project?.roles?.filter(
472473
(role) => role.role === "OWNER"

packages/round-manager/src/features/round/ViewRoundResults/ViewRoundResults.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
UploadIcon,
99
} from "@heroicons/react/solid";
1010
import { useDropzone } from "react-dropzone";
11-
import { classNames, isGG20Round, getPayoutTokens, TToken } from "common";
11+
import { classNames, getPayoutTokens, TToken } from "common";
1212
import { Button } from "common/src/styles";
1313
import { useDebugMode, useRoundMatchingFunds } from "../../../hooks";
1414
import {
@@ -384,9 +384,8 @@ function ViewRoundResults({
384384

385385
const disableRoundSaturationControls = Math.round(roundSaturation) >= 100;
386386

387-
const sybilDefense = isGG20Round(round.id, chain.id)
388-
? "passport-mbds"
389-
: round.roundMetadata?.quadraticFundingConfig?.sybilDefense;
387+
const sybilDefense =
388+
round.roundMetadata?.quadraticFundingConfig?.sybilDefense;
390389

391390
const isCustomResults =
392391
(sybilDefense === "passport-mbds" && isRecommendedDistribution) ||

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)