@boostxyz/sdk 0.0.0-alpha.7 → 0.0.0-alpha.9
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 +1 -1
- package/dist/Actions/ContractAction.d.ts +46 -3
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +37 -10
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +257 -11
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +249 -82
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.d.ts +2 -2
- package/dist/AllowLists/AllowList.js +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +33 -4
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +52 -37
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +31 -2
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +41 -129
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.cjs.map +1 -1
- package/dist/Auth/PassthroughAuth.js +4 -4
- package/dist/Auth/PassthroughAuth.js.map +1 -1
- package/dist/Boost.cjs +1 -1
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.d.ts +93 -1
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +151 -5
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +45 -7
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +352 -305
- 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 +18 -4
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +36 -25
- 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 +40 -2
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +53 -36
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/SimpleBudget.d.ts +33 -2
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +54 -2
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs +1 -1
- package/dist/Deployable/Contract.cjs.map +1 -1
- package/dist/Deployable/Contract.js +1 -1
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts +8 -2
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +6 -0
- package/dist/Deployable/Deployable.js.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +4 -3
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +31 -28
- package/dist/Deployable/DeployableTarget.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 +35 -5
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +33 -21
- 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 +89 -5
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +44 -23
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +67 -6
- 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 +49 -5
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +46 -27
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +42 -5
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.cjs.map +1 -1
- package/dist/Incentives/Incentive.js +48 -32
- package/dist/Incentives/Incentive.js.map +1 -1
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +49 -5
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +38 -21
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +298 -5
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +151 -26
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/claiming.cjs +2 -0
- package/dist/claiming.cjs.map +1 -0
- package/dist/claiming.d.ts +43 -0
- package/dist/claiming.d.ts.map +1 -0
- package/dist/claiming.js +17 -0
- package/dist/claiming.js.map +1 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +15 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +30 -21
- package/dist/errors.js.map +1 -1
- package/dist/{generated-DGpIVcv5.js → generated-57_Kffpz.js} +293 -282
- package/dist/generated-57_Kffpz.js.map +1 -0
- package/dist/{generated-Cd-Fe7W7.cjs → generated-wKBNvm48.cjs} +3 -3
- package/dist/generated-wKBNvm48.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -124
- package/dist/transfers.cjs +2 -0
- package/dist/transfers.cjs.map +1 -0
- package/dist/transfers.d.ts +198 -0
- package/dist/transfers.d.ts.map +1 -0
- package/dist/transfers.js +84 -0
- package/dist/transfers.js.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +2 -1371
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +26 -653
- package/dist/utils.js.map +1 -1
- package/package.json +17 -3
- package/src/Actions/Action.test.ts +5 -4
- package/src/Actions/ContractAction.test.ts +4 -6
- package/src/Actions/ContractAction.ts +73 -10
- package/src/Actions/ERC721MintAction.test.ts +2 -2
- package/src/Actions/ERC721MintAction.ts +70 -16
- package/src/Actions/EventAction.test.ts +43 -17
- package/src/Actions/EventAction.ts +451 -26
- package/src/AllowLists/SimpleAllowList.ts +51 -7
- package/src/AllowLists/SimpleDenyList.ts +47 -109
- package/src/Auth/PassthroughAuth.ts +1 -1
- package/src/Boost.ts +136 -1
- package/src/BoostCore.test.ts +4 -11
- package/src/BoostCore.ts +114 -45
- package/src/BoostRegistry.ts +39 -21
- package/src/Budgets/ManagedBudget.ts +69 -16
- package/src/Budgets/SimpleBudget.ts +57 -14
- package/src/Budgets/VestingBudget.ts +79 -9
- package/src/Deployable/Contract.ts +1 -1
- package/src/Deployable/Deployable.ts +8 -2
- package/src/Deployable/DeployableTarget.ts +19 -6
- package/src/Incentives/AllowListIncentive.test.ts +2 -5
- package/src/Incentives/AllowListIncentive.ts +59 -15
- package/src/Incentives/CGDAIncentive.test.ts +3 -7
- package/src/Incentives/CGDAIncentive.ts +123 -19
- package/src/Incentives/ERC1155Incentive.test.ts +2 -13
- package/src/Incentives/ERC1155Incentive.ts +104 -22
- package/src/Incentives/ERC20Incentive.test.ts +6 -17
- package/src/Incentives/ERC20Incentive.ts +86 -21
- package/src/Incentives/ERC20VariableIncentive.test.ts +4 -24
- package/src/Incentives/ERC20VariableIncentive.ts +71 -19
- package/src/Incentives/Incentive.test.ts +1 -1
- package/src/Incentives/PointsIncentive.test.ts +3 -6
- package/src/Incentives/PointsIncentive.ts +79 -17
- package/src/Validators/SignerValidator.test.ts +3 -7
- package/src/Validators/SignerValidator.ts +422 -13
- package/src/claiming.ts +56 -0
- package/src/errors.ts +19 -1
- package/src/index.ts +10 -7
- package/src/transfers.ts +284 -0
- package/src/utils.ts +3 -2052
- package/dist/generated-Cd-Fe7W7.cjs.map +0 -1
- package/dist/generated-DGpIVcv5.js.map +0 -1
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
type Address,
|
|
23
23
|
type ContractEventName,
|
|
24
24
|
type Hex,
|
|
25
|
+
encodeAbiParameters,
|
|
26
|
+
parseAbiParameters,
|
|
25
27
|
zeroAddress,
|
|
26
28
|
} from 'viem';
|
|
27
29
|
import type {
|
|
@@ -36,22 +38,40 @@ import {
|
|
|
36
38
|
import {
|
|
37
39
|
type ERC1155TransferPayload,
|
|
38
40
|
type FungibleTransferPayload,
|
|
41
|
+
prepareERC1155Transfer,
|
|
42
|
+
prepareFungibleTransfer,
|
|
43
|
+
} from '../transfers';
|
|
44
|
+
import {
|
|
39
45
|
type GenericLog,
|
|
40
46
|
type ReadParams,
|
|
41
47
|
RegistryType,
|
|
42
|
-
type SimpleBudgetPayload,
|
|
43
48
|
type WriteParams,
|
|
44
|
-
prepareERC1155Transfer,
|
|
45
|
-
prepareFungibleTransfer,
|
|
46
|
-
prepareSimpleBudgetPayload,
|
|
47
49
|
} from '../utils';
|
|
48
50
|
|
|
49
51
|
export { simpleBudgetAbi };
|
|
50
|
-
export type {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
export type { ERC1155TransferPayload, FungibleTransferPayload };
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The object representation of a `SimpleBudgetPayload.InitPayload`
|
|
56
|
+
*
|
|
57
|
+
* @export
|
|
58
|
+
* @interface SimpleBudgetPayload
|
|
59
|
+
* @typedef {SimpleBudgetPayload}
|
|
60
|
+
*/
|
|
61
|
+
export interface SimpleBudgetPayload {
|
|
62
|
+
/**
|
|
63
|
+
* The budget's owner
|
|
64
|
+
*
|
|
65
|
+
* @type {Address}
|
|
66
|
+
*/
|
|
67
|
+
owner: Address;
|
|
68
|
+
/**
|
|
69
|
+
* List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
|
|
70
|
+
*
|
|
71
|
+
* @type {Address[]}
|
|
72
|
+
*/
|
|
73
|
+
authorized: Address[];
|
|
74
|
+
}
|
|
55
75
|
|
|
56
76
|
/**
|
|
57
77
|
* A generic `viem.Log` event with support for `SimpleBudget` event types.
|
|
@@ -159,7 +179,7 @@ export class SimpleBudget extends DeployableTarget<
|
|
|
159
179
|
transfer: FungibleTransferPayload | ERC1155TransferPayload,
|
|
160
180
|
params?: WriteParams<typeof simpleBudgetAbi, 'allocate'>,
|
|
161
181
|
) {
|
|
162
|
-
return this.awaitResult(this.allocateRaw(transfer, params));
|
|
182
|
+
return await this.awaitResult(this.allocateRaw(transfer, params));
|
|
163
183
|
}
|
|
164
184
|
|
|
165
185
|
/**
|
|
@@ -207,7 +227,7 @@ export class SimpleBudget extends DeployableTarget<
|
|
|
207
227
|
transfer: FungibleTransferPayload | ERC1155TransferPayload,
|
|
208
228
|
params?: WriteParams<typeof simpleBudgetAbi, 'clawback'>,
|
|
209
229
|
) {
|
|
210
|
-
return this.awaitResult(this.clawbackRaw(transfer, params));
|
|
230
|
+
return await this.awaitResult(this.clawbackRaw(transfer, params));
|
|
211
231
|
}
|
|
212
232
|
|
|
213
233
|
/**
|
|
@@ -254,7 +274,7 @@ export class SimpleBudget extends DeployableTarget<
|
|
|
254
274
|
transfer: FungibleTransferPayload | ERC1155TransferPayload,
|
|
255
275
|
params?: WriteParams<typeof simpleBudgetAbi, 'disburse'>,
|
|
256
276
|
) {
|
|
257
|
-
return this.awaitResult(this.disburseRaw(transfer, params));
|
|
277
|
+
return await this.awaitResult(this.disburseRaw(transfer, params));
|
|
258
278
|
}
|
|
259
279
|
|
|
260
280
|
/**
|
|
@@ -298,7 +318,7 @@ export class SimpleBudget extends DeployableTarget<
|
|
|
298
318
|
transfers: Array<FungibleTransferPayload | ERC1155TransferPayload>,
|
|
299
319
|
params?: WriteParams<typeof simpleBudgetAbi, 'disburseBatch'>,
|
|
300
320
|
) {
|
|
301
|
-
return this.awaitResult(this.disburseBatchRaw(transfers, params));
|
|
321
|
+
return await this.awaitResult(this.disburseBatchRaw(transfers, params));
|
|
302
322
|
}
|
|
303
323
|
|
|
304
324
|
/**
|
|
@@ -344,7 +364,9 @@ export class SimpleBudget extends DeployableTarget<
|
|
|
344
364
|
allowed: boolean[],
|
|
345
365
|
params?: WriteParams<typeof simpleBudgetAbi, 'setAuthorized'>,
|
|
346
366
|
) {
|
|
347
|
-
return this.awaitResult(
|
|
367
|
+
return await this.awaitResult(
|
|
368
|
+
this.setAuthorizedRaw(addresses, allowed, params),
|
|
369
|
+
);
|
|
348
370
|
}
|
|
349
371
|
|
|
350
372
|
/**
|
|
@@ -519,3 +541,24 @@ export class SimpleBudget extends DeployableTarget<
|
|
|
519
541
|
};
|
|
520
542
|
}
|
|
521
543
|
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Given a {@link SimpleBudgetPayload}, properly encode a `SimpleBudget.InitPayload` for use with {@link SimpleBudget} initialization.
|
|
547
|
+
*
|
|
548
|
+
* @param {SimpleBudgetPayload} param0
|
|
549
|
+
* @param {Address} param0.owner - The budget's owner
|
|
550
|
+
* @param {{}} param0.authorized - List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
|
|
551
|
+
* @returns {*}
|
|
552
|
+
*/
|
|
553
|
+
export const prepareSimpleBudgetPayload = ({
|
|
554
|
+
owner,
|
|
555
|
+
authorized,
|
|
556
|
+
}: SimpleBudgetPayload) => {
|
|
557
|
+
return encodeAbiParameters(
|
|
558
|
+
parseAbiParameters([
|
|
559
|
+
'SimpleBudgetPayload payload',
|
|
560
|
+
'struct SimpleBudgetPayload { address owner; address[] authorized; }',
|
|
561
|
+
]),
|
|
562
|
+
[{ owner, authorized }],
|
|
563
|
+
);
|
|
564
|
+
};
|
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
type Address,
|
|
27
27
|
type ContractEventName,
|
|
28
28
|
type Hex,
|
|
29
|
+
encodeAbiParameters,
|
|
30
|
+
parseAbiParameters,
|
|
29
31
|
zeroAddress,
|
|
30
32
|
} from 'viem';
|
|
31
33
|
import type {
|
|
@@ -36,17 +38,56 @@ import { DeployableTarget } from '../Deployable/DeployableTarget';
|
|
|
36
38
|
import { DeployableUnknownOwnerProvidedError } from '../errors';
|
|
37
39
|
import {
|
|
38
40
|
type FungibleTransferPayload,
|
|
41
|
+
prepareFungibleTransfer,
|
|
42
|
+
} from '../transfers';
|
|
43
|
+
import {
|
|
39
44
|
type GenericLog,
|
|
40
45
|
type ReadParams,
|
|
41
46
|
RegistryType,
|
|
42
|
-
type VestingBudgetPayload,
|
|
43
47
|
type WriteParams,
|
|
44
|
-
prepareFungibleTransfer,
|
|
45
|
-
prepareVestingBudgetPayload,
|
|
46
48
|
} from '../utils';
|
|
47
49
|
|
|
48
50
|
export { vestingBudgetAbi };
|
|
49
|
-
export type {
|
|
51
|
+
export type { FungibleTransferPayload };
|
|
52
|
+
/**
|
|
53
|
+
* The object representation of a `VestingBudget.InitPayload`
|
|
54
|
+
*
|
|
55
|
+
* @export
|
|
56
|
+
* @interface VestingBudgetPayload
|
|
57
|
+
* @typedef {VestingBudgetPayload}
|
|
58
|
+
*/
|
|
59
|
+
export interface VestingBudgetPayload {
|
|
60
|
+
/**
|
|
61
|
+
* The budget's owner.
|
|
62
|
+
*
|
|
63
|
+
* @type {Address}
|
|
64
|
+
*/
|
|
65
|
+
owner: Address;
|
|
66
|
+
/**
|
|
67
|
+
* List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
|
|
68
|
+
*
|
|
69
|
+
* @type {Address[]}
|
|
70
|
+
*/
|
|
71
|
+
authorized: Address[];
|
|
72
|
+
/**
|
|
73
|
+
* The timestamp at which the vesting schedule begins
|
|
74
|
+
*
|
|
75
|
+
* @type {bigint}
|
|
76
|
+
*/
|
|
77
|
+
start: bigint;
|
|
78
|
+
/**
|
|
79
|
+
* The duration of the vesting schedule (in seconds)
|
|
80
|
+
*
|
|
81
|
+
* @type {bigint}
|
|
82
|
+
*/
|
|
83
|
+
duration: bigint;
|
|
84
|
+
/**
|
|
85
|
+
* The duration of the cliff period (in seconds)
|
|
86
|
+
*
|
|
87
|
+
* @type {bigint}
|
|
88
|
+
*/
|
|
89
|
+
cliff: bigint;
|
|
90
|
+
}
|
|
50
91
|
|
|
51
92
|
/**
|
|
52
93
|
* A generic `viem.Log` event with support for `VestingBudget` event types.
|
|
@@ -178,7 +219,7 @@ export class VestingBudget extends DeployableTarget<
|
|
|
178
219
|
transfer: FungibleTransferPayload,
|
|
179
220
|
params?: WriteParams<typeof vestingBudgetAbi, 'allocate'>,
|
|
180
221
|
) {
|
|
181
|
-
return this.awaitResult(this.allocateRaw(transfer, params));
|
|
222
|
+
return await this.awaitResult(this.allocateRaw(transfer, params));
|
|
182
223
|
}
|
|
183
224
|
|
|
184
225
|
/**
|
|
@@ -226,7 +267,7 @@ export class VestingBudget extends DeployableTarget<
|
|
|
226
267
|
transfer: FungibleTransferPayload,
|
|
227
268
|
params?: WriteParams<typeof vestingBudgetAbi, 'clawback'>,
|
|
228
269
|
) {
|
|
229
|
-
return this.awaitResult(this.clawbackRaw(transfer, params));
|
|
270
|
+
return await this.awaitResult(this.clawbackRaw(transfer, params));
|
|
230
271
|
}
|
|
231
272
|
|
|
232
273
|
/**
|
|
@@ -273,7 +314,7 @@ export class VestingBudget extends DeployableTarget<
|
|
|
273
314
|
transfer: FungibleTransferPayload,
|
|
274
315
|
params?: WriteParams<typeof vestingBudgetAbi, 'disburse'>,
|
|
275
316
|
) {
|
|
276
|
-
return this.awaitResult(this.disburseRaw(transfer, params));
|
|
317
|
+
return await this.awaitResult(this.disburseRaw(transfer, params));
|
|
277
318
|
}
|
|
278
319
|
|
|
279
320
|
/**
|
|
@@ -317,7 +358,7 @@ export class VestingBudget extends DeployableTarget<
|
|
|
317
358
|
transfers: FungibleTransferPayload[],
|
|
318
359
|
params?: WriteParams<typeof vestingBudgetAbi, 'disburseBatch'>,
|
|
319
360
|
) {
|
|
320
|
-
return this.awaitResult(this.disburseBatchRaw(transfers, params));
|
|
361
|
+
return await this.awaitResult(this.disburseBatchRaw(transfers, params));
|
|
321
362
|
}
|
|
322
363
|
|
|
323
364
|
/**
|
|
@@ -363,7 +404,9 @@ export class VestingBudget extends DeployableTarget<
|
|
|
363
404
|
allowed: boolean[],
|
|
364
405
|
params?: WriteParams<typeof vestingBudgetAbi, 'setAuthorized'>,
|
|
365
406
|
) {
|
|
366
|
-
return this.awaitResult(
|
|
407
|
+
return await this.awaitResult(
|
|
408
|
+
this.setAuthorizedRaw(addresses, allowed, params),
|
|
409
|
+
);
|
|
367
410
|
}
|
|
368
411
|
|
|
369
412
|
/**
|
|
@@ -530,3 +573,30 @@ export class VestingBudget extends DeployableTarget<
|
|
|
530
573
|
};
|
|
531
574
|
}
|
|
532
575
|
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Given a {@link VestingBudgetPayload}, properly encode a `VestingBudget.InitPayload` for use with {@link VestingBudget} initialization.
|
|
579
|
+
*
|
|
580
|
+
* @param {VestingBudgetPayload} param0
|
|
581
|
+
* @param {Address} param0.owner - The budget's owner.
|
|
582
|
+
* @param {{}} param0.authorized - List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
|
|
583
|
+
* @param {bigint} param0.start - The timestamp at which the vesting schedule begins
|
|
584
|
+
* @param {bigint} param0.duration - The duration of the vesting schedule (in seconds)
|
|
585
|
+
* @param {bigint} param0.cliff - The duration of the cliff period (in seconds)
|
|
586
|
+
* @returns {Hex}
|
|
587
|
+
*/
|
|
588
|
+
export function prepareVestingBudgetPayload({
|
|
589
|
+
owner,
|
|
590
|
+
authorized,
|
|
591
|
+
start,
|
|
592
|
+
duration,
|
|
593
|
+
cliff,
|
|
594
|
+
}: VestingBudgetPayload) {
|
|
595
|
+
return encodeAbiParameters(
|
|
596
|
+
parseAbiParameters([
|
|
597
|
+
'VestingBudgetPayload payload',
|
|
598
|
+
'struct VestingBudgetPayload { address owner; address[] authorized; uint64 start; uint64 duration; uint64 cliff; }',
|
|
599
|
+
]),
|
|
600
|
+
[{ owner, authorized, start, duration, cliff }],
|
|
601
|
+
);
|
|
602
|
+
}
|
|
@@ -224,6 +224,6 @@ export class Contract<ContractAbi extends Abi> {
|
|
|
224
224
|
hashPromise: Promise<HashAndSimulatedResult<Result>>,
|
|
225
225
|
waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,
|
|
226
226
|
) {
|
|
227
|
-
return awaitResult(this._config, hashPromise, waitParams);
|
|
227
|
+
return await awaitResult(this._config, hashPromise, waitParams);
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -140,6 +140,9 @@ export class Deployable<
|
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* High level deployment function to deploy and await the contract address.
|
|
143
|
+
* This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,
|
|
144
|
+
* which makes it useless for Boost components.
|
|
145
|
+
* Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.
|
|
143
146
|
*
|
|
144
147
|
* @public
|
|
145
148
|
* @async
|
|
@@ -148,7 +151,7 @@ export class Deployable<
|
|
|
148
151
|
* @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - See [viem.WaitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)
|
|
149
152
|
* @returns {unknown}
|
|
150
153
|
*/
|
|
151
|
-
|
|
154
|
+
protected async deploy(
|
|
152
155
|
_payload?: Payload,
|
|
153
156
|
_options?: DeployableOptions,
|
|
154
157
|
waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,
|
|
@@ -165,6 +168,9 @@ export class Deployable<
|
|
|
165
168
|
|
|
166
169
|
/**
|
|
167
170
|
* The lower level contract deployment function that does not await for the transaction receipt.
|
|
171
|
+
* This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,
|
|
172
|
+
* which makes it useless for Boost components.
|
|
173
|
+
* Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.
|
|
168
174
|
*
|
|
169
175
|
* @public
|
|
170
176
|
* @async
|
|
@@ -175,7 +181,7 @@ export class Deployable<
|
|
|
175
181
|
* @throws {@link DeployableWagmiConfigurationRequiredError}
|
|
176
182
|
* @throws {@link DeployableMissingPayloadError}
|
|
177
183
|
*/
|
|
178
|
-
|
|
184
|
+
protected async deployRaw(
|
|
179
185
|
_payload?: Payload,
|
|
180
186
|
_options?: DeployableOptions,
|
|
181
187
|
): Promise<Hash> {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type Hash,
|
|
11
11
|
type Hex,
|
|
12
12
|
type WaitForTransactionReceiptParameters,
|
|
13
|
+
isAddress,
|
|
13
14
|
zeroAddress,
|
|
14
15
|
} from 'viem';
|
|
15
16
|
import {
|
|
@@ -58,7 +59,11 @@ export class DeployableTarget<
|
|
|
58
59
|
* @readonly
|
|
59
60
|
* @type {boolean}
|
|
60
61
|
*/
|
|
61
|
-
|
|
62
|
+
protected _isBase = true;
|
|
63
|
+
get isBase() {
|
|
64
|
+
if (!!this.address && this.address !== this.base) return false;
|
|
65
|
+
return this._isBase;
|
|
66
|
+
}
|
|
62
67
|
|
|
63
68
|
/**
|
|
64
69
|
* Creates an instance of DeployableTarget.
|
|
@@ -74,7 +79,15 @@ export class DeployableTarget<
|
|
|
74
79
|
isBase?: boolean,
|
|
75
80
|
) {
|
|
76
81
|
super(options, payload);
|
|
77
|
-
if
|
|
82
|
+
// if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier
|
|
83
|
+
if (
|
|
84
|
+
typeof payload === 'string' &&
|
|
85
|
+
isAddress(payload) &&
|
|
86
|
+
payload !== this.base &&
|
|
87
|
+
payload !== zeroAddress
|
|
88
|
+
)
|
|
89
|
+
isBase = false;
|
|
90
|
+
if (isBase !== undefined) this._isBase = isBase;
|
|
78
91
|
}
|
|
79
92
|
|
|
80
93
|
/**
|
|
@@ -109,7 +122,7 @@ export class DeployableTarget<
|
|
|
109
122
|
* @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
|
|
110
123
|
* @returns {unknown}
|
|
111
124
|
*/
|
|
112
|
-
|
|
125
|
+
protected override async deploy(
|
|
113
126
|
payload?: Payload,
|
|
114
127
|
options?: DeployableOptions,
|
|
115
128
|
waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,
|
|
@@ -128,7 +141,7 @@ export class DeployableTarget<
|
|
|
128
141
|
* @param {?DeployableOptions} [_options]
|
|
129
142
|
* @returns {Promise<Hash>}
|
|
130
143
|
*/
|
|
131
|
-
|
|
144
|
+
protected override async deployRaw(
|
|
132
145
|
_payload?: Payload,
|
|
133
146
|
_options?: DeployableOptions,
|
|
134
147
|
): Promise<Hash> {
|
|
@@ -157,7 +170,7 @@ export class DeployableTarget<
|
|
|
157
170
|
interfaceId: Hex,
|
|
158
171
|
params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,
|
|
159
172
|
) {
|
|
160
|
-
return readACloneableSupportsInterface(this._config, {
|
|
173
|
+
return await readACloneableSupportsInterface(this._config, {
|
|
161
174
|
address: this.assertValidAddress(),
|
|
162
175
|
...this.optionallyAttachAccount(),
|
|
163
176
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -178,7 +191,7 @@ export class DeployableTarget<
|
|
|
178
191
|
public async getComponentInterface(
|
|
179
192
|
params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,
|
|
180
193
|
) {
|
|
181
|
-
return readACloneableGetComponentInterface(this._config, {
|
|
194
|
+
return await readACloneableGetComponentInterface(this._config, {
|
|
182
195
|
address: this.assertValidAddress(),
|
|
183
196
|
...this.optionallyAttachAccount(),
|
|
184
197
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
freshBoost,
|
|
10
10
|
} from '../../test/helpers';
|
|
11
11
|
import { LIST_MANAGER_ROLE } from '../AllowLists/SimpleAllowList';
|
|
12
|
-
import { prepareSignerValidatorClaimDataPayload } from '../utils';
|
|
13
12
|
import { PointsIncentive } from './PointsIncentive';
|
|
14
13
|
|
|
15
14
|
let fixtures: Fixtures;
|
|
@@ -68,11 +67,10 @@ describe('AllowListIncentive', () => {
|
|
|
68
67
|
console.log(claimant);
|
|
69
68
|
|
|
70
69
|
const incentiveQuantity = 1;
|
|
71
|
-
const claimDataPayload = await
|
|
70
|
+
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
72
71
|
signer: trustedSigner,
|
|
73
72
|
incentiveData,
|
|
74
73
|
chainId: defaultOptions.config.chains[0].id,
|
|
75
|
-
validator: boost.validator.assertValidAddress(),
|
|
76
74
|
incentiveQuantity,
|
|
77
75
|
claimant,
|
|
78
76
|
boostId: boost.id,
|
|
@@ -114,11 +112,10 @@ describe('AllowListIncentive', () => {
|
|
|
114
112
|
const incentiveData = pad('0xdef456232173821931823712381232131391321934');
|
|
115
113
|
console.log(claimant);
|
|
116
114
|
|
|
117
|
-
const claimDataPayload = await
|
|
115
|
+
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
118
116
|
signer: trustedSigner,
|
|
119
117
|
incentiveData,
|
|
120
118
|
chainId: defaultOptions.config.chains[0].id,
|
|
121
|
-
validator: boost.validator.assertValidAddress(),
|
|
122
119
|
incentiveQuantity,
|
|
123
120
|
claimant,
|
|
124
121
|
boostId: boost.id,
|
|
@@ -11,26 +11,49 @@ import {
|
|
|
11
11
|
writeAllowListIncentiveClaim,
|
|
12
12
|
} from '@boostxyz/evm';
|
|
13
13
|
import { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';
|
|
14
|
-
import
|
|
14
|
+
import {
|
|
15
|
+
type Address,
|
|
16
|
+
type ContractEventName,
|
|
17
|
+
type Hex,
|
|
18
|
+
encodeAbiParameters,
|
|
19
|
+
} from 'viem';
|
|
15
20
|
import { SimpleAllowList } from '../AllowLists/AllowList';
|
|
16
21
|
import type {
|
|
17
22
|
DeployableOptions,
|
|
18
23
|
GenericDeployableParams,
|
|
19
24
|
} from '../Deployable/Deployable';
|
|
20
25
|
import { DeployableTarget } from '../Deployable/DeployableTarget';
|
|
26
|
+
import { type ClaimPayload, prepareClaimPayload } from '../claiming';
|
|
21
27
|
import {
|
|
22
|
-
type AllowListIncentivePayload,
|
|
23
|
-
type ClaimPayload,
|
|
24
28
|
type GenericLog,
|
|
25
29
|
type ReadParams,
|
|
26
30
|
RegistryType,
|
|
27
31
|
type WriteParams,
|
|
28
|
-
prepareAllowListIncentivePayload,
|
|
29
|
-
prepareClaimPayload,
|
|
30
32
|
} from '../utils';
|
|
31
33
|
|
|
32
34
|
export { allowListIncentiveAbi };
|
|
33
|
-
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The object representation of a `AllowListIncentive.InitPayload`
|
|
38
|
+
*
|
|
39
|
+
* @export
|
|
40
|
+
* @interface AllowListIncentivePayload
|
|
41
|
+
* @typedef {AllowListIncentivePayload}
|
|
42
|
+
*/
|
|
43
|
+
export interface AllowListIncentivePayload {
|
|
44
|
+
/**
|
|
45
|
+
* The address to the allowlist to add claimers to.
|
|
46
|
+
*
|
|
47
|
+
* @type {Address}
|
|
48
|
+
*/
|
|
49
|
+
allowList: Address;
|
|
50
|
+
/**
|
|
51
|
+
* The maximum number of claims that can be made (one per address)
|
|
52
|
+
*
|
|
53
|
+
* @type {bigint}
|
|
54
|
+
*/
|
|
55
|
+
limit: bigint;
|
|
56
|
+
}
|
|
34
57
|
|
|
35
58
|
/**
|
|
36
59
|
* A generic `viem.Log` event with support for `AllowListIncentive` event types.
|
|
@@ -93,7 +116,7 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
93
116
|
public async owner(
|
|
94
117
|
params?: ReadParams<typeof allowListIncentiveAbi, 'owner'>,
|
|
95
118
|
) {
|
|
96
|
-
return readAllowListIncentiveOwner(this._config, {
|
|
119
|
+
return await readAllowListIncentiveOwner(this._config, {
|
|
97
120
|
address: this.assertValidAddress(),
|
|
98
121
|
args: [],
|
|
99
122
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -112,7 +135,7 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
112
135
|
public async claims(
|
|
113
136
|
params?: ReadParams<typeof allowListIncentiveAbi, 'claims'>,
|
|
114
137
|
) {
|
|
115
|
-
return readAllowListIncentiveClaims(this._config, {
|
|
138
|
+
return await readAllowListIncentiveClaims(this._config, {
|
|
116
139
|
address: this.assertValidAddress(),
|
|
117
140
|
args: [],
|
|
118
141
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -131,7 +154,7 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
131
154
|
public async reward(
|
|
132
155
|
params?: ReadParams<typeof allowListIncentiveAbi, 'reward'>,
|
|
133
156
|
) {
|
|
134
|
-
return readAllowListIncentiveReward(this._config, {
|
|
157
|
+
return await readAllowListIncentiveReward(this._config, {
|
|
135
158
|
address: this.assertValidAddress(),
|
|
136
159
|
args: [],
|
|
137
160
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -152,7 +175,7 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
152
175
|
address: Address,
|
|
153
176
|
params?: ReadParams<typeof allowListIncentiveAbi, 'claimed'>,
|
|
154
177
|
) {
|
|
155
|
-
return readAllowListIncentiveClaimed(this._config, {
|
|
178
|
+
return await readAllowListIncentiveClaimed(this._config, {
|
|
156
179
|
address: this.assertValidAddress(),
|
|
157
180
|
args: [address],
|
|
158
181
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -193,7 +216,7 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
193
216
|
public async limit(
|
|
194
217
|
params?: ReadParams<typeof allowListIncentiveAbi, 'limit'>,
|
|
195
218
|
) {
|
|
196
|
-
return readAllowListIncentiveLimit(this._config, {
|
|
219
|
+
return await readAllowListIncentiveLimit(this._config, {
|
|
197
220
|
address: this.assertValidAddress(),
|
|
198
221
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
199
222
|
...(params as any),
|
|
@@ -209,11 +232,11 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
209
232
|
* @param {?WriteParams<typeof allowListIncentiveAbi, 'claim'>} [params]
|
|
210
233
|
* @returns {Promise<true>} - return true if successful, otherwise revert
|
|
211
234
|
*/
|
|
212
|
-
|
|
235
|
+
protected async claim(
|
|
213
236
|
payload: Pick<ClaimPayload, 'target'>,
|
|
214
237
|
params?: WriteParams<typeof allowListIncentiveAbi, 'claim'>,
|
|
215
238
|
) {
|
|
216
|
-
return this.awaitResult(this.claimRaw(payload, params));
|
|
239
|
+
return await this.awaitResult(this.claimRaw(payload, params));
|
|
217
240
|
}
|
|
218
241
|
|
|
219
242
|
/**
|
|
@@ -225,7 +248,7 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
225
248
|
* @param {?WriteParams<typeof allowListIncentiveAbi, 'claim'>} [params]
|
|
226
249
|
* @returns {Promise<true>} - return true if successful, otherwise revert
|
|
227
250
|
*/
|
|
228
|
-
|
|
251
|
+
protected async claimRaw(
|
|
229
252
|
payload: Pick<ClaimPayload, 'target'>,
|
|
230
253
|
params?: WriteParams<typeof allowListIncentiveAbi, 'claim'>,
|
|
231
254
|
) {
|
|
@@ -256,7 +279,7 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
256
279
|
payload: Pick<ClaimPayload, 'target'>,
|
|
257
280
|
params?: ReadParams<typeof allowListIncentiveAbi, 'isClaimable'>,
|
|
258
281
|
) {
|
|
259
|
-
return readAllowListIncentiveIsClaimable(this._config, {
|
|
282
|
+
return await readAllowListIncentiveIsClaimable(this._config, {
|
|
260
283
|
address: this.assertValidAddress(),
|
|
261
284
|
args: [prepareClaimPayload(payload)],
|
|
262
285
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -288,3 +311,24 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
288
311
|
};
|
|
289
312
|
}
|
|
290
313
|
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Given a {@link AllowListIncentivePayload}, properly encode a `AllowListIncentive.InitPayload` for use with {@link AllowListIncentive} initialization.
|
|
317
|
+
*
|
|
318
|
+
* @param {AllowListIncentivePayload} param0
|
|
319
|
+
* @param {Address} param0.allowList - The address to the allowlist to add claimers to.
|
|
320
|
+
* @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)
|
|
321
|
+
* @returns {Hex}
|
|
322
|
+
*/
|
|
323
|
+
export const prepareAllowListIncentivePayload = ({
|
|
324
|
+
allowList,
|
|
325
|
+
limit,
|
|
326
|
+
}: AllowListIncentivePayload) => {
|
|
327
|
+
return encodeAbiParameters(
|
|
328
|
+
[
|
|
329
|
+
{ type: 'address', name: 'allowList' },
|
|
330
|
+
{ type: 'uint256', name: 'limit' },
|
|
331
|
+
],
|
|
332
|
+
[allowList, limit],
|
|
333
|
+
);
|
|
334
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readMockErc20BalanceOf } from '@boostxyz/evm';
|
|
2
2
|
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
|
|
3
|
-
import {
|
|
4
|
-
import { encodePacked, isAddress, keccak256, pad, parseEther } from 'viem';
|
|
3
|
+
import { isAddress, pad, parseEther } from 'viem';
|
|
5
4
|
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
6
5
|
import { accounts } from '../../test/accounts';
|
|
7
6
|
import {
|
|
@@ -12,7 +11,6 @@ import {
|
|
|
12
11
|
freshBoost,
|
|
13
12
|
fundBudget,
|
|
14
13
|
} from '../../test/helpers';
|
|
15
|
-
import { prepareSignerValidatorClaimDataPayload } from '../utils';
|
|
16
14
|
import { CGDAIncentive } from './CGDAIncentive';
|
|
17
15
|
|
|
18
16
|
let fixtures: Fixtures, budgets: BudgetFixtures;
|
|
@@ -59,11 +57,10 @@ describe('CGDAIncentive', () => {
|
|
|
59
57
|
const incentiveData = pad('0xdef456232173821931823712381232131391321934');
|
|
60
58
|
|
|
61
59
|
const incentiveQuantity = 1;
|
|
62
|
-
const claimDataPayload = await
|
|
60
|
+
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
63
61
|
signer: trustedSigner,
|
|
64
62
|
incentiveData,
|
|
65
63
|
chainId: defaultOptions.config.chains[0].id,
|
|
66
|
-
validator: boost.validator.assertValidAddress(),
|
|
67
64
|
incentiveQuantity,
|
|
68
65
|
claimant,
|
|
69
66
|
boostId: boost.id,
|
|
@@ -104,11 +101,10 @@ describe('CGDAIncentive', () => {
|
|
|
104
101
|
const claimant = trustedSigner.account;
|
|
105
102
|
const incentiveData = pad('0xdef456232173821931823712381232131391321934');
|
|
106
103
|
const incentiveQuantity = 1;
|
|
107
|
-
const claimDataPayload = await
|
|
104
|
+
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
108
105
|
signer: trustedSigner,
|
|
109
106
|
incentiveData,
|
|
110
107
|
chainId: defaultOptions.config.chains[0].id,
|
|
111
|
-
validator: boost.validator.assertValidAddress(),
|
|
112
108
|
incentiveQuantity,
|
|
113
109
|
claimant,
|
|
114
110
|
boostId: boost.id,
|