@boostxyz/sdk 0.0.0-alpha.16 → 0.0.0-alpha.18
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 +7 -7
- package/dist/Actions/ContractAction.d.ts +9 -9
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +12 -12
- 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 +32 -49
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +13 -779
- 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.js +3 -3
- package/dist/AllowLists/OpenAllowList.d.ts +183 -0
- package/dist/AllowLists/OpenAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +82 -36
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +44 -80
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +192 -9
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +5 -5
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.d.ts +18 -0
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore-BiPwp6SR.cjs +3 -0
- package/dist/BoostCore-BiPwp6SR.cjs.map +1 -0
- package/dist/BoostCore-C00iqvks.js +1477 -0
- package/dist/BoostCore-C00iqvks.js.map +1 -0
- package/dist/BoostCore.cjs +1 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +80 -35
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +29 -1273
- 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 -18
- package/dist/BoostRegistry.js +36 -36
- 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 +24 -174
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +76 -298
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +181 -77
- 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 +4 -5
- 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.js +1 -1
- 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 +5 -5
- package/dist/Deployable/DeployableTarget.js +10 -10
- 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 +179 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
- package/dist/EventAction-BO5WI_5s.js +1355 -0
- package/dist/EventAction-BO5WI_5s.js.map +1 -0
- package/dist/EventAction-DBDRaG4A.cjs +2 -0
- package/dist/EventAction-DBDRaG4A.cjs.map +1 -0
- package/dist/{Incentive-CtuAJAjG.js → Incentive-CF7kaz_9.js} +67 -68
- package/dist/Incentive-CF7kaz_9.js.map +1 -0
- package/dist/{Incentive-CqX3fYEd.cjs → Incentive-Djnzseoj.cjs} +2 -2
- package/dist/Incentive-Djnzseoj.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +12 -12
- package/dist/Incentives/AllowListIncentive.js +26 -26
- 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 +15 -15
- package/dist/Incentives/CGDAIncentive.js +25 -25
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +30 -30
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +23 -23
- package/dist/Incentives/ERC20Incentive.js +45 -45
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +523 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +19 -19
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.d.ts +3 -3
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +3 -3
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +14 -14
- package/dist/Incentives/PointsIncentive.js +20 -20
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/SimpleDenyList-BwfNjRsg.cjs +2 -0
- package/dist/SimpleDenyList-BwfNjRsg.cjs.map +1 -0
- package/dist/SimpleDenyList-D9i4rw_F.js +132 -0
- package/dist/SimpleDenyList-D9i4rw_F.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +14 -14
- package/dist/Validators/SignerValidator.js +25 -25
- 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 +6 -6
- 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-D09mhzxO.cjs +2 -0
- package/dist/componentInterfaces-D09mhzxO.cjs.map +1 -0
- package/dist/componentInterfaces-RXBMI5yH.js +14 -0
- package/dist/componentInterfaces-RXBMI5yH.js.map +1 -0
- package/dist/deployments-BM42vImE.js +43 -0
- package/dist/deployments-BM42vImE.js.map +1 -0
- package/dist/deployments-CMdF5uEC.cjs +2 -0
- package/dist/deployments-CMdF5uEC.cjs.map +1 -0
- package/dist/deployments.json +15 -12
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +132 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +122 -36
- package/dist/errors.js.map +1 -1
- package/dist/generated-B0tk-c9b.cjs +3 -0
- package/dist/generated-B0tk-c9b.cjs.map +1 -0
- package/dist/{generated-DLMdMwD1.js → generated-B8VWObPa.js} +2350 -1290
- package/dist/generated-B8VWObPa.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +134 -122
- 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.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +12 -5
- package/src/Actions/ContractAction.ts +9 -10
- package/src/Actions/ERC721MintAction.ts +12 -13
- package/src/Actions/EventAction.test.ts +182 -53
- package/src/Actions/EventAction.ts +128 -107
- package/src/AllowLists/SimpleAllowList.ts +14 -59
- package/src/AllowLists/SimpleDenyList.ts +12 -9
- package/src/Boost.ts +19 -0
- package/src/BoostCore.test.ts +117 -1
- package/src/BoostCore.ts +113 -54
- package/src/BoostRegistry.ts +18 -18
- package/src/Budgets/Budget.ts +1 -2
- package/src/Budgets/ManagedBudget.ts +21 -295
- package/src/Budgets/VestingBudget.ts +26 -97
- package/src/Deployable/Contract.ts +4 -5
- package/src/Deployable/Deployable.ts +1 -1
- package/src/Deployable/DeployableTarget.ts +5 -5
- package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
- package/src/Incentives/AllowListIncentive.ts +12 -12
- package/src/Incentives/CGDAIncentive.ts +15 -15
- package/src/Incentives/ERC1155Incentive.ts +26 -26
- package/src/Incentives/ERC20Incentive.ts +23 -23
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
- package/src/Incentives/ERC20VariableIncentive.ts +19 -19
- package/src/Incentives/Incentive.ts +6 -5
- package/src/Incentives/PointsIncentive.test.ts +21 -21
- package/src/Incentives/PointsIncentive.ts +14 -14
- package/src/Validators/SignerValidator.ts +14 -14
- package/src/Validators/Validator.ts +1 -1
- package/src/claiming.ts +1 -1
- package/src/errors.ts +165 -0
- package/src/index.test.ts +3 -4
- package/src/index.ts +2 -0
- package/src/transfers.ts +1 -1
- package/src/utils.ts +1 -1
- package/dist/Budgets/SimpleBudget.d.ts +0 -824
- package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
- package/dist/Incentive-CqX3fYEd.cjs.map +0 -1
- package/dist/Incentive-CtuAJAjG.js.map +0 -1
- package/dist/SimpleDenyList-9UIxZZKP.cjs +0 -2
- package/dist/SimpleDenyList-9UIxZZKP.cjs.map +0 -1
- package/dist/SimpleDenyList-DGPNc7ov.js +0 -132
- package/dist/SimpleDenyList-DGPNc7ov.js.map +0 -1
- package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
- package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
- package/dist/componentInterfaces-Cmg8tUxq.js +0 -13
- package/dist/componentInterfaces-Cmg8tUxq.js.map +0 -1
- package/dist/deployments-BvFcK_eR.js +0 -40
- package/dist/deployments-BvFcK_eR.js.map +0 -1
- package/dist/deployments-Ho4PnGCS.cjs +0 -2
- package/dist/deployments-Ho4PnGCS.cjs.map +0 -1
- package/dist/generated-BLg7yPgI.cjs +0 -3
- package/dist/generated-BLg7yPgI.cjs.map +0 -1
- package/dist/generated-DLMdMwD1.js.map +0 -1
- package/src/Budgets/SimpleBudget.test.ts +0 -152
- package/src/Budgets/SimpleBudget.ts +0 -563
|
@@ -144,8 +144,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
144
144
|
*
|
|
145
145
|
* @public
|
|
146
146
|
* @async
|
|
147
|
-
* @param {?ReadParams
|
|
148
|
-
* @returns {
|
|
147
|
+
* @param {?ReadParams} [params]
|
|
148
|
+
* @returns {Promise<bigint>}
|
|
149
149
|
*/
|
|
150
150
|
public async claims(
|
|
151
151
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'claims'>,
|
|
@@ -163,8 +163,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
163
163
|
*
|
|
164
164
|
* @public
|
|
165
165
|
* @async
|
|
166
|
-
* @param {?ReadParams
|
|
167
|
-
* @returns {
|
|
166
|
+
* @param {?ReadParams} [params]
|
|
167
|
+
* @returns {Promise<bigint>}
|
|
168
168
|
*/
|
|
169
169
|
public async reward(
|
|
170
170
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'reward'>,
|
|
@@ -183,8 +183,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
183
183
|
* @public
|
|
184
184
|
* @async
|
|
185
185
|
* @param {Address} address
|
|
186
|
-
* @param {?ReadParams
|
|
187
|
-
* @returns {
|
|
186
|
+
* @param {?ReadParams} [params]
|
|
187
|
+
* @returns {Promise<boolean>}
|
|
188
188
|
*/
|
|
189
189
|
public async claimed(
|
|
190
190
|
address: Address,
|
|
@@ -203,8 +203,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
203
203
|
*
|
|
204
204
|
* @public
|
|
205
205
|
* @async
|
|
206
|
-
* @param {?ReadParams
|
|
207
|
-
* @returns {
|
|
206
|
+
* @param {?ReadParams} [params]
|
|
207
|
+
* @returns {Promise<Address>}
|
|
208
208
|
*/
|
|
209
209
|
public async asset(params?: ReadParams<typeof erc1155IncentiveAbi, 'asset'>) {
|
|
210
210
|
return await readErc1155IncentiveAsset(this._config, {
|
|
@@ -219,7 +219,7 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
219
219
|
*
|
|
220
220
|
* @public
|
|
221
221
|
* @async
|
|
222
|
-
* @param {?ReadParams
|
|
222
|
+
* @param {?ReadParams} [params]
|
|
223
223
|
* @returns {Promise<StrategyType>}
|
|
224
224
|
*/
|
|
225
225
|
public strategy(
|
|
@@ -237,7 +237,7 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
237
237
|
*
|
|
238
238
|
* @public
|
|
239
239
|
* @async
|
|
240
|
-
* @param {?ReadParams
|
|
240
|
+
* @param {?ReadParams} [params]
|
|
241
241
|
* @returns {unknown}
|
|
242
242
|
*/
|
|
243
243
|
public async limit(params?: ReadParams<typeof erc1155IncentiveAbi, 'limit'>) {
|
|
@@ -253,8 +253,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
253
253
|
*
|
|
254
254
|
* @public
|
|
255
255
|
* @async
|
|
256
|
-
* @param {?ReadParams
|
|
257
|
-
* @returns {
|
|
256
|
+
* @param {?ReadParams} [params]
|
|
257
|
+
* @returns {Promise<bigint>}
|
|
258
258
|
*/
|
|
259
259
|
public async tokenId(
|
|
260
260
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'tokenId'>,
|
|
@@ -271,8 +271,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
271
271
|
*
|
|
272
272
|
* @public
|
|
273
273
|
* @async
|
|
274
|
-
* @param {?ReadParams
|
|
275
|
-
* @returns {
|
|
274
|
+
* @param {?ReadParams} [params]
|
|
275
|
+
* @returns {Promise<Hex>}
|
|
276
276
|
*/
|
|
277
277
|
public async extraData(
|
|
278
278
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'extraData'>,
|
|
@@ -290,8 +290,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
290
290
|
* @public
|
|
291
291
|
* @async
|
|
292
292
|
* @param {ClaimPayload} payload
|
|
293
|
-
* @param {?WriteParams
|
|
294
|
-
* @returns {
|
|
293
|
+
* @param {?WriteParams} [params]
|
|
294
|
+
* @returns {Promise<boolean>}
|
|
295
295
|
*/
|
|
296
296
|
protected async claim(
|
|
297
297
|
payload: ClaimPayload,
|
|
@@ -306,8 +306,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
306
306
|
* @public
|
|
307
307
|
* @async
|
|
308
308
|
* @param {ClaimPayload} payload
|
|
309
|
-
* @param {?WriteParams
|
|
310
|
-
* @returns {
|
|
309
|
+
* @param {?WriteParams} [params]
|
|
310
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>}
|
|
311
311
|
*/
|
|
312
312
|
protected async claimRaw(
|
|
313
313
|
payload: ClaimPayload,
|
|
@@ -333,8 +333,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
333
333
|
* @public
|
|
334
334
|
* @async
|
|
335
335
|
* @param {ClaimPayload} payload
|
|
336
|
-
* @param {?WriteParams
|
|
337
|
-
* @returns {
|
|
336
|
+
* @param {?WriteParams} [params]
|
|
337
|
+
* @returns {Promise<boolean>}
|
|
338
338
|
*/
|
|
339
339
|
public async clawback(
|
|
340
340
|
payload: ClaimPayload,
|
|
@@ -349,8 +349,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
349
349
|
* @public
|
|
350
350
|
* @async
|
|
351
351
|
* @param {ClaimPayload} payload
|
|
352
|
-
* @param {?WriteParams
|
|
353
|
-
* @returns {
|
|
352
|
+
* @param {?WriteParams} [params]
|
|
353
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>}
|
|
354
354
|
*/
|
|
355
355
|
public async clawbackRaw(
|
|
356
356
|
payload: ClaimPayload,
|
|
@@ -376,8 +376,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
376
376
|
* @public
|
|
377
377
|
* @async
|
|
378
378
|
* @param {ClaimPayload} payload
|
|
379
|
-
* @param {?ReadParams
|
|
380
|
-
* @returns {
|
|
379
|
+
* @param {?ReadParams} [params]
|
|
380
|
+
* @returns {Promise<boolean>}
|
|
381
381
|
*/
|
|
382
382
|
public async isClaimable(
|
|
383
383
|
payload: ClaimPayload,
|
|
@@ -397,8 +397,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
397
397
|
* @public
|
|
398
398
|
* @async
|
|
399
399
|
* @param {ERC1155IncentivePayload} data
|
|
400
|
-
* @param {?ReadParams
|
|
401
|
-
* @returns {
|
|
400
|
+
* @param {?ReadParams} [params]
|
|
401
|
+
* @returns {Promise<Hex>}
|
|
402
402
|
*/
|
|
403
403
|
public async preflight(
|
|
404
404
|
data: ERC1155IncentivePayload,
|
|
@@ -130,8 +130,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
130
130
|
*
|
|
131
131
|
* @public
|
|
132
132
|
* @async
|
|
133
|
-
* @param {?ReadParams
|
|
134
|
-
* @returns {
|
|
133
|
+
* @param {?ReadParams} [params]
|
|
134
|
+
* @returns {Promise<Address>}
|
|
135
135
|
*/
|
|
136
136
|
public async owner(params?: ReadParams<typeof erc20IncentiveAbi, 'owner'>) {
|
|
137
137
|
return await readErc20IncentiveOwner(this._config, {
|
|
@@ -147,7 +147,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
147
147
|
*
|
|
148
148
|
* @public
|
|
149
149
|
* @async
|
|
150
|
-
* @param {?ReadParams
|
|
150
|
+
* @param {?ReadParams} [params]
|
|
151
151
|
* @returns {Promise<bigint>} - The current reward
|
|
152
152
|
*/
|
|
153
153
|
public async currentReward(
|
|
@@ -166,7 +166,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
166
166
|
*
|
|
167
167
|
* @public
|
|
168
168
|
* @async
|
|
169
|
-
* @param {?ReadParams
|
|
169
|
+
* @param {?ReadParams} [params]
|
|
170
170
|
* @returns {Promise<bigint>}
|
|
171
171
|
*/
|
|
172
172
|
public async claims(params?: ReadParams<typeof erc20IncentiveAbi, 'claims'>) {
|
|
@@ -184,7 +184,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
184
184
|
* @public
|
|
185
185
|
* @async
|
|
186
186
|
* @param {Address} address
|
|
187
|
-
* @param {?ReadParams
|
|
187
|
+
* @param {?ReadParams} [params]
|
|
188
188
|
* @returns {Promise<boolean>}
|
|
189
189
|
*/
|
|
190
190
|
public async claimed(
|
|
@@ -204,7 +204,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
204
204
|
*
|
|
205
205
|
* @public
|
|
206
206
|
* @async
|
|
207
|
-
* @param {?ReadParams
|
|
207
|
+
* @param {?ReadParams} [params]
|
|
208
208
|
* @returns {Promise<Address>}
|
|
209
209
|
*/
|
|
210
210
|
public async asset(params?: ReadParams<typeof erc20IncentiveAbi, 'asset'>) {
|
|
@@ -220,7 +220,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
220
220
|
*
|
|
221
221
|
* @public
|
|
222
222
|
* @async
|
|
223
|
-
* @param {?ReadParams
|
|
223
|
+
* @param {?ReadParams} [params]
|
|
224
224
|
* @returns {Promise<StrategyType>}
|
|
225
225
|
*/
|
|
226
226
|
public strategy(
|
|
@@ -238,7 +238,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
238
238
|
*
|
|
239
239
|
* @public
|
|
240
240
|
* @async
|
|
241
|
-
* @param {?ReadParams
|
|
241
|
+
* @param {?ReadParams} [params]
|
|
242
242
|
* @returns {Promise<bigint>}
|
|
243
243
|
*/
|
|
244
244
|
public async reward(params?: ReadParams<typeof erc20IncentiveAbi, 'reward'>) {
|
|
@@ -254,8 +254,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
254
254
|
*
|
|
255
255
|
* @public
|
|
256
256
|
* @async
|
|
257
|
-
* @param {?ReadParams
|
|
258
|
-
* @returns {
|
|
257
|
+
* @param {?ReadParams} [params]
|
|
258
|
+
* @returns {Promise<bigint>}
|
|
259
259
|
*/
|
|
260
260
|
public async limit(params?: ReadParams<typeof erc20IncentiveAbi, 'limit'>) {
|
|
261
261
|
return await readErc20IncentiveLimit(this._config, {
|
|
@@ -271,7 +271,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
271
271
|
* @public
|
|
272
272
|
* @async
|
|
273
273
|
* @param {bigint} i - Index of address
|
|
274
|
-
* @param {?ReadParams
|
|
274
|
+
* @param {?ReadParams} [params]
|
|
275
275
|
* @returns {Promise<Address>}
|
|
276
276
|
*/
|
|
277
277
|
public async entries(
|
|
@@ -292,7 +292,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
292
292
|
* @public
|
|
293
293
|
* @async
|
|
294
294
|
* @param {ClaimPayload} payload
|
|
295
|
-
* @param {?WriteParams
|
|
295
|
+
* @param {?WriteParams} [params]
|
|
296
296
|
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
297
297
|
*/
|
|
298
298
|
protected async claim(
|
|
@@ -308,8 +308,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
308
308
|
* @public
|
|
309
309
|
* @async
|
|
310
310
|
* @param {ClaimPayload} payload
|
|
311
|
-
* @param {?WriteParams
|
|
312
|
-
* @returns {Promise<boolean>} - Returns true if successfully claimed
|
|
311
|
+
* @param {?WriteParams} [params]
|
|
312
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed
|
|
313
313
|
*/
|
|
314
314
|
protected async claimRaw(
|
|
315
315
|
payload: ClaimPayload,
|
|
@@ -335,7 +335,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
335
335
|
* @public
|
|
336
336
|
* @async
|
|
337
337
|
* @param {ClaimPayload} payload
|
|
338
|
-
* @param {?WriteParams
|
|
338
|
+
* @param {?WriteParams} [params]
|
|
339
339
|
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
340
340
|
*/
|
|
341
341
|
public async clawback(
|
|
@@ -351,8 +351,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
351
351
|
* @public
|
|
352
352
|
* @async
|
|
353
353
|
* @param {ClaimPayload} payload
|
|
354
|
-
* @param {?WriteParams
|
|
355
|
-
* @returns {Promise<boolean>} - True if the assets were successfully clawbacked
|
|
354
|
+
* @param {?WriteParams} [params]
|
|
355
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked
|
|
356
356
|
*/
|
|
357
357
|
public async clawbackRaw(
|
|
358
358
|
payload: ClaimPayload,
|
|
@@ -378,8 +378,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
378
378
|
* @public
|
|
379
379
|
* @async
|
|
380
380
|
* @param {ClaimPayload} payload
|
|
381
|
-
* @param {?ReadParams
|
|
382
|
-
* @returns {
|
|
381
|
+
* @param {?ReadParams} [params]
|
|
382
|
+
* @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload
|
|
383
383
|
*/
|
|
384
384
|
public async isClaimable(
|
|
385
385
|
payload: ClaimPayload,
|
|
@@ -398,7 +398,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
398
398
|
*
|
|
399
399
|
* @public
|
|
400
400
|
* @async
|
|
401
|
-
* @param {?WriteParams
|
|
401
|
+
* @param {?WriteParams} [params]
|
|
402
402
|
* @returns {Promise<void>}
|
|
403
403
|
*/
|
|
404
404
|
public async drawRaffle(
|
|
@@ -412,8 +412,8 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
412
412
|
*
|
|
413
413
|
* @public
|
|
414
414
|
* @async
|
|
415
|
-
* @param {?WriteParams
|
|
416
|
-
* @returns {Promise<void>}
|
|
415
|
+
* @param {?WriteParams} [params]
|
|
416
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
417
417
|
*/
|
|
418
418
|
public async drawRaffleRaw(
|
|
419
419
|
params?: WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>,
|
|
@@ -464,7 +464,7 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
464
464
|
* @param {StrategyType} param0.strategy - The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`
|
|
465
465
|
* @param {bigint} param0.reward - The amount of the asset to distribute.
|
|
466
466
|
* @param {bigint} param0.limit - How many times can this incentive be claimed.
|
|
467
|
-
* @returns {
|
|
467
|
+
* @returns {Hex}
|
|
468
468
|
*/
|
|
469
469
|
export function prepareERC20IncentivePayload({
|
|
470
470
|
asset,
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Mock } from 'node:test';
|
|
2
|
+
import { selectors as eventSelectors } from '@boostxyz/signatures/events';
|
|
3
|
+
import { selectors as funcSelectors } from '@boostxyz/signatures/functions';
|
|
4
|
+
import type { MockERC20 } from '@boostxyz/test/MockERC20';
|
|
5
|
+
import type { MockERC721 } from '@boostxyz/test/MockERC721';
|
|
6
|
+
import { accounts } from '@boostxyz/test/accounts';
|
|
7
|
+
import {
|
|
8
|
+
type BudgetFixtures,
|
|
9
|
+
type Fixtures,
|
|
10
|
+
defaultOptions,
|
|
11
|
+
deployFixtures,
|
|
12
|
+
freshBoost,
|
|
13
|
+
fundBudget,
|
|
14
|
+
fundErc20,
|
|
15
|
+
fundErc721,
|
|
16
|
+
} from '@boostxyz/test/helpers';
|
|
17
|
+
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
|
|
18
|
+
import { type Hex, isAddress, parseEther } from 'viem';
|
|
19
|
+
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
20
|
+
import { SignatureType } from '../Actions/EventAction';
|
|
21
|
+
import type { Boost } from '../Boost';
|
|
22
|
+
import type {
|
|
23
|
+
ERC20VariableCriteriaIncentive,
|
|
24
|
+
ERC20VariableCriteriaIncentivePayload,
|
|
25
|
+
IncentiveCriteria,
|
|
26
|
+
} from './ERC20VariableCriteriaIncentive';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A basic ERC721 mint scalar criteria for testing
|
|
30
|
+
*
|
|
31
|
+
* @param {MockERC721} erc721 - The ERC721 contract
|
|
32
|
+
* @returns {IncentiveCriteria} - Returns a basic incentive criteria
|
|
33
|
+
*/
|
|
34
|
+
export function basicErc721TransferScalarCriteria(
|
|
35
|
+
erc721: MockERC721,
|
|
36
|
+
): IncentiveCriteria {
|
|
37
|
+
return {
|
|
38
|
+
criteriaType: SignatureType.FUNC,
|
|
39
|
+
signature: funcSelectors['transferFrom(address,address,uint256)'] as Hex, // Function selector for mint
|
|
40
|
+
fieldIndex: 2, // Field where the scalar value resides
|
|
41
|
+
targetContract: erc721.assertValidAddress(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A basic ERC721 mint scalar criteria for testing
|
|
47
|
+
*
|
|
48
|
+
* @param {MockERC721} erc721 - The ERC721 contract
|
|
49
|
+
* @returns {IncentiveCriteria} - Returns a basic incentive criteria
|
|
50
|
+
*/
|
|
51
|
+
export function basicErc721MintScalarCriteria(
|
|
52
|
+
erc721: MockERC721,
|
|
53
|
+
): IncentiveCriteria {
|
|
54
|
+
return {
|
|
55
|
+
criteriaType: SignatureType.EVENT,
|
|
56
|
+
signature: eventSelectors[
|
|
57
|
+
'Transfer(address indexed,address indexed,uint256 indexed)'
|
|
58
|
+
] as Hex, // Function selector for mint
|
|
59
|
+
fieldIndex: 2, // Field where the scalar value resides
|
|
60
|
+
targetContract: erc721.assertValidAddress(),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A basic ERC721 mint scalar payload for testing
|
|
66
|
+
*
|
|
67
|
+
* @param {MockERC721} erc721 - The ERC721 contract
|
|
68
|
+
* @returns {ERC20VariableCriteriaIncentivePayload} - Returns a full variable criteria incentive payload
|
|
69
|
+
*/
|
|
70
|
+
export function basicErc721TransferScalarPayload(
|
|
71
|
+
erc721: MockERC721,
|
|
72
|
+
): ERC20VariableCriteriaIncentivePayload {
|
|
73
|
+
return {
|
|
74
|
+
asset: erc721.assertValidAddress(),
|
|
75
|
+
reward: 1n,
|
|
76
|
+
limit: 1n,
|
|
77
|
+
criteria: basicErc721TransferScalarCriteria(erc721),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
let fixtures: Fixtures,
|
|
82
|
+
erc20: MockERC20,
|
|
83
|
+
erc721: MockERC721,
|
|
84
|
+
erc20Incentive: ERC20VariableCriteriaIncentive,
|
|
85
|
+
budgets: BudgetFixtures,
|
|
86
|
+
boost: Boost;
|
|
87
|
+
|
|
88
|
+
describe('ERC20VariableCriteriaIncentive', () => {
|
|
89
|
+
beforeAll(async () => {
|
|
90
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
beforeEach(async () => {
|
|
94
|
+
budgets = await loadFixture(fundBudget(defaultOptions, fixtures));
|
|
95
|
+
erc20 = await loadFixture(fundErc20(defaultOptions));
|
|
96
|
+
erc721 = await loadFixture(fundErc721(defaultOptions));
|
|
97
|
+
erc20Incentive = fixtures.core.ERC20VariableCriteriaIncentive({
|
|
98
|
+
asset: budgets.erc20.assertValidAddress(),
|
|
99
|
+
reward: 1n,
|
|
100
|
+
limit: 1n,
|
|
101
|
+
criteria: basicErc721TransferScalarCriteria(erc721),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
boost = await freshBoost(fixtures, {
|
|
105
|
+
budget: budgets.budget,
|
|
106
|
+
incentives: [erc20Incentive],
|
|
107
|
+
});
|
|
108
|
+
expect(isAddress(boost.incentives[0]!.assertValidAddress())).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('getIncentiveCriteria', () => {
|
|
112
|
+
test('should fetch incentive criteria successfully', async () => {
|
|
113
|
+
const incentive = boost.incentives[0] as ERC20VariableCriteriaIncentive;
|
|
114
|
+
const criteria = await incentive.getIncentiveCriteria();
|
|
115
|
+
expect(criteria).toMatchObject({
|
|
116
|
+
criteriaType: SignatureType.FUNC,
|
|
117
|
+
signature: expect.any(String),
|
|
118
|
+
fieldIndex: expect.any(Number),
|
|
119
|
+
targetContract: expect.any(String),
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
describe('getIncentiveScalar', () => {
|
|
125
|
+
test('should return a valid scalar for function-based criteria', async () => {
|
|
126
|
+
const recipient = accounts[1].account;
|
|
127
|
+
|
|
128
|
+
const { hash } = await erc721.transferFromRaw(
|
|
129
|
+
accounts[0].account,
|
|
130
|
+
recipient,
|
|
131
|
+
1n,
|
|
132
|
+
);
|
|
133
|
+
const scalar = await erc20Incentive.getIncentiveScalar({ hash });
|
|
134
|
+
|
|
135
|
+
expect(scalar).toBe(1n);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('should return a valid scalar for event-based criteria', async () => {
|
|
139
|
+
erc20Incentive = fixtures.core.ERC20VariableCriteriaIncentive({
|
|
140
|
+
asset: budgets.erc20.assertValidAddress(),
|
|
141
|
+
reward: 1n,
|
|
142
|
+
limit: 1n,
|
|
143
|
+
criteria: basicErc721MintScalarCriteria(erc721),
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
boost = await freshBoost(fixtures, {
|
|
147
|
+
budget: budgets.budget,
|
|
148
|
+
incentives: [erc20Incentive],
|
|
149
|
+
});
|
|
150
|
+
const recipient = accounts[1].account;
|
|
151
|
+
const { hash } = await erc721.transferFromRaw(
|
|
152
|
+
accounts[0].account,
|
|
153
|
+
recipient,
|
|
154
|
+
1n,
|
|
155
|
+
);
|
|
156
|
+
const scalar = await erc20Incentive.getIncentiveScalar({ hash });
|
|
157
|
+
|
|
158
|
+
expect(scalar).toBe(1n);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('should throw NoMatchingLogsError for event criteria with no matching logs', async () => {
|
|
162
|
+
const recipient = accounts[1].account;
|
|
163
|
+
|
|
164
|
+
const { hash } = await erc20.mintRaw(recipient, parseEther('100'));
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
await erc20Incentive.getIncentiveScalar({ hash });
|
|
168
|
+
} catch (e) {
|
|
169
|
+
expect((e as Error).name).toBe('DecodedArgsError');
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test('should throw DecodedArgsError for invalid function-based data', async () => {
|
|
174
|
+
const recipient = accounts[1].account;
|
|
175
|
+
const { hash } = await erc20.mintRaw(recipient, parseEther('100'));
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
await erc20Incentive.getIncentiveScalar({ hash });
|
|
179
|
+
} catch (e) {
|
|
180
|
+
expect((e as Error).name).toBe('DecodedArgsError');
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|