@boostxyz/sdk 0.0.0-alpha.2 → 0.0.0-alpha.20
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 +2 -1
- package/dist/Actions/Action.cjs.map +1 -0
- package/dist/Actions/Action.d.ts +1 -1
- package/dist/Actions/Action.d.ts.map +1 -1
- package/dist/Actions/Action.js +14 -12
- package/dist/Actions/Action.js.map +1 -0
- 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 +2 -1
- package/dist/Actions/EventAction.cjs.map +1 -0
- package/dist/Actions/EventAction.d.ts +405 -36
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +15 -209
- package/dist/Actions/EventAction.js.map +1 -0
- package/dist/AllowLists/AllowList.cjs +2 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -0
- package/dist/AllowLists/AllowList.d.ts +6 -5
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +46 -22
- package/dist/AllowLists/AllowList.js.map +1 -0
- package/dist/AllowLists/OpenAllowList.d.ts +423 -0
- package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +2 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
- package/dist/AllowLists/SimpleAllowList.d.ts +124 -40
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +77 -77
- package/dist/AllowLists/SimpleAllowList.js.map +1 -0
- package/dist/AllowLists/SimpleDenyList.cjs +2 -1
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
- package/dist/AllowLists/SimpleDenyList.d.ts +234 -13
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +12 -200
- package/dist/AllowLists/SimpleDenyList.js.map +1 -0
- package/dist/Auth/Auth.cjs +1 -0
- package/dist/Auth/Auth.cjs.map +1 -0
- package/dist/Auth/Auth.js +1 -0
- package/dist/Auth/Auth.js.map +1 -0
- package/dist/Auth/PassthroughAuth.cjs +2 -1
- package/dist/Auth/PassthroughAuth.cjs.map +1 -0
- package/dist/Auth/PassthroughAuth.js +5 -4
- package/dist/Auth/PassthroughAuth.js.map +1 -0
- package/dist/Boost.cjs +2 -1
- package/dist/Boost.cjs.map +1 -0
- package/dist/Boost.d.ts +111 -1
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +140 -5
- package/dist/Boost.js.map +1 -0
- package/dist/BoostCore-3-U1xTQN.cjs +3 -0
- package/dist/BoostCore-3-U1xTQN.cjs.map +1 -0
- package/dist/BoostCore-DVGBUr2y.js +1477 -0
- package/dist/BoostCore-DVGBUr2y.js.map +1 -0
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -0
- package/dist/BoostCore.d.ts +166 -43
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +30 -1103
- package/dist/BoostCore.js.map +1 -0
- package/dist/BoostRegistry.cjs +2 -1
- package/dist/BoostRegistry.cjs.map +1 -0
- package/dist/BoostRegistry.d.ts +64 -23
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +162 -88
- package/dist/BoostRegistry.js.map +1 -0
- package/dist/Budgets/Budget.cjs +2 -1
- package/dist/Budgets/Budget.cjs.map +1 -0
- package/dist/Budgets/Budget.d.ts +1 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +15 -13
- package/dist/Budgets/Budget.js.map +1 -0
- package/dist/Budgets/ManagedBudget.cjs +2 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -0
- package/dist/Budgets/ManagedBudget.d.ts +78 -188
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +86 -286
- package/dist/Budgets/ManagedBudget.js.map +1 -0
- package/dist/Budgets/VestingBudget.d.ts +243 -87
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs +2 -1
- package/dist/Deployable/Contract.cjs.map +1 -0
- package/dist/Deployable/Contract.d.ts +4 -5
- package/dist/Deployable/Contract.d.ts.map +1 -1
- package/dist/Deployable/Contract.js +7 -8
- package/dist/Deployable/Contract.js.map +1 -0
- package/dist/Deployable/Deployable.cjs +1 -0
- package/dist/Deployable/Deployable.cjs.map +1 -0
- package/dist/Deployable/Deployable.d.ts +9 -3
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +10 -5
- package/dist/Deployable/Deployable.js.map +1 -0
- package/dist/Deployable/DeployableTarget.cjs +2 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -0
- package/dist/Deployable/DeployableTarget.d.ts +16 -15
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +49 -42
- package/dist/Deployable/DeployableTarget.js.map +1 -0
- 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-CIPqmAoP.js +1450 -0
- package/dist/EventAction-CIPqmAoP.js.map +1 -0
- package/dist/EventAction-d-oeqZQs.cjs +2 -0
- package/dist/EventAction-d-oeqZQs.cjs.map +1 -0
- package/dist/Incentive-Bp8Sez7M.js +298 -0
- package/dist/Incentive-Bp8Sez7M.js.map +1 -0
- package/dist/Incentive-Djnzseoj.cjs +2 -0
- package/dist/Incentive-Djnzseoj.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +2 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.d.ts +49 -19
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +50 -34
- package/dist/Incentives/AllowListIncentive.js.map +1 -0
- package/dist/Incentives/CGDAIncentive.cjs +2 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
- package/dist/Incentives/CGDAIncentive.d.ts +118 -22
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +67 -42
- package/dist/Incentives/CGDAIncentive.js.map +1 -0
- package/dist/Incentives/ERC1155Incentive.d.ts +99 -38
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +2 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
- package/dist/Incentives/ERC20Incentive.d.ts +73 -29
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +71 -48
- package/dist/Incentives/ERC20Incentive.js.map +1 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +523 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +65 -28
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +2 -1
- package/dist/Incentives/Incentive.cjs.map +1 -0
- package/dist/Incentives/Incentive.d.ts +4 -7
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +17 -278
- package/dist/Incentives/Incentive.js.map +1 -0
- package/dist/Incentives/PointsIncentive.cjs +2 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -0
- package/dist/Incentives/PointsIncentive.d.ts +65 -21
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +57 -36
- package/dist/Incentives/PointsIncentive.js.map +1 -0
- package/dist/SimpleDenyList-BwfNjRsg.cjs +2 -0
- package/dist/SimpleDenyList-BwfNjRsg.cjs.map +1 -0
- package/dist/SimpleDenyList-Cn5WpNn0.js +132 -0
- package/dist/SimpleDenyList-Cn5WpNn0.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +2 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -0
- package/dist/Validators/SignerValidator.d.ts +310 -17
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +165 -36
- package/dist/Validators/SignerValidator.js.map +1 -0
- package/dist/Validators/Validator.cjs +2 -1
- package/dist/Validators/Validator.cjs.map +1 -0
- package/dist/Validators/Validator.d.ts +2 -2
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +12 -10
- package/dist/Validators/Validator.js.map +1 -0
- 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-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 +41 -0
- package/dist/errors.cjs +2 -1
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +403 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +285 -39
- package/dist/errors.js.map +1 -0
- package/dist/generated-B0tk-c9b.cjs +3 -0
- package/dist/generated-B0tk-c9b.cjs.map +1 -0
- package/dist/{generated-x_abr3Yv.js → generated-B7VaSah4.js} +2058 -2541
- package/dist/generated-B7VaSah4.js.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -1353
- package/dist/index.js.map +1 -0
- 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 +2 -1
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +26 -1350
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -636
- package/dist/utils.js.map +1 -0
- package/package.json +37 -11
- package/src/Actions/Action.test.ts +79 -0
- package/src/Actions/Action.ts +61 -0
- package/src/Actions/ContractAction.test.ts +197 -0
- package/src/Actions/ContractAction.ts +300 -0
- package/src/Actions/ERC721MintAction.test.ts +112 -0
- package/src/Actions/ERC721MintAction.ts +291 -0
- package/src/Actions/EventAction.test.ts +787 -0
- package/src/Actions/EventAction.ts +1214 -0
- package/src/AllowLists/AllowList.test.ts +64 -0
- package/src/AllowLists/AllowList.ts +62 -0
- package/src/AllowLists/OpenAllowList.test.ts +40 -0
- package/src/AllowLists/OpenAllowList.ts +45 -0
- package/src/AllowLists/SimpleAllowList.test.ts +52 -0
- package/src/AllowLists/SimpleAllowList.ts +262 -0
- package/src/AllowLists/SimpleDenyList.test.ts +52 -0
- package/src/AllowLists/SimpleDenyList.ts +250 -0
- package/src/Auth/Auth.ts +11 -0
- package/src/Auth/PassthroughAuth.test.ts +12 -0
- package/src/Auth/PassthroughAuth.ts +80 -0
- package/src/Boost.ts +309 -0
- package/src/BoostCore.test.ts +827 -0
- package/src/BoostCore.ts +1447 -0
- package/src/BoostRegistry.ts +543 -0
- package/src/Budgets/Budget.test.ts +27 -0
- package/src/Budgets/Budget.ts +60 -0
- package/src/Budgets/ManagedBudget.test.ts +217 -0
- package/src/Budgets/ManagedBudget.ts +534 -0
- package/src/Budgets/VestingBudget.test.ts +123 -0
- package/src/Budgets/VestingBudget.ts +530 -0
- package/src/Deployable/Contract.ts +228 -0
- package/src/Deployable/Deployable.ts +250 -0
- package/src/Deployable/DeployableTarget.ts +234 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
- package/src/Incentives/AllowListIncentive.test.ts +143 -0
- package/src/Incentives/AllowListIncentive.ts +336 -0
- package/src/Incentives/CGDAIncentive.test.ts +132 -0
- package/src/Incentives/CGDAIncentive.ts +470 -0
- package/src/Incentives/ERC1155Incentive.test.ts +87 -0
- package/src/Incentives/ERC1155Incentive.ts +465 -0
- package/src/Incentives/ERC20Incentive.test.ts +130 -0
- package/src/Incentives/ERC20Incentive.ts +484 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +136 -0
- package/src/Incentives/ERC20VariableIncentive.ts +422 -0
- package/src/Incentives/Incentive.test.ts +92 -0
- package/src/Incentives/Incentive.ts +86 -0
- package/src/Incentives/PointsIncentive.test.ts +139 -0
- package/src/Incentives/PointsIncentive.ts +367 -0
- package/src/Validators/SignerValidator.test.ts +159 -0
- package/src/Validators/SignerValidator.ts +683 -0
- package/src/Validators/Validator.test.ts +21 -0
- package/src/Validators/Validator.ts +55 -0
- package/src/claiming.ts +56 -0
- package/src/errors.ts +844 -0
- package/src/index.test.ts +122 -0
- package/src/index.ts +58 -0
- package/src/transfers.ts +284 -0
- package/src/utils.test.ts +44 -0
- package/src/utils.ts +247 -0
- package/dist/Budgets/SimpleBudget.d.ts +0 -793
- package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
- package/dist/generated-BaaleHW-.cjs +0 -2
package/src/BoostCore.ts
ADDED
|
@@ -0,0 +1,1447 @@
|
|
|
1
|
+
import {
|
|
2
|
+
boostCoreAbi,
|
|
3
|
+
type iAuthAbi,
|
|
4
|
+
readBoostCoreClaimFee,
|
|
5
|
+
readBoostCoreCreateBoostAuth,
|
|
6
|
+
readBoostCoreGetBoost,
|
|
7
|
+
readBoostCoreGetBoostCount,
|
|
8
|
+
readBoostCoreProtocolFee,
|
|
9
|
+
readBoostCoreProtocolFeeReceiver,
|
|
10
|
+
readIAuthIsAuthorized,
|
|
11
|
+
simulateBoostCoreClaimIncentive,
|
|
12
|
+
simulateBoostCoreClaimIncentiveFor,
|
|
13
|
+
simulateBoostCoreSetClaimFee,
|
|
14
|
+
simulateBoostCoreSetCreateBoostAuth,
|
|
15
|
+
simulateBoostCoreSetProtocolFeeReceiver,
|
|
16
|
+
writeBoostCoreClaimIncentive,
|
|
17
|
+
writeBoostCoreClaimIncentiveFor,
|
|
18
|
+
writeBoostCoreSetClaimFee,
|
|
19
|
+
writeBoostCoreSetCreateBoostAuth,
|
|
20
|
+
writeBoostCoreSetProtocolFeeReceiver,
|
|
21
|
+
} from '@boostxyz/evm';
|
|
22
|
+
import { bytecode } from '@boostxyz/evm/artifacts/contracts/BoostCore.sol/BoostCore.json';
|
|
23
|
+
import {
|
|
24
|
+
type GetTransactionReceiptParameters,
|
|
25
|
+
getAccount,
|
|
26
|
+
getTransactionReceipt,
|
|
27
|
+
waitForTransactionReceipt,
|
|
28
|
+
} from '@wagmi/core';
|
|
29
|
+
import { createWriteContract } from '@wagmi/core/codegen';
|
|
30
|
+
import {
|
|
31
|
+
type Address,
|
|
32
|
+
type ContractEventName,
|
|
33
|
+
type Hex,
|
|
34
|
+
parseEther,
|
|
35
|
+
parseEventLogs,
|
|
36
|
+
zeroAddress,
|
|
37
|
+
zeroHash,
|
|
38
|
+
} from 'viem';
|
|
39
|
+
import { BoostCore as BoostCoreBases } from '../dist/deployments.json';
|
|
40
|
+
import { type Action, actionFromAddress } from './Actions/Action';
|
|
41
|
+
import { EventAction, type EventActionPayload } from './Actions/EventAction';
|
|
42
|
+
import { type AllowList, allowListFromAddress } from './AllowLists/AllowList';
|
|
43
|
+
import { OpenAllowList } from './AllowLists/OpenAllowList';
|
|
44
|
+
import {
|
|
45
|
+
SimpleAllowList,
|
|
46
|
+
type SimpleAllowListPayload,
|
|
47
|
+
} from './AllowLists/SimpleAllowList';
|
|
48
|
+
import {
|
|
49
|
+
SimpleDenyList,
|
|
50
|
+
type SimpleDenyListPayload,
|
|
51
|
+
} from './AllowLists/SimpleDenyList';
|
|
52
|
+
import { type Auth, PassthroughAuth } from './Auth/Auth';
|
|
53
|
+
import {
|
|
54
|
+
Boost,
|
|
55
|
+
type BoostPayload,
|
|
56
|
+
type Target,
|
|
57
|
+
prepareBoostPayload,
|
|
58
|
+
} from './Boost';
|
|
59
|
+
import { type Budget, budgetFromAddress } from './Budgets/Budget';
|
|
60
|
+
import {
|
|
61
|
+
ManagedBudget,
|
|
62
|
+
type ManagedBudgetPayload,
|
|
63
|
+
} from './Budgets/ManagedBudget';
|
|
64
|
+
import {
|
|
65
|
+
Deployable,
|
|
66
|
+
type DeployableOptions,
|
|
67
|
+
type DeployablePayloadOrAddress,
|
|
68
|
+
type GenericDeployableParams,
|
|
69
|
+
} from './Deployable/Deployable';
|
|
70
|
+
import {
|
|
71
|
+
AllowListIncentive,
|
|
72
|
+
type AllowListIncentivePayload,
|
|
73
|
+
} from './Incentives/AllowListIncentive';
|
|
74
|
+
import {
|
|
75
|
+
CGDAIncentive,
|
|
76
|
+
type CGDAIncentivePayload,
|
|
77
|
+
} from './Incentives/CGDAIncentive';
|
|
78
|
+
import {
|
|
79
|
+
ERC20Incentive,
|
|
80
|
+
type ERC20IncentivePayload,
|
|
81
|
+
} from './Incentives/ERC20Incentive';
|
|
82
|
+
import {
|
|
83
|
+
ERC20VariableCriteriaIncentive,
|
|
84
|
+
type ERC20VariableCriteriaIncentivePayload,
|
|
85
|
+
} from './Incentives/ERC20VariableCriteriaIncentive';
|
|
86
|
+
import type { ERC20VariableIncentivePayload } from './Incentives/ERC20VariableIncentive';
|
|
87
|
+
import {
|
|
88
|
+
ERC20VariableIncentive,
|
|
89
|
+
type Incentive,
|
|
90
|
+
incentiveFromAddress,
|
|
91
|
+
} from './Incentives/Incentive';
|
|
92
|
+
import {
|
|
93
|
+
PointsIncentive,
|
|
94
|
+
type PointsIncentivePayload,
|
|
95
|
+
} from './Incentives/PointsIncentive';
|
|
96
|
+
import {
|
|
97
|
+
SignerValidator,
|
|
98
|
+
type SignerValidatorPayload,
|
|
99
|
+
} from './Validators/SignerValidator';
|
|
100
|
+
import { type Validator, validatorFromAddress } from './Validators/Validator';
|
|
101
|
+
import {
|
|
102
|
+
BoostCoreNoIdentifierEmitted,
|
|
103
|
+
BudgetMustAuthorizeBoostCore,
|
|
104
|
+
DeployableUnknownOwnerProvidedError,
|
|
105
|
+
IncentiveNotCloneableError,
|
|
106
|
+
MustInitializeBudgetError,
|
|
107
|
+
} from './errors';
|
|
108
|
+
import {
|
|
109
|
+
type GenericLog,
|
|
110
|
+
type ReadParams,
|
|
111
|
+
type WriteParams,
|
|
112
|
+
assertValidAddressByChainId,
|
|
113
|
+
} from './utils';
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The ABI of the BoostCore contract, if needed for low level operations
|
|
117
|
+
*
|
|
118
|
+
* @type {typeof boostCoreAbi}
|
|
119
|
+
*/
|
|
120
|
+
export { boostCoreAbi };
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The fee (in wei) required to claim each incentive, must be provided for the `claimIncentive` transaction
|
|
124
|
+
*
|
|
125
|
+
* @type {bigint}
|
|
126
|
+
*/
|
|
127
|
+
export const BOOST_CORE_CLAIM_FEE = parseEther('0.000075');
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The address of the deployed BoostCore instance. In prerelease mode, this will be its sepolia address
|
|
131
|
+
*
|
|
132
|
+
* @type {Address}
|
|
133
|
+
*/
|
|
134
|
+
export const BOOST_CORE_ADDRESS =
|
|
135
|
+
(BoostCoreBases as Record<string, Address>)[__DEFAULT_CHAIN_ID__] ||
|
|
136
|
+
zeroAddress;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The fixed addresses for the deployed Boost Core.
|
|
140
|
+
* By default, `new BoostCore` will use the address deployed to the currently connected chain, or `BOOST_CORE_ADDRESS` if not provided.
|
|
141
|
+
*
|
|
142
|
+
* @type {Record<number, Address>}
|
|
143
|
+
*/
|
|
144
|
+
export const BOOST_CORE_ADDRESSES: Record<number, Address> = {
|
|
145
|
+
...(BoostCoreBases as Record<number, Address>),
|
|
146
|
+
31337: import.meta.env.VITE_BOOST_CORE_ADDRESS,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* A generic `viem.Log` event with support for `BoostCore` event types.
|
|
151
|
+
*
|
|
152
|
+
* @export
|
|
153
|
+
* @typedef {BoostCoreLog}
|
|
154
|
+
* @template {ContractEventName<typeof boostCoreAbi>} [event=ContractEventName<
|
|
155
|
+
* typeof boostCoreAbi
|
|
156
|
+
* >]
|
|
157
|
+
*/
|
|
158
|
+
export type BoostCoreLog<
|
|
159
|
+
event extends ContractEventName<typeof boostCoreAbi> = ContractEventName<
|
|
160
|
+
typeof boostCoreAbi
|
|
161
|
+
>,
|
|
162
|
+
> = GenericLog<typeof boostCoreAbi, event>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Boost Core instantiation options for a custom deployed instance.
|
|
166
|
+
*
|
|
167
|
+
* @export
|
|
168
|
+
* @interface BoostCoreDeployedOptions
|
|
169
|
+
* @typedef {BoostCoreDeployedOptions}
|
|
170
|
+
* @extends {DeployableOptions}
|
|
171
|
+
*/
|
|
172
|
+
export interface BoostCoreDeployedOptions extends DeployableOptions {
|
|
173
|
+
/**
|
|
174
|
+
* The address of a deployed, custom Boost Core contract.
|
|
175
|
+
*
|
|
176
|
+
* @type {?Address}
|
|
177
|
+
*/
|
|
178
|
+
address?: Address;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Typeguard to determine if a user is supplying a custom address for a Boost Core contract.
|
|
183
|
+
*
|
|
184
|
+
* @param {*} opts
|
|
185
|
+
* @returns {opts is BoostCoreDeployedOptions}
|
|
186
|
+
*/
|
|
187
|
+
// biome-ignore lint/suspicious/noExplicitAny: type guard
|
|
188
|
+
function isBoostCoreDeployed(opts: any): opts is BoostCoreDeployedOptions {
|
|
189
|
+
return opts.address;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Boost Core instantiation options when a user intends to deploy a new instance of Boost Core, setting their own registry address and protocol fee receiver.
|
|
194
|
+
*
|
|
195
|
+
* @export
|
|
196
|
+
* @interface BoostCoreOptionsWithPayload
|
|
197
|
+
* @typedef {BoostCoreOptionsWithPayload}
|
|
198
|
+
* @extends {DeployableOptions}
|
|
199
|
+
*/
|
|
200
|
+
export interface BoostCoreOptionsWithPayload extends DeployableOptions {
|
|
201
|
+
/**
|
|
202
|
+
* The address of a deployed Boost Registry contract.
|
|
203
|
+
*
|
|
204
|
+
* @type {Address}
|
|
205
|
+
*/
|
|
206
|
+
registryAddress: Address;
|
|
207
|
+
/**
|
|
208
|
+
* The address to send fees.
|
|
209
|
+
*
|
|
210
|
+
* @type {Address}
|
|
211
|
+
*/
|
|
212
|
+
protocolFeeReceiver: Address;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Typeguard to determine if a user is intending to deploy a new instance of the Boost Core contracts with {@link BoostCoreOptionsWithPayload}.
|
|
217
|
+
*
|
|
218
|
+
* @param {*} opts
|
|
219
|
+
* @returns {opts is BoostCoreOptionsWithPayload}
|
|
220
|
+
*/
|
|
221
|
+
// biome-ignore lint/suspicious/noExplicitAny: type guard
|
|
222
|
+
function isBoostCoreDeployable(opts: any): opts is BoostCoreOptionsWithPayload {
|
|
223
|
+
return opts.registryAddress && opts.protocolFeeReceiver;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* A union representing both of the valid Boost Core instantiation parameters.
|
|
228
|
+
*
|
|
229
|
+
* @export
|
|
230
|
+
* @typedef {BoostCoreConfig}
|
|
231
|
+
*/
|
|
232
|
+
export type BoostCoreConfig =
|
|
233
|
+
| BoostCoreDeployedOptions
|
|
234
|
+
| BoostCoreOptionsWithPayload;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The interface required to create a new Boost.
|
|
238
|
+
*
|
|
239
|
+
* @export
|
|
240
|
+
* @typedef {CreateBoostPayload}
|
|
241
|
+
*/
|
|
242
|
+
export type CreateBoostPayload = {
|
|
243
|
+
budget: Budget;
|
|
244
|
+
action: Action;
|
|
245
|
+
validator?: Validator;
|
|
246
|
+
allowList: AllowList;
|
|
247
|
+
incentives: Array<Incentive>;
|
|
248
|
+
protocolFee?: bigint;
|
|
249
|
+
referralFee?: bigint;
|
|
250
|
+
maxParticipants?: bigint;
|
|
251
|
+
owner?: Address;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* The core contract for the Boost protocol. Used to create and retrieve deployed Boosts.
|
|
256
|
+
*
|
|
257
|
+
* @export
|
|
258
|
+
* @class BoostCore
|
|
259
|
+
* @typedef {BoostCore}
|
|
260
|
+
* @extends {Deployable<[Address, Address]>}
|
|
261
|
+
*/
|
|
262
|
+
export class BoostCore extends Deployable<
|
|
263
|
+
[Address, Address],
|
|
264
|
+
typeof boostCoreAbi
|
|
265
|
+
> {
|
|
266
|
+
/**
|
|
267
|
+
* A static property representing a map of stringified chain ID's to the address of the deployed implementation on chain
|
|
268
|
+
*
|
|
269
|
+
* @static
|
|
270
|
+
* @readonly
|
|
271
|
+
* @type {Record<string, Address>}
|
|
272
|
+
*/
|
|
273
|
+
static readonly addresses: Record<number, Address> = BOOST_CORE_ADDRESSES;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* A getter that will return Boost core's static addresses by numerical chain ID
|
|
277
|
+
*
|
|
278
|
+
* @public
|
|
279
|
+
* @readonly
|
|
280
|
+
* @type {Record<number, Address>}
|
|
281
|
+
*/
|
|
282
|
+
public get addresses(): Record<number, Address> {
|
|
283
|
+
return (this.constructor as typeof BoostCore).addresses;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Creates an instance of BoostCore.
|
|
288
|
+
*
|
|
289
|
+
* @constructor
|
|
290
|
+
* @param {BoostCoreConfig} param0
|
|
291
|
+
* @param {Config} param0.config
|
|
292
|
+
* @param {?Account} [param0.account]
|
|
293
|
+
* @param {({ address?: Address; } | { registryAddress: Address; protocolFeeReceiver: Address; })} param0....options
|
|
294
|
+
*/
|
|
295
|
+
constructor({ config, account, ...options }: BoostCoreConfig) {
|
|
296
|
+
if (isBoostCoreDeployed(options) && options.address) {
|
|
297
|
+
super({ account, config }, options.address);
|
|
298
|
+
} else if (isBoostCoreDeployable(options)) {
|
|
299
|
+
super({ account, config }, [
|
|
300
|
+
options.registryAddress,
|
|
301
|
+
options.protocolFeeReceiver,
|
|
302
|
+
]);
|
|
303
|
+
} else {
|
|
304
|
+
const { address } = assertValidAddressByChainId(
|
|
305
|
+
config,
|
|
306
|
+
BOOST_CORE_ADDRESSES,
|
|
307
|
+
);
|
|
308
|
+
super({ account, config }, address);
|
|
309
|
+
}
|
|
310
|
+
//@ts-expect-error I can't set this property on the class because for some reason it takes super out of constructor scope?
|
|
311
|
+
this.abi = boostCoreAbi;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Create a new Boost.
|
|
315
|
+
*
|
|
316
|
+
* @public
|
|
317
|
+
* @async
|
|
318
|
+
* @param {CreateBoostPayload} _boostPayload
|
|
319
|
+
* @param {?DeployableOptions} [_options]
|
|
320
|
+
* @returns {Promise<Boost>}
|
|
321
|
+
*/
|
|
322
|
+
public async createBoost(
|
|
323
|
+
_boostPayload: CreateBoostPayload,
|
|
324
|
+
_params?: DeployableOptions &
|
|
325
|
+
WriteParams<typeof boostCoreAbi, 'createBoost'>,
|
|
326
|
+
) {
|
|
327
|
+
const [payload, options] =
|
|
328
|
+
this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload, _params);
|
|
329
|
+
const desiredChainId = _params?.chain?.id || _params?.chainId;
|
|
330
|
+
const { chainId, address: coreAddress } = assertValidAddressByChainId(
|
|
331
|
+
options.config,
|
|
332
|
+
this.addresses,
|
|
333
|
+
desiredChainId,
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
let {
|
|
337
|
+
budget,
|
|
338
|
+
action,
|
|
339
|
+
validator,
|
|
340
|
+
allowList,
|
|
341
|
+
incentives,
|
|
342
|
+
protocolFee = 0n,
|
|
343
|
+
referralFee = 0n,
|
|
344
|
+
maxParticipants = 0n,
|
|
345
|
+
owner,
|
|
346
|
+
} = payload;
|
|
347
|
+
|
|
348
|
+
const boostFactory = createWriteContract({
|
|
349
|
+
abi: boostCoreAbi,
|
|
350
|
+
functionName: 'createBoost',
|
|
351
|
+
address: coreAddress,
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
if (!owner) {
|
|
355
|
+
owner =
|
|
356
|
+
this._account?.address ||
|
|
357
|
+
getAccount(options.config).address ||
|
|
358
|
+
zeroAddress;
|
|
359
|
+
if (owner === zeroAddress) {
|
|
360
|
+
throw new DeployableUnknownOwnerProvidedError();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (!validator) {
|
|
365
|
+
validator = this.SignerValidator({
|
|
366
|
+
signers: [owner],
|
|
367
|
+
validatorCaller: coreAddress,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
let budgetPayload: BoostPayload['budget'] = zeroAddress;
|
|
372
|
+
if (budget.address) {
|
|
373
|
+
budgetPayload = budget.address;
|
|
374
|
+
if (!(await budget.isAuthorized(coreAddress))) {
|
|
375
|
+
throw new BudgetMustAuthorizeBoostCore(coreAddress);
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
throw new MustInitializeBudgetError();
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// if we're supplying an address, it could be a pre-initialized target
|
|
382
|
+
// if base is explicitly set to false, then it will not be initialized, and it will be referenced as is if it implements interface correctly
|
|
383
|
+
let actionPayload: BoostPayload['action'] = {
|
|
384
|
+
instance: zeroAddress,
|
|
385
|
+
isBase: true,
|
|
386
|
+
parameters: zeroHash,
|
|
387
|
+
};
|
|
388
|
+
if (action.address) {
|
|
389
|
+
const isBase = action.isBase;
|
|
390
|
+
actionPayload = {
|
|
391
|
+
isBase: isBase,
|
|
392
|
+
instance: action.address,
|
|
393
|
+
parameters: isBase
|
|
394
|
+
? action.buildParameters(undefined, options).args.at(0) || zeroHash
|
|
395
|
+
: zeroHash,
|
|
396
|
+
};
|
|
397
|
+
} else {
|
|
398
|
+
actionPayload.parameters =
|
|
399
|
+
action.buildParameters(undefined, options).args.at(0) || zeroHash;
|
|
400
|
+
actionPayload.instance = assertValidAddressByChainId(
|
|
401
|
+
options.config,
|
|
402
|
+
action.bases,
|
|
403
|
+
chainId,
|
|
404
|
+
).address;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
let validatorPayload: BoostPayload['validator'] = {
|
|
408
|
+
instance: zeroAddress,
|
|
409
|
+
isBase: true,
|
|
410
|
+
parameters: zeroHash,
|
|
411
|
+
};
|
|
412
|
+
if (validator.address) {
|
|
413
|
+
const isBase = validator.isBase;
|
|
414
|
+
validatorPayload = {
|
|
415
|
+
isBase: isBase,
|
|
416
|
+
instance: validator.address,
|
|
417
|
+
parameters: isBase
|
|
418
|
+
? validator.buildParameters(undefined, options).args.at(0) || zeroHash
|
|
419
|
+
: zeroHash,
|
|
420
|
+
};
|
|
421
|
+
} else {
|
|
422
|
+
validatorPayload.parameters =
|
|
423
|
+
validator.buildParameters(undefined, options).args.at(0) || zeroHash;
|
|
424
|
+
validatorPayload.instance = assertValidAddressByChainId(
|
|
425
|
+
options.config,
|
|
426
|
+
validator.bases,
|
|
427
|
+
chainId,
|
|
428
|
+
).address;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
let allowListPayload: BoostPayload['allowList'] = {
|
|
432
|
+
instance: zeroAddress,
|
|
433
|
+
isBase: true,
|
|
434
|
+
parameters: zeroHash,
|
|
435
|
+
};
|
|
436
|
+
if (allowList.address) {
|
|
437
|
+
const isBase = allowList.isBase;
|
|
438
|
+
allowListPayload = {
|
|
439
|
+
isBase: isBase,
|
|
440
|
+
instance: allowList.address,
|
|
441
|
+
parameters: isBase
|
|
442
|
+
? zeroHash // allowList.buildParameters(undefined, options).args.at(0) || zeroHash
|
|
443
|
+
: zeroHash,
|
|
444
|
+
};
|
|
445
|
+
} else {
|
|
446
|
+
allowListPayload.parameters =
|
|
447
|
+
allowList.buildParameters(undefined, options).args.at(0) || zeroHash;
|
|
448
|
+
allowListPayload.instance = assertValidAddressByChainId(
|
|
449
|
+
options.config,
|
|
450
|
+
allowList.bases,
|
|
451
|
+
chainId,
|
|
452
|
+
).address;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const incentivesPayloads: Array<Target> = incentives.map(() => ({
|
|
456
|
+
instance: zeroAddress,
|
|
457
|
+
isBase: true,
|
|
458
|
+
parameters: zeroHash,
|
|
459
|
+
}));
|
|
460
|
+
for (let i = 0; i < incentives.length; i++) {
|
|
461
|
+
// biome-ignore lint/style/noNonNullAssertion: this will never be undefined
|
|
462
|
+
const incentive = incentives.at(i)!;
|
|
463
|
+
if (incentive.address) {
|
|
464
|
+
const isBase = incentive.isBase;
|
|
465
|
+
if (!isBase) throw new IncentiveNotCloneableError(incentive);
|
|
466
|
+
incentivesPayloads[i] = {
|
|
467
|
+
isBase: isBase,
|
|
468
|
+
instance: incentive.address,
|
|
469
|
+
parameters: isBase
|
|
470
|
+
? incentive.buildParameters(undefined, options).args.at(0) ||
|
|
471
|
+
zeroHash
|
|
472
|
+
: zeroHash,
|
|
473
|
+
};
|
|
474
|
+
} else {
|
|
475
|
+
// biome-ignore lint/style/noNonNullAssertion: this will never be undefined
|
|
476
|
+
incentivesPayloads[i]!.parameters =
|
|
477
|
+
incentive.buildParameters(undefined, options).args.at(0) || zeroHash;
|
|
478
|
+
// biome-ignore lint/style/noNonNullAssertion: this will never be undefined
|
|
479
|
+
incentivesPayloads[i]!.instance = assertValidAddressByChainId(
|
|
480
|
+
options.config,
|
|
481
|
+
incentive.bases,
|
|
482
|
+
chainId,
|
|
483
|
+
).address;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const onChainPayload = {
|
|
488
|
+
budget: budgetPayload,
|
|
489
|
+
action: actionPayload,
|
|
490
|
+
validator: validatorPayload,
|
|
491
|
+
allowList: allowListPayload,
|
|
492
|
+
incentives: incentivesPayloads,
|
|
493
|
+
protocolFee,
|
|
494
|
+
referralFee,
|
|
495
|
+
maxParticipants,
|
|
496
|
+
owner,
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
const boostHash = await boostFactory(options.config, {
|
|
500
|
+
...this.optionallyAttachAccount(options.account),
|
|
501
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
502
|
+
...(_params as any),
|
|
503
|
+
chainId,
|
|
504
|
+
args: [prepareBoostPayload(onChainPayload)],
|
|
505
|
+
});
|
|
506
|
+
const receipt = await waitForTransactionReceipt(options.config, {
|
|
507
|
+
hash: boostHash,
|
|
508
|
+
});
|
|
509
|
+
const boostCreatedLog = parseEventLogs({
|
|
510
|
+
abi: boostCoreAbi,
|
|
511
|
+
eventName: 'BoostCreated',
|
|
512
|
+
logs: receipt.logs,
|
|
513
|
+
}).at(0);
|
|
514
|
+
let boostId = 0n;
|
|
515
|
+
if (!boostCreatedLog) throw new BoostCoreNoIdentifierEmitted();
|
|
516
|
+
boostId = boostCreatedLog?.args.boostIndex;
|
|
517
|
+
const boost = await this.readBoost(boostId);
|
|
518
|
+
return new Boost({
|
|
519
|
+
id: boostId,
|
|
520
|
+
budget: budget.at(boost.budget),
|
|
521
|
+
action: action.at(boost.action),
|
|
522
|
+
validator: validator.at(boost.validator),
|
|
523
|
+
allowList: allowList.at(boost.allowList),
|
|
524
|
+
incentives: incentives.map((incentive, i) =>
|
|
525
|
+
// biome-ignore lint/style/noNonNullAssertion: this will never be undefined
|
|
526
|
+
incentive.at(boost.incentives.at(i)!),
|
|
527
|
+
),
|
|
528
|
+
protocolFee: boost.protocolFee,
|
|
529
|
+
referralFee: boost.referralFee,
|
|
530
|
+
maxParticipants: boost.maxParticipants,
|
|
531
|
+
owner: boost.owner,
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Claims one incentive from a given `Boost` by `boostId` and `incentiveId`
|
|
537
|
+
*
|
|
538
|
+
* @public
|
|
539
|
+
* @async
|
|
540
|
+
* @param {bigint} boostId
|
|
541
|
+
* @param {bigint} incentiveId
|
|
542
|
+
* @param {Address} address
|
|
543
|
+
* @param {Hex} data
|
|
544
|
+
* @param {?WriteParams} [params]
|
|
545
|
+
* @returns {Promise<void>}
|
|
546
|
+
*/
|
|
547
|
+
public async claimIncentive(
|
|
548
|
+
boostId: bigint,
|
|
549
|
+
incentiveId: bigint,
|
|
550
|
+
address: Address,
|
|
551
|
+
data: Hex,
|
|
552
|
+
params?: WriteParams<typeof boostCoreAbi, 'claimIncentive'>,
|
|
553
|
+
) {
|
|
554
|
+
return await this.awaitResult(
|
|
555
|
+
this.claimIncentiveRaw(boostId, incentiveId, address, data, params),
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Claim an incentive for a Boost
|
|
561
|
+
*
|
|
562
|
+
* @public
|
|
563
|
+
* @async
|
|
564
|
+
* @param {bigint} boostId - The ID of the Boost
|
|
565
|
+
* @param {bigint} incentiveId - The ID of the Incentive
|
|
566
|
+
* @param {Address} referrer - The address of the referrer (if any)
|
|
567
|
+
* @param {Hex} data- The data for the claim
|
|
568
|
+
* @param {?WriteParams} [params]
|
|
569
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
570
|
+
*/
|
|
571
|
+
public async claimIncentiveRaw(
|
|
572
|
+
boostId: bigint,
|
|
573
|
+
incentiveId: bigint,
|
|
574
|
+
referrer: Address,
|
|
575
|
+
data: Hex,
|
|
576
|
+
params?: WriteParams<typeof boostCoreAbi, 'claimIncentive'>,
|
|
577
|
+
) {
|
|
578
|
+
const { request, result } = await simulateBoostCoreClaimIncentive(
|
|
579
|
+
this._config,
|
|
580
|
+
{
|
|
581
|
+
...assertValidAddressByChainId(
|
|
582
|
+
this._config,
|
|
583
|
+
this.addresses,
|
|
584
|
+
params?.chain?.id || params?.chainId,
|
|
585
|
+
),
|
|
586
|
+
args: [boostId, incentiveId, referrer, data],
|
|
587
|
+
...this.optionallyAttachAccount(),
|
|
588
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
589
|
+
...(params as any),
|
|
590
|
+
},
|
|
591
|
+
);
|
|
592
|
+
const hash = await writeBoostCoreClaimIncentive(this._config, request);
|
|
593
|
+
return { hash, result };
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Claims one incentive for a given `Boost` on behalf of another user by `boostId` and `incentiveId`
|
|
598
|
+
*
|
|
599
|
+
* @public
|
|
600
|
+
* @async
|
|
601
|
+
* @param {bigint} boostId
|
|
602
|
+
* @param {bigint} incentiveId
|
|
603
|
+
* @param {Address} referrer
|
|
604
|
+
* @param {Hex} data
|
|
605
|
+
* @param {Address} claimant
|
|
606
|
+
* @param {?WriteParams} [params]
|
|
607
|
+
* @returns {Promise<void>}
|
|
608
|
+
*/
|
|
609
|
+
public async claimIncentiveFor(
|
|
610
|
+
boostId: bigint,
|
|
611
|
+
incentiveId: bigint,
|
|
612
|
+
referrer: Address,
|
|
613
|
+
data: Hex,
|
|
614
|
+
claimant: Address,
|
|
615
|
+
params?: WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>,
|
|
616
|
+
) {
|
|
617
|
+
return await this.awaitResult(
|
|
618
|
+
this.claimIncentiveForRaw(
|
|
619
|
+
boostId,
|
|
620
|
+
incentiveId,
|
|
621
|
+
referrer,
|
|
622
|
+
data,
|
|
623
|
+
claimant,
|
|
624
|
+
params,
|
|
625
|
+
),
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Claim an incentive for a Boost on behalf of another user
|
|
631
|
+
*
|
|
632
|
+
* @public
|
|
633
|
+
* @async
|
|
634
|
+
* @param {bigint} boostId - The ID of the Boost
|
|
635
|
+
* @param {bigint} incentiveId - The ID of the Incentive
|
|
636
|
+
* @param {Address} referrer - The address of the referrer (if any)
|
|
637
|
+
* @param {Hex} data - The data for the claim
|
|
638
|
+
* @param {Address} claimant - The address of the user eligible for the incentive payout
|
|
639
|
+
* @param {?WriteParams} [params]
|
|
640
|
+
* @returns {Promise<{ hash: Hex; result: void; }>}
|
|
641
|
+
*/
|
|
642
|
+
public async claimIncentiveForRaw(
|
|
643
|
+
boostId: bigint,
|
|
644
|
+
incentiveId: bigint,
|
|
645
|
+
referrer: Address,
|
|
646
|
+
data: Hex,
|
|
647
|
+
claimant: Address,
|
|
648
|
+
params?: WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>,
|
|
649
|
+
) {
|
|
650
|
+
const { request, result } = await simulateBoostCoreClaimIncentiveFor(
|
|
651
|
+
this._config,
|
|
652
|
+
{
|
|
653
|
+
...assertValidAddressByChainId(
|
|
654
|
+
this._config,
|
|
655
|
+
this.addresses,
|
|
656
|
+
params?.chain?.id || params?.chainId,
|
|
657
|
+
),
|
|
658
|
+
args: [boostId, incentiveId, referrer, data, claimant],
|
|
659
|
+
...this.optionallyAttachAccount(),
|
|
660
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
661
|
+
...(params as any),
|
|
662
|
+
},
|
|
663
|
+
);
|
|
664
|
+
const hash = await writeBoostCoreClaimIncentiveFor(this._config, request);
|
|
665
|
+
return { hash, result };
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Get a Boost by index, will return the raw on chain representation of a Boost.
|
|
670
|
+
*
|
|
671
|
+
* @public
|
|
672
|
+
* @async
|
|
673
|
+
* @param {bigint} id
|
|
674
|
+
* @param {?ReadParams} [params]
|
|
675
|
+
* @returns {Promise<RawBoost>}
|
|
676
|
+
*/
|
|
677
|
+
public async readBoost(
|
|
678
|
+
id: bigint,
|
|
679
|
+
params?: ReadParams<typeof boostCoreAbi, 'getBoost'>,
|
|
680
|
+
) {
|
|
681
|
+
return await readBoostCoreGetBoost(this._config, {
|
|
682
|
+
address: this.assertValidAddress(),
|
|
683
|
+
args: [id],
|
|
684
|
+
...this.optionallyAttachAccount(),
|
|
685
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
686
|
+
...(params as any),
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Get a Boost by index, will return a new {@link Boost} with correct target implementations instantiated, ie `(await core.getBoost(0n)).allowList instanceof SimpleAllowList` vs `SimpleDenyList`
|
|
692
|
+
*
|
|
693
|
+
* @public
|
|
694
|
+
* @async
|
|
695
|
+
* @param {(string | bigint)} _id
|
|
696
|
+
* @param {?ReadParams} [params]
|
|
697
|
+
* @returns {Promise<Boost>}
|
|
698
|
+
*/
|
|
699
|
+
public async getBoost(
|
|
700
|
+
_id: string | bigint,
|
|
701
|
+
params?: ReadParams<typeof boostCoreAbi, 'getBoost'>,
|
|
702
|
+
) {
|
|
703
|
+
let id: bigint;
|
|
704
|
+
if (typeof _id === 'string') {
|
|
705
|
+
id = BigInt(_id);
|
|
706
|
+
} else id = _id;
|
|
707
|
+
const {
|
|
708
|
+
protocolFee,
|
|
709
|
+
referralFee,
|
|
710
|
+
maxParticipants,
|
|
711
|
+
owner,
|
|
712
|
+
...boostPayload
|
|
713
|
+
} = await this.readBoost(id, params);
|
|
714
|
+
const options: DeployableOptions = {
|
|
715
|
+
config: this._config,
|
|
716
|
+
account: this._account,
|
|
717
|
+
};
|
|
718
|
+
const [action, budget, validator, allowList, incentives] =
|
|
719
|
+
await Promise.all([
|
|
720
|
+
actionFromAddress(options, boostPayload.action),
|
|
721
|
+
budgetFromAddress(options, boostPayload.budget),
|
|
722
|
+
validatorFromAddress(options, boostPayload.validator),
|
|
723
|
+
allowListFromAddress(options, boostPayload.allowList),
|
|
724
|
+
Promise.all(
|
|
725
|
+
boostPayload.incentives.map((incentiveAddress) =>
|
|
726
|
+
incentiveFromAddress(options, incentiveAddress),
|
|
727
|
+
),
|
|
728
|
+
),
|
|
729
|
+
]);
|
|
730
|
+
return new Boost({
|
|
731
|
+
id,
|
|
732
|
+
action,
|
|
733
|
+
budget,
|
|
734
|
+
validator,
|
|
735
|
+
allowList,
|
|
736
|
+
incentives,
|
|
737
|
+
protocolFee,
|
|
738
|
+
referralFee,
|
|
739
|
+
maxParticipants,
|
|
740
|
+
owner,
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Retrieve the total number of deployed Boosts
|
|
746
|
+
*
|
|
747
|
+
* @public
|
|
748
|
+
* @async
|
|
749
|
+
* @param {?ReadParams} [params]
|
|
750
|
+
* @returns {Promise<bigint>}
|
|
751
|
+
*/
|
|
752
|
+
public async getBoostCount(
|
|
753
|
+
params?: ReadParams<typeof boostCoreAbi, 'getBoostCount'>,
|
|
754
|
+
) {
|
|
755
|
+
return await readBoostCoreGetBoostCount(this._config, {
|
|
756
|
+
...assertValidAddressByChainId(
|
|
757
|
+
this._config,
|
|
758
|
+
this.addresses,
|
|
759
|
+
params?.chainId,
|
|
760
|
+
),
|
|
761
|
+
args: [],
|
|
762
|
+
...this.optionallyAttachAccount(),
|
|
763
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
764
|
+
...(params as any),
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Checks if an address is authorized
|
|
770
|
+
*
|
|
771
|
+
* @public
|
|
772
|
+
* @async
|
|
773
|
+
* @param {Address} address
|
|
774
|
+
* @param {?ReadParams &
|
|
775
|
+
* ReadParams<typeof iAuthAbi, 'isAuthorized'>} [params]
|
|
776
|
+
* @returns {Promise<boolean>}
|
|
777
|
+
*/
|
|
778
|
+
public async isAuthorized(
|
|
779
|
+
address: Address,
|
|
780
|
+
params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'> &
|
|
781
|
+
ReadParams<typeof iAuthAbi, 'isAuthorized'>,
|
|
782
|
+
) {
|
|
783
|
+
const auth = await this.createBoostAuth(params);
|
|
784
|
+
return readIAuthIsAuthorized(this._config, {
|
|
785
|
+
address: auth,
|
|
786
|
+
args: [address],
|
|
787
|
+
...this.optionallyAttachAccount(),
|
|
788
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
789
|
+
...(params as any),
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Retrieve the address of the current creation auth provider.
|
|
795
|
+
*
|
|
796
|
+
* @public
|
|
797
|
+
* @async
|
|
798
|
+
* @param {?ReadParams} [params]
|
|
799
|
+
* @returns {Promise<Address>}
|
|
800
|
+
*/
|
|
801
|
+
public async createBoostAuth(
|
|
802
|
+
params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'>,
|
|
803
|
+
) {
|
|
804
|
+
return await readBoostCoreCreateBoostAuth(this._config, {
|
|
805
|
+
...assertValidAddressByChainId(
|
|
806
|
+
this._config,
|
|
807
|
+
this.addresses,
|
|
808
|
+
params?.chainId,
|
|
809
|
+
),
|
|
810
|
+
args: [],
|
|
811
|
+
...this.optionallyAttachAccount(),
|
|
812
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
813
|
+
...(params as any),
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Replace the current auth scheme.
|
|
819
|
+
*
|
|
820
|
+
* @public
|
|
821
|
+
* @async
|
|
822
|
+
* @param {Auth} auth
|
|
823
|
+
* @param {?WriteParams} [params]
|
|
824
|
+
* @returns {Promise<void>}
|
|
825
|
+
*/
|
|
826
|
+
public async setCreateBoostAuth(
|
|
827
|
+
auth: Auth,
|
|
828
|
+
params?: WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>,
|
|
829
|
+
) {
|
|
830
|
+
return await this.awaitResult(
|
|
831
|
+
this.setCreateBoostAuthRaw(auth.assertValidAddress(), {
|
|
832
|
+
...params,
|
|
833
|
+
}),
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Set the createBoostAuth address
|
|
839
|
+
*
|
|
840
|
+
* @public
|
|
841
|
+
* @async
|
|
842
|
+
* @param {Address} address
|
|
843
|
+
* @param {?WriteParams} [params]
|
|
844
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
845
|
+
*/
|
|
846
|
+
public async setCreateBoostAuthRaw(
|
|
847
|
+
address: Address,
|
|
848
|
+
params?: WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>,
|
|
849
|
+
) {
|
|
850
|
+
const { request, result } = await simulateBoostCoreSetCreateBoostAuth(
|
|
851
|
+
this._config,
|
|
852
|
+
{
|
|
853
|
+
...assertValidAddressByChainId(
|
|
854
|
+
this._config,
|
|
855
|
+
this.addresses,
|
|
856
|
+
params?.chainId,
|
|
857
|
+
),
|
|
858
|
+
args: [address],
|
|
859
|
+
...this.optionallyAttachAccount(),
|
|
860
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
861
|
+
...(params as any),
|
|
862
|
+
},
|
|
863
|
+
);
|
|
864
|
+
const hash = await writeBoostCoreSetCreateBoostAuth(this._config, request);
|
|
865
|
+
return { hash, result };
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Get the protocol fee.
|
|
870
|
+
*
|
|
871
|
+
* @public
|
|
872
|
+
* @async
|
|
873
|
+
* @param {?ReadParams} [params]
|
|
874
|
+
* @returns {unknown}
|
|
875
|
+
*/
|
|
876
|
+
public async protocolFee(
|
|
877
|
+
params?: ReadParams<typeof boostCoreAbi, 'protocolFee'>,
|
|
878
|
+
) {
|
|
879
|
+
return await readBoostCoreProtocolFee(this._config, {
|
|
880
|
+
...assertValidAddressByChainId(
|
|
881
|
+
this._config,
|
|
882
|
+
this.addresses,
|
|
883
|
+
params?.chainId,
|
|
884
|
+
),
|
|
885
|
+
args: [],
|
|
886
|
+
...this.optionallyAttachAccount(),
|
|
887
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
888
|
+
...(params as any),
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Get the protocol fee receiver.
|
|
894
|
+
*
|
|
895
|
+
* @public
|
|
896
|
+
* @async
|
|
897
|
+
* @param {?ReadParams} [params]
|
|
898
|
+
* @returns {Promise<Address>}
|
|
899
|
+
*/
|
|
900
|
+
public async protocolFeeReceiver(
|
|
901
|
+
params?: ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>,
|
|
902
|
+
) {
|
|
903
|
+
return await readBoostCoreProtocolFeeReceiver(this._config, {
|
|
904
|
+
...assertValidAddressByChainId(
|
|
905
|
+
this._config,
|
|
906
|
+
this.addresses,
|
|
907
|
+
params?.chainId,
|
|
908
|
+
),
|
|
909
|
+
args: [],
|
|
910
|
+
...this.optionallyAttachAccount(),
|
|
911
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
912
|
+
...(params as any),
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Set the protocol fee receiver address. This function is only callable by the owner.
|
|
918
|
+
*
|
|
919
|
+
* @public
|
|
920
|
+
* @async
|
|
921
|
+
* @param {Address} address
|
|
922
|
+
* @param {?WriteParams} [params]
|
|
923
|
+
* @returns {Promise<void>}
|
|
924
|
+
*/
|
|
925
|
+
public async setProcolFeeReceiver(
|
|
926
|
+
address: Address,
|
|
927
|
+
params?: WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>,
|
|
928
|
+
) {
|
|
929
|
+
return await this.awaitResult(
|
|
930
|
+
this.setProcolFeeReceiverRaw(address, {
|
|
931
|
+
...params,
|
|
932
|
+
}),
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Set the protocol fee receiver address. This function is only callable by the owner.
|
|
938
|
+
*
|
|
939
|
+
* @public
|
|
940
|
+
* @async
|
|
941
|
+
* @param {Address} address
|
|
942
|
+
* @param {?WriteParams} [params]
|
|
943
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
944
|
+
*/
|
|
945
|
+
public async setProcolFeeReceiverRaw(
|
|
946
|
+
address: Address,
|
|
947
|
+
params?: WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>,
|
|
948
|
+
) {
|
|
949
|
+
const { request, result } = await simulateBoostCoreSetProtocolFeeReceiver(
|
|
950
|
+
this._config,
|
|
951
|
+
{
|
|
952
|
+
...assertValidAddressByChainId(
|
|
953
|
+
this._config,
|
|
954
|
+
this.addresses,
|
|
955
|
+
params?.chainId,
|
|
956
|
+
),
|
|
957
|
+
args: [address],
|
|
958
|
+
...this.optionallyAttachAccount(),
|
|
959
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
960
|
+
...(params as any),
|
|
961
|
+
},
|
|
962
|
+
);
|
|
963
|
+
const hash = await writeBoostCoreSetProtocolFeeReceiver(
|
|
964
|
+
this._config,
|
|
965
|
+
request,
|
|
966
|
+
);
|
|
967
|
+
return { hash, result };
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Get the claim fee.
|
|
972
|
+
*
|
|
973
|
+
* @public
|
|
974
|
+
* @async
|
|
975
|
+
* @param {?ReadParams} [params]
|
|
976
|
+
* @returns {Promise<bigint>}
|
|
977
|
+
*/
|
|
978
|
+
public async claimFee(params?: ReadParams<typeof boostCoreAbi, 'claimFee'>) {
|
|
979
|
+
return await readBoostCoreClaimFee(this._config, {
|
|
980
|
+
...assertValidAddressByChainId(
|
|
981
|
+
this._config,
|
|
982
|
+
this.addresses,
|
|
983
|
+
params?.chainId,
|
|
984
|
+
),
|
|
985
|
+
args: [],
|
|
986
|
+
...this.optionallyAttachAccount(),
|
|
987
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
988
|
+
...(params as any),
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Sets the claim fee.
|
|
994
|
+
*
|
|
995
|
+
* @public
|
|
996
|
+
* @async
|
|
997
|
+
* @param {bigint} claimFee
|
|
998
|
+
* @param {?WriteParams} [params]
|
|
999
|
+
* @returns {Promise<void>}
|
|
1000
|
+
*/
|
|
1001
|
+
public async setClaimFee(
|
|
1002
|
+
claimFee: bigint,
|
|
1003
|
+
params?: WriteParams<typeof boostCoreAbi, 'setClaimFee'>,
|
|
1004
|
+
) {
|
|
1005
|
+
return await this.awaitResult(this.setClaimFeeRaw(claimFee, params));
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Sets the claim fee.
|
|
1010
|
+
*
|
|
1011
|
+
* @public
|
|
1012
|
+
* @async
|
|
1013
|
+
* @param {bigint} claimFee
|
|
1014
|
+
* @param {?WriteParams} [params]
|
|
1015
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
1016
|
+
*/
|
|
1017
|
+
public async setClaimFeeRaw(
|
|
1018
|
+
claimFee: bigint,
|
|
1019
|
+
params?: WriteParams<typeof boostCoreAbi, 'setClaimFee'>,
|
|
1020
|
+
) {
|
|
1021
|
+
const { request, result } = await simulateBoostCoreSetClaimFee(
|
|
1022
|
+
this._config,
|
|
1023
|
+
{
|
|
1024
|
+
...assertValidAddressByChainId(
|
|
1025
|
+
this._config,
|
|
1026
|
+
this.addresses,
|
|
1027
|
+
params?.chainId,
|
|
1028
|
+
),
|
|
1029
|
+
args: [claimFee],
|
|
1030
|
+
...this.optionallyAttachAccount(),
|
|
1031
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
1032
|
+
...(params as any),
|
|
1033
|
+
},
|
|
1034
|
+
);
|
|
1035
|
+
const hash = await writeBoostCoreSetClaimFee(this._config, request);
|
|
1036
|
+
return { hash, result };
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* Retrieves the claim information from a transaction receipt.
|
|
1041
|
+
*
|
|
1042
|
+
* @param {GetTransactionReceiptParameters} params - The parameters required to get the transaction receipt.
|
|
1043
|
+
* @returns {Promise<{ boostId: bigint, incentiveId: bigint, claimer: Address, amount: bigint } | undefined>} The claim information if found, undefined otherwise.
|
|
1044
|
+
*
|
|
1045
|
+
* @description
|
|
1046
|
+
* This method retrieves the transaction receipt using the provided parameters,
|
|
1047
|
+
* then parses the logs to find the 'BoostClaimed' event.
|
|
1048
|
+
* If found, it returns the arguments of the event, which include the boost ID,
|
|
1049
|
+
* incentive ID, claimer address, and claimed amount.
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```ts
|
|
1053
|
+
* const claimInfo = await boostCore.getClaimFromTransaction({
|
|
1054
|
+
* hash: '0x...',
|
|
1055
|
+
* chainId: 1
|
|
1056
|
+
* });
|
|
1057
|
+
* if (claimInfo) {
|
|
1058
|
+
* console.log(`Boost ${claimInfo.boostId} claimed by ${claimInfo.claimer}`);
|
|
1059
|
+
* }
|
|
1060
|
+
* ```
|
|
1061
|
+
*/
|
|
1062
|
+
public async getClaimFromTransaction(
|
|
1063
|
+
params: GetTransactionReceiptParameters,
|
|
1064
|
+
) {
|
|
1065
|
+
const receipt = await getTransactionReceipt(this._config, params);
|
|
1066
|
+
const logs = parseEventLogs({
|
|
1067
|
+
abi: boostCoreAbi,
|
|
1068
|
+
eventName: 'BoostClaimed',
|
|
1069
|
+
logs: receipt.logs,
|
|
1070
|
+
});
|
|
1071
|
+
return logs.at(0)?.args;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Bound {@link PassthroughAuth} constructor that reuses the same configuration as the Boost Core instance.
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* ```ts
|
|
1079
|
+
* const auth = core.PassthroughAuth('0x') // is roughly equivalent to
|
|
1080
|
+
* const auth = new PassthroughAuth({ config: core._config, account: core._account }, '0x')
|
|
1081
|
+
* ```
|
|
1082
|
+
* @param {Address} address
|
|
1083
|
+
* @returns {PassthroughAuth}
|
|
1084
|
+
*/
|
|
1085
|
+
PassthroughAuth(address?: Address) {
|
|
1086
|
+
return new PassthroughAuth(
|
|
1087
|
+
{ config: this._config, account: this._account },
|
|
1088
|
+
address,
|
|
1089
|
+
);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
// /**
|
|
1093
|
+
// * Bound {@link ContractAction} constructor that reuses the same configuration as the Boost Core instance.
|
|
1094
|
+
// *
|
|
1095
|
+
// * @example
|
|
1096
|
+
// * ```ts
|
|
1097
|
+
// * const action = core.ContractAction('0x') // is roughly equivalent to
|
|
1098
|
+
// * const action = new ContractAction({ config: core._config, account: core._account }, '0x')
|
|
1099
|
+
// * ```
|
|
1100
|
+
// * @param {DeployablePayloadOrAddress<ContractActionPayload>} options
|
|
1101
|
+
// * @param {?boolean} [isBase]
|
|
1102
|
+
// * @returns {ContractAction}
|
|
1103
|
+
// */
|
|
1104
|
+
// ContractAction(
|
|
1105
|
+
// options: DeployablePayloadOrAddress<ContractActionPayload>,
|
|
1106
|
+
// isBase?: boolean,
|
|
1107
|
+
// ) {
|
|
1108
|
+
// return new ContractAction(
|
|
1109
|
+
// { config: this._config, account: this._account },
|
|
1110
|
+
// options,
|
|
1111
|
+
// isBase,
|
|
1112
|
+
// );
|
|
1113
|
+
// }
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Bound {@link EventAction} constructor that reuses the same configuration as the Boost Core instance.
|
|
1117
|
+
*
|
|
1118
|
+
* @example
|
|
1119
|
+
* ```ts
|
|
1120
|
+
* const action = core.EventAction('0x') // is roughly equivalent to
|
|
1121
|
+
* const action = new EventAction({ config: core._config, account: core._account }, '0x')
|
|
1122
|
+
*/
|
|
1123
|
+
EventAction(
|
|
1124
|
+
options: DeployablePayloadOrAddress<EventActionPayload>,
|
|
1125
|
+
isBase?: boolean,
|
|
1126
|
+
) {
|
|
1127
|
+
return new EventAction(
|
|
1128
|
+
{ config: this._config, account: this._account },
|
|
1129
|
+
options,
|
|
1130
|
+
isBase,
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
// /**
|
|
1134
|
+
// * Bound {@link ERC721MintAction} constructor that reuses the same configuration as the Boost Core instance.
|
|
1135
|
+
// *
|
|
1136
|
+
// * @example
|
|
1137
|
+
// * ```ts
|
|
1138
|
+
// * const action = core.ERC721MintAction('0x') // is roughly equivalent to
|
|
1139
|
+
// * const action = new ERC721MintAction({ config: core._config, account: core._account }, '0x')
|
|
1140
|
+
// * ```
|
|
1141
|
+
// * @param {DeployablePayloadOrAddress<ERC721MintActionPayload>} options
|
|
1142
|
+
// * @param {?boolean} [isBase]
|
|
1143
|
+
// * @returns {ERC721MintAction}
|
|
1144
|
+
// */
|
|
1145
|
+
// ERC721MintAction(
|
|
1146
|
+
// options: DeployablePayloadOrAddress<ERC721MintActionPayload>,
|
|
1147
|
+
// isBase?: boolean,
|
|
1148
|
+
// ) {
|
|
1149
|
+
// return new ERC721MintAction(
|
|
1150
|
+
// { config: this._config, account: this._account },
|
|
1151
|
+
// options,
|
|
1152
|
+
// isBase,
|
|
1153
|
+
// );
|
|
1154
|
+
// }
|
|
1155
|
+
/**
|
|
1156
|
+
* Bound {@link OpenAllowList} constructor that reuses the same configuration as the Boost Core instance.
|
|
1157
|
+
*
|
|
1158
|
+
* @example
|
|
1159
|
+
* ```ts
|
|
1160
|
+
* const list = core.OpenAllowList('0x') // is roughly equivalent to
|
|
1161
|
+
* const list = new OpenAllowList({ config: core._config, account: core._account }, '0x')
|
|
1162
|
+
* ```
|
|
1163
|
+
* @param {?boolean} [isBase]
|
|
1164
|
+
* @returns {OpenAllowList}
|
|
1165
|
+
*/
|
|
1166
|
+
OpenAllowList(isBase?: boolean) {
|
|
1167
|
+
return new OpenAllowList(
|
|
1168
|
+
{ config: this._config, account: this._account },
|
|
1169
|
+
undefined,
|
|
1170
|
+
isBase,
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Bound {@link SimpleAllowList} constructor that reuses the same configuration as the Boost Core instance.
|
|
1175
|
+
*
|
|
1176
|
+
* @example
|
|
1177
|
+
* ```ts
|
|
1178
|
+
* const list = core.SimpleAllowList('0x') // is roughly equivalent to
|
|
1179
|
+
* const list = new SimpleAllowList({ config: core._config, account: core._account }, '0x')
|
|
1180
|
+
* ```
|
|
1181
|
+
* @param {DeployablePayloadOrAddress<SimpleAllowListPayload>} options
|
|
1182
|
+
* @param {?boolean} [isBase]
|
|
1183
|
+
* @returns {SimpleAllowList}
|
|
1184
|
+
*/
|
|
1185
|
+
SimpleAllowList(
|
|
1186
|
+
options: DeployablePayloadOrAddress<SimpleAllowListPayload>,
|
|
1187
|
+
isBase?: boolean,
|
|
1188
|
+
) {
|
|
1189
|
+
return new SimpleAllowList(
|
|
1190
|
+
{ config: this._config, account: this._account },
|
|
1191
|
+
options,
|
|
1192
|
+
isBase,
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Bound {@link SimpleDenyList} constructor that reuses the same configuration as the Boost Core instance.
|
|
1197
|
+
*
|
|
1198
|
+
* @example
|
|
1199
|
+
* ```ts
|
|
1200
|
+
* const list = core.SimpleDenyList('0x') // is roughly equivalent to
|
|
1201
|
+
* const list = new SimpleDenyList({ config: core._config, account: core._account }, '0x')
|
|
1202
|
+
* ```
|
|
1203
|
+
* @param {DeployablePayloadOrAddress<SimpleDenyListPayload>} options
|
|
1204
|
+
* @param {?boolean} [isBase]
|
|
1205
|
+
* @returns {SimpleDenyList}
|
|
1206
|
+
*/
|
|
1207
|
+
SimpleDenyList(
|
|
1208
|
+
options: DeployablePayloadOrAddress<SimpleDenyListPayload>,
|
|
1209
|
+
isBase?: boolean,
|
|
1210
|
+
) {
|
|
1211
|
+
return new SimpleDenyList(
|
|
1212
|
+
{ config: this._config, account: this._account },
|
|
1213
|
+
options,
|
|
1214
|
+
isBase,
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1217
|
+
// /**
|
|
1218
|
+
// * Bound {@link SimpleBudget} constructor that reuses the same configuration as the Boost Core instance.
|
|
1219
|
+
// *
|
|
1220
|
+
// * @example
|
|
1221
|
+
// * ```ts
|
|
1222
|
+
// * const budget = core.SimpleBudget('0x') // is roughly equivalent to
|
|
1223
|
+
// * const budget = new SimpleBudget({ config: core._config, account: core._account }, '0x')
|
|
1224
|
+
// * ```
|
|
1225
|
+
// * @param {DeployablePayloadOrAddress<SimpleBudgetPayload>} options
|
|
1226
|
+
// * @returns {SimpleBudget}
|
|
1227
|
+
// */
|
|
1228
|
+
// SimpleBudget(options: DeployablePayloadOrAddress<SimpleBudgetPayload>) {
|
|
1229
|
+
// return new SimpleBudget(
|
|
1230
|
+
// { config: this._config, account: this._account },
|
|
1231
|
+
// options,
|
|
1232
|
+
// );
|
|
1233
|
+
// }
|
|
1234
|
+
/**
|
|
1235
|
+
* Bound {@link ManagedBudget} constructor that reuses the same configuration as the Boost Core instance.
|
|
1236
|
+
*
|
|
1237
|
+
* @example
|
|
1238
|
+
* ```ts
|
|
1239
|
+
* const budget = core.ManagedBudget('0x') // is roughly equivalent to
|
|
1240
|
+
* const budget = new ManagedBudget({ config: core._config, account: core._account }, '0x')
|
|
1241
|
+
* ```
|
|
1242
|
+
* @param {DeployablePayloadOrAddress<ManagedBudgetPayload>} options
|
|
1243
|
+
* @returns {ManagedBudget}
|
|
1244
|
+
*/
|
|
1245
|
+
ManagedBudget(options: DeployablePayloadOrAddress<ManagedBudgetPayload>) {
|
|
1246
|
+
return new ManagedBudget(
|
|
1247
|
+
{ config: this._config, account: this._account },
|
|
1248
|
+
options,
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
// /**
|
|
1252
|
+
// * Bound {@link VestingBudget} constructor that reuses the same configuration as the Boost Core instance.
|
|
1253
|
+
// *
|
|
1254
|
+
// * @example
|
|
1255
|
+
// * ```ts
|
|
1256
|
+
// * const budget = core.VestingBudget('0x') // is roughly equivalent to
|
|
1257
|
+
// * const budget = new VestingBudget({ config: core._config, account: core._account }, '0x')
|
|
1258
|
+
// * ```
|
|
1259
|
+
// * @param {DeployablePayloadOrAddress<VestingBudgetPayload>} options
|
|
1260
|
+
// * @returns {VestingBudget}
|
|
1261
|
+
// */
|
|
1262
|
+
// VestingBudget(options: DeployablePayloadOrAddress<VestingBudgetPayload>) {
|
|
1263
|
+
// return new VestingBudget(
|
|
1264
|
+
// { config: this._config, account: this._account },
|
|
1265
|
+
// options,
|
|
1266
|
+
// );
|
|
1267
|
+
// }
|
|
1268
|
+
/**
|
|
1269
|
+
* Bound {@link AllowListIncentive} constructor that reuses the same configuration as the Boost Core instance.
|
|
1270
|
+
*
|
|
1271
|
+
* @example
|
|
1272
|
+
* ```ts
|
|
1273
|
+
* const incentive = core.AllowListIncentive({ ... }) // is roughly equivalent to
|
|
1274
|
+
* const incentive = new AllowListIncentive({ config: core._config, account: core._account }, { ... })
|
|
1275
|
+
* ```
|
|
1276
|
+
* @param {DeployablePayloadOrAddress<VestingBudgetPayload>} options
|
|
1277
|
+
* @returns {VestingBudget}
|
|
1278
|
+
*/
|
|
1279
|
+
AllowListIncentive(options: AllowListIncentivePayload) {
|
|
1280
|
+
return new AllowListIncentive(
|
|
1281
|
+
{ config: this._config, account: this._account },
|
|
1282
|
+
options,
|
|
1283
|
+
);
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Bound {@link CGDAIncentive} constructor that reuses the same configuration as the Boost Core instance.
|
|
1287
|
+
*
|
|
1288
|
+
* @example
|
|
1289
|
+
* ```ts
|
|
1290
|
+
* const incentive = core.CGDAIncentive({ ... }) // is roughly equivalent to
|
|
1291
|
+
* const incentive = new CGDAIncentive({ config: core._config, account: core._account }, { ... })
|
|
1292
|
+
* ```
|
|
1293
|
+
* @param {CGDAIncentivePayload} options
|
|
1294
|
+
* @returns {CGDAIncentive}
|
|
1295
|
+
*/
|
|
1296
|
+
CGDAIncentive(options: CGDAIncentivePayload) {
|
|
1297
|
+
return new CGDAIncentive(
|
|
1298
|
+
{ config: this._config, account: this._account },
|
|
1299
|
+
options,
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Bound {@link ERC20Incentive} constructor that reuses the same configuration as the Boost Core instance.
|
|
1304
|
+
*
|
|
1305
|
+
* @example
|
|
1306
|
+
* ```ts
|
|
1307
|
+
* const incentive = core.ERC20Incentive({ ... }) // is roughly equivalent to
|
|
1308
|
+
* const incentive = new ERC20Incentive({ config: core._config, account: core._account }, { ... })
|
|
1309
|
+
* ```
|
|
1310
|
+
* @param {ERC20IncentivePayload} options
|
|
1311
|
+
* @returns {ERC20Incentive}
|
|
1312
|
+
*/
|
|
1313
|
+
ERC20Incentive(options: ERC20IncentivePayload) {
|
|
1314
|
+
return new ERC20Incentive(
|
|
1315
|
+
{ config: this._config, account: this._account },
|
|
1316
|
+
options,
|
|
1317
|
+
);
|
|
1318
|
+
}
|
|
1319
|
+
// /**
|
|
1320
|
+
// * Temporarily disabled until low level ABI encoding bugs are resolved
|
|
1321
|
+
// * Bound {@link ERC1155Incentive} constructor that reuses the same configuration as the Boost Core instance.
|
|
1322
|
+
// *
|
|
1323
|
+
// * @experimental
|
|
1324
|
+
// * @example
|
|
1325
|
+
// * ```ts
|
|
1326
|
+
// * const incentive = core.ERC1155Incentive({ ... }) // is roughly equivalent to
|
|
1327
|
+
// * const incentive = new ERC1155Incentive({ config: core._config, account: core._account }, { ... })
|
|
1328
|
+
// * ```
|
|
1329
|
+
// * @param {ERC1155IncentivePayload} options
|
|
1330
|
+
// * @returns {ERC1155Incentive}
|
|
1331
|
+
// */
|
|
1332
|
+
// ERC1155Incentive(options: ERC1155IncentivePayload) {
|
|
1333
|
+
// return new ERC1155Incentive(
|
|
1334
|
+
// { config: this._config, account: this._account },
|
|
1335
|
+
// options,
|
|
1336
|
+
// );
|
|
1337
|
+
// }
|
|
1338
|
+
/**
|
|
1339
|
+
* Bound {@link PointsIncentive} constructor that reuses the same configuration as the Boost Core instance.
|
|
1340
|
+
*
|
|
1341
|
+
* @example
|
|
1342
|
+
* ```ts
|
|
1343
|
+
* const incentive = core.PointsIncentive({ ... }) // is roughly equivalent to
|
|
1344
|
+
* const incentive = new PointsIncentive({ config: core._config, account: core._account }, { ... })
|
|
1345
|
+
* ```
|
|
1346
|
+
* @param {PointsIncentivePayload} options
|
|
1347
|
+
* @returns {PointsIncentive}
|
|
1348
|
+
*/
|
|
1349
|
+
PointsIncentive(options: PointsIncentivePayload) {
|
|
1350
|
+
return new PointsIncentive(
|
|
1351
|
+
{ config: this._config, account: this._account },
|
|
1352
|
+
options,
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Bound {@link SignerValidator} constructor that reuses the same configuration as the Boost Core instance.
|
|
1357
|
+
*
|
|
1358
|
+
* @example
|
|
1359
|
+
* ```ts
|
|
1360
|
+
* const validator = core.SignerValidator({ ... }) // is roughly equivalent to
|
|
1361
|
+
* const validator = new SignerValidator({ config: core._config, account: core._account }, { ... })
|
|
1362
|
+
* ```
|
|
1363
|
+
* @param {DeployablePayloadOrAddress<SignerValidatorPayload>} options
|
|
1364
|
+
* @param {?boolean} [isBase]
|
|
1365
|
+
* @returns {SignerValidator}
|
|
1366
|
+
*/
|
|
1367
|
+
SignerValidator(
|
|
1368
|
+
options: DeployablePayloadOrAddress<SignerValidatorPayload>,
|
|
1369
|
+
isBase?: boolean,
|
|
1370
|
+
) {
|
|
1371
|
+
return new SignerValidator(
|
|
1372
|
+
{ config: this._config, account: this._account },
|
|
1373
|
+
options,
|
|
1374
|
+
isBase,
|
|
1375
|
+
);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
* Bound {@link ERC20VariableCriteriaIncentive} constructor that reuses the same configuration as the Boost Core instance.
|
|
1380
|
+
*
|
|
1381
|
+
* @example
|
|
1382
|
+
* ```ts
|
|
1383
|
+
* const validator = core.ERC20VariableCrtieriaIncentive({ ... }) // is roughly equivalent to
|
|
1384
|
+
* const validator = new ERC20VariableCrtieriaIncentive({ config: core._config, account: core._account }, { ... })
|
|
1385
|
+
* ```
|
|
1386
|
+
* @param {DeployablePayloadOrAddress<ERC20VariableCrtieriaIncentivePayload>} options
|
|
1387
|
+
* @param {?boolean} [isBase]
|
|
1388
|
+
* @returns {ERC20VariableCrtieriaIncentive}
|
|
1389
|
+
* */
|
|
1390
|
+
ERC20VariableCriteriaIncentive(
|
|
1391
|
+
options: DeployablePayloadOrAddress<ERC20VariableCriteriaIncentivePayload>,
|
|
1392
|
+
isBase?: boolean,
|
|
1393
|
+
) {
|
|
1394
|
+
return new ERC20VariableCriteriaIncentive(
|
|
1395
|
+
{ config: this._config, account: this._account },
|
|
1396
|
+
options,
|
|
1397
|
+
isBase,
|
|
1398
|
+
);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* Bound {@link ERC20VariableIncentive} constructor that reuses the same configuration as the Boost Core instance.
|
|
1403
|
+
*
|
|
1404
|
+
* @example
|
|
1405
|
+
* ```ts
|
|
1406
|
+
* const validator = core.ERC20VariableIncentive({ ... }) // is roughly equivalent to
|
|
1407
|
+
* const validator = new ERC20VariableIncentive({ config: core._config, account: core._account }, { ... })
|
|
1408
|
+
* ```
|
|
1409
|
+
* @param {DeployablePayloadOrAddress<ERC20VariableIncentivePayload>} options
|
|
1410
|
+
* @param {?boolean} [isBase]
|
|
1411
|
+
* @returns {ERC20VariableIncentive}
|
|
1412
|
+
*/
|
|
1413
|
+
ERC20VariableIncentive(
|
|
1414
|
+
options: DeployablePayloadOrAddress<ERC20VariableIncentivePayload>,
|
|
1415
|
+
isBase?: boolean,
|
|
1416
|
+
) {
|
|
1417
|
+
return new ERC20VariableIncentive(
|
|
1418
|
+
{ config: this._config, account: this._account },
|
|
1419
|
+
options,
|
|
1420
|
+
isBase,
|
|
1421
|
+
);
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/**
|
|
1425
|
+
* @inheritdoc
|
|
1426
|
+
*
|
|
1427
|
+
* @public
|
|
1428
|
+
* @param {?[Address, Address]} [_payload]
|
|
1429
|
+
* @param {?DeployableOptions} [_options]
|
|
1430
|
+
* @returns {GenericDeployableParams}
|
|
1431
|
+
*/
|
|
1432
|
+
public override buildParameters(
|
|
1433
|
+
_payload?: [Address, Address],
|
|
1434
|
+
_options?: DeployableOptions,
|
|
1435
|
+
): GenericDeployableParams {
|
|
1436
|
+
const [payload, options] = this.validateDeploymentConfig(
|
|
1437
|
+
_payload,
|
|
1438
|
+
_options,
|
|
1439
|
+
);
|
|
1440
|
+
return {
|
|
1441
|
+
abi: boostCoreAbi,
|
|
1442
|
+
bytecode: bytecode as Hex,
|
|
1443
|
+
args: payload,
|
|
1444
|
+
...this.optionallyAttachAccount(options.account),
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
}
|