@maci-protocol/coordinator 0.0.0-ci.00107eb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +103 -0
- package/build/hardhat.config.cjs +39 -0
- package/build/hardhat.config.cjs.map +1 -0
- package/build/hardhat.config.d.cts +27 -0
- package/build/hardhat.config.d.cts.map +1 -0
- package/build/scripts/generateKeypair.d.ts +2 -0
- package/build/scripts/generateKeypair.d.ts.map +1 -0
- package/build/scripts/generateKeypair.js +25 -0
- package/build/scripts/generateKeypair.js.map +1 -0
- package/build/scripts/generateMaciKeyPair.d.ts +2 -0
- package/build/scripts/generateMaciKeyPair.d.ts.map +1 -0
- package/build/scripts/generateMaciKeyPair.js +3 -0
- package/build/scripts/generateMaciKeyPair.js.map +1 -0
- package/build/scripts/getAuthHeader.d.ts +2 -0
- package/build/scripts/getAuthHeader.d.ts.map +1 -0
- package/build/scripts/getAuthHeader.js +31 -0
- package/build/scripts/getAuthHeader.js.map +1 -0
- package/build/tests/constants.d.ts +7 -0
- package/build/tests/constants.d.ts.map +1 -0
- package/build/tests/constants.js +11 -0
- package/build/tests/constants.js.map +1 -0
- package/build/tests/e2e.deploy.test.d.ts +2 -0
- package/build/tests/e2e.deploy.test.d.ts.map +1 -0
- package/build/tests/e2e.deploy.test.js +264 -0
- package/build/tests/e2e.deploy.test.js.map +1 -0
- package/build/tests/e2e.redis.test.d.ts +2 -0
- package/build/tests/e2e.redis.test.d.ts.map +1 -0
- package/build/tests/e2e.redis.test.js +118 -0
- package/build/tests/e2e.redis.test.js.map +1 -0
- package/build/tests/utils.d.ts +20 -0
- package/build/tests/utils.d.ts.map +1 -0
- package/build/tests/utils.js +55 -0
- package/build/tests/utils.js.map +1 -0
- package/build/ts/app.module.d.ts +3 -0
- package/build/ts/app.module.d.ts.map +1 -0
- package/build/ts/app.module.js +42 -0
- package/build/ts/app.module.js.map +1 -0
- package/build/ts/auth/AccountSignatureGuard.service.d.ts +44 -0
- package/build/ts/auth/AccountSignatureGuard.service.d.ts.map +1 -0
- package/build/ts/auth/AccountSignatureGuard.service.js +96 -0
- package/build/ts/auth/AccountSignatureGuard.service.js.map +1 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts +2 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts.map +1 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.js +113 -0
- package/build/ts/auth/__tests__/AccountSignatureGuard.test.js.map +1 -0
- package/build/ts/common/__tests__/common.test.d.ts +2 -0
- package/build/ts/common/__tests__/common.test.d.ts.map +1 -0
- package/build/ts/common/__tests__/common.test.js +77 -0
- package/build/ts/common/__tests__/common.test.js.map +1 -0
- package/build/ts/common/accountAbstraction.d.ts +38 -0
- package/build/ts/common/accountAbstraction.d.ts.map +1 -0
- package/build/ts/common/accountAbstraction.js +83 -0
- package/build/ts/common/accountAbstraction.js.map +1 -0
- package/build/ts/common/chain.d.ts +22 -0
- package/build/ts/common/chain.d.ts.map +1 -0
- package/build/ts/common/chain.js +37 -0
- package/build/ts/common/chain.js.map +1 -0
- package/build/ts/common/coordinatorKeypair.d.ts +7 -0
- package/build/ts/common/coordinatorKeypair.d.ts.map +1 -0
- package/build/ts/common/coordinatorKeypair.js +14 -0
- package/build/ts/common/coordinatorKeypair.js.map +1 -0
- package/build/ts/common/errors.d.ts +36 -0
- package/build/ts/common/errors.d.ts.map +1 -0
- package/build/ts/common/errors.js +37 -0
- package/build/ts/common/errors.js.map +1 -0
- package/build/ts/common/http.d.ts +6 -0
- package/build/ts/common/http.d.ts.map +1 -0
- package/build/ts/common/http.js +49 -0
- package/build/ts/common/http.js.map +1 -0
- package/build/ts/common/index.d.ts +6 -0
- package/build/ts/common/index.d.ts.map +1 -0
- package/build/ts/common/index.js +6 -0
- package/build/ts/common/index.js.map +1 -0
- package/build/ts/common/networks.d.ts +10 -0
- package/build/ts/common/networks.d.ts.map +1 -0
- package/build/ts/common/networks.js +61 -0
- package/build/ts/common/networks.js.map +1 -0
- package/build/ts/common/types.d.ts +8 -0
- package/build/ts/common/types.d.ts.map +1 -0
- package/build/ts/common/types.js +2 -0
- package/build/ts/common/types.js.map +1 -0
- package/build/ts/crypto/__tests__/crypto.service.test.d.ts +2 -0
- package/build/ts/crypto/__tests__/crypto.service.test.d.ts.map +1 -0
- package/build/ts/crypto/__tests__/crypto.service.test.js +26 -0
- package/build/ts/crypto/__tests__/crypto.service.test.js.map +1 -0
- package/build/ts/crypto/crypto.module.d.ts +3 -0
- package/build/ts/crypto/crypto.module.d.ts.map +1 -0
- package/build/ts/crypto/crypto.module.js +18 -0
- package/build/ts/crypto/crypto.module.js.map +1 -0
- package/build/ts/crypto/crypto.service.d.ts +31 -0
- package/build/ts/crypto/crypto.service.d.ts.map +1 -0
- package/build/ts/crypto/crypto.service.js +68 -0
- package/build/ts/crypto/crypto.service.js.map +1 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.d.ts +2 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.js +82 -0
- package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -0
- package/build/ts/deployer/__tests__/deployer.service.test.d.ts +2 -0
- package/build/ts/deployer/__tests__/deployer.service.test.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/deployer.service.test.js +272 -0
- package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -0
- package/build/ts/deployer/__tests__/utils.d.ts +61 -0
- package/build/ts/deployer/__tests__/utils.d.ts.map +1 -0
- package/build/ts/deployer/__tests__/utils.js +122 -0
- package/build/ts/deployer/__tests__/utils.js.map +1 -0
- package/build/ts/deployer/constants.d.ts +13 -0
- package/build/ts/deployer/constants.d.ts.map +1 -0
- package/build/ts/deployer/constants.js +13 -0
- package/build/ts/deployer/constants.js.map +1 -0
- package/build/ts/deployer/deployer.controller.d.ts +34 -0
- package/build/ts/deployer/deployer.controller.d.ts.map +1 -0
- package/build/ts/deployer/deployer.controller.js +102 -0
- package/build/ts/deployer/deployer.controller.js.map +1 -0
- package/build/ts/deployer/deployer.module.d.ts +3 -0
- package/build/ts/deployer/deployer.module.d.ts.map +1 -0
- package/build/ts/deployer/deployer.module.js +23 -0
- package/build/ts/deployer/deployer.module.js.map +1 -0
- package/build/ts/deployer/deployer.service.d.ts +85 -0
- package/build/ts/deployer/deployer.service.d.ts.map +1 -0
- package/build/ts/deployer/deployer.service.js +505 -0
- package/build/ts/deployer/deployer.service.js.map +1 -0
- package/build/ts/deployer/dto.d.ts +46 -0
- package/build/ts/deployer/dto.d.ts.map +1 -0
- package/build/ts/deployer/dto.js +125 -0
- package/build/ts/deployer/dto.js.map +1 -0
- package/build/ts/deployer/types.d.ts +351 -0
- package/build/ts/deployer/types.d.ts.map +1 -0
- package/build/ts/deployer/types.js +2 -0
- package/build/ts/deployer/types.js.map +1 -0
- package/build/ts/file/__tests__/file.service.test.d.ts +2 -0
- package/build/ts/file/__tests__/file.service.test.d.ts.map +1 -0
- package/build/ts/file/__tests__/file.service.test.js +77 -0
- package/build/ts/file/__tests__/file.service.test.js.map +1 -0
- package/build/ts/file/file.module.d.ts +3 -0
- package/build/ts/file/file.module.d.ts.map +1 -0
- package/build/ts/file/file.module.js +18 -0
- package/build/ts/file/file.module.js.map +1 -0
- package/build/ts/file/file.service.d.ts +63 -0
- package/build/ts/file/file.service.d.ts.map +1 -0
- package/build/ts/file/file.service.js +121 -0
- package/build/ts/file/file.service.js.map +1 -0
- package/build/ts/file/types.d.ts +36 -0
- package/build/ts/file/types.d.ts.map +1 -0
- package/build/ts/file/types.js +2 -0
- package/build/ts/file/types.js.map +1 -0
- package/build/ts/health/__tests__/health.controller.test.d.ts +2 -0
- package/build/ts/health/__tests__/health.controller.test.d.ts.map +1 -0
- package/build/ts/health/__tests__/health.controller.test.js +52 -0
- package/build/ts/health/__tests__/health.controller.test.js.map +1 -0
- package/build/ts/health/__tests__/health.service.test.d.ts +2 -0
- package/build/ts/health/__tests__/health.service.test.d.ts.map +1 -0
- package/build/ts/health/__tests__/health.service.test.js +101 -0
- package/build/ts/health/__tests__/health.service.test.js.map +1 -0
- package/build/ts/health/health.controller.d.ts +16 -0
- package/build/ts/health/health.controller.d.ts.map +1 -0
- package/build/ts/health/health.controller.js +43 -0
- package/build/ts/health/health.controller.js.map +1 -0
- package/build/ts/health/health.module.d.ts +3 -0
- package/build/ts/health/health.module.d.ts.map +1 -0
- package/build/ts/health/health.module.js +22 -0
- package/build/ts/health/health.module.js.map +1 -0
- package/build/ts/health/health.service.d.ts +42 -0
- package/build/ts/health/health.service.d.ts.map +1 -0
- package/build/ts/health/health.service.js +176 -0
- package/build/ts/health/health.service.js.map +1 -0
- package/build/ts/health/types.d.ts +87 -0
- package/build/ts/health/types.d.ts.map +1 -0
- package/build/ts/health/types.js +2 -0
- package/build/ts/health/types.js.map +1 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts +11 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.d.ts.map +1 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js +12 -0
- package/build/ts/jest/__mocks__/@openzeppelin/merkle-tree.js.map +1 -0
- package/build/ts/jest/setup.d.ts +8 -0
- package/build/ts/jest/setup.d.ts.map +1 -0
- package/build/ts/jest/setup.js +2 -0
- package/build/ts/jest/setup.js.map +1 -0
- package/build/ts/jest/transform.d.ts +8 -0
- package/build/ts/jest/transform.d.ts.map +1 -0
- package/build/ts/jest/transform.js +10 -0
- package/build/ts/jest/transform.js.map +1 -0
- package/build/ts/main.d.ts +2 -0
- package/build/ts/main.d.ts.map +1 -0
- package/build/ts/main.js +46 -0
- package/build/ts/main.js.map +1 -0
- package/build/ts/proof/__tests__/proof.controller.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.controller.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.controller.test.js +90 -0
- package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -0
- package/build/ts/proof/__tests__/proof.gateway.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.gateway.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.gateway.test.js +63 -0
- package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -0
- package/build/ts/proof/__tests__/proof.service.test.d.ts +2 -0
- package/build/ts/proof/__tests__/proof.service.test.d.ts.map +1 -0
- package/build/ts/proof/__tests__/proof.service.test.js +84 -0
- package/build/ts/proof/__tests__/proof.service.test.js.map +1 -0
- package/build/ts/proof/dto.d.ts +70 -0
- package/build/ts/proof/dto.d.ts.map +1 -0
- package/build/ts/proof/dto.js +261 -0
- package/build/ts/proof/dto.js.map +1 -0
- package/build/ts/proof/proof.controller.d.ts +47 -0
- package/build/ts/proof/proof.controller.d.ts.map +1 -0
- package/build/ts/proof/proof.controller.js +158 -0
- package/build/ts/proof/proof.controller.js.map +1 -0
- package/build/ts/proof/proof.gateway.d.ts +35 -0
- package/build/ts/proof/proof.gateway.d.ts.map +1 -0
- package/build/ts/proof/proof.gateway.js +93 -0
- package/build/ts/proof/proof.gateway.js.map +1 -0
- package/build/ts/proof/proof.module.d.ts +3 -0
- package/build/ts/proof/proof.module.d.ts.map +1 -0
- package/build/ts/proof/proof.module.js +25 -0
- package/build/ts/proof/proof.module.js.map +1 -0
- package/build/ts/proof/proof.service.d.ts +52 -0
- package/build/ts/proof/proof.service.d.ts.map +1 -0
- package/build/ts/proof/proof.service.js +164 -0
- package/build/ts/proof/proof.service.js.map +1 -0
- package/build/ts/proof/types.d.ts +144 -0
- package/build/ts/proof/types.d.ts.map +1 -0
- package/build/ts/proof/types.js +11 -0
- package/build/ts/proof/types.js.map +1 -0
- package/build/ts/redis/__tests__/redis.service.test.d.ts +2 -0
- package/build/ts/redis/__tests__/redis.service.test.d.ts.map +1 -0
- package/build/ts/redis/__tests__/redis.service.test.js +148 -0
- package/build/ts/redis/__tests__/redis.service.test.js.map +1 -0
- package/build/ts/redis/redis.module.d.ts +3 -0
- package/build/ts/redis/redis.module.d.ts.map +1 -0
- package/build/ts/redis/redis.module.js +18 -0
- package/build/ts/redis/redis.module.js.map +1 -0
- package/build/ts/redis/redis.service.d.ts +53 -0
- package/build/ts/redis/redis.service.d.ts.map +1 -0
- package/build/ts/redis/redis.service.js +99 -0
- package/build/ts/redis/redis.service.js.map +1 -0
- package/build/ts/redis/types.d.ts +66 -0
- package/build/ts/redis/types.d.ts.map +1 -0
- package/build/ts/redis/types.js +2 -0
- package/build/ts/redis/types.js.map +1 -0
- package/build/ts/redis/utils.d.ts +20 -0
- package/build/ts/redis/utils.d.ts.map +1 -0
- package/build/ts/redis/utils.js +27 -0
- package/build/ts/redis/utils.js.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts +2 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.d.ts.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.js +62 -0
- package/build/ts/scheduler/__tests__/scheduler.controller.test.js.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts +2 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.d.ts.map +1 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.js +369 -0
- package/build/ts/scheduler/__tests__/scheduler.service.test.js.map +1 -0
- package/build/ts/scheduler/dto.d.ts +41 -0
- package/build/ts/scheduler/dto.d.ts.map +1 -0
- package/build/ts/scheduler/dto.js +115 -0
- package/build/ts/scheduler/dto.js.map +1 -0
- package/build/ts/scheduler/scheduler.controller.d.ts +32 -0
- package/build/ts/scheduler/scheduler.controller.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.controller.js +118 -0
- package/build/ts/scheduler/scheduler.controller.js.map +1 -0
- package/build/ts/scheduler/scheduler.module.d.ts +3 -0
- package/build/ts/scheduler/scheduler.module.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.module.js +24 -0
- package/build/ts/scheduler/scheduler.module.js.map +1 -0
- package/build/ts/scheduler/scheduler.service.d.ts +71 -0
- package/build/ts/scheduler/scheduler.service.d.ts.map +1 -0
- package/build/ts/scheduler/scheduler.service.js +297 -0
- package/build/ts/scheduler/scheduler.service.js.map +1 -0
- package/build/ts/scheduler/types.d.ts +65 -0
- package/build/ts/scheduler/types.d.ts.map +1 -0
- package/build/ts/scheduler/types.js +2 -0
- package/build/ts/scheduler/types.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts +2 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +44 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts +2 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +76 -0
- package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -0
- package/build/ts/sessionKeys/__tests__/utils.d.ts +25 -0
- package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -0
- package/build/ts/sessionKeys/__tests__/utils.js +65 -0
- package/build/ts/sessionKeys/__tests__/utils.js.map +1 -0
- package/build/ts/sessionKeys/dto.d.ts +11 -0
- package/build/ts/sessionKeys/dto.d.ts.map +1 -0
- package/build/ts/sessionKeys/dto.js +29 -0
- package/build/ts/sessionKeys/dto.js.map +1 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
- package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.controller.d.ts +26 -0
- package/build/ts/sessionKeys/sessionKeys.controller.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.controller.js +74 -0
- package/build/ts/sessionKeys/sessionKeys.controller.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.module.d.ts +3 -0
- package/build/ts/sessionKeys/sessionKeys.module.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.module.js +23 -0
- package/build/ts/sessionKeys/sessionKeys.module.js.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.service.d.ts +62 -0
- package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -0
- package/build/ts/sessionKeys/sessionKeys.service.js +121 -0
- package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -0
- package/build/ts/sessionKeys/types.d.ts +11 -0
- package/build/ts/sessionKeys/types.d.ts.map +1 -0
- package/build/ts/sessionKeys/types.js +2 -0
- package/build/ts/sessionKeys/types.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.js +50 -0
- package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +83 -0
- package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts +2 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts.map +1 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.js +58 -0
- package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -0
- package/build/ts/subgraph/dto.d.ts +27 -0
- package/build/ts/subgraph/dto.d.ts.map +1 -0
- package/build/ts/subgraph/dto.js +83 -0
- package/build/ts/subgraph/dto.js.map +1 -0
- package/build/ts/subgraph/subgraph.controller.d.ts +24 -0
- package/build/ts/subgraph/subgraph.controller.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.controller.js +71 -0
- package/build/ts/subgraph/subgraph.controller.js.map +1 -0
- package/build/ts/subgraph/subgraph.gateway.d.ts +35 -0
- package/build/ts/subgraph/subgraph.gateway.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.gateway.js +93 -0
- package/build/ts/subgraph/subgraph.gateway.js.map +1 -0
- package/build/ts/subgraph/subgraph.module.d.ts +3 -0
- package/build/ts/subgraph/subgraph.module.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.module.js +23 -0
- package/build/ts/subgraph/subgraph.module.js.map +1 -0
- package/build/ts/subgraph/subgraph.service.d.ts +24 -0
- package/build/ts/subgraph/subgraph.service.d.ts.map +1 -0
- package/build/ts/subgraph/subgraph.service.js +119 -0
- package/build/ts/subgraph/subgraph.service.js.map +1 -0
- package/build/ts/subgraph/types.d.ts +93 -0
- package/build/ts/subgraph/types.d.ts.map +1 -0
- package/build/ts/subgraph/types.js +24 -0
- package/build/ts/subgraph/types.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +131 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { ContractStorage, deployFreeForAllSignUpPolicy, deployPoll, deployVerifier, deployVerifyingKeysRegistryContract, deployMaci, deployConstantInitialVoiceCreditProxyFactory, deployConstantInitialVoiceCreditProxy, getDeployedPolicyProxyFactories, ECheckerFactories, EContracts, EInitialVoiceCreditProxies, EInitialVoiceCreditProxiesFactories, EPolicies, EPolicyFactories, ESupportedChains, ECheckers, } from "@maci-protocol/sdk";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
import { zeroAddress } from "viem";
|
|
4
|
+
import { ErrorCodes } from "../../common";
|
|
5
|
+
import { DeployerService } from "../deployer.service";
|
|
6
|
+
import { testMaciDeploymentConfig, testPollDeploymentConfig } from "./utils";
|
|
7
|
+
dotenv.config();
|
|
8
|
+
jest.mock("@maci-protocol/sdk", () => ({
|
|
9
|
+
...jest.requireActual("@maci-protocol/sdk"),
|
|
10
|
+
ContractStorage: {
|
|
11
|
+
getInstance: jest.fn(),
|
|
12
|
+
},
|
|
13
|
+
deployFreeForAllSignUpPolicy: jest.fn(),
|
|
14
|
+
deployPoll: jest.fn(),
|
|
15
|
+
deployVerifyingKeysRegistryContract: jest.fn(),
|
|
16
|
+
deployVerifier: jest.fn(),
|
|
17
|
+
getDeployedPolicyProxyFactories: jest.fn(),
|
|
18
|
+
setVerifyingKeys: jest.fn(),
|
|
19
|
+
deployMaci: jest.fn(),
|
|
20
|
+
deployConstantInitialVoiceCreditProxyFactory: jest.fn(),
|
|
21
|
+
deployConstantInitialVoiceCreditProxy: jest.fn(),
|
|
22
|
+
}));
|
|
23
|
+
describe("DeployerService", () => {
|
|
24
|
+
const chain = ESupportedChains.OptimismSepolia;
|
|
25
|
+
const signer = {
|
|
26
|
+
getAddress: jest.fn().mockResolvedValue(zeroAddress),
|
|
27
|
+
};
|
|
28
|
+
const approval = "approval";
|
|
29
|
+
const sessionKeyAddress = zeroAddress;
|
|
30
|
+
const mockStorage = {
|
|
31
|
+
register: jest.fn(),
|
|
32
|
+
getAddress: jest.fn(),
|
|
33
|
+
};
|
|
34
|
+
const mockContract = {
|
|
35
|
+
deploymentTransaction: jest.fn(),
|
|
36
|
+
getAddress: jest.fn().mockResolvedValue(zeroAddress.replace("0x0", "0x1")),
|
|
37
|
+
};
|
|
38
|
+
const fileService = {
|
|
39
|
+
getZkeyFilePaths: jest.fn(),
|
|
40
|
+
};
|
|
41
|
+
const sessionKeyService = {
|
|
42
|
+
getCoordinatorSigner: jest.fn().mockResolvedValue(signer),
|
|
43
|
+
};
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
mockStorage.getAddress = jest.fn().mockReturnValue(zeroAddress);
|
|
46
|
+
sessionKeyService.getCoordinatorSigner = jest.fn().mockResolvedValue(signer);
|
|
47
|
+
fileService.getZkeyFilePaths = jest.fn().mockReturnValue({ zkey: "" });
|
|
48
|
+
ContractStorage.getInstance.mockReturnValue(mockStorage);
|
|
49
|
+
deployFreeForAllSignUpPolicy.mockResolvedValue([
|
|
50
|
+
mockContract,
|
|
51
|
+
mockContract,
|
|
52
|
+
mockContract,
|
|
53
|
+
mockContract,
|
|
54
|
+
]);
|
|
55
|
+
deployVerifier.mockResolvedValue(mockContract);
|
|
56
|
+
deployVerifyingKeysRegistryContract.mockResolvedValue(mockContract);
|
|
57
|
+
deployConstantInitialVoiceCreditProxyFactory.mockResolvedValue(mockContract);
|
|
58
|
+
deployConstantInitialVoiceCreditProxy.mockResolvedValue(mockContract);
|
|
59
|
+
deployPoll.mockResolvedValue({
|
|
60
|
+
pollContractAddress: zeroAddress,
|
|
61
|
+
messageProcessorContractAddress: zeroAddress,
|
|
62
|
+
tallyContractAddress: zeroAddress,
|
|
63
|
+
pollId: 0n,
|
|
64
|
+
});
|
|
65
|
+
deployMaci.mockResolvedValue({
|
|
66
|
+
maciContractAddress: zeroAddress.replace("0x0", "0x1"),
|
|
67
|
+
pollFactoryContractAddress: zeroAddress,
|
|
68
|
+
messageProcessorFactoryContractAddress: zeroAddress,
|
|
69
|
+
tallyFactoryContractAddress: zeroAddress,
|
|
70
|
+
poseidonAddresses: {
|
|
71
|
+
poseidonT3: zeroAddress,
|
|
72
|
+
poseidonT4: zeroAddress,
|
|
73
|
+
poseidonT5: zeroAddress,
|
|
74
|
+
poseidonT6: zeroAddress,
|
|
75
|
+
},
|
|
76
|
+
verifierContractAddress: zeroAddress,
|
|
77
|
+
verifyingKeysRegistryContractAddress: zeroAddress,
|
|
78
|
+
});
|
|
79
|
+
getDeployedPolicyProxyFactories.mockResolvedValue({ checker: undefined, policy: undefined });
|
|
80
|
+
});
|
|
81
|
+
afterEach(() => {
|
|
82
|
+
jest.clearAllMocks();
|
|
83
|
+
});
|
|
84
|
+
describe("deployAndSavePolicy", () => {
|
|
85
|
+
test("should throw when the policy is not existent", async () => {
|
|
86
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
87
|
+
await expect(deployerService.deployAndSavePolicy(signer, chain, {
|
|
88
|
+
policyType: "NonExistent",
|
|
89
|
+
checkerType: "NonExistent",
|
|
90
|
+
})).rejects.toThrow(ErrorCodes.UNSUPPORTED_POLICY.toString());
|
|
91
|
+
});
|
|
92
|
+
test("should deploy policy if none is stored", async () => {
|
|
93
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
94
|
+
const policy = await deployerService.deployAndSavePolicy(signer, chain, {
|
|
95
|
+
policyType: EPolicies.FreeForAll,
|
|
96
|
+
checkerType: ECheckers.FreeForAll,
|
|
97
|
+
});
|
|
98
|
+
expect(policy).toBeDefined();
|
|
99
|
+
expect(await policy.getAddress()).not.toBe(zeroAddress);
|
|
100
|
+
});
|
|
101
|
+
test("should save factories (policy and checker) after deploying policy", async () => {
|
|
102
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
103
|
+
await deployerService.deployAndSavePolicy(signer, chain, {
|
|
104
|
+
policyType: EPolicies.FreeForAll,
|
|
105
|
+
checkerType: ECheckers.FreeForAll,
|
|
106
|
+
});
|
|
107
|
+
expect(mockStorage.register).toHaveBeenCalledTimes(4);
|
|
108
|
+
expect(mockStorage.register).toHaveBeenNthCalledWith(1, {
|
|
109
|
+
id: EPolicies.FreeForAll,
|
|
110
|
+
name: EPolicies.FreeForAll,
|
|
111
|
+
contract: mockContract,
|
|
112
|
+
args: [await mockContract.getAddress()],
|
|
113
|
+
network: chain,
|
|
114
|
+
});
|
|
115
|
+
expect(mockStorage.register).toHaveBeenNthCalledWith(2, {
|
|
116
|
+
id: ECheckers.FreeForAll,
|
|
117
|
+
name: ECheckers.FreeForAll,
|
|
118
|
+
contract: mockContract,
|
|
119
|
+
args: [],
|
|
120
|
+
network: chain,
|
|
121
|
+
});
|
|
122
|
+
expect(mockStorage.register).toHaveBeenNthCalledWith(3, {
|
|
123
|
+
id: EPolicyFactories.FreeForAll,
|
|
124
|
+
name: EPolicyFactories.FreeForAll,
|
|
125
|
+
contract: mockContract,
|
|
126
|
+
network: chain,
|
|
127
|
+
});
|
|
128
|
+
expect(mockStorage.register).toHaveBeenNthCalledWith(4, {
|
|
129
|
+
id: ECheckerFactories.FreeForAll,
|
|
130
|
+
name: ECheckerFactories.FreeForAll,
|
|
131
|
+
contract: mockContract,
|
|
132
|
+
network: chain,
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
test("should reuse policy factories if already stored", async () => {
|
|
136
|
+
getDeployedPolicyProxyFactories.mockResolvedValue({
|
|
137
|
+
checker: mockContract,
|
|
138
|
+
policy: mockContract,
|
|
139
|
+
});
|
|
140
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
141
|
+
await deployerService.deployAndSavePolicy(signer, chain, {
|
|
142
|
+
policyType: EPolicies.FreeForAll,
|
|
143
|
+
checkerType: ECheckers.FreeForAll,
|
|
144
|
+
});
|
|
145
|
+
await deployerService.deployAndSavePolicy(signer, chain, {
|
|
146
|
+
policyType: EPolicies.FreeForAll,
|
|
147
|
+
checkerType: ECheckers.FreeForAll,
|
|
148
|
+
});
|
|
149
|
+
expect(mockStorage.register).toHaveBeenCalledTimes(4);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe("deployAndSaveVoiceCreditProxyFactory", () => {
|
|
153
|
+
test("should throw when the voice credit proxy factory is not existent", async () => {
|
|
154
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
155
|
+
await expect(deployerService.deployAndSaveVoiceCreditProxyFactory(signer, "NonExistent", chain)).rejects.toThrow(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY_FACTORY.toString());
|
|
156
|
+
});
|
|
157
|
+
test("should deploy voice credit proxy factory if none is stored", async () => {
|
|
158
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
159
|
+
const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
|
|
160
|
+
expect(constantInitialVoiceCreditProxyFactory).toBeDefined();
|
|
161
|
+
expect(await constantInitialVoiceCreditProxyFactory.getAddress()).not.toBe(zeroAddress);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
describe("deployAndSaveVoiceCreditProxy", () => {
|
|
165
|
+
test("should throw when the voice credit proxy is not existent", async () => {
|
|
166
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
167
|
+
const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
|
|
168
|
+
await expect(deployerService.deployAndSaveVoiceCreditProxy(signer, "NonExistent", chain, constantInitialVoiceCreditProxyFactory)).rejects.toThrow(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY.toString());
|
|
169
|
+
});
|
|
170
|
+
test("should deploy voice credit proxy if none is stored", async () => {
|
|
171
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
172
|
+
const constantInitialVoiceCreditProxyFactory = await deployerService.deployAndSaveVoiceCreditProxyFactory(signer, EInitialVoiceCreditProxiesFactories.Constant, chain);
|
|
173
|
+
const voiceCreditProxy = await deployerService.deployAndSaveVoiceCreditProxy(signer, EInitialVoiceCreditProxies.Constant, chain, constantInitialVoiceCreditProxyFactory, { amount: 100 });
|
|
174
|
+
expect(voiceCreditProxy).toBeDefined();
|
|
175
|
+
expect(await voiceCreditProxy.getAddress()).not.toBe(zeroAddress);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
describe("deployMaci", () => {
|
|
179
|
+
test("should throw when passing a non existent session key address", async () => {
|
|
180
|
+
sessionKeyService.getCoordinatorSigner = jest
|
|
181
|
+
.fn()
|
|
182
|
+
.mockRejectedValue(new Error(ErrorCodes.SESSION_KEY_NOT_FOUND.toString()));
|
|
183
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
184
|
+
await expect(deployerService.deployMaci({
|
|
185
|
+
config: testMaciDeploymentConfig,
|
|
186
|
+
chain,
|
|
187
|
+
approval,
|
|
188
|
+
sessionKeyAddress: "0x5",
|
|
189
|
+
})).rejects.toThrow(ErrorCodes.SESSION_KEY_NOT_FOUND.toString());
|
|
190
|
+
});
|
|
191
|
+
test("should throw when the approval is not valid", async () => {
|
|
192
|
+
sessionKeyService.getCoordinatorSigner = jest
|
|
193
|
+
.fn()
|
|
194
|
+
.mockRejectedValue(new Error(ErrorCodes.INVALID_APPROVAL.toString()));
|
|
195
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
196
|
+
await expect(deployerService.deployMaci({
|
|
197
|
+
config: testMaciDeploymentConfig,
|
|
198
|
+
chain,
|
|
199
|
+
approval: "0x123",
|
|
200
|
+
sessionKeyAddress,
|
|
201
|
+
})).rejects.toThrow(ErrorCodes.INVALID_APPROVAL.toString());
|
|
202
|
+
});
|
|
203
|
+
test("should deploy all new contracts", async () => {
|
|
204
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
205
|
+
const { address: maciAddress } = await deployerService.deployMaci({
|
|
206
|
+
config: testMaciDeploymentConfig,
|
|
207
|
+
chain,
|
|
208
|
+
approval,
|
|
209
|
+
sessionKeyAddress,
|
|
210
|
+
});
|
|
211
|
+
expect(maciAddress).toBe(zeroAddress.replace("0x0", "0x1"));
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
describe("deployPoll", () => {
|
|
215
|
+
test("should throw when there is no maci contract deployed", async () => {
|
|
216
|
+
ContractStorage.getInstance.mockReturnValue({
|
|
217
|
+
...mockStorage,
|
|
218
|
+
getAddress: jest
|
|
219
|
+
.fn()
|
|
220
|
+
.mockImplementation((key) => (key !== EContracts.MACI ? zeroAddress : undefined)),
|
|
221
|
+
});
|
|
222
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
223
|
+
await expect(deployerService.deployPoll({
|
|
224
|
+
approval,
|
|
225
|
+
sessionKeyAddress,
|
|
226
|
+
chain,
|
|
227
|
+
config: testPollDeploymentConfig,
|
|
228
|
+
})).rejects.toThrow(ErrorCodes.MACI_NOT_DEPLOYED.toString());
|
|
229
|
+
});
|
|
230
|
+
test("should throw when there is no verifier deployed", async () => {
|
|
231
|
+
ContractStorage.getInstance.mockReturnValue({
|
|
232
|
+
...mockStorage,
|
|
233
|
+
getAddress: jest
|
|
234
|
+
.fn()
|
|
235
|
+
.mockImplementation((key) => (key !== EContracts.Verifier ? zeroAddress : undefined)),
|
|
236
|
+
});
|
|
237
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
238
|
+
await expect(deployerService.deployPoll({
|
|
239
|
+
approval,
|
|
240
|
+
sessionKeyAddress,
|
|
241
|
+
chain,
|
|
242
|
+
config: testPollDeploymentConfig,
|
|
243
|
+
})).rejects.toThrow(ErrorCodes.VERIFIER_NOT_DEPLOYED.toString());
|
|
244
|
+
});
|
|
245
|
+
test("should throw when there is no verifying keys registry deployed", async () => {
|
|
246
|
+
ContractStorage.getInstance.mockReturnValue({
|
|
247
|
+
...mockStorage,
|
|
248
|
+
getAddress: jest
|
|
249
|
+
.fn()
|
|
250
|
+
.mockImplementation((key) => key !== EContracts.VerifyingKeysRegistry ? zeroAddress : undefined),
|
|
251
|
+
});
|
|
252
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
253
|
+
await expect(deployerService.deployPoll({
|
|
254
|
+
approval,
|
|
255
|
+
sessionKeyAddress,
|
|
256
|
+
chain,
|
|
257
|
+
config: testPollDeploymentConfig,
|
|
258
|
+
})).rejects.toThrow(ErrorCodes.VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED.toString());
|
|
259
|
+
});
|
|
260
|
+
test("should deploy a poll", async () => {
|
|
261
|
+
const deployerService = new DeployerService(sessionKeyService, fileService);
|
|
262
|
+
const { pollId } = await deployerService.deployPoll({
|
|
263
|
+
config: testPollDeploymentConfig,
|
|
264
|
+
chain,
|
|
265
|
+
approval,
|
|
266
|
+
sessionKeyAddress,
|
|
267
|
+
});
|
|
268
|
+
expect(pollId).toBe("0");
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
//# sourceMappingURL=deployer.service.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployer.service.test.js","sourceRoot":"","sources":["../../../../ts/deployer/__tests__/deployer.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,4BAA4B,EAC5B,UAAU,EACV,cAAc,EACd,mCAAmC,EACnC,UAAU,EACV,4CAA4C,EAC5C,qCAAqC,EACrC,+BAA+B,EAC/B,iBAAiB,EACjB,UAAU,EACV,0BAA0B,EAC1B,mCAAmC,EACnC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAE7E,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAY,EAAE,CAAC,CAAC;IAC9C,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC;IAC3C,eAAe,EAAE;QACf,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;KACvB;IACD,4BAA4B,EAAE,IAAI,CAAC,EAAE,EAAE;IACvC,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;IACrB,mCAAmC,EAAE,IAAI,CAAC,EAAE,EAAE;IAC9C,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;IACzB,+BAA+B,EAAE,IAAI,CAAC,EAAE,EAAE;IAC1C,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;IAC3B,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H,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EMode } from "@maci-protocol/sdk";
|
|
2
|
+
import { type IDeployMaciConfig, type IDeployPollConfig, type IEASCheckerArgs, type IGitcoinPassportCheckerArgs, type IHatsCheckerArgs, type IMerkleProofCheckerArgs, type ISemaphoreCheckerArgs, type ITokenCheckerArgs, type IZupassCheckerArgs } from "../types";
|
|
3
|
+
export declare const MSG_BATCH_SIZE = 20;
|
|
4
|
+
export declare const MODE = EMode.NON_QV;
|
|
5
|
+
/**
|
|
6
|
+
* MACI deployment configuration for testing
|
|
7
|
+
*/
|
|
8
|
+
export declare const testMaciDeploymentConfig: IDeployMaciConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Start date for the poll (it cannot be in the past)
|
|
11
|
+
*/
|
|
12
|
+
export declare const startDate: number;
|
|
13
|
+
/**
|
|
14
|
+
* Poll duration in seconds
|
|
15
|
+
* n seconds are added to the poll start date
|
|
16
|
+
*/
|
|
17
|
+
export declare const pollDuration = 60;
|
|
18
|
+
/**
|
|
19
|
+
* Poll start date extra seconds
|
|
20
|
+
* n seconds are added to the poll start date
|
|
21
|
+
* to give it time until it the previous poll contracts are deployed
|
|
22
|
+
*/
|
|
23
|
+
export declare const pollStartDateExtraSeconds = 60;
|
|
24
|
+
/**
|
|
25
|
+
* Poll deployment configuration for testing
|
|
26
|
+
*/
|
|
27
|
+
export declare const testPollDeploymentConfig: IDeployPollConfig;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* Policies
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* EAS Policy deployment configuration for testing
|
|
35
|
+
*/
|
|
36
|
+
export declare const EASPolicyDeploymentConfig: IEASCheckerArgs;
|
|
37
|
+
/**
|
|
38
|
+
* Zupass Policy deployment configuration for testing
|
|
39
|
+
*/
|
|
40
|
+
export declare const ZupassPolicyDeploymentConfig: IZupassCheckerArgs;
|
|
41
|
+
/**
|
|
42
|
+
* Semaphore Policy deployment configuration for testing
|
|
43
|
+
*/
|
|
44
|
+
export declare const SemaphorePolicyDeploymentConfig: ISemaphoreCheckerArgs;
|
|
45
|
+
/**
|
|
46
|
+
* HatsPolicy deployment configuration for testing
|
|
47
|
+
*/
|
|
48
|
+
export declare const HatsPolicyDeploymentConfig: IHatsCheckerArgs;
|
|
49
|
+
/**
|
|
50
|
+
* MerkleProofPolicy deployment configuration for testing
|
|
51
|
+
*/
|
|
52
|
+
export declare const MerkleProofPolicyDeploymentConfig: IMerkleProofCheckerArgs;
|
|
53
|
+
/**
|
|
54
|
+
* SignUpPolicy deployment configuration for testing
|
|
55
|
+
*/
|
|
56
|
+
export declare const SignUpPolicyDeploymentConfig: ITokenCheckerArgs;
|
|
57
|
+
/**
|
|
58
|
+
* GitcoinPassportPolicy deployment configuration for testing
|
|
59
|
+
*/
|
|
60
|
+
export declare const GitcoinPassportPolicyDeploymentConfig: IGitcoinPassportCheckerArgs;
|
|
61
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../ts/deployer/__tests__/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAGN,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,eAAO,MAAM,IAAI,eAAe,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBAmBtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,QAAgC,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBAoBtC,CAAC;AAEF;;;;GAIG;AACH;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAIvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,kBAK1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,EAAE,qBAG7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,gBAGxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,uBAE/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,iBAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qCAAqC,EAAE,2BAGnD,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { EPolicies, EInitialVoiceCreditProxies, EMode, EInitialVoiceCreditProxiesFactories, ECheckers, } from "@maci-protocol/sdk";
|
|
2
|
+
import { zeroHash } from "viem";
|
|
3
|
+
export const MSG_BATCH_SIZE = 20;
|
|
4
|
+
export const MODE = EMode.NON_QV;
|
|
5
|
+
/**
|
|
6
|
+
* MACI deployment configuration for testing
|
|
7
|
+
*/
|
|
8
|
+
export const testMaciDeploymentConfig = {
|
|
9
|
+
policy: {
|
|
10
|
+
policyType: EPolicies.FreeForAll,
|
|
11
|
+
checkerType: ECheckers.FreeForAll,
|
|
12
|
+
},
|
|
13
|
+
MACI: {
|
|
14
|
+
policy: EPolicies.FreeForAll,
|
|
15
|
+
stateTreeDepth: 10,
|
|
16
|
+
modes: [MODE],
|
|
17
|
+
},
|
|
18
|
+
VerifyingKeysRegistry: {
|
|
19
|
+
args: {
|
|
20
|
+
stateTreeDepth: "10",
|
|
21
|
+
pollStateTreeDepth: "10",
|
|
22
|
+
messageBatchSize: MSG_BATCH_SIZE,
|
|
23
|
+
voteOptionTreeDepth: "2",
|
|
24
|
+
tallyProcessingStateTreeDepth: "1",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Start date for the poll (it cannot be in the past)
|
|
30
|
+
*/
|
|
31
|
+
export const startDate = Math.floor(Date.now() / 1000);
|
|
32
|
+
/**
|
|
33
|
+
* Poll duration in seconds
|
|
34
|
+
* n seconds are added to the poll start date
|
|
35
|
+
*/
|
|
36
|
+
export const pollDuration = 60;
|
|
37
|
+
/**
|
|
38
|
+
* Poll start date extra seconds
|
|
39
|
+
* n seconds are added to the poll start date
|
|
40
|
+
* to give it time until it the previous poll contracts are deployed
|
|
41
|
+
*/
|
|
42
|
+
export const pollStartDateExtraSeconds = 60;
|
|
43
|
+
/**
|
|
44
|
+
* Poll deployment configuration for testing
|
|
45
|
+
*/
|
|
46
|
+
export const testPollDeploymentConfig = {
|
|
47
|
+
startDate,
|
|
48
|
+
endDate: startDate + pollDuration,
|
|
49
|
+
mode: MODE,
|
|
50
|
+
tallyProcessingStateTreeDepth: 1,
|
|
51
|
+
messageBatchSize: MSG_BATCH_SIZE,
|
|
52
|
+
pollStateTreeDepth: 10,
|
|
53
|
+
voteOptionTreeDepth: 2,
|
|
54
|
+
policy: {
|
|
55
|
+
policyType: EPolicies.FreeForAll,
|
|
56
|
+
checkerType: ECheckers.FreeForAll,
|
|
57
|
+
},
|
|
58
|
+
initialVoiceCreditsProxy: {
|
|
59
|
+
factoryType: EInitialVoiceCreditProxiesFactories.Constant,
|
|
60
|
+
type: EInitialVoiceCreditProxies.Constant,
|
|
61
|
+
args: {
|
|
62
|
+
amount: 100,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
voteOptions: 2n,
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* Policies
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* EAS Policy deployment configuration for testing
|
|
74
|
+
*/
|
|
75
|
+
export const EASPolicyDeploymentConfig = {
|
|
76
|
+
easAddress: "0xC2679fBD37d54388Ce493F1DB75320D236e1815e",
|
|
77
|
+
attester: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
78
|
+
schema: "0xe2636f31239f7948afdd9a9c477048b7fc2a089c347af60e3aa1251e5bf63e5c",
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Zupass Policy deployment configuration for testing
|
|
82
|
+
*/
|
|
83
|
+
export const ZupassPolicyDeploymentConfig = {
|
|
84
|
+
signer1: "13908133709081944902758389525983124100292637002438232157513257158004852609027",
|
|
85
|
+
signer2: "7654374482676219729919246464135900991450848628968334062174564799457623790084",
|
|
86
|
+
eventId: "0",
|
|
87
|
+
zupassVerifier: "0x2272cdb3596617886d0F48524DA486044E0376d6",
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Semaphore Policy deployment configuration for testing
|
|
91
|
+
*/
|
|
92
|
+
export const SemaphorePolicyDeploymentConfig = {
|
|
93
|
+
semaphoreContract: "0x0A09FB3f63c13F1C54F2fA41AFB1e7a98cffc774",
|
|
94
|
+
groupId: "0",
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* HatsPolicy deployment configuration for testing
|
|
98
|
+
*/
|
|
99
|
+
export const HatsPolicyDeploymentConfig = {
|
|
100
|
+
hatsProtocolAddress: "0x3bc1A0Ad72417f2d411118085256fC53CBdDd137",
|
|
101
|
+
criterionHats: ["26960358043289970096177553829315270011263390106506980876069447401472"],
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* MerkleProofPolicy deployment configuration for testing
|
|
105
|
+
*/
|
|
106
|
+
export const MerkleProofPolicyDeploymentConfig = {
|
|
107
|
+
root: zeroHash,
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* SignUpPolicy deployment configuration for testing
|
|
111
|
+
*/
|
|
112
|
+
export const SignUpPolicyDeploymentConfig = {
|
|
113
|
+
token: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7", // OP Sepolia USDC
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* GitcoinPassportPolicy deployment configuration for testing
|
|
117
|
+
*/
|
|
118
|
+
export const GitcoinPassportPolicyDeploymentConfig = {
|
|
119
|
+
decoderAddress: "0xe53C60F8069C2f0c3a84F9B3DB5cf56f3100ba56",
|
|
120
|
+
passingScore: "5",
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../ts/deployer/__tests__/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,0BAA0B,EAC1B,KAAK,EACL,mCAAmC,EACnC,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAchC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IACzD,MAAM,EAAE;QACN,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,WAAW,EAAE,SAAS,CAAC,UAAU;KAClC;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,SAAS,CAAC,UAAU;QAC5B,cAAc,EAAE,EAAE;QAClB,KAAK,EAAE,CAAC,IAAI,CAAC;KACd;IACD,qBAAqB,EAAE;QACrB,IAAI,EAAE;YACJ,cAAc,EAAE,IAAI;YACpB,kBAAkB,EAAE,IAAI;YACxB,gBAAgB,EAAE,cAAc;YAChC,mBAAmB,E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/D,OAAO,EAAE,GAAG;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAqB;IAC1D,mBAAmB,EAAE,4CAA4C;IACjE,aAAa,EAAE,CAAC,sEAAsE,CAAC;CACxF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAA4B;IACxE,IAAI,EAAE,QAAQ;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,KAAK,EAAE,4CAA4C,EAAE,kBAAkB;CACxE,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAgC;IAChF,cAAc,EAAE,4CAA4C;IAC5D,YAAY,EAAE,GAAG;CAClB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The maximum gas limit for a user operation
|
|
3
|
+
*/
|
|
4
|
+
export declare const MAX_GAS_LIMIT = 28000000n;
|
|
5
|
+
/**
|
|
6
|
+
* The divisor for the gas limit
|
|
7
|
+
*/
|
|
8
|
+
export declare const DIVISOR = 100n;
|
|
9
|
+
/**
|
|
10
|
+
* The extra gas limit percentage
|
|
11
|
+
*/
|
|
12
|
+
export declare const EXTRA_GAS_LIMIT_PERCENTAGE = 5n;
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../ts/deployer/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,OAAO,OAAO,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The maximum gas limit for a user operation
|
|
3
|
+
*/
|
|
4
|
+
export const MAX_GAS_LIMIT = 28000000n;
|
|
5
|
+
/**
|
|
6
|
+
* The divisor for the gas limit
|
|
7
|
+
*/
|
|
8
|
+
export const DIVISOR = 100n;
|
|
9
|
+
/**
|
|
10
|
+
* The extra gas limit percentage
|
|
11
|
+
*/
|
|
12
|
+
export const EXTRA_GAS_LIMIT_PERCENTAGE = 5n;
|
|
13
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../ts/deployer/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DeployerService } from "./deployer.service";
|
|
2
|
+
import { DeployerServiceDeployMaciDto, DeployerServiceDeployPollDto } from "./dto";
|
|
3
|
+
export declare class DeployerController {
|
|
4
|
+
private readonly deployerService;
|
|
5
|
+
/**
|
|
6
|
+
* Logger
|
|
7
|
+
*/
|
|
8
|
+
private readonly logger;
|
|
9
|
+
/**
|
|
10
|
+
* Initialize DeployerController
|
|
11
|
+
*
|
|
12
|
+
* @param deployerService - deployer service
|
|
13
|
+
*/
|
|
14
|
+
constructor(deployerService: DeployerService);
|
|
15
|
+
/**
|
|
16
|
+
* Deploy MACI contracts api method
|
|
17
|
+
*
|
|
18
|
+
* @param args - deploy maci dto
|
|
19
|
+
* @returns maci contract address
|
|
20
|
+
*/
|
|
21
|
+
deployMACIContracts(args: DeployerServiceDeployMaciDto): Promise<{
|
|
22
|
+
address: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Deploy a poll
|
|
26
|
+
*
|
|
27
|
+
* @param args - deploy poll dto
|
|
28
|
+
* @returns the poll id
|
|
29
|
+
*/
|
|
30
|
+
deployPoll(args: DeployerServiceDeployPollDto): Promise<{
|
|
31
|
+
pollId: string;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=deployer.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployer.controller.d.ts","sourceRoot":"","sources":["../../../ts/deployer/deployer.controller.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,OAAO,CAAC;AAEnF,qBAIa,kBAAkB;IAWjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAV5C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;IAE9D;;;;OAIG;gBAC0B,eAAe,EAAE,eAAe;IAE7D;;;;;OAKG;IAUG,mBAAmB,CAAS,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAOnG;;;;;OAKG;IAcG,UAAU,CAAS,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAM1F"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var DeployerController_1;
|
|
14
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
15
|
+
import { Body, Controller, HttpException, HttpStatus, Logger, Post, UseGuards } from "@nestjs/common";
|
|
16
|
+
import { ApiBearerAuth, ApiBody, ApiResponse, ApiTags } from "@nestjs/swagger";
|
|
17
|
+
import { AccountSignatureGuard } from "../auth/AccountSignatureGuard.service";
|
|
18
|
+
import { mapErrorToHttpStatus } from "../common/http";
|
|
19
|
+
import { DeployerService } from "./deployer.service";
|
|
20
|
+
import { DeployerServiceDeployMaciDto, DeployerServiceDeployPollDto } from "./dto";
|
|
21
|
+
let DeployerController = DeployerController_1 = class DeployerController {
|
|
22
|
+
deployerService;
|
|
23
|
+
/**
|
|
24
|
+
* Logger
|
|
25
|
+
*/
|
|
26
|
+
logger = new Logger(DeployerController_1.name);
|
|
27
|
+
/**
|
|
28
|
+
* Initialize DeployerController
|
|
29
|
+
*
|
|
30
|
+
* @param deployerService - deployer service
|
|
31
|
+
*/
|
|
32
|
+
constructor(deployerService) {
|
|
33
|
+
this.deployerService = deployerService;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Deploy MACI contracts api method
|
|
37
|
+
*
|
|
38
|
+
* @param args - deploy maci dto
|
|
39
|
+
* @returns maci contract address
|
|
40
|
+
*/
|
|
41
|
+
async deployMACIContracts(args) {
|
|
42
|
+
return this.deployerService.deployMaci(args).catch((error) => {
|
|
43
|
+
this.logger.error(`Error:`, error);
|
|
44
|
+
throw new HttpException(error.message, mapErrorToHttpStatus(error));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Deploy a poll
|
|
49
|
+
*
|
|
50
|
+
* @param args - deploy poll dto
|
|
51
|
+
* @returns the poll id
|
|
52
|
+
*/
|
|
53
|
+
async deployPoll(args) {
|
|
54
|
+
return this.deployerService.deployPoll(args).catch((error) => {
|
|
55
|
+
this.logger.error(`Error:`, error);
|
|
56
|
+
throw new HttpException(error.message, mapErrorToHttpStatus(error));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
__decorate([
|
|
61
|
+
ApiBody({ type: DeployerServiceDeployMaciDto }),
|
|
62
|
+
ApiResponse({ status: HttpStatus.CREATED, description: "The MACI contracts were successfully deployed" }),
|
|
63
|
+
ApiResponse({ status: HttpStatus.FORBIDDEN, description: "Invalid approval signature" }),
|
|
64
|
+
ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "Unsupported input (network/policy/voice credit proxy)" }),
|
|
65
|
+
ApiResponse({
|
|
66
|
+
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
67
|
+
description: "Deployment failed or configuration error (e.g., RPC URL not set, contract deployment failed)",
|
|
68
|
+
}),
|
|
69
|
+
Post("maci"),
|
|
70
|
+
__param(0, Body()),
|
|
71
|
+
__metadata("design:type", Function),
|
|
72
|
+
__metadata("design:paramtypes", [DeployerServiceDeployMaciDto]),
|
|
73
|
+
__metadata("design:returntype", Promise)
|
|
74
|
+
], DeployerController.prototype, "deployMACIContracts", null);
|
|
75
|
+
__decorate([
|
|
76
|
+
ApiBody({ type: DeployerServiceDeployPollDto }),
|
|
77
|
+
ApiResponse({ status: HttpStatus.CREATED, description: "The Poll was successfully deployed" }),
|
|
78
|
+
ApiResponse({ status: HttpStatus.FORBIDDEN, description: "Invalid approval signature" }),
|
|
79
|
+
ApiResponse({ status: HttpStatus.BAD_REQUEST, description: "Unsupported input (network/policy/voice credit proxy)" }),
|
|
80
|
+
ApiResponse({
|
|
81
|
+
status: HttpStatus.PRECONDITION_FAILED,
|
|
82
|
+
description: "Required contracts not deployed (MACI/Verifier/VerifyingKeysRegistry)",
|
|
83
|
+
}),
|
|
84
|
+
ApiResponse({
|
|
85
|
+
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
86
|
+
description: "Poll deployment failed (failed to deploy poll/set verifying keys/set MACI instance on policy)",
|
|
87
|
+
}),
|
|
88
|
+
Post("poll"),
|
|
89
|
+
__param(0, Body()),
|
|
90
|
+
__metadata("design:type", Function),
|
|
91
|
+
__metadata("design:paramtypes", [DeployerServiceDeployPollDto]),
|
|
92
|
+
__metadata("design:returntype", Promise)
|
|
93
|
+
], DeployerController.prototype, "deployPoll", null);
|
|
94
|
+
DeployerController = DeployerController_1 = __decorate([
|
|
95
|
+
ApiTags("v1/deploy"),
|
|
96
|
+
ApiBearerAuth(),
|
|
97
|
+
Controller("v1/deploy"),
|
|
98
|
+
UseGuards(AccountSignatureGuard),
|
|
99
|
+
__metadata("design:paramtypes", [DeployerService])
|
|
100
|
+
], DeployerController);
|
|
101
|
+
export { DeployerController };
|
|
102
|
+
//# sourceMappingURL=deployer.controller.js.map
|