@boostxyz/sdk 8.0.0-canary.3 → 8.0.0-canary.5
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.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +2 -2
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +184 -181
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/{AllowList-DQf-8HQC.js → AllowList-CTRuUBCQ.js} +41 -41
- package/dist/{AllowList-DQf-8HQC.js.map → AllowList-CTRuUBCQ.js.map} +1 -1
- package/dist/{AllowList-DaX239DR.cjs → AllowList-GEmUfOR1.cjs} +2 -2
- package/dist/{AllowList-DaX239DR.cjs.map → AllowList-GEmUfOR1.cjs.map} +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +4 -4
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.js +7 -7
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.js +3 -3
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +2 -2
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +137 -2
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +336 -206
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.js +21 -21
- package/dist/{Budget-LnAQ_Slw.js → Budget-BH0s7Bxu.js} +52 -52
- package/dist/{Budget-LnAQ_Slw.js.map → Budget-BH0s7Bxu.js.map} +1 -1
- package/dist/{Budget-WIB8IJoM.cjs → Budget-CwNhsa3m.cjs} +2 -2
- package/dist/{Budget-WIB8IJoM.cjs.map → Budget-CwNhsa3m.cjs.map} +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +3 -3
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.js +26 -26
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.js +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +17 -17
- package/dist/{Incentive-gT7z-4v3.cjs → Incentive-B2ZBE5LU.cjs} +2 -2
- package/dist/{Incentive-gT7z-4v3.cjs.map → Incentive-B2ZBE5LU.cjs.map} +1 -1
- package/dist/{Incentive-D_IBex5V.js → Incentive-BCSV7OtF.js} +41 -41
- package/dist/{Incentive-D_IBex5V.js.map → Incentive-BCSV7OtF.js.map} +1 -1
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.js +17 -17
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.js +14 -14
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.js +13 -13
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js +71 -71
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +35 -35
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +9 -9
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +12 -12
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +8 -8
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.js +3 -3
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.js +28 -28
- package/dist/{SimpleDenyList-D5AoBdVi.cjs → SimpleDenyList-6_sxnZB0.cjs} +2 -2
- package/dist/{SimpleDenyList-D5AoBdVi.cjs.map → SimpleDenyList-6_sxnZB0.cjs.map} +1 -1
- package/dist/{SimpleDenyList-CtdXM49y.js → SimpleDenyList-CrjjFnn5.js} +17 -17
- package/dist/{SimpleDenyList-CtdXM49y.js.map → SimpleDenyList-CrjjFnn5.js.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
- package/dist/Validators/LimitedSignerValidator.d.ts +9 -9
- package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
- package/dist/Validators/LimitedSignerValidator.js +19 -19
- package/dist/Validators/LimitedSignerValidator.js.map +1 -1
- package/dist/Validators/LimitedSignerValidatorV2.cjs +2 -0
- package/dist/Validators/LimitedSignerValidatorV2.cjs.map +1 -0
- package/dist/Validators/LimitedSignerValidatorV2.d.ts +842 -0
- package/dist/Validators/LimitedSignerValidatorV2.d.ts.map +1 -0
- package/dist/Validators/LimitedSignerValidatorV2.js +301 -0
- package/dist/Validators/LimitedSignerValidatorV2.js.map +1 -0
- package/dist/Validators/PayableLimitedSignerValidator.cjs +2 -0
- package/dist/Validators/PayableLimitedSignerValidator.cjs.map +1 -0
- package/dist/Validators/PayableLimitedSignerValidator.d.ts.map +1 -1
- package/dist/{Validator-BEUqV28V.js → Validators/PayableLimitedSignerValidator.js} +56 -102
- package/dist/Validators/PayableLimitedSignerValidator.js.map +1 -0
- package/dist/Validators/PayableLimitedSignerValidatorV2.cjs +2 -0
- package/dist/Validators/PayableLimitedSignerValidatorV2.cjs.map +1 -0
- package/dist/Validators/PayableLimitedSignerValidatorV2.d.ts +855 -0
- package/dist/Validators/PayableLimitedSignerValidatorV2.d.ts.map +1 -0
- package/dist/Validators/PayableLimitedSignerValidatorV2.js +372 -0
- package/dist/Validators/PayableLimitedSignerValidatorV2.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +4 -2
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +12 -12
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/SignerValidatorV2.cjs +2 -0
- package/dist/Validators/SignerValidatorV2.cjs.map +1 -0
- package/dist/Validators/SignerValidatorV2.d.ts +728 -0
- package/dist/Validators/SignerValidatorV2.d.ts.map +1 -0
- package/dist/Validators/SignerValidatorV2.js +299 -0
- package/dist/Validators/SignerValidatorV2.js.map +1 -0
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +19 -4
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +79 -14
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/componentInterfaces-43ygGrVO.js +28 -0
- package/dist/componentInterfaces-43ygGrVO.js.map +1 -0
- package/dist/componentInterfaces-JU4NBkEc.cjs +2 -0
- package/dist/componentInterfaces-JU4NBkEc.cjs.map +1 -0
- package/dist/{deployments-Dw5Suk_D.js → deployments-COm00j8v.js} +48 -39
- package/dist/{deployments-Dw5Suk_D.js.map → deployments-COm00j8v.js.map} +1 -1
- package/dist/deployments-uLDgrxCp.cjs +2 -0
- package/dist/deployments-uLDgrxCp.cjs.map +1 -0
- package/dist/deployments.json +30 -21
- package/dist/generated-CkZm1EVH.cjs +3 -0
- package/dist/generated-CkZm1EVH.cjs.map +1 -0
- package/dist/{generated-krkFnwbV.js → generated-DRbljODL.js} +2314 -1284
- package/dist/generated-DRbljODL.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +185 -165
- package/dist/index.js.map +1 -1
- package/package.json +25 -1
- package/src/Actions/EventAction.ts +24 -5
- package/src/BoostCore.test.ts +77 -11
- package/src/BoostCore.ts +165 -4
- package/src/Budgets/ManagedBudgetWithFees.test.ts +14 -14
- package/src/Budgets/ManagedBudgetWithFeesV2.test.ts +3 -3
- package/src/Incentives/AllowListIncentive.test.ts +5 -5
- package/src/Incentives/CGDAIncentive.test.ts +6 -6
- package/src/Incentives/ERC1155Incentive.test.ts +2 -2
- package/src/Incentives/ERC20Incentive.test.ts +6 -6
- package/src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.test.ts +5 -5
- package/src/Incentives/ERC20VariableCriteriaIncentiveV2.test.ts +5 -5
- package/src/Incentives/ERC20VariableIncentive.test.ts +7 -8
- package/src/Incentives/PointsIncentive.test.ts +5 -5
- package/src/Validators/LimitedSignerValidator.test.ts +1 -1
- package/src/Validators/LimitedSignerValidator.ts +9 -10
- package/src/Validators/LimitedSignerValidatorV2.test.ts +231 -0
- package/src/Validators/LimitedSignerValidatorV2.ts +707 -0
- package/src/Validators/PayableLimitedSignerValidator.test.ts +1 -1
- package/src/Validators/PayableLimitedSignerValidator.ts +0 -1
- package/src/Validators/PayableLimitedSignerValidatorV2.test.ts +202 -0
- package/src/Validators/PayableLimitedSignerValidatorV2.ts +688 -0
- package/src/Validators/SignerValidator.ts +4 -2
- package/src/Validators/SignerValidatorV2.test.ts +163 -0
- package/src/Validators/SignerValidatorV2.ts +635 -0
- package/src/Validators/Validator.ts +45 -2
- package/src/index.ts +3 -0
- package/dist/Validator-BEUqV28V.js.map +0 -1
- package/dist/Validator-FxcxYKhR.cjs +0 -2
- package/dist/Validator-FxcxYKhR.cjs.map +0 -1
- package/dist/componentInterfaces-BZ3fSNkT.cjs +0 -2
- package/dist/componentInterfaces-BZ3fSNkT.cjs.map +0 -1
- package/dist/componentInterfaces-D2s6AXlV.js +0 -25
- package/dist/componentInterfaces-D2s6AXlV.js.map +0 -1
- package/dist/deployments-DimWVnA4.cjs +0 -2
- package/dist/deployments-DimWVnA4.cjs.map +0 -1
- package/dist/generated-Cf82M-QP.cjs +0 -3
- package/dist/generated-Cf82M-QP.cjs.map +0 -1
- package/dist/generated-krkFnwbV.js.map +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
2
|
+
import { isAddress, parseEther } from "viem";
|
|
3
|
+
import { beforeAll, describe, expect, test } from "vitest";
|
|
4
|
+
import { accounts } from "@boostxyz/test/accounts";
|
|
5
|
+
import { type Fixtures, defaultOptions, deployFixtures } from "@boostxyz/test/helpers";
|
|
6
|
+
import { testAccount } from "@boostxyz/test/viem";
|
|
7
|
+
import { PayableLimitedSignerValidatorV2 } from "./PayableLimitedSignerValidatorV2";
|
|
8
|
+
|
|
9
|
+
let fixtures: Fixtures;
|
|
10
|
+
|
|
11
|
+
function freshBaseValidator(fixtures: Fixtures) {
|
|
12
|
+
return async function freshBaseValidator() {
|
|
13
|
+
const PayableLimitedSignerValidatorV2 = fixtures.bases.PayableLimitedSignerValidatorV2;
|
|
14
|
+
const baseAddress = PayableLimitedSignerValidatorV2.bases[31337];
|
|
15
|
+
return new PayableLimitedSignerValidatorV2(
|
|
16
|
+
defaultOptions,
|
|
17
|
+
baseAddress
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function freshCloneValidator(fixtures: Fixtures) {
|
|
23
|
+
return function freshCloneValidator() {
|
|
24
|
+
const account = accounts[2].account;
|
|
25
|
+
return fixtures.registry.initialize(
|
|
26
|
+
crypto.randomUUID(),
|
|
27
|
+
fixtures.core.PayableLimitedSignerValidatorV2({
|
|
28
|
+
signers: [account],
|
|
29
|
+
validatorCaller: testAccount.address,
|
|
30
|
+
maxClaimCount: 3
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe("PayableLimitedSignerValidatorV2", () => {
|
|
37
|
+
beforeAll(async () => {
|
|
38
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
39
|
+
// Set the base address in the SDK class so other tests can use it
|
|
40
|
+
const TPayableLimitedSignerValidatorV2 = fixtures.bases.PayableLimitedSignerValidatorV2;
|
|
41
|
+
if (TPayableLimitedSignerValidatorV2.bases[31337]) {
|
|
42
|
+
PayableLimitedSignerValidatorV2.bases[31337] = TPayableLimitedSignerValidatorV2.bases[31337];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("can successfully be deployed as clone", async () => {
|
|
47
|
+
expect.assertions(1);
|
|
48
|
+
|
|
49
|
+
// Deploy a clone (not a base)
|
|
50
|
+
const validator = await fixtures.registry.initialize(
|
|
51
|
+
crypto.randomUUID(),
|
|
52
|
+
fixtures.core.PayableLimitedSignerValidatorV2({
|
|
53
|
+
signers: [testAccount.address],
|
|
54
|
+
validatorCaller: testAccount.address,
|
|
55
|
+
maxClaimCount: 1
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
expect(isAddress(validator.assertValidAddress())).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("initializes successfully as base implementation", async () => {
|
|
63
|
+
expect.assertions(1);
|
|
64
|
+
const validator = await loadFixture(freshBaseValidator(fixtures));
|
|
65
|
+
expect(isAddress(validator.assertValidAddress())).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("initializes successfully as clone", async () => {
|
|
69
|
+
expect.assertions(2);
|
|
70
|
+
const cloneValidator = await loadFixture(freshCloneValidator(fixtures));
|
|
71
|
+
|
|
72
|
+
expect(await cloneValidator.signers(accounts[2].account)).toBe(true);
|
|
73
|
+
expect(await cloneValidator.signers(defaultOptions.account.address)).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe("Claim Fee Management", () => {
|
|
77
|
+
test("should have initial claim fee set from constructor", async () => {
|
|
78
|
+
expect.assertions(1);
|
|
79
|
+
const baseValidator = await loadFixture(freshBaseValidator(fixtures));
|
|
80
|
+
const initialFee = await baseValidator.getClaimFee();
|
|
81
|
+
|
|
82
|
+
// Should have the initial fee set during deployment (0.001 ETH)
|
|
83
|
+
expect(initialFee).toBe(parseEther("0.001"));
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("should update initial claim fee and reflect changes on both base and clones", async () => {
|
|
87
|
+
expect.assertions(6);
|
|
88
|
+
const baseValidator = await loadFixture(freshBaseValidator(fixtures));
|
|
89
|
+
const cloneValidator = await loadFixture(freshCloneValidator(fixtures));
|
|
90
|
+
const newFee = parseEther("0.005"); // 0.005 ETH
|
|
91
|
+
|
|
92
|
+
// Verify initial fees are set correctly (0.001 ETH from constructor)
|
|
93
|
+
const initialBaseFee = await baseValidator.getClaimFee();
|
|
94
|
+
const initialCloneFee = await cloneValidator.getClaimFee();
|
|
95
|
+
expect(initialBaseFee).toBe(parseEther("0.001"));
|
|
96
|
+
expect(initialCloneFee).toBe(parseEther("0.001"));
|
|
97
|
+
|
|
98
|
+
// Update the fee on the base implementation
|
|
99
|
+
await baseValidator.setClaimFee(newFee);
|
|
100
|
+
|
|
101
|
+
// Verify both base and clone now reflect the new fee
|
|
102
|
+
const updatedBaseFee = await baseValidator.getClaimFee();
|
|
103
|
+
const updatedCloneFee = await cloneValidator.getClaimFee();
|
|
104
|
+
expect(updatedBaseFee).toBe(newFee);
|
|
105
|
+
expect(updatedCloneFee).toBe(newFee);
|
|
106
|
+
|
|
107
|
+
// Verify the fees are different from the initial fees
|
|
108
|
+
expect(updatedBaseFee).not.toBe(initialBaseFee);
|
|
109
|
+
expect(updatedCloneFee).not.toBe(initialCloneFee);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("should set and read claim fee on base implementation", async () => {
|
|
113
|
+
expect.assertions(1);
|
|
114
|
+
const baseValidator = await loadFixture(freshBaseValidator(fixtures));
|
|
115
|
+
const claimFee = parseEther("0.01");
|
|
116
|
+
|
|
117
|
+
await baseValidator.setClaimFee(claimFee);
|
|
118
|
+
const retrievedFee = await baseValidator.getClaimFee();
|
|
119
|
+
|
|
120
|
+
expect(retrievedFee).toBe(claimFee);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("should read claim fee from base implementation when called on clone", async () => {
|
|
124
|
+
expect.assertions(2);
|
|
125
|
+
const baseValidator = await loadFixture(freshBaseValidator(fixtures));
|
|
126
|
+
const cloneValidator = await loadFixture(freshCloneValidator(fixtures));
|
|
127
|
+
const claimFee = parseEther("0.02");
|
|
128
|
+
|
|
129
|
+
await baseValidator.setClaimFee(claimFee);
|
|
130
|
+
|
|
131
|
+
const baseFee = await baseValidator.getClaimFee();
|
|
132
|
+
const cloneFee = await cloneValidator.getClaimFee();
|
|
133
|
+
|
|
134
|
+
expect(baseFee).toBe(claimFee);
|
|
135
|
+
expect(cloneFee).toBe(claimFee);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("should update fee globally when base is updated", async () => {
|
|
139
|
+
expect.assertions(4);
|
|
140
|
+
const baseValidator = await loadFixture(freshBaseValidator(fixtures));
|
|
141
|
+
const cloneValidator = await loadFixture(freshCloneValidator(fixtures));
|
|
142
|
+
const initialFee = parseEther("0.01");
|
|
143
|
+
const newFee = parseEther("0.03");
|
|
144
|
+
|
|
145
|
+
// Set initial fee
|
|
146
|
+
await baseValidator.setClaimFee(initialFee);
|
|
147
|
+
expect(await baseValidator.getClaimFee()).toBe(initialFee);
|
|
148
|
+
expect(await cloneValidator.getClaimFee()).toBe(initialFee);
|
|
149
|
+
|
|
150
|
+
// Update fee on base
|
|
151
|
+
await baseValidator.setClaimFee(newFee);
|
|
152
|
+
expect(await baseValidator.getClaimFee()).toBe(newFee);
|
|
153
|
+
expect(await cloneValidator.getClaimFee()).toBe(newFee);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("should prevent clones from setting fee", async () => {
|
|
157
|
+
expect.assertions(1);
|
|
158
|
+
const cloneValidator = await loadFixture(freshCloneValidator(fixtures));
|
|
159
|
+
const newFee = parseEther("0.05");
|
|
160
|
+
|
|
161
|
+
await expect(cloneValidator.setClaimFee(newFee)).rejects.toThrow();
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test("should allow setting fee to zero", async () => {
|
|
165
|
+
expect.assertions(1);
|
|
166
|
+
const baseValidator = await loadFixture(freshBaseValidator(fixtures));
|
|
167
|
+
|
|
168
|
+
await baseValidator.setClaimFee(0n);
|
|
169
|
+
const retrievedFee = await baseValidator.getClaimFee();
|
|
170
|
+
|
|
171
|
+
expect(retrievedFee).toBe(0n);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe("Inherited Functionality", () => {
|
|
176
|
+
test("should inherit signer management from LimitedSignerValidatorV2", async () => {
|
|
177
|
+
expect.assertions(3);
|
|
178
|
+
const validator = await loadFixture(freshBaseValidator(fixtures));
|
|
179
|
+
const newSigner = accounts[3].account;
|
|
180
|
+
|
|
181
|
+
// Initially not authorized
|
|
182
|
+
expect(await validator.signers(newSigner)).toBe(false);
|
|
183
|
+
|
|
184
|
+
// Authorize the signer
|
|
185
|
+
await validator.setAuthorized([newSigner], [true]);
|
|
186
|
+
expect(await validator.signers(newSigner)).toBe(true);
|
|
187
|
+
|
|
188
|
+
// Deauthorize the signer
|
|
189
|
+
await validator.setAuthorized([newSigner], [false]);
|
|
190
|
+
expect(await validator.signers(newSigner)).toBe(false);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test("should inherit validator caller management", async () => {
|
|
194
|
+
expect.assertions(1);
|
|
195
|
+
const validator = await loadFixture(freshBaseValidator(fixtures));
|
|
196
|
+
const newCaller = accounts[4].account;
|
|
197
|
+
|
|
198
|
+
await validator.setValidatorCaller(newCaller);
|
|
199
|
+
expect(true).toBe(true);
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
});
|