@boostxyz/sdk 8.0.0-canary.2 → 8.0.0-canary.4

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 (170) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +2 -2
  3. package/dist/Actions/EventAction.cjs +1 -1
  4. package/dist/Actions/EventAction.cjs.map +1 -1
  5. package/dist/Actions/EventAction.js +46 -46
  6. package/dist/Actions/EventAction.js.map +1 -1
  7. package/dist/{AllowList-DQf-8HQC.js → AllowList-CTRuUBCQ.js} +41 -41
  8. package/dist/{AllowList-DQf-8HQC.js.map → AllowList-CTRuUBCQ.js.map} +1 -1
  9. package/dist/{AllowList-DaX239DR.cjs → AllowList-GEmUfOR1.cjs} +2 -2
  10. package/dist/{AllowList-DaX239DR.cjs.map → AllowList-GEmUfOR1.cjs.map} +1 -1
  11. package/dist/AllowLists/AllowList.cjs +1 -1
  12. package/dist/AllowLists/AllowList.js +4 -4
  13. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  14. package/dist/AllowLists/SimpleAllowList.js +7 -7
  15. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  16. package/dist/AllowLists/SimpleDenyList.js +3 -3
  17. package/dist/Auth/PassthroughAuth.cjs +1 -1
  18. package/dist/Auth/PassthroughAuth.js +2 -2
  19. package/dist/BoostCore.cjs +2 -2
  20. package/dist/BoostCore.cjs.map +1 -1
  21. package/dist/BoostCore.d.ts +137 -2
  22. package/dist/BoostCore.d.ts.map +1 -1
  23. package/dist/BoostCore.js +336 -206
  24. package/dist/BoostCore.js.map +1 -1
  25. package/dist/BoostRegistry.cjs +1 -1
  26. package/dist/BoostRegistry.js +21 -21
  27. package/dist/{Budget-LnAQ_Slw.js → Budget-BH0s7Bxu.js} +52 -52
  28. package/dist/{Budget-LnAQ_Slw.js.map → Budget-BH0s7Bxu.js.map} +1 -1
  29. package/dist/{Budget-WIB8IJoM.cjs → Budget-CwNhsa3m.cjs} +2 -2
  30. package/dist/{Budget-WIB8IJoM.cjs.map → Budget-CwNhsa3m.cjs.map} +1 -1
  31. package/dist/Budgets/Budget.cjs +1 -1
  32. package/dist/Budgets/Budget.js +3 -3
  33. package/dist/Budgets/ManagedBudget.cjs +1 -1
  34. package/dist/Budgets/ManagedBudget.js +26 -26
  35. package/dist/Deployable/DeployableTarget.cjs +1 -1
  36. package/dist/Deployable/DeployableTarget.js +1 -1
  37. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  38. package/dist/Deployable/DeployableTargetWithRBAC.js +17 -17
  39. package/dist/{Incentive-gT7z-4v3.cjs → Incentive-B2ZBE5LU.cjs} +2 -2
  40. package/dist/{Incentive-gT7z-4v3.cjs.map → Incentive-B2ZBE5LU.cjs.map} +1 -1
  41. package/dist/{Incentive-D_IBex5V.js → Incentive-BCSV7OtF.js} +41 -41
  42. package/dist/{Incentive-D_IBex5V.js.map → Incentive-BCSV7OtF.js.map} +1 -1
  43. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  44. package/dist/Incentives/AllowListIncentive.js +17 -17
  45. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  46. package/dist/Incentives/CGDAIncentive.js +14 -14
  47. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  48. package/dist/Incentives/ERC20Incentive.js +13 -13
  49. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs +1 -1
  50. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js +71 -71
  51. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +1 -1
  52. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs.map +1 -1
  53. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +36 -36
  54. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js.map +1 -1
  55. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
  56. package/dist/Incentives/ERC20VariableCriteriaIncentive.js +9 -9
  57. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +1 -1
  58. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs.map +1 -1
  59. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +13 -13
  60. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js.map +1 -1
  61. package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
  62. package/dist/Incentives/ERC20VariableIncentive.js +8 -8
  63. package/dist/Incentives/Incentive.cjs +1 -1
  64. package/dist/Incentives/Incentive.js +3 -3
  65. package/dist/Incentives/PointsIncentive.cjs +1 -1
  66. package/dist/Incentives/PointsIncentive.js +28 -28
  67. package/dist/{SimpleDenyList-D5AoBdVi.cjs → SimpleDenyList-6_sxnZB0.cjs} +2 -2
  68. package/dist/{SimpleDenyList-D5AoBdVi.cjs.map → SimpleDenyList-6_sxnZB0.cjs.map} +1 -1
  69. package/dist/{SimpleDenyList-CtdXM49y.js → SimpleDenyList-CrjjFnn5.js} +17 -17
  70. package/dist/{SimpleDenyList-CtdXM49y.js.map → SimpleDenyList-CrjjFnn5.js.map} +1 -1
  71. package/dist/Validators/LimitedSignerValidator.cjs +1 -1
  72. package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
  73. package/dist/Validators/LimitedSignerValidator.d.ts +9 -9
  74. package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
  75. package/dist/Validators/LimitedSignerValidator.js +19 -19
  76. package/dist/Validators/LimitedSignerValidator.js.map +1 -1
  77. package/dist/Validators/LimitedSignerValidatorV2.cjs +2 -0
  78. package/dist/Validators/LimitedSignerValidatorV2.cjs.map +1 -0
  79. package/dist/Validators/LimitedSignerValidatorV2.d.ts +842 -0
  80. package/dist/Validators/LimitedSignerValidatorV2.d.ts.map +1 -0
  81. package/dist/Validators/LimitedSignerValidatorV2.js +301 -0
  82. package/dist/Validators/LimitedSignerValidatorV2.js.map +1 -0
  83. package/dist/Validators/PayableLimitedSignerValidator.cjs +2 -0
  84. package/dist/Validators/PayableLimitedSignerValidator.cjs.map +1 -0
  85. package/dist/Validators/PayableLimitedSignerValidator.d.ts.map +1 -1
  86. package/dist/{Validator-BEUqV28V.js → Validators/PayableLimitedSignerValidator.js} +56 -102
  87. package/dist/Validators/PayableLimitedSignerValidator.js.map +1 -0
  88. package/dist/Validators/PayableLimitedSignerValidatorV2.cjs +2 -0
  89. package/dist/Validators/PayableLimitedSignerValidatorV2.cjs.map +1 -0
  90. package/dist/Validators/PayableLimitedSignerValidatorV2.d.ts +855 -0
  91. package/dist/Validators/PayableLimitedSignerValidatorV2.d.ts.map +1 -0
  92. package/dist/Validators/PayableLimitedSignerValidatorV2.js +372 -0
  93. package/dist/Validators/PayableLimitedSignerValidatorV2.js.map +1 -0
  94. package/dist/Validators/SignerValidator.cjs +1 -1
  95. package/dist/Validators/SignerValidator.cjs.map +1 -1
  96. package/dist/Validators/SignerValidator.d.ts +4 -2
  97. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  98. package/dist/Validators/SignerValidator.js +12 -12
  99. package/dist/Validators/SignerValidator.js.map +1 -1
  100. package/dist/Validators/SignerValidatorV2.cjs +2 -0
  101. package/dist/Validators/SignerValidatorV2.cjs.map +1 -0
  102. package/dist/Validators/SignerValidatorV2.d.ts +728 -0
  103. package/dist/Validators/SignerValidatorV2.d.ts.map +1 -0
  104. package/dist/Validators/SignerValidatorV2.js +299 -0
  105. package/dist/Validators/SignerValidatorV2.js.map +1 -0
  106. package/dist/Validators/Validator.cjs +1 -1
  107. package/dist/Validators/Validator.cjs.map +1 -1
  108. package/dist/Validators/Validator.d.ts +19 -4
  109. package/dist/Validators/Validator.d.ts.map +1 -1
  110. package/dist/Validators/Validator.js +79 -14
  111. package/dist/Validators/Validator.js.map +1 -1
  112. package/dist/componentInterfaces-43ygGrVO.js +28 -0
  113. package/dist/componentInterfaces-43ygGrVO.js.map +1 -0
  114. package/dist/componentInterfaces-JU4NBkEc.cjs +2 -0
  115. package/dist/componentInterfaces-JU4NBkEc.cjs.map +1 -0
  116. package/dist/{deployments-Dw5Suk_D.js → deployments-COm00j8v.js} +48 -39
  117. package/dist/{deployments-Dw5Suk_D.js.map → deployments-COm00j8v.js.map} +1 -1
  118. package/dist/deployments-uLDgrxCp.cjs +2 -0
  119. package/dist/deployments-uLDgrxCp.cjs.map +1 -0
  120. package/dist/deployments.json +30 -21
  121. package/dist/generated-CkZm1EVH.cjs +3 -0
  122. package/dist/generated-CkZm1EVH.cjs.map +1 -0
  123. package/dist/{generated-krkFnwbV.js → generated-DRbljODL.js} +2314 -1284
  124. package/dist/generated-DRbljODL.js.map +1 -0
  125. package/dist/index.cjs +1 -1
  126. package/dist/index.d.ts +3 -0
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +185 -165
  129. package/dist/index.js.map +1 -1
  130. package/package.json +25 -1
  131. package/src/Actions/EventAction.ts +1 -1
  132. package/src/BoostCore.test.ts +77 -11
  133. package/src/BoostCore.ts +165 -4
  134. package/src/Budgets/ManagedBudgetWithFees.test.ts +14 -14
  135. package/src/Budgets/ManagedBudgetWithFeesV2.test.ts +3 -3
  136. package/src/Incentives/AllowListIncentive.test.ts +5 -5
  137. package/src/Incentives/CGDAIncentive.test.ts +6 -6
  138. package/src/Incentives/ERC1155Incentive.test.ts +2 -2
  139. package/src/Incentives/ERC20Incentive.test.ts +6 -6
  140. package/src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.test.ts +5 -5
  141. package/src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.ts +1 -1
  142. package/src/Incentives/ERC20VariableCriteriaIncentiveV2.test.ts +5 -5
  143. package/src/Incentives/ERC20VariableCriteriaIncentiveV2.ts +1 -1
  144. package/src/Incentives/ERC20VariableIncentive.test.ts +7 -8
  145. package/src/Incentives/PointsIncentive.test.ts +5 -5
  146. package/src/Validators/LimitedSignerValidator.test.ts +1 -1
  147. package/src/Validators/LimitedSignerValidator.ts +9 -10
  148. package/src/Validators/LimitedSignerValidatorV2.test.ts +231 -0
  149. package/src/Validators/LimitedSignerValidatorV2.ts +707 -0
  150. package/src/Validators/PayableLimitedSignerValidator.test.ts +1 -1
  151. package/src/Validators/PayableLimitedSignerValidator.ts +0 -1
  152. package/src/Validators/PayableLimitedSignerValidatorV2.test.ts +202 -0
  153. package/src/Validators/PayableLimitedSignerValidatorV2.ts +688 -0
  154. package/src/Validators/SignerValidator.ts +4 -2
  155. package/src/Validators/SignerValidatorV2.test.ts +163 -0
  156. package/src/Validators/SignerValidatorV2.ts +635 -0
  157. package/src/Validators/Validator.ts +45 -2
  158. package/src/index.ts +3 -0
  159. package/dist/Validator-BEUqV28V.js.map +0 -1
  160. package/dist/Validator-FxcxYKhR.cjs +0 -2
  161. package/dist/Validator-FxcxYKhR.cjs.map +0 -1
  162. package/dist/componentInterfaces-BZ3fSNkT.cjs +0 -2
  163. package/dist/componentInterfaces-BZ3fSNkT.cjs.map +0 -1
  164. package/dist/componentInterfaces-D2s6AXlV.js +0 -25
  165. package/dist/componentInterfaces-D2s6AXlV.js.map +0 -1
  166. package/dist/deployments-DimWVnA4.cjs +0 -2
  167. package/dist/deployments-DimWVnA4.cjs.map +0 -1
  168. package/dist/generated-Cf82M-QP.cjs +0 -3
  169. package/dist/generated-Cf82M-QP.cjs.map +0 -1
  170. package/dist/generated-krkFnwbV.js.map +0 -1
@@ -5,7 +5,7 @@ import {
5
5
  type Fixtures,
6
6
  defaultOptions,
7
7
  deployFixtures,
8
- freshBoost,
8
+ freshBoostWithV1Validator,
9
9
  fundBudget,
10
10
  } from "@boostxyz/test/helpers";
11
11
  import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
@@ -56,7 +56,7 @@ describe("ERC20Incentive", () => {
56
56
  limit: 1n,
57
57
  manager: budgets.budget.assertValidAddress(),
58
58
  });
59
- const boost = await freshBoost(fixtures, {
59
+ const boost = await freshBoostWithV1Validator(fixtures, {
60
60
  budget: budgets.budget,
61
61
  incentives: [erc20Incentive],
62
62
  });
@@ -98,7 +98,7 @@ describe("ERC20Incentive", () => {
98
98
  limit: 1n,
99
99
  manager: budgets.budget.assertValidAddress(),
100
100
  });
101
- const boost = await freshBoost(fixtures, {
101
+ const boost = await freshBoostWithV1Validator(fixtures, {
102
102
  budget: budgets.budget,
103
103
  incentives: [erc20Incentive],
104
104
  });
@@ -140,7 +140,7 @@ describe("ERC20Incentive", () => {
140
140
  limit: 1n,
141
141
  manager: budgets.budget.assertValidAddress(),
142
142
  });
143
- const boost = await freshBoost(fixtures, {
143
+ const boost = await freshBoostWithV1Validator(fixtures, {
144
144
  budget: budgets.budget,
145
145
  incentives: [erc20Incentive],
146
146
  });
@@ -191,7 +191,7 @@ describe("ERC20Incentive", () => {
191
191
  limit: 10n,
192
192
  manager: budgets.budget.assertValidAddress(),
193
193
  });
194
- const boost = await freshBoost(fixtures, {
194
+ const boost = await freshBoostWithV1Validator(fixtures, {
195
195
  budget: budgets.budget,
196
196
  incentives: [erc20Incentive],
197
197
  });
@@ -217,7 +217,7 @@ describe("ERC20Incentive", () => {
217
217
  limit: 1n,
218
218
  manager: budgets.budget.assertValidAddress(),
219
219
  });
220
- const boost = await freshBoost(fixtures, {
220
+ const boost = await freshBoostWithV1Validator(fixtures, {
221
221
  budget: budgets.budget,
222
222
  incentives: [erc20Incentive],
223
223
  });
@@ -8,7 +8,7 @@ import {
8
8
  type Fixtures,
9
9
  defaultOptions,
10
10
  deployFixtures,
11
- freshBoost,
11
+ freshBoostWithV1Validator,
12
12
  fundBudget,
13
13
  fundErc20,
14
14
  fundErc721,
@@ -98,7 +98,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
98
98
  peg: erc20.assertValidAddress(),
99
99
  });
100
100
 
101
- boost = await freshBoost(fixtures, {
101
+ boost = await freshBoostWithV1Validator(fixtures, {
102
102
  budget: budgets.budget,
103
103
  incentives: [erc20PeggedVariableCriteriaIncentive],
104
104
  });
@@ -203,7 +203,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
203
203
  });
204
204
 
205
205
  test("should return a valid scalar for event-based criteria", async () => {
206
- boost = await freshBoost(fixtures, {
206
+ boost = await freshBoostWithV1Validator(fixtures, {
207
207
  budget: budgets.budget,
208
208
  incentives: [erc20PeggedVariableCriteriaIncentive],
209
209
  });
@@ -244,7 +244,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
244
244
  valueType: ValueType.WAD,
245
245
  });
246
246
 
247
- boost = await freshBoost(fixtures, {
247
+ boost = await freshBoostWithV1Validator(fixtures, {
248
248
  budget: budgets.budget,
249
249
  incentives: [erc20PeggedVariableCriteriaIncentive],
250
250
  });
@@ -302,7 +302,7 @@ describe("ERC20PeggedVariableCriteriaIncentive", () => {
302
302
 
303
303
  test("can clawback via a budget", async () => {
304
304
  // rebase this
305
- const boost = await freshBoost(fixtures, {
305
+ const boost = await freshBoostWithV1Validator(fixtures, {
306
306
  budget: budgets.budget,
307
307
  incentives: [erc20PeggedVariableCriteriaIncentive],
308
308
  });
@@ -877,7 +877,7 @@ export function prepareERC20PeggedVariableCriteriaIncentiveV2Payload({
877
877
  components: [
878
878
  { type: 'uint8', name: 'criteriaType' },
879
879
  { type: 'bytes32', name: 'signature' },
880
- { type: 'uint8', name: 'fieldIndex' },
880
+ { type: 'uint32', name: 'fieldIndex' },
881
881
  { type: 'address', name: 'targetContract' },
882
882
  { type: 'uint8', name: 'valueType' },
883
883
  ],
@@ -8,7 +8,7 @@ import {
8
8
  type Fixtures,
9
9
  defaultOptions,
10
10
  deployFixtures,
11
- freshBoost,
11
+ freshBoostWithV1Validator,
12
12
  fundBudget,
13
13
  fundErc20,
14
14
  fundErc721,
@@ -112,7 +112,7 @@ describe("ERC20VariableCriteriaIncentiveV2", () => {
112
112
  criteria: basicErc721TransferScalarCriteria(erc721),
113
113
  });
114
114
 
115
- boost = await freshBoost(fixtures, {
115
+ boost = await freshBoostWithV1Validator(fixtures, {
116
116
  budget: budgets.budget,
117
117
  incentives: [erc20Incentive],
118
118
  });
@@ -160,7 +160,7 @@ describe("ERC20VariableCriteriaIncentiveV2", () => {
160
160
  criteria: basicErc721MintScalarCriteria(erc721),
161
161
  });
162
162
 
163
- boost = await freshBoost(fixtures, {
163
+ boost = await freshBoostWithV1Validator(fixtures, {
164
164
  budget: budgets.budget,
165
165
  incentives: [erc20Incentive],
166
166
  });
@@ -200,7 +200,7 @@ describe("ERC20VariableCriteriaIncentiveV2", () => {
200
200
  valueType: ValueType.WAD,
201
201
  });
202
202
 
203
- boost = await freshBoost(fixtures, {
203
+ boost = await freshBoostWithV1Validator(fixtures, {
204
204
  budget: budgets.budget,
205
205
  incentives: [erc20Incentive],
206
206
  });
@@ -257,7 +257,7 @@ describe("ERC20VariableCriteriaIncentiveV2", () => {
257
257
  });
258
258
 
259
259
  test("can clawback via a budget", async () => {
260
- const boost = await freshBoost(fixtures, {
260
+ const boost = await freshBoostWithV1Validator(fixtures, {
261
261
  budget: budgets.budget,
262
262
  incentives: [erc20Incentive],
263
263
  });
@@ -457,7 +457,7 @@ export function prepareERC20VariableCriteriaIncentiveV2Payload({
457
457
  components: [
458
458
  { type: 'uint8', name: 'criteriaType' },
459
459
  { type: 'bytes32', name: 'signature' },
460
- { type: 'uint8', name: 'fieldIndex' },
460
+ { type: 'uint32', name: 'fieldIndex' },
461
461
  { type: 'address', name: 'targetContract' },
462
462
  { type: 'uint8', name: 'valueType' },
463
463
  ],
@@ -5,7 +5,7 @@ import {
5
5
  type Fixtures,
6
6
  defaultOptions,
7
7
  deployFixtures,
8
- freshBoost,
8
+ freshBoostWithV1Validator,
9
9
  fundBudget,
10
10
  } from "@boostxyz/test/helpers";
11
11
  import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
@@ -19,7 +19,6 @@ import { beforeAll, beforeEach, describe, expect, test } from "vitest";
19
19
  import { decodeClaimData } from "../Validators/Validator";
20
20
  import { ERC20VariableIncentive } from "./ERC20VariableIncentive";
21
21
 
22
-
23
22
  let fixtures: Fixtures, budgets: BudgetFixtures;
24
23
 
25
24
  describe("ERC20VariableIncentive", () => {
@@ -57,7 +56,7 @@ describe("ERC20VariableIncentive", () => {
57
56
  manager: zeroAddress,
58
57
  },
59
58
  );
60
- const boost = await freshBoost(fixtures, {
59
+ const boost = await freshBoostWithV1Validator(fixtures, {
61
60
  budget: budgets.budget,
62
61
  incentives: [erc20VariableIncentive],
63
62
  });
@@ -99,7 +98,7 @@ describe("ERC20VariableIncentive", () => {
99
98
  manager: zeroAddress,
100
99
  },
101
100
  );
102
- const boost = await freshBoost(fixtures, {
101
+ const boost = await freshBoostWithV1Validator(fixtures, {
103
102
  budget: budgets.budget,
104
103
  incentives: [erc20VariableIncentive],
105
104
  });
@@ -139,7 +138,7 @@ describe("ERC20VariableIncentive", () => {
139
138
  manager: zeroAddress,
140
139
  },
141
140
  );
142
- const boost = await freshBoost(fixtures, {
141
+ const boost = await freshBoostWithV1Validator(fixtures, {
143
142
  budget: budgets.budget,
144
143
  incentives: [erc20VariableIncentive],
145
144
  });
@@ -186,7 +185,7 @@ describe("ERC20VariableIncentive", () => {
186
185
  manager: zeroAddress,
187
186
  },
188
187
  );
189
- const boost = await freshBoost(fixtures, {
188
+ const boost = await freshBoostWithV1Validator(fixtures, {
190
189
  budget: budgets.budget,
191
190
  incentives: [erc20VariableIncentive],
192
191
  });
@@ -223,7 +222,7 @@ describe("ERC20VariableIncentive", () => {
223
222
  manager: zeroAddress,
224
223
  },
225
224
  );
226
- const boost = await freshBoost(fixtures, {
225
+ const boost = await freshBoostWithV1Validator(fixtures, {
227
226
  budget: budgets.budget,
228
227
  incentives: [erc20VariableIncentive],
229
228
  });
@@ -248,7 +247,7 @@ describe("ERC20VariableIncentive", () => {
248
247
  limit: 1n,
249
248
  manager: budgets.budget.assertValidAddress(),
250
249
  });
251
- const boost = await freshBoost(fixtures, {
250
+ const boost = await freshBoostWithV1Validator(fixtures, {
252
251
  budget: budgets.budget,
253
252
  incentives: [erc20VariableIncentive],
254
253
  });
@@ -5,7 +5,7 @@ import {
5
5
  type Fixtures,
6
6
  defaultOptions,
7
7
  deployFixtures,
8
- freshBoost,
8
+ freshBoostWithV1Validator,
9
9
  freshPoints,
10
10
  } from "@boostxyz/test/helpers";
11
11
  import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
@@ -48,7 +48,7 @@ describe("PointsIncentive", () => {
48
48
  reward: 1n,
49
49
  limit: 10n,
50
50
  });
51
- const boost = await freshBoost(fixtures, {
51
+ const boost = await freshBoostWithV1Validator(fixtures, {
52
52
  incentives: [pointsIncentive],
53
53
  });
54
54
 
@@ -93,7 +93,7 @@ describe("PointsIncentive", () => {
93
93
  reward: 1n,
94
94
  limit: 1n,
95
95
  });
96
- const boost = await freshBoost(fixtures, {
96
+ const boost = await freshBoostWithV1Validator(fixtures, {
97
97
  incentives: [pointsIncentive],
98
98
  });
99
99
 
@@ -139,7 +139,7 @@ describe("PointsIncentive", () => {
139
139
  reward,
140
140
  limit: 10n,
141
141
  });
142
- const boost = await freshBoost(fixtures, {
142
+ const boost = await freshBoostWithV1Validator(fixtures, {
143
143
  incentives: [pointsIncentive],
144
144
  });
145
145
 
@@ -188,7 +188,7 @@ describe("PointsIncentive", () => {
188
188
  reward: 1n,
189
189
  limit: 1n,
190
190
  });
191
- const boost = await freshBoost(fixtures, {
191
+ const boost = await freshBoostWithV1Validator(fixtures, {
192
192
  incentives: [pointsIncentive],
193
193
  });
194
194
 
@@ -1,5 +1,5 @@
1
1
  import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
2
- import { isAddress, pad, ContractFunctionRevertedError } from 'viem';
2
+ import { isAddress, pad } from 'viem';
3
3
  import { beforeAll, describe, expect, test } from 'vitest';
4
4
  import { accounts } from '@boostxyz/test/accounts';
5
5
  import {
@@ -17,7 +17,6 @@ import {
17
17
  type PrivateKeyAccount,
18
18
  encodeAbiParameters,
19
19
  } from 'viem';
20
- import { signTypedData } from 'viem/accounts';
21
20
  import { LimitedSignerValidator as SignerValidatorBases } from '../../dist/deployments.json';
22
21
  import type {
23
22
  DeployableOptions,
@@ -292,9 +291,9 @@ export type LimitedSignerValidatorLog<
292
291
  * A simple implementation of a Validator that verifies a given signature and checks the recovered address against a set of authorized signers
293
292
  *
294
293
  * @export
295
- * @class SignerValidator
296
- * @typedef {SignerValidator}
297
- * @extends {DeployableTarget<SignerValidatorPayload>}
294
+ * @class LimitedSignerValidator
295
+ * @typedef {LimitedSignerValidator}
296
+ * @extends {DeployableTarget<LimitedSignerValidatorPayload>}
298
297
  */
299
298
  export class LimitedSignerValidator extends DeployableTarget<
300
299
  LimitedSignerValidatorPayload,
@@ -379,11 +378,11 @@ export class LimitedSignerValidator extends DeployableTarget<
379
378
  *
380
379
  * @public
381
380
  * @async
382
- * @param {SignerValidatorValidatePayload} payload
381
+ * @param {LimitedSignerValidatorValidatePayload} payload
383
382
  * @param {?WriteParams} [params]
384
383
  * @returns {Promise<boolean>} - True if the action has been validated based on the data payload
385
384
  */
386
- protected async validate(
385
+ public async validate(
387
386
  payload: LimitedSignerValidatorValidatePayload,
388
387
  params?: WriteParams,
389
388
  ) {
@@ -395,11 +394,11 @@ export class LimitedSignerValidator extends DeployableTarget<
395
394
  *
396
395
  * @public
397
396
  * @async
398
- * @param {SignerValidatorValidatePayload} payload
397
+ * @param {LimitedSignerValidatorValidatePayload} payload
399
398
  * @param {?WriteParams} [params]
400
399
  * @returns {Promise<boolean>} - True if the action has been validated based on the data payload
401
400
  */
402
- protected async validateRaw(
401
+ public async validateRaw(
403
402
  payload: LimitedSignerValidatorValidatePayload,
404
403
  params?: WriteParams,
405
404
  ) {
@@ -518,7 +517,7 @@ export class LimitedSignerValidator extends DeployableTarget<
518
517
  *
519
518
  * @public
520
519
  * @async
521
- * @param {SignerValidatorClaimDataParams} params
520
+ * @param {LimitedSignerValidatorClaimDataParams} params
522
521
  * @returns {Promise<Hex>}
523
522
  */
524
523
  public async encodeClaimData(
@@ -534,7 +533,7 @@ export class LimitedSignerValidator extends DeployableTarget<
534
533
  * @inheritdoc
535
534
  *
536
535
  * @public
537
- * @param {?SignerValidatorPayload} [_payload]
536
+ * @param {?LimitedSignerValidatorPayload} [_payload]
538
537
  * @param {?DeployableOptions} [_options]
539
538
  * @returns {GenericDeployableParams}
540
539
  */
@@ -0,0 +1,231 @@
1
+ import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
2
+ import { isAddress, pad, ContractFunctionRevertedError } from 'viem';
3
+ import { beforeAll, describe, expect, test } from 'vitest';
4
+ import { accounts } from '@boostxyz/test/accounts';
5
+ import {
6
+ type Fixtures,
7
+ defaultOptions,
8
+ deployFixtures,
9
+ } from '@boostxyz/test/helpers';
10
+ import { testAccount } from '@boostxyz/test/viem';
11
+ import { LimitedSignerValidatorV2 } from './LimitedSignerValidatorV2';
12
+
13
+ let fixtures: Fixtures;
14
+
15
+ function freshValidator(fixtures: Fixtures) {
16
+ return function freshValidator() {
17
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
18
+ const account = accounts.at(1)!.account;
19
+ return fixtures.registry.initialize(
20
+ crypto.randomUUID(),
21
+ fixtures.core.LimitedSignerValidatorV2({
22
+ signers: [defaultOptions.account.address, account],
23
+ validatorCaller: testAccount.address,
24
+ maxClaimCount: 1,
25
+ }),
26
+ );
27
+ };
28
+ }
29
+
30
+ describe('LimitedSignerValidatorV2', () => {
31
+ beforeAll(async () => {
32
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
33
+ });
34
+
35
+ test('can successfully be deployed', async () => {
36
+ expect.assertions(1);
37
+ const action = new LimitedSignerValidatorV2(defaultOptions, {
38
+ signers: [testAccount.address],
39
+ validatorCaller: testAccount.address,
40
+ maxClaimCount: 0,
41
+ });
42
+ await action.deploy();
43
+ expect(isAddress(action.assertValidAddress())).toBe(true);
44
+ });
45
+
46
+ test('initializes successfully', async () => {
47
+ expect.assertions(3);
48
+ const validator = await loadFixture(freshValidator(fixtures));
49
+ expect(await validator.signers(defaultOptions.account.address)).toBe(true);
50
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
51
+ expect(await validator.signers(accounts.at(1)!.account)).toBe(true);
52
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
53
+ expect(await validator.signers(accounts.at(2)!.account)).toBe(false);
54
+ });
55
+
56
+ test('can validate hashes', async () => {
57
+ const validator = await loadFixture(freshValidator(fixtures));
58
+
59
+ // Define the input data
60
+ const boostId = 5n;
61
+ const incentiveQuantity = 1;
62
+ const incentiveId = 0n;
63
+ const claimant = '0x24582544C98a86eE59687c4D5B55D78f4FffA666';
64
+ const referrer = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';
65
+ const incentiveData = pad('0xdef456232173821931823712381232131391321934');
66
+
67
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
68
+ const trustedSigner = accounts.at(0)!;
69
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
70
+ const untrustedSigner = accounts.at(2)!;
71
+
72
+ const claimDataPayload = await validator.encodeClaimData({
73
+ signer: trustedSigner,
74
+ incentiveData,
75
+ chainId: defaultOptions.config.chains[0].id,
76
+ incentiveQuantity,
77
+ claimant,
78
+ boostId: boostId,
79
+ referrer,
80
+ });
81
+
82
+ const badClaimDataPayload = await validator.encodeClaimData({
83
+ signer: untrustedSigner,
84
+ incentiveData,
85
+ chainId: defaultOptions.config.chains[0].id,
86
+ incentiveQuantity,
87
+ claimant,
88
+ boostId: boostId,
89
+ referrer,
90
+ });
91
+
92
+ // Validation using trusted signer
93
+ expect(
94
+ await validator.validate({
95
+ boostId: boostId,
96
+ incentiveId: incentiveId,
97
+ claimData: claimDataPayload,
98
+ claimant: claimant,
99
+ }),
100
+ ).toBe(true);
101
+
102
+ // Validation using untrusted signer should throw an error
103
+ try {
104
+ await validator.validate({
105
+ boostId: boostId,
106
+ incentiveId: incentiveId,
107
+ claimData: badClaimDataPayload,
108
+ claimant: claimant,
109
+ });
110
+ } catch (e) {
111
+ expect(e).toBeInstanceOf(Error);
112
+ }
113
+ expect.assertions(2);
114
+ });
115
+
116
+ test('will not accept more than `maxClaims` valid claims', async () =>{
117
+ // in this case maxClaims is 1, configured above as a state variable
118
+ const validator = await loadFixture(freshValidator(fixtures));
119
+
120
+ // Define the input data
121
+ const boostId = 5n;
122
+ const incentiveQuantity = 1;
123
+ const incentiveId = 0n;
124
+ const claimant = '0x24582544C98a86eE59687c4D5B55D78f4FffA666';
125
+ const referrer = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';
126
+ const incentiveData = pad('0xdef456232173821931823712381232131391321934');
127
+
128
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
129
+ const trustedSigner = accounts[0];
130
+
131
+ const claimDataPayload = await validator.encodeClaimData({
132
+ signer: trustedSigner,
133
+ incentiveData,
134
+ chainId: defaultOptions.config.chains[0].id,
135
+ incentiveQuantity,
136
+ claimant,
137
+ boostId: boostId,
138
+ referrer,
139
+ });
140
+
141
+ // Validation using trusted signer
142
+ expect(
143
+ await validator.validate({
144
+ boostId: boostId,
145
+ incentiveId: incentiveId,
146
+ claimData: claimDataPayload,
147
+ claimant: claimant,
148
+ }),
149
+ ).toBe(true);
150
+
151
+ const newClaimDataPayload = await validator.encodeClaimData({
152
+ signer: trustedSigner,
153
+ incentiveData: pad('0xdef45623217382193182371238123213139132193456'),
154
+ chainId: defaultOptions.config.chains[0].id,
155
+ incentiveQuantity,
156
+ claimant,
157
+ boostId: boostId,
158
+ referrer,
159
+ });
160
+
161
+ try {
162
+ await validator.validate({
163
+ boostId: boostId,
164
+ incentiveId: incentiveId,
165
+ claimData: newClaimDataPayload,
166
+ claimant: claimant,
167
+ })
168
+ } catch(e) {
169
+ if (e instanceof Object)
170
+ expect((e).toString()).toContain('MaximumClaimed')
171
+ }
172
+ expect.assertions(2);
173
+ })
174
+
175
+ test('will not revalidate the same hash', async () => {
176
+ const validator = await loadFixture(freshValidator(fixtures));
177
+
178
+ // Define the input data
179
+ const boostId = 5n;
180
+ const incentiveQuantity = 1;
181
+ const incentiveId = 0n;
182
+ const claimant = '0x24582544C98a86eE59687c4D5B55D78f4FffA666';
183
+ const referrer = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';
184
+ const incentiveData = pad('0xdef456232173821931823712381232131391321934');
185
+
186
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
187
+ const trustedSigner = accounts.at(0)!;
188
+
189
+ const claimDataPayload = await validator.encodeClaimData({
190
+ signer: trustedSigner,
191
+ incentiveData,
192
+ chainId: defaultOptions.config.chains[0].id,
193
+ incentiveQuantity,
194
+ claimant,
195
+ boostId: boostId,
196
+ referrer,
197
+ });
198
+
199
+ expect(
200
+ await validator.validate({
201
+ boostId,
202
+ incentiveId,
203
+ claimant,
204
+ claimData: claimDataPayload,
205
+ }),
206
+ ).toBe(true);
207
+
208
+ // Attempt to validate the same hash again (should throw an error)
209
+ try {
210
+ await validator.validate({
211
+ boostId,
212
+ incentiveId,
213
+ claimData: claimDataPayload,
214
+ claimant,
215
+ });
216
+ } catch (e) {
217
+ expect(e).toBeInstanceOf(Error);
218
+ }
219
+ expect.assertions(2);
220
+ });
221
+
222
+ test('can set authorized', async () => {
223
+ const validator = await loadFixture(freshValidator(fixtures));
224
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
225
+ const newSigner = accounts.at(2)!.account;
226
+ expect(await validator.signers(newSigner)).toBe(false);
227
+ await validator.setAuthorized([newSigner], [true]);
228
+ expect(await validator.signers(newSigner)).toBe(true);
229
+ expect.assertions(2);
230
+ });
231
+ });