@boostxyz/sdk 7.3.0 → 7.5.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.
- 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 +160 -159
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +3 -3
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +30 -30
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +3 -3
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +14 -0
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +199 -180
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +31 -31
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budget-DGg1wCa6.cjs +2 -0
- package/dist/Budget-DGg1wCa6.cjs.map +1 -0
- package/dist/{Budget-B-grnRq9.js → Budget-ZnzzZsjK.js} +102 -102
- package/dist/Budget-ZnzzZsjK.js.map +1 -0
- 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.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +48 -48
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/ManagedBudgetWithFees.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudgetWithFeesV2.d.ts.map +1 -1
- package/dist/Budgets/TransparentBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +5 -8
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +19 -19
- package/dist/{Incentive-Bz_g-nID.js → Incentive-CYj6lbM5.js} +64 -64
- package/dist/Incentive-CYj6lbM5.js.map +1 -0
- package/dist/{Incentive-Dufx0ZjH.cjs → Incentive-Ckxpw7EN.cjs} +2 -2
- package/dist/Incentive-Ckxpw7EN.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +36 -36
- package/dist/Incentives/AllowListIncentive.js.map +1 -1
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +37 -37
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +44 -44
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20PeggedIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js +63 -63
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.d.ts.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +55 -53
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +45 -45
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +51 -49
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +38 -38
- package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
- 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.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +35 -35
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-BlLgvhjE.js → SimpleDenyList-DUO4ex__.js} +32 -32
- package/dist/SimpleDenyList-DUO4ex__.js.map +1 -0
- package/dist/{SimpleDenyList-B2YDJ_gk.cjs → SimpleDenyList-v5G-fPfm.cjs} +2 -2
- package/dist/SimpleDenyList-v5G-fPfm.cjs.map +1 -0
- package/dist/Validator-BA8RC2J6.cjs +2 -0
- package/dist/Validator-BA8RC2J6.cjs.map +1 -0
- package/dist/Validator-D4CzwdB9.js +409 -0
- package/dist/Validator-D4CzwdB9.js.map +1 -0
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
- package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
- package/dist/Validators/LimitedSignerValidator.js +39 -39
- package/dist/Validators/LimitedSignerValidator.js.map +1 -1
- package/dist/Validators/PayableLimitedSignerValidator.d.ts +829 -0
- package/dist/Validators/PayableLimitedSignerValidator.d.ts.map +1 -0
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +48 -48
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +4 -3
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +14 -50
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/componentInterfaces-D4QdH2Qz.cjs +2 -0
- package/dist/componentInterfaces-D4QdH2Qz.cjs.map +1 -0
- package/dist/componentInterfaces-DCTot4_O.js +24 -0
- package/dist/componentInterfaces-DCTot4_O.js.map +1 -0
- package/dist/{deployments-DKtAq6BT.js → deployments-B-ZU0zVY.js} +61 -34
- package/dist/{deployments-DKtAq6BT.js.map → deployments-B-ZU0zVY.js.map} +1 -1
- package/dist/deployments-CaacquP1.cjs +2 -0
- package/dist/deployments-CaacquP1.cjs.map +1 -0
- package/dist/deployments.json +32 -4
- package/dist/generated-BOBQ2ut4.cjs +3 -0
- package/dist/generated-BOBQ2ut4.cjs.map +1 -0
- package/dist/{generated-CINzoGbl.js → generated-ffteMTHN.js} +1157 -776
- package/dist/generated-ffteMTHN.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +123 -118
- package/package.json +1 -1
- package/src/Actions/EventAction.ts +3 -1
- package/src/AllowLists/SimpleAllowList.ts +3 -1
- package/src/AllowLists/SimpleDenyList.ts +3 -1
- package/src/BoostCore.ts +30 -1
- package/src/BoostRegistry.ts +3 -1
- package/src/Budgets/ManagedBudget.ts +3 -1
- package/src/Budgets/ManagedBudgetWithFees.ts +3 -1
- package/src/Budgets/ManagedBudgetWithFeesV2.ts +3 -1
- package/src/Budgets/TransparentBudget.ts +3 -1
- package/src/Budgets/VestingBudget.ts +3 -1
- package/src/Deployable/DeployableTarget.ts +2 -3
- package/src/Incentives/AllowListIncentive.ts +3 -1
- package/src/Incentives/CGDAIncentive.ts +3 -1
- package/src/Incentives/ERC1155Incentive.ts +3 -1
- package/src/Incentives/ERC20Incentive.ts +3 -1
- package/src/Incentives/ERC20PeggedIncentive.ts +3 -1
- package/src/Incentives/ERC20PeggedVariableCriteriaIncentive.ts +3 -1
- package/src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.ts +6 -2
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +3 -1
- package/src/Incentives/ERC20VariableCriteriaIncentiveV2.ts +5 -1
- package/src/Incentives/ERC20VariableIncentive.ts +3 -1
- package/src/Incentives/PointsIncentive.ts +3 -1
- package/src/Validators/LimitedSignerValidator.ts +3 -1
- package/src/Validators/PayableLimitedSignerValidator.test.ts +202 -0
- package/src/Validators/PayableLimitedSignerValidator.ts +667 -0
- package/src/Validators/SignerValidator.ts +3 -1
- package/src/Validators/Validator.ts +7 -1
- package/src/index.ts +1 -0
- package/dist/Budget-B-grnRq9.js.map +0 -1
- package/dist/Budget-uGKa2qzz.cjs +0 -2
- package/dist/Budget-uGKa2qzz.cjs.map +0 -1
- package/dist/Incentive-Bz_g-nID.js.map +0 -1
- package/dist/Incentive-Dufx0ZjH.cjs.map +0 -1
- package/dist/SimpleDenyList-B2YDJ_gk.cjs.map +0 -1
- package/dist/SimpleDenyList-BlLgvhjE.js.map +0 -1
- package/dist/componentInterfaces-C5ig8mCK.cjs +0 -2
- package/dist/componentInterfaces-C5ig8mCK.cjs.map +0 -1
- package/dist/componentInterfaces-Ddus5rIA.js +0 -23
- package/dist/componentInterfaces-Ddus5rIA.js.map +0 -1
- package/dist/deployments-Dk-Z1L2X.cjs +0 -2
- package/dist/deployments-Dk-Z1L2X.cjs.map +0 -1
- package/dist/generated-CINzoGbl.js.map +0 -1
- package/dist/generated-C_JEoLDO.cjs +0 -3
- package/dist/generated-C_JEoLDO.cjs.map +0 -1
|
@@ -124,7 +124,9 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
124
124
|
* @type {Record<number, Address>}
|
|
125
125
|
*/
|
|
126
126
|
public static override bases: Record<number, Address> = {
|
|
127
|
-
|
|
127
|
+
...(import.meta.env?.VITE_ERC20_INCENTIVE_BASE
|
|
128
|
+
? { 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE }
|
|
129
|
+
: {}),
|
|
128
130
|
...(ERC20IncentiveBases as Record<number, Address>),
|
|
129
131
|
};
|
|
130
132
|
/**
|
|
@@ -118,7 +118,9 @@ export class ERC20PeggedIncentive extends DeployableTarget<
|
|
|
118
118
|
* @type {Record<number, Address>}
|
|
119
119
|
*/
|
|
120
120
|
public static override bases: Record<number, Address> = {
|
|
121
|
-
|
|
121
|
+
...(import.meta.env?.VITE_ERC20_INCENTIVE_BASE
|
|
122
|
+
? { 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE }
|
|
123
|
+
: {}),
|
|
122
124
|
...(ERC20PeggedIncentiveBases as Record<number, Address>),
|
|
123
125
|
};
|
|
124
126
|
/**
|
|
@@ -153,7 +153,9 @@ export class ERC20PeggedVariableCriteriaIncentive extends DeployableTarget<
|
|
|
153
153
|
* @type {Record<number, Address>}
|
|
154
154
|
*/
|
|
155
155
|
public static override bases: Record<number, Address> = {
|
|
156
|
-
|
|
156
|
+
...(import.meta.env?.VITE_ERC20_INCENTIVE_BASE
|
|
157
|
+
? { 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE }
|
|
158
|
+
: {}),
|
|
157
159
|
...(ERC20PeggedVariableCriteriaIncentiveBases as Record<number, Address>),
|
|
158
160
|
};
|
|
159
161
|
/**
|
|
@@ -156,8 +156,12 @@ export class ERC20PeggedVariableCriteriaIncentiveV2 extends DeployableTarget<
|
|
|
156
156
|
* @type {Record<number, Address>}
|
|
157
157
|
*/
|
|
158
158
|
public static override bases: Record<number, Address> = {
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
...(import.meta.env?.VITE_ERC20_PEGGED_VARIABLE_CRITERIA_INCENTIVE_V2_BASE
|
|
160
|
+
? {
|
|
161
|
+
31337: import.meta.env
|
|
162
|
+
.VITE_ERC20_PEGGED_VARIABLE_CRITERIA_INCENTIVE_V2_BASE,
|
|
163
|
+
}
|
|
164
|
+
: {}),
|
|
161
165
|
...(ERC20PeggedVariableCriteriaIncentiveV2Bases as Record<number, Address>),
|
|
162
166
|
};
|
|
163
167
|
/**
|
|
@@ -128,7 +128,9 @@ export class ERC20VariableCriteriaIncentive extends ERC20VariableIncentive<
|
|
|
128
128
|
* @type {Record<number, Address>}
|
|
129
129
|
*/
|
|
130
130
|
public static override bases: Record<number, Address> = {
|
|
131
|
-
|
|
131
|
+
...(import.meta.env?.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE
|
|
132
|
+
? { 31337: import.meta.env.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE }
|
|
133
|
+
: {}),
|
|
132
134
|
...(ERC20VariableCriteriaIncentiveBases as Record<number, Address>),
|
|
133
135
|
};
|
|
134
136
|
|
|
@@ -143,7 +143,11 @@ export class ERC20VariableCriteriaIncentiveV2 extends ERC20VariableIncentive<
|
|
|
143
143
|
* @type {Record<number, Address>}
|
|
144
144
|
*/
|
|
145
145
|
public static override bases: Record<number, Address> = {
|
|
146
|
-
|
|
146
|
+
...(import.meta.env?.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_V2_BASE
|
|
147
|
+
? {
|
|
148
|
+
31337: import.meta.env.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_V2_BASE,
|
|
149
|
+
}
|
|
150
|
+
: {}),
|
|
147
151
|
...(ERC20VariableCriteriaIncentiveV2Bases as Record<number, Address>),
|
|
148
152
|
};
|
|
149
153
|
|
|
@@ -113,7 +113,9 @@ export class ERC20VariableIncentive<
|
|
|
113
113
|
* @type {Record<number, Address>}
|
|
114
114
|
*/
|
|
115
115
|
public static override bases: Record<number, Address> = {
|
|
116
|
-
|
|
116
|
+
...(import.meta.env?.VITE_ERC20_VARIABLE_INCENTIVE_BASE
|
|
117
|
+
? { 31337: import.meta.env.VITE_ERC20_VARIABLE_INCENTIVE_BASE }
|
|
118
|
+
: {}),
|
|
117
119
|
...(ERC20VariableIncentiveBases as Record<number, Address>),
|
|
118
120
|
};
|
|
119
121
|
/**
|
|
@@ -111,7 +111,9 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
111
111
|
* @type {Record<number, Address>}
|
|
112
112
|
*/
|
|
113
113
|
public static override bases: Record<number, Address> = {
|
|
114
|
-
|
|
114
|
+
...(import.meta.env?.VITE_POINTS_INCENTIVE_BASE
|
|
115
|
+
? { 31337: import.meta.env.VITE_POINTS_INCENTIVE_BASE }
|
|
116
|
+
: {}),
|
|
115
117
|
...(PointsIncentiveBases as Record<number, Address>),
|
|
116
118
|
};
|
|
117
119
|
/**
|
|
@@ -316,7 +316,9 @@ export class LimitedSignerValidator extends DeployableTarget<
|
|
|
316
316
|
* @type {Record<number, Address>}
|
|
317
317
|
*/
|
|
318
318
|
public static override bases: Record<number, Address> = {
|
|
319
|
-
|
|
319
|
+
...(import.meta.env?.VITE_LIMITED_SIGNER_VALIDATOR_BASE
|
|
320
|
+
? { 31337: import.meta.env.VITE_LIMITED_SIGNER_VALIDATOR_BASE }
|
|
321
|
+
: {}),
|
|
320
322
|
...(SignerValidatorBases as Record<number, Address>),
|
|
321
323
|
};
|
|
322
324
|
/**
|
|
@@ -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 { PayableLimitedSignerValidator } from "./PayableLimitedSignerValidator";
|
|
8
|
+
|
|
9
|
+
let fixtures: Fixtures;
|
|
10
|
+
|
|
11
|
+
function freshBaseValidator(fixtures: Fixtures) {
|
|
12
|
+
return async function freshBaseValidator() {
|
|
13
|
+
const PayableLimitedSignerValidator = fixtures.bases.PayableLimitedSignerValidator;
|
|
14
|
+
const baseAddress = PayableLimitedSignerValidator.bases[31337];
|
|
15
|
+
return new PayableLimitedSignerValidator(
|
|
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.PayableLimitedSignerValidator({
|
|
28
|
+
signers: [account],
|
|
29
|
+
validatorCaller: testAccount.address,
|
|
30
|
+
maxClaimCount: 3
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe("PayableLimitedSignerValidator", () => {
|
|
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 TPayableLimitedSignerValidator = fixtures.bases.PayableLimitedSignerValidator;
|
|
41
|
+
if (TPayableLimitedSignerValidator.bases[31337]) {
|
|
42
|
+
PayableLimitedSignerValidator.bases[31337] = TPayableLimitedSignerValidator.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.PayableLimitedSignerValidator({
|
|
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 LimitedSignerValidator", 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
|
+
});
|