@boostxyz/sdk 6.1.2 → 7.0.0-canary.0

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 (180) hide show
  1. package/README.md +1 -1
  2. package/dist/Actions/Action.cjs +1 -1
  3. package/dist/Actions/Action.js +4 -4
  4. package/dist/Actions/EventAction.cjs +1 -1
  5. package/dist/Actions/EventAction.cjs.map +1 -1
  6. package/dist/Actions/EventAction.d.ts +10 -0
  7. package/dist/Actions/EventAction.d.ts.map +1 -1
  8. package/dist/Actions/EventAction.js +84 -83
  9. package/dist/Actions/EventAction.js.map +1 -1
  10. package/dist/AllowLists/AllowList.cjs +1 -1
  11. package/dist/AllowLists/AllowList.js +3 -3
  12. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  13. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  14. package/dist/AllowLists/SimpleAllowList.js +14 -14
  15. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  16. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  17. package/dist/AllowLists/SimpleDenyList.js +3 -3
  18. package/dist/Auth/PassthroughAuth.cjs +1 -1
  19. package/dist/Auth/PassthroughAuth.js +1 -1
  20. package/dist/BoostCore.cjs +2 -2
  21. package/dist/BoostCore.cjs.map +1 -1
  22. package/dist/BoostCore.d.ts +1894 -267
  23. package/dist/BoostCore.d.ts.map +1 -1
  24. package/dist/BoostCore.js +808 -497
  25. package/dist/BoostCore.js.map +1 -1
  26. package/dist/BoostRegistry.cjs +1 -1
  27. package/dist/BoostRegistry.js +47 -47
  28. package/dist/Budget-B_kgJGDu.cjs +2 -0
  29. package/dist/Budget-B_kgJGDu.cjs.map +1 -0
  30. package/dist/Budget-Bvi5Qjqp.js +1124 -0
  31. package/dist/Budget-Bvi5Qjqp.js.map +1 -0
  32. package/dist/Budgets/Budget.cjs +1 -1
  33. package/dist/Budgets/Budget.d.ts +5 -4
  34. package/dist/Budgets/Budget.d.ts.map +1 -1
  35. package/dist/Budgets/Budget.js +9 -6
  36. package/dist/Budgets/ManagedBudget.cjs +1 -1
  37. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  38. package/dist/Budgets/ManagedBudget.d.ts +4 -0
  39. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  40. package/dist/Budgets/ManagedBudget.js +25 -25
  41. package/dist/Budgets/ManagedBudgetWithFees.d.ts +4 -0
  42. package/dist/Budgets/ManagedBudgetWithFees.d.ts.map +1 -1
  43. package/dist/Budgets/ManagedBudgetWithFeesV2.d.ts +4 -0
  44. package/dist/Budgets/ManagedBudgetWithFeesV2.d.ts.map +1 -1
  45. package/dist/Budgets/TransparentBudget.d.ts +944 -0
  46. package/dist/Budgets/TransparentBudget.d.ts.map +1 -0
  47. package/dist/Budgets/VestingBudget.d.ts +4 -0
  48. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  49. package/dist/Deployable/Deployable.cjs.map +1 -1
  50. package/dist/Deployable/Deployable.d.ts +1 -1
  51. package/dist/Deployable/Deployable.d.ts.map +1 -1
  52. package/dist/Deployable/Deployable.js.map +1 -1
  53. package/dist/Deployable/DeployableTarget.cjs +1 -1
  54. package/dist/Deployable/DeployableTarget.js +1 -1
  55. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  56. package/dist/Deployable/DeployableTargetWithRBAC.js +19 -19
  57. package/dist/Incentive-CLKutfnD.js +445 -0
  58. package/dist/Incentive-CLKutfnD.js.map +1 -0
  59. package/dist/Incentive-CLSVNxDz.cjs +2 -0
  60. package/dist/Incentive-CLSVNxDz.cjs.map +1 -0
  61. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  62. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  63. package/dist/Incentives/AllowListIncentive.js +9 -9
  64. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  65. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  66. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  67. package/dist/Incentives/CGDAIncentive.js +5 -5
  68. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  69. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  70. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  71. package/dist/Incentives/ERC20Incentive.js +17 -17
  72. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  73. package/dist/Incentives/ERC20PeggedIncentive.d.ts +1 -1
  74. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +2 -0
  75. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs.map +1 -0
  76. package/dist/Incentives/{ERC20PeggedVariableCriteriaIncentive.d.ts → ERC20PeggedVariableCriteriaIncentiveV2.d.ts} +39 -27
  77. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.d.ts.map +1 -0
  78. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +625 -0
  79. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js.map +1 -0
  80. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +2 -0
  81. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs.map +1 -0
  82. package/dist/Incentives/{ERC20VariableCriteriaIncentive.d.ts → ERC20VariableCriteriaIncentiveV2.d.ts} +42 -13
  83. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.d.ts.map +1 -0
  84. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +242 -0
  85. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js.map +1 -0
  86. package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
  87. package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
  88. package/dist/Incentives/ERC20VariableIncentive.d.ts +3 -3
  89. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  90. package/dist/Incentives/ERC20VariableIncentive.js +22 -22
  91. package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
  92. package/dist/Incentives/Incentive.cjs +1 -1
  93. package/dist/Incentives/Incentive.d.ts +8 -8
  94. package/dist/Incentives/Incentive.d.ts.map +1 -1
  95. package/dist/Incentives/Incentive.js +13 -12
  96. package/dist/Incentives/Incentive.js.map +1 -1
  97. package/dist/Incentives/PointsIncentive.cjs +1 -1
  98. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  99. package/dist/Incentives/PointsIncentive.js +13 -13
  100. package/dist/Incentives/PointsIncentive.js.map +1 -1
  101. package/dist/SimpleDenyList-C1C_BHkY.js +133 -0
  102. package/dist/{SimpleDenyList-BKfPoTo1.js.map → SimpleDenyList-C1C_BHkY.js.map} +1 -1
  103. package/dist/SimpleDenyList-CWthbyj7.cjs +2 -0
  104. package/dist/{SimpleDenyList-DgjVf7FK.cjs.map → SimpleDenyList-CWthbyj7.cjs.map} +1 -1
  105. package/dist/Validators/LimitedSignerValidator.cjs +1 -1
  106. package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
  107. package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
  108. package/dist/Validators/LimitedSignerValidator.js +48 -52
  109. package/dist/Validators/LimitedSignerValidator.js.map +1 -1
  110. package/dist/Validators/SignerValidator.cjs +1 -1
  111. package/dist/Validators/SignerValidator.cjs.map +1 -1
  112. package/dist/Validators/SignerValidator.js +54 -54
  113. package/dist/Validators/SignerValidator.js.map +1 -1
  114. package/dist/Validators/Validator.cjs +1 -1
  115. package/dist/Validators/Validator.js +2 -2
  116. package/dist/componentInterfaces-BVHB4Fjw.js +21 -0
  117. package/dist/componentInterfaces-BVHB4Fjw.js.map +1 -0
  118. package/dist/componentInterfaces-BqhL-meV.cjs +2 -0
  119. package/dist/componentInterfaces-BqhL-meV.cjs.map +1 -0
  120. package/dist/deployments-D9QxJGrC.cjs +2 -0
  121. package/dist/deployments-D9QxJGrC.cjs.map +1 -0
  122. package/dist/deployments-De8_J7SS.js +120 -0
  123. package/dist/{deployments-W_LUj833.js.map → deployments-De8_J7SS.js.map} +1 -1
  124. package/dist/deployments.json +63 -48
  125. package/dist/{generated-CElkFqkY.js → generated-BJfQ-EBO.js} +1268 -737
  126. package/dist/generated-BJfQ-EBO.js.map +1 -0
  127. package/dist/generated-mJJNq-xb.cjs +3 -0
  128. package/dist/generated-mJJNq-xb.cjs.map +1 -0
  129. package/dist/index.cjs +1 -1
  130. package/dist/index.d.ts +3 -2
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.js +162 -158
  133. package/dist/index.js.map +1 -1
  134. package/dist/utils.cjs.map +1 -1
  135. package/dist/utils.js.map +1 -1
  136. package/package.json +13 -7
  137. package/src/Actions/EventAction.ts +11 -0
  138. package/src/BoostCore.test.ts +14 -9
  139. package/src/BoostCore.ts +428 -26
  140. package/src/Budgets/Budget.ts +8 -1
  141. package/src/Budgets/TransparentBudget.test.ts +70 -0
  142. package/src/Budgets/TransparentBudget.ts +334 -0
  143. package/src/Deployable/Deployable.ts +1 -1
  144. package/src/Incentives/ERC20PeggedIncentive.ts +1 -1
  145. package/src/Incentives/{ERC20PeggedVariableCriteriaIncentive.test.ts → ERC20PeggedVariableCriteriaIncentiveV2.test.ts} +14 -10
  146. package/src/Incentives/{ERC20PeggedVariableCriteriaIncentive.ts → ERC20PeggedVariableCriteriaIncentiveV2.ts} +122 -100
  147. package/src/Incentives/{ERC20VariableCriteriaIncentive.test.ts → ERC20VariableCriteriaIncentiveV2.test.ts} +18 -13
  148. package/src/Incentives/{ERC20VariableCriteriaIncentive.ts → ERC20VariableCriteriaIncentiveV2.ts} +83 -24
  149. package/src/Incentives/ERC20VariableIncentive.ts +4 -2
  150. package/src/Incentives/Incentive.ts +12 -12
  151. package/src/Validators/LimitedSignerValidator.ts +1 -4
  152. package/src/index.test.ts +2 -2
  153. package/src/index.ts +3 -2
  154. package/src/utils.ts +1 -1
  155. package/dist/Budget-BjfL8dVX.cjs +0 -2
  156. package/dist/Budget-BjfL8dVX.cjs.map +0 -1
  157. package/dist/Budget-DD7IPuDx.js +0 -922
  158. package/dist/Budget-DD7IPuDx.js.map +0 -1
  159. package/dist/Incentive-V1RjH38L.js +0 -1036
  160. package/dist/Incentive-V1RjH38L.js.map +0 -1
  161. package/dist/Incentive-gVTfsnMB.cjs +0 -2
  162. package/dist/Incentive-gVTfsnMB.cjs.map +0 -1
  163. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.d.ts.map +0 -1
  164. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +0 -2
  165. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +0 -1
  166. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +0 -1
  167. package/dist/Incentives/ERC20VariableCriteriaIncentive.js +0 -207
  168. package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +0 -1
  169. package/dist/SimpleDenyList-BKfPoTo1.js +0 -133
  170. package/dist/SimpleDenyList-DgjVf7FK.cjs +0 -2
  171. package/dist/componentInterfaces-CA1UIqWL.js +0 -20
  172. package/dist/componentInterfaces-CA1UIqWL.js.map +0 -1
  173. package/dist/componentInterfaces-aBgBbB7r.cjs +0 -2
  174. package/dist/componentInterfaces-aBgBbB7r.cjs.map +0 -1
  175. package/dist/deployments-CwTZr-cK.cjs +0 -2
  176. package/dist/deployments-CwTZr-cK.cjs.map +0 -1
  177. package/dist/deployments-W_LUj833.js +0 -117
  178. package/dist/generated-BPiHi7W2.cjs +0 -3
  179. package/dist/generated-BPiHi7W2.cjs.map +0 -1
  180. package/dist/generated-CElkFqkY.js.map +0 -1
@@ -0,0 +1,334 @@
1
+ import {
2
+ readTransparentBudgetDistributed,
3
+ readTransparentBudgetOwner,
4
+ readTransparentBudgetTotal,
5
+ simulateTransparentBudgetClawbackFromTarget,
6
+ simulateTransparentBudgetDisburse,
7
+ simulateTransparentBudgetDisburseBatch,
8
+ transparentBudgetAbi,
9
+ writeTransparentBudgetClawbackFromTarget,
10
+ writeTransparentBudgetDisburse,
11
+ writeTransparentBudgetDisburseBatch,
12
+ } from '@boostxyz/evm';
13
+ import { bytecode } from '@boostxyz/evm/artifacts/contracts/budgets/TransparentBudget.sol/TransparentBudget.json';
14
+ import {
15
+ type Address,
16
+ type ContractEventName,
17
+ type Hex,
18
+ zeroAddress,
19
+ zeroHash,
20
+ } from 'viem';
21
+ import { TransparentBudget as TransparentBudgetBases } from '../../dist/deployments.json';
22
+ import type {
23
+ DeployableOptions,
24
+ GenericDeployableParams,
25
+ } from '../Deployable/Deployable';
26
+ import { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';
27
+ import type {
28
+ ERC1155TransferPayload,
29
+ FungibleTransferPayload,
30
+ } from '../transfers';
31
+ import {
32
+ type GenericLog,
33
+ type ReadParams,
34
+ RegistryType,
35
+ type WriteParams,
36
+ } from '../utils';
37
+ import { prepareTransfer } from './ManagedBudget';
38
+ export { transparentBudgetAbi };
39
+ export type { ERC1155TransferPayload, FungibleTransferPayload };
40
+
41
+ /**
42
+ * A generic `viem.Log` event with support for `TransparentBudget` event types.
43
+ *
44
+ * @export
45
+ * @typedef {TransparentBudgetLog}
46
+ * @template {ContractEventName<typeof transparentBudgetAbi>} [event=ContractEventName<
47
+ * typeof transparentBudgetAbi
48
+ * >]
49
+ */
50
+ export type TransparentBudgetLog<
51
+ event extends ContractEventName<
52
+ typeof transparentBudgetAbi
53
+ > = ContractEventName<typeof transparentBudgetAbi>,
54
+ > = GenericLog<typeof transparentBudgetAbi, event>;
55
+
56
+ /**
57
+ * A budget implementation that transfers assets to the budget on Boost creation.
58
+ * Can be used with or without [Permit2](https://github.com/Uniswap/permit2) for token approval
59
+ *
60
+ * @export
61
+ * @class TransparentBudget
62
+ * @typedef {TransparentBudget}
63
+ * @extends {DeployableTargetWithRBAC<TransparentBudgetPayload>}
64
+ */
65
+ export class TransparentBudget extends DeployableTargetWithRBAC<
66
+ never,
67
+ typeof transparentBudgetAbi
68
+ > {
69
+ /**
70
+ * @inheritdoc
71
+ *
72
+ * @public
73
+ * @readonly
74
+ * @type {*}
75
+ */
76
+ public override readonly abi = transparentBudgetAbi;
77
+ /**
78
+ * @inheritdoc
79
+ *
80
+ * @public
81
+ * @static
82
+ * @type {Record<number, Address>}
83
+ */
84
+ public static override bases: Record<number, Address> = {
85
+ 31337: import.meta.env.VITE_TRANSPARENT_BUDGET_BASE,
86
+ ...(TransparentBudgetBases as Record<number, Address>),
87
+ };
88
+ /**
89
+ * @inheritdoc
90
+ *
91
+ * @public
92
+ * @static
93
+ * @type {RegistryType}
94
+ */
95
+ public static override registryType: RegistryType = RegistryType.BUDGET;
96
+
97
+ /**
98
+ * Clawbacks assets from an incentive associated with the budget via Boost Core.
99
+ * Only the authorized users can clawback assets from an incentive.
100
+ * If the asset transfer fails, the reclamation will revert.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const [amount, address] = await budgets.budget.clawbackFromTarget(
105
+ * core.assertValidAddress(),
106
+ * erc20Incentive.buildClawbackData(1n),
107
+ * boost.id,
108
+ * incentiveId,
109
+ * );
110
+ * ```
111
+ * @public
112
+ * @async
113
+ * @param {Address} target - The address of a contract implementing clawback, typically `BoostCore`
114
+ * @param {Hex} data - The encoded data payload for the clawback, can be acquired with `incentive.buildClawbackData`
115
+ * @param {bigint | number} boostId - The ID of the boost
116
+ * @param {bigint | number} incentiveId - The ID of the incentive
117
+ * @param {?WriteParams} [params] - Optional write parameters
118
+ * @returns {Promise<[bigint, Address]>} - Returns a tuple of amount reclaimed and the address reclaimed from
119
+ */
120
+ public async clawbackFromTarget(
121
+ target: Address,
122
+ data: Hex,
123
+ boostId: bigint | number,
124
+ incentiveId: bigint | number,
125
+ params?: WriteParams,
126
+ ) {
127
+ return await this.awaitResult(
128
+ this.clawbackFromTargetRaw(target, data, boostId, incentiveId, params),
129
+ );
130
+ }
131
+
132
+ /**
133
+ * Clawbacks assets from an incentive associated with the budget via Boost Core.
134
+ * Only the authorized users can clawback assets from an incentive.
135
+ * If the asset transfer fails, the reclamation will revert.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const { hash, result: [ amount, address ] } = await budgets.budget.clawbackFromTargetRaw(
140
+ * core.assertValidAddress(),
141
+ * erc20Incentive.buildClawbackData(1n),
142
+ * boost.id,
143
+ * incentiveId,
144
+ * );
145
+ * ```
146
+ * @public
147
+ * @async
148
+ * @param {Address} target - The address of a contract implementing clawback, typically `BoostCore`
149
+ * @param {Hex} data - The encoded data payload for the clawback, can be acquired with `incentive.buildClawbackData`
150
+ * @param {bigint | number} boostId - The ID of the boost
151
+ * @param {bigint | number} incentiveId - The ID of the incentive
152
+ * @param {?WriteParams} [params] - Optional write parameters
153
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns transaction hash and simulated result
154
+ */
155
+ public async clawbackFromTargetRaw(
156
+ target: Address,
157
+ data: Hex,
158
+ boostId: bigint | number,
159
+ incentiveId: bigint | number,
160
+ params?: WriteParams,
161
+ ) {
162
+ const { request, result } =
163
+ await simulateTransparentBudgetClawbackFromTarget(this._config, {
164
+ address: this.assertValidAddress(),
165
+ args: [target, data, BigInt(boostId), BigInt(incentiveId)],
166
+ ...this.optionallyAttachAccount(),
167
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
168
+ ...(params as any),
169
+ });
170
+ const hash = await writeTransparentBudgetClawbackFromTarget(
171
+ this._config,
172
+ request,
173
+ );
174
+ return { hash, result };
175
+ }
176
+
177
+ /**
178
+ * Disburses assets from the budget to a single recipient
179
+ * If the asset transfer fails, the disbursement will revert
180
+ *
181
+ * @public
182
+ * @async
183
+ * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
184
+ * @param {?WriteParams} [params]
185
+ * @returns {Promise<boolean>} - True if the disbursement was successful
186
+ */
187
+ public async disburse(
188
+ transfer: FungibleTransferPayload | ERC1155TransferPayload,
189
+ params?: WriteParams,
190
+ ) {
191
+ return await this.awaitResult(this.disburseRaw(transfer, params));
192
+ }
193
+
194
+ /**
195
+ * Disburses assets from the budget to a single recipient
196
+ * If the asset transfer fails, the disbursement will revert
197
+ *
198
+ * @public
199
+ * @async
200
+ * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
201
+ * @param {?WriteParams} [params]
202
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the disbursement was successful
203
+ */
204
+ public async disburseRaw(
205
+ transfer: FungibleTransferPayload | ERC1155TransferPayload,
206
+ params?: WriteParams,
207
+ ) {
208
+ const { request, result } = await simulateTransparentBudgetDisburse(
209
+ this._config,
210
+ {
211
+ address: this.assertValidAddress(),
212
+ args: [prepareTransfer(transfer)],
213
+ ...this.optionallyAttachAccount(),
214
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
215
+ ...(params as any),
216
+ },
217
+ );
218
+ const hash = await writeTransparentBudgetDisburse(this._config, request);
219
+ return { hash, result };
220
+ }
221
+
222
+ /**
223
+ * Disburses assets from the budget to multiple recipients
224
+ *
225
+ * @public
226
+ * @async
227
+ * @param {Array<FungibleTransferPayload | ERC1155TransferPayload>} transfers
228
+ * @param {?WriteParams} [params]
229
+ * @returns {Promise<boolean>} - True if all disbursements were successful
230
+ */
231
+ public async disburseBatch(
232
+ transfers: Array<FungibleTransferPayload | ERC1155TransferPayload>,
233
+ params?: WriteParams,
234
+ ) {
235
+ return await this.awaitResult(this.disburseBatchRaw(transfers, params));
236
+ }
237
+
238
+ /**
239
+ * Disburses assets from the budget to multiple recipients
240
+ *
241
+ * @public
242
+ * @async
243
+ * @param {Array<FungibleTransferPayload | ERC1155TransferPayload>} transfers
244
+ * @param {?WriteParams} [params]
245
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if all disbursements were successful
246
+ */
247
+ public async disburseBatchRaw(
248
+ transfers: Array<FungibleTransferPayload | ERC1155TransferPayload>,
249
+ params?: WriteParams,
250
+ ) {
251
+ const { request, result } = await simulateTransparentBudgetDisburseBatch(
252
+ this._config,
253
+ {
254
+ address: this.assertValidAddress(),
255
+ args: [transfers.map(prepareTransfer)],
256
+ ...this.optionallyAttachAccount(),
257
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
258
+ ...(params as any),
259
+ },
260
+ );
261
+ const hash = await writeTransparentBudgetDisburseBatch(
262
+ this._config,
263
+ request,
264
+ );
265
+ return { hash, result };
266
+ }
267
+
268
+ /**
269
+ * Get the total amount of assets allocated to the budget, including any that have been distributed
270
+ * If a tokenId is provided, get the total amount of ERC1155 assets allocated to the budget, including any that have been distributed
271
+ *
272
+ * @public
273
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"] - The address of the asset
274
+ * @param {?(bigint | undefined)} [tokenId] - The ID of the token
275
+ * @param {?ReadParams} [params]
276
+ * @returns {Promise<bigint>} - The total amount of assets
277
+ */
278
+ public total(
279
+ asset: Address = zeroAddress,
280
+ tokenId?: bigint | undefined,
281
+ params?: ReadParams,
282
+ ) {
283
+ return readTransparentBudgetTotal(this._config, {
284
+ address: this.assertValidAddress(),
285
+ args: tokenId ? [asset, tokenId] : [asset],
286
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
287
+ ...(params as any),
288
+ });
289
+ }
290
+
291
+ /**
292
+ * Get the amount of assets that have been distributed from the budget.
293
+ * If a tokenId is provided, get the amount of ERC1155 assets that have been distributed from the budget
294
+ *
295
+ * @public
296
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"]
297
+ * @param {?(bigint | undefined)} [tokenId]
298
+ * @param {?ReadParams} [params]
299
+ * @returns {Promise<bigint>} - The amount of assets distributed
300
+ */
301
+ public distributed(
302
+ asset: Address = zeroAddress,
303
+ tokenId?: bigint | undefined,
304
+ params?: ReadParams,
305
+ ) {
306
+ return readTransparentBudgetDistributed(this._config, {
307
+ address: this.assertValidAddress(),
308
+ args: tokenId ? [asset, tokenId] : [asset],
309
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
310
+ ...(params as any),
311
+ });
312
+ }
313
+
314
+ /**
315
+ * @inheritdoc
316
+ *
317
+ * @public
318
+ * @param {?TransparentBudgetPayload} [_payload]
319
+ * @param {?DeployableOptions} [_options]
320
+ * @returns {GenericDeployableParams}
321
+ */
322
+ public override buildParameters(
323
+ _payload?: never,
324
+ _options?: DeployableOptions,
325
+ ): GenericDeployableParams {
326
+ const [_, options] = this.validateDeploymentConfig({}, _options);
327
+ return {
328
+ abi: transparentBudgetAbi,
329
+ bytecode: bytecode as Hex,
330
+ args: [zeroHash],
331
+ ...this.optionallyAttachAccount(options.account),
332
+ };
333
+ }
334
+ }
@@ -27,7 +27,7 @@ export type GenericDeployableParams = Omit<
27
27
  Parameters<typeof deployContract>[1],
28
28
  'args' | 'account'
29
29
  > & {
30
- args: [Hex, ...Array<Hex>];
30
+ args: [Hex, ...Array<Hex>] | [];
31
31
  account?: Account;
32
32
  };
33
33
 
@@ -503,7 +503,7 @@ export class ERC20PeggedIncentive extends DeployableTarget<
503
503
  *
504
504
  * @public
505
505
  * @param {Hex} claimData
506
- * @returns {BigInt} Returns the reward amount from a claim data payload
506
+ * @returns {bigint} Returns the reward amount from a claim data payload
507
507
  */
508
508
  public decodeClaimData(claimData: Hex) {
509
509
  const boostClaimData = decodeAbiParameters(
@@ -23,15 +23,15 @@ import {
23
23
  zeroHash,
24
24
  } from "viem";
25
25
  import { beforeAll, beforeEach, describe, expect, test } from "vitest";
26
- import { SignatureType } from "../Actions/EventAction";
26
+ import { SignatureType, ValueType } from "../Actions/EventAction";
27
27
  import type { Boost } from "../Boost";
28
28
  import {
29
- type ERC20PeggedVariableCriteriaIncentive,
30
- } from "./ERC20PeggedVariableCriteriaIncentive";
29
+ type ERC20PeggedVariableCriteriaIncentiveV2,
30
+ } from "./ERC20PeggedVariableCriteriaIncentiveV2";
31
31
  import {
32
32
  type IncentiveCriteria,
33
33
  gasRebateIncentiveCriteria,
34
- } from "./ERC20VariableCriteriaIncentive";
34
+ } from "./ERC20VariableCriteriaIncentiveV2";
35
35
  import { allKnownSignatures } from "@boostxyz/test/allKnownSignatures";
36
36
  import { readMockErc20BalanceOf } from "@boostxyz/evm";
37
37
 
@@ -49,6 +49,7 @@ export function basicErc721TransferScalarCriteria(
49
49
  signature: funcSelectors["transferFrom(address,address,uint256)"] as Hex, // Function selector for mint
50
50
  fieldIndex: 2, // Field where the scalar value resides
51
51
  targetContract: erc721.assertValidAddress(),
52
+ valueType: ValueType.WAD,
52
53
  };
53
54
  }
54
55
 
@@ -68,13 +69,14 @@ export function basicErc721MintScalarCriteria(
68
69
  ] as Hex, // Function selector for mint
69
70
  fieldIndex: 2, // Field where the scalar value resides
70
71
  targetContract: erc721.assertValidAddress(),
72
+ valueType: ValueType.WAD,
71
73
  };
72
74
  }
73
75
 
74
76
  let fixtures: Fixtures,
75
77
  erc20: MockERC20,
76
78
  erc721: MockERC721,
77
- erc20PeggedVariableCriteriaIncentive: ERC20PeggedVariableCriteriaIncentive,
79
+ erc20PeggedVariableCriteriaIncentive: ERC20PeggedVariableCriteriaIncentiveV2,
78
80
  budgets: BudgetFixtures,
79
81
  boost: Boost;
80
82
 
@@ -87,7 +89,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
87
89
  budgets = await loadFixture(fundBudget(defaultOptions, fixtures));
88
90
  erc20 = await loadFixture(fundErc20(defaultOptions));
89
91
  erc721 = await loadFixture(fundErc721(defaultOptions));
90
- erc20PeggedVariableCriteriaIncentive = fixtures.core.ERC20PeggedVariableCriteriaIncentive({
92
+ erc20PeggedVariableCriteriaIncentive = fixtures.core.ERC20PeggedVariableCriteriaIncentiveV2({
91
93
  asset: budgets.erc20.assertValidAddress(),
92
94
  reward: parseEther("1"),
93
95
  limit: parseEther("10"),
@@ -146,7 +148,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
146
148
 
147
149
  describe("getIncentiveCriteria", () => {
148
150
  test("should fetch incentive criteria successfully", async () => {
149
- const incentive = boost.incentives[0] as ERC20PeggedVariableCriteriaIncentive;
151
+ const incentive = boost.incentives[0] as ERC20PeggedVariableCriteriaIncentiveV2;
150
152
  const criteria = await incentive.getIncentiveCriteria();
151
153
  expect(criteria).toMatchObject({
152
154
  criteriaType: SignatureType.FUNC,
@@ -224,7 +226,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
224
226
  // Ensure that the gasRebateIncentiveCriteria returns the correct structure
225
227
  const gasRebateCriteria = gasRebateIncentiveCriteria();
226
228
 
227
- erc20PeggedVariableCriteriaIncentive = fixtures.core.ERC20PeggedVariableCriteriaIncentive({
229
+ erc20PeggedVariableCriteriaIncentive = fixtures.core.ERC20PeggedVariableCriteriaIncentiveV2({
228
230
  asset: budgets.erc20.assertValidAddress(),
229
231
  reward: 1n,
230
232
  limit: 1n,
@@ -239,6 +241,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
239
241
  signature: zeroHash,
240
242
  fieldIndex: 255,
241
243
  targetContract: zeroAddress,
244
+ valueType: ValueType.WAD,
242
245
  });
243
246
 
244
247
  boost = await freshBoost(fixtures, {
@@ -248,12 +251,13 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
248
251
 
249
252
  // Validate that the deployed incentive has the correct criteria set up
250
253
  const deployedIncentive = (await boost
251
- .incentives[0]) as ERC20PeggedVariableCriteriaIncentive;
254
+ .incentives[0]) as ERC20PeggedVariableCriteriaIncentiveV2;
252
255
  const deployedCriteria = await deployedIncentive.getIncentiveCriteria();
253
256
  expect(deployedCriteria.criteriaType).toBe(SignatureType.EVENT);
254
257
  expect(deployedCriteria.signature).toBe(zeroHash);
255
258
  expect(deployedCriteria.fieldIndex).toBe(255);
256
259
  expect(deployedCriteria.targetContract).toBe(zeroAddress);
260
+ expect(deployedCriteria.valueType).toBe(ValueType.WAD);
257
261
  });
258
262
 
259
263
  test("should throw NoMatchingLogsError for event criteria with no matching logs", async () => {
@@ -290,7 +294,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
290
294
 
291
295
  test("can properly encode a uint256", () => {
292
296
  //@ts-ignore
293
- const incentive = fixtures.core.ERC20VariableCriteriaIncentive();
297
+ const incentive = fixtures.core.ERC20VariableCriteriaIncentiveV2();
294
298
  expect(incentive.buildClawbackData(1n)).toBe(
295
299
  "0x0000000000000000000000000000000000000000000000000000000000000001",
296
300
  );