@boostxyz/sdk 0.0.0-alpha.9 → 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 +2 -2
- package/dist/Actions/ContractAction.d.ts +11 -11
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +14 -14
- 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 +174 -41
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +557 -129
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -1
- package/dist/AllowLists/AllowList.d.ts +6 -4
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +45 -23
- package/dist/AllowLists/AllowList.js.map +1 -1
- package/dist/AllowLists/OpenAllowList.d.ts +423 -0
- package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +92 -37
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +60 -75
- 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 +203 -11
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +11 -112
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/Boost.cjs +1 -1
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.d.ts +20 -21
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +43 -57
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore-Btl5BdAs.cjs +3 -0
- package/dist/BoostCore-Btl5BdAs.cjs.map +1 -0
- package/dist/BoostCore-CD56zbYX.js +2641 -0
- package/dist/BoostCore-CD56zbYX.js.map +1 -0
- package/dist/BoostCore.cjs +1 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +749 -78
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +29 -1150
- 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 +80 -25
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +164 -82
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.cjs.map +1 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/Budget.js.map +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +103 -221
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +81 -298
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +223 -89
- 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.d.ts +4 -5
- package/dist/Deployable/Contract.d.ts.map +1 -1
- package/dist/Deployable/Contract.js +5 -7
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts +1 -1
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +3 -5
- 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 +13 -13
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +28 -25
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
- package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +248 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js +320 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
- package/dist/Incentive-CcnOIc8L.cjs +2 -0
- package/dist/Incentive-CcnOIc8L.cjs.map +1 -0
- package/dist/Incentive-rM5nKznp.js +313 -0
- package/dist/Incentive-rM5nKznp.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +38 -16
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +43 -29
- 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 +234 -21
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +46 -32
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
- 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 +234 -30
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +62 -46
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +333 -438
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
- 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.d.ts +4 -4
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +16 -296
- 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 +40 -18
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +38 -24
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/SimpleDenyList-BDXpY74P.js +133 -0
- package/dist/SimpleDenyList-BDXpY74P.js.map +1 -0
- package/dist/SimpleDenyList-DNj5qDWM.cjs +2 -0
- 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 +16 -16
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +32 -28
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +1 -1
- package/dist/Validators/Validator.js +2 -2
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/claiming.cjs.map +1 -1
- package/dist/claiming.d.ts +1 -1
- package/dist/claiming.js.map +1 -1
- package/dist/componentInterfaces-BBCFkrZv.js +14 -0
- package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
- 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 +58 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +256 -20
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +183 -26
- package/dist/errors.js.map +1 -1
- package/dist/{generated-57_Kffpz.js → generated-CsNyWPKA.js} +3843 -2084
- 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.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +142 -108
- package/dist/index.js.map +1 -1
- package/dist/transfers.cjs.map +1 -1
- package/dist/transfers.d.ts +1 -1
- package/dist/transfers.js.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +26 -12
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -23
- package/dist/utils.js.map +1 -1
- package/package.json +20 -10
- package/src/Actions/Action.test.ts +14 -13
- package/src/Actions/ContractAction.test.ts +10 -10
- package/src/Actions/ContractAction.ts +11 -12
- package/src/Actions/ERC721MintAction.test.ts +6 -6
- package/src/Actions/ERC721MintAction.ts +14 -15
- package/src/Actions/EventAction.test.ts +735 -109
- package/src/Actions/EventAction.ts +527 -88
- package/src/AllowLists/AllowList.test.ts +7 -7
- package/src/AllowLists/AllowList.ts +5 -3
- package/src/AllowLists/OpenAllowList.test.ts +40 -0
- package/src/AllowLists/OpenAllowList.ts +45 -0
- package/src/AllowLists/SimpleAllowList.test.ts +4 -4
- package/src/AllowLists/SimpleAllowList.ts +40 -61
- package/src/AllowLists/SimpleDenyList.test.ts +4 -4
- package/src/AllowLists/SimpleDenyList.ts +41 -17
- package/src/Auth/PassthroughAuth.test.ts +1 -1
- package/src/Boost.ts +21 -24
- package/src/BoostCore.test.ts +361 -306
- package/src/BoostCore.ts +403 -220
- package/src/BoostRegistry.test.ts +53 -0
- package/src/BoostRegistry.ts +161 -40
- package/src/Budgets/Budget.test.ts +2 -2
- package/src/Budgets/Budget.ts +1 -2
- package/src/Budgets/ManagedBudget.test.ts +106 -19
- package/src/Budgets/ManagedBudget.ts +49 -321
- package/src/Budgets/VestingBudget.test.ts +7 -7
- package/src/Budgets/VestingBudget.ts +36 -106
- package/src/Deployable/Contract.ts +4 -5
- package/src/Deployable/Deployable.ts +1 -1
- package/src/Deployable/DeployableTarget.ts +30 -19
- package/src/Deployable/DeployableTargetWithRBAC.test.ts +103 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +447 -0
- package/src/Incentives/AllowListIncentive.test.ts +12 -12
- package/src/Incentives/AllowListIncentive.ts +30 -15
- package/src/Incentives/CGDAIncentive.test.ts +9 -6
- package/src/Incentives/CGDAIncentive.ts +39 -18
- package/src/Incentives/ERC1155Incentive.test.ts +3 -3
- package/src/Incentives/ERC1155Incentive.ts +30 -29
- package/src/Incentives/ERC20Incentive.test.ts +9 -6
- package/src/Incentives/ERC20Incentive.ts +54 -27
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +325 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
- package/src/Incentives/ERC20VariableIncentive.ts +50 -26
- package/src/Incentives/Incentive.test.ts +4 -1
- package/src/Incentives/Incentive.ts +7 -6
- package/src/Incentives/PointsIncentive.test.ts +24 -25
- package/src/Incentives/PointsIncentive.ts +32 -17
- package/src/Validators/SignerValidator.test.ts +6 -6
- package/src/Validators/SignerValidator.ts +20 -17
- package/src/Validators/Validator.test.ts +2 -2
- package/src/Validators/Validator.ts +1 -1
- package/src/claiming.ts +1 -1
- package/src/errors.ts +345 -21
- package/src/index.test.ts +118 -36
- package/src/index.ts +5 -0
- package/src/transfers.ts +1 -1
- package/src/utils.test.ts +2 -2
- package/src/utils.ts +61 -12
- package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
- package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
- package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
- package/dist/componentInterfaces-DYkaxBda.js +0 -13
- package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
- package/dist/generated-57_Kffpz.js.map +0 -1
- package/dist/generated-wKBNvm48.cjs +0 -3
- package/dist/generated-wKBNvm48.cjs.map +0 -1
- package/src/Budgets/SimpleBudget.test.ts +0 -152
- package/src/Budgets/SimpleBudget.ts +0 -564
|
@@ -20,7 +20,9 @@ import {
|
|
|
20
20
|
type ContractEventName,
|
|
21
21
|
type Hex,
|
|
22
22
|
encodeAbiParameters,
|
|
23
|
+
zeroHash,
|
|
23
24
|
} from 'viem';
|
|
25
|
+
import { CGDAIncentive as CGDAIncentiveBases } from '../../dist/deployments.json';
|
|
24
26
|
import type {
|
|
25
27
|
DeployableOptions,
|
|
26
28
|
GenericDeployableParams,
|
|
@@ -74,6 +76,12 @@ export interface CGDAIncentivePayload {
|
|
|
74
76
|
* @type {bigint}
|
|
75
77
|
*/
|
|
76
78
|
totalBudget: bigint;
|
|
79
|
+
/**
|
|
80
|
+
* The entity that can `clawback` funds
|
|
81
|
+
*
|
|
82
|
+
* @type {Address}
|
|
83
|
+
*/
|
|
84
|
+
manager: Address;
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
/**
|
|
@@ -144,10 +152,12 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
144
152
|
*
|
|
145
153
|
* @public
|
|
146
154
|
* @static
|
|
147
|
-
* @type {Address}
|
|
155
|
+
* @type {Record<number, Address>}
|
|
148
156
|
*/
|
|
149
|
-
public static override
|
|
150
|
-
.VITE_CGDA_INCENTIVE_BASE
|
|
157
|
+
public static override bases: Record<number, Address> = {
|
|
158
|
+
31337: import.meta.env.VITE_CGDA_INCENTIVE_BASE,
|
|
159
|
+
...(CGDAIncentiveBases as Record<number, Address>),
|
|
160
|
+
};
|
|
151
161
|
/**
|
|
152
162
|
* @inheritdoc
|
|
153
163
|
*
|
|
@@ -162,8 +172,8 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
162
172
|
*
|
|
163
173
|
* @public
|
|
164
174
|
* @async
|
|
165
|
-
* @param {?ReadParams
|
|
166
|
-
* @returns {
|
|
175
|
+
* @param {?ReadParams} [params]
|
|
176
|
+
* @returns {Promise<Address>}
|
|
167
177
|
*/
|
|
168
178
|
public async owner(params?: ReadParams<typeof cgdaIncentiveAbi, 'owner'>) {
|
|
169
179
|
return await readCgdaIncentiveOwner(this._config, {
|
|
@@ -179,7 +189,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
179
189
|
*
|
|
180
190
|
* @public
|
|
181
191
|
* @async
|
|
182
|
-
* @param {?ReadParams
|
|
192
|
+
* @param {?ReadParams} [params]
|
|
183
193
|
* @returns {Promise<bigint>}
|
|
184
194
|
*/
|
|
185
195
|
public async claims(params?: ReadParams<typeof cgdaIncentiveAbi, 'claims'>) {
|
|
@@ -196,7 +206,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
196
206
|
*
|
|
197
207
|
* @public
|
|
198
208
|
* @async
|
|
199
|
-
* @param {?ReadParams
|
|
209
|
+
* @param {?ReadParams} [params]
|
|
200
210
|
* @returns {Promise<bigint>}
|
|
201
211
|
*/
|
|
202
212
|
public async reward(params?: ReadParams<typeof cgdaIncentiveAbi, 'reward'>) {
|
|
@@ -214,7 +224,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
214
224
|
* @public
|
|
215
225
|
* @async
|
|
216
226
|
* @param {Address} address
|
|
217
|
-
* @param {?ReadParams
|
|
227
|
+
* @param {?ReadParams} [params]
|
|
218
228
|
* @returns {Promise<boolean>}
|
|
219
229
|
*/
|
|
220
230
|
public async claimed(
|
|
@@ -234,8 +244,8 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
234
244
|
*
|
|
235
245
|
* @public
|
|
236
246
|
* @async
|
|
237
|
-
* @param {?ReadParams
|
|
238
|
-
* @returns {
|
|
247
|
+
* @param {?ReadParams} [params]
|
|
248
|
+
* @returns {Promise<Address>}
|
|
239
249
|
*/
|
|
240
250
|
public async asset(params?: ReadParams<typeof cgdaIncentiveAbi, 'asset'>) {
|
|
241
251
|
return await readCgdaIncentiveAsset(this._config, {
|
|
@@ -250,7 +260,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
250
260
|
*
|
|
251
261
|
* @public
|
|
252
262
|
* @async
|
|
253
|
-
* @param {?ReadParams
|
|
263
|
+
* @param {?ReadParams} [params]
|
|
254
264
|
* @returns {Promise<CGDAParameters>}
|
|
255
265
|
*/
|
|
256
266
|
public async cgdaParams(
|
|
@@ -275,7 +285,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
275
285
|
*
|
|
276
286
|
* @public
|
|
277
287
|
* @async
|
|
278
|
-
* @param {?ReadParams
|
|
288
|
+
* @param {?ReadParams} [params]
|
|
279
289
|
* @returns {Promise<bigint>}
|
|
280
290
|
*/
|
|
281
291
|
public async totalBudget(
|
|
@@ -294,7 +304,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
294
304
|
* @public
|
|
295
305
|
* @async
|
|
296
306
|
* @param {ClaimPayload} payload
|
|
297
|
-
* @param {?WriteParams
|
|
307
|
+
* @param {?WriteParams} [params]
|
|
298
308
|
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
299
309
|
*/
|
|
300
310
|
protected async claim(
|
|
@@ -310,7 +320,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
310
320
|
* @public
|
|
311
321
|
* @async
|
|
312
322
|
* @param {ClaimPayload} payload
|
|
313
|
-
* @param {?WriteParams
|
|
323
|
+
* @param {?WriteParams} [params]
|
|
314
324
|
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
315
325
|
*/
|
|
316
326
|
protected async claimRaw(
|
|
@@ -334,7 +344,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
334
344
|
* @public
|
|
335
345
|
* @async
|
|
336
346
|
* @param {ClaimPayload} payload
|
|
337
|
-
* @param {?WriteParams
|
|
347
|
+
* @param {?WriteParams} [params]
|
|
338
348
|
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
339
349
|
*/
|
|
340
350
|
public async clawback(
|
|
@@ -350,7 +360,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
350
360
|
* @public
|
|
351
361
|
* @async
|
|
352
362
|
* @param {ClaimPayload} payload
|
|
353
|
-
* @param {?WriteParams
|
|
363
|
+
* @param {?WriteParams} [params]
|
|
354
364
|
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
355
365
|
*/
|
|
356
366
|
public async clawbackRaw(
|
|
@@ -377,7 +387,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
377
387
|
* @public
|
|
378
388
|
* @async
|
|
379
389
|
* @param {ClaimPayload} payload
|
|
380
|
-
* @param {?ReadParams
|
|
390
|
+
* @param {?ReadParams} [params]
|
|
381
391
|
* @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload
|
|
382
392
|
*/
|
|
383
393
|
public async isClaimable(
|
|
@@ -399,7 +409,7 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
399
409
|
*
|
|
400
410
|
* @public
|
|
401
411
|
* @async
|
|
402
|
-
* @param {?ReadParams
|
|
412
|
+
* @param {?ReadParams} [params]
|
|
403
413
|
* @returns {Promise<bigint>} - The current reward
|
|
404
414
|
*/
|
|
405
415
|
public async currentReward(
|
|
@@ -435,6 +445,17 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
435
445
|
...this.optionallyAttachAccount(options.account),
|
|
436
446
|
};
|
|
437
447
|
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Builds the claim data for the CGDAIncentive.
|
|
451
|
+
*
|
|
452
|
+
* @public
|
|
453
|
+
* @returns {Hash} A `zeroHash`, as CGDAIncentive doesn't require specific claim data.
|
|
454
|
+
* @description This function returns `zeroHash` because CGDAIncentive doesn't use any specific claim data.
|
|
455
|
+
*/
|
|
456
|
+
public buildClaimData() {
|
|
457
|
+
return zeroHash;
|
|
458
|
+
}
|
|
438
459
|
}
|
|
439
460
|
|
|
440
461
|
/**
|
|
@@ -2,7 +2,7 @@ import { readMockErc1155BalanceOf } from '@boostxyz/evm';
|
|
|
2
2
|
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
|
|
3
3
|
import { isAddress, pad, parseEther, zeroAddress, zeroHash } from 'viem';
|
|
4
4
|
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
5
|
-
import { accounts } from '
|
|
5
|
+
import { accounts } from '@boostxyz/test/accounts';
|
|
6
6
|
import {
|
|
7
7
|
type BudgetFixtures,
|
|
8
8
|
type Fixtures,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
deployFixtures,
|
|
11
11
|
freshBoost,
|
|
12
12
|
fundBudget,
|
|
13
|
-
} from '
|
|
13
|
+
} from '@boostxyz/test/helpers';
|
|
14
14
|
import { ERC1155Incentive, ERC1155StrategyType } from './ERC1155Incentive';
|
|
15
15
|
|
|
16
16
|
const BOOST_CORE_CLAIM_FEE = parseEther('0.000075');
|
|
@@ -19,7 +19,7 @@ let fixtures: Fixtures, budgets: BudgetFixtures;
|
|
|
19
19
|
|
|
20
20
|
describe.skip('ERC1155Incentive', () => {
|
|
21
21
|
beforeAll(async () => {
|
|
22
|
-
fixtures = await loadFixture(deployFixtures);
|
|
22
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
beforeEach(async () => {
|
|
@@ -127,10 +127,11 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
127
127
|
*
|
|
128
128
|
* @public
|
|
129
129
|
* @static
|
|
130
|
-
* @type {Address}
|
|
130
|
+
* @type {Record<number, Address>}
|
|
131
131
|
*/
|
|
132
|
-
public static override
|
|
133
|
-
.VITE_ERC1155_INCENTIVE_BASE
|
|
132
|
+
public static override bases: Record<number, Address> = {
|
|
133
|
+
31337: import.meta.env.VITE_ERC1155_INCENTIVE_BASE,
|
|
134
|
+
};
|
|
134
135
|
/**
|
|
135
136
|
* @inheritdoc
|
|
136
137
|
*
|
|
@@ -145,8 +146,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
145
146
|
*
|
|
146
147
|
* @public
|
|
147
148
|
* @async
|
|
148
|
-
* @param {?ReadParams
|
|
149
|
-
* @returns {
|
|
149
|
+
* @param {?ReadParams} [params]
|
|
150
|
+
* @returns {Promise<bigint>}
|
|
150
151
|
*/
|
|
151
152
|
public async claims(
|
|
152
153
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'claims'>,
|
|
@@ -164,8 +165,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
164
165
|
*
|
|
165
166
|
* @public
|
|
166
167
|
* @async
|
|
167
|
-
* @param {?ReadParams
|
|
168
|
-
* @returns {
|
|
168
|
+
* @param {?ReadParams} [params]
|
|
169
|
+
* @returns {Promise<bigint>}
|
|
169
170
|
*/
|
|
170
171
|
public async reward(
|
|
171
172
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'reward'>,
|
|
@@ -184,8 +185,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
184
185
|
* @public
|
|
185
186
|
* @async
|
|
186
187
|
* @param {Address} address
|
|
187
|
-
* @param {?ReadParams
|
|
188
|
-
* @returns {
|
|
188
|
+
* @param {?ReadParams} [params]
|
|
189
|
+
* @returns {Promise<boolean>}
|
|
189
190
|
*/
|
|
190
191
|
public async claimed(
|
|
191
192
|
address: Address,
|
|
@@ -204,8 +205,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
204
205
|
*
|
|
205
206
|
* @public
|
|
206
207
|
* @async
|
|
207
|
-
* @param {?ReadParams
|
|
208
|
-
* @returns {
|
|
208
|
+
* @param {?ReadParams} [params]
|
|
209
|
+
* @returns {Promise<Address>}
|
|
209
210
|
*/
|
|
210
211
|
public async asset(params?: ReadParams<typeof erc1155IncentiveAbi, 'asset'>) {
|
|
211
212
|
return await readErc1155IncentiveAsset(this._config, {
|
|
@@ -220,7 +221,7 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
220
221
|
*
|
|
221
222
|
* @public
|
|
222
223
|
* @async
|
|
223
|
-
* @param {?ReadParams
|
|
224
|
+
* @param {?ReadParams} [params]
|
|
224
225
|
* @returns {Promise<StrategyType>}
|
|
225
226
|
*/
|
|
226
227
|
public strategy(
|
|
@@ -238,7 +239,7 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
238
239
|
*
|
|
239
240
|
* @public
|
|
240
241
|
* @async
|
|
241
|
-
* @param {?ReadParams
|
|
242
|
+
* @param {?ReadParams} [params]
|
|
242
243
|
* @returns {unknown}
|
|
243
244
|
*/
|
|
244
245
|
public async limit(params?: ReadParams<typeof erc1155IncentiveAbi, 'limit'>) {
|
|
@@ -254,8 +255,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
254
255
|
*
|
|
255
256
|
* @public
|
|
256
257
|
* @async
|
|
257
|
-
* @param {?ReadParams
|
|
258
|
-
* @returns {
|
|
258
|
+
* @param {?ReadParams} [params]
|
|
259
|
+
* @returns {Promise<bigint>}
|
|
259
260
|
*/
|
|
260
261
|
public async tokenId(
|
|
261
262
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'tokenId'>,
|
|
@@ -272,8 +273,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
272
273
|
*
|
|
273
274
|
* @public
|
|
274
275
|
* @async
|
|
275
|
-
* @param {?ReadParams
|
|
276
|
-
* @returns {
|
|
276
|
+
* @param {?ReadParams} [params]
|
|
277
|
+
* @returns {Promise<Hex>}
|
|
277
278
|
*/
|
|
278
279
|
public async extraData(
|
|
279
280
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'extraData'>,
|
|
@@ -291,8 +292,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
291
292
|
* @public
|
|
292
293
|
* @async
|
|
293
294
|
* @param {ClaimPayload} payload
|
|
294
|
-
* @param {?WriteParams
|
|
295
|
-
* @returns {
|
|
295
|
+
* @param {?WriteParams} [params]
|
|
296
|
+
* @returns {Promise<boolean>}
|
|
296
297
|
*/
|
|
297
298
|
protected async claim(
|
|
298
299
|
payload: ClaimPayload,
|
|
@@ -307,8 +308,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
307
308
|
* @public
|
|
308
309
|
* @async
|
|
309
310
|
* @param {ClaimPayload} payload
|
|
310
|
-
* @param {?WriteParams
|
|
311
|
-
* @returns {
|
|
311
|
+
* @param {?WriteParams} [params]
|
|
312
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>}
|
|
312
313
|
*/
|
|
313
314
|
protected async claimRaw(
|
|
314
315
|
payload: ClaimPayload,
|
|
@@ -334,8 +335,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
334
335
|
* @public
|
|
335
336
|
* @async
|
|
336
337
|
* @param {ClaimPayload} payload
|
|
337
|
-
* @param {?WriteParams
|
|
338
|
-
* @returns {
|
|
338
|
+
* @param {?WriteParams} [params]
|
|
339
|
+
* @returns {Promise<boolean>}
|
|
339
340
|
*/
|
|
340
341
|
public async clawback(
|
|
341
342
|
payload: ClaimPayload,
|
|
@@ -350,8 +351,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
350
351
|
* @public
|
|
351
352
|
* @async
|
|
352
353
|
* @param {ClaimPayload} payload
|
|
353
|
-
* @param {?WriteParams
|
|
354
|
-
* @returns {
|
|
354
|
+
* @param {?WriteParams} [params]
|
|
355
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>}
|
|
355
356
|
*/
|
|
356
357
|
public async clawbackRaw(
|
|
357
358
|
payload: ClaimPayload,
|
|
@@ -377,8 +378,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
377
378
|
* @public
|
|
378
379
|
* @async
|
|
379
380
|
* @param {ClaimPayload} payload
|
|
380
|
-
* @param {?ReadParams
|
|
381
|
-
* @returns {
|
|
381
|
+
* @param {?ReadParams} [params]
|
|
382
|
+
* @returns {Promise<boolean>}
|
|
382
383
|
*/
|
|
383
384
|
public async isClaimable(
|
|
384
385
|
payload: ClaimPayload,
|
|
@@ -398,8 +399,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
398
399
|
* @public
|
|
399
400
|
* @async
|
|
400
401
|
* @param {ERC1155IncentivePayload} data
|
|
401
|
-
* @param {?ReadParams
|
|
402
|
-
* @returns {
|
|
402
|
+
* @param {?ReadParams} [params]
|
|
403
|
+
* @returns {Promise<Hex>}
|
|
403
404
|
*/
|
|
404
405
|
public async preflight(
|
|
405
406
|
data: ERC1155IncentivePayload,
|
|
@@ -2,7 +2,7 @@ import { readMockErc20BalanceOf } from '@boostxyz/evm';
|
|
|
2
2
|
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
|
|
3
3
|
import { isAddress, pad, parseEther, zeroAddress } from 'viem';
|
|
4
4
|
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
5
|
-
import { accounts } from '
|
|
5
|
+
import { accounts } from '@boostxyz/test/accounts';
|
|
6
6
|
import {
|
|
7
7
|
type BudgetFixtures,
|
|
8
8
|
type Fixtures,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
deployFixtures,
|
|
11
11
|
freshBoost,
|
|
12
12
|
fundBudget,
|
|
13
|
-
} from '
|
|
13
|
+
} from '@boostxyz/test/helpers';
|
|
14
14
|
import { BOOST_CORE_CLAIM_FEE } from '../BoostCore';
|
|
15
15
|
import { StrategyType } from '../claiming';
|
|
16
16
|
import { ERC20Incentive } from './ERC20Incentive';
|
|
@@ -19,7 +19,7 @@ let fixtures: Fixtures, budgets: BudgetFixtures;
|
|
|
19
19
|
|
|
20
20
|
describe('ERC20Incentive', () => {
|
|
21
21
|
beforeAll(async () => {
|
|
22
|
-
fixtures = await loadFixture(deployFixtures);
|
|
22
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
beforeEach(async () => {
|
|
@@ -32,6 +32,7 @@ describe('ERC20Incentive', () => {
|
|
|
32
32
|
strategy: StrategyType.POOL,
|
|
33
33
|
reward: 1n,
|
|
34
34
|
limit: 1n,
|
|
35
|
+
manager: zeroAddress,
|
|
35
36
|
});
|
|
36
37
|
await action.deploy();
|
|
37
38
|
expect(isAddress(action.assertValidAddress())).toBe(true);
|
|
@@ -42,11 +43,12 @@ describe('ERC20Incentive', () => {
|
|
|
42
43
|
const referrer = accounts.at(1)!.account!,
|
|
43
44
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
44
45
|
trustedSigner = accounts.at(0)!;
|
|
45
|
-
const erc20Incentive =
|
|
46
|
+
const erc20Incentive = fixtures.core.ERC20Incentive({
|
|
46
47
|
asset: budgets.erc20.assertValidAddress(),
|
|
47
48
|
strategy: StrategyType.POOL,
|
|
48
49
|
reward: 1n,
|
|
49
50
|
limit: 1n,
|
|
51
|
+
manager: budgets.budget.assertValidAddress(),
|
|
50
52
|
});
|
|
51
53
|
const boost = await freshBoost(fixtures, {
|
|
52
54
|
budget: budgets.budget,
|
|
@@ -54,7 +56,7 @@ describe('ERC20Incentive', () => {
|
|
|
54
56
|
});
|
|
55
57
|
|
|
56
58
|
const claimant = trustedSigner.account;
|
|
57
|
-
const incentiveData =
|
|
59
|
+
const incentiveData = erc20Incentive.buildClaimData();
|
|
58
60
|
const incentiveQuantity = 1;
|
|
59
61
|
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
60
62
|
signer: trustedSigner,
|
|
@@ -85,11 +87,12 @@ describe('ERC20Incentive', () => {
|
|
|
85
87
|
const referrer = accounts.at(1)!.account!;
|
|
86
88
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
87
89
|
const trustedSigner = accounts.at(0)!;
|
|
88
|
-
const erc20Incentive =
|
|
90
|
+
const erc20Incentive = fixtures.core.ERC20Incentive({
|
|
89
91
|
asset: budgets.erc20.assertValidAddress(),
|
|
90
92
|
strategy: StrategyType.POOL,
|
|
91
93
|
reward: 1n,
|
|
92
94
|
limit: 1n,
|
|
95
|
+
manager: budgets.budget.assertValidAddress(),
|
|
93
96
|
});
|
|
94
97
|
const boost = await freshBoost(fixtures, {
|
|
95
98
|
budget: budgets.budget,
|
|
@@ -23,7 +23,10 @@ import {
|
|
|
23
23
|
type ContractEventName,
|
|
24
24
|
type Hex,
|
|
25
25
|
encodeAbiParameters,
|
|
26
|
+
zeroAddress,
|
|
27
|
+
zeroHash,
|
|
26
28
|
} from 'viem';
|
|
29
|
+
import { ERC20Incentive as ERC20IncentiveBases } from '../../dist/deployments.json';
|
|
27
30
|
import type {
|
|
28
31
|
DeployableOptions,
|
|
29
32
|
GenericDeployableParams,
|
|
@@ -75,6 +78,14 @@ export interface ERC20IncentivePayload {
|
|
|
75
78
|
* @type {bigint}
|
|
76
79
|
*/
|
|
77
80
|
limit: bigint;
|
|
81
|
+
/**
|
|
82
|
+
* (Optional) The address of the entity that can trigger a raffle.
|
|
83
|
+
* If omitted, the incentive will have no manager with permissions to draw the raffle.
|
|
84
|
+
*
|
|
85
|
+
* @type {Address}
|
|
86
|
+
* @optional
|
|
87
|
+
*/
|
|
88
|
+
manager?: Address;
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
/**
|
|
@@ -110,10 +121,12 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
110
121
|
*
|
|
111
122
|
* @public
|
|
112
123
|
* @static
|
|
113
|
-
* @type {Address}
|
|
124
|
+
* @type {Record<number, Address>}
|
|
114
125
|
*/
|
|
115
|
-
public static override
|
|
116
|
-
.VITE_ERC20_INCENTIVE_BASE
|
|
126
|
+
public static override bases: Record<number, Address> = {
|
|
127
|
+
31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,
|
|
128
|
+
...(ERC20IncentiveBases as Record<number, Address>),
|
|
129
|
+
};
|
|
117
130
|
/**
|
|
118
131
|
* @inheritdoc
|
|
119
132
|
*
|
|
@@ -128,8 +141,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
128
141
|
*
|
|
129
142
|
* @public
|
|
130
143
|
* @async
|
|
131
|
-
* @param {?ReadParams
|
|
132
|
-
* @returns {
|
|
144
|
+
* @param {?ReadParams} [params]
|
|
145
|
+
* @returns {Promise<Address>}
|
|
133
146
|
*/
|
|
134
147
|
public async owner(params?: ReadParams<typeof erc20IncentiveAbi, 'owner'>) {
|
|
135
148
|
return await readErc20IncentiveOwner(this._config, {
|
|
@@ -145,7 +158,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
145
158
|
*
|
|
146
159
|
* @public
|
|
147
160
|
* @async
|
|
148
|
-
* @param {?ReadParams
|
|
161
|
+
* @param {?ReadParams} [params]
|
|
149
162
|
* @returns {Promise<bigint>} - The current reward
|
|
150
163
|
*/
|
|
151
164
|
public async currentReward(
|
|
@@ -164,7 +177,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
164
177
|
*
|
|
165
178
|
* @public
|
|
166
179
|
* @async
|
|
167
|
-
* @param {?ReadParams
|
|
180
|
+
* @param {?ReadParams} [params]
|
|
168
181
|
* @returns {Promise<bigint>}
|
|
169
182
|
*/
|
|
170
183
|
public async claims(params?: ReadParams<typeof erc20IncentiveAbi, 'claims'>) {
|
|
@@ -182,7 +195,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
182
195
|
* @public
|
|
183
196
|
* @async
|
|
184
197
|
* @param {Address} address
|
|
185
|
-
* @param {?ReadParams
|
|
198
|
+
* @param {?ReadParams} [params]
|
|
186
199
|
* @returns {Promise<boolean>}
|
|
187
200
|
*/
|
|
188
201
|
public async claimed(
|
|
@@ -202,7 +215,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
202
215
|
*
|
|
203
216
|
* @public
|
|
204
217
|
* @async
|
|
205
|
-
* @param {?ReadParams
|
|
218
|
+
* @param {?ReadParams} [params]
|
|
206
219
|
* @returns {Promise<Address>}
|
|
207
220
|
*/
|
|
208
221
|
public async asset(params?: ReadParams<typeof erc20IncentiveAbi, 'asset'>) {
|
|
@@ -218,7 +231,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
218
231
|
*
|
|
219
232
|
* @public
|
|
220
233
|
* @async
|
|
221
|
-
* @param {?ReadParams
|
|
234
|
+
* @param {?ReadParams} [params]
|
|
222
235
|
* @returns {Promise<StrategyType>}
|
|
223
236
|
*/
|
|
224
237
|
public strategy(
|
|
@@ -236,7 +249,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
236
249
|
*
|
|
237
250
|
* @public
|
|
238
251
|
* @async
|
|
239
|
-
* @param {?ReadParams
|
|
252
|
+
* @param {?ReadParams} [params]
|
|
240
253
|
* @returns {Promise<bigint>}
|
|
241
254
|
*/
|
|
242
255
|
public async reward(params?: ReadParams<typeof erc20IncentiveAbi, 'reward'>) {
|
|
@@ -252,8 +265,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
252
265
|
*
|
|
253
266
|
* @public
|
|
254
267
|
* @async
|
|
255
|
-
* @param {?ReadParams
|
|
256
|
-
* @returns {
|
|
268
|
+
* @param {?ReadParams} [params]
|
|
269
|
+
* @returns {Promise<bigint>}
|
|
257
270
|
*/
|
|
258
271
|
public async limit(params?: ReadParams<typeof erc20IncentiveAbi, 'limit'>) {
|
|
259
272
|
return await readErc20IncentiveLimit(this._config, {
|
|
@@ -269,7 +282,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
269
282
|
* @public
|
|
270
283
|
* @async
|
|
271
284
|
* @param {bigint} i - Index of address
|
|
272
|
-
* @param {?ReadParams
|
|
285
|
+
* @param {?ReadParams} [params]
|
|
273
286
|
* @returns {Promise<Address>}
|
|
274
287
|
*/
|
|
275
288
|
public async entries(
|
|
@@ -290,7 +303,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
290
303
|
* @public
|
|
291
304
|
* @async
|
|
292
305
|
* @param {ClaimPayload} payload
|
|
293
|
-
* @param {?WriteParams
|
|
306
|
+
* @param {?WriteParams} [params]
|
|
294
307
|
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
295
308
|
*/
|
|
296
309
|
protected async claim(
|
|
@@ -306,8 +319,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
306
319
|
* @public
|
|
307
320
|
* @async
|
|
308
321
|
* @param {ClaimPayload} payload
|
|
309
|
-
* @param {?WriteParams
|
|
310
|
-
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
322
|
+
* @param {?WriteParams} [params]
|
|
323
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed
|
|
311
324
|
*/
|
|
312
325
|
protected async claimRaw(
|
|
313
326
|
payload: ClaimPayload,
|
|
@@ -333,7 +346,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
333
346
|
* @public
|
|
334
347
|
* @async
|
|
335
348
|
* @param {ClaimPayload} payload
|
|
336
|
-
* @param {?WriteParams
|
|
349
|
+
* @param {?WriteParams} [params]
|
|
337
350
|
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
338
351
|
*/
|
|
339
352
|
public async clawback(
|
|
@@ -349,8 +362,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
349
362
|
* @public
|
|
350
363
|
* @async
|
|
351
364
|
* @param {ClaimPayload} payload
|
|
352
|
-
* @param {?WriteParams
|
|
353
|
-
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
365
|
+
* @param {?WriteParams} [params]
|
|
366
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked
|
|
354
367
|
*/
|
|
355
368
|
public async clawbackRaw(
|
|
356
369
|
payload: ClaimPayload,
|
|
@@ -376,8 +389,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
376
389
|
* @public
|
|
377
390
|
* @async
|
|
378
391
|
* @param {ClaimPayload} payload
|
|
379
|
-
* @param {?ReadParams
|
|
380
|
-
* @returns {
|
|
392
|
+
* @param {?ReadParams} [params]
|
|
393
|
+
* @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload
|
|
381
394
|
*/
|
|
382
395
|
public async isClaimable(
|
|
383
396
|
payload: ClaimPayload,
|
|
@@ -396,7 +409,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
396
409
|
*
|
|
397
410
|
* @public
|
|
398
411
|
* @async
|
|
399
|
-
* @param {?WriteParams
|
|
412
|
+
* @param {?WriteParams} [params]
|
|
400
413
|
* @returns {Promise<void>}
|
|
401
414
|
*/
|
|
402
415
|
public async drawRaffle(
|
|
@@ -410,8 +423,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
410
423
|
*
|
|
411
424
|
* @public
|
|
412
425
|
* @async
|
|
413
|
-
* @param {?WriteParams
|
|
414
|
-
* @returns {Promise<void>}
|
|
426
|
+
* @param {?WriteParams} [params]
|
|
427
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
415
428
|
*/
|
|
416
429
|
public async drawRaffleRaw(
|
|
417
430
|
params?: WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>,
|
|
@@ -452,6 +465,17 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
452
465
|
...this.optionallyAttachAccount(options.account),
|
|
453
466
|
};
|
|
454
467
|
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Builds the claim data for the ERC20Incentive.
|
|
471
|
+
*
|
|
472
|
+
* @public
|
|
473
|
+
* @returns {Hash} A `zeroHash`, as ERC20Incentive doesn't require specific claim data.
|
|
474
|
+
* @description This function returns `zeroHash` because ERC20Incentive doesn't use any specific claim data.
|
|
475
|
+
*/
|
|
476
|
+
public buildClaimData() {
|
|
477
|
+
return zeroHash;
|
|
478
|
+
}
|
|
455
479
|
}
|
|
456
480
|
|
|
457
481
|
/**
|
|
@@ -462,13 +486,15 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
462
486
|
* @param {StrategyType} param0.strategy - The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`
|
|
463
487
|
* @param {bigint} param0.reward - The amount of the asset to distribute.
|
|
464
488
|
* @param {bigint} param0.limit - How many times can this incentive be claimed.
|
|
465
|
-
* @
|
|
489
|
+
* @param {Address} [param0.manager=zeroAddress] - The entity that can draw raffles - defaults to unset
|
|
490
|
+
* @returns {Hex}
|
|
466
491
|
*/
|
|
467
492
|
export function prepareERC20IncentivePayload({
|
|
468
493
|
asset,
|
|
469
494
|
strategy,
|
|
470
495
|
reward,
|
|
471
496
|
limit,
|
|
497
|
+
manager = zeroAddress,
|
|
472
498
|
}: ERC20IncentivePayload) {
|
|
473
499
|
return encodeAbiParameters(
|
|
474
500
|
[
|
|
@@ -476,7 +502,8 @@ export function prepareERC20IncentivePayload({
|
|
|
476
502
|
{ type: 'uint8', name: 'strategy' },
|
|
477
503
|
{ type: 'uint256', name: 'reward' },
|
|
478
504
|
{ type: 'uint256', name: 'limit' },
|
|
505
|
+
{ type: 'address', name: 'manager' },
|
|
479
506
|
],
|
|
480
|
-
[asset, strategy, reward, limit],
|
|
507
|
+
[asset, strategy, reward, limit, manager],
|
|
481
508
|
);
|
|
482
509
|
}
|