@boostxyz/sdk 0.0.0-alpha.7 → 0.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +1 -1
- package/dist/Actions/ContractAction.d.ts +46 -3
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +37 -10
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +257 -11
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +249 -82
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.d.ts +2 -2
- package/dist/AllowLists/AllowList.js +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +33 -4
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +52 -37
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +31 -2
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +41 -129
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.cjs.map +1 -1
- package/dist/Auth/PassthroughAuth.js +4 -4
- package/dist/Auth/PassthroughAuth.js.map +1 -1
- package/dist/Boost.cjs +1 -1
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.d.ts +93 -1
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +151 -5
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +45 -7
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +352 -305
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts +18 -4
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +36 -25
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +40 -2
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +53 -36
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/SimpleBudget.d.ts +33 -2
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +54 -2
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs +1 -1
- package/dist/Deployable/Contract.cjs.map +1 -1
- package/dist/Deployable/Contract.js +1 -1
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts +8 -2
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +6 -0
- package/dist/Deployable/Deployable.js.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +4 -3
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +31 -28
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +35 -5
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +33 -21
- package/dist/Incentives/AllowListIncentive.js.map +1 -1
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
- package/dist/Incentives/CGDAIncentive.d.ts +89 -5
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +44 -23
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +67 -6
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +49 -5
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +46 -27
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +42 -5
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.cjs.map +1 -1
- package/dist/Incentives/Incentive.js +48 -32
- package/dist/Incentives/Incentive.js.map +1 -1
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +49 -5
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +38 -21
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +298 -5
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +151 -26
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/claiming.cjs +2 -0
- package/dist/claiming.cjs.map +1 -0
- package/dist/claiming.d.ts +43 -0
- package/dist/claiming.d.ts.map +1 -0
- package/dist/claiming.js +17 -0
- package/dist/claiming.js.map +1 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +15 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +30 -21
- package/dist/errors.js.map +1 -1
- package/dist/{generated-DGpIVcv5.js → generated-57_Kffpz.js} +293 -282
- package/dist/generated-57_Kffpz.js.map +1 -0
- package/dist/{generated-Cd-Fe7W7.cjs → generated-wKBNvm48.cjs} +3 -3
- package/dist/generated-wKBNvm48.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -124
- package/dist/transfers.cjs +2 -0
- package/dist/transfers.cjs.map +1 -0
- package/dist/transfers.d.ts +198 -0
- package/dist/transfers.d.ts.map +1 -0
- package/dist/transfers.js +84 -0
- package/dist/transfers.js.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +2 -1371
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +26 -653
- package/dist/utils.js.map +1 -1
- package/package.json +17 -3
- package/src/Actions/Action.test.ts +5 -4
- package/src/Actions/ContractAction.test.ts +4 -6
- package/src/Actions/ContractAction.ts +73 -10
- package/src/Actions/ERC721MintAction.test.ts +2 -2
- package/src/Actions/ERC721MintAction.ts +70 -16
- package/src/Actions/EventAction.test.ts +43 -17
- package/src/Actions/EventAction.ts +451 -26
- package/src/AllowLists/SimpleAllowList.ts +51 -7
- package/src/AllowLists/SimpleDenyList.ts +47 -109
- package/src/Auth/PassthroughAuth.ts +1 -1
- package/src/Boost.ts +136 -1
- package/src/BoostCore.test.ts +4 -11
- package/src/BoostCore.ts +114 -45
- package/src/BoostRegistry.ts +39 -21
- package/src/Budgets/ManagedBudget.ts +69 -16
- package/src/Budgets/SimpleBudget.ts +57 -14
- package/src/Budgets/VestingBudget.ts +79 -9
- package/src/Deployable/Contract.ts +1 -1
- package/src/Deployable/Deployable.ts +8 -2
- package/src/Deployable/DeployableTarget.ts +19 -6
- package/src/Incentives/AllowListIncentive.test.ts +2 -5
- package/src/Incentives/AllowListIncentive.ts +59 -15
- package/src/Incentives/CGDAIncentive.test.ts +3 -7
- package/src/Incentives/CGDAIncentive.ts +123 -19
- package/src/Incentives/ERC1155Incentive.test.ts +2 -13
- package/src/Incentives/ERC1155Incentive.ts +104 -22
- package/src/Incentives/ERC20Incentive.test.ts +6 -17
- package/src/Incentives/ERC20Incentive.ts +86 -21
- package/src/Incentives/ERC20VariableIncentive.test.ts +4 -24
- package/src/Incentives/ERC20VariableIncentive.ts +71 -19
- package/src/Incentives/Incentive.test.ts +1 -1
- package/src/Incentives/PointsIncentive.test.ts +3 -6
- package/src/Incentives/PointsIncentive.ts +79 -17
- package/src/Validators/SignerValidator.test.ts +3 -7
- package/src/Validators/SignerValidator.ts +422 -13
- package/src/claiming.ts +56 -0
- package/src/errors.ts +19 -1
- package/src/index.ts +10 -7
- package/src/transfers.ts +284 -0
- package/src/utils.ts +3 -2052
- package/dist/generated-Cd-Fe7W7.cjs.map +0 -1
- package/dist/generated-DGpIVcv5.js.map +0 -1
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type Address,
|
|
11
11
|
type ContractEventName,
|
|
12
12
|
type Hex,
|
|
13
|
+
encodeAbiParameters,
|
|
13
14
|
zeroAddress,
|
|
14
15
|
zeroHash,
|
|
15
16
|
} from 'viem';
|
|
@@ -23,13 +24,32 @@ import {
|
|
|
23
24
|
type GenericLog,
|
|
24
25
|
type ReadParams,
|
|
25
26
|
RegistryType,
|
|
26
|
-
type SimpleDenyListPayload,
|
|
27
27
|
type WriteParams,
|
|
28
|
-
prepareSimpleDenyListPayload,
|
|
29
28
|
} from '../utils';
|
|
30
29
|
|
|
31
30
|
export { simpleDenyListAbi };
|
|
32
|
-
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Object representation of a {@link SimpleDenyList} initialization payload.
|
|
34
|
+
*
|
|
35
|
+
* @export
|
|
36
|
+
* @interface SimpleDenyListPayload
|
|
37
|
+
* @typedef {SimpleDenyListPayload}
|
|
38
|
+
*/
|
|
39
|
+
export interface SimpleDenyListPayload {
|
|
40
|
+
/**
|
|
41
|
+
* The allow list's owner
|
|
42
|
+
*
|
|
43
|
+
* @type {Address}
|
|
44
|
+
*/
|
|
45
|
+
owner: Address;
|
|
46
|
+
/**
|
|
47
|
+
* List of denied addresses.
|
|
48
|
+
*
|
|
49
|
+
* @type {Address[]}
|
|
50
|
+
*/
|
|
51
|
+
denied: Address[];
|
|
52
|
+
}
|
|
33
53
|
|
|
34
54
|
/**
|
|
35
55
|
* A generic `viem.Log` event with support for `SimpleDenyList` event types.
|
|
@@ -114,7 +134,9 @@ export class SimpleDenyList extends DeployableTarget<
|
|
|
114
134
|
allowed: boolean[],
|
|
115
135
|
params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,
|
|
116
136
|
) {
|
|
117
|
-
return this.awaitResult(
|
|
137
|
+
return await this.awaitResult(
|
|
138
|
+
this.setDeniedRaw(addresses, allowed, params),
|
|
139
|
+
);
|
|
118
140
|
}
|
|
119
141
|
|
|
120
142
|
/**
|
|
@@ -146,111 +168,6 @@ export class SimpleDenyList extends DeployableTarget<
|
|
|
146
168
|
return { hash, result };
|
|
147
169
|
}
|
|
148
170
|
|
|
149
|
-
// /**
|
|
150
|
-
// * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].
|
|
151
|
-
// * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.
|
|
152
|
-
// * @example
|
|
153
|
-
// * ```ts
|
|
154
|
-
// * const logs = contract.getLogs({ eventName: 'EventName' })
|
|
155
|
-
// * const logs = contract.getLogs({ eventNames: ['EventName'] })
|
|
156
|
-
// * ```
|
|
157
|
-
// * @public
|
|
158
|
-
// * @async
|
|
159
|
-
// * @template {ContractEventName<typeof simpleDenyListAbi>} event
|
|
160
|
-
// * @template {ExtractAbiEvent<
|
|
161
|
-
// * typeof simpleDenyListAbi,
|
|
162
|
-
// * event
|
|
163
|
-
// * >} [abiEvent=ExtractAbiEvent<typeof simpleDenyListAbi, event>]
|
|
164
|
-
// * @param {?Omit<
|
|
165
|
-
// * GetLogsParams<typeof simpleDenyListAbi, event, abiEvent, abiEvent[]>,
|
|
166
|
-
// * 'event' | 'events'
|
|
167
|
-
// * > & {
|
|
168
|
-
// * eventName?: event;
|
|
169
|
-
// * eventNames?: event[];
|
|
170
|
-
// * }} [params]
|
|
171
|
-
// * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}
|
|
172
|
-
// */
|
|
173
|
-
// public async getLogs<
|
|
174
|
-
// event extends ContractEventName<typeof simpleDenyListAbi>,
|
|
175
|
-
// const abiEvent extends ExtractAbiEvent<
|
|
176
|
-
// typeof simpleDenyListAbi,
|
|
177
|
-
// event
|
|
178
|
-
// > = ExtractAbiEvent<typeof simpleDenyListAbi, event>,
|
|
179
|
-
// >(
|
|
180
|
-
// params?: Omit<
|
|
181
|
-
// GetLogsParams<typeof simpleDenyListAbi, event, abiEvent, abiEvent[]>,
|
|
182
|
-
// 'event' | 'events'
|
|
183
|
-
// > & {
|
|
184
|
-
// eventName?: event;
|
|
185
|
-
// eventNames?: event[];
|
|
186
|
-
// },
|
|
187
|
-
// ): Promise<GetLogsReturnType<abiEvent, abiEvent[]>> {
|
|
188
|
-
// return getLogs(this._config.getClient({ chainId: params?.chainId }), {
|
|
189
|
-
// // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wag
|
|
190
|
-
// ...(params as any),
|
|
191
|
-
// ...(params?.eventName
|
|
192
|
-
// ? {
|
|
193
|
-
// event: getAbiItem({
|
|
194
|
-
// abi: simpleDenyListAbi,
|
|
195
|
-
// name: params.eventName,
|
|
196
|
-
// // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue
|
|
197
|
-
// } as any),
|
|
198
|
-
// }
|
|
199
|
-
// : {}),
|
|
200
|
-
// ...(params?.eventNames
|
|
201
|
-
// ? {
|
|
202
|
-
// events: params.eventNames.map((name) =>
|
|
203
|
-
// getAbiItem({
|
|
204
|
-
// abi: simpleDenyListAbi,
|
|
205
|
-
// name,
|
|
206
|
-
// // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue
|
|
207
|
-
// } as any),
|
|
208
|
-
// ),
|
|
209
|
-
// }
|
|
210
|
-
// : {}),
|
|
211
|
-
// address: this.assertValidAddress(),
|
|
212
|
-
// });
|
|
213
|
-
// }
|
|
214
|
-
|
|
215
|
-
// /**
|
|
216
|
-
// * A typed wrapper for `wagmi.watchContractEvent`
|
|
217
|
-
// *
|
|
218
|
-
// * @public
|
|
219
|
-
// * @async
|
|
220
|
-
// * @template {ContractEventName<typeof simpleDenyListAbi>} event
|
|
221
|
-
// * @param {(log: SimpleDenyListLog<event>) => unknown} cb
|
|
222
|
-
// * @param {?WatchParams<typeof simpleDenyListAbi, event> & {
|
|
223
|
-
// * eventName?: event;
|
|
224
|
-
// * }} [params]
|
|
225
|
-
// * @returns {unknown, params?: any) => unknown} Unsubscribe function
|
|
226
|
-
// */
|
|
227
|
-
// public async subscribe<
|
|
228
|
-
// event extends ContractEventName<typeof simpleDenyListAbi>,
|
|
229
|
-
// >(
|
|
230
|
-
// cb: (log: SimpleDenyListLog<event>) => unknown,
|
|
231
|
-
// params?: WatchParams<typeof simpleDenyListAbi, event> & {
|
|
232
|
-
// eventName?: event;
|
|
233
|
-
// },
|
|
234
|
-
// ) {
|
|
235
|
-
// return watchContractEvent<
|
|
236
|
-
// typeof this._config,
|
|
237
|
-
// (typeof this._config)['chains'][number]['id'],
|
|
238
|
-
// typeof simpleDenyListAbi,
|
|
239
|
-
// event
|
|
240
|
-
// >(this._config, {
|
|
241
|
-
// // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
242
|
-
// ...(params as any),
|
|
243
|
-
// eventName: params?.eventName,
|
|
244
|
-
// abi: simpleDenyListAbi,
|
|
245
|
-
// address: this.assertValidAddress(),
|
|
246
|
-
// onLogs: (logs) => {
|
|
247
|
-
// for (let l of logs) {
|
|
248
|
-
// cb(l as unknown as SimpleDenyListLog<event>);
|
|
249
|
-
// }
|
|
250
|
-
// },
|
|
251
|
-
// });
|
|
252
|
-
// }
|
|
253
|
-
|
|
254
171
|
/**
|
|
255
172
|
* @inheritdoc
|
|
256
173
|
*
|
|
@@ -287,3 +204,24 @@ export class SimpleDenyList extends DeployableTarget<
|
|
|
287
204
|
};
|
|
288
205
|
}
|
|
289
206
|
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Given a {@link SimpleDenyListPayload}, properly encode the initialization payload.
|
|
210
|
+
*
|
|
211
|
+
* @param {SimpleDenyListPayload} param0
|
|
212
|
+
* @param {Address} param0.owner - The allow list's owner
|
|
213
|
+
* @param {Address[]} param0.denied - List of denied addresses.
|
|
214
|
+
* @returns {Hex}
|
|
215
|
+
*/
|
|
216
|
+
export function prepareSimpleDenyListPayload({
|
|
217
|
+
owner,
|
|
218
|
+
denied,
|
|
219
|
+
}: SimpleDenyListPayload) {
|
|
220
|
+
return encodeAbiParameters(
|
|
221
|
+
[
|
|
222
|
+
{ type: 'address', name: 'owner' },
|
|
223
|
+
{ type: 'address[]', name: 'denied' },
|
|
224
|
+
],
|
|
225
|
+
[owner, denied],
|
|
226
|
+
);
|
|
227
|
+
}
|
|
@@ -48,7 +48,7 @@ export class PassthroughAuth extends Deployable<
|
|
|
48
48
|
address: Address,
|
|
49
49
|
params?: ReadParams<typeof passthroughAuthAbi, 'isAuthorized'>,
|
|
50
50
|
) {
|
|
51
|
-
return readPassthroughAuthIsAuthorized(this._config, {
|
|
51
|
+
return await readPassthroughAuthIsAuthorized(this._config, {
|
|
52
52
|
address: this.assertValidAddress(),
|
|
53
53
|
args: [address],
|
|
54
54
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
package/src/Boost.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LibZip } from 'solady';
|
|
2
|
+
import {
|
|
3
|
+
type Address,
|
|
4
|
+
type Hex,
|
|
5
|
+
encodeAbiParameters,
|
|
6
|
+
parseAbiParameters,
|
|
7
|
+
zeroAddress,
|
|
8
|
+
} from 'viem';
|
|
2
9
|
import type { Action } from './Actions/Action';
|
|
3
10
|
import type { AllowList } from './AllowLists/AllowList';
|
|
4
11
|
import type { Budget } from './Budgets/Budget';
|
|
@@ -153,3 +160,131 @@ export class Boost {
|
|
|
153
160
|
this.owner = config.owner || zeroAddress;
|
|
154
161
|
}
|
|
155
162
|
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Object representation of `BoostLib.Target` struct. Used for low level Boost creation operations.
|
|
166
|
+
* This is used to pass the base contract and its initialization parameters in an efficient manner
|
|
167
|
+
*
|
|
168
|
+
* @export
|
|
169
|
+
* @typedef {Target}
|
|
170
|
+
*/
|
|
171
|
+
export type Target = {
|
|
172
|
+
isBase: boolean;
|
|
173
|
+
instance: Address;
|
|
174
|
+
parameters: Hex;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Object representation of `BoostCore.InitPayload` struct.
|
|
179
|
+
*
|
|
180
|
+
* @export
|
|
181
|
+
* @interface BoostPayload
|
|
182
|
+
* @typedef {BoostPayload}
|
|
183
|
+
*/
|
|
184
|
+
export interface BoostPayload {
|
|
185
|
+
/**
|
|
186
|
+
* Address to valid budget.
|
|
187
|
+
*
|
|
188
|
+
* @type {Address}
|
|
189
|
+
*/
|
|
190
|
+
budget: Address;
|
|
191
|
+
/**
|
|
192
|
+
* Target for existing action, or base with initialization payload.
|
|
193
|
+
*
|
|
194
|
+
* @type {Target}
|
|
195
|
+
*/
|
|
196
|
+
action: Target;
|
|
197
|
+
/**
|
|
198
|
+
* Target for existing validator, or base with initialization payload.
|
|
199
|
+
*
|
|
200
|
+
* @type {Target}
|
|
201
|
+
*/
|
|
202
|
+
validator: Target;
|
|
203
|
+
/**
|
|
204
|
+
* Target for existing allowList, or base with initialization payload.
|
|
205
|
+
*
|
|
206
|
+
* @type {Target}
|
|
207
|
+
*/
|
|
208
|
+
allowList: Target;
|
|
209
|
+
/**
|
|
210
|
+
* Targets for new incentives, with initialization payloads.
|
|
211
|
+
*
|
|
212
|
+
* @type {Target[]}
|
|
213
|
+
*/
|
|
214
|
+
incentives: Target[];
|
|
215
|
+
/**
|
|
216
|
+
* The base protocol fee (in bps)
|
|
217
|
+
*
|
|
218
|
+
* @type {?bigint}
|
|
219
|
+
*/
|
|
220
|
+
protocolFee?: bigint;
|
|
221
|
+
/**
|
|
222
|
+
* The base referral fee (in bps)
|
|
223
|
+
*
|
|
224
|
+
* @type {?bigint}
|
|
225
|
+
*/
|
|
226
|
+
referralFee?: bigint;
|
|
227
|
+
/**
|
|
228
|
+
* Optional maximum amount of participants in the Boost.
|
|
229
|
+
*
|
|
230
|
+
* @type {?bigint}
|
|
231
|
+
*/
|
|
232
|
+
maxParticipants?: bigint;
|
|
233
|
+
/**
|
|
234
|
+
* The owner of the Boost.
|
|
235
|
+
*
|
|
236
|
+
* @type {Address}
|
|
237
|
+
*/
|
|
238
|
+
owner: Address;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Given a valid {@link BoostPayload}, properly encode and compress the payload for use with `createBoost`
|
|
243
|
+
*
|
|
244
|
+
* @export
|
|
245
|
+
* @param {BoostPayload} param0
|
|
246
|
+
* @param {Address} param0.budget - Address to valid budget.
|
|
247
|
+
* @param {Target} param0.action - Target for existing action, or base with initialization payload.
|
|
248
|
+
* @param {Target} param0.validator - Target for existing validator, or base with initialization payload.
|
|
249
|
+
* @param {Target} param0.allowList - Target for existing allowList, or base with initialization payload.
|
|
250
|
+
* @param {Target[]} param0.incentives - Targets for new incentives, with initialization payloads.
|
|
251
|
+
* @param {bigint} [param0.protocolFee=0n] - The base protocol fee (in bps)
|
|
252
|
+
* @param {bigint} [param0.referralFee=0n] - The base referral fee (in bps)
|
|
253
|
+
* @param {bigint} [param0.maxParticipants=0n] - Optional maximum amount of participants in the Boost.
|
|
254
|
+
* @param {Address} param0.owner - The owner of the Boost.
|
|
255
|
+
* @returns {Hex}
|
|
256
|
+
*/
|
|
257
|
+
export function prepareBoostPayload({
|
|
258
|
+
budget,
|
|
259
|
+
action,
|
|
260
|
+
validator,
|
|
261
|
+
allowList,
|
|
262
|
+
incentives,
|
|
263
|
+
protocolFee = 0n,
|
|
264
|
+
referralFee = 0n,
|
|
265
|
+
maxParticipants = 0n,
|
|
266
|
+
owner,
|
|
267
|
+
}: BoostPayload): Hex {
|
|
268
|
+
return LibZip.cdCompress(
|
|
269
|
+
encodeAbiParameters(
|
|
270
|
+
parseAbiParameters([
|
|
271
|
+
'BoostPayload payload',
|
|
272
|
+
'struct BoostPayload { address budget; Target action; Target validator; Target allowList; Target[] incentives; uint64 protocolFee; uint64 referralFee; uint256 maxParticipants; address owner; }',
|
|
273
|
+
'struct Target { bool isBase; address instance; bytes parameters; }',
|
|
274
|
+
]),
|
|
275
|
+
[
|
|
276
|
+
{
|
|
277
|
+
budget,
|
|
278
|
+
action,
|
|
279
|
+
validator,
|
|
280
|
+
allowList,
|
|
281
|
+
incentives,
|
|
282
|
+
protocolFee,
|
|
283
|
+
referralFee,
|
|
284
|
+
maxParticipants,
|
|
285
|
+
owner,
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
),
|
|
289
|
+
) as Hex;
|
|
290
|
+
}
|
package/src/BoostCore.test.ts
CHANGED
|
@@ -10,19 +10,12 @@ import {
|
|
|
10
10
|
makeMockEventActionPayload,
|
|
11
11
|
} from '../test/helpers';
|
|
12
12
|
import { ContractAction } from './Actions/ContractAction';
|
|
13
|
-
import { PassthroughAuth } from './Auth/PassthroughAuth';
|
|
14
13
|
import { BoostCore } from './BoostCore';
|
|
15
14
|
import type { ERC20Incentive } from './Incentives/ERC20Incentive';
|
|
15
|
+
import { ERC1155StrategyType } from './Incentives/ERC1155Incentive';
|
|
16
|
+
import { StrategyType } from './claiming';
|
|
16
17
|
import { IncentiveNotCloneableError } from './errors';
|
|
17
|
-
import {
|
|
18
|
-
ActionStep,
|
|
19
|
-
ERC1155StrategyType,
|
|
20
|
-
FilterType,
|
|
21
|
-
PrimitiveType,
|
|
22
|
-
SignatureType,
|
|
23
|
-
StrategyType,
|
|
24
|
-
bytes4,
|
|
25
|
-
} from './utils';
|
|
18
|
+
import { bytes4 } from './utils';
|
|
26
19
|
|
|
27
20
|
let fixtures: Fixtures, budgets: BudgetFixtures;
|
|
28
21
|
|
|
@@ -683,7 +676,7 @@ describe('BoostCore', () => {
|
|
|
683
676
|
expect(await client.claimFee()).toBe(100n);
|
|
684
677
|
});
|
|
685
678
|
|
|
686
|
-
test('binds all actions, budgets, allowlists, incentives, and validators to reuse core options and account',
|
|
679
|
+
test('binds all actions, budgets, allowlists, incentives, and validators to reuse core options and account', () => {
|
|
687
680
|
const { core } = fixtures;
|
|
688
681
|
|
|
689
682
|
// const contractAction = core.ContractAction(zeroAddress);
|