From df06ee9c79bc05e54d94696b52ee99b504322ea5 Mon Sep 17 00:00:00 2001 From: ctrlc03 <93448202+ctrlc03@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:01:43 +0100 Subject: [PATCH] chore: convert project to monorepo and add coordinator service --- .eslintignore | 8 +- .eslintrc.js | 101 +- .github/scripts/build.sh | 16 + .github/scripts/deploy.sh | 13 + .github/workflows/checks.yml | 4 +- .github/workflows/commitlint.yml | 2 +- .github/workflows/coordinator-build.yml | 114 + .github/workflows/coordinator-deploy.yml | 37 + .github/workflows/e2e.yml | 5 +- .gitignore | 16 +- README.md | 79 +- lerna.json | 47 + package.json | 182 +- packages/coordinator/.env.example | 48 + packages/coordinator/.eslintrc.js | 32 + packages/coordinator/.gitignore | 6 + packages/coordinator/README.md | 43 + packages/coordinator/apps/Dockerfile | 33 + packages/coordinator/hardhat.config.js | 33 + packages/coordinator/nest-cli.json | 8 + packages/coordinator/package.json | 95 + packages/coordinator/scripts/downloadZKeys.ts | 42 + .../coordinator/scripts/generateKeypair.ts | 25 + packages/coordinator/tests/app.test.ts | 903 + packages/coordinator/ts/app.module.ts | 23 + .../ts/auth/AccountSignatureGuard.service.ts | 103 + .../__tests__/AccountSignatureGuard.test.ts | 163 + packages/coordinator/ts/common/errors.ts | 13 + packages/coordinator/ts/common/index.ts | 2 + packages/coordinator/ts/common/networks.ts | 64 + .../crypto/__tests__/crypto.service.test.ts | 41 + .../coordinator/ts/crypto/crypto.module.ts | 9 + .../coordinator/ts/crypto/crypto.service.ts | 59 + .../ts/file/__tests__/file.service.test.ts | 87 + packages/coordinator/ts/file/file.module.ts | 9 + packages/coordinator/ts/file/file.service.ts | 81 + packages/coordinator/ts/file/types.ts | 39 + packages/coordinator/ts/jest/setup.ts | 9 + packages/coordinator/ts/jest/transform.js | 9 + packages/coordinator/ts/main.ts | 45 + .../proof/__tests__/proof.controller.test.ts | 101 + .../ts/proof/__tests__/proof.gateway.test.ts | 84 + .../ts/proof/__tests__/proof.service.test.ts | 180 + packages/coordinator/ts/proof/dto.ts | 103 + .../coordinator/ts/proof/proof.controller.ts | 68 + .../coordinator/ts/proof/proof.gateway.ts | 77 + packages/coordinator/ts/proof/proof.module.ts | 15 + .../coordinator/ts/proof/proof.service.ts | 173 + packages/coordinator/ts/proof/types.ts | 92 + .../__tests__/subgraph.controller.test.ts | 66 + .../__tests__/subgraph.gateway.test.ts | 106 + .../__tests__/subgraph.service.test.ts | 90 + packages/coordinator/ts/subgraph/dto.ts | 68 + .../ts/subgraph/subgraph.controller.ts | 44 + .../ts/subgraph/subgraph.gateway.ts | 76 + .../ts/subgraph/subgraph.module.ts | 15 + .../ts/subgraph/subgraph.service.ts | 126 + packages/coordinator/ts/subgraph/types.ts | 106 + packages/coordinator/tsconfig.build.json | 11 + packages/coordinator/tsconfig.json | 10 + .../interface/.env.example | 0 packages/interface/.eslintignore | 15 + packages/interface/.eslintrc.js | 185 + .npmrc => packages/interface/.npmrc | 0 LICENSE => packages/interface/LICENSE | 0 packages/interface/README.md | 41 + .../interface/e2e}/connectWallet.test.ts | 2 + .../interface/next.config.js | 0 packages/interface/package.json | 152 + .../interface/playwright.config.ts | 0 .../interface/playwright}/constants.ts | 0 .../interface/playwright}/fixtures.ts | 0 .../interface/playwright}/types.d.ts | 0 .../interface/postcss.config.cjs | 0 .../interface/public}/Logo.svg | 0 .../interface/public}/arrow-down.svg | 0 .../interface/public}/arrow-go-to.svg | 0 .../interface/public}/arrow-up.svg | 0 .../interface/public}/check-black.svg | 0 .../interface/public}/check-white.svg | 0 .../public}/circle-check-blue-filled.svg | 0 .../interface/public}/circle-check-blue.svg | 0 .../interface/public}/dropdown.svg | 0 .../interface/public}/favicon.svg | 0 .../interface/public}/fonts/DM_Sans.woff2 | Bin .../public}/fonts/Share_Tech_Mono.woff2 | Bin .../interface/public}/mockServiceWorker.js | 185 +- .../interface/public}/round-logo.svg | 0 .../src}/components/AddedProjects.tsx | 0 .../src}/components/BallotOverview.tsx | 2 +- .../src}/components/ConnectButton.tsx | 0 .../interface/src}/components/ENS.tsx | 0 .../src}/components/EligibilityDialog.tsx | 0 .../interface/src}/components/EmptyState.tsx | 0 .../interface/src}/components/Footer.tsx | 2 +- .../interface/src}/components/Header.tsx | 2 +- .../interface/src}/components/ImageUpload.tsx | 0 .../src}/components/InfiniteLoading.tsx | 0 .../interface/src}/components/Info.tsx | 0 .../interface/src}/components/InfoCard.tsx | 2 +- .../interface/src}/components/JoinButton.tsx | 0 .../interface/src}/components/RoundInfo.tsx | 0 .../src}/components/SortByDropdown.tsx | 4 +- .../interface/src}/components/SortFilter.tsx | 0 .../interface/src}/components/StatusBar.tsx | 0 .../interface/src}/components/TimeSlot.tsx | 0 .../interface/src}/components/Toaster.tsx | 0 .../interface/src}/components/VotingInfo.tsx | 0 .../interface/src}/components/VotingUsage.tsx | 0 .../interface/src}/components/ui/Alert.tsx | 0 .../interface/src}/components/ui/Avatar.tsx | 0 .../src}/components/ui/BackgroundImage.tsx | 0 .../interface/src}/components/ui/Badge.tsx | 0 .../interface/src}/components/ui/Banner.tsx | 0 .../interface/src}/components/ui/Button.tsx | 0 .../interface/src}/components/ui/Card.tsx | 0 .../interface/src}/components/ui/Chip.tsx | 0 .../interface/src}/components/ui/Dialog.tsx | 0 .../interface/src}/components/ui/Form.tsx | 2 +- .../interface/src}/components/ui/Heading.tsx | 0 .../interface/src}/components/ui/Input.tsx | 0 .../interface/src}/components/ui/Link.tsx | 0 .../interface/src}/components/ui/Logo.tsx | 0 .../interface/src}/components/ui/Markdown.tsx | 0 .../src}/components/ui/Navigation.tsx | 0 .../interface/src}/components/ui/Notice.tsx | 0 .../interface/src}/components/ui/Progress.tsx | 2 +- .../interface/src}/components/ui/Skeleton.tsx | 0 .../interface/src}/components/ui/Spinner.tsx | 0 .../interface/src}/components/ui/Table.tsx | 0 .../interface/src}/components/ui/Tag.tsx | 0 .../interface/src}/components/ui/Tooltip.tsx | 2 +- .../interface/src}/components/ui/index.tsx | 0 {src => packages/interface/src}/config.ts | 0 .../interface/src}/contexts/Ballot.tsx | 6 +- .../interface/src}/contexts/Maci.tsx | 6 +- .../interface/src}/contexts/types.ts | 0 {src => packages/interface/src}/env.js | 0 .../admin/components/InvalidAdmin.tsx | 0 .../components/ApplicationButtons.tsx | 0 .../components/ApplicationForm.tsx | 2 +- .../components/ApplicationSteps.tsx | 0 .../components/ApplicationsToApprove.tsx | 4 +- .../applications/components/ImpactTags.tsx | 0 .../applications/components/LinkField.tsx | 0 .../components/ReviewApplicationDetails.tsx | 0 .../applications/components/ReviewBar.tsx | 0 .../hooks/useApplicationByTxHash.ts | 0 .../applications/hooks/useApplications.ts | 0 .../hooks/useApproveApplication.ts | 0 .../hooks/useApprovedApplications.ts | 0 .../hooks/useCreateApplication.ts | 0 .../src}/features/applications/types/index.ts | 0 .../ballot/components/AllocationInput.tsx | 0 .../ballot/components/AllocationList.tsx | 0 .../ballot/components/BallotConfirmation.tsx | 0 .../components/ProjectAvatarWithName.tsx | 0 .../ballot/components/SubmitBallotButton.tsx | 0 .../ballot/components/VotingEndsIn.tsx | 0 .../src}/features/ballot/types/index.ts | 0 .../src}/features/filter/hooks/useFilter.ts | 0 .../src}/features/filter/types/index.ts | 0 .../projects/components/ImpactCategories.tsx | 0 .../features/projects/components/LinkBox.tsx | 0 .../projects/components/ProjectAvatar.tsx | 0 .../projects/components/ProjectAwarded.tsx | 0 .../projects/components/ProjectBanner.tsx | 0 .../projects/components/ProjectContacts.tsx | 0 .../components/ProjectContributions.tsx | 0 .../components/ProjectDescriptionSection.tsx | 0 .../projects/components/ProjectDetails.tsx | 0 .../projects/components/ProjectItem.tsx | 2 +- .../features/projects/components/Projects.tsx | 0 .../projects/components/ProjectsResults.tsx | 0 .../projects/components/VotingWidget.tsx | 2 +- .../features/projects/hooks/useProjects.ts | 0 .../projects/hooks/useSelectProjects.ts | 0 .../interface/src}/features/projects/types.ts | 0 .../features/results/components/Chart.tsx | 0 .../features/signup/components/FaqItem.tsx | 0 .../features/signup/components/FaqList.tsx | 0 .../interface/src}/features/signup/types.ts | 0 .../voters/components/ApproveVoters.tsx | 0 .../features/voters/components/VotersList.tsx | 0 .../features/voters/hooks/useApproveVoters.ts | 0 .../features/voters/hooks/useApprovedVoter.ts | 0 .../interface/src}/features/voters/types.tsx | 0 .../interface/src}/hooks/useEAS.ts | 0 .../interface/src}/hooks/useEthersSigner.ts | 0 .../interface/src}/hooks/useIsAdmin.ts | 0 .../src}/hooks/useIsCorrectNetwork.ts | 0 .../interface/src}/hooks/useMetadata.ts | 0 .../interface/src}/hooks/useProfile.ts | 0 .../interface/src}/hooks/useResults.ts | 0 .../interface/src}/layouts/AdminLayout.tsx | 0 .../interface/src}/layouts/BaseLayout.tsx | 0 .../interface/src}/layouts/DefaultLayout.tsx | 0 .../src}/lib/eas/createAttestation.ts | 0 .../interface/src}/lib/eas/createEAS.ts | 0 .../interface/src}/lib/eas/registerSchemas.ts | 0 .../interface/src}/pages/_app.tsx | 0 .../interface/src}/pages/api/blob.ts | 0 .../interface/src}/pages/api/og.tsx | 0 .../interface/src}/pages/api/trpc/[trpc].ts | 0 .../src}/pages/applications/confirmation.tsx | 0 .../src}/pages/applications/index.tsx | 0 .../interface/src}/pages/applications/new.tsx | 0 .../src}/pages/ballot/confirmation.tsx | 0 .../interface/src}/pages/ballot/index.tsx | 0 .../interface/src}/pages/index.tsx | 0 .../interface/src}/pages/info/index.tsx | 0 .../pages/projects/[projectId]/Project.tsx | 0 .../src}/pages/projects/[projectId]/index.tsx | 0 .../interface/src}/pages/projects/index.tsx | 0 .../interface/src}/pages/projects/results.tsx | 0 .../interface/src}/pages/signup/index.tsx | 0 .../interface/src}/pages/stats/index.tsx | 0 .../interface/src}/pages/voters/index.tsx | 0 .../interface/src}/pages/voters/status.tsx | 0 .../interface/src}/providers/index.tsx | 0 .../interface/src}/server/api/root.ts | 0 .../src}/server/api/routers/applications.ts | 0 .../interface/src}/server/api/routers/maci.ts | 0 .../src}/server/api/routers/metadata.ts | 0 .../src}/server/api/routers/profile.ts | 0 .../src}/server/api/routers/projects.ts | 0 .../src}/server/api/routers/results.ts | 0 .../src}/server/api/routers/voters.ts | 0 .../interface/src}/server/api/trpc.ts | 0 .../interface/src}/styles/globals.css | 0 {src => packages/interface/src}/utils/api.ts | 0 .../interface/src}/utils/classNames.ts | 0 .../interface/src}/utils/fetch.ts | 0 .../interface/src}/utils/fetchAttestations.ts | 0 .../src}/utils/fetchAttestationsUtils.ts | 0 .../utils/fetchAttestationsWithoutCache.ts | 0 .../interface/src}/utils/fetchMetadata.ts | 0 .../interface/src}/utils/fetchPoll.ts | 0 .../interface/src}/utils/fetchUser.ts | 0 .../interface/src}/utils/formatNumber.ts | 0 .../interface/src}/utils/reverseKeys.ts | 0 .../interface/src}/utils/semaphore.ts | 0 .../interface/src}/utils/state.ts | 0 .../interface/src}/utils/suffixNumber.ts | 0 {src => packages/interface/src}/utils/time.ts | 0 .../interface/src}/utils/truncate.ts | 0 .../interface/src}/utils/types.ts | 0 .../interface/tailwind.config.ts | 0 packages/interface/tsconfig.build.json | 44 + packages/interface/tsconfig.json | 44 + pnpm-lock.yaml | 33184 ++++++++++------ pnpm-workspace.yaml | 2 + src/lib/eas/__test__/eas.test.ts | 62 - src/test-msw.ts | 32 - src/test-setup.ts | 28 - src/test-utils.tsx | 39 - tsconfig.json | 46 +- vitest.config.ts | 18 - 258 files changed, 25825 insertions(+), 12553 deletions(-) create mode 100644 .github/scripts/build.sh create mode 100644 .github/scripts/deploy.sh create mode 100644 .github/workflows/coordinator-build.yml create mode 100644 .github/workflows/coordinator-deploy.yml create mode 100644 lerna.json create mode 100644 packages/coordinator/.env.example create mode 100644 packages/coordinator/.eslintrc.js create mode 100644 packages/coordinator/.gitignore create mode 100644 packages/coordinator/README.md create mode 100644 packages/coordinator/apps/Dockerfile create mode 100644 packages/coordinator/hardhat.config.js create mode 100644 packages/coordinator/nest-cli.json create mode 100644 packages/coordinator/package.json create mode 100644 packages/coordinator/scripts/downloadZKeys.ts create mode 100644 packages/coordinator/scripts/generateKeypair.ts create mode 100644 packages/coordinator/tests/app.test.ts create mode 100644 packages/coordinator/ts/app.module.ts create mode 100644 packages/coordinator/ts/auth/AccountSignatureGuard.service.ts create mode 100644 packages/coordinator/ts/auth/__tests__/AccountSignatureGuard.test.ts create mode 100644 packages/coordinator/ts/common/errors.ts create mode 100644 packages/coordinator/ts/common/index.ts create mode 100644 packages/coordinator/ts/common/networks.ts create mode 100644 packages/coordinator/ts/crypto/__tests__/crypto.service.test.ts create mode 100644 packages/coordinator/ts/crypto/crypto.module.ts create mode 100644 packages/coordinator/ts/crypto/crypto.service.ts create mode 100644 packages/coordinator/ts/file/__tests__/file.service.test.ts create mode 100644 packages/coordinator/ts/file/file.module.ts create mode 100644 packages/coordinator/ts/file/file.service.ts create mode 100644 packages/coordinator/ts/file/types.ts create mode 100644 packages/coordinator/ts/jest/setup.ts create mode 100644 packages/coordinator/ts/jest/transform.js create mode 100644 packages/coordinator/ts/main.ts create mode 100644 packages/coordinator/ts/proof/__tests__/proof.controller.test.ts create mode 100644 packages/coordinator/ts/proof/__tests__/proof.gateway.test.ts create mode 100644 packages/coordinator/ts/proof/__tests__/proof.service.test.ts create mode 100644 packages/coordinator/ts/proof/dto.ts create mode 100644 packages/coordinator/ts/proof/proof.controller.ts create mode 100644 packages/coordinator/ts/proof/proof.gateway.ts create mode 100644 packages/coordinator/ts/proof/proof.module.ts create mode 100644 packages/coordinator/ts/proof/proof.service.ts create mode 100644 packages/coordinator/ts/proof/types.ts create mode 100644 packages/coordinator/ts/subgraph/__tests__/subgraph.controller.test.ts create mode 100644 packages/coordinator/ts/subgraph/__tests__/subgraph.gateway.test.ts create mode 100644 packages/coordinator/ts/subgraph/__tests__/subgraph.service.test.ts create mode 100644 packages/coordinator/ts/subgraph/dto.ts create mode 100644 packages/coordinator/ts/subgraph/subgraph.controller.ts create mode 100644 packages/coordinator/ts/subgraph/subgraph.gateway.ts create mode 100644 packages/coordinator/ts/subgraph/subgraph.module.ts create mode 100644 packages/coordinator/ts/subgraph/subgraph.service.ts create mode 100644 packages/coordinator/ts/subgraph/types.ts create mode 100644 packages/coordinator/tsconfig.build.json create mode 100644 packages/coordinator/tsconfig.json rename .env.example => packages/interface/.env.example (100%) create mode 100644 packages/interface/.eslintignore create mode 100644 packages/interface/.eslintrc.js rename .npmrc => packages/interface/.npmrc (100%) rename LICENSE => packages/interface/LICENSE (100%) create mode 100644 packages/interface/README.md rename {e2e => packages/interface/e2e}/connectWallet.test.ts (96%) rename next.config.js => packages/interface/next.config.js (100%) create mode 100644 packages/interface/package.json rename playwright.config.ts => packages/interface/playwright.config.ts (100%) rename {playwright => packages/interface/playwright}/constants.ts (100%) rename {playwright => packages/interface/playwright}/fixtures.ts (100%) rename {playwright => packages/interface/playwright}/types.d.ts (100%) rename postcss.config.cjs => packages/interface/postcss.config.cjs (100%) rename {public => packages/interface/public}/Logo.svg (100%) rename {public => packages/interface/public}/arrow-down.svg (100%) rename {public => packages/interface/public}/arrow-go-to.svg (100%) rename {public => packages/interface/public}/arrow-up.svg (100%) rename {public => packages/interface/public}/check-black.svg (100%) rename {public => packages/interface/public}/check-white.svg (100%) rename {public => packages/interface/public}/circle-check-blue-filled.svg (100%) rename {public => packages/interface/public}/circle-check-blue.svg (100%) rename {public => packages/interface/public}/dropdown.svg (100%) rename {public => packages/interface/public}/favicon.svg (100%) rename {public => packages/interface/public}/fonts/DM_Sans.woff2 (100%) rename {public => packages/interface/public}/fonts/Share_Tech_Mono.woff2 (100%) rename {public => packages/interface/public}/mockServiceWorker.js (63%) rename {public => packages/interface/public}/round-logo.svg (100%) rename {src => packages/interface/src}/components/AddedProjects.tsx (100%) rename {src => packages/interface/src}/components/BallotOverview.tsx (84%) rename {src => packages/interface/src}/components/ConnectButton.tsx (100%) rename {src => packages/interface/src}/components/ENS.tsx (100%) rename {src => packages/interface/src}/components/EligibilityDialog.tsx (100%) rename {src => packages/interface/src}/components/EmptyState.tsx (100%) rename {src => packages/interface/src}/components/Footer.tsx (92%) rename {src => packages/interface/src}/components/Header.tsx (96%) rename {src => packages/interface/src}/components/ImageUpload.tsx (100%) rename {src => packages/interface/src}/components/InfiniteLoading.tsx (100%) rename {src => packages/interface/src}/components/Info.tsx (100%) rename {src => packages/interface/src}/components/InfoCard.tsx (95%) rename {src => packages/interface/src}/components/JoinButton.tsx (100%) rename {src => packages/interface/src}/components/RoundInfo.tsx (100%) rename {src => packages/interface/src}/components/SortByDropdown.tsx (88%) rename {src => packages/interface/src}/components/SortFilter.tsx (100%) rename {src => packages/interface/src}/components/StatusBar.tsx (100%) rename {src => packages/interface/src}/components/TimeSlot.tsx (100%) rename {src => packages/interface/src}/components/Toaster.tsx (100%) rename {src => packages/interface/src}/components/VotingInfo.tsx (100%) rename {src => packages/interface/src}/components/VotingUsage.tsx (100%) rename {src => packages/interface/src}/components/ui/Alert.tsx (100%) rename {src => packages/interface/src}/components/ui/Avatar.tsx (100%) rename {src => packages/interface/src}/components/ui/BackgroundImage.tsx (100%) rename {src => packages/interface/src}/components/ui/Badge.tsx (100%) rename {src => packages/interface/src}/components/ui/Banner.tsx (100%) rename {src => packages/interface/src}/components/ui/Button.tsx (100%) rename {src => packages/interface/src}/components/ui/Card.tsx (100%) rename {src => packages/interface/src}/components/ui/Chip.tsx (100%) rename {src => packages/interface/src}/components/ui/Dialog.tsx (100%) rename {src => packages/interface/src}/components/ui/Form.tsx (98%) rename {src => packages/interface/src}/components/ui/Heading.tsx (100%) rename {src => packages/interface/src}/components/ui/Input.tsx (100%) rename {src => packages/interface/src}/components/ui/Link.tsx (100%) rename {src => packages/interface/src}/components/ui/Logo.tsx (100%) rename {src => packages/interface/src}/components/ui/Markdown.tsx (100%) rename {src => packages/interface/src}/components/ui/Navigation.tsx (100%) rename {src => packages/interface/src}/components/ui/Notice.tsx (100%) rename {src => packages/interface/src}/components/ui/Progress.tsx (88%) rename {src => packages/interface/src}/components/ui/Skeleton.tsx (100%) rename {src => packages/interface/src}/components/ui/Spinner.tsx (100%) rename {src => packages/interface/src}/components/ui/Table.tsx (100%) rename {src => packages/interface/src}/components/ui/Tag.tsx (100%) rename {src => packages/interface/src}/components/ui/Tooltip.tsx (86%) rename {src => packages/interface/src}/components/ui/index.tsx (100%) rename {src => packages/interface/src}/config.ts (100%) rename {src => packages/interface/src}/contexts/Ballot.tsx (97%) rename {src => packages/interface/src}/contexts/Maci.tsx (99%) rename {src => packages/interface/src}/contexts/types.ts (100%) rename {src => packages/interface/src}/env.js (100%) rename {src => packages/interface/src}/features/admin/components/InvalidAdmin.tsx (100%) rename {src => packages/interface/src}/features/applications/components/ApplicationButtons.tsx (100%) rename {src => packages/interface/src}/features/applications/components/ApplicationForm.tsx (99%) rename {src => packages/interface/src}/features/applications/components/ApplicationSteps.tsx (100%) rename {src => packages/interface/src}/features/applications/components/ApplicationsToApprove.tsx (97%) rename {src => packages/interface/src}/features/applications/components/ImpactTags.tsx (100%) rename {src => packages/interface/src}/features/applications/components/LinkField.tsx (100%) rename {src => packages/interface/src}/features/applications/components/ReviewApplicationDetails.tsx (100%) rename {src => packages/interface/src}/features/applications/components/ReviewBar.tsx (100%) rename {src => packages/interface/src}/features/applications/hooks/useApplicationByTxHash.ts (100%) rename {src => packages/interface/src}/features/applications/hooks/useApplications.ts (100%) rename {src => packages/interface/src}/features/applications/hooks/useApproveApplication.ts (100%) rename {src => packages/interface/src}/features/applications/hooks/useApprovedApplications.ts (100%) rename {src => packages/interface/src}/features/applications/hooks/useCreateApplication.ts (100%) rename {src => packages/interface/src}/features/applications/types/index.ts (100%) rename {src => packages/interface/src}/features/ballot/components/AllocationInput.tsx (100%) rename {src => packages/interface/src}/features/ballot/components/AllocationList.tsx (100%) rename {src => packages/interface/src}/features/ballot/components/BallotConfirmation.tsx (100%) rename {src => packages/interface/src}/features/ballot/components/ProjectAvatarWithName.tsx (100%) rename {src => packages/interface/src}/features/ballot/components/SubmitBallotButton.tsx (100%) rename {src => packages/interface/src}/features/ballot/components/VotingEndsIn.tsx (100%) rename {src => packages/interface/src}/features/ballot/types/index.ts (100%) rename {src => packages/interface/src}/features/filter/hooks/useFilter.ts (100%) rename {src => packages/interface/src}/features/filter/types/index.ts (100%) rename {src => packages/interface/src}/features/projects/components/ImpactCategories.tsx (100%) rename {src => packages/interface/src}/features/projects/components/LinkBox.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectAvatar.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectAwarded.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectBanner.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectContacts.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectContributions.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectDescriptionSection.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectDetails.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectItem.tsx (97%) rename {src => packages/interface/src}/features/projects/components/Projects.tsx (100%) rename {src => packages/interface/src}/features/projects/components/ProjectsResults.tsx (100%) rename {src => packages/interface/src}/features/projects/components/VotingWidget.tsx (98%) rename {src => packages/interface/src}/features/projects/hooks/useProjects.ts (100%) rename {src => packages/interface/src}/features/projects/hooks/useSelectProjects.ts (100%) rename {src => packages/interface/src}/features/projects/types.ts (100%) rename {src => packages/interface/src}/features/results/components/Chart.tsx (100%) rename {src => packages/interface/src}/features/signup/components/FaqItem.tsx (100%) rename {src => packages/interface/src}/features/signup/components/FaqList.tsx (100%) rename {src => packages/interface/src}/features/signup/types.ts (100%) rename {src => packages/interface/src}/features/voters/components/ApproveVoters.tsx (100%) rename {src => packages/interface/src}/features/voters/components/VotersList.tsx (100%) rename {src => packages/interface/src}/features/voters/hooks/useApproveVoters.ts (100%) rename {src => packages/interface/src}/features/voters/hooks/useApprovedVoter.ts (100%) rename {src => packages/interface/src}/features/voters/types.tsx (100%) rename {src => packages/interface/src}/hooks/useEAS.ts (100%) rename {src => packages/interface/src}/hooks/useEthersSigner.ts (100%) rename {src => packages/interface/src}/hooks/useIsAdmin.ts (100%) rename {src => packages/interface/src}/hooks/useIsCorrectNetwork.ts (100%) rename {src => packages/interface/src}/hooks/useMetadata.ts (100%) rename {src => packages/interface/src}/hooks/useProfile.ts (100%) rename {src => packages/interface/src}/hooks/useResults.ts (100%) rename {src => packages/interface/src}/layouts/AdminLayout.tsx (100%) rename {src => packages/interface/src}/layouts/BaseLayout.tsx (100%) rename {src => packages/interface/src}/layouts/DefaultLayout.tsx (100%) rename {src => packages/interface/src}/lib/eas/createAttestation.ts (100%) rename {src => packages/interface/src}/lib/eas/createEAS.ts (100%) rename {src => packages/interface/src}/lib/eas/registerSchemas.ts (100%) rename {src => packages/interface/src}/pages/_app.tsx (100%) rename {src => packages/interface/src}/pages/api/blob.ts (100%) rename {src => packages/interface/src}/pages/api/og.tsx (100%) rename {src => packages/interface/src}/pages/api/trpc/[trpc].ts (100%) rename {src => packages/interface/src}/pages/applications/confirmation.tsx (100%) rename {src => packages/interface/src}/pages/applications/index.tsx (100%) rename {src => packages/interface/src}/pages/applications/new.tsx (100%) rename {src => packages/interface/src}/pages/ballot/confirmation.tsx (100%) rename {src => packages/interface/src}/pages/ballot/index.tsx (100%) rename {src => packages/interface/src}/pages/index.tsx (100%) rename {src => packages/interface/src}/pages/info/index.tsx (100%) rename {src => packages/interface/src}/pages/projects/[projectId]/Project.tsx (100%) rename {src => packages/interface/src}/pages/projects/[projectId]/index.tsx (100%) rename {src => packages/interface/src}/pages/projects/index.tsx (100%) rename {src => packages/interface/src}/pages/projects/results.tsx (100%) rename {src => packages/interface/src}/pages/signup/index.tsx (100%) rename {src => packages/interface/src}/pages/stats/index.tsx (100%) rename {src => packages/interface/src}/pages/voters/index.tsx (100%) rename {src => packages/interface/src}/pages/voters/status.tsx (100%) rename {src => packages/interface/src}/providers/index.tsx (100%) rename {src => packages/interface/src}/server/api/root.ts (100%) rename {src => packages/interface/src}/server/api/routers/applications.ts (100%) rename {src => packages/interface/src}/server/api/routers/maci.ts (100%) rename {src => packages/interface/src}/server/api/routers/metadata.ts (100%) rename {src => packages/interface/src}/server/api/routers/profile.ts (100%) rename {src => packages/interface/src}/server/api/routers/projects.ts (100%) rename {src => packages/interface/src}/server/api/routers/results.ts (100%) rename {src => packages/interface/src}/server/api/routers/voters.ts (100%) rename {src => packages/interface/src}/server/api/trpc.ts (100%) rename {src => packages/interface/src}/styles/globals.css (100%) rename {src => packages/interface/src}/utils/api.ts (100%) rename {src => packages/interface/src}/utils/classNames.ts (100%) rename {src => packages/interface/src}/utils/fetch.ts (100%) rename {src => packages/interface/src}/utils/fetchAttestations.ts (100%) rename {src => packages/interface/src}/utils/fetchAttestationsUtils.ts (100%) rename {src => packages/interface/src}/utils/fetchAttestationsWithoutCache.ts (100%) rename {src => packages/interface/src}/utils/fetchMetadata.ts (100%) rename {src => packages/interface/src}/utils/fetchPoll.ts (100%) rename {src => packages/interface/src}/utils/fetchUser.ts (100%) rename {src => packages/interface/src}/utils/formatNumber.ts (100%) rename {src => packages/interface/src}/utils/reverseKeys.ts (100%) rename {src => packages/interface/src}/utils/semaphore.ts (100%) rename {src => packages/interface/src}/utils/state.ts (100%) rename {src => packages/interface/src}/utils/suffixNumber.ts (100%) rename {src => packages/interface/src}/utils/time.ts (100%) rename {src => packages/interface/src}/utils/truncate.ts (100%) rename {src => packages/interface/src}/utils/types.ts (100%) rename tailwind.config.ts => packages/interface/tailwind.config.ts (100%) create mode 100644 packages/interface/tsconfig.build.json create mode 100644 packages/interface/tsconfig.json create mode 100644 pnpm-workspace.yaml delete mode 100644 src/lib/eas/__test__/eas.test.ts delete mode 100644 src/test-msw.ts delete mode 100644 src/test-setup.ts delete mode 100644 src/test-utils.tsx delete mode 100644 vitest.config.ts diff --git a/.eslintignore b/.eslintignore index 240d8094..c561d243 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,14 +1,10 @@ node_modules dist -.next coverage build typechain-types .eslintrc.js commitlint.config.js -subgraph/generated -public/mockServiceWorker.js zkeys -playwright-report -test-results -next.config.js +interface/playwright.config.ts +interface/playwright/fixtures.ts diff --git a/.eslintrc.js b/.eslintrc.js index 9594edad..88432698 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,7 +10,6 @@ module.exports = { extends: [ "airbnb", "prettier", - "next/core-web-vitals", "plugin:import/recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", @@ -20,26 +19,23 @@ module.exports = { "plugin:@typescript-eslint/stylistic", "plugin:@typescript-eslint/stylistic-type-checked", "plugin:import/typescript", - "plugin:react/recommended", - "plugin:playwright/playwright-test", ], - plugins: ["json", "prettier", "unused-imports", "import", "@typescript-eslint", "react-hooks"], + plugins: ["json", "prettier", "unused-imports", "import", "@typescript-eslint"], parser: "@typescript-eslint/parser", env: { - browser: true, node: true, jest: true, es2022: true, }, settings: { react: { - version: "18", + version: "999.999.999", }, "import/resolver": { typescript: {}, node: { - extensions: [".ts", ".js", ".tsx", ".jsx"], - moduleDirectory: ["node_modules", "src", "playwright"], + extensions: [".ts", ".js"], + moduleDirectory: ["node_modules", "ts", "src"], }, }, }, @@ -63,15 +59,7 @@ module.exports = { "import/no-extraneous-dependencies": [ "error", { - devDependencies: [ - "**/*.test.ts", - "./src/test-msw.ts", - "./src/test-setup.ts", - "./src/lib/eas/*.ts", - "./playwright/**/*.ts", - "./playwright.config.ts", - "./vitest.config.ts", - ], + devDependencies: ["**/*.test.ts"], }, ], "no-debugger": isProduction ? "error" : "off", @@ -113,86 +101,9 @@ module.exports = { "error", { builtinGlobals: true, - allow: [ - "alert", - "location", - "event", - "history", - "name", - "status", - "Option", - "Image", - "Lock", - "test", - "expect", - "describe", - "beforeAll", - "afterAll", - ], + allow: ["location", "event", "history", "name", "status", "Option", "test", "expect"], }, ], "@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }], - - "react/jsx-filename-extension": [ - "error", - { - extensions: [".tsx", ".jsx", ".js"], - }, - ], - "react/no-unknown-property": ["error", { ignore: ["tw", "global", "jsx"] }], - "react/jsx-sort-props": [ - "error", - { - callbacksLast: true, - shorthandFirst: true, - ignoreCase: true, - reservedFirst: true, - }, - ], - "react/sort-prop-types": [ - "error", - { - callbacksLast: true, - }, - ], - "react/react-in-jsx-scope": "off", - "react/jsx-boolean-value": "error", - "react/jsx-handler-names": "error", - "react/prop-types": "error", - "react/jsx-no-bind": "error", - "react-hooks/rules-of-hooks": "error", - "react/no-array-index-key": "warn", - "jsx-a11y/no-static-element-interactions": "warn", - "jsx-a11y/click-events-have-key-events": "warn", - "jsx-a11y/anchor-is-valid": "warn", - "react/jsx-props-no-spreading": "off", - "react/forbid-prop-types": "off", - "react/state-in-constructor": "off", - "react/jsx-fragments": "off", - "react/static-property-placement": ["off"], - "react/jsx-newline": ["error", { prevent: false }], - "jsx-a11y/label-has-associated-control": "off", - "jsx-a11y/label-has-for": "off", - "react/require-default-props": [ - "error", - { - functions: "defaultArguments", - }, - ], - "react/no-unused-prop-types": "error", - "react/function-component-definition": ["error", { namedComponents: ["arrow-function"] }], - - "playwright/prefer-lowercase-title": "error", - "playwright/prefer-to-be": "error", - "playwright/prefer-to-have-length": "error", - "playwright/prefer-strict-equal": "error", - "playwright/max-nested-describe": ["error", { max: 1 }], - "playwright/no-restricted-matchers": [ - "error", - { - toBeFalsy: "Use `toBe(false)` instead.", - not: null, - }, - ], }, }; diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh new file mode 100644 index 00000000..733197ed --- /dev/null +++ b/.github/scripts/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -ex + +cp packages/coordinator/.env.example packages/coordinator/.env + +sed -i "s|^\(COORDINATOR_RPC_URL=\).*|\1$1|" packages/coordinator/.env +sed -i "s|^\(COORDINATOR_ADDRESSES=\).*|\1$2|" packages/coordinator/.env +sed -i "s|^\(COORDINATOR_ALLOWED_ORIGINS=\).*|\1$3|" packages/coordinator/.env + +aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 490752553772.dkr.ecr.eu-central-1.amazonaws.com + +docker build -t maci-coordinator -f packages/coordinator/apps/Dockerfile . +docker tag maci-coordinator:latest 490752553772.dkr.ecr.eu-central-1.amazonaws.com/maci-coordinator:latest +docker push 490752553772.dkr.ecr.eu-central-1.amazonaws.com/maci-coordinator:latest + +exit 0 diff --git a/.github/scripts/deploy.sh b/.github/scripts/deploy.sh new file mode 100644 index 00000000..3d987b14 --- /dev/null +++ b/.github/scripts/deploy.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -ex + +tasks="maci-coordinator" +for task in $tasks; do + maci_coordinator_revision=$(aws ecs describe-task-definition --task-definition $task --query "taskDefinition.revision") + aws ecs update-service --cluster maci-coordinator --service $task --force-new-deployment --task-definition $task:$maci_coordinator_revision +done + +for loop in {1..3}; do + [ "$loop" -eq 3 ] && exit 1 + aws ecs wait services-stable --cluster maci-coordinator --services $tasks && break || continue +done diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8e3634bf..6ff76288 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - command: ["prettier", "types", "lint", "test"] + command: ["prettier", "types", "lint"] runs-on: ubuntu-22.04 @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 with: - version: 8 + version: 9 - name: Use Node.js 20 uses: actions/setup-node@v4 diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index fe2541d3..955b0447 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -17,7 +17,7 @@ jobs: fetch-depth: 0 - uses: pnpm/action-setup@v4 with: - version: 8 + version: 9 - name: Use Node.js 20 uses: actions/setup-node@v4 diff --git a/.github/workflows/coordinator-build.yml b/.github/workflows/coordinator-build.yml new file mode 100644 index 00000000..7e881668 --- /dev/null +++ b/.github/workflows/coordinator-build.yml @@ -0,0 +1,114 @@ +name: Coordinator + +on: + push: + branches: [main] + pull_request: + +env: + COORDINATOR_RPC_URL: "http://localhost:8545" + COORDINATOR_PUBLIC_KEY_PATH: "./pub.key" + COORDINATOR_PRIVATE_KEY_PATH: "./priv.key" + COORDINATOR_TALLY_ZKEY_NAME: "TallyVotes_10-1-2_test" + COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME: "ProcessMessages_10-2-1-2_test" + COORDINATOR_ZKEY_PATH: "./zkeys/" + COORDINATOR_RAPIDSNARK_EXE: "~/rapidsnark/build/prover" + SUBGRAPH_FOLDER: "./node_modules/maci-subgraph" + SUBGRAPH_NAME: ${{ vars.SUBGRAPH_NAME }} + SUBGRAPH_PROVIDER_URL: ${{ vars.SUBGRAPH_PROVIDER_URL }} + SUBGRAPH_DEPLOY_KEY: ${{ secrets.SUBGRAPH_DEPLOY_KEY }} + # interface related variables as they are needed for building the monorepo + NEXT_PUBLIC_CHAIN_NAME: ${{ vars.NEXT_PUBLIC_CHAIN_NAME }} + NEXT_PUBLIC_ADMIN_ADDRESS: ${{ vars.NEXT_PUBLIC_ADMIN_ADDRESS }} + NEXT_PUBLIC_APPROVAL_SCHEMA: ${{ vars.NEXT_PUBLIC_APPROVAL_SCHEMA }} + NEXT_PUBLIC_METADATA_SCHEMA: ${{ vars.NEXT_PUBLIC_METADATA_SCHEMA }} + NEXT_PUBLIC_ROUND_ID: ${{ vars.NEXT_PUBLIC_ROUND_ID }} + NEXT_PUBLIC_SKIP_APPROVED_VOTER_CHECK: false + NEXT_PUBLIC_MACI_ADDRESS: ${{ vars.NEXT_PUBLIC_MACI_ADDRESS }} + NEXT_PUBLIC_TALLY_URL: ${{ vars.NEXT_PUBLIC_TALLY_URL }} + NEXT_PUBLIC_WALLETCONNECT_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_ID }} + NEXT_PUBLIC_FEEDBACK_URL: ${{ vars.NEXT_PUBLIC_FEEDBACK_URL }} + NEXT_PUBLIC_MACI_START_BLOCK: ${{ vars.NEXT_PUBLIC_MACI_START_BLOCK }} + NEXT_PUBLIC_MACI_SUBGRAPH_URL: ${{ vars.NEXT_PUBLIC_MACI_SUBGRAPH_URL }} + NEXT_PUBLIC_TOKEN_NAME: ${{ vars.NEXT_PUBLIC_TOKEN_NAME }} + NEXT_PUBLIC_MAX_VOTES_TOTAL: ${{ vars.NEXT_PUBLIC_MAX_VOTES_TOTAL }} + NEXT_PUBLIC_MAX_VOTES_PROJECT: ${{ vars.NEXT_PUBLIC_MAX_VOTES_PROJECT }} + BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }} + NEXT_PUBLIC_ALCHEMY_ID: ${{ secrets.NEXT_PUBLIC_ALCHEMY_ID }} + NEXT_PUBLIC_START_DATE: ${{ vars.NEXT_PUBLIC_START_DATE }} + NEXT_PUBLIC_REGISTRATION_END_DATE: ${{ vars.NEXT_PUBLIC_REGISTRATION_END_DATE }} + NEXT_PUBLIC_REVIEW_END_DATE: ${{ vars.NEXT_PUBLIC_REVIEW_END_DATE }} + NEXT_PUBLIC_VOTING_END_DATE: ${{ vars.NEXT_PUBLIC_VOTING_END_DATE }} + NEXT_PUBLIC_RESULTS_DATE: ${{ vars.NEXT_PUBLIC_RESULTS_DATE }} + NEXT_PUBLIC_POLL_MODE: ${{ vars.NEXT_PUBLIC_POLL_MODE }} + TEST_MNEMONIC: ${{ secrets.TEST_MNEMONIC }} + WALLET_PRIVATE_KEY: "" + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes \ + build-essential \ + libgmp-dev \ + libsodium-dev \ + nasm \ + nlohmann-json3-dev + + - name: Install + run: | + pnpm install --frozen-lockfile --prefer-offline + + - name: Build + run: | + pnpm run build + + - name: Run hardhat + run: | + pnpm run hardhat & + sleep 5 + working-directory: packages/coordinator + + - name: Download rapidsnark (1c137) + run: | + mkdir -p ~/rapidsnark/build + wget -qO ~/rapidsnark/build/prover https://maci-devops-zkeys.s3.ap-northeast-2.amazonaws.com/rapidsnark-linux-amd64-1c137 + chmod +x ~/rapidsnark/build/prover + + - name: Download circom Binary v2.1.6 + run: | + wget -qO ${{ github.workspace }}/circom https://github.com/iden3/circom/releases/download/v2.1.6/circom-linux-amd64 + chmod +x ${{ github.workspace }}/circom + sudo mv ${{ github.workspace }}/circom /bin/circom + + - name: Download zkeys + run: | + pnpm download-zkeys:test + + - name: Generate keypair + run: | + pnpm generate-keypair + working-directory: packages/coordinator + + - name: Test + run: pnpm run test + working-directory: packages/coordinator diff --git a/.github/workflows/coordinator-deploy.yml b/.github/workflows/coordinator-deploy.yml new file mode 100644 index 00000000..58665e92 --- /dev/null +++ b/.github/workflows/coordinator-deploy.yml @@ -0,0 +1,37 @@ +name: CoordinatorDeploy +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy: + runs-on: ubuntu-22.04 + permissions: + id-token: write + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::490752553772:role/maci-coordinator-ecs-deploy-slc + role-duration-seconds: 2700 + aws-region: eu-central-1 + + - name: Build and Push images to ECR + run: | + .github/scripts/build.sh ${{ secrets.COORDINATOR_RPC_URL }} ${{ secrets.COORDINATOR_ADDRESSES }} ${{ secrets.COORDINATOR_ALLOWED_ORIGINS }} + + - name: Create Deployment + run: | + .github/scripts/deploy.sh diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4c3fe025..f83c5b26 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -54,7 +54,7 @@ jobs: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 with: - version: 8 + version: 9 - name: Use Node.js 20 uses: actions/setup-node@v4 @@ -96,14 +96,17 @@ jobs: if: steps.playwright-cache.outputs.cache-hit != 'true' run: |- pnpm run install:chromium + working-directory: packages/interface - name: Build run: pnpm run build + working-directory: packages/interface - name: Run Playwright tests uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a with: run: pnpm run test:e2e + working-directory: packages/interface - uses: actions/upload-artifact@v4 if: always() diff --git a/.gitignore b/.gitignore index d36a51f6..6f4ab1f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,22 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies -/node_modules -/.pnp +node_modules +.pnp .pnp.js # testing -/coverage -/playwright-report -/test-results +coverage +playwright-report +test-results # next.js -/.next/ -/out/ +.next/ +out/ next-env.d.ts # production -/build +build # misc .DS_Store diff --git a/README.md b/README.md index bd5f0d47..012620f2 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,13 @@ -# MACI-RPGF +# MACI Platform -
+MACI Platform is a complete solution for running voting and funding rounds using [MACI](https://maci.pse.dev). -[](https://easy-retro-pgf.vercel.app) +It is comprised of two components: -## Documentation - -MACI-RPGF uses EAS as backbone to run Retroactive Public Goods Funding to reward contributors ([As used by the Optimism Collective](https://community.optimism.io/docs/governance/citizens-house/#how-retro-funding-works)) while adding a privacy layer to reduce bribery and collusion using MACI. - -## Video Tutorial - -A complete installation tutorial can be seen here: - -[![Watch the Video](https://img.youtube.com/vi/86VBbO1E4Vk/0.jpg)](https://www.youtube.com/watch?v=86VBbO1E4Vk) +- Coordinator Service - the complete automation of MACI operations +- Interface - a web app for managing and voting on MACI polls -### MACI-RPGF docs +### MACI-Platform docs - [Setup & Deployment](./docs/01_setup.md) - [Adding Projects & Approving](./docs/02_adding_projects.md) @@ -33,55 +20,39 @@ A complete installation tutorial can be seen here: - [Documentation](https://maci.pse.dev/docs/introduction) -## Supported Networks - -All networks EAS is deployed to are supported. If a network is not supported, you can follow the EAS documentation to deploy the contracts to the network. - -- https://docs.attest.sh/docs/quick--start/contracts - -#### Mainnets - -- Ethereum -- Optimism -- Base -- Arbitrum One & Nova -- Polygon -- Scroll -- Celo -- Linea - -#### Testnets - -- Sepolia -- Optimism Sepolia -- Base Sepolia -- Polygon Mumbai -- Scroll Sepolia - ## Development To run locally follow these instructions: ```sh -git clone https://github.com/privacy-scaling-explorations/maci-rpgf +git clone https://github.com/privacy-scaling-explorations/maci-platform + +pnpm install && pnpm build -cp .env.example .env # and update .env variables +cp packages/interface/.env.example packages/interface/.env # and update .env variables ``` At the very minimum you need to configure the subgraph url, admin address, maci address and the voting periods. For more details head to [Setup & Deployment](./docs/01_setup.md). Once you have set everything run: ```sh -pnpm install - -pnpm run dev +pnpm run dev:interface open localhost:3000 ``` -### Technical details +## Documentation + +MACI-Platform uses EAS as backbone to run Retroactive Public Goods Funding to reward contributors ([As used by the Optimism Collective](https://community.optimism.io/docs/governance/citizens-house/#how-retro-funding-works)) while adding a privacy layer to reduce bribery and collusion using MACI. + +## Video Tutorial + +A complete installation tutorial can be seen here: + +[![Watch the Video](https://img.youtube.com/vi/86VBbO1E4Vk/0.jpg)](https://www.youtube.com/watch?v=86VBbO1E4Vk) + +## Credits + +The interface started as a fork of [easy-rpgf](https://github.com/gitcoinco/easy-retro-pgf), but now has gone a completely different direction and thus we decided to detach the fork to clarify the new direction of the project, which is not focusing anymore on RPGF only, but other types of voting and funding. -- **EAS** - Projects, profiles, etc are all stored on-chain in Ethereum Attestation Service -- **Batched requests with tRPC** - Multiple requests are batched into one (for example when the frontend requests the metadata for 24 projects they are batched into 1 request) -- **Server-side caching of requests to EAS and IPFS** - Immediately returns the data without calling EAS and locally serving ipfs cids. -- **MACI** - Minimal Anti-Collusion Infrastructure (MACI) is an open-source public good that serves as infrastructure for private on-chain voting, handles the rounds and private voting of the badgeholders. +We are very thankful to the developers and all contributors of the [easy-rpgf](https://github.com/gitcoinco/easy-retro-pgf) project, and we hope to continue collaborating and wish to see their project succeed and help more communities/projects get funded. diff --git a/lerna.json b/lerna.json new file mode 100644 index 00000000..beafc3c4 --- /dev/null +++ b/lerna.json @@ -0,0 +1,47 @@ +{ + "packages": ["packages/*"], + "version": "0.1.0", + "npmClient": "pnpm", + "changelogPreset": { + "name": "conventionalcommits", + "types": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "refactor", + "section": "Code Refactoring" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "chore", + "section": "Miscellaneous" + }, + { + "type": "docs", + "section": "Miscellaneous" + }, + { + "type": "style", + "section": "Miscellaneous" + }, + { + "type": "test", + "section": "Miscellaneous" + } + ], + "issuePrefixes": ["#"], + "issueUrlFormat": "{{host}}/{{owner}}/{{repository}}/issues/{{id}}", + "commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}", + "compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}", + "userUrlFormat": "{{host}}/{{user}}" + } +} diff --git a/package.json b/package.json index 8ae1fc6f..b8569c62 100644 --- a/package.json +++ b/package.json @@ -1,159 +1,65 @@ { - "name": "maci-rpgf", + "name": "maci-platform", "version": "0.1.0", - "private": true, + "description": "Minimal Anti-Collusion Infrastructure Platform", + "repository": "https://github.com/privacy-scaling-explorations/maci-rpgf", + "license": "MIT", "scripts": { - "build": "next build", - "dev": "next dev", - "lint": "next lint", - "lint:fix": "next lint --fix", - "start": "next start", - "test": "vitest run", + "build": "lerna run build", + "clean": "lerna exec -- rm -rf node_modules build && rm -rf node_modules", + "commit": "git cz", + "download-zkeys:test": "lerna run download-zkeys:test --scope=maci-coordinator", + "download-zkeys:prod": "lerna run download-zkeys:prod --scope=maci-coordinator", "prettier": "prettier -c .", "prettier:fix": "prettier -w .", - "types": "tsc -p tsconfig.json --noEmit", - "eas:registerSchemas": "npx tsx src/lib/eas/registerSchemas", - "install:chromium": "playwright install chromium", - "test:e2e": "playwright test --project=chromium", - "prepare": "is-ci || husky" - }, - "dependencies": { - "@ethereum-attestation-service/eas-sdk": "^1.5.0", - "@hookform/resolvers": "^3.3.4", - "@nivo/boxplot": "^0.84.0", - "@nivo/line": "^0.84.0", - "@pinata/sdk": "^2.1.0", - "@radix-ui/react-accordion": "^1.1.2", - "@radix-ui/react-dialog": "^1.0.5", - "@radix-ui/react-dropdown-menu": "^2.0.6", - "@rainbow-me/rainbowkit": "^2.0.1", - "@rainbow-me/rainbowkit-siwe-next-auth": "^0.4.0", - "@semaphore-protocol/core": "4.0.0-beta.16", - "@semaphore-protocol/data": "4.0.0-beta.16", - "@t3-oss/env-nextjs": "^0.8.0", - "@tailwindcss/forms": "^0.5.7", - "@tanstack/react-query": "^5.24.1", - "@testing-library/react": "^14.1.2", - "@trpc/client": "11.0.0-next-beta.294", - "@trpc/next": "11.0.0-next-beta.294", - "@trpc/react-query": "11.0.0-next-beta.294", - "@trpc/server": "11.0.0-next-beta.294", - "@vercel/blob": "^0.19.0", - "clsx": "^2.1.0", - "cmdk": "^0.2.0", - "date-fns": "^3.6.0", - "ethers": "^6.13.1", - "formidable": "^3.5.1", - "graphql-request": "^6.1.0", - "lowdb": "^1.0.0", - "lucide-react": "^0.316.0", - "maci-cli": "0.0.0-ci.4d2d340", - "maci-domainobjs": "0.0.0-ci.4d2d340", - "next": "^14.1.0", - "next-auth": "^4.24.5", - "next-themes": "^0.2.1", - "node-fetch-cache": "^4.1.0", - "nuqs": "^1.17.1", - "p-limit": "^5.0.0", - "react": "18.2.0", - "react-dom": "18.2.0", - "react-hook-form": "^7.49.3", - "react-icons": "^5.0.1", - "react-markdown": "^9.0.1", - "react-number-format": "^5.3.1", - "react-use": "^17.5.0", - "siwe": "^2.1.4", - "sonner": "^1.4.0", - "superjson": "^2.2.1", - "tailwindcss": "^3.4.1", - "tailwind-merge": "^2.2.1", - "tailwind-variants": "^0.1.20", - "viem": "^2.7.15", - "wagmi": "^2.9.8", - "zod": "3.22.4" + "lint": "pnpm run lint:coordinator && pnpm run lint:interface", + "lint:coordinator": "eslint './packages/coordinator/**/*.ts'", + "lint:coordinator:fix": "eslint './packages/coordinator/**/*.ts' --fix", + "lint:interface": "lerna run lint --scope=maci-platform-interface", + "lint:interface:fix": "lerna run lint:fix --scope=maci-platform-interface", + "lint:fix": "pnpm run lint:coordinator:fix && pnpm run lint:interface:fix", + "types": "lerna run types", + "docs": "lerna run docs", + "prepare": "is-ci || husky", + "start": "lerna run start --scope=maci-platform-interface", + "dev:interface": "lerna run dev --scope=maci-platform-interface", + "test:coordinator": "lerna run test --scope=maci-coordinator", + "test:interface:e2e": "lerna run test:e2e --scope=maci-platform-interface", + "hardhat": "lerna run hardhat --scope=maci-platform-interface" }, + "author": "PSE", "devDependencies": { "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", - "@next/eslint-plugin-next": "^14.2.3", - "@playwright/test": "^1.45.0", - "@synthetixio/synpress": "^3.7.3", - "@tailwindcss/typography": "^0.5.10", - "@testing-library/jest-dom": "^6.4.5", - "@types/eslint": "^8.56.2", - "@types/formidable": "^3.4.5", - "@types/lowdb": "^1.0.15", - "@types/node": "^20.11.10", - "@types/node-fetch-cache": "^3.0.5", - "@types/papaparse": "^5.3.14", - "@types/react": "^18.2.48", - "@types/react-dom": "^18.2.18", - "@typescript-eslint/eslint-plugin": "^6.19.1", - "@typescript-eslint/parser": "^6.19.1", - "@vitejs/plugin-react": "^4.3.1", - "autoprefixer": "^10.4.17", - "dotenv": "^16.4.1", + "@typescript-eslint/eslint-plugin": "^7.17.0", + "@typescript-eslint/parser": "^7.17.0", + "conventional-changelog-conventionalcommits": "^8.0.0", + "cz-conventional-changelog": "^3.3.0", "eslint": "^8.57.0", "eslint-config-airbnb": "^19.0.4", - "eslint-config-next": "14.2.4", - "eslint-config-prettier": "^9.1.0", + "eslint-config-prettier": "^9.0.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-json": "^4.0.0", - "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-playwright": "^1.6.2", - "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-react": "^7.34.3", + "eslint-plugin-jsx-a11y": "^6.9.0", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-react": "^7.35.0", "eslint-plugin-react-hooks": "^4.6.2", - "eslint-plugin-unused-imports": "^4.0.0", - "happy-dom": "^13.3.2", - "hardhat": "^2.22.3", - "husky": "^9.0.11", + "eslint-plugin-unused-imports": "^3.2.0", + "husky": "^9.1.1", "is-ci": "^3.0.1", - "jsdom": "^24.0.0", - "ky": "^1.2.0", + "lerna": "^8.1.7", "lint-staged": "^15.2.7", - "msw": "^2.1.5", - "msw-trpc": "2.0.0-beta.0", - "mws": "^2.0.11", - "next-router-mock": "^0.9.11", - "postcss": "^8.4.33", - "prettier": "^3.3.2", - "prettier-plugin-tailwindcss": "^0.5.11", - "typescript": "^5.3.3", - "vite": "^5.3.1", - "vite-tsconfig-paths": "^4.3.2", - "vitest": "^1.6.0", - "vitest-mock-extended": "^1.3.1" - }, - "ct3aMetadata": { - "initVersion": "7.24.1" - }, - "msw": { - "workerDirectory": "public" + "prettier": "^3.3.3", + "typescript": "^5.5.4" }, - "jest": { - "moduleFileExtensions": [ - "js", - "json", - "ts" - ], - "rootDir": ".", - "roots": [ - "