@maci-protocol/coordinator 0.0.0-ci.01622be

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.
Files changed (261) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +21 -0
  3. package/README.md +49 -0
  4. package/build/hardhat.config.cjs +34 -0
  5. package/build/hardhat.config.cjs.map +1 -0
  6. package/build/hardhat.config.d.cts +27 -0
  7. package/build/hardhat.config.d.cts.map +1 -0
  8. package/build/scripts/generateKeypair.d.ts +2 -0
  9. package/build/scripts/generateKeypair.d.ts.map +1 -0
  10. package/build/scripts/generateKeypair.js +25 -0
  11. package/build/scripts/generateKeypair.js.map +1 -0
  12. package/build/scripts/generateMaciKeyPair.d.ts +2 -0
  13. package/build/scripts/generateMaciKeyPair.d.ts.map +1 -0
  14. package/build/scripts/generateMaciKeyPair.js +3 -0
  15. package/build/scripts/generateMaciKeyPair.js.map +1 -0
  16. package/build/scripts/getAuthHeader.d.ts +2 -0
  17. package/build/scripts/getAuthHeader.d.ts.map +1 -0
  18. package/build/scripts/getAuthHeader.js +31 -0
  19. package/build/scripts/getAuthHeader.js.map +1 -0
  20. package/build/tests/constants.d.ts +7 -0
  21. package/build/tests/constants.d.ts.map +1 -0
  22. package/build/tests/constants.js +9 -0
  23. package/build/tests/constants.js.map +1 -0
  24. package/build/tests/e2e.aa.test.d.ts +2 -0
  25. package/build/tests/e2e.aa.test.d.ts.map +1 -0
  26. package/build/tests/e2e.aa.test.js +106 -0
  27. package/build/tests/e2e.aa.test.js.map +1 -0
  28. package/build/tests/e2e.deploy.test.d.ts +2 -0
  29. package/build/tests/e2e.deploy.test.d.ts.map +1 -0
  30. package/build/tests/e2e.deploy.test.js +282 -0
  31. package/build/tests/e2e.deploy.test.js.map +1 -0
  32. package/build/tests/utils.d.ts +20 -0
  33. package/build/tests/utils.d.ts.map +1 -0
  34. package/build/tests/utils.js +53 -0
  35. package/build/tests/utils.js.map +1 -0
  36. package/build/ts/app.module.d.ts +3 -0
  37. package/build/ts/app.module.d.ts.map +1 -0
  38. package/build/ts/app.module.js +36 -0
  39. package/build/ts/app.module.js.map +1 -0
  40. package/build/ts/auth/AccountSignatureGuard.service.d.ts +44 -0
  41. package/build/ts/auth/AccountSignatureGuard.service.d.ts.map +1 -0
  42. package/build/ts/auth/AccountSignatureGuard.service.js +96 -0
  43. package/build/ts/auth/AccountSignatureGuard.service.js.map +1 -0
  44. package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts +2 -0
  45. package/build/ts/auth/__tests__/AccountSignatureGuard.test.d.ts.map +1 -0
  46. package/build/ts/auth/__tests__/AccountSignatureGuard.test.js +113 -0
  47. package/build/ts/auth/__tests__/AccountSignatureGuard.test.js.map +1 -0
  48. package/build/ts/common/__tests__/common.test.d.ts +2 -0
  49. package/build/ts/common/__tests__/common.test.d.ts.map +1 -0
  50. package/build/ts/common/__tests__/common.test.js +75 -0
  51. package/build/ts/common/__tests__/common.test.js.map +1 -0
  52. package/build/ts/common/accountAbstraction.d.ts +38 -0
  53. package/build/ts/common/accountAbstraction.d.ts.map +1 -0
  54. package/build/ts/common/accountAbstraction.js +81 -0
  55. package/build/ts/common/accountAbstraction.js.map +1 -0
  56. package/build/ts/common/chain.d.ts +16 -0
  57. package/build/ts/common/chain.d.ts.map +1 -0
  58. package/build/ts/common/chain.js +35 -0
  59. package/build/ts/common/chain.js.map +1 -0
  60. package/build/ts/common/errors.d.ts +32 -0
  61. package/build/ts/common/errors.d.ts.map +1 -0
  62. package/build/ts/common/errors.js +33 -0
  63. package/build/ts/common/errors.js.map +1 -0
  64. package/build/ts/common/index.d.ts +6 -0
  65. package/build/ts/common/index.d.ts.map +1 -0
  66. package/build/ts/common/index.js +6 -0
  67. package/build/ts/common/index.js.map +1 -0
  68. package/build/ts/common/networks.d.ts +29 -0
  69. package/build/ts/common/networks.d.ts.map +1 -0
  70. package/build/ts/common/networks.js +70 -0
  71. package/build/ts/common/networks.js.map +1 -0
  72. package/build/ts/common/types.d.ts +8 -0
  73. package/build/ts/common/types.d.ts.map +1 -0
  74. package/build/ts/common/types.js +2 -0
  75. package/build/ts/common/types.js.map +1 -0
  76. package/build/ts/crypto/__tests__/crypto.service.test.d.ts +2 -0
  77. package/build/ts/crypto/__tests__/crypto.service.test.d.ts.map +1 -0
  78. package/build/ts/crypto/__tests__/crypto.service.test.js +26 -0
  79. package/build/ts/crypto/__tests__/crypto.service.test.js.map +1 -0
  80. package/build/ts/crypto/crypto.module.d.ts +3 -0
  81. package/build/ts/crypto/crypto.module.d.ts.map +1 -0
  82. package/build/ts/crypto/crypto.module.js +18 -0
  83. package/build/ts/crypto/crypto.module.js.map +1 -0
  84. package/build/ts/crypto/crypto.service.d.ts +31 -0
  85. package/build/ts/crypto/crypto.service.d.ts.map +1 -0
  86. package/build/ts/crypto/crypto.service.js +68 -0
  87. package/build/ts/crypto/crypto.service.js.map +1 -0
  88. package/build/ts/deployer/__tests__/deployer.controller.test.d.ts +2 -0
  89. package/build/ts/deployer/__tests__/deployer.controller.test.d.ts.map +1 -0
  90. package/build/ts/deployer/__tests__/deployer.controller.test.js +84 -0
  91. package/build/ts/deployer/__tests__/deployer.controller.test.js.map +1 -0
  92. package/build/ts/deployer/__tests__/deployer.service.test.d.ts +2 -0
  93. package/build/ts/deployer/__tests__/deployer.service.test.d.ts.map +1 -0
  94. package/build/ts/deployer/__tests__/deployer.service.test.js +166 -0
  95. package/build/ts/deployer/__tests__/deployer.service.test.js.map +1 -0
  96. package/build/ts/deployer/__tests__/utils.d.ts +65 -0
  97. package/build/ts/deployer/__tests__/utils.d.ts.map +1 -0
  98. package/build/ts/deployer/__tests__/utils.js +131 -0
  99. package/build/ts/deployer/__tests__/utils.js.map +1 -0
  100. package/build/ts/deployer/constants.d.ts +13 -0
  101. package/build/ts/deployer/constants.d.ts.map +1 -0
  102. package/build/ts/deployer/constants.js +13 -0
  103. package/build/ts/deployer/constants.js.map +1 -0
  104. package/build/ts/deployer/deployer.controller.d.ts +34 -0
  105. package/build/ts/deployer/deployer.controller.d.ts.map +1 -0
  106. package/build/ts/deployer/deployer.controller.js +89 -0
  107. package/build/ts/deployer/deployer.controller.js.map +1 -0
  108. package/build/ts/deployer/deployer.module.d.ts +3 -0
  109. package/build/ts/deployer/deployer.module.d.ts.map +1 -0
  110. package/build/ts/deployer/deployer.module.js +23 -0
  111. package/build/ts/deployer/deployer.module.js.map +1 -0
  112. package/build/ts/deployer/deployer.service.d.ts +76 -0
  113. package/build/ts/deployer/deployer.service.d.ts.map +1 -0
  114. package/build/ts/deployer/deployer.service.js +341 -0
  115. package/build/ts/deployer/deployer.service.js.map +1 -0
  116. package/build/ts/deployer/dto.d.ts +46 -0
  117. package/build/ts/deployer/dto.d.ts.map +1 -0
  118. package/build/ts/deployer/dto.js +125 -0
  119. package/build/ts/deployer/dto.js.map +1 -0
  120. package/build/ts/deployer/types.d.ts +344 -0
  121. package/build/ts/deployer/types.d.ts.map +1 -0
  122. package/build/ts/deployer/types.js +2 -0
  123. package/build/ts/deployer/types.js.map +1 -0
  124. package/build/ts/file/__tests__/file.service.test.d.ts +2 -0
  125. package/build/ts/file/__tests__/file.service.test.d.ts.map +1 -0
  126. package/build/ts/file/__tests__/file.service.test.js +77 -0
  127. package/build/ts/file/__tests__/file.service.test.js.map +1 -0
  128. package/build/ts/file/file.module.d.ts +3 -0
  129. package/build/ts/file/file.module.d.ts.map +1 -0
  130. package/build/ts/file/file.module.js +18 -0
  131. package/build/ts/file/file.module.js.map +1 -0
  132. package/build/ts/file/file.service.d.ts +63 -0
  133. package/build/ts/file/file.service.d.ts.map +1 -0
  134. package/build/ts/file/file.service.js +120 -0
  135. package/build/ts/file/file.service.js.map +1 -0
  136. package/build/ts/file/types.d.ts +36 -0
  137. package/build/ts/file/types.d.ts.map +1 -0
  138. package/build/ts/file/types.js +2 -0
  139. package/build/ts/file/types.js.map +1 -0
  140. package/build/ts/jest/setup.d.ts +8 -0
  141. package/build/ts/jest/setup.d.ts.map +1 -0
  142. package/build/ts/jest/setup.js +2 -0
  143. package/build/ts/jest/setup.js.map +1 -0
  144. package/build/ts/jest/transform.d.ts +8 -0
  145. package/build/ts/jest/transform.d.ts.map +1 -0
  146. package/build/ts/jest/transform.js +10 -0
  147. package/build/ts/jest/transform.js.map +1 -0
  148. package/build/ts/main.d.ts +2 -0
  149. package/build/ts/main.d.ts.map +1 -0
  150. package/build/ts/main.js +46 -0
  151. package/build/ts/main.js.map +1 -0
  152. package/build/ts/proof/__tests__/proof.controller.test.d.ts +2 -0
  153. package/build/ts/proof/__tests__/proof.controller.test.d.ts.map +1 -0
  154. package/build/ts/proof/__tests__/proof.controller.test.js +92 -0
  155. package/build/ts/proof/__tests__/proof.controller.test.js.map +1 -0
  156. package/build/ts/proof/__tests__/proof.gateway.test.d.ts +2 -0
  157. package/build/ts/proof/__tests__/proof.gateway.test.d.ts.map +1 -0
  158. package/build/ts/proof/__tests__/proof.gateway.test.js +65 -0
  159. package/build/ts/proof/__tests__/proof.gateway.test.js.map +1 -0
  160. package/build/ts/proof/__tests__/proof.service.test.d.ts +2 -0
  161. package/build/ts/proof/__tests__/proof.service.test.d.ts.map +1 -0
  162. package/build/ts/proof/__tests__/proof.service.test.js +130 -0
  163. package/build/ts/proof/__tests__/proof.service.test.js.map +1 -0
  164. package/build/ts/proof/dto.d.ts +75 -0
  165. package/build/ts/proof/dto.d.ts.map +1 -0
  166. package/build/ts/proof/dto.js +277 -0
  167. package/build/ts/proof/dto.js.map +1 -0
  168. package/build/ts/proof/proof.controller.d.ts +47 -0
  169. package/build/ts/proof/proof.controller.d.ts.map +1 -0
  170. package/build/ts/proof/proof.controller.js +135 -0
  171. package/build/ts/proof/proof.controller.js.map +1 -0
  172. package/build/ts/proof/proof.gateway.d.ts +35 -0
  173. package/build/ts/proof/proof.gateway.d.ts.map +1 -0
  174. package/build/ts/proof/proof.gateway.js +93 -0
  175. package/build/ts/proof/proof.gateway.js.map +1 -0
  176. package/build/ts/proof/proof.module.d.ts +3 -0
  177. package/build/ts/proof/proof.module.d.ts.map +1 -0
  178. package/build/ts/proof/proof.module.js +24 -0
  179. package/build/ts/proof/proof.module.js.map +1 -0
  180. package/build/ts/proof/proof.service.d.ts +54 -0
  181. package/build/ts/proof/proof.service.d.ts.map +1 -0
  182. package/build/ts/proof/proof.service.js +166 -0
  183. package/build/ts/proof/proof.service.js.map +1 -0
  184. package/build/ts/proof/types.d.ts +148 -0
  185. package/build/ts/proof/types.d.ts.map +1 -0
  186. package/build/ts/proof/types.js +11 -0
  187. package/build/ts/proof/types.js.map +1 -0
  188. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts +2 -0
  189. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.d.ts.map +1 -0
  190. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js +44 -0
  191. package/build/ts/sessionKeys/__tests__/sessionKeys.controller.test.js.map +1 -0
  192. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts +2 -0
  193. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.d.ts.map +1 -0
  194. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js +61 -0
  195. package/build/ts/sessionKeys/__tests__/sessionKeys.service.test.js.map +1 -0
  196. package/build/ts/sessionKeys/__tests__/utils.d.ts +25 -0
  197. package/build/ts/sessionKeys/__tests__/utils.d.ts.map +1 -0
  198. package/build/ts/sessionKeys/__tests__/utils.js +64 -0
  199. package/build/ts/sessionKeys/__tests__/utils.js.map +1 -0
  200. package/build/ts/sessionKeys/dto.d.ts +11 -0
  201. package/build/ts/sessionKeys/dto.d.ts.map +1 -0
  202. package/build/ts/sessionKeys/dto.js +29 -0
  203. package/build/ts/sessionKeys/dto.js.map +1 -0
  204. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts +53 -0
  205. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.d.ts.map +1 -0
  206. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js +105 -0
  207. package/build/ts/sessionKeys/provider/KernelEIP1193Provider.js.map +1 -0
  208. package/build/ts/sessionKeys/sessionKeys.controller.d.ts +26 -0
  209. package/build/ts/sessionKeys/sessionKeys.controller.d.ts.map +1 -0
  210. package/build/ts/sessionKeys/sessionKeys.controller.js +74 -0
  211. package/build/ts/sessionKeys/sessionKeys.controller.js.map +1 -0
  212. package/build/ts/sessionKeys/sessionKeys.module.d.ts +3 -0
  213. package/build/ts/sessionKeys/sessionKeys.module.d.ts.map +1 -0
  214. package/build/ts/sessionKeys/sessionKeys.module.js +23 -0
  215. package/build/ts/sessionKeys/sessionKeys.module.js.map +1 -0
  216. package/build/ts/sessionKeys/sessionKeys.service.d.ts +61 -0
  217. package/build/ts/sessionKeys/sessionKeys.service.d.ts.map +1 -0
  218. package/build/ts/sessionKeys/sessionKeys.service.js +122 -0
  219. package/build/ts/sessionKeys/sessionKeys.service.js.map +1 -0
  220. package/build/ts/sessionKeys/types.d.ts +11 -0
  221. package/build/ts/sessionKeys/types.d.ts.map +1 -0
  222. package/build/ts/sessionKeys/types.js +2 -0
  223. package/build/ts/sessionKeys/types.js.map +1 -0
  224. package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts +2 -0
  225. package/build/ts/subgraph/__tests__/subgraph.controller.test.d.ts.map +1 -0
  226. package/build/ts/subgraph/__tests__/subgraph.controller.test.js +50 -0
  227. package/build/ts/subgraph/__tests__/subgraph.controller.test.js.map +1 -0
  228. package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts +2 -0
  229. package/build/ts/subgraph/__tests__/subgraph.gateway.test.d.ts.map +1 -0
  230. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js +83 -0
  231. package/build/ts/subgraph/__tests__/subgraph.gateway.test.js.map +1 -0
  232. package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts +2 -0
  233. package/build/ts/subgraph/__tests__/subgraph.service.test.d.ts.map +1 -0
  234. package/build/ts/subgraph/__tests__/subgraph.service.test.js +58 -0
  235. package/build/ts/subgraph/__tests__/subgraph.service.test.js.map +1 -0
  236. package/build/ts/subgraph/dto.d.ts +27 -0
  237. package/build/ts/subgraph/dto.d.ts.map +1 -0
  238. package/build/ts/subgraph/dto.js +83 -0
  239. package/build/ts/subgraph/dto.js.map +1 -0
  240. package/build/ts/subgraph/subgraph.controller.d.ts +24 -0
  241. package/build/ts/subgraph/subgraph.controller.d.ts.map +1 -0
  242. package/build/ts/subgraph/subgraph.controller.js +66 -0
  243. package/build/ts/subgraph/subgraph.controller.js.map +1 -0
  244. package/build/ts/subgraph/subgraph.gateway.d.ts +35 -0
  245. package/build/ts/subgraph/subgraph.gateway.d.ts.map +1 -0
  246. package/build/ts/subgraph/subgraph.gateway.js +93 -0
  247. package/build/ts/subgraph/subgraph.gateway.js.map +1 -0
  248. package/build/ts/subgraph/subgraph.module.d.ts +3 -0
  249. package/build/ts/subgraph/subgraph.module.d.ts.map +1 -0
  250. package/build/ts/subgraph/subgraph.module.js +23 -0
  251. package/build/ts/subgraph/subgraph.module.js.map +1 -0
  252. package/build/ts/subgraph/subgraph.service.d.ts +20 -0
  253. package/build/ts/subgraph/subgraph.service.d.ts.map +1 -0
  254. package/build/ts/subgraph/subgraph.service.js +106 -0
  255. package/build/ts/subgraph/subgraph.service.js.map +1 -0
  256. package/build/ts/subgraph/types.d.ts +93 -0
  257. package/build/ts/subgraph/types.d.ts.map +1 -0
  258. package/build/ts/subgraph/types.js +24 -0
  259. package/build/ts/subgraph/types.js.map +1 -0
  260. package/build/tsconfig.build.tsbuildinfo +1 -0
  261. package/package.json +125 -0
@@ -0,0 +1,341 @@
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
+ import { deployVerifier } from "@maci-protocol/contracts";
11
+ import { PublicKey } from "@maci-protocol/domainobjs";
12
+ import { ContractStorage, EPolicies, VerifyingKeysRegistry__factory as VerifyingKeysRegistryFactory, MessageProcessor__factory as MessageProcessorFactory, Tally__factory as TallyFactory, Poll__factory as PollFactory, MACI__factory as MACIFactory, EContracts, EInitialVoiceCreditProxies, EMode, deployPoll, extractAllVerifyingKeys, deployConstantInitialVoiceCreditProxy, deployFreeForAllSignUpPolicy, deployERC20VotesPolicy, deployAnonAadhaarPolicy, deploySignupTokenPolicy, deployMerkleProofPolicy, deploySemaphoreSignupPolicy, deployZupassSignUpPolicy, deployGitcoinPassportPolicy, deployEASSignUpPolicy, deployHatsSignupPolicy, deployMaci, setVerifyingKeys, deployVerifyingKeysRegistryContract, generateEmptyBallotRoots, } from "@maci-protocol/sdk";
13
+ import { Injectable } from "@nestjs/common";
14
+ import { BaseContract } from "ethers";
15
+ import path from "path";
16
+ import { ErrorCodes } from "../common";
17
+ import { FileService } from "../file/file.service";
18
+ import { SessionKeysService } from "../sessionKeys/sessionKeys.service";
19
+ /**
20
+ * DeployerService is responsible for deploying contracts.
21
+ */
22
+ let DeployerService = class DeployerService {
23
+ sessionKeysService;
24
+ fileService;
25
+ /**
26
+ * Contract storage instance
27
+ */
28
+ storage;
29
+ /**
30
+ * Create a new instance of DeployerService
31
+ *
32
+ * @param fileService - file service
33
+ */
34
+ constructor(sessionKeysService, fileService) {
35
+ this.sessionKeysService = sessionKeysService;
36
+ this.fileService = fileService;
37
+ this.storage = ContractStorage.getInstance(path.join(process.cwd(), "deployed-contracts.json"));
38
+ }
39
+ /**
40
+ * Get the policy contract object
41
+ * always deploy and save it
42
+ *
43
+ * @param signer - the signer
44
+ * @param policyType - the policy type
45
+ * @param network - the network
46
+ * @param args - the policy args
47
+ * @returns - the policy contract
48
+ */
49
+ async deployAndSavePolicy(signer, policyType, network, args) {
50
+ let contract;
51
+ // based on the policy type, we need to deploy the correct policy
52
+ switch (policyType) {
53
+ case EPolicies.FreeForAll: {
54
+ [contract] = await deployFreeForAllSignUpPolicy({}, signer, true);
55
+ break;
56
+ }
57
+ case EPolicies.EAS: {
58
+ [contract] = await deployEASSignUpPolicy({
59
+ eas: args.easAddress,
60
+ attester: args.attester,
61
+ schema: args.schema,
62
+ }, {}, signer, true);
63
+ break;
64
+ }
65
+ case EPolicies.GitcoinPassport: {
66
+ [contract] = await deployGitcoinPassportPolicy({
67
+ decoderAddress: args.decoderAddress,
68
+ minimumScore: Number(args.passingScore),
69
+ }, {}, signer, true);
70
+ break;
71
+ }
72
+ case EPolicies.Hats: {
73
+ [contract] = await deployHatsSignupPolicy({
74
+ hats: args.hatsProtocolAddress,
75
+ criterionHats: args.critrionHats.map((c) => BigInt(c)),
76
+ }, {}, signer, true);
77
+ break;
78
+ }
79
+ case EPolicies.Zupass: {
80
+ [contract] = await deployZupassSignUpPolicy({
81
+ eventId: args.eventId,
82
+ signer1: args.signer1,
83
+ signer2: args.signer2,
84
+ verifier: args.zupassVerifier,
85
+ }, {}, signer, true);
86
+ break;
87
+ }
88
+ case EPolicies.Semaphore: {
89
+ [contract] = await deploySemaphoreSignupPolicy({
90
+ semaphore: args.semaphoreContract,
91
+ groupId: BigInt(args.groupId),
92
+ }, {}, signer, true);
93
+ break;
94
+ }
95
+ case EPolicies.MerkleProof: {
96
+ [contract] = await deployMerkleProofPolicy({
97
+ root: args.root,
98
+ }, {}, signer, true);
99
+ break;
100
+ }
101
+ case EPolicies.Token: {
102
+ [contract] = await deploySignupTokenPolicy({
103
+ token: args.token,
104
+ }, {}, signer, true);
105
+ break;
106
+ }
107
+ case EPolicies.AnonAadhaar: {
108
+ [contract] = await deployAnonAadhaarPolicy({
109
+ verifierAddress: args.verifier,
110
+ nullifierSeed: args.nullifierSeed,
111
+ }, {}, signer, true);
112
+ break;
113
+ }
114
+ case EPolicies.ERC20Votes: {
115
+ [contract] = await deployERC20VotesPolicy({
116
+ snapshotBlock: BigInt(args.snapshotBlock),
117
+ threshold: BigInt(args.threshold),
118
+ token: args.token,
119
+ }, {}, signer, true);
120
+ break;
121
+ }
122
+ default:
123
+ throw new Error(ErrorCodes.UNSUPPORTED_POLICY.toString());
124
+ }
125
+ await this.storage.register({
126
+ id: policyType,
127
+ contract,
128
+ args: args ? Object.values(args).map((arg) => String(arg)) : [],
129
+ network,
130
+ });
131
+ return contract;
132
+ }
133
+ /**
134
+ * Get the voice credit proxy contract object
135
+ * always deploy and save it
136
+ *
137
+ * @param signer - the signer
138
+ * @param voiceCreditProxyType - the voice credit proxy type
139
+ * @param network - the network
140
+ * @param args - the args
141
+ * @returns - the voice credit proxy contract
142
+ */
143
+ async deployAndSaveVoiceCreditProxy(signer, voiceCreditProxyType, network, args) {
144
+ let contract;
145
+ switch (voiceCreditProxyType) {
146
+ case EInitialVoiceCreditProxies.Constant: {
147
+ [contract] = await deployConstantInitialVoiceCreditProxy({
148
+ amount: args.amount,
149
+ }, signer, undefined, true);
150
+ break;
151
+ }
152
+ default:
153
+ throw new Error(ErrorCodes.UNSUPPORTED_VOICE_CREDIT_PROXY.toString());
154
+ }
155
+ await this.storage.register({
156
+ id: voiceCreditProxyType,
157
+ contract,
158
+ args: args ? Object.values(args).map((arg) => String(arg)) : [],
159
+ network,
160
+ });
161
+ return contract;
162
+ }
163
+ /**
164
+ * Get verifying keys arguments (specially zkey paths)
165
+ * @param signer - the signer
166
+ * @param verifyingKeysRegistryContract - the deployed verifyingKey registry contract
167
+ * @param verifyingKeysRegistryArgs - the arguments send to the endpoint
168
+ * @param mode - use QV or NON_QV
169
+ * @returns SetVerifyingKeysArgs
170
+ */
171
+ async getVerifyingKeysArgs(signer, verifyingKeysRegistryAddress, verifyingKeysRegistryArgs, mode) {
172
+ const { zkey: pollJoiningZkeyPath } = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_POLL_JOINING_ZKEY_NAME, EMode.QV);
173
+ const { zkey: pollJoinedZkeyPath } = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_POLL_JOINED_ZKEY_NAME, EMode.QV);
174
+ const { zkey: processMessagesZkeyPath } = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME, mode);
175
+ // There are only QV and Non-QV modes
176
+ const { zkey: tallyVotesZkeyPath } = this.fileService.getZkeyFilePaths(process.env.COORDINATOR_TALLY_ZKEY_NAME, mode === EMode.QV ? mode : EMode.NON_QV);
177
+ const { pollJoiningVerifyingKey, pollJoinedVerifyingKey, processVerifyingKey, tallyVerifyingKey } = await extractAllVerifyingKeys({
178
+ pollJoiningZkeyPath,
179
+ pollJoinedZkeyPath,
180
+ processMessagesZkeyPath,
181
+ tallyVotesZkeyPath,
182
+ });
183
+ const { stateTreeDepth, pollStateTreeDepth, tallyProcessingStateTreeDepth, voteOptionTreeDepth, messageBatchSize } = verifyingKeysRegistryArgs;
184
+ return {
185
+ pollJoiningVerifyingKey: pollJoiningVerifyingKey,
186
+ pollJoinedVerifyingKey: pollJoinedVerifyingKey,
187
+ processMessagesVerifyingKey: processVerifyingKey,
188
+ tallyVotesVerifyingKey: tallyVerifyingKey,
189
+ stateTreeDepth: Number(stateTreeDepth),
190
+ tallyProcessingStateTreeDepth: Number(tallyProcessingStateTreeDepth),
191
+ voteOptionTreeDepth: Number(voteOptionTreeDepth),
192
+ messageBatchSize: Number(messageBatchSize),
193
+ pollStateTreeDepth: Number(pollStateTreeDepth),
194
+ signer,
195
+ mode,
196
+ verifyingKeysRegistryAddress,
197
+ };
198
+ }
199
+ /**
200
+ * Deploy MACI contracts
201
+ *
202
+ * @param args - deploy maci arguments
203
+ * @param options - ws hooks
204
+ * @returns - deployed maci contract
205
+ * @returns the address of the deployed maci contract
206
+ */
207
+ async deployMaci({ approval, sessionKeyAddress, chain, config }) {
208
+ const signer = await this.sessionKeysService.getCoordinatorSigner(chain, sessionKeyAddress, approval);
209
+ const policyContract = await this.deployAndSavePolicy(signer, config.policy.type, chain, config.policy.args);
210
+ const policyAddress = await policyContract.getAddress();
211
+ const verifierContract = await deployVerifier(signer, true);
212
+ const verifyingKeysRegistryAddress = await deployVerifyingKeysRegistryContract({ signer });
213
+ const verifyingKeysArgs = await this.getVerifyingKeysArgs(signer, verifyingKeysRegistryAddress, config.VerifyingKeysRegistry.args, EMode.QV);
214
+ await setVerifyingKeys(verifyingKeysArgs);
215
+ // deploy the smart contracts
216
+ const maciAddresses = await deployMaci({
217
+ stateTreeDepth: config.MACI.stateTreeDepth,
218
+ signer,
219
+ signupPolicyAddress: policyAddress,
220
+ });
221
+ // store the contracts
222
+ await Promise.all([
223
+ this.storage.register({
224
+ id: EContracts.Verifier,
225
+ contract: verifierContract,
226
+ network: chain,
227
+ }),
228
+ this.storage.register({
229
+ id: EContracts.VerifyingKeysRegistry,
230
+ contract: new BaseContract(verifyingKeysRegistryAddress, VerifyingKeysRegistryFactory.abi),
231
+ network: chain,
232
+ }),
233
+ this.storage.register({
234
+ id: EContracts.MACI,
235
+ contract: new BaseContract(maciAddresses.maciContractAddress, MACIFactory.abi),
236
+ args: [
237
+ maciAddresses.pollFactoryContractAddress,
238
+ maciAddresses.messageProcessorFactoryContractAddress,
239
+ maciAddresses.tallyFactoryContractAddress,
240
+ policyAddress,
241
+ config.MACI.stateTreeDepth,
242
+ generateEmptyBallotRoots(config.MACI.stateTreeDepth).map((root) => root.toString()),
243
+ ],
244
+ network: chain,
245
+ }),
246
+ ]);
247
+ return { address: maciAddresses.maciContractAddress };
248
+ }
249
+ /**
250
+ * Deploy a poll
251
+ *
252
+ * @param args - deploy poll dto
253
+ * @returns poll id
254
+ */
255
+ async deployPoll({ approval, sessionKeyAddress, chain, config }) {
256
+ const signer = await this.sessionKeysService.getCoordinatorSigner(chain, sessionKeyAddress, approval);
257
+ // check if there is a maci contract deployed on this chain
258
+ const maciAddress = this.storage.getAddress(EContracts.MACI, chain);
259
+ if (!maciAddress) {
260
+ throw new Error(ErrorCodes.MACI_NOT_DEPLOYED.toString());
261
+ }
262
+ // check if there is a verifier deployed on this chain
263
+ const verifierAddress = this.storage.getAddress(EContracts.Verifier, chain);
264
+ if (!verifierAddress) {
265
+ throw new Error(ErrorCodes.VERIFIER_NOT_DEPLOYED.toString());
266
+ }
267
+ // check if there is a verifyingKey registry deployed on this chain
268
+ const verifyingKeysRegistryAddress = this.storage.getAddress(EContracts.VerifyingKeysRegistry, chain);
269
+ if (!verifyingKeysRegistryAddress) {
270
+ throw new Error(ErrorCodes.VERIFYING_KEYS_REGISTRY_NOT_DEPLOYED.toString());
271
+ }
272
+ // check if policy address was given
273
+ let policyAddress = config.policy.address;
274
+ if (!policyAddress) {
275
+ const policyContract = await this.deployAndSavePolicy(signer, config.policy.type, chain, config.policy.args);
276
+ policyAddress = (await policyContract.getAddress());
277
+ }
278
+ // check if initial voice credit proxy address was given
279
+ let initialVoiceCreditProxyAddress = config.initialVoiceCreditsProxy.address;
280
+ if (!initialVoiceCreditProxyAddress) {
281
+ const initialVoiceCreditProxyContract = await this.deployAndSaveVoiceCreditProxy(signer, config.initialVoiceCreditsProxy.type, chain, config.initialVoiceCreditsProxy.args);
282
+ initialVoiceCreditProxyAddress = (await initialVoiceCreditProxyContract.getAddress());
283
+ }
284
+ const deployPollArgs = {
285
+ maciAddress,
286
+ pollStartTimestamp: config.startDate,
287
+ pollEndTimestamp: config.endDate,
288
+ tallyProcessingStateTreeDepth: config.tallyProcessingStateTreeDepth,
289
+ voteOptionTreeDepth: config.voteOptionTreeDepth,
290
+ messageBatchSize: config.messageBatchSize,
291
+ stateTreeDepth: config.pollStateTreeDepth,
292
+ coordinatorPublicKey: PublicKey.deserialize(config.coordinatorPublicKey),
293
+ verifierContractAddress: verifierAddress,
294
+ verifyingKeysRegistryContractAddress: verifyingKeysRegistryAddress,
295
+ mode: config.mode,
296
+ policyContractAddress: policyAddress,
297
+ initialVoiceCreditProxyContractAddress: initialVoiceCreditProxyAddress,
298
+ relayers: config.relayers ? config.relayers.map((address) => address) : [],
299
+ voteOptions: Number(config.voteOptions),
300
+ initialVoiceCredits: Number(config.initialVoiceCreditsProxy.args.amount),
301
+ signer,
302
+ };
303
+ const { pollContractAddress, messageProcessorContractAddress, tallyContractAddress, pollId } = await deployPoll(deployPollArgs);
304
+ const poll = PollFactory.connect(pollContractAddress, signer);
305
+ // store to storage
306
+ await Promise.all([
307
+ this.storage.register({
308
+ id: EContracts.Poll,
309
+ key: `poll-${pollId}`,
310
+ contract: poll,
311
+ // clones do not have args for verification
312
+ args: [],
313
+ network: chain,
314
+ }),
315
+ this.storage.register({
316
+ id: EContracts.MessageProcessor,
317
+ key: `poll-${pollId}`,
318
+ contract: MessageProcessorFactory.connect(messageProcessorContractAddress, signer),
319
+ // clones do not have args for verification
320
+ args: [],
321
+ network: chain,
322
+ }),
323
+ this.storage.register({
324
+ id: EContracts.Tally,
325
+ key: `poll-${pollId}`,
326
+ contract: TallyFactory.connect(tallyContractAddress, signer),
327
+ // clones do not have args for verification
328
+ args: [],
329
+ network: chain,
330
+ }),
331
+ ]);
332
+ return { pollId: pollId.toString() };
333
+ }
334
+ };
335
+ DeployerService = __decorate([
336
+ Injectable(),
337
+ __metadata("design:paramtypes", [SessionKeysService,
338
+ FileService])
339
+ ], DeployerService);
340
+ export { DeployerService };
341
+ //# sourceMappingURL=deployer.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployer.service.js","sourceRoot":"","sources":["../../../ts/deployer/deployer.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,eAAe,EACf,SAAS,EACT,8BAA8B,IAAI,4BAA4B,EAC9D,yBAAyB,IAA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{ IDeployMaciConfig, IDeployPollConfig } from "./types";
2
+ import type { Hex } from "viem";
3
+ import { ESupportedNetworks } from "../common";
4
+ /**
5
+ * Data transfer object for MACI contracts deployment
6
+ */
7
+ export declare class DeployerServiceDeployMaciDto {
8
+ /**
9
+ * Session Key Approval string
10
+ */
11
+ approval?: string;
12
+ /**
13
+ * Address of the session key
14
+ */
15
+ sessionKeyAddress?: Hex;
16
+ /**
17
+ * Chain Name
18
+ */
19
+ chain: ESupportedNetworks;
20
+ /**
21
+ * Config
22
+ */
23
+ config: IDeployMaciConfig;
24
+ }
25
+ /**
26
+ * Data transfer object for Poll contract deployment
27
+ */
28
+ export declare class DeployerServiceDeployPollDto {
29
+ /**
30
+ * Session Key Approval string
31
+ */
32
+ approval?: string;
33
+ /**
34
+ * Address of the session key
35
+ */
36
+ sessionKeyAddress?: Hex;
37
+ /**
38
+ * Chain Name
39
+ */
40
+ chain: ESupportedNetworks;
41
+ /**
42
+ * Config
43
+ */
44
+ config: IDeployPollConfig;
45
+ }
46
+ //# sourceMappingURL=dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../../../ts/deployer/dto.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,qBAAa,4BAA4B;IACvC;;OAEG;IAQH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IAQH,iBAAiB,CAAC,EAAE,GAAG,CAAC;IAExB;;OAEG;IAMH,KAAK,EAAG,kBAAkB,CAAC;IAE3B;;OAEG;IAKH,MAAM,EAAG,iBAAiB,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,4BAA4B;IACvC;;OAEG;IAQH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IAQH,iBAAiB,CAAC,EAAE,GAAG,CAAC;IAExB;;OAEG;IAMH,KAAK,EAAG,kBAAkB,CAAC;IAE3B;;OAEG;IAKH,MAAM,EAAG,iBAAiB,CAAC;CAC5B"}
@@ -0,0 +1,125 @@
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
+ import { ApiProperty } from "@nestjs/swagger";
11
+ import { IsEnum, IsOptional, IsString } from "class-validator";
12
+ import { ESupportedNetworks } from "../common";
13
+ /**
14
+ * Data transfer object for MACI contracts deployment
15
+ */
16
+ export class DeployerServiceDeployMaciDto {
17
+ /**
18
+ * Session Key Approval string
19
+ */
20
+ approval;
21
+ /**
22
+ * Address of the session key
23
+ */
24
+ sessionKeyAddress;
25
+ /**
26
+ * Chain Name
27
+ */
28
+ chain;
29
+ /**
30
+ * Config
31
+ */
32
+ config;
33
+ }
34
+ __decorate([
35
+ ApiProperty({
36
+ description: "Session Key Approval string",
37
+ type: String,
38
+ required: false,
39
+ }),
40
+ IsOptional(),
41
+ IsString(),
42
+ __metadata("design:type", String)
43
+ ], DeployerServiceDeployMaciDto.prototype, "approval", void 0);
44
+ __decorate([
45
+ ApiProperty({
46
+ description: "Address of the session key",
47
+ type: String,
48
+ required: false,
49
+ }),
50
+ IsOptional(),
51
+ IsString(),
52
+ __metadata("design:type", String)
53
+ ], DeployerServiceDeployMaciDto.prototype, "sessionKeyAddress", void 0);
54
+ __decorate([
55
+ ApiProperty({
56
+ description: "Chain to which to deploy the contract(s)",
57
+ enum: ESupportedNetworks,
58
+ }),
59
+ IsEnum(ESupportedNetworks),
60
+ __metadata("design:type", String)
61
+ ], DeployerServiceDeployMaciDto.prototype, "chain", void 0);
62
+ __decorate([
63
+ ApiProperty({
64
+ description: "Deployment configuration",
65
+ type: Object,
66
+ }),
67
+ __metadata("design:type", Object)
68
+ ], DeployerServiceDeployMaciDto.prototype, "config", void 0);
69
+ /**
70
+ * Data transfer object for Poll contract deployment
71
+ */
72
+ export class DeployerServiceDeployPollDto {
73
+ /**
74
+ * Session Key Approval string
75
+ */
76
+ approval;
77
+ /**
78
+ * Address of the session key
79
+ */
80
+ sessionKeyAddress;
81
+ /**
82
+ * Chain Name
83
+ */
84
+ chain;
85
+ /**
86
+ * Config
87
+ */
88
+ config;
89
+ }
90
+ __decorate([
91
+ ApiProperty({
92
+ description: "Session Key Approval string",
93
+ type: String,
94
+ required: false,
95
+ }),
96
+ IsOptional(),
97
+ IsString(),
98
+ __metadata("design:type", String)
99
+ ], DeployerServiceDeployPollDto.prototype, "approval", void 0);
100
+ __decorate([
101
+ ApiProperty({
102
+ description: "Address of the session key",
103
+ type: String,
104
+ required: false,
105
+ }),
106
+ IsOptional(),
107
+ IsString(),
108
+ __metadata("design:type", String)
109
+ ], DeployerServiceDeployPollDto.prototype, "sessionKeyAddress", void 0);
110
+ __decorate([
111
+ ApiProperty({
112
+ description: "Chain to which to deploy the contract(s)",
113
+ enum: ESupportedNetworks,
114
+ }),
115
+ IsEnum(ESupportedNetworks),
116
+ __metadata("design:type", String)
117
+ ], DeployerServiceDeployPollDto.prototype, "chain", void 0);
118
+ __decorate([
119
+ ApiProperty({
120
+ description: "Deployment configuration",
121
+ type: Object,
122
+ }),
123
+ __metadata("design:type", Object)
124
+ ], DeployerServiceDeployPollDto.prototype, "config", void 0);
125
+ //# source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