@boostxyz/sdk 0.0.0-alpha.10 → 0.0.0-alpha.11

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 (76) hide show
  1. package/dist/Actions/Action.js +1 -1
  2. package/dist/AllowLists/AllowList.cjs +1 -1
  3. package/dist/AllowLists/AllowList.cjs.map +1 -1
  4. package/dist/AllowLists/AllowList.d.ts +6 -4
  5. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  6. package/dist/AllowLists/AllowList.js +45 -23
  7. package/dist/AllowLists/AllowList.js.map +1 -1
  8. package/dist/AllowLists/OpenAllowList.d.ts +240 -0
  9. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
  10. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  11. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  12. package/dist/AllowLists/SimpleDenyList.d.ts +2 -2
  13. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  14. package/dist/AllowLists/SimpleDenyList.js +9 -111
  15. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  16. package/dist/BoostCore.cjs +2 -2
  17. package/dist/BoostCore.cjs.map +1 -1
  18. package/dist/BoostCore.d.ts +14 -1
  19. package/dist/BoostCore.d.ts.map +1 -1
  20. package/dist/BoostCore.js +169 -151
  21. package/dist/BoostCore.js.map +1 -1
  22. package/dist/Budgets/Budget.js +1 -1
  23. package/dist/Budgets/ManagedBudget.cjs +1 -1
  24. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  25. package/dist/Budgets/ManagedBudget.d.ts +29 -27
  26. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  27. package/dist/Budgets/ManagedBudget.js +78 -77
  28. package/dist/Budgets/ManagedBudget.js.map +1 -1
  29. package/dist/Budgets/SimpleBudget.d.ts +6 -6
  30. package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
  31. package/dist/Budgets/VestingBudget.d.ts +6 -6
  32. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  33. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  34. package/dist/Deployable/DeployableTarget.d.ts +1 -1
  35. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  36. package/dist/Deployable/DeployableTarget.js.map +1 -1
  37. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  38. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  39. package/dist/Incentives/AllowListIncentive.js +1 -1
  40. package/dist/Incentives/ERC20VariableIncentive.d.ts +5 -5
  41. package/dist/Incentives/Incentive.cjs.map +1 -1
  42. package/dist/Incentives/Incentive.js +4 -4
  43. package/dist/Incentives/Incentive.js.map +1 -1
  44. package/dist/SimpleDenyList-4PtOPXTc.js +112 -0
  45. package/dist/SimpleDenyList-4PtOPXTc.js.map +1 -0
  46. package/dist/SimpleDenyList-CqT0BMP7.cjs +2 -0
  47. package/dist/SimpleDenyList-CqT0BMP7.cjs.map +1 -0
  48. package/dist/Validators/Validator.js +1 -1
  49. package/dist/{componentInterfaces-DYkaxBda.js → componentInterfaces-Cmg8tUxq.js} +5 -5
  50. package/dist/componentInterfaces-Cmg8tUxq.js.map +1 -0
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.js +88 -87
  53. package/package.json +4 -3
  54. package/src/Actions/Action.test.ts +1 -1
  55. package/src/Actions/ContractAction.test.ts +3 -3
  56. package/src/Actions/ERC721MintAction.test.ts +1 -1
  57. package/src/Actions/EventAction.test.ts +1 -1
  58. package/src/AllowLists/AllowList.test.ts +2 -2
  59. package/src/AllowLists/AllowList.ts +5 -3
  60. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  61. package/src/AllowLists/OpenAllowList.ts +45 -0
  62. package/src/AllowLists/SimpleAllowList.test.ts +1 -1
  63. package/src/AllowLists/SimpleDenyList.test.ts +1 -1
  64. package/src/AllowLists/SimpleDenyList.ts +6 -9
  65. package/src/BoostCore.ts +19 -0
  66. package/src/Budgets/ManagedBudget.test.ts +70 -7
  67. package/src/Budgets/ManagedBudget.ts +42 -31
  68. package/src/Budgets/SimpleBudget.test.ts +3 -3
  69. package/src/Budgets/SimpleBudget.ts +6 -6
  70. package/src/Budgets/VestingBudget.test.ts +3 -3
  71. package/src/Budgets/VestingBudget.ts +6 -6
  72. package/src/Deployable/DeployableTarget.ts +1 -1
  73. package/src/Incentives/AllowListIncentive.test.ts +1 -1
  74. package/src/Incentives/ERC20VariableIncentive.ts +5 -5
  75. package/src/Validators/SignerValidator.test.ts +1 -1
  76. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
package/dist/index.js CHANGED
@@ -3,111 +3,112 @@ import { BOOST_CORE_ADDRESS as i, BOOST_CORE_CLAIM_FEE as n, BoostCore as p } fr
3
3
  import { Boost as s, prepareBoostPayload as d } from "./Boost.js";
4
4
  import { ActionByComponentInterface as A, actionFromAddress as y } from "./Actions/Action.js";
5
5
  import { EventAction as f, FilterType as E, PrimitiveType as g, SignatureType as v, isEventActionPayloadSimple as I, prepareEventActionPayload as C } from "./Actions/EventAction.js";
6
- import { AllowListByComponentInterface as b, allowListFromAddress as x } from "./AllowLists/AllowList.js";
7
- import { LIST_MANAGER_ROLE as S, SimpleAllowList as B, prepareSimpleAllowListPayload as R } from "./AllowLists/SimpleAllowList.js";
8
- import { SimpleDenyList as T, prepareSimpleDenyListPayload as L } from "./AllowLists/SimpleDenyList.js";
9
- import { BudgetByComponentInterface as F, budgetFromAddress as M } from "./Budgets/Budget.js";
10
- import { ManagedBudget as V, ManagedBudgetRoles as _, isERC1155TransferPayload as h, isFungibleTransfer as N, prepareManagedBudgetPayload as U, prepareTransfer as z } from "./Budgets/ManagedBudget.js";
11
- import { Deployable as k } from "./Deployable/Deployable.js";
12
- import { Contract as W } from "./Deployable/Contract.js";
13
- import { DeployableTarget as j } from "./Deployable/DeployableTarget.js";
14
- import { AllowListIncentive as J, prepareAllowListIncentivePayload as K } from "./Incentives/AllowListIncentive.js";
15
- import { CGDAIncentive as X, prepareCGDAIncentivePayload as Z } from "./Incentives/CGDAIncentive.js";
16
- import { ERC20Incentive as ee, prepareERC20IncentivePayload as re } from "./Incentives/ERC20Incentive.js";
17
- import { ERC20VariableIncentive as te, IncentiveByComponentInterface as ae, incentiveFromAddress as ie } from "./Incentives/Incentive.js";
18
- import { PointsIncentive as pe, preparePointsIncentivePayload as le } from "./Incentives/PointsIncentive.js";
19
- import { SignerValidator as de, prepareSignerValidatorClaimDataPayload as me, prepareSignerValidatorInputParams as Ae, prepareSignerValidatorPayload as ye } from "./Validators/SignerValidator.js";
20
- import { ValidatorByComponentInterface as fe, validatorFromAddress as Ee } from "./Validators/Validator.js";
21
- import { BoostCoreNoIdentifierEmitted as ve, BudgetMustAuthorizeBoostCore as Ie, ContractAddressRequiredError as Ce, DeployableAlreadyDeployedError as ue, DeployableBuildParametersUnspecifiedError as be, DeployableMissingPayloadError as xe, DeployableUnknownOwnerProvidedError as Pe, DeployableWagmiConfigurationRequiredError as Se, EventActionValidationError as Be, FieldValueNotComparableError as Re, FieldValueUndefinedError as De, IncentiveNotCloneableError as Te, InvalidComponentInterfaceError as Le, InvalidNumericalCriteriaError as we, MustInitializeBudgetError as Fe, NoContractAddressUponReceiptError as Me, NoEventActionStepsProvidedError as Oe, TooManyEventActionStepsProvidedError as Ve, UnknownTransferPayloadSupplied as _e, UnrecognizedFilterTypeError as he } from "./errors.js";
22
- import { RegistryType as Ue, awaitResult as ze, bytes4 as Ge, getDeployedContractAddress as ke } from "./utils.js";
23
- import { PassthroughAuth as We } from "./Auth/PassthroughAuth.js";
24
- import { A as je, c as He, e as Je, v as Ke, f as Qe, p as Xe, z as Ze, l as $e, M as er, T as rr, S as or } from "./generated-BDeDiaCK.js";
6
+ import { AllowListByComponentInterface as b, OpenAllowList as x, allowListFromAddress as P } from "./AllowLists/AllowList.js";
7
+ import { LIST_MANAGER_ROLE as B, SimpleAllowList as R, prepareSimpleAllowListPayload as D } from "./AllowLists/SimpleAllowList.js";
8
+ import { S as L, p as w } from "./SimpleDenyList-4PtOPXTc.js";
9
+ import { BudgetByComponentInterface as O, budgetFromAddress as M } from "./Budgets/Budget.js";
10
+ import { ManagedBudget as _, ManagedBudgetRoles as h, isERC1155TransferPayload as N, isFungibleTransfer as U, prepareManagedBudgetPayload as z, prepareTransfer as G } from "./Budgets/ManagedBudget.js";
11
+ import { Deployable as q } from "./Deployable/Deployable.js";
12
+ import { Contract as Y } from "./Deployable/Contract.js";
13
+ import { DeployableTarget as H } from "./Deployable/DeployableTarget.js";
14
+ import { AllowListIncentive as K, prepareAllowListIncentivePayload as Q } from "./Incentives/AllowListIncentive.js";
15
+ import { CGDAIncentive as Z, prepareCGDAIncentivePayload as $ } from "./Incentives/CGDAIncentive.js";
16
+ import { ERC20Incentive as re, prepareERC20IncentivePayload as oe } from "./Incentives/ERC20Incentive.js";
17
+ import { ERC20VariableIncentive as ae, IncentiveByComponentInterface as ie, incentiveFromAddress as ne } from "./Incentives/Incentive.js";
18
+ import { PointsIncentive as le, preparePointsIncentivePayload as se } from "./Incentives/PointsIncentive.js";
19
+ import { SignerValidator as me, prepareSignerValidatorClaimDataPayload as Ae, prepareSignerValidatorInputParams as ye, prepareSignerValidatorPayload as ce } from "./Validators/SignerValidator.js";
20
+ import { ValidatorByComponentInterface as Ee, validatorFromAddress as ge } from "./Validators/Validator.js";
21
+ import { BoostCoreNoIdentifierEmitted as Ie, BudgetMustAuthorizeBoostCore as Ce, ContractAddressRequiredError as ue, DeployableAlreadyDeployedError as be, DeployableBuildParametersUnspecifiedError as xe, DeployableMissingPayloadError as Pe, DeployableUnknownOwnerProvidedError as Se, DeployableWagmiConfigurationRequiredError as Be, EventActionValidationError as Re, FieldValueNotComparableError as De, FieldValueUndefinedError as Te, IncentiveNotCloneableError as Le, InvalidComponentInterfaceError as we, InvalidNumericalCriteriaError as Fe, MustInitializeBudgetError as Oe, NoContractAddressUponReceiptError as Me, NoEventActionStepsProvidedError as Ve, TooManyEventActionStepsProvidedError as _e, UnknownTransferPayloadSupplied as he, UnrecognizedFilterTypeError as Ne } from "./errors.js";
22
+ import { RegistryType as ze, awaitResult as Ge, bytes4 as ke, getDeployedContractAddress as qe } from "./utils.js";
23
+ import { PassthroughAuth as Ye } from "./Auth/PassthroughAuth.js";
24
+ import { A as He, c as Je, e as Ke, v as Qe, f as Xe, p as Ze, z as $e, l as er, M as rr, T as or, S as tr } from "./generated-BDeDiaCK.js";
25
25
  export {
26
26
  A as ActionByComponentInterface,
27
27
  b as AllowListByComponentInterface,
28
- J as AllowListIncentive,
28
+ K as AllowListIncentive,
29
29
  i as BOOST_CORE_ADDRESS,
30
30
  n as BOOST_CORE_CLAIM_FEE,
31
31
  o as BOOST_REGISTRY_ADDRESS,
32
32
  s as Boost,
33
33
  p as BoostCore,
34
- ve as BoostCoreNoIdentifierEmitted,
34
+ Ie as BoostCoreNoIdentifierEmitted,
35
35
  t as BoostRegistry,
36
- F as BudgetByComponentInterface,
37
- Ie as BudgetMustAuthorizeBoostCore,
38
- X as CGDAIncentive,
39
- W as Contract,
40
- Ce as ContractAddressRequiredError,
41
- k as Deployable,
42
- ue as DeployableAlreadyDeployedError,
43
- be as DeployableBuildParametersUnspecifiedError,
44
- xe as DeployableMissingPayloadError,
45
- j as DeployableTarget,
46
- Pe as DeployableUnknownOwnerProvidedError,
47
- Se as DeployableWagmiConfigurationRequiredError,
48
- ee as ERC20Incentive,
49
- te as ERC20VariableIncentive,
36
+ O as BudgetByComponentInterface,
37
+ Ce as BudgetMustAuthorizeBoostCore,
38
+ Z as CGDAIncentive,
39
+ Y as Contract,
40
+ ue as ContractAddressRequiredError,
41
+ q as Deployable,
42
+ be as DeployableAlreadyDeployedError,
43
+ xe as DeployableBuildParametersUnspecifiedError,
44
+ Pe as DeployableMissingPayloadError,
45
+ H as DeployableTarget,
46
+ Se as DeployableUnknownOwnerProvidedError,
47
+ Be as DeployableWagmiConfigurationRequiredError,
48
+ re as ERC20Incentive,
49
+ ae as ERC20VariableIncentive,
50
50
  f as EventAction,
51
- Be as EventActionValidationError,
52
- Re as FieldValueNotComparableError,
53
- De as FieldValueUndefinedError,
51
+ Re as EventActionValidationError,
52
+ De as FieldValueNotComparableError,
53
+ Te as FieldValueUndefinedError,
54
54
  E as FilterType,
55
- ae as IncentiveByComponentInterface,
56
- Te as IncentiveNotCloneableError,
57
- Le as InvalidComponentInterfaceError,
58
- we as InvalidNumericalCriteriaError,
59
- S as LIST_MANAGER_ROLE,
60
- V as ManagedBudget,
61
- _ as ManagedBudgetRoles,
62
- Fe as MustInitializeBudgetError,
55
+ ie as IncentiveByComponentInterface,
56
+ Le as IncentiveNotCloneableError,
57
+ we as InvalidComponentInterfaceError,
58
+ Fe as InvalidNumericalCriteriaError,
59
+ B as LIST_MANAGER_ROLE,
60
+ _ as ManagedBudget,
61
+ h as ManagedBudgetRoles,
62
+ Oe as MustInitializeBudgetError,
63
63
  Me as NoContractAddressUponReceiptError,
64
- Oe as NoEventActionStepsProvidedError,
65
- We as PassthroughAuth,
66
- pe as PointsIncentive,
64
+ Ve as NoEventActionStepsProvidedError,
65
+ x as OpenAllowList,
66
+ Ye as PassthroughAuth,
67
+ le as PointsIncentive,
67
68
  g as PrimitiveType,
68
- Ue as RegistryType,
69
+ ze as RegistryType,
69
70
  v as SignatureType,
70
- de as SignerValidator,
71
- B as SimpleAllowList,
72
- T as SimpleDenyList,
73
- Ve as TooManyEventActionStepsProvidedError,
74
- _e as UnknownTransferPayloadSupplied,
75
- he as UnrecognizedFilterTypeError,
76
- fe as ValidatorByComponentInterface,
71
+ me as SignerValidator,
72
+ R as SimpleAllowList,
73
+ L as SimpleDenyList,
74
+ _e as TooManyEventActionStepsProvidedError,
75
+ he as UnknownTransferPayloadSupplied,
76
+ Ne as UnrecognizedFilterTypeError,
77
+ Ee as ValidatorByComponentInterface,
77
78
  y as actionFromAddress,
78
- x as allowListFromAddress,
79
- je as allowListIncentiveAbi,
80
- ze as awaitResult,
81
- He as boostCoreAbi,
82
- Je as boostRegistryAbi,
79
+ P as allowListFromAddress,
80
+ He as allowListIncentiveAbi,
81
+ Ge as awaitResult,
82
+ Je as boostCoreAbi,
83
+ Ke as boostRegistryAbi,
83
84
  M as budgetFromAddress,
84
- Ge as bytes4,
85
- Ke as cgdaIncentiveAbi,
86
- Qe as erc20IncentiveAbi,
87
- ke as getDeployedContractAddress,
88
- ie as incentiveFromAddress,
89
- h as isERC1155TransferPayload,
85
+ ke as bytes4,
86
+ Qe as cgdaIncentiveAbi,
87
+ Xe as erc20IncentiveAbi,
88
+ qe as getDeployedContractAddress,
89
+ ne as incentiveFromAddress,
90
+ N as isERC1155TransferPayload,
90
91
  I as isEventActionPayloadSimple,
91
- N as isFungibleTransfer,
92
- Xe as managedBudgetAbi,
93
- Ze as passthroughAuthAbi,
94
- $e as pointsIncentiveAbi,
95
- K as prepareAllowListIncentivePayload,
92
+ U as isFungibleTransfer,
93
+ Ze as managedBudgetAbi,
94
+ $e as passthroughAuthAbi,
95
+ er as pointsIncentiveAbi,
96
+ Q as prepareAllowListIncentivePayload,
96
97
  d as prepareBoostPayload,
97
- Z as prepareCGDAIncentivePayload,
98
- re as prepareERC20IncentivePayload,
98
+ $ as prepareCGDAIncentivePayload,
99
+ oe as prepareERC20IncentivePayload,
99
100
  C as prepareEventActionPayload,
100
- U as prepareManagedBudgetPayload,
101
- le as preparePointsIncentivePayload,
102
- me as prepareSignerValidatorClaimDataPayload,
103
- Ae as prepareSignerValidatorInputParams,
104
- ye as prepareSignerValidatorPayload,
105
- R as prepareSimpleAllowListPayload,
106
- L as prepareSimpleDenyListPayload,
107
- z as prepareTransfer,
108
- er as signerValidatorAbi,
109
- rr as simpleAllowListAbi,
110
- or as simpleDenyListAbi,
111
- Ee as validatorFromAddress
101
+ z as prepareManagedBudgetPayload,
102
+ se as preparePointsIncentivePayload,
103
+ Ae as prepareSignerValidatorClaimDataPayload,
104
+ ye as prepareSignerValidatorInputParams,
105
+ ce as prepareSignerValidatorPayload,
106
+ D as prepareSimpleAllowListPayload,
107
+ w as prepareSimpleDenyListPayload,
108
+ G as prepareTransfer,
109
+ rr as signerValidatorAbi,
110
+ or as simpleAllowListAbi,
111
+ tr as simpleDenyListAbi,
112
+ ge as validatorFromAddress
112
113
  };
113
114
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boostxyz/sdk",
3
- "version": "0.0.0-alpha.10",
3
+ "version": "0.0.0-alpha.11",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "files": [
@@ -197,7 +197,8 @@
197
197
  "abitype": "1"
198
198
  },
199
199
  "scripts": {
200
- "build": "vite build && tsc --build --emitDeclarationOnly --declaration --declarationMap --force",
200
+ "build": "vite build && tsc -p ./tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
201
+ "typecheck": "tsc -p ./tsconfig.build.json --noEmit",
201
202
  "lint:ci": "npx biome ci",
202
203
  "lint": "npx biome check",
203
204
  "bench": "vitest bench",
@@ -206,6 +207,6 @@
206
207
  "dev": "vite build --watch",
207
208
  "test": "vitest dev",
208
209
  "test:ci": "CI=true vitest --coverage",
209
- "typedoc": "npx typedoc --sort required-first --sort visibility --sort kind"
210
+ "typedoc": "npx typedoc --tsconfig ./tsconfig.build.json --sort required-first --sort visibility --sort kind"
210
211
  }
211
212
  }
@@ -50,7 +50,7 @@ export function basicErc721TransferAction(
50
50
 
51
51
  export function cloneEventAction(fixtures: Fixtures, erc721: MockERC721) {
52
52
  return function cloneEventAction() {
53
- return fixtures.registry.clone(
53
+ return fixtures.registry.initialize(
54
54
  crypto.randomUUID(),
55
55
  fixtures.core.EventAction(basicErc721TransferAction(erc721)),
56
56
  );
@@ -36,7 +36,7 @@ const mintSelector = toFunctionSelector(
36
36
 
37
37
  function payableContractAction(fixtures: Fixtures, erc20: MockERC20) {
38
38
  return function payableContractAction() {
39
- return fixtures.registry.clone(
39
+ return fixtures.registry.initialize(
40
40
  crypto.randomUUID(),
41
41
  fixtures.core.ContractAction({
42
42
  chainId: BigInt(31_337),
@@ -50,7 +50,7 @@ function payableContractAction(fixtures: Fixtures, erc20: MockERC20) {
50
50
 
51
51
  function nonPayableAction(fixtures: Fixtures, erc20: MockERC20) {
52
52
  return function nonPayableAction() {
53
- return fixtures.registry.clone(
53
+ return fixtures.registry.initialize(
54
54
  crypto.randomUUID(),
55
55
  fixtures.core.ContractAction({
56
56
  chainId: BigInt(31_337),
@@ -64,7 +64,7 @@ function nonPayableAction(fixtures: Fixtures, erc20: MockERC20) {
64
64
 
65
65
  function otherAction(fixtures: Fixtures, erc20: MockERC20) {
66
66
  return function nonPayableAction() {
67
- return fixtures.registry.clone(
67
+ return fixtures.registry.initialize(
68
68
  crypto.randomUUID(),
69
69
  fixtures.core.ContractAction({
70
70
  chainId: BigInt(31_337) + 1n,
@@ -29,7 +29,7 @@ const mintSelector = toFunctionSelector('function mint(address to)');
29
29
 
30
30
  function nonPayableAction(fixtures: Fixtures, erc721: MockERC721) {
31
31
  return function nonPayableAction() {
32
- return fixtures.registry.clone(
32
+ return fixtures.registry.initialize(
33
33
  crypto.randomUUID(),
34
34
  fixtures.core.ERC721MintAction({
35
35
  chainId: BigInt(31_337),
@@ -83,7 +83,7 @@ function basicErc721MintFuncAction(
83
83
 
84
84
  function cloneEventAction(fixtures: Fixtures, erc721: MockERC721) {
85
85
  return function cloneEventAction() {
86
- return fixtures.registry.clone(
86
+ return fixtures.registry.initialize(
87
87
  crypto.randomUUID(),
88
88
  fixtures.core.EventAction(basicErc721TransferAction(erc721)),
89
89
  );
@@ -19,7 +19,7 @@ beforeAll(async () => {
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
24
  fixtures.core.SimpleAllowList({
25
25
  owner: defaultOptions.account.address,
@@ -31,7 +31,7 @@ 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
36
  fixtures.core.SimpleDenyList({
37
37
  owner: defaultOptions.account.address,
@@ -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 '../../test/accounts';
5
+ import {
6
+ type Fixtures,
7
+ defaultOptions,
8
+ deployFixtures,
9
+ } from '../../test/helpers';
10
+ import { OpenAllowList } from './OpenAllowList';
11
+
12
+ let fixtures: Fixtures;
13
+
14
+ beforeAll(async () => {
15
+ fixtures = await loadFixture(deployFixtures);
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
+ }
@@ -16,7 +16,7 @@ beforeAll(async () => {
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
21
  fixtures.core.SimpleAllowList({
22
22
  owner: defaultOptions.account.address,
@@ -16,7 +16,7 @@ beforeAll(async () => {
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
21
  fixtures.core.SimpleDenyList({
22
22
  owner: defaultOptions.account.address,
@@ -74,10 +74,9 @@ export type SimpleDenyListLog<
74
74
  * @typedef {SimpleDenyList}
75
75
  * @extends {DeployableTarget<SimpleDenyListPayload>}
76
76
  */
77
- export class SimpleDenyList extends DeployableTarget<
78
- SimpleDenyListPayload,
79
- typeof simpleDenyListAbi
80
- > {
77
+ export class SimpleDenyList<
78
+ Payload = SimpleDenyListPayload,
79
+ > extends DeployableTarget<Payload | undefined, typeof simpleDenyListAbi> {
81
80
  public override readonly abi = simpleDenyListAbi;
82
81
  /**
83
82
  * @inheritdoc
@@ -177,13 +176,11 @@ export class SimpleDenyList extends DeployableTarget<
177
176
  * @returns {GenericDeployableParams}
178
177
  */
179
178
  public override buildParameters(
180
- _payload?: SimpleDenyListPayload,
179
+ _payload?: Payload,
181
180
  _options?: DeployableOptions,
182
181
  ): GenericDeployableParams {
183
- const [payload, options] = this.validateDeploymentConfig(
184
- _payload,
185
- _options,
186
- );
182
+ const [p, options] = this.validateDeploymentConfig(_payload, _options);
183
+ const payload = p as SimpleDenyListPayload;
187
184
  if (!payload.owner || payload.owner === zeroAddress) {
188
185
  const owner = options.account
189
186
  ? options.account.address
package/src/BoostCore.ts CHANGED
@@ -34,6 +34,7 @@ import {
34
34
  import { type Action, actionFromAddress } from './Actions/Action';
35
35
  import { EventAction, type EventActionPayload } from './Actions/EventAction';
36
36
  import { type AllowList, allowListFromAddress } from './AllowLists/AllowList';
37
+ import { OpenAllowList } from './AllowLists/OpenAllowList';
37
38
  import {
38
39
  SimpleAllowList,
39
40
  type SimpleAllowListPayload,
@@ -1008,6 +1009,24 @@ export class BoostCore extends Deployable<
1008
1009
  // isBase,
1009
1010
  // );
1010
1011
  // }
1012
+ /**
1013
+ * Bound {@link OpenAllowList} constructor that reuses the same configuration as the Boost Core instance.
1014
+ *
1015
+ * @example
1016
+ * ```ts
1017
+ * const list = core.OpenAllowList('0x') // is roughly equivalent to
1018
+ * const list = new OpenAllowList({ config: core._config, account: core._account }, '0x')
1019
+ * ```
1020
+ * @param {?boolean} [isBase]
1021
+ * @returns {OpenAllowList}
1022
+ */
1023
+ OpenAllowList(isBase?: boolean) {
1024
+ return new OpenAllowList(
1025
+ { config: this._config, account: this._account },
1026
+ undefined,
1027
+ isBase,
1028
+ );
1029
+ }
1011
1030
  /**
1012
1031
  * Bound {@link SimpleAllowList} constructor that reuses the same configuration as the Boost Core instance.
1013
1032
  *
@@ -4,6 +4,7 @@ import { isAddress, parseEther, zeroAddress } from 'viem';
4
4
  import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
5
5
  import type { MockERC20 } from '../../test/MockERC20';
6
6
  import type { MockERC1155 } from '../../test/MockERC1155';
7
+ import { accounts } from '../../test/accounts';
7
8
  import {
8
9
  type Fixtures,
9
10
  defaultOptions,
@@ -15,7 +16,7 @@ import {
15
16
  fundManagedBudget,
16
17
  } from '../../test/helpers';
17
18
  import { testAccount } from '../../test/viem';
18
- import { ManagedBudget } from './ManagedBudget';
19
+ import { ManagedBudget, ManagedBudgetRoles } from './ManagedBudget';
19
20
 
20
21
  let fixtures: Fixtures,
21
22
  budget: ManagedBudget,
@@ -37,13 +38,73 @@ describe('ManagedBudget', () => {
37
38
  expect(isAddress(action.assertValidAddress())).toBe(true);
38
39
  });
39
40
 
41
+ test('can grant manager role to many users', async () => {
42
+ const budget = await loadFixture(
43
+ freshManagedBudget(defaultOptions, fixtures),
44
+ );
45
+ const one = accounts[1].account;
46
+ const two = accounts[2].account;
47
+ await budget.setAuthorized([one, two], [true, true]);
48
+ expect(await budget.hasAllRoles(one, ManagedBudgetRoles.ADMIN)).toBe(false);
49
+ expect(await budget.hasAllRoles(one, ManagedBudgetRoles.MANAGER)).toBe(
50
+ true,
51
+ );
52
+ expect(await budget.hasAllRoles(two, ManagedBudgetRoles.MANAGER)).toBe(
53
+ true,
54
+ );
55
+ });
56
+
57
+ test('can grant roles', async () => {
58
+ const budget = await loadFixture(
59
+ freshManagedBudget(defaultOptions, fixtures),
60
+ );
61
+ const admin = accounts[1].account;
62
+ const manager = accounts[2].account;
63
+ await budget.grantRoles(
64
+ [admin, manager],
65
+ [ManagedBudgetRoles.ADMIN, ManagedBudgetRoles.MANAGER],
66
+ );
67
+ expect(await budget.hasAllRoles(admin, ManagedBudgetRoles.ADMIN)).toBe(
68
+ true,
69
+ );
70
+ expect(await budget.hasAllRoles(manager, ManagedBudgetRoles.MANAGER)).toBe(
71
+ true,
72
+ );
73
+ });
74
+
75
+ test('can revoke roles', async () => {
76
+ const budget = await loadFixture(
77
+ freshManagedBudget(defaultOptions, fixtures),
78
+ );
79
+ const admin = accounts[1].account;
80
+ const manager = accounts[2].account;
81
+ await budget.grantRoles(
82
+ [admin, manager],
83
+ [ManagedBudgetRoles.ADMIN, ManagedBudgetRoles.MANAGER],
84
+ );
85
+ await budget.revokeRoles(
86
+ [admin, manager],
87
+ [ManagedBudgetRoles.ADMIN, ManagedBudgetRoles.MANAGER],
88
+ );
89
+ expect(await budget.hasAllRoles(admin, ManagedBudgetRoles.ADMIN)).toBe(
90
+ false,
91
+ );
92
+ expect(await budget.hasAllRoles(manager, ManagedBudgetRoles.MANAGER)).toBe(
93
+ false,
94
+ );
95
+ });
96
+
40
97
  test('can be owned', async () => {
41
- const budget = await loadFixture(freshBudget(defaultOptions, fixtures));
98
+ const budget = await loadFixture(
99
+ freshManagedBudget(defaultOptions, fixtures),
100
+ );
42
101
  expect(await budget.owner()).toBe(defaultOptions.account.address);
43
102
  });
44
103
 
45
104
  test('can have authorized users', async () => {
46
- const budget = await loadFixture(freshBudget(defaultOptions, fixtures));
105
+ const budget = await loadFixture(
106
+ freshManagedBudget(defaultOptions, fixtures),
107
+ );
47
108
  expect(await budget.isAuthorized(defaultOptions.account.address)).toBe(
48
109
  true,
49
110
  );
@@ -51,8 +112,10 @@ describe('ManagedBudget', () => {
51
112
  });
52
113
 
53
114
  test('can have no initial balance', async () => {
54
- const budget = await loadFixture(freshBudget(defaultOptions, fixtures));
55
- expect(await budget.available(zeroAddress)).toBe(0n);
115
+ const budget = await loadFixture(
116
+ freshManagedBudget(defaultOptions, fixtures),
117
+ );
118
+ expect(await budget.available()).toBe(0n);
56
119
  });
57
120
 
58
121
  describe('can allocate', () => {
@@ -73,7 +136,7 @@ describe('ManagedBudget', () => {
73
136
  value: parseEther('1.0'),
74
137
  },
75
138
  );
76
- expect(await budget.available(zeroAddress)).toBe(parseEther('1.0'));
139
+ expect(await budget.available()).toBe(parseEther('1.0'));
77
140
  });
78
141
 
79
142
  test('erc20', async () => {
@@ -123,7 +186,7 @@ describe('ManagedBudget', () => {
123
186
  target: defaultOptions.account.address,
124
187
  });
125
188
 
126
- expect(await budget.available(zeroAddress)).toBe(0n);
189
+ expect(await budget.available()).toBe(0n);
127
190
  });
128
191
 
129
192
  test('erc20 assets', async () => {