Skip to content

Commit

Permalink
Merge branch 'main' into fix/round-page-id
Browse files Browse the repository at this point in the history
  • Loading branch information
cristinalare authored May 9, 2024
2 parents 3e331af + 13813a9 commit 2f6dfb7
Show file tree
Hide file tree
Showing 17 changed files with 2,282 additions and 1,318 deletions.
40 changes: 19 additions & 21 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,27 +425,6 @@ export function roundToPassportURLMap(round: Round) {
}
}

const passportLiteRounds = [
//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: "9", chainId: 10 }, // Token Engineering Commons (TEC)
];

export function isRoundUsingPassportLite(round: Round) {
const roundId = round.id;
const chainId = round.chainId;
return passportLiteRounds.some(
(r) => r.roundId === roundId && r.chainId === chainId
);
}

export * from "./allo/transaction-builder";
export type { VotingToken } from "./types";

Expand Down Expand Up @@ -490,3 +469,22 @@ export function isChainIdSupported(chainId: number) {
}
return Object.values(ChainId).includes(chainId);
}

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);
}
6 changes: 4 additions & 2 deletions packages/data-layer/src/data.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ export type Eligibility = {
requirements?: Requirement[];
};

export type SybilDefense = "passport" | "passport-mbds" | "none";

export interface Round {
/**
* The on-chain unique round ID
Expand All @@ -434,7 +436,7 @@ export interface Round {
matchingCapAmount?: number;
minDonationThreshold?: boolean;
minDonationThresholdAmount?: number;
sybilDefense?: boolean;
sybilDefense?: SybilDefense | boolean; // this is to support both old and new sybil defense types.
};
support?: {
type: string;
Expand Down Expand Up @@ -631,7 +633,7 @@ export interface MatchingFunds {

export interface QuadraticFundingConfig {
matchingCap: boolean;
sybilDefense: boolean;
sybilDefense: SybilDefense | boolean;
matchingCapAmount?: number;
minDonationThreshold: boolean;
matchingFundsAvailable: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const collections: CommunityCollection[] = [
},
{
cid: "bafkreifk3ejfp3j6eanuvvoqmp2bgyieuq67eh4kqpuxebegshaqaghu5e",
author: "ThankArb",
name: "Bring ARB Home ",
author: "ArbFan",
name: "Projects building on ARB",
numberOfProjects: 22,
description:
"Think ARB is cool, but never felt like it would really work for you? Take a look at these rounds on Abriturum that you can use to impact your community close to home.",
Expand Down Expand Up @@ -99,6 +99,30 @@ const collections: CommunityCollection[] = [
description:
"Womyn Founders GG20 - 15 impactful Climate/ReFi/Impact projects led and co-led by women #GG20",
},
{
cid: "bafkreigg3kxlj4o4bihbiqp5ngamwas2secavegnfnl24ub6jv3qjkhmb4",
author: "Austin Fatheree",
name: "ICP projects",
numberOfProjects: 2,
description:
"Internet Computer Collection - Projects that are building on the Internet Computer(DFINITY) to scale web3.",
},
{
cid: "bafkreifjrs25nw4pj6t3dmkl54og6bphisszqgbjmg2mej33fpuncxpx4m",
author: "Wasabi",
name: "Lets Grow live Hosts",
numberOfProjects: 41,
description:
"This is a collection that includes all the grantees showing up to make Let's GROW Live 24/7 Broadcast a reality.",
},
{
cid: "bafkreihkao32n3zjfffeuqm5bywgd67toztasrcpabyhrwjurfa7l35rse",
author: "Wasabi",
name: "Critical Infra + Scaling Web3",
numberOfProjects: 45,
description:
"This is a curated collection about long-tail yet critical projects for a massive Web3 Scaling and secure Critical Infrastructure for the Future.",
},
];

export default collections;
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import { ReactComponent as GitcoinPassportLogoFull } from "../../assets/passport
import { ReactComponent as GitcoinPassportLogo } from "../../assets/passport-logo.svg";
import { Dropdown as DropdownIcon } from "common/src/icons/Dropdown";
import { Round } from "data-layer";
import {
ChainId,
isRoundUsingPassportLite,
roundToPassportURLMap,
} from "common";
import { ChainId, roundToPassportURLMap } from "common";
import { PassportShield } from "./PassportShield";

type PassportWidgetProps = {
Expand Down Expand Up @@ -38,7 +34,8 @@ export function PassportWidget({ round, alignment }: PassportWidgetProps) {

return (
<>
{isRoundUsingPassportLite(round) ? (
{round.roundMetadata?.quadraticFundingConfig?.sybilDefense ===
"passport-mbds" ? (
<div title="This round is protected by a combination of Passport’s model-based detection system and specialized donation verification.">
<GitcoinPassportLogo className="h-8 w-8" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const applicationData = {
programContractAddress: "0x8294ea30a691b47bb73e4b64225e52a080dc9ec7",
quadraticFundingConfig: {
matchingCap: true,
sybilDefense: true,
sybilDefense: "passport-mbds",
matchingCapAmount: 7.42,
minDonationThreshold: true,
matchingFundsAvailable: 200000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useAccount } from "wagmi";
import { useCartStorage } from "../../../store";
import { Skeleton } from "@chakra-ui/react";
import { BoltIcon } from "@heroicons/react/24/outline";
import { ChainId, VotingToken, isRoundUsingPassportLite } from "common";
import { ChainId, VotingToken } from "common";
import { getFormattedRoundId } from "../../common/utils/utils";
import { PassportWidget } from "../../common/PassportWidget";

Expand All @@ -29,7 +29,8 @@ export function RoundInCart(
).round;

const isSybilDefenseEnabled =
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense === true;
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense === true ||
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense !== "none";

const minDonationThresholdAmount =
round?.roundMetadata?.quadraticFundingConfig?.minDonationThresholdAmount ??
Expand Down Expand Up @@ -131,13 +132,11 @@ export function RoundInCart(
<div className="p-4 bg-grey-100 rounded-b-xl font-medium text-lg">
<div className="flex flex-row justify-between items-center">
<div>
{address &&
round &&
(isSybilDefenseEnabled || isRoundUsingPassportLite(round)) && (
<div data-testid="passport-widget">
<PassportWidget round={round} alignment="left" />
</div>
)}
{address && round && isSybilDefenseEnabled && (
<div data-testid="passport-widget">
<PassportWidget round={round} alignment="left" />
</div>
)}
</div>
<div className="flex flex-row gap-3 justify-center pt-1 pr-2">
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export default function ViewProjectDetails() {
const round = application && mapApplicationToRound(application);
round && (round.chainId = Number(chainId));
const isSybilDefenseEnabled =
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense === true;
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense === true ||
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense !== "none";

const { grants } = useGap(projectToRender?.projectRegistryId as string);
const { stats } = useOSO(
Expand Down Expand Up @@ -231,7 +232,11 @@ export default function ViewProjectDetails() {
return (
<>
<DefaultLayout>
{isAfterRoundEndDate && <RoundEndedBanner />}
{isAfterRoundEndDate && (
<div className="relative top-6">
<RoundEndedBanner />
</div>
)}
<div className="flex flex-row justify-between my-8">
<div className="flex items-center pt-2" data-testid="bread-crumbs">
<Breadcrumb items={breadCrumbs} />
Expand Down
17 changes: 8 additions & 9 deletions packages/grant-explorer/src/features/round/ViewRoundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
formatUTCDateAsISOString,
getRoundStrategyTitle,
getUTCTime,
isRoundUsingPassportLite,
renderToPlainText,
truncateDescription,
useTokenPrice,
Expand Down Expand Up @@ -213,7 +212,8 @@ function AfterRoundStart(props: {
const [randomizedProjects, setRandomizedProjects] = useState<Project[]>();
const { address: walletAddress } = useAccount();
const isSybilDefenseEnabled =
round.roundMetadata?.quadraticFundingConfig?.sybilDefense === true;
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense === true ||
round?.roundMetadata?.quadraticFundingConfig?.sybilDefense !== "none";

const [showCartNotification, setShowCartNotification] = useState(false);
const [currentProjectAddedToCart, setCurrentProjectAddedToCart] =
Expand Down Expand Up @@ -402,7 +402,7 @@ function AfterRoundStart(props: {
<DefaultLayout>
{showCartNotification && renderCartNotification()}
{props.isAfterRoundEndDate && (
<div className="relative top-16">
<div className="relative top-6">
<RoundEndedBanner />
</div>
)}
Expand All @@ -413,12 +413,11 @@ function AfterRoundStart(props: {
>
<Breadcrumb items={breadCrumbs} />
</div>
{walletAddress &&
(isSybilDefenseEnabled || isRoundUsingPassportLite(round)) && (
<div data-testid="passport-widget">
<PassportWidget round={round} alignment="right" />
</div>
)}
{walletAddress && isSybilDefenseEnabled && (
<div data-testid="passport-widget">
<PassportWidget round={round} alignment="right" />
</div>
)}
</div>

<section>
Expand Down
2 changes: 1 addition & 1 deletion packages/grant-explorer/src/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const makeRoundData = (overrides: Partial<Round> = {}): Round => {
matchingCapAmount: 0,
minDonationThreshold: false,
minDonationThresholdAmount: 0,
sybilDefense: true,
sybilDefense: "passport-mbds",
},
},
store: {
Expand Down
8 changes: 5 additions & 3 deletions packages/round-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,25 @@
"allo-indexer-client": "github:gitcoinco/allo-indexer-client",
"buffer": "^6.0.3",
"common": "workspace:*",
"data-layer": "workspace:*",
"crypto-browserify": "^3.12.0",
"csv-parse": "^5.3.8",
"csv-stringify": "^6.3.2",
"data-layer": "workspace:*",
"date-fns": "^2.29.3",
"deepmerge": "^4.3.1",
"eslint-config-gitcoin": "workspace:*",
"ethers": "^5.7.2",
"gitcoin-lit-js-sdk": "^1.3.1",
"history": "^5.3.0",
"html-react-parser": "^3.0.7",
"https-browserify": "^1.0.0",
"jest-fetch-mock": "^3.0.3",
"jszip": "^3.10.1",
"gitcoin-lit-js-sdk": "^1.3.1",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"moment": "^2.29.3",
"os-browserify": "^0.3.0",
"papaparse": "^5.4.1",
"process": "^0.11.10",
"react": "^18.1.0",
"react-datetime": "^3.1.1",
Expand Down Expand Up @@ -125,15 +126,16 @@
"devDependencies": {
"@faker-js/faker": "^7.4.0",
"@gitcoinco/passport-sdk-types": "^0.1.2",
"@playwright/test": "^1.41.1",
"@rsbuild/core": "^0.4.1",
"@rsbuild/plugin-react": "^0.3.11",
"@rsbuild/plugin-svgr": "^0.3.11",
"@rsdoctor/rspack-plugin": "^0.1.1",
"@playwright/test": "^1.41.1",
"@synthetixio/synpress": "3.7.2-beta.10",
"@tailwindcss/line-clamp": "^0.4.0",
"@typechain/ethers-v5": "10.2.0",
"@types/lodash": "^4.14.192",
"@types/papaparse": "^5.3.14",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@types/react-gtm-module": "^2.0.1",
Expand Down
15 changes: 13 additions & 2 deletions packages/round-manager/src/features/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { RoundVisibilityType } from "common";
import { BigNumber } from "ethers";
import { Address } from "viem";
import { SchemaQuestion } from "./utils";
import { RoundForManager } from "data-layer";
import { RoundForManager, SybilDefense } from "data-layer";

export type Network = "optimism" | "fantom" | "pgn";

Expand Down Expand Up @@ -170,7 +170,7 @@ export interface Round {
matchingCapAmount?: number;
minDonationThreshold?: boolean;
minDonationThresholdAmount?: number;
sybilDefense?: boolean;
sybilDefense?: SybilDefense;
};
support?: {
type: string;
Expand Down Expand Up @@ -465,3 +465,14 @@ export type TransactionBlock = {
transactionBlockNumber: number;
error?: unknown;
};

export type RevisedMatch = {
revisedContributionCount: number;
revisedMatch: bigint;
matched: bigint;
contributionsCount: number;
projectId: string;
applicationId: string;
projectName: string;
payoutAddress: string;
};
Loading

0 comments on commit 2f6dfb7

Please sign in to comment.