@boostxyz/sdk 8.0.0-canary.3 → 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.
- 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.js +45 -45
- 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/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
package/src/BoostCore.test.ts
CHANGED
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
type Fixtures,
|
|
5
5
|
defaultOptions,
|
|
6
6
|
deployFixtures,
|
|
7
|
-
|
|
7
|
+
freshBoostWithV1Validator,
|
|
8
|
+
freshBoostWithV2Validator,
|
|
8
9
|
fundBudget,
|
|
9
10
|
makeMockEventActionPayload,
|
|
10
11
|
fundErc721,
|
|
@@ -47,7 +48,7 @@ describe("BoostCore", () => {
|
|
|
47
48
|
erc20.assertValidAddress(),
|
|
48
49
|
),
|
|
49
50
|
),
|
|
50
|
-
validator: core.
|
|
51
|
+
validator: core.SignerValidatorV2({
|
|
51
52
|
signers: [defaultOptions.account.address],
|
|
52
53
|
validatorCaller: defaultOptions.account.address,
|
|
53
54
|
}),
|
|
@@ -615,7 +616,7 @@ describe("BoostCore", () => {
|
|
|
615
616
|
expect(await pointsIncentive.limit()).toEqual(10n);
|
|
616
617
|
});
|
|
617
618
|
|
|
618
|
-
test("can get
|
|
619
|
+
test("can get the protocol fee", async () => {
|
|
619
620
|
const { core } = fixtures;
|
|
620
621
|
|
|
621
622
|
expect(await core.protocolFee()).toBe(1000n);
|
|
@@ -632,11 +633,20 @@ describe("BoostCore", () => {
|
|
|
632
633
|
test("can set the protocol fee receiver", async () => {
|
|
633
634
|
const { core } = fixtures;
|
|
634
635
|
|
|
635
|
-
await core.
|
|
636
|
+
await core.setProtocolFeeReceiver(zeroAddress);
|
|
636
637
|
|
|
637
638
|
expect(await core.protocolFeeReceiver()).toBe(zeroAddress);
|
|
638
639
|
});
|
|
639
640
|
|
|
641
|
+
test("can set the referral fee", async () => {
|
|
642
|
+
const { core } = fixtures;
|
|
643
|
+
const fee = 500n;
|
|
644
|
+
|
|
645
|
+
await core.setReferralFee(fee);
|
|
646
|
+
|
|
647
|
+
expect(await core.referralFee()).toBe(fee);
|
|
648
|
+
})
|
|
649
|
+
|
|
640
650
|
test("binds all actions, budgets, allowlists, incentives, and validators to reuse core options and account", () => {
|
|
641
651
|
const { core } = fixtures;
|
|
642
652
|
|
|
@@ -790,7 +800,7 @@ describe("BoostCore", () => {
|
|
|
790
800
|
test("uses the provided validator when one is specified", async () => {
|
|
791
801
|
const { core } = fixtures;
|
|
792
802
|
const { budget, erc20 } = budgets;
|
|
793
|
-
const customValidator = core.
|
|
803
|
+
const customValidator = core.SignerValidatorV2({
|
|
794
804
|
signers: [budget.assertValidAddress()],
|
|
795
805
|
validatorCaller: core.assertValidAddress(),
|
|
796
806
|
});
|
|
@@ -859,11 +869,11 @@ describe("BoostCore", () => {
|
|
|
859
869
|
expect(signer).toBe(true);
|
|
860
870
|
});
|
|
861
871
|
|
|
862
|
-
test("can retrieve the BoostClaimed event from a transaction hash", async () => {
|
|
872
|
+
test("[v1-validator] can retrieve the BoostClaimed event from a transaction hash", async () => {
|
|
873
|
+
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
874
|
+
const referrer = accounts.at(1)!.account!;
|
|
863
875
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
864
|
-
const
|
|
865
|
-
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
866
|
-
trustedSigner = accounts.at(0)!;
|
|
876
|
+
const trustedSigner = accounts.at(0)!;
|
|
867
877
|
const erc20Incentive = fixtures.core.ERC20Incentive({
|
|
868
878
|
asset: budgets.erc20.assertValidAddress(),
|
|
869
879
|
strategy: StrategyType.POOL,
|
|
@@ -871,7 +881,7 @@ describe("BoostCore", () => {
|
|
|
871
881
|
limit: 1n,
|
|
872
882
|
manager: budgets.budget.assertValidAddress(),
|
|
873
883
|
});
|
|
874
|
-
const boost = await
|
|
884
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
875
885
|
budget: budgets.budget,
|
|
876
886
|
incentives: [erc20Incentive],
|
|
877
887
|
});
|
|
@@ -885,6 +895,7 @@ describe("BoostCore", () => {
|
|
|
885
895
|
incentiveQuantity: boost.incentives.length,
|
|
886
896
|
claimant,
|
|
887
897
|
boostId: boost.id,
|
|
898
|
+
referrer,
|
|
888
899
|
});
|
|
889
900
|
|
|
890
901
|
const { hash } = await fixtures.core.claimIncentiveRaw(
|
|
@@ -894,11 +905,64 @@ describe("BoostCore", () => {
|
|
|
894
905
|
claimDataPayload,
|
|
895
906
|
);
|
|
896
907
|
|
|
908
|
+
const claimInfo = await fixtures.core.getClaimFromTransaction({ hash });
|
|
909
|
+
expect(claimInfo).toBeDefined();
|
|
910
|
+
expect(claimInfo?.claimant).toBe(claimant);
|
|
911
|
+
expect(typeof claimInfo?.boostId).toBe("bigint");
|
|
912
|
+
expect(claimInfo?.referrer).toBe(zeroAddress);
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
test("[v2-validator] can retrieve the BoostClaimed event from a transaction hash", async () => {
|
|
916
|
+
const { budget, erc20 } = budgets;
|
|
917
|
+
|
|
918
|
+
// set referral fee
|
|
919
|
+
const referralFee = 500n;
|
|
920
|
+
await fixtures.core.setReferralFee(referralFee);
|
|
921
|
+
|
|
922
|
+
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
923
|
+
const referrer = accounts.at(1)!.account!;
|
|
924
|
+
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
925
|
+
const trustedSigner = accounts.at(0)!;
|
|
926
|
+
const erc20Incentive = fixtures.core.ERC20Incentive({
|
|
927
|
+
asset: erc20.assertValidAddress(),
|
|
928
|
+
strategy: StrategyType.POOL,
|
|
929
|
+
reward: parseEther('1'),
|
|
930
|
+
limit: 1n,
|
|
931
|
+
manager: budget.assertValidAddress(),
|
|
932
|
+
});
|
|
933
|
+
const boost = await freshBoostWithV2Validator(fixtures, {
|
|
934
|
+
budget,
|
|
935
|
+
incentives: [erc20Incentive],
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
const claimant = trustedSigner.account;
|
|
939
|
+
const incentiveData = pad("0xdef456232173821931823712381232131391321934");
|
|
940
|
+
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
941
|
+
signer: trustedSigner,
|
|
942
|
+
incentiveData,
|
|
943
|
+
chainId: defaultOptions.config.chains[0].id,
|
|
944
|
+
incentiveQuantity: boost.incentives.length,
|
|
945
|
+
claimant,
|
|
946
|
+
boostId: boost.id,
|
|
947
|
+
referrer,
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
const referrerInitBalance = await erc20.balanceOf(referrer);
|
|
951
|
+
|
|
952
|
+
const { hash } = await fixtures.core.claimIncentiveRaw(
|
|
953
|
+
boost.id,
|
|
954
|
+
0n,
|
|
955
|
+
referrer,
|
|
956
|
+
claimDataPayload,
|
|
957
|
+
);
|
|
958
|
+
|
|
959
|
+
const referrerFinalBalance = await erc20.balanceOf(referrer);
|
|
897
960
|
const claimInfo = await fixtures.core.getClaimFromTransaction({ hash });
|
|
898
961
|
expect(claimInfo).toBeDefined();
|
|
899
962
|
expect(claimInfo?.claimant).toBe(claimant);
|
|
900
963
|
expect(typeof claimInfo?.boostId).toBe("bigint");
|
|
901
964
|
expect(claimInfo?.referrer).toBe(referrer);
|
|
965
|
+
expect(referrerFinalBalance - referrerInitBalance).toBe(parseEther('1') * referralFee / 10_000n);
|
|
902
966
|
});
|
|
903
967
|
|
|
904
968
|
test("can calculate an incentive's protocol fee ahead of creation time", async () => {
|
|
@@ -1288,7 +1352,7 @@ describe("ERC20PeggedVariableCriteriaIncentive Top-Ups", () => {
|
|
|
1288
1352
|
});
|
|
1289
1353
|
});
|
|
1290
1354
|
|
|
1291
|
-
describe("ERC20PeggedVariableCriteriaIncentive with
|
|
1355
|
+
describe("ERC20PeggedVariableCriteriaIncentive with LimitedSignerValidatorV2", () => {
|
|
1292
1356
|
beforeAll(async () => {
|
|
1293
1357
|
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
1294
1358
|
});
|
|
@@ -1355,6 +1419,7 @@ describe("ERC20PeggedVariableCriteriaIncentive with LimitedSignerValidator", ()
|
|
|
1355
1419
|
incentiveQuantity: boost.incentives.length,
|
|
1356
1420
|
claimant,
|
|
1357
1421
|
boostId: boost.id,
|
|
1422
|
+
referrer,
|
|
1358
1423
|
});
|
|
1359
1424
|
|
|
1360
1425
|
// First claim should succeed
|
|
@@ -1368,6 +1433,7 @@ describe("ERC20PeggedVariableCriteriaIncentive with LimitedSignerValidator", ()
|
|
|
1368
1433
|
incentiveQuantity: boost.incentives.length,
|
|
1369
1434
|
claimant,
|
|
1370
1435
|
boostId: boost.id,
|
|
1436
|
+
referrer,
|
|
1371
1437
|
});
|
|
1372
1438
|
|
|
1373
1439
|
// Second claim should fail due to validator limit (specific error code)
|
package/src/BoostCore.ts
CHANGED
|
@@ -6,12 +6,14 @@ import {
|
|
|
6
6
|
readBoostCoreGetIncentiveFeesInfo,
|
|
7
7
|
readBoostCoreProtocolFee,
|
|
8
8
|
readBoostCoreProtocolFeeReceiver,
|
|
9
|
+
readBoostCoreReferralFee,
|
|
9
10
|
readIAuthIsAuthorized,
|
|
10
11
|
simulateBoostCoreClaimIncentive,
|
|
11
12
|
simulateBoostCoreClaimIncentiveFor,
|
|
12
13
|
simulateBoostCoreCreateBoost,
|
|
13
14
|
simulateBoostCoreSetCreateBoostAuth,
|
|
14
15
|
simulateBoostCoreSetProtocolFeeReceiver,
|
|
16
|
+
simulateBoostCoreSetReferralFee,
|
|
15
17
|
simulateBoostCoreTopupIncentiveFromBudget,
|
|
16
18
|
simulateBoostCoreTopupIncentiveFromSender,
|
|
17
19
|
simulateTransparentBudgetCreateBoost,
|
|
@@ -22,6 +24,7 @@ import {
|
|
|
22
24
|
writeBoostCoreCreateBoost,
|
|
23
25
|
writeBoostCoreSetCreateBoostAuth,
|
|
24
26
|
writeBoostCoreSetProtocolFeeReceiver,
|
|
27
|
+
writeBoostCoreSetReferralFee,
|
|
25
28
|
writeBoostCoreTopupIncentiveFromBudget,
|
|
26
29
|
writeBoostCoreTopupIncentiveFromSender,
|
|
27
30
|
writeTransparentBudgetCreateBoost,
|
|
@@ -134,14 +137,26 @@ import {
|
|
|
134
137
|
LimitedSignerValidator,
|
|
135
138
|
type LimitedSignerValidatorPayload,
|
|
136
139
|
} from './Validators/LimitedSignerValidator';
|
|
140
|
+
import {
|
|
141
|
+
LimitedSignerValidatorV2,
|
|
142
|
+
type LimitedSignerValidatorV2Payload,
|
|
143
|
+
} from './Validators/LimitedSignerValidatorV2';
|
|
137
144
|
import {
|
|
138
145
|
PayableLimitedSignerValidator,
|
|
139
146
|
type PayableLimitedSignerValidatorPayload,
|
|
140
147
|
} from './Validators/PayableLimitedSignerValidator';
|
|
148
|
+
import {
|
|
149
|
+
PayableLimitedSignerValidatorV2,
|
|
150
|
+
type PayableLimitedSignerValidatorV2Payload,
|
|
151
|
+
} from './Validators/PayableLimitedSignerValidatorV2';
|
|
141
152
|
import {
|
|
142
153
|
SignerValidator,
|
|
143
154
|
type SignerValidatorPayload,
|
|
144
155
|
} from './Validators/SignerValidator';
|
|
156
|
+
import {
|
|
157
|
+
SignerValidatorV2,
|
|
158
|
+
type SignerValidatorV2Payload,
|
|
159
|
+
} from './Validators/SignerValidatorV2';
|
|
145
160
|
import {
|
|
146
161
|
BoostValidatorEOA,
|
|
147
162
|
type Validator,
|
|
@@ -900,7 +915,7 @@ export class BoostCore extends Deployable<
|
|
|
900
915
|
signers.push('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266');
|
|
901
916
|
}
|
|
902
917
|
|
|
903
|
-
payload.validator = this.
|
|
918
|
+
payload.validator = this.LimitedSignerValidatorV2({
|
|
904
919
|
signers,
|
|
905
920
|
validatorCaller: coreAddress,
|
|
906
921
|
maxClaimCount: 1,
|
|
@@ -1431,9 +1446,9 @@ export class BoostCore extends Deployable<
|
|
|
1431
1446
|
* @param {?WriteParams} [params]
|
|
1432
1447
|
* @returns {Promise<void>}
|
|
1433
1448
|
*/
|
|
1434
|
-
public async
|
|
1449
|
+
public async setProtocolFeeReceiver(address: Address, params?: WriteParams) {
|
|
1435
1450
|
return await this.awaitResult(
|
|
1436
|
-
this.
|
|
1451
|
+
this.setProtocolFeeReceiverRaw(address, {
|
|
1437
1452
|
...params,
|
|
1438
1453
|
}),
|
|
1439
1454
|
);
|
|
@@ -1448,7 +1463,10 @@ export class BoostCore extends Deployable<
|
|
|
1448
1463
|
* @param {?WriteParams} [params]
|
|
1449
1464
|
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
1450
1465
|
*/
|
|
1451
|
-
public async
|
|
1466
|
+
public async setProtocolFeeReceiverRaw(
|
|
1467
|
+
address: Address,
|
|
1468
|
+
params?: WriteParams,
|
|
1469
|
+
) {
|
|
1452
1470
|
const { request, result } = await simulateBoostCoreSetProtocolFeeReceiver(
|
|
1453
1471
|
this._config,
|
|
1454
1472
|
{
|
|
@@ -1470,6 +1488,73 @@ export class BoostCore extends Deployable<
|
|
|
1470
1488
|
return { hash, result };
|
|
1471
1489
|
}
|
|
1472
1490
|
|
|
1491
|
+
/**
|
|
1492
|
+
* Get the referral fee.
|
|
1493
|
+
*
|
|
1494
|
+
* @public
|
|
1495
|
+
* @async
|
|
1496
|
+
* @param {?ReadParams} [params]
|
|
1497
|
+
* @returns {unknown}
|
|
1498
|
+
*/
|
|
1499
|
+
public async referralFee(params?: ReadParams) {
|
|
1500
|
+
return await readBoostCoreReferralFee(this._config, {
|
|
1501
|
+
...assertValidAddressByChainId(
|
|
1502
|
+
this._config,
|
|
1503
|
+
this.addresses,
|
|
1504
|
+
params?.chainId,
|
|
1505
|
+
),
|
|
1506
|
+
args: [],
|
|
1507
|
+
...this.optionallyAttachAccount(),
|
|
1508
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
1509
|
+
...(params as any),
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* Set the referral fee. This function is only callable by the owner.
|
|
1515
|
+
*
|
|
1516
|
+
* @public
|
|
1517
|
+
* @async
|
|
1518
|
+
* @param {bigint} fee
|
|
1519
|
+
* @param {?WriteParams} [params]
|
|
1520
|
+
* @returns {Promise<void>}
|
|
1521
|
+
*/
|
|
1522
|
+
public async setReferralFee(fee: bigint, params?: WriteParams) {
|
|
1523
|
+
return await this.awaitResult(
|
|
1524
|
+
this.setReferralFeeRaw(fee, {
|
|
1525
|
+
...params,
|
|
1526
|
+
}),
|
|
1527
|
+
);
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* Set the referral fee. This function is only callable by the owner.
|
|
1532
|
+
*
|
|
1533
|
+
* @public
|
|
1534
|
+
* @async
|
|
1535
|
+
* @param {bigint} fee
|
|
1536
|
+
* @param {?WriteParams} [params]
|
|
1537
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
1538
|
+
*/
|
|
1539
|
+
public async setReferralFeeRaw(fee: bigint, params?: WriteParams) {
|
|
1540
|
+
const { request, result } = await simulateBoostCoreSetReferralFee(
|
|
1541
|
+
this._config,
|
|
1542
|
+
{
|
|
1543
|
+
...assertValidAddressByChainId(
|
|
1544
|
+
this._config,
|
|
1545
|
+
this.addresses,
|
|
1546
|
+
params?.chainId,
|
|
1547
|
+
),
|
|
1548
|
+
args: [fee],
|
|
1549
|
+
...this.optionallyAttachAccount(),
|
|
1550
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
1551
|
+
...(params as any),
|
|
1552
|
+
},
|
|
1553
|
+
);
|
|
1554
|
+
const hash = await writeBoostCoreSetReferralFee(this._config, request);
|
|
1555
|
+
return { hash, result };
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1473
1558
|
/**
|
|
1474
1559
|
* Get the incentives fees information for a given Boost ID and Incentive ID.
|
|
1475
1560
|
*
|
|
@@ -1983,7 +2068,10 @@ export class BoostCore extends Deployable<
|
|
|
1983
2068
|
options,
|
|
1984
2069
|
);
|
|
1985
2070
|
}
|
|
2071
|
+
|
|
1986
2072
|
/**
|
|
2073
|
+
* @deprecated Use {@link SignerValidatorV2} instead.
|
|
2074
|
+
*
|
|
1987
2075
|
* Bound {@link SignerValidator} constructor that reuses the same configuration as the Boost Core instance.
|
|
1988
2076
|
*
|
|
1989
2077
|
* @example
|
|
@@ -2007,6 +2095,8 @@ export class BoostCore extends Deployable<
|
|
|
2007
2095
|
}
|
|
2008
2096
|
|
|
2009
2097
|
/**
|
|
2098
|
+
* @deprecated Use {@link LimitedSignerValidatorV2} instead.
|
|
2099
|
+
*
|
|
2010
2100
|
* Bound {@link LimitedSignerValidator} constructor that reuses the same configuration as the Boost Core instance.
|
|
2011
2101
|
*
|
|
2012
2102
|
* @example
|
|
@@ -2030,6 +2120,8 @@ export class BoostCore extends Deployable<
|
|
|
2030
2120
|
}
|
|
2031
2121
|
|
|
2032
2122
|
/**
|
|
2123
|
+
* @deprecated Use {@link PayableLimitedSignerValidatorV2} instead.
|
|
2124
|
+
*
|
|
2033
2125
|
* Bound {@link PayableLimitedSignerValidator} constructor that reuses the same configuration as the Boost Core instance.
|
|
2034
2126
|
*
|
|
2035
2127
|
* @example
|
|
@@ -2052,6 +2144,75 @@ export class BoostCore extends Deployable<
|
|
|
2052
2144
|
);
|
|
2053
2145
|
}
|
|
2054
2146
|
|
|
2147
|
+
/**
|
|
2148
|
+
* Bound {@link SignerValidatorV2} constructor that reuses the same configuration as the Boost Core instance.
|
|
2149
|
+
*
|
|
2150
|
+
* @example
|
|
2151
|
+
* ```ts
|
|
2152
|
+
* const validator = core.SignerValidatorV2({ ... }) // is roughly equivalent to
|
|
2153
|
+
* const validator = new SignerValidatorV2({ config: core._config, account: core._account }, { ... })
|
|
2154
|
+
* ```
|
|
2155
|
+
* @param {DeployablePayloadOrAddress<SignerValidatorV2Payload>} options
|
|
2156
|
+
* @param {?boolean} [isBase]
|
|
2157
|
+
* @returns {SignerValidatorV2}
|
|
2158
|
+
*/
|
|
2159
|
+
SignerValidatorV2(
|
|
2160
|
+
options: DeployablePayloadOrAddress<SignerValidatorV2Payload>,
|
|
2161
|
+
isBase?: boolean,
|
|
2162
|
+
) {
|
|
2163
|
+
return new SignerValidatorV2(
|
|
2164
|
+
{ config: this._config, account: this._account },
|
|
2165
|
+
options,
|
|
2166
|
+
isBase,
|
|
2167
|
+
);
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
/**
|
|
2171
|
+
* Bound {@link LimitedSignerValidatorV2} constructor that reuses the same configuration as the Boost Core instance.
|
|
2172
|
+
*
|
|
2173
|
+
* @example
|
|
2174
|
+
* ```ts
|
|
2175
|
+
* const validator = core.LimitedSignerValidatorV2({ ... }) // is roughly equivalent to
|
|
2176
|
+
* const validator = new LimitedSignerValidatorV2({ config: core._config, account: core._account }, { ... })
|
|
2177
|
+
* ```
|
|
2178
|
+
* @param {DeployablePayloadOrAddress<LimitedSignerValidatorV2Payload>} options
|
|
2179
|
+
* @param {?boolean} [isBase]
|
|
2180
|
+
* @returns {LimitedSignerValidatorV2}
|
|
2181
|
+
*/
|
|
2182
|
+
LimitedSignerValidatorV2(
|
|
2183
|
+
options: DeployablePayloadOrAddress<LimitedSignerValidatorV2Payload>,
|
|
2184
|
+
isBase?: boolean,
|
|
2185
|
+
) {
|
|
2186
|
+
return new LimitedSignerValidatorV2(
|
|
2187
|
+
{ config: this._config, account: this._account },
|
|
2188
|
+
options,
|
|
2189
|
+
isBase,
|
|
2190
|
+
);
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
/**
|
|
2194
|
+
* Bound {@link PayableLimitedSignerValidatorV2} constructor that reuses the same configuration as the Boost Core instance.
|
|
2195
|
+
*
|
|
2196
|
+
* @example
|
|
2197
|
+
* ```ts
|
|
2198
|
+
* const validator = core.PayableLimitedSignerValidatorV2({ ... }) // is roughly equivalent to
|
|
2199
|
+
* const validator = new PayableLimitedSignerValidatorV2({ config: core._config, account: core._account }, { ... })
|
|
2200
|
+
* ```
|
|
2201
|
+
* @param {DeployablePayloadOrAddress<PayableLimitedSignerValidatorV2Payload>} options
|
|
2202
|
+
* @param {?boolean} [isBase]
|
|
2203
|
+
* @returns {PayableLimitedSignerValidatorV2}
|
|
2204
|
+
*/
|
|
2205
|
+
PayableLimitedSignerValidatorV2(
|
|
2206
|
+
options: DeployablePayloadOrAddress<PayableLimitedSignerValidatorV2Payload>,
|
|
2207
|
+
isBase?: boolean,
|
|
2208
|
+
) {
|
|
2209
|
+
return new PayableLimitedSignerValidatorV2(
|
|
2210
|
+
{ config: this._config, account: this._account },
|
|
2211
|
+
options,
|
|
2212
|
+
isBase ?? false,
|
|
2213
|
+
);
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2055
2216
|
/**
|
|
2056
2217
|
* Bound {@link ERC20VariableCriteriaIncentiveV2} constructor that reuses the same configuration as the Boost Core instance.
|
|
2057
2218
|
*
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
freshManagedBudgetWithFees,
|
|
13
13
|
fundErc20,
|
|
14
14
|
fundErc1155,
|
|
15
|
-
|
|
15
|
+
freshBoostWithV1Validator,
|
|
16
|
+
freshBoostWithV2Validator,
|
|
16
17
|
fundManagedBudgetWithFees,
|
|
17
18
|
} from "@boostxyz/test/helpers";
|
|
18
19
|
import { testAccount } from "@boostxyz/test/viem";
|
|
@@ -199,7 +200,6 @@ describe("ManagedBudgetWithFees", () => {
|
|
|
199
200
|
});
|
|
200
201
|
|
|
201
202
|
test("to a fee-compatible incentive", async () => {
|
|
202
|
-
|
|
203
203
|
const reward = 1_000_000_000n;
|
|
204
204
|
const fee = await budget.managementFee();
|
|
205
205
|
const erc20Incentive = fixtures.core.ERC20Incentive({
|
|
@@ -210,7 +210,7 @@ describe("ManagedBudgetWithFees", () => {
|
|
|
210
210
|
manager: budget.assertValidAddress(),
|
|
211
211
|
});
|
|
212
212
|
await budget.grantRoles(fixtures.core.assertValidAddress(), Roles.MANAGER);
|
|
213
|
-
const boost = await
|
|
213
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
214
214
|
budget: budget,
|
|
215
215
|
incentives: [erc20Incentive],
|
|
216
216
|
});
|
|
@@ -226,20 +226,21 @@ describe("ManagedBudgetWithFees", () => {
|
|
|
226
226
|
claimant,
|
|
227
227
|
boostId: boost.id,
|
|
228
228
|
});
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
229
|
+
await fixtures.core.claimIncentive(
|
|
230
|
+
boost.id,
|
|
231
|
+
0n,
|
|
232
|
+
trustedSigner.account,
|
|
233
|
+
claimDataPayload,
|
|
234
|
+
);
|
|
235
|
+
let originalBalance = await erc20.balanceOf(accounts[0].account);
|
|
236
236
|
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
await budget.payManagementFee(boost.id, 0n);
|
|
238
|
+
let balance = await erc20.balanceOf(accounts[0].account);
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
expect(balance - originalBalance).toBe(reward*fee/10_000n);
|
|
241
241
|
})
|
|
242
242
|
|
|
243
|
+
|
|
243
244
|
test("native assets", async () => {
|
|
244
245
|
const originalAmount = await budget.available();
|
|
245
246
|
const disbursalAmount = parseEther("0.5");
|
|
@@ -250,7 +251,6 @@ describe("ManagedBudgetWithFees", () => {
|
|
|
250
251
|
target: defaultOptions.account.address,
|
|
251
252
|
});
|
|
252
253
|
|
|
253
|
-
|
|
254
254
|
expect(await budget.available()).toBe(originalAmount - disbursalAmount - disbursalAmount*fee / 10_000n);
|
|
255
255
|
});
|
|
256
256
|
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
freshManagedBudgetWithFeesV2,
|
|
13
13
|
fundErc20,
|
|
14
14
|
fundErc1155,
|
|
15
|
-
|
|
15
|
+
freshBoostWithV1Validator,
|
|
16
16
|
fundManagedBudgetWithFeesV2,
|
|
17
17
|
} from "@boostxyz/test/helpers";
|
|
18
18
|
import { testAccount } from "@boostxyz/test/viem";
|
|
@@ -210,7 +210,7 @@ describe("ManagedBudgetWithFeesV2", () => {
|
|
|
210
210
|
manager: budget.assertValidAddress(),
|
|
211
211
|
});
|
|
212
212
|
await budget.grantRoles(fixtures.core.assertValidAddress(), Roles.MANAGER);
|
|
213
|
-
const boost = await
|
|
213
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
214
214
|
budget: budget,
|
|
215
215
|
incentives: [erc20Incentive],
|
|
216
216
|
});
|
|
@@ -252,7 +252,7 @@ describe("ManagedBudgetWithFeesV2", () => {
|
|
|
252
252
|
manager: budget.assertValidAddress(),
|
|
253
253
|
});
|
|
254
254
|
await budget.grantRoles(fixtures.core.assertValidAddress(), Roles.MANAGER);
|
|
255
|
-
const boost = await
|
|
255
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
256
256
|
budget: budget,
|
|
257
257
|
incentives: [erc20Incentive],
|
|
258
258
|
});
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
type Fixtures,
|
|
4
4
|
defaultOptions,
|
|
5
5
|
deployFixtures,
|
|
6
|
-
|
|
6
|
+
freshBoostWithV1Validator,
|
|
7
7
|
} from "@boostxyz/test/helpers";
|
|
8
8
|
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
9
9
|
import { isAddress, pad, parseEther, zeroAddress } from "viem";
|
|
@@ -55,7 +55,7 @@ describe("AllowListIncentive", () => {
|
|
|
55
55
|
limit: 3n,
|
|
56
56
|
},
|
|
57
57
|
);
|
|
58
|
-
const boost = await
|
|
58
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
59
59
|
incentives: [allowListIncentive],
|
|
60
60
|
});
|
|
61
61
|
await allowList.grantManyRoles(
|
|
@@ -100,7 +100,7 @@ describe("AllowListIncentive", () => {
|
|
|
100
100
|
limit: 1n,
|
|
101
101
|
},
|
|
102
102
|
);
|
|
103
|
-
const boost = await
|
|
103
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
104
104
|
incentives: [allowListIncentive],
|
|
105
105
|
});
|
|
106
106
|
await allowList.grantManyRoles(
|
|
@@ -148,7 +148,7 @@ describe("AllowListIncentive", () => {
|
|
|
148
148
|
limit: 3n,
|
|
149
149
|
},
|
|
150
150
|
);
|
|
151
|
-
const boost = await
|
|
151
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
152
152
|
incentives: [allowListIncentive],
|
|
153
153
|
});
|
|
154
154
|
await allowList.grantManyRoles(
|
|
@@ -199,7 +199,7 @@ describe("AllowListIncentive", () => {
|
|
|
199
199
|
limit: 1n,
|
|
200
200
|
},
|
|
201
201
|
);
|
|
202
|
-
const boost = await
|
|
202
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
203
203
|
incentives: [allowListIncentive],
|
|
204
204
|
});
|
|
205
205
|
await allowList.grantManyRoles(
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type Fixtures,
|
|
6
6
|
defaultOptions,
|
|
7
7
|
deployFixtures,
|
|
8
|
-
|
|
8
|
+
freshBoostWithV1Validator,
|
|
9
9
|
fundBudget,
|
|
10
10
|
} from "@boostxyz/test/helpers";
|
|
11
11
|
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
|
@@ -51,7 +51,7 @@ describe("CGDAIncentive", () => {
|
|
|
51
51
|
rewardDecay: 1n,
|
|
52
52
|
manager: budgets.budget.assertValidAddress(),
|
|
53
53
|
});
|
|
54
|
-
const boost = await
|
|
54
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
55
55
|
budget: budgets.budget,
|
|
56
56
|
incentives: [erc20Incentive],
|
|
57
57
|
});
|
|
@@ -96,7 +96,7 @@ describe("CGDAIncentive", () => {
|
|
|
96
96
|
rewardDecay: 1n,
|
|
97
97
|
manager: budgets.budget.assertValidAddress(),
|
|
98
98
|
});
|
|
99
|
-
const boost = await
|
|
99
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
100
100
|
budget: budgets.budget,
|
|
101
101
|
incentives: [erc20Incentive],
|
|
102
102
|
});
|
|
@@ -141,7 +141,7 @@ describe("CGDAIncentive", () => {
|
|
|
141
141
|
rewardDecay: 1n,
|
|
142
142
|
manager: budgets.budget.address || zeroAddress,
|
|
143
143
|
});
|
|
144
|
-
const boost = await
|
|
144
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
145
145
|
budget: budgets.budget,
|
|
146
146
|
incentives: [erc20Incentive],
|
|
147
147
|
});
|
|
@@ -194,7 +194,7 @@ describe("CGDAIncentive", () => {
|
|
|
194
194
|
rewardDecay: 1n,
|
|
195
195
|
manager: budgets.budget.assertValidAddress(),
|
|
196
196
|
});
|
|
197
|
-
const boost = await
|
|
197
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
198
198
|
budget: budgets.budget,
|
|
199
199
|
incentives: [cgdaIncentive],
|
|
200
200
|
});
|
|
@@ -221,7 +221,7 @@ describe("CGDAIncentive", () => {
|
|
|
221
221
|
rewardDecay: 1n,
|
|
222
222
|
manager: budgets.budget.assertValidAddress(),
|
|
223
223
|
});
|
|
224
|
-
const boost = await
|
|
224
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
225
225
|
budget: budgets.budget,
|
|
226
226
|
incentives: [cgdaIncentive],
|
|
227
227
|
});
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type Fixtures,
|
|
9
9
|
defaultOptions,
|
|
10
10
|
deployFixtures,
|
|
11
|
-
|
|
11
|
+
freshBoostWithV1Validator,
|
|
12
12
|
fundBudget,
|
|
13
13
|
} from "@boostxyz/test/helpers";
|
|
14
14
|
import { ERC1155Incentive, ERC1155StrategyType } from "./ERC1155Incentive";
|
|
@@ -53,7 +53,7 @@ describe.skip("ERC1155Incentive", () => {
|
|
|
53
53
|
extraData: zeroHash,
|
|
54
54
|
},
|
|
55
55
|
);
|
|
56
|
-
const boost = await
|
|
56
|
+
const boost = await freshBoostWithV1Validator(fixtures, {
|
|
57
57
|
budget: budgets.budget,
|
|
58
58
|
incentives: [erc1155Incentive],
|
|
59
59
|
});
|