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

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 (100) hide show
  1. package/dist/Actions/Action.js +2 -2
  2. package/dist/Actions/EventAction.cjs +1 -1
  3. package/dist/Actions/EventAction.cjs.map +1 -1
  4. package/dist/Actions/EventAction.d.ts +115 -31
  5. package/dist/Actions/EventAction.d.ts.map +1 -1
  6. package/dist/Actions/EventAction.js +306 -122
  7. package/dist/Actions/EventAction.js.map +1 -1
  8. package/dist/AllowLists/AllowList.cjs +1 -1
  9. package/dist/AllowLists/AllowList.cjs.map +1 -1
  10. package/dist/AllowLists/AllowList.d.ts +6 -4
  11. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  12. package/dist/AllowLists/AllowList.js +45 -23
  13. package/dist/AllowLists/AllowList.js.map +1 -1
  14. package/dist/AllowLists/OpenAllowList.d.ts +240 -0
  15. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
  16. package/dist/AllowLists/SimpleAllowList.js +1 -1
  17. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  18. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  19. package/dist/AllowLists/SimpleDenyList.d.ts +2 -2
  20. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  21. package/dist/AllowLists/SimpleDenyList.js +9 -111
  22. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  23. package/dist/Auth/PassthroughAuth.js +1 -1
  24. package/dist/BoostCore.cjs +2 -2
  25. package/dist/BoostCore.cjs.map +1 -1
  26. package/dist/BoostCore.d.ts +14 -1
  27. package/dist/BoostCore.d.ts.map +1 -1
  28. package/dist/BoostCore.js +169 -151
  29. package/dist/BoostCore.js.map +1 -1
  30. package/dist/BoostRegistry.js +1 -1
  31. package/dist/Budgets/Budget.js +2 -2
  32. package/dist/Budgets/ManagedBudget.cjs +1 -1
  33. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  34. package/dist/Budgets/ManagedBudget.d.ts +29 -27
  35. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  36. package/dist/Budgets/ManagedBudget.js +78 -77
  37. package/dist/Budgets/ManagedBudget.js.map +1 -1
  38. package/dist/Budgets/SimpleBudget.d.ts +6 -6
  39. package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
  40. package/dist/Budgets/VestingBudget.d.ts +6 -6
  41. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  42. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  43. package/dist/Deployable/DeployableTarget.d.ts +1 -1
  44. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  45. package/dist/Deployable/DeployableTarget.js +1 -1
  46. package/dist/Deployable/DeployableTarget.js.map +1 -1
  47. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  48. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  49. package/dist/Incentives/AllowListIncentive.js +2 -2
  50. package/dist/Incentives/CGDAIncentive.js +1 -1
  51. package/dist/Incentives/ERC20Incentive.js +1 -1
  52. package/dist/Incentives/ERC20VariableIncentive.d.ts +5 -5
  53. package/dist/Incentives/Incentive.cjs.map +1 -1
  54. package/dist/Incentives/Incentive.js +16 -16
  55. package/dist/Incentives/Incentive.js.map +1 -1
  56. package/dist/Incentives/PointsIncentive.js +1 -1
  57. package/dist/SimpleDenyList-CqT0BMP7.cjs +2 -0
  58. package/dist/SimpleDenyList-CqT0BMP7.cjs.map +1 -0
  59. package/dist/SimpleDenyList-IJ9Ipya7.js +112 -0
  60. package/dist/SimpleDenyList-IJ9Ipya7.js.map +1 -0
  61. package/dist/Validators/SignerValidator.js +1 -1
  62. package/dist/Validators/Validator.js +2 -2
  63. package/dist/{componentInterfaces-DYkaxBda.js → componentInterfaces-Cmg8tUxq.js} +5 -5
  64. package/dist/componentInterfaces-Cmg8tUxq.js.map +1 -0
  65. package/dist/errors.cjs +1 -1
  66. package/dist/errors.cjs.map +1 -1
  67. package/dist/errors.d.ts +116 -20
  68. package/dist/errors.d.ts.map +1 -1
  69. package/dist/errors.js +106 -52
  70. package/dist/errors.js.map +1 -1
  71. package/dist/{generated-BDeDiaCK.js → generated-HGddZXHJ.js} +21 -21
  72. package/dist/{generated-BDeDiaCK.js.map → generated-HGddZXHJ.js.map} +1 -1
  73. package/dist/index.cjs +1 -1
  74. package/dist/index.js +95 -91
  75. package/package.json +11 -7
  76. package/src/Actions/Action.test.ts +9 -5
  77. package/src/Actions/ContractAction.test.ts +3 -3
  78. package/src/Actions/ERC721MintAction.test.ts +1 -1
  79. package/src/Actions/EventAction.test.ts +527 -99
  80. package/src/Actions/EventAction.ts +296 -58
  81. package/src/AllowLists/AllowList.test.ts +2 -2
  82. package/src/AllowLists/AllowList.ts +5 -3
  83. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  84. package/src/AllowLists/OpenAllowList.ts +45 -0
  85. package/src/AllowLists/SimpleAllowList.test.ts +1 -1
  86. package/src/AllowLists/SimpleDenyList.test.ts +1 -1
  87. package/src/AllowLists/SimpleDenyList.ts +6 -9
  88. package/src/BoostCore.ts +19 -0
  89. package/src/Budgets/ManagedBudget.test.ts +70 -7
  90. package/src/Budgets/ManagedBudget.ts +42 -31
  91. package/src/Budgets/SimpleBudget.test.ts +3 -3
  92. package/src/Budgets/SimpleBudget.ts +6 -6
  93. package/src/Budgets/VestingBudget.test.ts +3 -3
  94. package/src/Budgets/VestingBudget.ts +6 -6
  95. package/src/Deployable/DeployableTarget.ts +1 -1
  96. package/src/Incentives/AllowListIncentive.test.ts +1 -1
  97. package/src/Incentives/ERC20VariableIncentive.ts +5 -5
  98. package/src/Validators/SignerValidator.test.ts +1 -1
  99. package/src/errors.ts +160 -20
  100. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
@@ -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 () => {
@@ -81,22 +81,26 @@ export interface ManagedBudgetPayload {
81
81
  /**
82
82
  * List of roles to assign to the corresponding account by index.
83
83
  *
84
- * @type {bigint[]}
84
+ * @type {ManagedBudgetRoles[]}
85
85
  */
86
- roles: bigint[];
86
+ roles: ManagedBudgetRoles[];
87
87
  }
88
88
 
89
89
  /**
90
- * Enum representing available roles for use in the `ManagedBudget`.
90
+ * Enum representing available roles for use in the `ManagedBudget`.
91
91
  * `MANAGER` can disburse funds.
92
92
  * `ADMIN` can additionally manage authorized users on the budget.
93
93
  *
94
+ * @export
94
95
  * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}
96
+ * @enum {bigint}
95
97
  */
96
- export const ManagedBudgetRoles = {
97
- MANAGER: 1n,
98
- ADMIN: 2n,
99
- } as const;
98
+ export enum ManagedBudgetRoles {
99
+ //@ts-expect-error ts doesn't like bigint enum values
100
+ MANAGER = 1n,
101
+ //@ts-expect-error ts doesn't like bigint enum values
102
+ ADMIN = 2n,
103
+ }
100
104
 
101
105
  /**
102
106
  * A generic `viem.Log` event with support for `ManagedBudget` event types.
@@ -152,9 +156,11 @@ export function prepareTransfer(
152
156
  ) {
153
157
  if (isFungibleTransfer(transfer)) {
154
158
  return prepareFungibleTransfer(transfer);
155
- } else if (isERC1155TransferPayload(transfer)) {
159
+ }
160
+ if (isERC1155TransferPayload(transfer)) {
156
161
  return prepareERC1155Transfer(transfer);
157
- } else throw new UnknownTransferPayloadSupplied(transfer);
162
+ }
163
+ throw new UnknownTransferPayloadSupplied(transfer);
158
164
  }
159
165
 
160
166
  /**
@@ -441,13 +447,13 @@ export class ManagedBudget extends DeployableTarget<
441
447
  * @public
442
448
  * @async
443
449
  * @param {Address[]} addresses
444
- * @param {bigint[]} roles
450
+ * @param {ManagedBudgetRoles[]} roles
445
451
  * @param {?WriteParams<typeof managedBudgetAbi, 'grantRoles'>} [params]
446
452
  * @returns {unknown}
447
453
  */
448
454
  public async grantRoles(
449
455
  addresses: Address[],
450
- roles: bigint[],
456
+ roles: ManagedBudgetRoles[],
451
457
  params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,
452
458
  ) {
453
459
  return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));
@@ -463,13 +469,13 @@ export class ManagedBudget extends DeployableTarget<
463
469
  * @public
464
470
  * @async
465
471
  * @param {Address[]} addresses
466
- * @param {bigint[]} roles
472
+ * @param {ManagedBudgetRoles[]} roles
467
473
  * @param {?WriteParams<typeof managedBudgetAbi, 'grantRoles'>} [params]
468
474
  * @returns {unknown}
469
475
  */
470
476
  public async grantRolesRaw(
471
477
  addresses: Address[],
472
- roles: bigint[],
478
+ roles: ManagedBudgetRoles[],
473
479
  params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,
474
480
  ) {
475
481
  const { request, result } = await simulateManagedBudgetGrantRoles(
@@ -500,13 +506,13 @@ export class ManagedBudget extends DeployableTarget<
500
506
  * @public
501
507
  * @async
502
508
  * @param {Address[]} addresses
503
- * @param {bigint[]} roles
509
+ * @param {ManagedBudgetRoles[]} roles
504
510
  * @param {?WriteParams<typeof managedBudgetAbi, 'revokeRoles'>} [params]
505
511
  * @returns {unknown}
506
512
  */
507
513
  public async revokeRoles(
508
514
  addresses: Address[],
509
- roles: bigint[],
515
+ roles: ManagedBudgetRoles[],
510
516
  params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,
511
517
  ) {
512
518
  return await this.awaitResult(
@@ -523,13 +529,13 @@ export class ManagedBudget extends DeployableTarget<
523
529
  * @public
524
530
  * @async
525
531
  * @param {Address[]} addresses
526
- * @param {bigint[]} roles
532
+ * @param {ManagedBudgetRoles[]} roles
527
533
  * @param {?WriteParams<typeof managedBudgetAbi, 'revokeRoles'>} [params]
528
534
  * @returns {unknown}
529
535
  */
530
536
  public async revokeRolesRaw(
531
537
  addresses: Address[],
532
- roles: bigint[],
538
+ roles: ManagedBudgetRoles[],
533
539
  params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,
534
540
  ) {
535
541
  const { request, result } = await simulateManagedBudgetRevokeRoles(
@@ -558,7 +564,7 @@ export class ManagedBudget extends DeployableTarget<
558
564
  * @public
559
565
  * @param {Address} account
560
566
  * @param {?ReadParams<typeof managedBudgetAbi, 'rolesOf'>} [params]
561
- * @returns {Promise<Array<bigint>>}
567
+ * @returns {Promise<Array<ManagedBudgetRoles>>}
562
568
  */
563
569
  public async rolesOf(
564
570
  account: Address,
@@ -571,9 +577,14 @@ export class ManagedBudget extends DeployableTarget<
571
577
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
572
578
  ...(params as any),
573
579
  });
574
- return [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN].filter(
580
+ return (
581
+ [
582
+ ManagedBudgetRoles.MANAGER,
583
+ ManagedBudgetRoles.ADMIN,
584
+ ] as unknown as Array<bigint>
585
+ ).filter(
575
586
  (role) => (roles & role) === role,
576
- );
587
+ ) as unknown as ManagedBudgetRoles[];
577
588
  }
578
589
 
579
590
  /**
@@ -584,13 +595,13 @@ export class ManagedBudget extends DeployableTarget<
584
595
  * await budget.hasAnyRole(0xfoo, ManagedBudgetRoles.ADMIN | ManagedBudgetRoles.MANAGER)
585
596
  * @public
586
597
  * @param {Address} account
587
- * @param {bigint} roles
598
+ * @param {ManagedBudgetRoles} roles
588
599
  * @param {?ReadParams<typeof managedBudgetAbi, 'hasAnyRole'>} [params]
589
600
  * @returns {Promise<boolean>}
590
601
  */
591
602
  public hasAnyRole(
592
603
  account: Address,
593
- roles: bigint,
604
+ roles: ManagedBudgetRoles,
594
605
  params?: ReadParams<typeof managedBudgetAbi, 'hasAnyRole'>,
595
606
  ) {
596
607
  return readManagedBudgetHasAnyRole(this._config, {
@@ -611,13 +622,13 @@ export class ManagedBudget extends DeployableTarget<
611
622
  *
612
623
  * @public
613
624
  * @param {Address} account
614
- * @param {bigint} roles
625
+ * @param {ManagedBudgetRoles} roles
615
626
  * @param {?ReadParams<typeof managedBudgetAbi, 'hasAllRoles'>} [params]
616
627
  * @returns {*}
617
628
  */
618
629
  public hasAllRoles(
619
630
  account: Address,
620
- roles: bigint,
631
+ roles: ManagedBudgetRoles,
621
632
  params?: ReadParams<typeof managedBudgetAbi, 'hasAllRoles'>,
622
633
  ) {
623
634
  return readManagedBudgetHasAllRoles(this._config, {
@@ -671,13 +682,13 @@ export class ManagedBudget extends DeployableTarget<
671
682
  * If a tokenId is provided, get the total amount of ERC1155 assets allocated to the budget, including any that have been distributed
672
683
  *
673
684
  * @public
674
- * @param {Address} asset - The address of the asset
685
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"] - The address of the asset
675
686
  * @param {?(bigint | undefined)} [tokenId] - The ID of the token
676
687
  * @param {?ReadParams<typeof managedBudgetAbi, 'total'>} [params]
677
688
  * @returns {Promise<bigint>} - The total amount of assets
678
689
  */
679
690
  public total(
680
- asset: Address,
691
+ asset: Address = zeroAddress,
681
692
  tokenId?: bigint | undefined,
682
693
  params?: ReadParams<typeof managedBudgetAbi, 'total'>,
683
694
  ) {
@@ -694,13 +705,13 @@ export class ManagedBudget extends DeployableTarget<
694
705
  * If a tokenId is provided, get the amount of ERC1155 assets available for distribution from the budget
695
706
  *
696
707
  * @public
697
- * @param {Address} asset
708
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"]
698
709
  * @param {?(bigint | undefined)} [tokenId]
699
710
  * @param {?ReadParams<typeof managedBudgetAbi, 'available'>} [params]
700
711
  * @returns {Promise<bigint>} - The amount of assets available
701
712
  */
702
713
  public available(
703
- asset: Address,
714
+ asset: Address = zeroAddress,
704
715
  tokenId?: bigint | undefined,
705
716
  params?: ReadParams<typeof managedBudgetAbi, 'available'>,
706
717
  ) {
@@ -717,13 +728,13 @@ export class ManagedBudget extends DeployableTarget<
717
728
  * If a tokenId is provided, get the amount of ERC1155 assets that have been distributed from the budget
718
729
  *
719
730
  * @public
720
- * @param {Address} asset
731
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"]
721
732
  * @param {?(bigint | undefined)} [tokenId]
722
733
  * @param {?ReadParams<typeof managedBudgetAbi, 'distributed'>} [params]
723
734
  * @returns {Promise<bigint>} - The amount of assets distributed
724
735
  */
725
736
  public distributed(
726
- asset: Address,
737
+ asset: Address = zeroAddress,
727
738
  tokenId?: bigint | undefined,
728
739
  params?: ReadParams<typeof managedBudgetAbi, 'distributed'>,
729
740
  ) {
@@ -791,6 +802,6 @@ export const prepareManagedBudgetPayload = ({
791
802
  'ManagedBudgetPayload payload',
792
803
  'struct ManagedBudgetPayload { address owner; address[] authorized; uint256[] roles; }',
793
804
  ]),
794
- [{ owner, authorized, roles }],
805
+ [{ owner, authorized, roles: roles as unknown as Array<bigint> }],
795
806
  );
796
807
  };
@@ -50,7 +50,7 @@ describe.skip('SimpleBudget', () => {
50
50
 
51
51
  test('can have no initial balance', async () => {
52
52
  const budget = await loadFixture(freshBudget(defaultOptions, fixtures));
53
- expect(await budget.available(zeroAddress)).toBe(0n);
53
+ expect(await budget.available()).toBe(0n);
54
54
  });
55
55
 
56
56
  describe('can allocate', () => {
@@ -71,7 +71,7 @@ describe.skip('SimpleBudget', () => {
71
71
  value: parseEther('1.0'),
72
72
  },
73
73
  );
74
- expect(await budget.available(zeroAddress)).toBe(parseEther('1.0'));
74
+ expect(await budget.available()).toBe(parseEther('1.0'));
75
75
  });
76
76
 
77
77
  test('erc20', async () => {
@@ -121,7 +121,7 @@ describe.skip('SimpleBudget', () => {
121
121
  target: defaultOptions.account.address,
122
122
  });
123
123
 
124
- expect(await budget.available(zeroAddress)).toBe(0n);
124
+ expect(await budget.available()).toBe(0n);
125
125
  });
126
126
 
127
127
  test('erc20 assets', async () => {
@@ -441,13 +441,13 @@ export class SimpleBudget extends DeployableTarget<
441
441
  * If a tokenId is provided, get the total amount of ERC1155 assets allocated to the budget, including any that have been distributed
442
442
  *
443
443
  * @public
444
- * @param {Address} asset - The address of the asset
444
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"] - The address of the asset
445
445
  * @param {?(bigint | undefined)} [tokenId] - The ID of the token
446
446
  * @param {?ReadParams<typeof simpleBudgetAbi, 'total'>} [params]
447
447
  * @returns {Promise<bigint>} - The total amount of assets
448
448
  */
449
449
  public total(
450
- asset: Address,
450
+ asset: Address = zeroAddress,
451
451
  tokenId?: bigint | undefined,
452
452
  params?: ReadParams<typeof simpleBudgetAbi, 'total'>,
453
453
  ) {
@@ -464,13 +464,13 @@ export class SimpleBudget extends DeployableTarget<
464
464
  * If a tokenId is provided, get the amount of ERC1155 assets available for distribution from the budget
465
465
  *
466
466
  * @public
467
- * @param {Address} asset
467
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"]
468
468
  * @param {?(bigint | undefined)} [tokenId]
469
469
  * @param {?ReadParams<typeof simpleBudgetAbi, 'available'>} [params]
470
470
  * @returns {Promise<bigint>} - The amount of assets available
471
471
  */
472
472
  public available(
473
- asset: Address,
473
+ asset: Address = zeroAddress,
474
474
  tokenId?: bigint | undefined,
475
475
  params?: ReadParams<typeof simpleBudgetAbi, 'available'>,
476
476
  ) {
@@ -487,13 +487,13 @@ export class SimpleBudget extends DeployableTarget<
487
487
  * If a tokenId is provided, get the amount of ERC1155 assets that have been distributed from the budget
488
488
  *
489
489
  * @public
490
- * @param {Address} asset
490
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"]
491
491
  * @param {?(bigint | undefined)} [tokenId]
492
492
  * @param {?ReadParams<typeof simpleBudgetAbi, 'distributed'>} [params]
493
493
  * @returns {Promise<bigint>} - The amount of assets distributed
494
494
  */
495
495
  public distributed(
496
- asset: Address,
496
+ asset: Address = zeroAddress,
497
497
  tokenId?: bigint | undefined,
498
498
  params?: ReadParams<typeof simpleBudgetAbi, 'distributed'>,
499
499
  ) {
@@ -53,7 +53,7 @@ describe.skip('VestingBudget', () => {
53
53
  const budget = await loadFixture(
54
54
  freshVestingBudget(defaultOptions, fixtures),
55
55
  );
56
- expect(await budget.available(zeroAddress)).toBe(0n);
56
+ expect(await budget.available()).toBe(0n);
57
57
  });
58
58
 
59
59
  describe('can allocate', () => {
@@ -73,7 +73,7 @@ describe.skip('VestingBudget', () => {
73
73
  value: parseEther('1.0'),
74
74
  },
75
75
  );
76
- expect(await budget.available(zeroAddress)).toBe(parseEther('1.0'));
76
+ expect(await budget.available()).toBe(parseEther('1.0'));
77
77
  });
78
78
 
79
79
  test('erc20', async () => {
@@ -105,7 +105,7 @@ describe.skip('VestingBudget', () => {
105
105
  target: defaultOptions.account.address,
106
106
  });
107
107
 
108
- expect(await budget.available(zeroAddress)).toBe(0n);
108
+ expect(await budget.available()).toBe(0n);
109
109
  });
110
110
 
111
111
  test('erc20 assets', async () => {
@@ -480,12 +480,12 @@ export class VestingBudget extends DeployableTarget<
480
480
  * This is equal to the sum of the total current balance and the total distributed amount
481
481
  *
482
482
  * @public
483
- * @param {Address} asset - The address of the asset (or the zero address for native assets)
483
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"] - The address of the asset (or the zero address for native assets)
484
484
  * @param {?ReadParams<typeof vestingBudgetAbi, 'total'>} [params]
485
485
  * @returns {Promise<bigint>}
486
486
  */
487
487
  public total(
488
- asset: Address,
488
+ asset: Address = zeroAddress,
489
489
  params?: ReadParams<typeof vestingBudgetAbi, 'total'>,
490
490
  ) {
491
491
  return readVestingBudgetTotal(this._config, {
@@ -501,12 +501,12 @@ export class VestingBudget extends DeployableTarget<
501
501
  * This is equal to the total vested amount minus any already distributed
502
502
  *
503
503
  * @public
504
- * @param {Address} asset - The address of the asset (or the zero address for native assets)
504
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"] - The address of the asset (or the zero address for native assets)
505
505
  * @param {?ReadParams<typeof vestingBudgetAbi, 'available'>} [params]
506
506
  * @returns {Promise<bigint>} - The amount of assets currently available for distribution
507
507
  */
508
508
  public available(
509
- asset: Address,
509
+ asset: Address = zeroAddress,
510
510
  params?: ReadParams<typeof vestingBudgetAbi, 'available'>,
511
511
  ) {
512
512
  return readVestingBudgetAvailable(this._config, {
@@ -521,12 +521,12 @@ export class VestingBudget extends DeployableTarget<
521
521
  * Get the amount of assets that have been distributed from the budget
522
522
  *
523
523
  * @public
524
- * @param {Address} asset
524
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"]
525
525
  * @param {?ReadParams<typeof vestingBudgetAbi, 'distributed'>} [params]
526
526
  * @returns {Promise<bigint>} - The amount of assets distributed
527
527
  */
528
528
  public distributed(
529
- asset: Address,
529
+ asset: Address = zeroAddress,
530
530
  params?: ReadParams<typeof vestingBudgetAbi, 'distributed'>,
531
531
  ) {
532
532
  return readVestingBudgetDistributed(this._config, {
@@ -75,7 +75,7 @@ export class DeployableTarget<
75
75
  */
76
76
  constructor(
77
77
  options: DeployableOptions,
78
- payload: DeployablePayloadOrAddress<Payload>,
78
+ payload?: DeployablePayloadOrAddress<Payload>,
79
79
  isBase?: boolean,
80
80
  ) {
81
81
  super(options, payload);
@@ -15,7 +15,7 @@ let fixtures: Fixtures;
15
15
 
16
16
  function freshAllowList(fixtures: Fixtures) {
17
17
  return function freshAllowList() {
18
- return fixtures.registry.clone(
18
+ return fixtures.registry.initialize(
19
19
  crypto.randomUUID(),
20
20
  fixtures.core.SimpleAllowList({
21
21
  owner: defaultOptions.account.address,
@@ -56,7 +56,7 @@ export interface ERC20VariableIncentivePayload {
56
56
  */
57
57
  reward: bigint;
58
58
  /**
59
- * How many times can this incentive be claimed.
59
+ * The total spending limit of the asset that will be distributed.
60
60
  *
61
61
  * @type {bigint}
62
62
  */
@@ -79,7 +79,7 @@ export type ERC20VariableIncentiveLog<
79
79
  > = GenericLog<typeof erc20VariableIncentiveAbi, event>;
80
80
 
81
81
  /**
82
- * A simple ERC20 incentive implementation that allows claiming of tokens
82
+ * A modified ERC20 incentive implementation that allows claiming of variable token amounts with a spending limit
83
83
  *
84
84
  * @export
85
85
  * @class ERC20VariableIncentive
@@ -129,12 +129,12 @@ export class ERC20VariableIncentive extends DeployableTarget<
129
129
  }
130
130
 
131
131
  /**
132
- * The current reward
132
+ * The total amount of rewards claimed
133
133
  *
134
134
  * @public
135
135
  * @async
136
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]
137
- * @returns {Promise<bigint>} - The current reward
136
+ * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'totalClaimed'>} [params]
137
+ * @returns {Promise<bigint>}
138
138
  */
139
139
  public async totalClaimed(
140
140
  params?: ReadParams<typeof erc20VariableIncentiveAbi, 'totalClaimed'>,
@@ -16,7 +16,7 @@ function freshValidator(fixtures: Fixtures) {
16
16
  return function freshValidator() {
17
17
  // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
18
18
  const account = accounts.at(1)!.account;
19
- return fixtures.registry.clone(
19
+ return fixtures.registry.initialize(
20
20
  crypto.randomUUID(),
21
21
  fixtures.core.SignerValidator({
22
22
  signers: [defaultOptions.account.address, account],