@boostxyz/sdk 0.0.0-alpha.9 → 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 (257) 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 +11 -11
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +14 -14
  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 +171 -41
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +15 -392
  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 +92 -37
  25. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleAllowList.js +55 -71
  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 +203 -11
  31. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  32. package/dist/AllowLists/SimpleDenyList.js +11 -112
  33. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  34. package/dist/Auth/PassthroughAuth.cjs +1 -1
  35. package/dist/Auth/PassthroughAuth.js +1 -1
  36. package/dist/Boost.cjs +1 -1
  37. package/dist/Boost.cjs.map +1 -1
  38. package/dist/Boost.d.ts +20 -21
  39. package/dist/Boost.d.ts.map +1 -1
  40. package/dist/Boost.js +43 -57
  41. package/dist/Boost.js.map +1 -1
  42. package/dist/BoostCore-BVZExPPu.js +1462 -0
  43. package/dist/BoostCore-BVZExPPu.js.map +1 -0
  44. package/dist/BoostCore-D-E-cnGI.cjs +3 -0
  45. package/dist/BoostCore-D-E-cnGI.cjs.map +1 -0
  46. package/dist/BoostCore.cjs +1 -2
  47. package/dist/BoostCore.cjs.map +1 -1
  48. package/dist/BoostCore.d.ts +748 -77
  49. package/dist/BoostCore.d.ts.map +1 -1
  50. package/dist/BoostCore.js +29 -1150
  51. package/dist/BoostCore.js.map +1 -1
  52. package/dist/BoostRegistry.cjs +1 -1
  53. package/dist/BoostRegistry.cjs.map +1 -1
  54. package/dist/BoostRegistry.d.ts +80 -25
  55. package/dist/BoostRegistry.d.ts.map +1 -1
  56. package/dist/BoostRegistry.js +165 -83
  57. package/dist/BoostRegistry.js.map +1 -1
  58. package/dist/Budgets/Budget.cjs +1 -1
  59. package/dist/Budgets/Budget.cjs.map +1 -1
  60. package/dist/Budgets/Budget.d.ts.map +1 -1
  61. package/dist/Budgets/Budget.js +2 -2
  62. package/dist/Budgets/Budget.js.map +1 -1
  63. package/dist/Budgets/ManagedBudget.cjs +1 -1
  64. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  65. package/dist/Budgets/ManagedBudget.d.ts +75 -193
  66. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  67. package/dist/Budgets/ManagedBudget.js +80 -298
  68. package/dist/Budgets/ManagedBudget.js.map +1 -1
  69. package/dist/Budgets/VestingBudget.d.ts +223 -89
  70. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  71. package/dist/Deployable/Contract.cjs +1 -1
  72. package/dist/Deployable/Contract.cjs.map +1 -1
  73. package/dist/Deployable/Contract.d.ts +4 -5
  74. package/dist/Deployable/Contract.d.ts.map +1 -1
  75. package/dist/Deployable/Contract.js +5 -7
  76. package/dist/Deployable/Contract.js.map +1 -1
  77. package/dist/Deployable/Deployable.cjs.map +1 -1
  78. package/dist/Deployable/Deployable.d.ts +1 -1
  79. package/dist/Deployable/Deployable.d.ts.map +1 -1
  80. package/dist/Deployable/Deployable.js +3 -5
  81. package/dist/Deployable/Deployable.js.map +1 -1
  82. package/dist/Deployable/DeployableTarget.cjs +1 -1
  83. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  84. package/dist/Deployable/DeployableTarget.d.ts +13 -13
  85. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  86. package/dist/Deployable/DeployableTarget.js +28 -25
  87. package/dist/Deployable/DeployableTarget.js.map +1 -1
  88. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  89. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  90. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  94. package/dist/EventAction-BZt5cjbe.cjs +2 -0
  95. package/dist/EventAction-BZt5cjbe.cjs.map +1 -0
  96. package/dist/EventAction-C_-hJXWm.js +1541 -0
  97. package/dist/EventAction-C_-hJXWm.js.map +1 -0
  98. package/dist/Incentive-BhHaK3PZ.cjs +2 -0
  99. package/dist/Incentive-BhHaK3PZ.cjs.map +1 -0
  100. package/dist/Incentive-Cqg1w6wD.js +312 -0
  101. package/dist/Incentive-Cqg1w6wD.js.map +1 -0
  102. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  103. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  104. package/dist/Incentives/AllowListIncentive.d.ts +38 -16
  105. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  106. package/dist/Incentives/AllowListIncentive.js +42 -29
  107. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  108. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  109. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  110. package/dist/Incentives/CGDAIncentive.d.ts +234 -21
  111. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  112. package/dist/Incentives/CGDAIncentive.js +45 -32
  113. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  114. package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
  115. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  116. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  117. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  118. package/dist/Incentives/ERC20Incentive.d.ts +230 -29
  119. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  120. package/dist/Incentives/ERC20Incentive.js +56 -43
  121. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  122. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +335 -440
  123. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  124. package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
  125. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  126. package/dist/Incentives/Incentive.cjs +1 -1
  127. package/dist/Incentives/Incentive.cjs.map +1 -1
  128. package/dist/Incentives/Incentive.d.ts +4 -4
  129. package/dist/Incentives/Incentive.d.ts.map +1 -1
  130. package/dist/Incentives/Incentive.js +16 -296
  131. package/dist/Incentives/Incentive.js.map +1 -1
  132. package/dist/Incentives/PointsIncentive.cjs +1 -1
  133. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  134. package/dist/Incentives/PointsIncentive.d.ts +40 -18
  135. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  136. package/dist/Incentives/PointsIncentive.js +37 -24
  137. package/dist/Incentives/PointsIncentive.js.map +1 -1
  138. package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
  139. package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
  140. package/dist/SimpleDenyList-CGaWjuld.js +132 -0
  141. package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
  142. package/dist/Validators/SignerValidator.cjs +1 -1
  143. package/dist/Validators/SignerValidator.cjs.map +1 -1
  144. package/dist/Validators/SignerValidator.d.ts +16 -16
  145. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  146. package/dist/Validators/SignerValidator.js +30 -27
  147. package/dist/Validators/SignerValidator.js.map +1 -1
  148. package/dist/Validators/Validator.cjs +1 -1
  149. package/dist/Validators/Validator.cjs.map +1 -1
  150. package/dist/Validators/Validator.d.ts +1 -1
  151. package/dist/Validators/Validator.js +2 -2
  152. package/dist/Validators/Validator.js.map +1 -1
  153. package/dist/claiming.cjs.map +1 -1
  154. package/dist/claiming.d.ts +1 -1
  155. package/dist/claiming.js.map +1 -1
  156. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  157. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  158. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  159. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  160. package/dist/deployments-DVXioW2i.cjs +2 -0
  161. package/dist/deployments-DVXioW2i.cjs.map +1 -0
  162. package/dist/deployments-oykLv3_Z.js +43 -0
  163. package/dist/deployments-oykLv3_Z.js.map +1 -0
  164. package/dist/deployments.json +44 -0
  165. package/dist/errors.cjs +1 -1
  166. package/dist/errors.cjs.map +1 -1
  167. package/dist/errors.d.ts +256 -20
  168. package/dist/errors.d.ts.map +1 -1
  169. package/dist/errors.js +183 -26
  170. package/dist/errors.js.map +1 -1
  171. package/dist/{generated-57_Kffpz.js → generated-CKt2yCQd.js} +3613 -1869
  172. package/dist/generated-CKt2yCQd.js.map +1 -0
  173. package/dist/generated-CyTNlOwM.cjs +3 -0
  174. package/dist/generated-CyTNlOwM.cjs.map +1 -0
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.d.ts +5 -0
  177. package/dist/index.d.ts.map +1 -1
  178. package/dist/index.js +142 -108
  179. package/dist/index.js.map +1 -1
  180. package/dist/transfers.cjs.map +1 -1
  181. package/dist/transfers.d.ts +1 -1
  182. package/dist/transfers.js.map +1 -1
  183. package/dist/utils.cjs +1 -1
  184. package/dist/utils.cjs.map +1 -1
  185. package/dist/utils.d.ts +26 -12
  186. package/dist/utils.d.ts.map +1 -1
  187. package/dist/utils.js +38 -23
  188. package/dist/utils.js.map +1 -1
  189. package/package.json +20 -10
  190. package/src/Actions/Action.test.ts +14 -13
  191. package/src/Actions/ContractAction.test.ts +10 -10
  192. package/src/Actions/ContractAction.ts +11 -12
  193. package/src/Actions/ERC721MintAction.test.ts +6 -6
  194. package/src/Actions/ERC721MintAction.ts +14 -15
  195. package/src/Actions/EventAction.test.ts +729 -109
  196. package/src/Actions/EventAction.ts +542 -84
  197. package/src/AllowLists/AllowList.test.ts +7 -7
  198. package/src/AllowLists/AllowList.ts +5 -3
  199. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  200. package/src/AllowLists/OpenAllowList.ts +45 -0
  201. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  202. package/src/AllowLists/SimpleAllowList.ts +39 -61
  203. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  204. package/src/AllowLists/SimpleDenyList.ts +40 -17
  205. package/src/Auth/PassthroughAuth.test.ts +1 -1
  206. package/src/Boost.ts +21 -24
  207. package/src/BoostCore.test.ts +323 -268
  208. package/src/BoostCore.ts +396 -219
  209. package/src/BoostRegistry.test.ts +53 -0
  210. package/src/BoostRegistry.ts +161 -40
  211. package/src/Budgets/Budget.test.ts +2 -2
  212. package/src/Budgets/Budget.ts +1 -2
  213. package/src/Budgets/ManagedBudget.test.ts +82 -19
  214. package/src/Budgets/ManagedBudget.ts +48 -310
  215. package/src/Budgets/VestingBudget.test.ts +7 -7
  216. package/src/Budgets/VestingBudget.ts +34 -106
  217. package/src/Deployable/Contract.ts +4 -5
  218. package/src/Deployable/Deployable.ts +1 -1
  219. package/src/Deployable/DeployableTarget.ts +30 -19
  220. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  221. package/src/Incentives/AllowListIncentive.test.ts +5 -5
  222. package/src/Incentives/AllowListIncentive.ts +29 -15
  223. package/src/Incentives/CGDAIncentive.test.ts +9 -6
  224. package/src/Incentives/CGDAIncentive.ts +38 -18
  225. package/src/Incentives/ERC1155Incentive.test.ts +3 -3
  226. package/src/Incentives/ERC1155Incentive.ts +28 -29
  227. package/src/Incentives/ERC20Incentive.test.ts +9 -6
  228. package/src/Incentives/ERC20Incentive.ts +46 -26
  229. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  230. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +324 -0
  231. package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
  232. package/src/Incentives/ERC20VariableIncentive.ts +49 -26
  233. package/src/Incentives/Incentive.test.ts +4 -1
  234. package/src/Incentives/Incentive.ts +7 -6
  235. package/src/Incentives/PointsIncentive.test.ts +24 -25
  236. package/src/Incentives/PointsIncentive.ts +31 -17
  237. package/src/Validators/SignerValidator.test.ts +6 -6
  238. package/src/Validators/SignerValidator.ts +19 -17
  239. package/src/Validators/Validator.test.ts +2 -2
  240. package/src/Validators/Validator.ts +1 -1
  241. package/src/claiming.ts +1 -1
  242. package/src/errors.ts +345 -21
  243. package/src/index.test.ts +118 -36
  244. package/src/index.ts +5 -0
  245. package/src/transfers.ts +1 -1
  246. package/src/utils.test.ts +2 -2
  247. package/src/utils.ts +61 -12
  248. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  249. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  250. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  251. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  252. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  253. package/dist/generated-57_Kffpz.js.map +0 -1
  254. package/dist/generated-wKBNvm48.cjs +0 -3
  255. package/dist/generated-wKBNvm48.cjs.map +0 -1
  256. package/src/Budgets/SimpleBudget.test.ts +0 -152
  257. package/src/Budgets/SimpleBudget.ts +0 -564
@@ -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';
@@ -16,11 +15,15 @@ import {
16
15
  zeroAddress,
17
16
  zeroHash,
18
17
  } from 'viem';
18
+ import { SimpleAllowList as SimpleAllowListBases } from '../../dist/deployments.json';
19
19
  import type {
20
20
  DeployableOptions,
21
21
  GenericDeployableParams,
22
22
  } from '../Deployable/Deployable';
23
- import { DeployableTarget } from '../Deployable/DeployableTarget';
23
+ import {
24
+ DeployableTargetWithRBAC,
25
+ Roles,
26
+ } from '../Deployable/DeployableTargetWithRBAC';
24
27
  import { DeployableUnknownOwnerProvidedError } from '../errors';
25
28
  import {
26
29
  type GenericLog,
@@ -71,18 +74,19 @@ export type SimpleAllowListLog<
71
74
  /**
72
75
  * A constant representing the list manager's role
73
76
  *
74
- * @type {2n}
77
+ * @deprecated use {@link Roles} instead
78
+ * @type {1n}
75
79
  */
76
- export const LIST_MANAGER_ROLE = 2n;
80
+ export const LIST_MANAGER_ROLE = Roles.MANAGER;
77
81
  /**
78
82
  * A simple implementation of an AllowList that checks if a user is authorized based on a list of allowed addresses
79
83
  *
80
84
  * @export
81
85
  * @class SimpleAllowList
82
86
  * @typedef {SimpleAllowList}
83
- * @extends {DeployableTarget<SimpleAllowListPayload>}
87
+ * @extends {DeployableTargetWithRBAC<SimpleAllowListPayload>}
84
88
  */
85
- export class SimpleAllowList extends DeployableTarget<
89
+ export class SimpleAllowList extends DeployableTargetWithRBAC<
86
90
  SimpleAllowListPayload,
87
91
  typeof simpleAllowListAbi
88
92
  > {
@@ -92,10 +96,11 @@ export class SimpleAllowList extends DeployableTarget<
92
96
  *
93
97
  * @public
94
98
  * @static
95
- * @type {Address}
99
+ * @type {Record<number, Address>}
96
100
  */
97
- public static override base: Address = import.meta.env
98
- .VITE_SIMPLE_ALLOWLIST_BASE;
101
+ public static override bases: Record<number, Address> = {
102
+ ...(SimpleAllowListBases as Record<number, Address>),
103
+ };
99
104
  /**
100
105
  * @inheritdoc
101
106
  *
@@ -105,13 +110,33 @@ export class SimpleAllowList extends DeployableTarget<
105
110
  */
106
111
  public static override registryType: RegistryType = RegistryType.ALLOW_LIST;
107
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
+
108
133
  /**
109
134
  * Check if a user is authorized.
110
135
  *
111
136
  * @public
112
137
  * @async
113
138
  * @param {Address} address - The address of the user
114
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
139
+ * @param {?ReadParams} [params]
115
140
  * @returns {Promise<boolean>} - True if the user is authorized
116
141
  */
117
142
  public async isAllowed(
@@ -135,7 +160,7 @@ export class SimpleAllowList extends DeployableTarget<
135
160
  * @async
136
161
  * @param {Address[]} addresses - The list of users to update
137
162
  * @param {boolean[]} allowed - The allowed status of each user
138
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
163
+ * @param {?ReadParams} [params]
139
164
  * @returns {Promise<void>}
140
165
  */
141
166
  public async setAllowed(
@@ -156,8 +181,8 @@ export class SimpleAllowList extends DeployableTarget<
156
181
  * @async
157
182
  * @param {Address[]} addresses - The list of users to update
158
183
  * @param {boolean[]} allowed - The allowed status of each user
159
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
160
- * @returns {Promise<void>}
184
+ * @param {?ReadParams} [params]
185
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
161
186
  */
162
187
  public async setAllowedRaw(
163
188
  addresses: Address[],
@@ -178,53 +203,6 @@ export class SimpleAllowList extends DeployableTarget<
178
203
  return { hash, result };
179
204
  }
180
205
 
181
- /**
182
- * Allows the owner to grant `user` `roles`.
183
- *
184
- * @public
185
- * @async
186
- * @param {Address} address
187
- * @param {bigint} role
188
- * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]
189
- * @returns {Promise<void>}
190
- */
191
- public async grantRoles(
192
- address: Address,
193
- role: bigint,
194
- params?: WriteParams<typeof simpleAllowListAbi, 'grantRoles'>,
195
- ) {
196
- return await this.awaitResult(this.grantRolesRaw(address, role, params));
197
- }
198
-
199
- /**
200
- * Allows the owner to grant `user` `roles`.
201
- *
202
- * @public
203
- * @async
204
- * @param {Address} address
205
- * @param {bigint} role
206
- * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]
207
- * @returns {Promise<void>}
208
- */
209
- public async grantRolesRaw(
210
- address: Address,
211
- role: bigint,
212
- params?: ReadParams<typeof simpleAllowListAbi, 'grantRoles'>,
213
- ) {
214
- const { request, result } = await simulateSimpleAllowListGrantRoles(
215
- this._config,
216
- {
217
- address: this.assertValidAddress(),
218
- args: [address, role],
219
- ...this.optionallyAttachAccount(),
220
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
221
- ...(params as any),
222
- },
223
- );
224
- const hash = await writeSimpleAllowListGrantRoles(this._config, request);
225
- return { hash, result };
226
- }
227
-
228
206
  /**
229
207
  * @inheritdoc
230
208
  *
@@ -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
  }),
@@ -1,4 +1,5 @@
1
1
  import {
2
+ readSimpleAllowListOwner,
2
3
  readSimpleDenyListIsAllowed,
3
4
  simpleDenyListAbi,
4
5
  simulateSimpleDenyListSetDenied,
@@ -14,11 +15,12 @@ import {
14
15
  zeroAddress,
15
16
  zeroHash,
16
17
  } from 'viem';
18
+ import { SimpleDenyList as SimpleDenyListBases } from '../../dist/deployments.json';
17
19
  import type {
18
20
  DeployableOptions,
19
21
  GenericDeployableParams,
20
22
  } from '../Deployable/Deployable';
21
- import { DeployableTarget } from '../Deployable/DeployableTarget';
23
+ import { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';
22
24
  import { DeployableUnknownOwnerProvidedError } from '../errors';
23
25
  import {
24
26
  type GenericLog,
@@ -72,10 +74,12 @@ export type SimpleDenyListLog<
72
74
  * @export
73
75
  * @class SimpleDenyList
74
76
  * @typedef {SimpleDenyList}
75
- * @extends {DeployableTarget<SimpleDenyListPayload>}
77
+ * @extends {DeployableTargetWithRBAC<SimpleDenyListPayload>}
76
78
  */
77
- export class SimpleDenyList extends DeployableTarget<
78
- SimpleDenyListPayload,
79
+ export class SimpleDenyList<
80
+ Payload = SimpleDenyListPayload,
81
+ > extends DeployableTargetWithRBAC<
82
+ Payload | undefined,
79
83
  typeof simpleDenyListAbi
80
84
  > {
81
85
  public override readonly abi = simpleDenyListAbi;
@@ -84,10 +88,11 @@ export class SimpleDenyList extends DeployableTarget<
84
88
  *
85
89
  * @public
86
90
  * @static
87
- * @type {Address}
91
+ * @type {Record<number, Address>}
88
92
  */
89
- public static override base: Address = import.meta.env
90
- .VITE_SIMPLE_DENYLIST_BASE;
93
+ public static override bases: Record<number, Address> = {
94
+ ...(SimpleDenyListBases as Record<number, Address>),
95
+ };
91
96
  /**
92
97
  * @inheritdoc
93
98
  *
@@ -97,13 +102,33 @@ export class SimpleDenyList extends DeployableTarget<
97
102
  */
98
103
  public static override registryType: RegistryType = RegistryType.ALLOW_LIST;
99
104
 
105
+ /**
106
+ * Retrieves the owner
107
+ *
108
+ * @public
109
+ * @async
110
+ * @param {?ReadParams} [params]
111
+ * @returns {Promise<Address>} - The address of the owner
112
+ */
113
+ public async owner(
114
+ params?: ReadParams<typeof simpleDenyListAbi, 'owner'>,
115
+ ): Promise<Address> {
116
+ return await readSimpleAllowListOwner(this._config, {
117
+ ...this.optionallyAttachAccount(),
118
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
119
+ ...(params as any),
120
+ address: this.assertValidAddress(),
121
+ args: [],
122
+ });
123
+ }
124
+
100
125
  /**
101
126
  * Check if a user is authorized (i.e. not denied)
102
127
  *
103
128
  * @public
104
129
  * @async
105
130
  * @param {Address} address - The address of the user
106
- * @param {?ReadParams<typeof simpleDenyListAbi, 'isAllowed'>} [params]
131
+ * @param {?ReadParams} [params]
107
132
  * @returns {Promise<boolean>} - True if the user is authorized
108
133
  */
109
134
  public async isAllowed(
@@ -126,8 +151,8 @@ export class SimpleDenyList extends DeployableTarget<
126
151
  * @async
127
152
  * @param {Address[]} addresses - The list of users to update
128
153
  * @param {boolean[]} allowed - The denied status of each user
129
- * @param {?WriteParams<typeof simpleDenyListAbi, 'setDenied'>} [params]
130
- * @returns {unknown}
154
+ * @param {?WriteParams} [params]
155
+ * @returns {Promise<void>}
131
156
  */
132
157
  public async setDenied(
133
158
  addresses: Address[],
@@ -146,8 +171,8 @@ export class SimpleDenyList extends DeployableTarget<
146
171
  * @async
147
172
  * @param {Address[]} addresses - The list of users to update
148
173
  * @param {boolean[]} allowed - The denied status of each user
149
- * @param {?WriteParams<typeof simpleDenyListAbi, 'setDenied'>} [params]
150
- * @returns {unknown}
174
+ * @param {?WriteParams} [params]
175
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
151
176
  */
152
177
  public async setDeniedRaw(
153
178
  addresses: Address[],
@@ -177,13 +202,11 @@ export class SimpleDenyList extends DeployableTarget<
177
202
  * @returns {GenericDeployableParams}
178
203
  */
179
204
  public override buildParameters(
180
- _payload?: SimpleDenyListPayload,
205
+ _payload?: Payload,
181
206
  _options?: DeployableOptions,
182
207
  ): GenericDeployableParams {
183
- const [payload, options] = this.validateDeploymentConfig(
184
- _payload,
185
- _options,
186
- );
208
+ const [p, options] = this.validateDeploymentConfig(_payload, _options);
209
+ const payload = p as SimpleDenyListPayload;
187
210
  if (!payload.owner || payload.owner === zeroAddress) {
188
211
  const owner = options.account
189
212
  ? options.account.address
@@ -1,6 +1,6 @@
1
1
  import { zeroAddress } from 'viem';
2
2
  import { describe, expect, test } from 'vitest';
3
- import { defaultOptions } from '../../test/helpers';
3
+ import { defaultOptions } from '@boostxyz/test/helpers';
4
4
  import { PassthroughAuth } from './PassthroughAuth';
5
5
 
6
6
  describe('PassthroughAuth', () => {
package/src/Boost.ts CHANGED
@@ -12,12 +12,30 @@ import type { Budget } from './Budgets/Budget';
12
12
  import type { Incentive } from './Incentives/Incentive';
13
13
  import type { Validator } from './Validators/Validator';
14
14
 
15
+ /**
16
+ * Interface representing a `BoostLib.Boost` on-chain struct
17
+ *
18
+ * @export
19
+ * @interface RawBoost
20
+ * @typedef {RawBoost}
21
+ */
22
+ export interface RawBoost {
23
+ action: Address;
24
+ validator: Address;
25
+ allowList: Address;
26
+ budget: Address;
27
+ incentives: readonly Address[];
28
+ protocolFee: bigint;
29
+ maxParticipants: bigint;
30
+ owner: Address;
31
+ }
32
+
15
33
  /**
16
34
  * Configuration used to instantiate a `Boost` instance.
17
35
  *
18
36
  * @export
19
- * @interface BoostPayload
20
- * @typedef {BoostPayload}
37
+ * @interface BoostConfig
38
+ * @typedef {BoostConfig}
21
39
  */
22
40
  export interface BoostConfig {
23
41
  /**
@@ -55,11 +73,6 @@ export interface BoostConfig {
55
73
  * @type {?bigint}
56
74
  */
57
75
  protocolFee?: bigint;
58
- /**
59
- *
60
- * @type {?bigint}
61
- */
62
- referralFee?: bigint;
63
76
  /**
64
77
  *
65
78
  * @type {?bigint}
@@ -122,12 +135,6 @@ export class Boost {
122
135
  * @type {bigint}
123
136
  */
124
137
  readonly protocolFee: bigint;
125
- /**
126
- *
127
- * @readonly
128
- * @type {bigint}
129
- */
130
- readonly referralFee: bigint;
131
138
  /**
132
139
  *
133
140
  * @readonly
@@ -155,7 +162,6 @@ export class Boost {
155
162
  this.allowList = config.allowList;
156
163
  this.incentives = config.incentives;
157
164
  this.protocolFee = config.protocolFee || 0n;
158
- this.referralFee = config.referralFee || 0n;
159
165
  this.maxParticipants = config.maxParticipants || 0n;
160
166
  this.owner = config.owner || zeroAddress;
161
167
  }
@@ -218,12 +224,6 @@ export interface BoostPayload {
218
224
  * @type {?bigint}
219
225
  */
220
226
  protocolFee?: bigint;
221
- /**
222
- * The base referral fee (in bps)
223
- *
224
- * @type {?bigint}
225
- */
226
- referralFee?: bigint;
227
227
  /**
228
228
  * Optional maximum amount of participants in the Boost.
229
229
  *
@@ -249,7 +249,6 @@ export interface BoostPayload {
249
249
  * @param {Target} param0.allowList - Target for existing allowList, or base with initialization payload.
250
250
  * @param {Target[]} param0.incentives - Targets for new incentives, with initialization payloads.
251
251
  * @param {bigint} [param0.protocolFee=0n] - The base protocol fee (in bps)
252
- * @param {bigint} [param0.referralFee=0n] - The base referral fee (in bps)
253
252
  * @param {bigint} [param0.maxParticipants=0n] - Optional maximum amount of participants in the Boost.
254
253
  * @param {Address} param0.owner - The owner of the Boost.
255
254
  * @returns {Hex}
@@ -261,7 +260,6 @@ export function prepareBoostPayload({
261
260
  allowList,
262
261
  incentives,
263
262
  protocolFee = 0n,
264
- referralFee = 0n,
265
263
  maxParticipants = 0n,
266
264
  owner,
267
265
  }: BoostPayload): Hex {
@@ -269,7 +267,7 @@ export function prepareBoostPayload({
269
267
  encodeAbiParameters(
270
268
  parseAbiParameters([
271
269
  'BoostPayload payload',
272
- 'struct BoostPayload { address budget; Target action; Target validator; Target allowList; Target[] incentives; uint64 protocolFee; uint64 referralFee; uint256 maxParticipants; address owner; }',
270
+ 'struct BoostPayload { address budget; Target action; Target validator; Target allowList; Target[] incentives; uint64 protocolFee; uint256 maxParticipants; address owner; }',
273
271
  'struct Target { bool isBase; address instance; bytes parameters; }',
274
272
  ]),
275
273
  [
@@ -280,7 +278,6 @@ export function prepareBoostPayload({
280
278
  allowList,
281
279
  incentives,
282
280
  protocolFee,
283
- referralFee,
284
281
  maxParticipants,
285
282
  owner,
286
283
  },