@boostxyz/sdk 0.0.0-alpha.9 → 1.1.0-alpha.23

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 (254) 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 +2 -2
  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 +174 -41
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +557 -129
  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 +60 -75
  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-Btl5BdAs.cjs +3 -0
  43. package/dist/BoostCore-Btl5BdAs.cjs.map +1 -0
  44. package/dist/BoostCore-CD56zbYX.js +2641 -0
  45. package/dist/BoostCore-CD56zbYX.js.map +1 -0
  46. package/dist/BoostCore.cjs +1 -2
  47. package/dist/BoostCore.cjs.map +1 -1
  48. package/dist/BoostCore.d.ts +749 -78
  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 +164 -82
  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 +103 -221
  66. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  67. package/dist/Budgets/ManagedBudget.js +81 -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 +248 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.js +320 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  94. package/dist/Incentive-CcnOIc8L.cjs +2 -0
  95. package/dist/Incentive-CcnOIc8L.cjs.map +1 -0
  96. package/dist/Incentive-rM5nKznp.js +313 -0
  97. package/dist/Incentive-rM5nKznp.js.map +1 -0
  98. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  99. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  100. package/dist/Incentives/AllowListIncentive.d.ts +38 -16
  101. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  102. package/dist/Incentives/AllowListIncentive.js +43 -29
  103. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  104. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  105. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  106. package/dist/Incentives/CGDAIncentive.d.ts +234 -21
  107. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  108. package/dist/Incentives/CGDAIncentive.js +46 -32
  109. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  110. package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
  111. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  112. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  113. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  114. package/dist/Incentives/ERC20Incentive.d.ts +234 -30
  115. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  116. package/dist/Incentives/ERC20Incentive.js +62 -46
  117. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  118. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +333 -438
  119. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  120. package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
  121. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  122. package/dist/Incentives/Incentive.cjs +1 -1
  123. package/dist/Incentives/Incentive.cjs.map +1 -1
  124. package/dist/Incentives/Incentive.d.ts +4 -4
  125. package/dist/Incentives/Incentive.d.ts.map +1 -1
  126. package/dist/Incentives/Incentive.js +16 -296
  127. package/dist/Incentives/Incentive.js.map +1 -1
  128. package/dist/Incentives/PointsIncentive.cjs +1 -1
  129. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  130. package/dist/Incentives/PointsIncentive.d.ts +40 -18
  131. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  132. package/dist/Incentives/PointsIncentive.js +38 -24
  133. package/dist/Incentives/PointsIncentive.js.map +1 -1
  134. package/dist/SimpleDenyList-BDXpY74P.js +133 -0
  135. package/dist/SimpleDenyList-BDXpY74P.js.map +1 -0
  136. package/dist/SimpleDenyList-DNj5qDWM.cjs +2 -0
  137. package/dist/SimpleDenyList-DNj5qDWM.cjs.map +1 -0
  138. package/dist/Validators/SignerValidator.cjs +1 -1
  139. package/dist/Validators/SignerValidator.cjs.map +1 -1
  140. package/dist/Validators/SignerValidator.d.ts +16 -16
  141. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  142. package/dist/Validators/SignerValidator.js +32 -28
  143. package/dist/Validators/SignerValidator.js.map +1 -1
  144. package/dist/Validators/Validator.cjs +1 -1
  145. package/dist/Validators/Validator.cjs.map +1 -1
  146. package/dist/Validators/Validator.d.ts +1 -1
  147. package/dist/Validators/Validator.js +2 -2
  148. package/dist/Validators/Validator.js.map +1 -1
  149. package/dist/claiming.cjs.map +1 -1
  150. package/dist/claiming.d.ts +1 -1
  151. package/dist/claiming.js.map +1 -1
  152. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  153. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  154. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  155. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  156. package/dist/deployments-DF_6-7hH.cjs +2 -0
  157. package/dist/deployments-DF_6-7hH.cjs.map +1 -0
  158. package/dist/deployments-fJsWblwS.js +56 -0
  159. package/dist/deployments-fJsWblwS.js.map +1 -0
  160. package/dist/deployments.json +58 -0
  161. package/dist/errors.cjs +1 -1
  162. package/dist/errors.cjs.map +1 -1
  163. package/dist/errors.d.ts +256 -20
  164. package/dist/errors.d.ts.map +1 -1
  165. package/dist/errors.js +183 -26
  166. package/dist/errors.js.map +1 -1
  167. package/dist/{generated-57_Kffpz.js → generated-CsNyWPKA.js} +3843 -2084
  168. package/dist/generated-CsNyWPKA.js.map +1 -0
  169. package/dist/generated-DHerxf1y.cjs +3 -0
  170. package/dist/generated-DHerxf1y.cjs.map +1 -0
  171. package/dist/index.cjs +1 -1
  172. package/dist/index.d.ts +5 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +142 -108
  175. package/dist/index.js.map +1 -1
  176. package/dist/transfers.cjs.map +1 -1
  177. package/dist/transfers.d.ts +1 -1
  178. package/dist/transfers.js.map +1 -1
  179. package/dist/utils.cjs +1 -1
  180. package/dist/utils.cjs.map +1 -1
  181. package/dist/utils.d.ts +26 -12
  182. package/dist/utils.d.ts.map +1 -1
  183. package/dist/utils.js +38 -23
  184. package/dist/utils.js.map +1 -1
  185. package/package.json +20 -10
  186. package/src/Actions/Action.test.ts +14 -13
  187. package/src/Actions/ContractAction.test.ts +10 -10
  188. package/src/Actions/ContractAction.ts +11 -12
  189. package/src/Actions/ERC721MintAction.test.ts +6 -6
  190. package/src/Actions/ERC721MintAction.ts +14 -15
  191. package/src/Actions/EventAction.test.ts +735 -109
  192. package/src/Actions/EventAction.ts +527 -88
  193. package/src/AllowLists/AllowList.test.ts +7 -7
  194. package/src/AllowLists/AllowList.ts +5 -3
  195. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  196. package/src/AllowLists/OpenAllowList.ts +45 -0
  197. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  198. package/src/AllowLists/SimpleAllowList.ts +40 -61
  199. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  200. package/src/AllowLists/SimpleDenyList.ts +41 -17
  201. package/src/Auth/PassthroughAuth.test.ts +1 -1
  202. package/src/Boost.ts +21 -24
  203. package/src/BoostCore.test.ts +361 -306
  204. package/src/BoostCore.ts +403 -220
  205. package/src/BoostRegistry.test.ts +53 -0
  206. package/src/BoostRegistry.ts +161 -40
  207. package/src/Budgets/Budget.test.ts +2 -2
  208. package/src/Budgets/Budget.ts +1 -2
  209. package/src/Budgets/ManagedBudget.test.ts +106 -19
  210. package/src/Budgets/ManagedBudget.ts +49 -321
  211. package/src/Budgets/VestingBudget.test.ts +7 -7
  212. package/src/Budgets/VestingBudget.ts +36 -106
  213. package/src/Deployable/Contract.ts +4 -5
  214. package/src/Deployable/Deployable.ts +1 -1
  215. package/src/Deployable/DeployableTarget.ts +30 -19
  216. package/src/Deployable/DeployableTargetWithRBAC.test.ts +103 -0
  217. package/src/Deployable/DeployableTargetWithRBAC.ts +447 -0
  218. package/src/Incentives/AllowListIncentive.test.ts +12 -12
  219. package/src/Incentives/AllowListIncentive.ts +30 -15
  220. package/src/Incentives/CGDAIncentive.test.ts +9 -6
  221. package/src/Incentives/CGDAIncentive.ts +39 -18
  222. package/src/Incentives/ERC1155Incentive.test.ts +3 -3
  223. package/src/Incentives/ERC1155Incentive.ts +30 -29
  224. package/src/Incentives/ERC20Incentive.test.ts +9 -6
  225. package/src/Incentives/ERC20Incentive.ts +54 -27
  226. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  227. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +325 -0
  228. package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
  229. package/src/Incentives/ERC20VariableIncentive.ts +50 -26
  230. package/src/Incentives/Incentive.test.ts +4 -1
  231. package/src/Incentives/Incentive.ts +7 -6
  232. package/src/Incentives/PointsIncentive.test.ts +24 -25
  233. package/src/Incentives/PointsIncentive.ts +32 -17
  234. package/src/Validators/SignerValidator.test.ts +6 -6
  235. package/src/Validators/SignerValidator.ts +20 -17
  236. package/src/Validators/Validator.test.ts +2 -2
  237. package/src/Validators/Validator.ts +1 -1
  238. package/src/claiming.ts +1 -1
  239. package/src/errors.ts +345 -21
  240. package/src/index.test.ts +118 -36
  241. package/src/index.ts +5 -0
  242. package/src/transfers.ts +1 -1
  243. package/src/utils.test.ts +2 -2
  244. package/src/utils.ts +61 -12
  245. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  246. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  247. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  248. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  249. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  250. package/dist/generated-57_Kffpz.js.map +0 -1
  251. package/dist/generated-wKBNvm48.cjs +0 -3
  252. package/dist/generated-wKBNvm48.cjs.map +0 -1
  253. package/src/Budgets/SimpleBudget.test.ts +0 -152
  254. 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,12 @@ 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
+ 31337: import.meta.env.VITE_SIMPLE_ALLOWLIST_BASE,
103
+ ...(SimpleAllowListBases as Record<number, Address>),
104
+ };
99
105
  /**
100
106
  * @inheritdoc
101
107
  *
@@ -105,13 +111,33 @@ export class SimpleAllowList extends DeployableTarget<
105
111
  */
106
112
  public static override registryType: RegistryType = RegistryType.ALLOW_LIST;
107
113
 
114
+ /**
115
+ * Retrieves the owner
116
+ *
117
+ * @public
118
+ * @async
119
+ * @param {?ReadParams} [params]
120
+ * @returns {Promise<Address>} - The address of the owner
121
+ */
122
+ public async owner(
123
+ params?: ReadParams<typeof simpleAllowListAbi, 'owner'>,
124
+ ): Promise<Address> {
125
+ return await readSimpleAllowListOwner(this._config, {
126
+ ...this.optionallyAttachAccount(),
127
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
128
+ ...(params as any),
129
+ address: this.assertValidAddress(),
130
+ args: [],
131
+ });
132
+ }
133
+
108
134
  /**
109
135
  * Check if a user is authorized.
110
136
  *
111
137
  * @public
112
138
  * @async
113
139
  * @param {Address} address - The address of the user
114
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
140
+ * @param {?ReadParams} [params]
115
141
  * @returns {Promise<boolean>} - True if the user is authorized
116
142
  */
117
143
  public async isAllowed(
@@ -135,7 +161,7 @@ export class SimpleAllowList extends DeployableTarget<
135
161
  * @async
136
162
  * @param {Address[]} addresses - The list of users to update
137
163
  * @param {boolean[]} allowed - The allowed status of each user
138
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
164
+ * @param {?ReadParams} [params]
139
165
  * @returns {Promise<void>}
140
166
  */
141
167
  public async setAllowed(
@@ -156,8 +182,8 @@ export class SimpleAllowList extends DeployableTarget<
156
182
  * @async
157
183
  * @param {Address[]} addresses - The list of users to update
158
184
  * @param {boolean[]} allowed - The allowed status of each user
159
- * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
160
- * @returns {Promise<void>}
185
+ * @param {?ReadParams} [params]
186
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
161
187
  */
162
188
  public async setAllowedRaw(
163
189
  addresses: Address[],
@@ -178,53 +204,6 @@ export class SimpleAllowList extends DeployableTarget<
178
204
  return { hash, result };
179
205
  }
180
206
 
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
207
  /**
229
208
  * @inheritdoc
230
209
  *
@@ -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,12 @@ 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
+ 31337: import.meta.env.VITE_SIMPLE_DENYLIST_BASE,
95
+ ...(SimpleDenyListBases as Record<number, Address>),
96
+ };
91
97
  /**
92
98
  * @inheritdoc
93
99
  *
@@ -97,13 +103,33 @@ export class SimpleDenyList extends DeployableTarget<
97
103
  */
98
104
  public static override registryType: RegistryType = RegistryType.ALLOW_LIST;
99
105
 
106
+ /**
107
+ * Retrieves the owner
108
+ *
109
+ * @public
110
+ * @async
111
+ * @param {?ReadParams} [params]
112
+ * @returns {Promise<Address>} - The address of the owner
113
+ */
114
+ public async owner(
115
+ params?: ReadParams<typeof simpleDenyListAbi, 'owner'>,
116
+ ): Promise<Address> {
117
+ return await readSimpleAllowListOwner(this._config, {
118
+ ...this.optionallyAttachAccount(),
119
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
120
+ ...(params as any),
121
+ address: this.assertValidAddress(),
122
+ args: [],
123
+ });
124
+ }
125
+
100
126
  /**
101
127
  * Check if a user is authorized (i.e. not denied)
102
128
  *
103
129
  * @public
104
130
  * @async
105
131
  * @param {Address} address - The address of the user
106
- * @param {?ReadParams<typeof simpleDenyListAbi, 'isAllowed'>} [params]
132
+ * @param {?ReadParams} [params]
107
133
  * @returns {Promise<boolean>} - True if the user is authorized
108
134
  */
109
135
  public async isAllowed(
@@ -126,8 +152,8 @@ export class SimpleDenyList extends DeployableTarget<
126
152
  * @async
127
153
  * @param {Address[]} addresses - The list of users to update
128
154
  * @param {boolean[]} allowed - The denied status of each user
129
- * @param {?WriteParams<typeof simpleDenyListAbi, 'setDenied'>} [params]
130
- * @returns {unknown}
155
+ * @param {?WriteParams} [params]
156
+ * @returns {Promise<void>}
131
157
  */
132
158
  public async setDenied(
133
159
  addresses: Address[],
@@ -146,8 +172,8 @@ export class SimpleDenyList extends DeployableTarget<
146
172
  * @async
147
173
  * @param {Address[]} addresses - The list of users to update
148
174
  * @param {boolean[]} allowed - The denied status of each user
149
- * @param {?WriteParams<typeof simpleDenyListAbi, 'setDenied'>} [params]
150
- * @returns {unknown}
175
+ * @param {?WriteParams} [params]
176
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
151
177
  */
152
178
  public async setDeniedRaw(
153
179
  addresses: Address[],
@@ -177,13 +203,11 @@ export class SimpleDenyList extends DeployableTarget<
177
203
  * @returns {GenericDeployableParams}
178
204
  */
179
205
  public override buildParameters(
180
- _payload?: SimpleDenyListPayload,
206
+ _payload?: Payload,
181
207
  _options?: DeployableOptions,
182
208
  ): GenericDeployableParams {
183
- const [payload, options] = this.validateDeploymentConfig(
184
- _payload,
185
- _options,
186
- );
209
+ const [p, options] = this.validateDeploymentConfig(_payload, _options);
210
+ const payload = p as SimpleDenyListPayload;
187
211
  if (!payload.owner || payload.owner === zeroAddress) {
188
212
  const owner = options.account
189
213
  ? 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
  },