@boostxyz/sdk 0.0.0-alpha.8 → 1.1.0-alpha.22
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 +57 -14
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +50 -23
- 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 +420 -45
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +15 -225
- 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 +123 -39
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +75 -76
- 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 +234 -13
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +11 -200
- 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 +105 -14
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +137 -5
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore-BVZExPPu.js +1462 -0
- package/dist/BoostCore-BVZExPPu.js.map +1 -0
- package/dist/BoostCore-D-E-cnGI.cjs +3 -0
- package/dist/BoostCore-D-E-cnGI.cjs.map +1 -0
- package/dist/BoostCore.cjs +1 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +759 -82
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +29 -1148
- 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 +83 -28
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +170 -93
- 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 +112 -192
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +89 -290
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +277 -91
- 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 +6 -8
- 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 +30 -27
- 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-BZt5cjbe.cjs +2 -0
- package/dist/EventAction-BZt5cjbe.cjs.map +1 -0
- package/dist/EventAction-C_-hJXWm.js +1541 -0
- package/dist/EventAction-C_-hJXWm.js.map +1 -0
- package/dist/Incentive-BhHaK3PZ.cjs +2 -0
- package/dist/Incentive-BhHaK3PZ.cjs.map +1 -0
- package/dist/Incentive-Cqg1w6wD.js +312 -0
- package/dist/Incentive-Cqg1w6wD.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 +73 -21
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +61 -36
- 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 +323 -26
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +73 -39
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +291 -43
- 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 +278 -33
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +79 -47
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +346 -420
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +271 -32
- 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 -280
- 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 +89 -23
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +66 -36
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
- package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
- package/dist/SimpleDenyList-CGaWjuld.js +132 -0
- package/dist/SimpleDenyList-CGaWjuld.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 +310 -17
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +164 -36
- 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 +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/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-DVXioW2i.cjs +2 -0
- package/dist/deployments-DVXioW2i.cjs.map +1 -0
- package/dist/deployments-oykLv3_Z.js +43 -0
- package/dist/deployments-oykLv3_Z.js.map +1 -0
- package/dist/deployments.json +44 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +257 -21
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +183 -26
- package/dist/errors.js.map +1 -1
- package/dist/{generated-Cbv8zFkf.js → generated-CKt2yCQd.js} +3615 -1868
- package/dist/generated-CKt2yCQd.js.map +1 -0
- package/dist/generated-CyTNlOwM.cjs +3 -0
- package/dist/generated-CyTNlOwM.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -126
- package/dist/index.js.map +1 -1
- 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 +25 -1380
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +36 -648
- package/dist/utils.js.map +1 -1
- package/package.json +34 -10
- package/src/Actions/Action.test.ts +19 -17
- package/src/Actions/ContractAction.test.ts +14 -16
- package/src/Actions/ContractAction.ts +84 -22
- package/src/Actions/ERC721MintAction.test.ts +8 -8
- package/src/Actions/ERC721MintAction.ts +83 -30
- package/src/Actions/EventAction.test.ts +759 -113
- package/src/Actions/EventAction.ts +991 -116
- 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 +86 -65
- package/src/AllowLists/SimpleDenyList.test.ts +4 -4
- package/src/AllowLists/SimpleDenyList.ts +87 -126
- package/src/Auth/PassthroughAuth.test.ts +1 -1
- package/src/Auth/PassthroughAuth.ts +1 -1
- package/src/Boost.ts +147 -15
- package/src/BoostCore.test.ts +326 -278
- package/src/BoostCore.ts +425 -242
- package/src/BoostRegistry.test.ts +53 -0
- package/src/BoostRegistry.ts +168 -50
- package/src/Budgets/Budget.test.ts +2 -2
- package/src/Budgets/Budget.ts +1 -2
- package/src/Budgets/ManagedBudget.test.ts +82 -19
- package/src/Budgets/ManagedBudget.ts +106 -315
- package/src/Budgets/VestingBudget.test.ts +7 -7
- package/src/Budgets/VestingBudget.ts +110 -112
- package/src/Deployable/Contract.ts +5 -6
- package/src/Deployable/Deployable.ts +1 -1
- package/src/Deployable/DeployableTarget.ts +32 -21
- package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
- package/src/Incentives/AllowListIncentive.test.ts +7 -10
- package/src/Incentives/AllowListIncentive.ts +88 -30
- package/src/Incentives/CGDAIncentive.test.ts +11 -12
- package/src/Incentives/CGDAIncentive.ts +161 -37
- package/src/Incentives/ERC1155Incentive.test.ts +5 -16
- package/src/Incentives/ERC1155Incentive.ts +132 -51
- package/src/Incentives/ERC20Incentive.test.ts +15 -23
- package/src/Incentives/ERC20Incentive.ts +131 -46
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +324 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +12 -35
- package/src/Incentives/ERC20VariableIncentive.ts +118 -43
- package/src/Incentives/Incentive.test.ts +5 -2
- package/src/Incentives/Incentive.ts +7 -6
- package/src/Incentives/PointsIncentive.test.ts +26 -30
- package/src/Incentives/PointsIncentive.ts +110 -34
- package/src/Validators/SignerValidator.test.ts +9 -13
- package/src/Validators/SignerValidator.ts +437 -26
- package/src/Validators/Validator.test.ts +2 -2
- package/src/Validators/Validator.ts +1 -1
- package/src/claiming.ts +56 -0
- package/src/errors.ts +346 -22
- package/src/index.test.ts +118 -36
- package/src/index.ts +15 -7
- package/src/transfers.ts +284 -0
- package/src/utils.test.ts +2 -2
- package/src/utils.ts +61 -2061
- 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-BzszviNp.cjs +0 -3
- package/dist/generated-BzszviNp.cjs.map +0 -1
- package/dist/generated-Cbv8zFkf.js.map +0 -1
- package/src/Budgets/SimpleBudget.test.ts +0 -152
- package/src/Budgets/SimpleBudget.ts +0 -521
|
@@ -16,7 +16,13 @@ import {
|
|
|
16
16
|
writeErc1155IncentiveClawback,
|
|
17
17
|
} from '@boostxyz/evm';
|
|
18
18
|
import { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC1155Incentive.sol/ERC1155Incentive.json';
|
|
19
|
-
import
|
|
19
|
+
import {
|
|
20
|
+
type Address,
|
|
21
|
+
type ContractEventName,
|
|
22
|
+
type Hex,
|
|
23
|
+
encodeAbiParameters,
|
|
24
|
+
parseAbiParameters,
|
|
25
|
+
} from 'viem';
|
|
20
26
|
import type {
|
|
21
27
|
DeployableOptions,
|
|
22
28
|
GenericDeployableParams,
|
|
@@ -24,19 +30,68 @@ import type {
|
|
|
24
30
|
import { DeployableTarget } from '../Deployable/DeployableTarget';
|
|
25
31
|
import {
|
|
26
32
|
type ClaimPayload,
|
|
27
|
-
type
|
|
28
|
-
|
|
33
|
+
type StrategyType,
|
|
34
|
+
prepareClaimPayload,
|
|
35
|
+
} from '../claiming';
|
|
36
|
+
import {
|
|
29
37
|
type GenericLog,
|
|
30
38
|
type ReadParams,
|
|
31
39
|
RegistryType,
|
|
32
|
-
type StrategyType,
|
|
33
40
|
type WriteParams,
|
|
34
|
-
prepareClaimPayload,
|
|
35
|
-
prepareERC1155IncentivePayload,
|
|
36
41
|
} from '../utils';
|
|
37
42
|
|
|
38
|
-
export {
|
|
39
|
-
|
|
43
|
+
export { erc1155IncentiveAbi };
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Enum representing inventive disbursement strategies for {@link ERC1155Incentive}
|
|
47
|
+
*
|
|
48
|
+
* @export
|
|
49
|
+
* @enum {number}
|
|
50
|
+
*/
|
|
51
|
+
export enum ERC1155StrategyType {
|
|
52
|
+
POOL = 0,
|
|
53
|
+
MINT = 1,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The object representation of a `ERC1155Incentive.InitPayload`
|
|
58
|
+
*
|
|
59
|
+
* @export
|
|
60
|
+
* @interface ERC1155IncentivePayload
|
|
61
|
+
* @typedef {ERC1155IncentivePayload}
|
|
62
|
+
*/
|
|
63
|
+
export interface ERC1155IncentivePayload {
|
|
64
|
+
/**
|
|
65
|
+
* The address of the `ERC1155` asset
|
|
66
|
+
*
|
|
67
|
+
* @type {Address}
|
|
68
|
+
*/
|
|
69
|
+
asset: Address;
|
|
70
|
+
/**
|
|
71
|
+
* Should be `Strategy.POOL`
|
|
72
|
+
*
|
|
73
|
+
* @type {ERC1155StrategyType}
|
|
74
|
+
*/
|
|
75
|
+
strategy: ERC1155StrategyType;
|
|
76
|
+
/**
|
|
77
|
+
* The token ID to target
|
|
78
|
+
*
|
|
79
|
+
* @type {bigint}
|
|
80
|
+
*/
|
|
81
|
+
tokenId: bigint;
|
|
82
|
+
/**
|
|
83
|
+
* The maximum number of claims that can be made (one per address)
|
|
84
|
+
*
|
|
85
|
+
* @type {bigint}
|
|
86
|
+
*/
|
|
87
|
+
limit: bigint;
|
|
88
|
+
/**
|
|
89
|
+
* Any extra data to accompany the claim, if applicable.
|
|
90
|
+
*
|
|
91
|
+
* @type {Hex}
|
|
92
|
+
*/
|
|
93
|
+
extraData: Hex;
|
|
94
|
+
}
|
|
40
95
|
|
|
41
96
|
/**
|
|
42
97
|
* A generic `viem.Log` event with support for `ERC1155Incentive` event types.
|
|
@@ -72,10 +127,9 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
72
127
|
*
|
|
73
128
|
* @public
|
|
74
129
|
* @static
|
|
75
|
-
* @type {Address}
|
|
130
|
+
* @type {Record<number, Address>}
|
|
76
131
|
*/
|
|
77
|
-
public static override
|
|
78
|
-
.VITE_ERC1155_INCENTIVE_BASE;
|
|
132
|
+
public static override bases: Record<number, Address> = {};
|
|
79
133
|
/**
|
|
80
134
|
* @inheritdoc
|
|
81
135
|
*
|
|
@@ -90,13 +144,13 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
90
144
|
*
|
|
91
145
|
* @public
|
|
92
146
|
* @async
|
|
93
|
-
* @param {?ReadParams
|
|
94
|
-
* @returns {
|
|
147
|
+
* @param {?ReadParams} [params]
|
|
148
|
+
* @returns {Promise<bigint>}
|
|
95
149
|
*/
|
|
96
150
|
public async claims(
|
|
97
151
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'claims'>,
|
|
98
152
|
) {
|
|
99
|
-
return readErc1155IncentiveClaims(this._config, {
|
|
153
|
+
return await readErc1155IncentiveClaims(this._config, {
|
|
100
154
|
address: this.assertValidAddress(),
|
|
101
155
|
args: [],
|
|
102
156
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -109,13 +163,13 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
109
163
|
*
|
|
110
164
|
* @public
|
|
111
165
|
* @async
|
|
112
|
-
* @param {?ReadParams
|
|
113
|
-
* @returns {
|
|
166
|
+
* @param {?ReadParams} [params]
|
|
167
|
+
* @returns {Promise<bigint>}
|
|
114
168
|
*/
|
|
115
169
|
public async reward(
|
|
116
170
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'reward'>,
|
|
117
171
|
) {
|
|
118
|
-
return readErc1155IncentiveReward(this._config, {
|
|
172
|
+
return await readErc1155IncentiveReward(this._config, {
|
|
119
173
|
address: this.assertValidAddress(),
|
|
120
174
|
args: [],
|
|
121
175
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -129,14 +183,14 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
129
183
|
* @public
|
|
130
184
|
* @async
|
|
131
185
|
* @param {Address} address
|
|
132
|
-
* @param {?ReadParams
|
|
133
|
-
* @returns {
|
|
186
|
+
* @param {?ReadParams} [params]
|
|
187
|
+
* @returns {Promise<boolean>}
|
|
134
188
|
*/
|
|
135
189
|
public async claimed(
|
|
136
190
|
address: Address,
|
|
137
191
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'claimed'>,
|
|
138
192
|
) {
|
|
139
|
-
return readErc1155IncentiveClaimed(this._config, {
|
|
193
|
+
return await readErc1155IncentiveClaimed(this._config, {
|
|
140
194
|
address: this.assertValidAddress(),
|
|
141
195
|
args: [address],
|
|
142
196
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -149,11 +203,11 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
149
203
|
*
|
|
150
204
|
* @public
|
|
151
205
|
* @async
|
|
152
|
-
* @param {?ReadParams
|
|
153
|
-
* @returns {
|
|
206
|
+
* @param {?ReadParams} [params]
|
|
207
|
+
* @returns {Promise<Address>}
|
|
154
208
|
*/
|
|
155
209
|
public async asset(params?: ReadParams<typeof erc1155IncentiveAbi, 'asset'>) {
|
|
156
|
-
return readErc1155IncentiveAsset(this._config, {
|
|
210
|
+
return await readErc1155IncentiveAsset(this._config, {
|
|
157
211
|
address: this.assertValidAddress(),
|
|
158
212
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
159
213
|
...(params as any),
|
|
@@ -165,10 +219,10 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
165
219
|
*
|
|
166
220
|
* @public
|
|
167
221
|
* @async
|
|
168
|
-
* @param {?ReadParams
|
|
222
|
+
* @param {?ReadParams} [params]
|
|
169
223
|
* @returns {Promise<StrategyType>}
|
|
170
224
|
*/
|
|
171
|
-
public
|
|
225
|
+
public strategy(
|
|
172
226
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'strategy'>,
|
|
173
227
|
): Promise<StrategyType> {
|
|
174
228
|
return readErc1155IncentiveStrategy(this._config, {
|
|
@@ -183,11 +237,11 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
183
237
|
*
|
|
184
238
|
* @public
|
|
185
239
|
* @async
|
|
186
|
-
* @param {?ReadParams
|
|
240
|
+
* @param {?ReadParams} [params]
|
|
187
241
|
* @returns {unknown}
|
|
188
242
|
*/
|
|
189
243
|
public async limit(params?: ReadParams<typeof erc1155IncentiveAbi, 'limit'>) {
|
|
190
|
-
return readErc1155IncentiveLimit(this._config, {
|
|
244
|
+
return await readErc1155IncentiveLimit(this._config, {
|
|
191
245
|
address: this.assertValidAddress(),
|
|
192
246
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
193
247
|
...(params as any),
|
|
@@ -199,13 +253,13 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
199
253
|
*
|
|
200
254
|
* @public
|
|
201
255
|
* @async
|
|
202
|
-
* @param {?ReadParams
|
|
203
|
-
* @returns {
|
|
256
|
+
* @param {?ReadParams} [params]
|
|
257
|
+
* @returns {Promise<bigint>}
|
|
204
258
|
*/
|
|
205
259
|
public async tokenId(
|
|
206
260
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'tokenId'>,
|
|
207
261
|
) {
|
|
208
|
-
return readErc1155IncentiveTokenId(this._config, {
|
|
262
|
+
return await readErc1155IncentiveTokenId(this._config, {
|
|
209
263
|
address: this.assertValidAddress(),
|
|
210
264
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
211
265
|
...(params as any),
|
|
@@ -217,13 +271,13 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
217
271
|
*
|
|
218
272
|
* @public
|
|
219
273
|
* @async
|
|
220
|
-
* @param {?ReadParams
|
|
221
|
-
* @returns {
|
|
274
|
+
* @param {?ReadParams} [params]
|
|
275
|
+
* @returns {Promise<Hex>}
|
|
222
276
|
*/
|
|
223
277
|
public async extraData(
|
|
224
278
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'extraData'>,
|
|
225
279
|
) {
|
|
226
|
-
return readErc1155IncentiveExtraData(this._config, {
|
|
280
|
+
return await readErc1155IncentiveExtraData(this._config, {
|
|
227
281
|
address: this.assertValidAddress(),
|
|
228
282
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
229
283
|
...(params as any),
|
|
@@ -236,14 +290,14 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
236
290
|
* @public
|
|
237
291
|
* @async
|
|
238
292
|
* @param {ClaimPayload} payload
|
|
239
|
-
* @param {?WriteParams
|
|
240
|
-
* @returns {
|
|
293
|
+
* @param {?WriteParams} [params]
|
|
294
|
+
* @returns {Promise<boolean>}
|
|
241
295
|
*/
|
|
242
|
-
|
|
296
|
+
protected async claim(
|
|
243
297
|
payload: ClaimPayload,
|
|
244
298
|
params?: WriteParams<typeof erc1155IncentiveAbi, 'claim'>,
|
|
245
299
|
) {
|
|
246
|
-
return this.awaitResult(this.claimRaw(payload, params));
|
|
300
|
+
return await this.awaitResult(this.claimRaw(payload, params));
|
|
247
301
|
}
|
|
248
302
|
|
|
249
303
|
/**
|
|
@@ -252,10 +306,10 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
252
306
|
* @public
|
|
253
307
|
* @async
|
|
254
308
|
* @param {ClaimPayload} payload
|
|
255
|
-
* @param {?WriteParams
|
|
256
|
-
* @returns {
|
|
309
|
+
* @param {?WriteParams} [params]
|
|
310
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>}
|
|
257
311
|
*/
|
|
258
|
-
|
|
312
|
+
protected async claimRaw(
|
|
259
313
|
payload: ClaimPayload,
|
|
260
314
|
params?: WriteParams<typeof erc1155IncentiveAbi, 'claim'>,
|
|
261
315
|
) {
|
|
@@ -279,14 +333,14 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
279
333
|
* @public
|
|
280
334
|
* @async
|
|
281
335
|
* @param {ClaimPayload} payload
|
|
282
|
-
* @param {?WriteParams
|
|
283
|
-
* @returns {
|
|
336
|
+
* @param {?WriteParams} [params]
|
|
337
|
+
* @returns {Promise<boolean>}
|
|
284
338
|
*/
|
|
285
339
|
public async clawback(
|
|
286
340
|
payload: ClaimPayload,
|
|
287
341
|
params?: WriteParams<typeof erc1155IncentiveAbi, 'clawback'>,
|
|
288
342
|
) {
|
|
289
|
-
return this.awaitResult(this.clawbackRaw(payload, params));
|
|
343
|
+
return await this.awaitResult(this.clawbackRaw(payload, params));
|
|
290
344
|
}
|
|
291
345
|
|
|
292
346
|
/**
|
|
@@ -295,8 +349,8 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
295
349
|
* @public
|
|
296
350
|
* @async
|
|
297
351
|
* @param {ClaimPayload} payload
|
|
298
|
-
* @param {?WriteParams
|
|
299
|
-
* @returns {
|
|
352
|
+
* @param {?WriteParams} [params]
|
|
353
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>}
|
|
300
354
|
*/
|
|
301
355
|
public async clawbackRaw(
|
|
302
356
|
payload: ClaimPayload,
|
|
@@ -322,14 +376,14 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
322
376
|
* @public
|
|
323
377
|
* @async
|
|
324
378
|
* @param {ClaimPayload} payload
|
|
325
|
-
* @param {?ReadParams
|
|
326
|
-
* @returns {
|
|
379
|
+
* @param {?ReadParams} [params]
|
|
380
|
+
* @returns {Promise<boolean>}
|
|
327
381
|
*/
|
|
328
382
|
public async isClaimable(
|
|
329
383
|
payload: ClaimPayload,
|
|
330
384
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'isClaimable'>,
|
|
331
385
|
) {
|
|
332
|
-
return readErc1155IncentiveIsClaimable(this._config, {
|
|
386
|
+
return await readErc1155IncentiveIsClaimable(this._config, {
|
|
333
387
|
address: this.assertValidAddress(),
|
|
334
388
|
args: [prepareClaimPayload(payload)],
|
|
335
389
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -343,14 +397,14 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
343
397
|
* @public
|
|
344
398
|
* @async
|
|
345
399
|
* @param {ERC1155IncentivePayload} data
|
|
346
|
-
* @param {?ReadParams
|
|
347
|
-
* @returns {
|
|
400
|
+
* @param {?ReadParams} [params]
|
|
401
|
+
* @returns {Promise<Hex>}
|
|
348
402
|
*/
|
|
349
403
|
public async preflight(
|
|
350
404
|
data: ERC1155IncentivePayload,
|
|
351
405
|
params?: ReadParams<typeof erc1155IncentiveAbi, 'preflight'>,
|
|
352
406
|
) {
|
|
353
|
-
return readErc1155IncentivePreflight(this._config, {
|
|
407
|
+
return await readErc1155IncentivePreflight(this._config, {
|
|
354
408
|
address: this.assertValidAddress(),
|
|
355
409
|
args: [prepareERC1155IncentivePayload(data)],
|
|
356
410
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -382,3 +436,30 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
382
436
|
};
|
|
383
437
|
}
|
|
384
438
|
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Given a {@link ERC1155IncentivePayload}, properly encode a `ERC1155Incentive.InitPayload` for use with {@link ERC1155Incentive} initialization.
|
|
442
|
+
*
|
|
443
|
+
* @param {ERC1155IncentivePayload} param0
|
|
444
|
+
* @param {Address} param0.asset - The address of the `ERC1155` asset
|
|
445
|
+
* @param {ERC1155StrategyType} param0.strategy - Should be `Strategy.POOL`
|
|
446
|
+
* @param {bigint} param0.tokenId - The token ID to target
|
|
447
|
+
* @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)
|
|
448
|
+
* @param {Hex} param0.extraData - Any extra data to accompany the claim, if applicable.
|
|
449
|
+
* @returns {Hex}
|
|
450
|
+
*/
|
|
451
|
+
export const prepareERC1155IncentivePayload = ({
|
|
452
|
+
asset,
|
|
453
|
+
strategy,
|
|
454
|
+
tokenId,
|
|
455
|
+
limit,
|
|
456
|
+
extraData,
|
|
457
|
+
}: ERC1155IncentivePayload) => {
|
|
458
|
+
return encodeAbiParameters(
|
|
459
|
+
parseAbiParameters([
|
|
460
|
+
'InitPayload payload',
|
|
461
|
+
'struct InitPayload { address asset; uint8 strategy; uint256 tokenId; uint256 limit; bytes extraData; }',
|
|
462
|
+
]),
|
|
463
|
+
[{ asset, strategy, tokenId, limit, extraData }],
|
|
464
|
+
);
|
|
465
|
+
};
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import { readMockErc20BalanceOf } from '@boostxyz/evm';
|
|
2
2
|
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
encodePacked,
|
|
6
|
-
isAddress,
|
|
7
|
-
keccak256,
|
|
8
|
-
pad,
|
|
9
|
-
parseEther,
|
|
10
|
-
zeroAddress,
|
|
11
|
-
} from 'viem';
|
|
3
|
+
import { isAddress, pad, parseEther, zeroAddress } from 'viem';
|
|
12
4
|
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
13
|
-
import { accounts } from '
|
|
5
|
+
import { accounts } from '@boostxyz/test/accounts';
|
|
14
6
|
import {
|
|
15
7
|
type BudgetFixtures,
|
|
16
8
|
type Fixtures,
|
|
@@ -18,17 +10,16 @@ import {
|
|
|
18
10
|
deployFixtures,
|
|
19
11
|
freshBoost,
|
|
20
12
|
fundBudget,
|
|
21
|
-
} from '
|
|
22
|
-
import {
|
|
13
|
+
} from '@boostxyz/test/helpers';
|
|
14
|
+
import { BOOST_CORE_CLAIM_FEE } from '../BoostCore';
|
|
15
|
+
import { StrategyType } from '../claiming';
|
|
23
16
|
import { ERC20Incentive } from './ERC20Incentive';
|
|
24
17
|
|
|
25
|
-
const BOOST_CORE_CLAIM_FEE = parseEther('0.000075');
|
|
26
|
-
|
|
27
18
|
let fixtures: Fixtures, budgets: BudgetFixtures;
|
|
28
19
|
|
|
29
20
|
describe('ERC20Incentive', () => {
|
|
30
21
|
beforeAll(async () => {
|
|
31
|
-
fixtures = await loadFixture(deployFixtures);
|
|
22
|
+
fixtures = await loadFixture(deployFixtures(defaultOptions));
|
|
32
23
|
});
|
|
33
24
|
|
|
34
25
|
beforeEach(async () => {
|
|
@@ -41,6 +32,7 @@ describe('ERC20Incentive', () => {
|
|
|
41
32
|
strategy: StrategyType.POOL,
|
|
42
33
|
reward: 1n,
|
|
43
34
|
limit: 1n,
|
|
35
|
+
manager: zeroAddress,
|
|
44
36
|
});
|
|
45
37
|
await action.deploy();
|
|
46
38
|
expect(isAddress(action.assertValidAddress())).toBe(true);
|
|
@@ -51,11 +43,12 @@ describe('ERC20Incentive', () => {
|
|
|
51
43
|
const referrer = accounts.at(1)!.account!,
|
|
52
44
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
53
45
|
trustedSigner = accounts.at(0)!;
|
|
54
|
-
const erc20Incentive =
|
|
46
|
+
const erc20Incentive = fixtures.core.ERC20Incentive({
|
|
55
47
|
asset: budgets.erc20.assertValidAddress(),
|
|
56
48
|
strategy: StrategyType.POOL,
|
|
57
49
|
reward: 1n,
|
|
58
50
|
limit: 1n,
|
|
51
|
+
manager: budgets.budget.assertValidAddress(),
|
|
59
52
|
});
|
|
60
53
|
const boost = await freshBoost(fixtures, {
|
|
61
54
|
budget: budgets.budget,
|
|
@@ -63,13 +56,12 @@ describe('ERC20Incentive', () => {
|
|
|
63
56
|
});
|
|
64
57
|
|
|
65
58
|
const claimant = trustedSigner.account;
|
|
66
|
-
const incentiveData =
|
|
59
|
+
const incentiveData = erc20Incentive.buildClaimData();
|
|
67
60
|
const incentiveQuantity = 1;
|
|
68
|
-
const claimDataPayload = await
|
|
61
|
+
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
69
62
|
signer: trustedSigner,
|
|
70
63
|
incentiveData,
|
|
71
64
|
chainId: defaultOptions.config.chains[0].id,
|
|
72
|
-
validator: boost.validator.assertValidAddress(),
|
|
73
65
|
incentiveQuantity,
|
|
74
66
|
claimant,
|
|
75
67
|
boostId: boost.id,
|
|
@@ -95,11 +87,12 @@ describe('ERC20Incentive', () => {
|
|
|
95
87
|
const referrer = accounts.at(1)!.account!;
|
|
96
88
|
// biome-ignore lint/style/noNonNullAssertion: we know this is defined
|
|
97
89
|
const trustedSigner = accounts.at(0)!;
|
|
98
|
-
const erc20Incentive =
|
|
90
|
+
const erc20Incentive = fixtures.core.ERC20Incentive({
|
|
99
91
|
asset: budgets.erc20.assertValidAddress(),
|
|
100
92
|
strategy: StrategyType.POOL,
|
|
101
93
|
reward: 1n,
|
|
102
94
|
limit: 1n,
|
|
95
|
+
manager: budgets.budget.assertValidAddress(),
|
|
103
96
|
});
|
|
104
97
|
const boost = await freshBoost(fixtures, {
|
|
105
98
|
budget: budgets.budget,
|
|
@@ -109,11 +102,10 @@ describe('ERC20Incentive', () => {
|
|
|
109
102
|
const claimant = trustedSigner.account;
|
|
110
103
|
const incentiveData = pad('0xdef456232173821931823712381232131391321934');
|
|
111
104
|
const incentiveQuantity = 1;
|
|
112
|
-
const claimDataPayload = await
|
|
105
|
+
const claimDataPayload = await boost.validator.encodeClaimData({
|
|
113
106
|
signer: trustedSigner,
|
|
114
107
|
incentiveData,
|
|
115
108
|
chainId: defaultOptions.config.chains[0].id,
|
|
116
|
-
validator: boost.validator.assertValidAddress(),
|
|
117
109
|
incentiveQuantity,
|
|
118
110
|
claimant,
|
|
119
111
|
boostId: boost.id,
|
|
@@ -124,7 +116,7 @@ describe('ERC20Incentive', () => {
|
|
|
124
116
|
0n,
|
|
125
117
|
referrer,
|
|
126
118
|
claimDataPayload,
|
|
127
|
-
{ value:
|
|
119
|
+
{ value: BOOST_CORE_CLAIM_FEE },
|
|
128
120
|
);
|
|
129
121
|
try {
|
|
130
122
|
await fixtures.core.claimIncentive(
|