@boostxyz/sdk 0.0.0-alpha.8 → 1.1.0-alpha.22

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 (266) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.cjs.map +1 -1
  3. package/dist/Actions/Action.js +7 -7
  4. package/dist/Actions/ContractAction.d.ts +57 -14
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +50 -23
  7. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  8. package/dist/Actions/EventAction.cjs +1 -1
  9. package/dist/Actions/EventAction.cjs.map +1 -1
  10. package/dist/Actions/EventAction.d.ts +420 -45
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +15 -225
  13. package/dist/Actions/EventAction.js.map +1 -1
  14. package/dist/AllowLists/AllowList.cjs +1 -1
  15. package/dist/AllowLists/AllowList.cjs.map +1 -1
  16. package/dist/AllowLists/AllowList.d.ts +6 -4
  17. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  18. package/dist/AllowLists/AllowList.js +45 -23
  19. package/dist/AllowLists/AllowList.js.map +1 -1
  20. package/dist/AllowLists/OpenAllowList.d.ts +423 -0
  21. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
  22. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  23. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  24. package/dist/AllowLists/SimpleAllowList.d.ts +123 -39
  25. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleAllowList.js +75 -76
  27. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  28. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  29. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  30. package/dist/AllowLists/SimpleDenyList.d.ts +234 -13
  31. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  32. package/dist/AllowLists/SimpleDenyList.js +11 -200
  33. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  34. package/dist/Auth/PassthroughAuth.cjs +1 -1
  35. package/dist/Auth/PassthroughAuth.cjs.map +1 -1
  36. package/dist/Auth/PassthroughAuth.js +4 -4
  37. package/dist/Auth/PassthroughAuth.js.map +1 -1
  38. package/dist/Boost.cjs +1 -1
  39. package/dist/Boost.cjs.map +1 -1
  40. package/dist/Boost.d.ts +105 -14
  41. package/dist/Boost.d.ts.map +1 -1
  42. package/dist/Boost.js +137 -5
  43. package/dist/Boost.js.map +1 -1
  44. package/dist/BoostCore-BVZExPPu.js +1462 -0
  45. package/dist/BoostCore-BVZExPPu.js.map +1 -0
  46. package/dist/BoostCore-D-E-cnGI.cjs +3 -0
  47. package/dist/BoostCore-D-E-cnGI.cjs.map +1 -0
  48. package/dist/BoostCore.cjs +1 -2
  49. package/dist/BoostCore.cjs.map +1 -1
  50. package/dist/BoostCore.d.ts +759 -82
  51. package/dist/BoostCore.d.ts.map +1 -1
  52. package/dist/BoostCore.js +29 -1148
  53. package/dist/BoostCore.js.map +1 -1
  54. package/dist/BoostRegistry.cjs +1 -1
  55. package/dist/BoostRegistry.cjs.map +1 -1
  56. package/dist/BoostRegistry.d.ts +83 -28
  57. package/dist/BoostRegistry.d.ts.map +1 -1
  58. package/dist/BoostRegistry.js +170 -93
  59. package/dist/BoostRegistry.js.map +1 -1
  60. package/dist/Budgets/Budget.cjs +1 -1
  61. package/dist/Budgets/Budget.cjs.map +1 -1
  62. package/dist/Budgets/Budget.d.ts.map +1 -1
  63. package/dist/Budgets/Budget.js +2 -2
  64. package/dist/Budgets/Budget.js.map +1 -1
  65. package/dist/Budgets/ManagedBudget.cjs +1 -1
  66. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  67. package/dist/Budgets/ManagedBudget.d.ts +112 -192
  68. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  69. package/dist/Budgets/ManagedBudget.js +89 -290
  70. package/dist/Budgets/ManagedBudget.js.map +1 -1
  71. package/dist/Budgets/VestingBudget.d.ts +277 -91
  72. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  73. package/dist/Deployable/Contract.cjs +1 -1
  74. package/dist/Deployable/Contract.cjs.map +1 -1
  75. package/dist/Deployable/Contract.d.ts +4 -5
  76. package/dist/Deployable/Contract.d.ts.map +1 -1
  77. package/dist/Deployable/Contract.js +6 -8
  78. package/dist/Deployable/Contract.js.map +1 -1
  79. package/dist/Deployable/Deployable.cjs.map +1 -1
  80. package/dist/Deployable/Deployable.d.ts +1 -1
  81. package/dist/Deployable/Deployable.d.ts.map +1 -1
  82. package/dist/Deployable/Deployable.js +3 -5
  83. package/dist/Deployable/Deployable.js.map +1 -1
  84. package/dist/Deployable/DeployableTarget.cjs +1 -1
  85. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  86. package/dist/Deployable/DeployableTarget.d.ts +13 -13
  87. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  88. package/dist/Deployable/DeployableTarget.js +30 -27
  89. package/dist/Deployable/DeployableTarget.js.map +1 -1
  90. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  94. package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
  95. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  96. package/dist/EventAction-BZt5cjbe.cjs +2 -0
  97. package/dist/EventAction-BZt5cjbe.cjs.map +1 -0
  98. package/dist/EventAction-C_-hJXWm.js +1541 -0
  99. package/dist/EventAction-C_-hJXWm.js.map +1 -0
  100. package/dist/Incentive-BhHaK3PZ.cjs +2 -0
  101. package/dist/Incentive-BhHaK3PZ.cjs.map +1 -0
  102. package/dist/Incentive-Cqg1w6wD.js +312 -0
  103. package/dist/Incentive-Cqg1w6wD.js.map +1 -0
  104. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  105. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  106. package/dist/Incentives/AllowListIncentive.d.ts +73 -21
  107. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  108. package/dist/Incentives/AllowListIncentive.js +61 -36
  109. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  110. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  111. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  112. package/dist/Incentives/CGDAIncentive.d.ts +323 -26
  113. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  114. package/dist/Incentives/CGDAIncentive.js +73 -39
  115. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  116. package/dist/Incentives/ERC1155Incentive.d.ts +291 -43
  117. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  118. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  119. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  120. package/dist/Incentives/ERC20Incentive.d.ts +278 -33
  121. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  122. package/dist/Incentives/ERC20Incentive.js +79 -47
  123. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  124. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +346 -420
  125. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  126. package/dist/Incentives/ERC20VariableIncentive.d.ts +271 -32
  127. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  128. package/dist/Incentives/Incentive.cjs +1 -1
  129. package/dist/Incentives/Incentive.cjs.map +1 -1
  130. package/dist/Incentives/Incentive.d.ts +4 -4
  131. package/dist/Incentives/Incentive.d.ts.map +1 -1
  132. package/dist/Incentives/Incentive.js +16 -280
  133. package/dist/Incentives/Incentive.js.map +1 -1
  134. package/dist/Incentives/PointsIncentive.cjs +1 -1
  135. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  136. package/dist/Incentives/PointsIncentive.d.ts +89 -23
  137. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  138. package/dist/Incentives/PointsIncentive.js +66 -36
  139. package/dist/Incentives/PointsIncentive.js.map +1 -1
  140. package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
  141. package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
  142. package/dist/SimpleDenyList-CGaWjuld.js +132 -0
  143. package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
  144. package/dist/Validators/SignerValidator.cjs +1 -1
  145. package/dist/Validators/SignerValidator.cjs.map +1 -1
  146. package/dist/Validators/SignerValidator.d.ts +310 -17
  147. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  148. package/dist/Validators/SignerValidator.js +164 -36
  149. package/dist/Validators/SignerValidator.js.map +1 -1
  150. package/dist/Validators/Validator.cjs +1 -1
  151. package/dist/Validators/Validator.cjs.map +1 -1
  152. package/dist/Validators/Validator.d.ts +1 -1
  153. package/dist/Validators/Validator.js +2 -2
  154. package/dist/Validators/Validator.js.map +1 -1
  155. package/dist/claiming.cjs +2 -0
  156. package/dist/claiming.cjs.map +1 -0
  157. package/dist/claiming.d.ts +43 -0
  158. package/dist/claiming.d.ts.map +1 -0
  159. package/dist/claiming.js +17 -0
  160. package/dist/claiming.js.map +1 -0
  161. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  162. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  163. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  164. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  165. package/dist/deployments-DVXioW2i.cjs +2 -0
  166. package/dist/deployments-DVXioW2i.cjs.map +1 -0
  167. package/dist/deployments-oykLv3_Z.js +43 -0
  168. package/dist/deployments-oykLv3_Z.js.map +1 -0
  169. package/dist/deployments.json +44 -0
  170. package/dist/errors.cjs +1 -1
  171. package/dist/errors.cjs.map +1 -1
  172. package/dist/errors.d.ts +257 -21
  173. package/dist/errors.d.ts.map +1 -1
  174. package/dist/errors.js +183 -26
  175. package/dist/errors.js.map +1 -1
  176. package/dist/{generated-Cbv8zFkf.js → generated-CKt2yCQd.js} +3615 -1868
  177. package/dist/generated-CKt2yCQd.js.map +1 -0
  178. package/dist/generated-CyTNlOwM.cjs +3 -0
  179. package/dist/generated-CyTNlOwM.cjs.map +1 -0
  180. package/dist/index.cjs +1 -1
  181. package/dist/index.d.ts +9 -4
  182. package/dist/index.d.ts.map +1 -1
  183. package/dist/index.js +143 -126
  184. package/dist/index.js.map +1 -1
  185. package/dist/transfers.cjs +2 -0
  186. package/dist/transfers.cjs.map +1 -0
  187. package/dist/transfers.d.ts +198 -0
  188. package/dist/transfers.d.ts.map +1 -0
  189. package/dist/transfers.js +84 -0
  190. package/dist/transfers.js.map +1 -0
  191. package/dist/utils.cjs +1 -1
  192. package/dist/utils.cjs.map +1 -1
  193. package/dist/utils.d.ts +25 -1380
  194. package/dist/utils.d.ts.map +1 -1
  195. package/dist/utils.js +36 -648
  196. package/dist/utils.js.map +1 -1
  197. package/package.json +34 -10
  198. package/src/Actions/Action.test.ts +19 -17
  199. package/src/Actions/ContractAction.test.ts +14 -16
  200. package/src/Actions/ContractAction.ts +84 -22
  201. package/src/Actions/ERC721MintAction.test.ts +8 -8
  202. package/src/Actions/ERC721MintAction.ts +83 -30
  203. package/src/Actions/EventAction.test.ts +759 -113
  204. package/src/Actions/EventAction.ts +991 -116
  205. package/src/AllowLists/AllowList.test.ts +7 -7
  206. package/src/AllowLists/AllowList.ts +5 -3
  207. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  208. package/src/AllowLists/OpenAllowList.ts +45 -0
  209. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  210. package/src/AllowLists/SimpleAllowList.ts +86 -65
  211. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  212. package/src/AllowLists/SimpleDenyList.ts +87 -126
  213. package/src/Auth/PassthroughAuth.test.ts +1 -1
  214. package/src/Auth/PassthroughAuth.ts +1 -1
  215. package/src/Boost.ts +147 -15
  216. package/src/BoostCore.test.ts +326 -278
  217. package/src/BoostCore.ts +425 -242
  218. package/src/BoostRegistry.test.ts +53 -0
  219. package/src/BoostRegistry.ts +168 -50
  220. package/src/Budgets/Budget.test.ts +2 -2
  221. package/src/Budgets/Budget.ts +1 -2
  222. package/src/Budgets/ManagedBudget.test.ts +82 -19
  223. package/src/Budgets/ManagedBudget.ts +106 -315
  224. package/src/Budgets/VestingBudget.test.ts +7 -7
  225. package/src/Budgets/VestingBudget.ts +110 -112
  226. package/src/Deployable/Contract.ts +5 -6
  227. package/src/Deployable/Deployable.ts +1 -1
  228. package/src/Deployable/DeployableTarget.ts +32 -21
  229. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  230. package/src/Incentives/AllowListIncentive.test.ts +7 -10
  231. package/src/Incentives/AllowListIncentive.ts +88 -30
  232. package/src/Incentives/CGDAIncentive.test.ts +11 -12
  233. package/src/Incentives/CGDAIncentive.ts +161 -37
  234. package/src/Incentives/ERC1155Incentive.test.ts +5 -16
  235. package/src/Incentives/ERC1155Incentive.ts +132 -51
  236. package/src/Incentives/ERC20Incentive.test.ts +15 -23
  237. package/src/Incentives/ERC20Incentive.ts +131 -46
  238. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  239. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +324 -0
  240. package/src/Incentives/ERC20VariableIncentive.test.ts +12 -35
  241. package/src/Incentives/ERC20VariableIncentive.ts +118 -43
  242. package/src/Incentives/Incentive.test.ts +5 -2
  243. package/src/Incentives/Incentive.ts +7 -6
  244. package/src/Incentives/PointsIncentive.test.ts +26 -30
  245. package/src/Incentives/PointsIncentive.ts +110 -34
  246. package/src/Validators/SignerValidator.test.ts +9 -13
  247. package/src/Validators/SignerValidator.ts +437 -26
  248. package/src/Validators/Validator.test.ts +2 -2
  249. package/src/Validators/Validator.ts +1 -1
  250. package/src/claiming.ts +56 -0
  251. package/src/errors.ts +346 -22
  252. package/src/index.test.ts +118 -36
  253. package/src/index.ts +15 -7
  254. package/src/transfers.ts +284 -0
  255. package/src/utils.test.ts +2 -2
  256. package/src/utils.ts +61 -2061
  257. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  258. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  259. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  260. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  261. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  262. package/dist/generated-BzszviNp.cjs +0 -3
  263. package/dist/generated-BzszviNp.cjs.map +0 -1
  264. package/dist/generated-Cbv8zFkf.js.map +0 -1
  265. package/src/Budgets/SimpleBudget.test.ts +0 -152
  266. package/src/Budgets/SimpleBudget.ts +0 -521
@@ -4,7 +4,7 @@ import {
4
4
  type Fixtures,
5
5
  defaultOptions,
6
6
  deployFixtures,
7
- } from '../../test/helpers';
7
+ } from '@boostxyz/test/helpers';
8
8
  import {
9
9
  SimpleAllowList,
10
10
  SimpleDenyList,
@@ -14,14 +14,14 @@ import {
14
14
  let fixtures: Fixtures;
15
15
 
16
16
  beforeAll(async () => {
17
- fixtures = await loadFixture(deployFixtures);
17
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
18
18
  });
19
19
 
20
20
  function freshAllowList(fixtures: Fixtures) {
21
21
  return function freshAllowList() {
22
- return fixtures.registry.clone(
22
+ return fixtures.registry.initialize(
23
23
  crypto.randomUUID(),
24
- new fixtures.bases.SimpleAllowList(defaultOptions, {
24
+ fixtures.core.SimpleAllowList({
25
25
  owner: defaultOptions.account.address,
26
26
  allowed: [defaultOptions.account.address],
27
27
  }),
@@ -31,9 +31,9 @@ function freshAllowList(fixtures: Fixtures) {
31
31
 
32
32
  function freshDenyList(fixtures: Fixtures) {
33
33
  return function freshDenyList() {
34
- return fixtures.registry.clone(
34
+ return fixtures.registry.initialize(
35
35
  crypto.randomUUID(),
36
- new fixtures.bases.SimpleDenyList(defaultOptions, {
36
+ fixtures.core.SimpleDenyList({
37
37
  owner: defaultOptions.account.address,
38
38
  denied: [defaultOptions.account.address],
39
39
  }),
@@ -52,7 +52,7 @@ describe('AllowList', () => {
52
52
  ).toBeInstanceOf(SimpleAllowList);
53
53
  });
54
54
 
55
- test('can automatically instantiate SimpleAllowList given an address', async () => {
55
+ test('can automatically instantiate SimpleDenyList given an address', async () => {
56
56
  const _allowList = await loadFixture(freshDenyList(fixtures));
57
57
  expect(
58
58
  await allowListFromAddress(
@@ -7,10 +7,11 @@ import { readContract } from '@wagmi/core';
7
7
  import type { Address, Hex } from 'viem';
8
8
  import type { DeployableOptions } from '../Deployable/Deployable';
9
9
  import { InvalidComponentInterfaceError } from '../errors';
10
+ import { OpenAllowList } from './OpenAllowList';
10
11
  import { SimpleAllowList } from './SimpleAllowList';
11
12
  import { SimpleDenyList } from './SimpleDenyList';
12
13
 
13
- export { SimpleAllowList, SimpleDenyList };
14
+ export { OpenAllowList, SimpleAllowList, SimpleDenyList };
14
15
 
15
16
  /**
16
17
  * A union type representing all valid protocol AllowList implementations
@@ -18,7 +19,7 @@ export { SimpleAllowList, SimpleDenyList };
18
19
  * @export
19
20
  * @typedef {AllowList}
20
21
  */
21
- export type AllowList = SimpleAllowList | SimpleDenyList;
22
+ export type AllowList = OpenAllowList | SimpleAllowList | SimpleDenyList;
22
23
 
23
24
  /**
24
25
  * A map of AllowList component interfaces to their constructors.
@@ -32,6 +33,7 @@ export const AllowListByComponentInterface = {
32
33
 
33
34
  /**
34
35
  * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.
36
+ * This function will never return an instance of {@link OpenAllowList} because it has the same component interface as {@link SimpleDenyList}
35
37
  *
36
38
  * @export
37
39
  * @async
@@ -56,5 +58,5 @@ export async function allowListFromAddress(
56
58
  interfaceId as Hex,
57
59
  );
58
60
  }
59
- return new Ctor(options, address);
61
+ return new Ctor(options, address) as SimpleDenyList | SimpleAllowList;
60
62
  }
@@ -0,0 +1,40 @@
1
+ import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
2
+ import { isAddress, zeroAddress } from 'viem';
3
+ import { beforeAll, describe, expect, test } from 'vitest';
4
+ import { accounts } from '@boostxyz/test/accounts';
5
+ import {
6
+ type Fixtures,
7
+ defaultOptions,
8
+ deployFixtures,
9
+ } from '@boostxyz/test/helpers';
10
+ import { OpenAllowList } from './OpenAllowList';
11
+
12
+ let fixtures: Fixtures;
13
+
14
+ beforeAll(async () => {
15
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
16
+ });
17
+
18
+ function freshOpenAllowList(fixtures: Fixtures) {
19
+ return function freshOpenAllowList() {
20
+ return fixtures.registry.initialize(
21
+ crypto.randomUUID(),
22
+ new fixtures.bases.OpenAllowList(defaultOptions),
23
+ );
24
+ };
25
+ }
26
+
27
+ describe('OpenAllowList', () => {
28
+ test('can successfully be deployed', async () => {
29
+ const denyList = new OpenAllowList(defaultOptions);
30
+ await denyList.deploy();
31
+ expect(isAddress(denyList.assertValidAddress())).toBe(true);
32
+ });
33
+
34
+ test('allows anyone', async () => {
35
+ const denyList = await loadFixture(freshOpenAllowList(fixtures));
36
+ expect(await denyList.isAllowed(defaultOptions.account.address)).toBe(true);
37
+ expect(await denyList.isAllowed(zeroAddress)).toBe(true);
38
+ expect(await denyList.isAllowed(accounts.at(1)!.account)).toBe(true);
39
+ });
40
+ });
@@ -0,0 +1,45 @@
1
+ import { simpleDenyListAbi } from '@boostxyz/evm';
2
+ import { bytecode } from '@boostxyz/evm/artifacts/contracts/allowlists/SimpleDenyList.sol/SimpleDenyList.json';
3
+ import { type Hex, zeroAddress } from 'viem';
4
+ import type {
5
+ DeployableOptions,
6
+ GenericDeployableParams,
7
+ } from '../Deployable/Deployable';
8
+ import {
9
+ SimpleDenyList,
10
+ type SimpleDenyListPayload,
11
+ prepareSimpleDenyListPayload,
12
+ } from './SimpleDenyList';
13
+
14
+ export const openAllowListAbi = simpleDenyListAbi;
15
+
16
+ /**
17
+ * A simple AllowList, extending {@link DenyList}, that is ownerless and allows anyone to claim.
18
+ *
19
+ * @export
20
+ * @class OpenAllowList
21
+ * @typedef {OpenAllowList}
22
+ * @extends {DeployableTarget<OpenAllowListPayload>}
23
+ */
24
+ export class OpenAllowList extends SimpleDenyList<undefined> {
25
+ /**
26
+ * @inheritdoc
27
+ *
28
+ * @public
29
+ * @param {?SimpleDenyListPayload} [_payload]
30
+ * @param {?DeployableOptions} [_options]
31
+ * @returns {GenericDeployableParams}
32
+ */
33
+ public override buildParameters(
34
+ _payload?: SimpleDenyListPayload,
35
+ _options?: DeployableOptions,
36
+ ): GenericDeployableParams {
37
+ const [_, options] = this.validateDeploymentConfig({}, _options);
38
+ return {
39
+ abi: openAllowListAbi,
40
+ bytecode: bytecode as Hex,
41
+ args: [prepareSimpleDenyListPayload({ owner: zeroAddress, denied: [] })],
42
+ ...this.optionallyAttachAccount(options.account),
43
+ };
44
+ }
45
+ }
@@ -5,20 +5,20 @@ import {
5
5
  type Fixtures,
6
6
  defaultOptions,
7
7
  deployFixtures,
8
- } from '../../test/helpers';
8
+ } from '@boostxyz/test/helpers';
9
9
  import { SimpleAllowList } from './SimpleAllowList';
10
10
 
11
11
  let fixtures: Fixtures;
12
12
 
13
13
  beforeAll(async () => {
14
- fixtures = await loadFixture(deployFixtures);
14
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
15
15
  });
16
16
 
17
17
  function freshAllowList(fixtures: Fixtures) {
18
18
  return function freshAllowList() {
19
- return fixtures.registry.clone(
19
+ return fixtures.registry.initialize(
20
20
  crypto.randomUUID(),
21
- new fixtures.bases.SimpleAllowList(defaultOptions, {
21
+ fixtures.core.SimpleAllowList({
22
22
  owner: defaultOptions.account.address,
23
23
  allowed: [defaultOptions.account.address],
24
24
  }),
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  readSimpleAllowListIsAllowed,
3
+ readSimpleAllowListOwner,
3
4
  simpleAllowListAbi,
4
- simulateSimpleAllowListGrantRoles,
5
5
  simulateSimpleAllowListSetAllowed,
6
- writeSimpleAllowListGrantRoles,
7
6
  writeSimpleAllowListSetAllowed,
8
7
  } from '@boostxyz/evm';
9
8
  import { bytecode } from '@boostxyz/evm/artifacts/contracts/allowlists/SimpleAllowList.sol/SimpleAllowList.json';
@@ -12,26 +11,50 @@ import {
12
11
  type Address,
13
12
  type ContractEventName,
14
13
  type Hex,
14
+ encodeAbiParameters,
15
15
  zeroAddress,
16
16
  zeroHash,
17
17
  } from 'viem';
18
+ import { SimpleAllowList as SimpleAllowListBases } from '../../dist/deployments.json';
18
19
  import type {
19
20
  DeployableOptions,
20
21
  GenericDeployableParams,
21
22
  } from '../Deployable/Deployable';
22
- import { DeployableTarget } from '../Deployable/DeployableTarget';
23
+ import {
24
+ DeployableTargetWithRBAC,
25
+ Roles,
26
+ } from '../Deployable/DeployableTargetWithRBAC';
23
27
  import { DeployableUnknownOwnerProvidedError } from '../errors';
24
28
  import {
25
29
  type GenericLog,
26
30
  type ReadParams,
27
31
  RegistryType,
28
- type SimpleAllowListPayload,
29
32
  type WriteParams,
30
- prepareSimpleAllowListPayload,
31
33
  } from '../utils';
32
34
 
33
35
  export { simpleAllowListAbi };
34
- export type { SimpleAllowListPayload };
36
+
37
+ /**
38
+ * Object representation of a {@link SimpleAllowList} initialization payload.
39
+ *
40
+ * @export
41
+ * @interface SimpleAllowListPayload
42
+ * @typedef {SimpleAllowListPayload}
43
+ */
44
+ export interface SimpleAllowListPayload {
45
+ /**
46
+ * The allow list's owner, given the {@link LIST_MANAGER_ROLE} role.
47
+ *
48
+ * @type {Address}
49
+ */
50
+ owner: Address;
51
+ /**
52
+ * List of allowed addresses.
53
+ *
54
+ * @type {Address[]}
55
+ */
56
+ allowed: Address[];
57
+ }
35
58
 
36
59
  /**
37
60
  * A generic `viem.Log` event with support for `SimpleAllowList` event types.
@@ -51,18 +74,19 @@ export type SimpleAllowListLog<
51
74
  /**
52
75
  * A constant representing the list manager's role
53
76
  *
54
- * @type {2n}
77
+ * @deprecated use {@link Roles} instead
78
+ * @type {1n}
55
79
  */
56
- export const LIST_MANAGER_ROLE = 2n;
80
+ export const LIST_MANAGER_ROLE = Roles.MANAGER;
57
81
  /**
58
82
  * A simple implementation of an AllowList that checks if a user is authorized based on a list of allowed addresses
59
83
  *
60
84
  * @export
61
85
  * @class SimpleAllowList
62
86
  * @typedef {SimpleAllowList}
63
- * @extends {DeployableTarget<SimpleAllowListPayload>}
87
+ * @extends {DeployableTargetWithRBAC<SimpleAllowListPayload>}
64
88
  */
65
- export class SimpleAllowList extends DeployableTarget<
89
+ export class SimpleAllowList extends DeployableTargetWithRBAC<
66
90
  SimpleAllowListPayload,
67
91
  typeof simpleAllowListAbi
68
92
  > {
@@ -72,10 +96,11 @@ export class SimpleAllowList extends DeployableTarget<
72
96
  *
73
97
  * @public
74
98
  * @static
75
- * @type {Address}
99
+ * @type {Record<number, Address>}
76
100
  */
77
- public static override base: Address = import.meta.env
78
- .VITE_SIMPLE_ALLOWLIST_BASE;
101
+ public static override bases: Record<number, Address> = {
102
+ ...(SimpleAllowListBases as Record<number, Address>),
103
+ };
79
104
  /**
80
105
  * @inheritdoc
81
106
  *
@@ -85,13 +110,33 @@ export class SimpleAllowList extends DeployableTarget<
85
110
  */
86
111
  public static override registryType: RegistryType = RegistryType.ALLOW_LIST;
87
112
 
113
+ /**
114
+ * Retrieves the owner
115
+ *
116
+ * @public
117
+ * @async
118
+ * @param {?ReadParams} [params]
119
+ * @returns {Promise<Address>} - The address of the owner
120
+ */
121
+ public async owner(
122
+ params?: ReadParams<typeof simpleAllowListAbi, 'owner'>,
123
+ ): Promise<Address> {
124
+ return await readSimpleAllowListOwner(this._config, {
125
+ ...this.optionallyAttachAccount(),
126
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
127
+ ...(params as any),
128
+ address: this.assertValidAddress(),
129
+ args: [],
130
+ });
131
+ }
132
+
88
133
  /**
89
134
  * Check if a user is authorized.
90
135
  *
91
136
  * @public
92
137
  * @async
93
138
  * @param {Address} address - The address of the user
94
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
139
+ * @param {?ReadParams} [params]
95
140
  * @returns {Promise<boolean>} - True if the user is authorized
96
141
  */
97
142
  public async isAllowed(
@@ -115,7 +160,7 @@ export class SimpleAllowList extends DeployableTarget<
115
160
  * @async
116
161
  * @param {Address[]} addresses - The list of users to update
117
162
  * @param {boolean[]} allowed - The allowed status of each user
118
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
163
+ * @param {?ReadParams} [params]
119
164
  * @returns {Promise<void>}
120
165
  */
121
166
  public async setAllowed(
@@ -123,7 +168,9 @@ export class SimpleAllowList extends DeployableTarget<
123
168
  allowed: boolean[],
124
169
  params?: WriteParams<typeof simpleAllowListAbi, 'setAllowed'>,
125
170
  ) {
126
- return this.awaitResult(this.setAllowedRaw(addresses, allowed, params));
171
+ return await this.awaitResult(
172
+ this.setAllowedRaw(addresses, allowed, params),
173
+ );
127
174
  }
128
175
 
129
176
  /**
@@ -134,8 +181,8 @@ export class SimpleAllowList extends DeployableTarget<
134
181
  * @async
135
182
  * @param {Address[]} addresses - The list of users to update
136
183
  * @param {boolean[]} allowed - The allowed status of each user
137
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
138
- * @returns {Promise<void>}
184
+ * @param {?ReadParams} [params]
185
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
139
186
  */
140
187
  public async setAllowedRaw(
141
188
  addresses: Address[],
@@ -156,53 +203,6 @@ export class SimpleAllowList extends DeployableTarget<
156
203
  return { hash, result };
157
204
  }
158
205
 
159
- /**
160
- * Allows the owner to grant `user` `roles`.
161
- *
162
- * @public
163
- * @async
164
- * @param {Address} address
165
- * @param {bigint} role
166
- * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]
167
- * @returns {Promise<void>}
168
- */
169
- public async grantRoles(
170
- address: Address,
171
- role: bigint,
172
- params?: WriteParams<typeof simpleAllowListAbi, 'grantRoles'>,
173
- ) {
174
- return this.awaitResult(this.grantRolesRaw(address, role, params));
175
- }
176
-
177
- /**
178
- * Allows the owner to grant `user` `roles`.
179
- *
180
- * @public
181
- * @async
182
- * @param {Address} address
183
- * @param {bigint} role
184
- * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]
185
- * @returns {Promise<void>}
186
- */
187
- public async grantRolesRaw(
188
- address: Address,
189
- role: bigint,
190
- params?: ReadParams<typeof simpleAllowListAbi, 'grantRoles'>,
191
- ) {
192
- const { request, result } = await simulateSimpleAllowListGrantRoles(
193
- this._config,
194
- {
195
- address: this.assertValidAddress(),
196
- args: [address, role],
197
- ...this.optionallyAttachAccount(),
198
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
199
- ...(params as any),
200
- },
201
- );
202
- const hash = await writeSimpleAllowListGrantRoles(this._config, request);
203
- return { hash, result };
204
- }
205
-
206
206
  /**
207
207
  * @inheritdoc
208
208
  *
@@ -239,3 +239,24 @@ export class SimpleAllowList extends DeployableTarget<
239
239
  };
240
240
  }
241
241
  }
242
+
243
+ /**
244
+ * Given a {@link SimpleAllowListPayload}, properly encode the initialization payload.
245
+ *
246
+ * @param {SimpleAllowListPayload} param0
247
+ * @param {Address} param0.owner - The allow list's owner, given the {@link LIST_MANAGER_ROLE} role.
248
+ * @param {Address[]} param0.allowed - List of allowed addresses.
249
+ * @returns {Hex}
250
+ */
251
+ export function prepareSimpleAllowListPayload({
252
+ owner,
253
+ allowed,
254
+ }: SimpleAllowListPayload) {
255
+ return encodeAbiParameters(
256
+ [
257
+ { type: 'address', name: 'owner' },
258
+ { type: 'address[]', name: 'allowed' },
259
+ ],
260
+ [owner, allowed],
261
+ );
262
+ }
@@ -5,20 +5,20 @@ import {
5
5
  type Fixtures,
6
6
  defaultOptions,
7
7
  deployFixtures,
8
- } from '../../test/helpers';
8
+ } from '@boostxyz/test/helpers';
9
9
  import { SimpleDenyList } from './SimpleDenyList';
10
10
 
11
11
  let fixtures: Fixtures;
12
12
 
13
13
  beforeAll(async () => {
14
- fixtures = await loadFixture(deployFixtures);
14
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
15
15
  });
16
16
 
17
17
  function freshDenyList(fixtures: Fixtures) {
18
18
  return function freshDenyList() {
19
- return fixtures.registry.clone(
19
+ return fixtures.registry.initialize(
20
20
  crypto.randomUUID(),
21
- new fixtures.bases.SimpleDenyList(defaultOptions, {
21
+ fixtures.core.SimpleDenyList({
22
22
  owner: defaultOptions.account.address,
23
23
  denied: [defaultOptions.account.address],
24
24
  }),