@boostxyz/sdk 1.1.0-alpha.22 → 1.1.0-alpha.23
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.cjs.map +1 -1
- package/dist/Actions/Action.js +6 -6
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +9 -6
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +820 -15
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +2 -2
- package/dist/AllowLists/OpenAllowList.d.ts +28 -28
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +28 -28
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +11 -10
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +28 -28
- 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-Btl5BdAs.cjs +3 -0
- package/dist/BoostCore-Btl5BdAs.cjs.map +1 -0
- package/dist/{BoostCore-BVZExPPu.js → BoostCore-CD56zbYX.js} +1678 -499
- package/dist/BoostCore-CD56zbYX.js.map +1 -0
- package/dist/BoostCore.cjs +1 -1
- package/dist/BoostCore.d.ts +7 -7
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +6 -6
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts +6 -6
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +50 -50
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +28 -28
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +30 -29
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +28 -28
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- 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.cjs.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +92 -23
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +145 -47
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -1
- package/dist/{Incentive-BhHaK3PZ.cjs → Incentive-CcnOIc8L.cjs} +2 -2
- package/dist/{Incentive-BhHaK3PZ.cjs.map → Incentive-CcnOIc8L.cjs.map} +1 -1
- package/dist/{Incentive-Cqg1w6wD.js → Incentive-rM5nKznp.js} +30 -29
- package/dist/{Incentive-Cqg1w6wD.js.map → Incentive-rM5nKznp.js.map} +1 -1
- 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 +11 -10
- 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 +28 -28
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +12 -11
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +28 -28
- 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 +34 -31
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +30 -27
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +28 -28
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +28 -28
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.js +2 -2
- 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 +12 -11
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-CGaWjuld.js → SimpleDenyList-BDXpY74P.js} +18 -17
- package/dist/SimpleDenyList-BDXpY74P.js.map +1 -0
- package/dist/{SimpleDenyList-BUR17Tt1.cjs → SimpleDenyList-DNj5qDWM.cjs} +2 -2
- package/dist/SimpleDenyList-DNj5qDWM.cjs.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 +13 -12
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/deployments-DF_6-7hH.cjs +2 -0
- package/dist/deployments-DF_6-7hH.cjs.map +1 -0
- package/dist/deployments-fJsWblwS.js +56 -0
- package/dist/deployments-fJsWblwS.js.map +1 -0
- package/dist/deployments.json +26 -12
- package/dist/{generated-CKt2yCQd.js → generated-CsNyWPKA.js} +458 -443
- package/dist/generated-CsNyWPKA.js.map +1 -0
- package/dist/generated-DHerxf1y.cjs +3 -0
- package/dist/generated-DHerxf1y.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +33 -33
- package/package.json +4 -4
- package/src/Actions/EventAction.test.ts +19 -13
- package/src/Actions/EventAction.ts +16 -35
- package/src/AllowLists/SimpleAllowList.ts +1 -0
- package/src/AllowLists/SimpleDenyList.ts +1 -0
- package/src/BoostCore.test.ts +78 -78
- package/src/BoostCore.ts +19 -13
- package/src/BoostRegistry.ts +10 -10
- package/src/Budgets/ManagedBudget.test.ts +41 -17
- package/src/Budgets/ManagedBudget.ts +1 -11
- package/src/Budgets/VestingBudget.ts +3 -1
- package/src/Deployable/DeployableTargetWithRBAC.test.ts +103 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +160 -36
- package/src/Incentives/AllowListIncentive.test.ts +7 -7
- package/src/Incentives/AllowListIncentive.ts +1 -0
- package/src/Incentives/CGDAIncentive.ts +1 -0
- package/src/Incentives/ERC1155Incentive.ts +3 -1
- package/src/Incentives/ERC20Incentive.ts +10 -3
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +1 -0
- package/src/Incentives/ERC20VariableIncentive.ts +1 -0
- package/src/Incentives/PointsIncentive.ts +1 -0
- package/src/Validators/SignerValidator.ts +1 -0
- package/dist/BoostCore-BVZExPPu.js.map +0 -1
- package/dist/BoostCore-D-E-cnGI.cjs +0 -3
- package/dist/BoostCore-D-E-cnGI.cjs.map +0 -1
- package/dist/EventAction-BZt5cjbe.cjs +0 -2
- package/dist/EventAction-BZt5cjbe.cjs.map +0 -1
- package/dist/EventAction-C_-hJXWm.js +0 -1541
- package/dist/EventAction-C_-hJXWm.js.map +0 -1
- package/dist/SimpleDenyList-BUR17Tt1.cjs.map +0 -1
- package/dist/SimpleDenyList-CGaWjuld.js.map +0 -1
- package/dist/deployments-DVXioW2i.cjs +0 -2
- package/dist/deployments-DVXioW2i.cjs.map +0 -1
- package/dist/deployments-oykLv3_Z.js +0 -43
- package/dist/deployments-oykLv3_Z.js.map +0 -1
- package/dist/generated-CKt2yCQd.js.map +0 -1
- package/dist/generated-CyTNlOwM.cjs +0 -3
- package/dist/generated-CyTNlOwM.cjs.map +0 -1
package/src/BoostCore.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { accounts } from
|
|
1
|
+
import { accounts } from "@boostxyz/test/accounts";
|
|
2
2
|
import {
|
|
3
3
|
type BudgetFixtures,
|
|
4
4
|
type Fixtures,
|
|
@@ -7,20 +7,20 @@ import {
|
|
|
7
7
|
freshBoost,
|
|
8
8
|
fundBudget,
|
|
9
9
|
makeMockEventActionPayload,
|
|
10
|
-
} from
|
|
11
|
-
import { loadFixture } from
|
|
12
|
-
import { pad, parseEther, zeroAddress } from
|
|
13
|
-
import { beforeAll, beforeEach, describe, expect, test, vi } from
|
|
14
|
-
import { ContractAction } from
|
|
15
|
-
import { BOOST_CORE_CLAIM_FEE } from
|
|
16
|
-
import type { ERC20Incentive } from
|
|
17
|
-
import { StrategyType } from
|
|
18
|
-
import { BoostNotFoundError, IncentiveNotCloneableError } from
|
|
19
|
-
import { bytes4 } from
|
|
10
|
+
} from "@boostxyz/test/helpers";
|
|
11
|
+
import { loadFixture } from "@nomicfoundation/hardhat-toolbox-viem/network-helpers";
|
|
12
|
+
import { pad, parseEther, zeroAddress } from "viem";
|
|
13
|
+
import { beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
|
|
14
|
+
import { ContractAction } from "./Actions/ContractAction";
|
|
15
|
+
import { BOOST_CORE_CLAIM_FEE } from "./BoostCore";
|
|
16
|
+
import type { ERC20Incentive } from "./Incentives/ERC20Incentive";
|
|
17
|
+
import { StrategyType } from "./claiming";
|
|
18
|
+
import { BoostNotFoundError, IncentiveNotCloneableError } from "./errors";
|
|
19
|
+
import { bytes4 } from "./utils";
|
|
20
20
|
|
|
21
21
|
let fixtures: Fixtures, budgets: BudgetFixtures;
|
|
22
22
|
|
|
23
|
-
describe(
|
|
23
|
+
describe("BoostCore", () => {
|
|
24
24
|
beforeAll(async () => {
|
|
25
25
|
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
26
26
|
});
|
|
@@ -28,13 +28,13 @@ describe('BoostCore', () => {
|
|
|
28
28
|
budgets = await loadFixture(fundBudget(defaultOptions, fixtures));
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
test(
|
|
31
|
+
test("can get the total number of boosts", async () => {
|
|
32
32
|
const { core } = fixtures;
|
|
33
33
|
|
|
34
34
|
const { budget, erc20 } = budgets;
|
|
35
35
|
await core.createBoost({
|
|
36
36
|
protocolFee: 0n,
|
|
37
|
-
maxParticipants:
|
|
37
|
+
maxParticipants: 5n,
|
|
38
38
|
budget: budget,
|
|
39
39
|
action: core.EventAction(
|
|
40
40
|
makeMockEventActionPayload(
|
|
@@ -53,8 +53,8 @@ describe('BoostCore', () => {
|
|
|
53
53
|
incentives: [
|
|
54
54
|
core.ERC20Incentive({
|
|
55
55
|
asset: erc20.assertValidAddress(),
|
|
56
|
-
reward: parseEther(
|
|
57
|
-
limit:
|
|
56
|
+
reward: parseEther("1"),
|
|
57
|
+
limit: 5n,
|
|
58
58
|
strategy: StrategyType.POOL,
|
|
59
59
|
manager: budget.assertValidAddress(),
|
|
60
60
|
}),
|
|
@@ -63,17 +63,17 @@ describe('BoostCore', () => {
|
|
|
63
63
|
expect(await core.getBoostCount()).toBe(1n);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
test(
|
|
66
|
+
test("throws a typed error if no boost exists", async () => {
|
|
67
67
|
const { core } = fixtures;
|
|
68
68
|
try {
|
|
69
|
-
await core.getBoost(1000n)
|
|
70
|
-
} catch(e) {
|
|
71
|
-
expect(e instanceof BoostNotFoundError).toBe(true)
|
|
72
|
-
expect(e.id).toBe(
|
|
69
|
+
await core.getBoost(1000n);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
expect(e instanceof BoostNotFoundError).toBe(true);
|
|
72
|
+
expect(e.id).toBe("1000");
|
|
73
73
|
}
|
|
74
|
-
})
|
|
74
|
+
});
|
|
75
75
|
|
|
76
|
-
test(
|
|
76
|
+
test("can successfully create a boost using all base contract implementations", async () => {
|
|
77
77
|
const { core } = fixtures;
|
|
78
78
|
const { budget, erc20 } = budgets;
|
|
79
79
|
const boost = await core.createBoost({
|
|
@@ -97,7 +97,7 @@ describe('BoostCore', () => {
|
|
|
97
97
|
incentives: [
|
|
98
98
|
core.ERC20Incentive({
|
|
99
99
|
asset: erc20.assertValidAddress(),
|
|
100
|
-
reward: parseEther(
|
|
100
|
+
reward: parseEther("1"),
|
|
101
101
|
limit: 100n,
|
|
102
102
|
strategy: StrategyType.POOL,
|
|
103
103
|
manager: budget.assertValidAddress(),
|
|
@@ -117,7 +117,7 @@ describe('BoostCore', () => {
|
|
|
117
117
|
expect((await boost.action.target()).toLowerCase()).toBe(
|
|
118
118
|
core.assertValidAddress().toLowerCase(),
|
|
119
119
|
);
|
|
120
|
-
expect(await boost.action.selector()).toBe(
|
|
120
|
+
expect(await boost.action.selector()).toBe("0xdeadbeef");
|
|
121
121
|
expect(await boost.action.value()).toBe(0n);
|
|
122
122
|
|
|
123
123
|
expect(boost.validator.address?.toLowerCase()).toBe(
|
|
@@ -150,12 +150,12 @@ describe('BoostCore', () => {
|
|
|
150
150
|
expect((await incentive.asset()).toLowerCase()).toBe(
|
|
151
151
|
erc20.address?.toLowerCase(),
|
|
152
152
|
);
|
|
153
|
-
expect(await incentive.currentReward()).toBe(parseEther(
|
|
153
|
+
expect(await incentive.currentReward()).toBe(parseEther("1"));
|
|
154
154
|
expect(await incentive.limit()).toBe(100n);
|
|
155
155
|
expect(await incentive.claims()).toBe(0n);
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
test(
|
|
158
|
+
test("can read the raw on chain representation of a boost", async () => {
|
|
159
159
|
const { core } = fixtures;
|
|
160
160
|
const { budget, erc20 } = budgets;
|
|
161
161
|
const _boost = await core.createBoost({
|
|
@@ -179,7 +179,7 @@ describe('BoostCore', () => {
|
|
|
179
179
|
incentives: [
|
|
180
180
|
core.ERC20Incentive({
|
|
181
181
|
asset: erc20.assertValidAddress(),
|
|
182
|
-
reward: parseEther(
|
|
182
|
+
reward: parseEther("1"),
|
|
183
183
|
limit: 100n,
|
|
184
184
|
strategy: StrategyType.POOL,
|
|
185
185
|
manager: budget.assertValidAddress(),
|
|
@@ -198,7 +198,7 @@ describe('BoostCore', () => {
|
|
|
198
198
|
);
|
|
199
199
|
});
|
|
200
200
|
|
|
201
|
-
test(
|
|
201
|
+
test("can optionally supply a validator", async () => {
|
|
202
202
|
const { core } = fixtures;
|
|
203
203
|
const { budget, erc20 } = budgets;
|
|
204
204
|
const _boost = await core.createBoost({
|
|
@@ -218,7 +218,7 @@ describe('BoostCore', () => {
|
|
|
218
218
|
incentives: [
|
|
219
219
|
core.ERC20Incentive({
|
|
220
220
|
asset: erc20.assertValidAddress(),
|
|
221
|
-
reward: parseEther(
|
|
221
|
+
reward: parseEther("1"),
|
|
222
222
|
limit: 100n,
|
|
223
223
|
strategy: StrategyType.POOL,
|
|
224
224
|
manager: budget.assertValidAddress(),
|
|
@@ -229,7 +229,7 @@ describe('BoostCore', () => {
|
|
|
229
229
|
expect(boost.validator).toBe(_boost.validator.assertValidAddress());
|
|
230
230
|
});
|
|
231
231
|
|
|
232
|
-
test(
|
|
232
|
+
test("can simulate a boost creation", async () => {
|
|
233
233
|
const { core } = fixtures;
|
|
234
234
|
const { budget, erc20 } = budgets;
|
|
235
235
|
const simulated = await core.simulateCreateBoost({
|
|
@@ -249,25 +249,25 @@ describe('BoostCore', () => {
|
|
|
249
249
|
incentives: [
|
|
250
250
|
core.ERC20Incentive({
|
|
251
251
|
asset: erc20.assertValidAddress(),
|
|
252
|
-
reward: parseEther(
|
|
252
|
+
reward: parseEther("1"),
|
|
253
253
|
limit: 100n,
|
|
254
254
|
strategy: StrategyType.POOL,
|
|
255
255
|
manager: budget.assertValidAddress(),
|
|
256
256
|
}),
|
|
257
257
|
],
|
|
258
258
|
});
|
|
259
|
-
expect(simulated.request.__mode).toBe(
|
|
259
|
+
expect(simulated.request.__mode).toBe("prepared");
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
-
test(
|
|
262
|
+
test("can reuse an existing action", async () => {
|
|
263
263
|
const { core } = fixtures;
|
|
264
264
|
const { budget, erc20 } = budgets;
|
|
265
265
|
|
|
266
266
|
// allocate more funds to the budget
|
|
267
|
-
await erc20.mint(defaultOptions.account.address, parseEther(
|
|
268
|
-
await erc20.approve(budget.assertValidAddress(), parseEther(
|
|
267
|
+
await erc20.mint(defaultOptions.account.address, parseEther("110"));
|
|
268
|
+
await erc20.approve(budget.assertValidAddress(), parseEther("110"));
|
|
269
269
|
await budget.allocate({
|
|
270
|
-
amount: parseEther(
|
|
270
|
+
amount: parseEther("110"),
|
|
271
271
|
asset: erc20.assertValidAddress(),
|
|
272
272
|
target: defaultOptions.account.address,
|
|
273
273
|
});
|
|
@@ -291,7 +291,7 @@ describe('BoostCore', () => {
|
|
|
291
291
|
incentives: [
|
|
292
292
|
core.ERC20Incentive({
|
|
293
293
|
asset: erc20.assertValidAddress(),
|
|
294
|
-
reward: parseEther(
|
|
294
|
+
reward: parseEther("1"),
|
|
295
295
|
limit: 100n,
|
|
296
296
|
strategy: StrategyType.POOL,
|
|
297
297
|
manager: budget.assertValidAddress(),
|
|
@@ -312,7 +312,7 @@ describe('BoostCore', () => {
|
|
|
312
312
|
incentives: [
|
|
313
313
|
core.ERC20Incentive({
|
|
314
314
|
asset: erc20.assertValidAddress(),
|
|
315
|
-
reward: parseEther(
|
|
315
|
+
reward: parseEther("1"),
|
|
316
316
|
limit: 100n,
|
|
317
317
|
strategy: StrategyType.POOL,
|
|
318
318
|
manager: budget.assertValidAddress(),
|
|
@@ -323,15 +323,15 @@ describe('BoostCore', () => {
|
|
|
323
323
|
expect(onChainBoost.action).toBe(_boost.action.assertValidAddress());
|
|
324
324
|
});
|
|
325
325
|
|
|
326
|
-
test(
|
|
326
|
+
test("can reuse an existing validator", async () => {
|
|
327
327
|
const { core } = fixtures;
|
|
328
328
|
const { budget, erc20 } = budgets;
|
|
329
329
|
|
|
330
330
|
// allocate more erc20 funds to the budget from the owning accound
|
|
331
|
-
await erc20.mint(defaultOptions.account.address, parseEther(
|
|
332
|
-
await erc20.approve(budget.assertValidAddress(), parseEther(
|
|
331
|
+
await erc20.mint(defaultOptions.account.address, parseEther("110"));
|
|
332
|
+
await erc20.approve(budget.assertValidAddress(), parseEther("110"));
|
|
333
333
|
await budget.allocate({
|
|
334
|
-
amount: parseEther(
|
|
334
|
+
amount: parseEther("110"),
|
|
335
335
|
asset: erc20.assertValidAddress(),
|
|
336
336
|
target: defaultOptions.account.address,
|
|
337
337
|
});
|
|
@@ -355,7 +355,7 @@ describe('BoostCore', () => {
|
|
|
355
355
|
incentives: [
|
|
356
356
|
core.ERC20Incentive({
|
|
357
357
|
asset: erc20.assertValidAddress(),
|
|
358
|
-
reward: parseEther(
|
|
358
|
+
reward: parseEther("1"),
|
|
359
359
|
limit: 100n,
|
|
360
360
|
strategy: StrategyType.POOL,
|
|
361
361
|
manager: budget.assertValidAddress(),
|
|
@@ -381,7 +381,7 @@ describe('BoostCore', () => {
|
|
|
381
381
|
incentives: [
|
|
382
382
|
core.ERC20Incentive({
|
|
383
383
|
asset: erc20.assertValidAddress(),
|
|
384
|
-
reward: parseEther(
|
|
384
|
+
reward: parseEther("1"),
|
|
385
385
|
limit: 100n,
|
|
386
386
|
strategy: StrategyType.POOL,
|
|
387
387
|
manager: budget.assertValidAddress(),
|
|
@@ -392,15 +392,15 @@ describe('BoostCore', () => {
|
|
|
392
392
|
expect(onChainBoost.validator).toBe(_boost.validator.assertValidAddress());
|
|
393
393
|
});
|
|
394
394
|
|
|
395
|
-
test(
|
|
395
|
+
test("can reuse an existing allowlist", async () => {
|
|
396
396
|
const { core } = fixtures;
|
|
397
397
|
const { budget, erc20 } = budgets;
|
|
398
398
|
|
|
399
399
|
// allocate more erc20 funds to the budget from the owning accound
|
|
400
|
-
await erc20.mint(defaultOptions.account.address, parseEther(
|
|
401
|
-
await erc20.approve(budget.assertValidAddress(), parseEther(
|
|
400
|
+
await erc20.mint(defaultOptions.account.address, parseEther("110"));
|
|
401
|
+
await erc20.approve(budget.assertValidAddress(), parseEther("110"));
|
|
402
402
|
await budget.allocate({
|
|
403
|
-
amount: parseEther(
|
|
403
|
+
amount: parseEther("110"),
|
|
404
404
|
asset: erc20.assertValidAddress(),
|
|
405
405
|
target: defaultOptions.account.address,
|
|
406
406
|
});
|
|
@@ -424,7 +424,7 @@ describe('BoostCore', () => {
|
|
|
424
424
|
incentives: [
|
|
425
425
|
core.ERC20Incentive({
|
|
426
426
|
asset: erc20.assertValidAddress(),
|
|
427
|
-
reward: parseEther(
|
|
427
|
+
reward: parseEther("1"),
|
|
428
428
|
limit: 100n,
|
|
429
429
|
strategy: StrategyType.POOL,
|
|
430
430
|
manager: budget.assertValidAddress(),
|
|
@@ -450,7 +450,7 @@ describe('BoostCore', () => {
|
|
|
450
450
|
incentives: [
|
|
451
451
|
core.ERC20Incentive({
|
|
452
452
|
asset: erc20.assertValidAddress(),
|
|
453
|
-
reward: parseEther(
|
|
453
|
+
reward: parseEther("1"),
|
|
454
454
|
limit: 100n,
|
|
455
455
|
strategy: StrategyType.POOL,
|
|
456
456
|
manager: budget.assertValidAddress(),
|
|
@@ -461,25 +461,25 @@ describe('BoostCore', () => {
|
|
|
461
461
|
expect(onChainBoost.allowList).toBe(_boost.allowList.assertValidAddress());
|
|
462
462
|
});
|
|
463
463
|
|
|
464
|
-
test(
|
|
464
|
+
test("cannot reuse an existing incentive", async () => {
|
|
465
465
|
const { core } = fixtures;
|
|
466
466
|
const { budget, erc20 } = budgets;
|
|
467
467
|
|
|
468
468
|
// allocate more erc20 funds to the budget from the owning accound
|
|
469
|
-
await erc20.mint(defaultOptions.account.address, parseEther(
|
|
470
|
-
await erc20.approve(budget.assertValidAddress(), parseEther(
|
|
469
|
+
await erc20.mint(defaultOptions.account.address, parseEther("110"));
|
|
470
|
+
await erc20.approve(budget.assertValidAddress(), parseEther("110"));
|
|
471
471
|
await budget.allocate({
|
|
472
|
-
amount: parseEther(
|
|
472
|
+
amount: parseEther("110"),
|
|
473
473
|
asset: erc20.assertValidAddress(),
|
|
474
474
|
target: defaultOptions.account.address,
|
|
475
475
|
});
|
|
476
476
|
|
|
477
477
|
const incentive = core.ERC20Incentive({
|
|
478
478
|
asset: erc20.assertValidAddress(),
|
|
479
|
-
reward: parseEther(
|
|
479
|
+
reward: parseEther("1"),
|
|
480
480
|
limit: 100n,
|
|
481
481
|
strategy: StrategyType.POOL,
|
|
482
|
-
|
|
482
|
+
manager: budget.assertValidAddress(),
|
|
483
483
|
});
|
|
484
484
|
const _boost = await core.createBoost({
|
|
485
485
|
budget: budget,
|
|
@@ -523,11 +523,11 @@ describe('BoostCore', () => {
|
|
|
523
523
|
}
|
|
524
524
|
});
|
|
525
525
|
|
|
526
|
-
test(
|
|
526
|
+
test("can offer multiple incentives", async () => {
|
|
527
527
|
const { registry, core } = fixtures;
|
|
528
528
|
const { budget, erc20, points, erc1155 } = budgets;
|
|
529
529
|
const allowList = await registry.initialize(
|
|
530
|
-
|
|
530
|
+
"SharedAllowList",
|
|
531
531
|
core.SimpleAllowList({
|
|
532
532
|
owner: defaultOptions.account.address,
|
|
533
533
|
allowed: [defaultOptions.account.address],
|
|
@@ -562,7 +562,7 @@ describe('BoostCore', () => {
|
|
|
562
562
|
});
|
|
563
563
|
const pointsIncentive = core.PointsIncentive({
|
|
564
564
|
venue: points.assertValidAddress(),
|
|
565
|
-
selector: bytes4(
|
|
565
|
+
selector: bytes4("issue(address,uint256)"),
|
|
566
566
|
reward: 1n,
|
|
567
567
|
limit: 10n,
|
|
568
568
|
});
|
|
@@ -597,22 +597,22 @@ describe('BoostCore', () => {
|
|
|
597
597
|
);
|
|
598
598
|
expect(await cgdaIncentive.currentReward()).toEqual(1n);
|
|
599
599
|
expect(
|
|
600
|
-
await (
|
|
601
|
-
|
|
602
|
-
),
|
|
600
|
+
await (
|
|
601
|
+
await allowListIncentive.allowList()
|
|
602
|
+
).isAllowed(defaultOptions.account.address),
|
|
603
603
|
).toEqual(true);
|
|
604
604
|
expect(await pointsIncentive.reward()).toEqual(1n);
|
|
605
605
|
expect(await pointsIncentive.currentReward()).toEqual(1n);
|
|
606
606
|
expect(await pointsIncentive.limit()).toEqual(10n);
|
|
607
607
|
});
|
|
608
608
|
|
|
609
|
-
test(
|
|
609
|
+
test("can get the protocol fee", async () => {
|
|
610
610
|
const { core } = fixtures;
|
|
611
611
|
|
|
612
612
|
expect(await core.protocolFee()).toBe(1000n);
|
|
613
613
|
});
|
|
614
614
|
|
|
615
|
-
test(
|
|
615
|
+
test("can get the protocol fee receiver", async () => {
|
|
616
616
|
const { core } = fixtures;
|
|
617
617
|
|
|
618
618
|
expect(await core.protocolFeeReceiver()).toBe(
|
|
@@ -620,7 +620,7 @@ describe('BoostCore', () => {
|
|
|
620
620
|
);
|
|
621
621
|
});
|
|
622
622
|
|
|
623
|
-
test(
|
|
623
|
+
test("can set the protocol fee receiver", async () => {
|
|
624
624
|
const { core } = fixtures;
|
|
625
625
|
|
|
626
626
|
await core.setProcolFeeReceiver(zeroAddress);
|
|
@@ -628,7 +628,7 @@ describe('BoostCore', () => {
|
|
|
628
628
|
expect(await core.protocolFeeReceiver()).toBe(zeroAddress);
|
|
629
629
|
});
|
|
630
630
|
|
|
631
|
-
test(
|
|
631
|
+
test("binds all actions, budgets, allowlists, incentives, and validators to reuse core options and account", () => {
|
|
632
632
|
const { core } = fixtures;
|
|
633
633
|
|
|
634
634
|
// const contractAction = core.ContractAction(zeroAddress);
|
|
@@ -710,7 +710,7 @@ describe('BoostCore', () => {
|
|
|
710
710
|
|
|
711
711
|
const pointsIncentive = core.PointsIncentive({
|
|
712
712
|
venue: zeroAddress,
|
|
713
|
-
selector:
|
|
713
|
+
selector: "0x",
|
|
714
714
|
reward: 0n,
|
|
715
715
|
limit: 0n,
|
|
716
716
|
});
|
|
@@ -722,7 +722,7 @@ describe('BoostCore', () => {
|
|
|
722
722
|
expect(signerValidator._account).toEqual(defaultOptions.account);
|
|
723
723
|
});
|
|
724
724
|
|
|
725
|
-
test(
|
|
725
|
+
test("can subscribe to contract events", async () => {
|
|
726
726
|
const subscription = vi.fn();
|
|
727
727
|
|
|
728
728
|
const { core } = fixtures;
|
|
@@ -749,7 +749,7 @@ describe('BoostCore', () => {
|
|
|
749
749
|
incentives: [
|
|
750
750
|
core.ERC20Incentive({
|
|
751
751
|
asset: erc20.assertValidAddress(),
|
|
752
|
-
reward: parseEther(
|
|
752
|
+
reward: parseEther("1"),
|
|
753
753
|
limit: 100n,
|
|
754
754
|
strategy: StrategyType.POOL,
|
|
755
755
|
manager: budget.assertValidAddress(),
|
|
@@ -764,7 +764,7 @@ describe('BoostCore', () => {
|
|
|
764
764
|
expect(subscription).toHaveBeenCalledTimes(1);
|
|
765
765
|
});
|
|
766
766
|
|
|
767
|
-
test(
|
|
767
|
+
test("can set a passthrough auth scheme", async () => {
|
|
768
768
|
const { core } = fixtures;
|
|
769
769
|
|
|
770
770
|
const auth = core.PassthroughAuth();
|
|
@@ -776,7 +776,7 @@ describe('BoostCore', () => {
|
|
|
776
776
|
expect(await core.isAuthorized(zeroAddress)).toBe(true);
|
|
777
777
|
});
|
|
778
778
|
|
|
779
|
-
test(
|
|
779
|
+
test("uses the provided validator when one is specified", async () => {
|
|
780
780
|
const { core } = fixtures;
|
|
781
781
|
const { budget, erc20 } = budgets;
|
|
782
782
|
const customValidator = core.SignerValidator({
|
|
@@ -800,7 +800,7 @@ describe('BoostCore', () => {
|
|
|
800
800
|
incentives: [
|
|
801
801
|
core.ERC20Incentive({
|
|
802
802
|
asset: erc20.assertValidAddress(),
|
|
803
|
-
reward: parseEther(
|
|
803
|
+
reward: parseEther("1"),
|
|
804
804
|
limit: 100n,
|
|
805
805
|
strategy: StrategyType.POOL,
|
|
806
806
|
manager: budget.assertValidAddress(),
|
|
@@ -813,7 +813,7 @@ describe('BoostCore', () => {
|
|
|
813
813
|
expect(signers).toBe(true);
|
|
814
814
|
});
|
|
815
815
|
|
|
816
|
-
test(
|
|
816
|
+
test("creates a boost with a default validator when none is provided", async () => {
|
|
817
817
|
const { core } = fixtures;
|
|
818
818
|
const { budget, erc20 } = budgets;
|
|
819
819
|
const boost = await core.createBoost({
|
|
@@ -829,7 +829,7 @@ describe('BoostCore', () => {
|
|
|
829
829
|
incentives: [
|
|
830
830
|
core.ERC20Incentive({
|
|
831
831
|
asset: erc20.assertValidAddress(),
|
|
832
|
-
reward: parseEther(
|
|
832
|
+
reward: parseEther("1"),
|
|
833
833
|
limit: 100n,
|
|
834
834
|
strategy: StrategyType.POOL,
|
|
835
835
|
manager: budget.assertValidAddress(),
|
|
@@ -848,7 +848,7 @@ describe('BoostCore', () => {
|
|
|
848
848
|
expect(signer).toBe(true);
|
|
849
849
|
});
|
|
850
850
|
|
|
851
|
-
test(
|
|
851
|
+
test("can retrieve the BoostClaimed event from a transaction hash", async () => {
|
|
852
852
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
853
853
|
const referrer = accounts.at(1)!.account!,
|
|
854
854
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
@@ -866,7 +866,7 @@ describe('BoostCore', () => {
|
|
|
866
866
|
});
|
|
867
867
|
|
|
868
868
|
const claimant = trustedSigner.account;
|
|
869
|
-
const incentiveData = pad(
|
|
869
|
+
const incentiveData = pad("0xdef456232173821931823712381232131391321934");
|
|
870
870
|
const incentiveQuantity = 1;
|
|
871
871
|
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
872
872
|
signer: trustedSigner,
|
|
@@ -888,7 +888,7 @@ describe('BoostCore', () => {
|
|
|
888
888
|
const claimInfo = await fixtures.core.getClaimFromTransaction({ hash });
|
|
889
889
|
expect(claimInfo).toBeDefined();
|
|
890
890
|
expect(claimInfo?.claimant).toBe(claimant);
|
|
891
|
-
expect(typeof claimInfo?.boostId).toBe(
|
|
891
|
+
expect(typeof claimInfo?.boostId).toBe("bigint");
|
|
892
892
|
expect(claimInfo?.referrer).toBe(referrer);
|
|
893
893
|
});
|
|
894
894
|
});
|
package/src/BoostCore.ts
CHANGED
|
@@ -127,15 +127,6 @@ export { boostCoreAbi };
|
|
|
127
127
|
*/
|
|
128
128
|
export const BOOST_CORE_CLAIM_FEE = parseEther('0.000075');
|
|
129
129
|
|
|
130
|
-
/**
|
|
131
|
-
* The address of the deployed BoostCore instance. In prerelease mode, this will be its sepolia address
|
|
132
|
-
*
|
|
133
|
-
* @type {Address}
|
|
134
|
-
*/
|
|
135
|
-
export const BOOST_CORE_ADDRESS =
|
|
136
|
-
(BoostCoreBases as Record<string, Address>)[__DEFAULT_CHAIN_ID__] ||
|
|
137
|
-
zeroAddress;
|
|
138
|
-
|
|
139
130
|
/**
|
|
140
131
|
* The fixed addresses for the deployed Boost Core.
|
|
141
132
|
* By default, `new BoostCore` will use the address deployed to the currently connected chain, or `BOOST_CORE_ADDRESS` if not provided.
|
|
@@ -143,10 +134,19 @@ export const BOOST_CORE_ADDRESS =
|
|
|
143
134
|
* @type {Record<number, Address>}
|
|
144
135
|
*/
|
|
145
136
|
export const BOOST_CORE_ADDRESSES: Record<number, Address> = {
|
|
146
|
-
...(BoostCoreBases as Record<number, Address>),
|
|
147
137
|
31337: import.meta.env.VITE_BOOST_CORE_ADDRESS,
|
|
138
|
+
...(BoostCoreBases as Record<number, Address>),
|
|
148
139
|
};
|
|
149
140
|
|
|
141
|
+
/**
|
|
142
|
+
* The address of the deployed BoostCore instance. In prerelease mode, this will be its sepolia address
|
|
143
|
+
*
|
|
144
|
+
* @type {Address}
|
|
145
|
+
*/
|
|
146
|
+
export const BOOST_CORE_ADDRESS =
|
|
147
|
+
BOOST_CORE_ADDRESSES[__DEFAULT_CHAIN_ID__ as unknown as number] ||
|
|
148
|
+
zeroAddress;
|
|
149
|
+
|
|
150
150
|
/**
|
|
151
151
|
* A generic `viem.Log` event with support for `BoostCore` event types.
|
|
152
152
|
*
|
|
@@ -244,7 +244,7 @@ export type CreateBoostPayload = {
|
|
|
244
244
|
budget: Budget;
|
|
245
245
|
action: Action;
|
|
246
246
|
validator?: Validator;
|
|
247
|
-
allowList
|
|
247
|
+
allowList?: AllowList;
|
|
248
248
|
incentives: Array<Incentive>;
|
|
249
249
|
protocolFee?: bigint;
|
|
250
250
|
maxParticipants?: bigint;
|
|
@@ -347,6 +347,8 @@ export class BoostCore extends Deployable<
|
|
|
347
347
|
options,
|
|
348
348
|
);
|
|
349
349
|
|
|
350
|
+
console.log(onChainPayload);
|
|
351
|
+
|
|
350
352
|
const boostHash = await boostFactory(options.config, {
|
|
351
353
|
...this.optionallyAttachAccount(options.account),
|
|
352
354
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -371,7 +373,7 @@ export class BoostCore extends Deployable<
|
|
|
371
373
|
budget: payload.budget.at(boost.budget),
|
|
372
374
|
action: payload.action.at(boost.action),
|
|
373
375
|
validator: payload.validator!.at(boost.validator),
|
|
374
|
-
allowList: payload.allowList
|
|
376
|
+
allowList: payload.allowList!.at(boost.allowList),
|
|
375
377
|
incentives: payload.incentives.map((incentive, i) =>
|
|
376
378
|
// biome-ignore lint/style/noNonNullAssertion: this will never be undefined
|
|
377
379
|
incentive.at(boost.incentives.at(i)!),
|
|
@@ -428,7 +430,7 @@ export class BoostCore extends Deployable<
|
|
|
428
430
|
chainId: number,
|
|
429
431
|
payload: CreateBoostPayload,
|
|
430
432
|
options: DeployableOptions,
|
|
431
|
-
): Promise<BoostPayload
|
|
433
|
+
): Promise<Required<BoostPayload>> {
|
|
432
434
|
if (!payload.owner) {
|
|
433
435
|
payload.owner =
|
|
434
436
|
this._account?.address ||
|
|
@@ -515,6 +517,10 @@ export class BoostCore extends Deployable<
|
|
|
515
517
|
isBase: true,
|
|
516
518
|
parameters: zeroHash,
|
|
517
519
|
};
|
|
520
|
+
// if allowlist not provided, assume open allowlist
|
|
521
|
+
if (!payload.allowList) {
|
|
522
|
+
payload.allowList = this.OpenAllowList();
|
|
523
|
+
}
|
|
518
524
|
if (payload.allowList.address) {
|
|
519
525
|
const isBase = payload.allowList.isBase;
|
|
520
526
|
allowListPayload = {
|
package/src/BoostRegistry.ts
CHANGED
|
@@ -41,15 +41,6 @@ import {
|
|
|
41
41
|
*/
|
|
42
42
|
export { boostRegistryAbi };
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* The address of the deployed `BoostRegistry` instance. In prerelease mode, this will be its sepolia address
|
|
46
|
-
*
|
|
47
|
-
* @type {Address}
|
|
48
|
-
*/
|
|
49
|
-
export const BOOST_REGISTRY_ADDRESS =
|
|
50
|
-
(BoostRegistryBases as Record<string, Address>)[__DEFAULT_CHAIN_ID__] ||
|
|
51
|
-
zeroAddress;
|
|
52
|
-
|
|
53
44
|
/**
|
|
54
45
|
* The fixed addresses for the deployed Boost Registry.
|
|
55
46
|
* By default, `new BoostRegistry` will use the address deployed to the currently connected chain, or `BOOST_REGISTRY_ADDRESS` if not provided.
|
|
@@ -57,10 +48,19 @@ export const BOOST_REGISTRY_ADDRESS =
|
|
|
57
48
|
* @type {Record<number, Address>}
|
|
58
49
|
*/
|
|
59
50
|
export const BOOST_REGISTRY_ADDRESSES: Record<number, Address> = {
|
|
60
|
-
...(BoostRegistryBases as Record<number, Address>),
|
|
61
51
|
31337: import.meta.env.VITE_BOOST_REGISTRY_ADDRESS,
|
|
52
|
+
...(BoostRegistryBases as Record<number, Address>),
|
|
62
53
|
};
|
|
63
54
|
|
|
55
|
+
/**
|
|
56
|
+
* The address of the deployed `BoostRegistry` instance. In prerelease mode, this will be its sepolia address
|
|
57
|
+
*
|
|
58
|
+
* @type {Address}
|
|
59
|
+
*/
|
|
60
|
+
export const BOOST_REGISTRY_ADDRESS =
|
|
61
|
+
BOOST_REGISTRY_ADDRESSES[__DEFAULT_CHAIN_ID__ as unknown as number] ||
|
|
62
|
+
zeroAddress;
|
|
63
|
+
|
|
64
64
|
/**
|
|
65
65
|
* A record of `BoostRegistry` event names to `AbiEvent` objects for use with `getLogs`
|
|
66
66
|
*
|