@boostxyz/sdk 2.2.0 → 2.2.2

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.
Files changed (129) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +2 -2
  3. package/dist/Actions/ERC721MintAction.d.ts +1 -1
  4. package/dist/Actions/EventAction.cjs +1 -1
  5. package/dist/Actions/EventAction.cjs.map +1 -1
  6. package/dist/Actions/EventAction.d.ts +219 -0
  7. package/dist/Actions/EventAction.d.ts.map +1 -1
  8. package/dist/Actions/EventAction.js +38 -38
  9. package/dist/Actions/EventAction.js.map +1 -1
  10. package/dist/AllowLists/AllowList.cjs +1 -1
  11. package/dist/AllowLists/AllowList.js +12 -12
  12. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  13. package/dist/AllowLists/SimpleAllowList.js +8 -8
  14. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  15. package/dist/AllowLists/SimpleDenyList.js +3 -3
  16. package/dist/Auth/PassthroughAuth.cjs +1 -1
  17. package/dist/Auth/PassthroughAuth.js +1 -1
  18. package/dist/BoostCore.cjs +2 -2
  19. package/dist/BoostCore.cjs.map +1 -1
  20. package/dist/BoostCore.d.ts +53 -0
  21. package/dist/BoostCore.d.ts.map +1 -1
  22. package/dist/BoostCore.js +100 -83
  23. package/dist/BoostCore.js.map +1 -1
  24. package/dist/BoostRegistry.cjs +1 -1
  25. package/dist/BoostRegistry.js +33 -33
  26. package/dist/{Budget-BA_1sa1e.cjs → Budget-BSqx3xcT.cjs} +2 -2
  27. package/dist/{Budget-BA_1sa1e.cjs.map → Budget-BSqx3xcT.cjs.map} +1 -1
  28. package/dist/{Budget-B0q1S08L.js → Budget-C3eMp8lh.js} +30 -30
  29. package/dist/{Budget-B0q1S08L.js.map → Budget-C3eMp8lh.js.map} +1 -1
  30. package/dist/Budgets/Budget.cjs +1 -1
  31. package/dist/Budgets/Budget.js +3 -3
  32. package/dist/Budgets/ManagedBudget.cjs +1 -1
  33. package/dist/Budgets/ManagedBudget.js +31 -31
  34. package/dist/Deployable/DeployableTarget.cjs +1 -1
  35. package/dist/Deployable/DeployableTarget.js +1 -1
  36. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  37. package/dist/Deployable/DeployableTargetWithRBAC.js +18 -18
  38. package/dist/Incentive-BWC9nRgY.cjs +2 -0
  39. package/dist/Incentive-BWC9nRgY.cjs.map +1 -0
  40. package/dist/Incentive-o0qXIACU.js +397 -0
  41. package/dist/Incentive-o0qXIACU.js.map +1 -0
  42. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  43. package/dist/Incentives/AllowListIncentive.js +3 -3
  44. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  45. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  46. package/dist/Incentives/CGDAIncentive.d.ts +30 -0
  47. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  48. package/dist/Incentives/CGDAIncentive.js +22 -22
  49. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  50. package/dist/Incentives/ERC1155Incentive.d.ts +25 -0
  51. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  52. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  53. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  54. package/dist/Incentives/ERC20Incentive.d.ts +30 -0
  55. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  56. package/dist/Incentives/ERC20Incentive.js +20 -20
  57. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  58. package/dist/Incentives/ERC20PeggedIncentive.d.ts +906 -0
  59. package/dist/Incentives/ERC20PeggedIncentive.d.ts.map +1 -0
  60. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
  61. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
  62. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +67 -0
  63. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -1
  64. package/dist/Incentives/ERC20VariableCriteriaIncentive.js +15 -15
  65. package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
  66. package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
  67. package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
  68. package/dist/Incentives/ERC20VariableIncentive.d.ts +20 -0
  69. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  70. package/dist/Incentives/ERC20VariableIncentive.js +13 -13
  71. package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
  72. package/dist/Incentives/Incentive.cjs +1 -1
  73. package/dist/Incentives/Incentive.cjs.map +1 -1
  74. package/dist/Incentives/Incentive.d.ts +24 -3
  75. package/dist/Incentives/Incentive.d.ts.map +1 -1
  76. package/dist/Incentives/Incentive.js +18 -39
  77. package/dist/Incentives/Incentive.js.map +1 -1
  78. package/dist/Incentives/PointsIncentive.cjs +1 -1
  79. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  80. package/dist/Incentives/PointsIncentive.d.ts +25 -0
  81. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  82. package/dist/Incentives/PointsIncentive.js +16 -16
  83. package/dist/Incentives/PointsIncentive.js.map +1 -1
  84. package/dist/{SimpleDenyList-DrQrJ14i.cjs → SimpleDenyList-Dzs_F7dt.cjs} +2 -2
  85. package/dist/{SimpleDenyList-DrQrJ14i.cjs.map → SimpleDenyList-Dzs_F7dt.cjs.map} +1 -1
  86. package/dist/{SimpleDenyList-DuCoaOlG.js → SimpleDenyList-bCzbBEvY.js} +9 -9
  87. package/dist/{SimpleDenyList-DuCoaOlG.js.map → SimpleDenyList-bCzbBEvY.js.map} +1 -1
  88. package/dist/Validators/LimitedSignerValidator.cjs +1 -1
  89. package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
  90. package/dist/Validators/LimitedSignerValidator.d.ts +11 -1
  91. package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
  92. package/dist/Validators/LimitedSignerValidator.js +20 -20
  93. package/dist/Validators/LimitedSignerValidator.js.map +1 -1
  94. package/dist/Validators/SignerValidator.cjs +1 -1
  95. package/dist/Validators/SignerValidator.cjs.map +1 -1
  96. package/dist/Validators/SignerValidator.d.ts +11 -1
  97. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  98. package/dist/Validators/SignerValidator.js +3 -3
  99. package/dist/Validators/SignerValidator.js.map +1 -1
  100. package/dist/Validators/Validator.cjs +1 -1
  101. package/dist/Validators/Validator.js +8 -8
  102. package/dist/{componentInterfaces-dakxtQHf.js → componentInterfaces-C4uAYjSo.js} +12 -12
  103. package/dist/componentInterfaces-C4uAYjSo.js.map +1 -0
  104. package/dist/deployments-B1Mh8zRA.cjs +2 -0
  105. package/dist/deployments-B1Mh8zRA.cjs.map +1 -0
  106. package/dist/deployments-DNjIZXvl.js +90 -0
  107. package/dist/deployments-DNjIZXvl.js.map +1 -0
  108. package/dist/deployments.json +33 -43
  109. package/dist/{generated-1ZT_mHJx.js → generated-D2xuTYvu.js} +1647 -748
  110. package/dist/generated-D2xuTYvu.js.map +1 -0
  111. package/dist/generated-DAZo6jo9.cjs +3 -0
  112. package/dist/generated-DAZo6jo9.cjs.map +1 -0
  113. package/dist/index.cjs +1 -1
  114. package/dist/index.d.ts +1 -0
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +115 -112
  117. package/package.json +1 -1
  118. package/src/BoostCore.ts +22 -0
  119. package/src/Incentives/ERC20PeggedIncentive.ts +511 -0
  120. package/src/Incentives/Incentive.ts +6 -1
  121. package/src/index.ts +1 -0
  122. package/dist/componentInterfaces-dakxtQHf.js.map +0 -1
  123. package/dist/deployments-BucJ-gwk.cjs +0 -2
  124. package/dist/deployments-BucJ-gwk.cjs.map +0 -1
  125. package/dist/deployments-CQu0bLhU.js +0 -102
  126. package/dist/deployments-CQu0bLhU.js.map +0 -1
  127. package/dist/generated-1ZT_mHJx.js.map +0 -1
  128. package/dist/generated-CgBgbMNe.cjs +0 -3
  129. package/dist/generated-CgBgbMNe.cjs.map +0 -1
@@ -0,0 +1,511 @@
1
+ import {
2
+ erc20PeggedIncentiveAbi,
3
+ readErc20PeggedIncentiveAsset,
4
+ readErc20PeggedIncentiveClaimed,
5
+ readErc20PeggedIncentiveClaims,
6
+ readErc20PeggedIncentiveCurrentReward,
7
+ readErc20PeggedIncentiveGetPeg,
8
+ readErc20PeggedIncentiveIsClaimable,
9
+ readErc20PeggedIncentiveLimit,
10
+ readErc20PeggedIncentiveOwner,
11
+ readErc20PeggedIncentivePeg,
12
+ readErc20PeggedIncentiveReward,
13
+ readErc20PeggedIncentiveTotalClaimed,
14
+ simulateErc20PeggedIncentiveClaim,
15
+ simulateErc20PeggedIncentiveClawback,
16
+ writeErc20PeggedIncentiveClaim,
17
+ writeErc20PeggedIncentiveClawback,
18
+ } from '@boostxyz/evm';
19
+ import { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20PeggedIncentive.sol/ERC20PeggedIncentive.json';
20
+ import {
21
+ type Address,
22
+ type ContractEventName,
23
+ type Hex,
24
+ encodeAbiParameters,
25
+ zeroAddress,
26
+ zeroHash,
27
+ } from 'viem';
28
+ import { ERC20Incentive as ERC20IncentiveBases } from '../../dist/deployments.json';
29
+ import type {
30
+ DeployableOptions,
31
+ GenericDeployableParams,
32
+ } from '../Deployable/Deployable';
33
+ import { DeployableTarget } from '../Deployable/DeployableTarget';
34
+ import { type ClaimPayload, prepareClaimPayload } from '../claiming';
35
+ import {
36
+ type GenericLog,
37
+ type ReadParams,
38
+ RegistryType,
39
+ type WriteParams,
40
+ } from '../utils';
41
+
42
+ export { erc20PeggedIncentiveAbi };
43
+
44
+ /**
45
+ * The object representation of a `ERC20PeggedIncentive.InitPayload`
46
+ *
47
+ * @export
48
+ * @interface ERC20PeggedIncentivePayload
49
+ * @typedef {ERC20PeggedIncentivePayload}
50
+ */
51
+ export interface ERC20PeggedIncentivePayload {
52
+ /**
53
+ * The address of the incentivized asset.
54
+ *
55
+ * @type {Address}
56
+ */
57
+ asset: Address;
58
+ /**
59
+ * The peg to normalize to.
60
+ *
61
+ * @type {Address}
62
+ */
63
+ peg: Address;
64
+ /**
65
+ * The amount of the asset to distribute.
66
+ *
67
+ * @type {bigint}
68
+ */
69
+ reward: bigint;
70
+ /**
71
+ * Total spend for the incentive.
72
+ *
73
+ * @type {bigint}
74
+ */
75
+ limit: bigint;
76
+ /**
77
+ * (Optional) The address of the entity that can managed the incentive.
78
+ *
79
+ * @type {Address}
80
+ * @optional
81
+ */
82
+ manager?: Address;
83
+ }
84
+
85
+ /**
86
+ * A generic `viem.Log` event with support for `ERC20PeggedIncentive` event types.
87
+ *
88
+ * @export
89
+ * @typedef {ERC20PeggedIncentiveLog}
90
+ * @template {ContractEventName<typeof erc20PeggedIncentiveAbi>} [event=ContractEventName<
91
+ * typeof erc20PeggedIncentiveAbi
92
+ * >]
93
+ */
94
+ export type ERC20PeggedIncentiveLog<
95
+ event extends ContractEventName<
96
+ typeof erc20PeggedIncentiveAbi
97
+ > = ContractEventName<typeof erc20PeggedIncentiveAbi>,
98
+ > = GenericLog<typeof erc20PeggedIncentiveAbi, event>;
99
+
100
+ /**
101
+ * A simple ERC20 incentive implementation that allows claiming of tokens
102
+ *
103
+ * @export
104
+ * @class ERC20PeggedIncentive
105
+ * @typedef {ERC20PeggedIncentive}
106
+ * @extends {DeployableTarget<ERC20PeggedIncentivePayload>}
107
+ */
108
+ export class ERC20PeggedIncentive extends DeployableTarget<
109
+ ERC20PeggedIncentivePayload,
110
+ typeof erc20PeggedIncentiveAbi
111
+ > {
112
+ public override readonly abi = erc20PeggedIncentiveAbi;
113
+ /**
114
+ * @inheritdoc
115
+ *
116
+ * @public
117
+ * @static
118
+ * @type {Record<number, Address>}
119
+ */
120
+ public static override bases: Record<number, Address> = {
121
+ 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,
122
+ ...(ERC20IncentiveBases as Record<number, Address>),
123
+ };
124
+ /**
125
+ * @inheritdoc
126
+ *
127
+ * @public
128
+ * @static
129
+ * @type {RegistryType}
130
+ */
131
+ public static override registryType: RegistryType = RegistryType.INCENTIVE;
132
+
133
+ /**
134
+ * The owner of the incentive
135
+ *
136
+ * @public
137
+ * @async
138
+ * @param {?ReadParams} [params]
139
+ * @returns {Promise<Address>}
140
+ */
141
+ public async owner(params?: ReadParams) {
142
+ return await readErc20PeggedIncentiveOwner(this._config, {
143
+ address: this.assertValidAddress(),
144
+ args: [],
145
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
146
+ ...(params as any),
147
+ });
148
+ }
149
+
150
+ /**
151
+ * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`
152
+ *
153
+ * @public
154
+ * @async
155
+ * @param {?ReadParams} [params]
156
+ * @returns {Promise<bigint>} - The current reward
157
+ */
158
+ public async currentReward(params?: ReadParams) {
159
+ return await readErc20PeggedIncentiveCurrentReward(this._config, {
160
+ address: this.assertValidAddress(),
161
+ args: [],
162
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
163
+ ...(params as any),
164
+ });
165
+ }
166
+
167
+ /**
168
+ * The number of claims that have been made
169
+ *
170
+ * @public
171
+ * @async
172
+ * @param {?ReadParams} [params]
173
+ * @returns {Promise<bigint>}
174
+ */
175
+ public async claims(params?: ReadParams) {
176
+ return await readErc20PeggedIncentiveClaims(this._config, {
177
+ address: this.assertValidAddress(),
178
+ args: [],
179
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
180
+ ...(params as any),
181
+ });
182
+ }
183
+
184
+ /**
185
+ * The total amount of rewards claimed
186
+ *
187
+ * @public
188
+ * @async
189
+ * @param {?ReadParams} [params]
190
+ * @returns {Promise<bigint>}
191
+ */
192
+ public async totalClaimed(params?: ReadParams) {
193
+ return await readErc20PeggedIncentiveTotalClaimed(this._config, {
194
+ address: this.assertValidAddress(),
195
+ args: [],
196
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
197
+ ...(params as any),
198
+ });
199
+ }
200
+
201
+ /**
202
+ * A mapping of address to claim status
203
+ *
204
+ * @public
205
+ * @async
206
+ * @param {Address} address
207
+ * @param {?ReadParams} [params]
208
+ * @returns {Promise<boolean>}
209
+ */
210
+ public async claimed(address: Address, params?: ReadParams) {
211
+ return await readErc20PeggedIncentiveClaimed(this._config, {
212
+ address: this.assertValidAddress(),
213
+ args: [address],
214
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
215
+ ...(params as any),
216
+ });
217
+ }
218
+
219
+ /**
220
+ * The address of the ERC20-like token
221
+ *
222
+ * @public
223
+ * @async
224
+ * @param {?ReadParams} [params]
225
+ * @returns {Promise<Address>}
226
+ */
227
+ public async asset(params?: ReadParams) {
228
+ return await readErc20PeggedIncentiveAsset(this._config, {
229
+ address: this.assertValidAddress(),
230
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
231
+ ...(params as any),
232
+ });
233
+ }
234
+
235
+ /**
236
+ * The address of the pegged ERC20-like token
237
+ *
238
+ * @public
239
+ * @async
240
+ * @param {?ReadParams} [params]
241
+ * @returns {Promise<Address>}
242
+ */
243
+ public async peg(params?: ReadParams) {
244
+ return await readErc20PeggedIncentivePeg(this._config, {
245
+ address: this.assertValidAddress(),
246
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
247
+ ...(params as any),
248
+ });
249
+ }
250
+
251
+ /**
252
+ * The reward amount issued for each claim
253
+ *
254
+ * @public
255
+ * @async
256
+ * @param {?ReadParams} [params]
257
+ * @returns {Promise<bigint>}
258
+ */
259
+ public async reward(params?: ReadParams) {
260
+ return await readErc20PeggedIncentiveReward(this._config, {
261
+ address: this.assertValidAddress(),
262
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
263
+ ...(params as any),
264
+ });
265
+ }
266
+
267
+ /**
268
+ * The limit (max possible rewards payout in reward token)
269
+ *
270
+ * @public
271
+ * @async
272
+ * @param {?ReadParams} [params]
273
+ * @returns {Promise<bigint>}
274
+ */
275
+ public async limit(params?: ReadParams) {
276
+ return await readErc20PeggedIncentiveLimit(this._config, {
277
+ address: this.assertValidAddress(),
278
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
279
+ ...(params as any),
280
+ });
281
+ }
282
+
283
+ /**
284
+ * Claim the incentive
285
+ *
286
+ * @public
287
+ * @async
288
+ * @param {ClaimPayload} payload
289
+ * @param {?WriteParams} [params]
290
+ * @returns {Promise<boolean>} - Returns true if successfully claimed
291
+ */
292
+ protected async claim(payload: ClaimPayload, params?: WriteParams) {
293
+ return await this.awaitResult(this.claimRaw(payload, params));
294
+ }
295
+
296
+ /**
297
+ * Claim the incentive
298
+ *
299
+ * @public
300
+ * @async
301
+ * @param {ClaimPayload} payload
302
+ * @param {?WriteParams} [params]
303
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed
304
+ */
305
+ protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {
306
+ const { request, result } = await simulateErc20PeggedIncentiveClaim(
307
+ this._config,
308
+ {
309
+ address: this.assertValidAddress(),
310
+ args: [prepareClaimPayload(payload)],
311
+ ...this.optionallyAttachAccount(),
312
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
313
+ ...(params as any),
314
+ },
315
+ );
316
+ const hash = await writeErc20PeggedIncentiveClaim(this._config, request);
317
+ return { hash, result };
318
+ }
319
+
320
+ /**
321
+ * Clawback assets from the incentive
322
+ *
323
+ * @public
324
+ * @async
325
+ * @param {ClaimPayload} payload
326
+ * @param {?WriteParams} [params]
327
+ * @returns {Promise<boolean>} - True if the assets were successfully clawbacked
328
+ */
329
+ public async clawback(payload: ClaimPayload, params?: WriteParams) {
330
+ return await this.awaitResult(this.clawbackRaw(payload, params));
331
+ }
332
+
333
+ /**
334
+ * Clawback assets from the incentive
335
+ *
336
+ * @public
337
+ * @async
338
+ * @param {ClaimPayload} payload
339
+ * @param {?WriteParams} [params]
340
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked
341
+ */
342
+ public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {
343
+ const { request, result } = await simulateErc20PeggedIncentiveClawback(
344
+ this._config,
345
+ {
346
+ address: this.assertValidAddress(),
347
+ args: [prepareClaimPayload(payload)],
348
+ ...this.optionallyAttachAccount(),
349
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
350
+ ...(params as any),
351
+ },
352
+ );
353
+ const hash = await writeErc20PeggedIncentiveClawback(this._config, request);
354
+ return { hash, result };
355
+ }
356
+
357
+ /**
358
+ * Check if an incentive is claimable.
359
+ *
360
+ * @public
361
+ * @async
362
+ * @param {ClaimPayload} payload
363
+ * @param {?ReadParams} [params]
364
+ * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload
365
+ */
366
+ public async isClaimable(payload: ClaimPayload, params?: ReadParams) {
367
+ return await readErc20PeggedIncentiveIsClaimable(this._config, {
368
+ address: this.assertValidAddress(),
369
+ args: [payload.target, payload.data],
370
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
371
+ ...(params as any),
372
+ });
373
+ }
374
+
375
+ /**
376
+ * read the peg token for the incentive.
377
+ *
378
+ * @public
379
+ * @async
380
+ * @param {?ReadParams} [params]
381
+ * @returns {Promise<Address>} = The address of the token the reward is pegged to
382
+ */
383
+ public async getPeg(params?: ReadParams) {
384
+ return await readErc20PeggedIncentiveGetPeg(this._config, {
385
+ address: this.assertValidAddress(),
386
+ args: [],
387
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
388
+ ...(params as any),
389
+ });
390
+ }
391
+
392
+ /**
393
+ * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`
394
+ *
395
+ * @public
396
+ * @async
397
+ * @param {?ReadParams} [params]
398
+ * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.
399
+ */
400
+ public async getTotalBudget(params?: ReadParams) {
401
+ return await this.limit(params);
402
+ }
403
+
404
+ /**
405
+ * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.
406
+ *
407
+ * @public
408
+ * @async
409
+ * @param {?ReadParams} [params]
410
+ * @returns {Promise<boolean>} - True if total claims is less than limit
411
+ */
412
+ public async canBeClaimed(params?: ReadParams) {
413
+ return (await this.getRemainingClaimPotential(params)) > 0n;
414
+ }
415
+
416
+ /**
417
+ * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.
418
+ *
419
+ * @public
420
+ * @async
421
+ * @param {?ReadParams} [params]
422
+ * @returns {Promise<bigint>} - True if total claims is less than limit
423
+ */
424
+ public async getRemainingClaimPotential(params?: ReadParams) {
425
+ const [claims, limit] = await Promise.all([
426
+ this.claims(params),
427
+ this.limit(params),
428
+ ]);
429
+ return limit - claims;
430
+ }
431
+
432
+ /**
433
+ * @inheritdoc
434
+ *
435
+ * @public
436
+ * @param {?ERC20PeggedIncentivePayload} [_payload]
437
+ * @param {?DeployableOptions} [_options]
438
+ * @returns {GenericDeployableParams}
439
+ */
440
+ public override buildParameters(
441
+ _payload?: ERC20PeggedIncentivePayload,
442
+ _options?: DeployableOptions,
443
+ ): GenericDeployableParams {
444
+ const [payload, options] = this.validateDeploymentConfig(
445
+ _payload,
446
+ _options,
447
+ );
448
+ return {
449
+ abi: erc20PeggedIncentiveAbi,
450
+ bytecode: bytecode as Hex,
451
+ args: [prepareERC20PeggedIncentivePayload(payload)],
452
+ ...this.optionallyAttachAccount(options.account),
453
+ };
454
+ }
455
+
456
+ /**
457
+ * Encodes an amount to clawback from the incentive
458
+ *
459
+ * @public
460
+ * @param {bigint} amount - How much of the asset to clawback
461
+ * @returns {Hex} - Returns an encoded uint256
462
+ */
463
+ public buildClawbackData(amount: bigint) {
464
+ return encodeAbiParameters([{ type: 'uint256' }], [amount]);
465
+ }
466
+
467
+ /**
468
+ * Builds the claim data for the ERC20PeggedIncentive.
469
+ *
470
+ * @public
471
+ * @param {bigint} rewardAmount
472
+ * @returns {Hash} Returns the encoded claim data
473
+ * @description This function returns the encoded claim data for the ERC20PeggedIncentive.
474
+ */
475
+ public buildClaimData(rewardAmount: bigint) {
476
+ return encodeAbiParameters(
477
+ [{ type: 'uint256', name: 'rewardAmount' }],
478
+ [rewardAmount],
479
+ );
480
+ }
481
+ }
482
+
483
+ /**
484
+ * Given a {@link ERC20PeggedIncentivePayload}, properly encode a `ERC20PeggedIncentive.InitPayload` for use with {@link ERC20PeggedIncentive} initialization.
485
+ *
486
+ * @param {ERC20PeggedIncentivePayload} param0
487
+ * @param {Address} param0.asset - The address of the incentivized asset.
488
+ * @param {Address} param0.peg - The peg to normalize to.
489
+ * @param {bigint} param0.reward - The amount of the asset to distribute.
490
+ * @param {bigint} param0.limit - How many times can this incentive be claimed.
491
+ * @param {Address} [param0.manager=zeroAddress] - The entity that can manage the incentive.
492
+ * @returns {Hex}
493
+ */
494
+ export function prepareERC20PeggedIncentivePayload({
495
+ asset,
496
+ peg,
497
+ reward,
498
+ limit,
499
+ manager = zeroAddress,
500
+ }: ERC20PeggedIncentivePayload) {
501
+ return encodeAbiParameters(
502
+ [
503
+ { type: 'address', name: 'asset' },
504
+ { type: 'address', name: 'peg' },
505
+ { type: 'uint256', name: 'reward' },
506
+ { type: 'uint256', name: 'limit' },
507
+ { type: 'address', name: 'manager' },
508
+ ],
509
+ [asset, peg, reward, limit, manager],
510
+ );
511
+ }
@@ -3,6 +3,7 @@ import {
3
3
  AAllowListIncentive,
4
4
  ACGDAIncentive,
5
5
  AERC20Incentive,
6
+ AERC20PeggedIncentive,
6
7
  AERC20VariableCriteriaIncentive,
7
8
  AERC20VariableIncentive,
8
9
  // AERC20VariableCriteriaIncentive
@@ -16,6 +17,7 @@ import type { ReadParams } from '../utils';
16
17
  import { AllowListIncentive } from './AllowListIncentive';
17
18
  import { CGDAIncentive } from './CGDAIncentive';
18
19
  import { ERC20Incentive } from './ERC20Incentive';
20
+ import { ERC20PeggedIncentive } from './ERC20PeggedIncentive';
19
21
  import { ERC20VariableCriteriaIncentive } from './ERC20VariableCriteriaIncentive';
20
22
  import { ERC20VariableIncentive } from './ERC20VariableIncentive';
21
23
  // import { ERC1155Incentive } from './ERC1155Incentive';
@@ -26,6 +28,7 @@ export {
26
28
  CGDAIncentive,
27
29
  // ERC1155Incentive,
28
30
  ERC20Incentive,
31
+ ERC20PeggedIncentive,
29
32
  PointsIncentive,
30
33
  ERC20VariableIncentive,
31
34
  ERC20VariableCriteriaIncentive,
@@ -42,6 +45,7 @@ export type Incentive =
42
45
  | CGDAIncentive
43
46
  | ERC20Incentive
44
47
  // | ERC1155Incentive
48
+ | ERC20PeggedIncentive
45
49
  | PointsIncentive
46
50
  | ERC20VariableIncentive
47
51
  | ERC20VariableCriteriaIncentive;
@@ -49,11 +53,12 @@ export type Incentive =
49
53
  /**
50
54
  * A map of Incentive component interfaces to their constructors.
51
55
  *
52
- * @type {{ "0xc5b24b8e": typeof PointsIncentive; "0x8c901437": typeof ERC20Incentive; "0x4414fbb4": typeof AllowListIncentive; "0xa39e44d9": typeof CGDAIncentive; "0xa8e4af1e": typeof ERC20VariableIncentive; "0x90318111": typeof ERC20VariableCriteriaIncentive }}
56
+ * @type {{ "0xc5b24b8e": typeof PointsIncentive; "0x8c901437": typeof ERC20Incentive; "0x4414fbb4": typeof ERC20PeggedIncentive; "0x56586338" typeof AllowListIncentive; "0xa39e44d9": typeof CGDAIncentive; "0xa8e4af1e": typeof ERC20VariableIncentive; "0x90318111": typeof ERC20VariableCriteriaIncentive }}
53
57
  */
54
58
  export const IncentiveByComponentInterface = {
55
59
  [APointsIncentive as Hex]: PointsIncentive,
56
60
  [AERC20Incentive as Hex]: ERC20Incentive,
61
+ [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,
57
62
  [AAllowListIncentive]: AllowListIncentive,
58
63
  // [AERC1155Incentive as Hex]: ERC1155Incentive,
59
64
  [ACGDAIncentive as Hex]: CGDAIncentive,
package/src/index.ts CHANGED
@@ -35,6 +35,7 @@ export * from './Deployable/DeployableTargetWithRBAC';
35
35
  export * from './Incentives/AllowListIncentive';
36
36
  export * from './Incentives/CGDAIncentive';
37
37
  export * from './Incentives/ERC20Incentive';
38
+ export * from './Incentives/ERC20PeggedIncentive';
38
39
  export * from './Incentives/ERC20VariableIncentive';
39
40
  export * from './Incentives/ERC20VariableCriteriaIncentive';
40
41
  // export * from './Incentives/ERC1155Incentive';
@@ -1 +0,0 @@
1
- {"version":3,"file":"componentInterfaces-dakxtQHf.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,2 +0,0 @@
1
- "use strict";const d={10:"0xE79Cc2063A470087604F7690F3Ff5e0759addA06",8453:"0xE79Cc2063A470087604F7690F3Ff5e0759addA06",42161:"0xE79Cc2063A470087604F7690F3Ff5e0759addA06",84532:"0xE79Cc2063A470087604F7690F3Ff5e0759addA06",11155111:"0xE79Cc2063A470087604F7690F3Ff5e0759addA06"},e={10:"0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC",8453:"0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC",42161:"0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC",84532:"0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC",11155111:"0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC"},C={10:"0xCF9A795Fed701aa214598998a2D4566413D906Ce",8453:"0xCF9A795Fed701aa214598998a2D4566413D906Ce",42161:"0xCF9A795Fed701aa214598998a2D4566413D906Ce",84532:"0xCF9A795Fed701aa214598998a2D4566413D906Ce",11155111:"0xCF9A795Fed701aa214598998a2D4566413D906Ce"},f={10:"0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd",8453:"0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd",42161:"0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd",84532:"0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd",11155111:"0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd"},b={10:"0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33",8453:"0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33",42161:"0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33",84532:"0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33",11155111:"0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33"},E={10:"0xB58d3bA94d16305bf35F8D2055faB44b01063F9B",8453:"0xB58d3bA94d16305bf35F8D2055faB44b01063F9B",42161:"0xB58d3bA94d16305bf35F8D2055faB44b01063F9B",84532:"0xB58d3bA94d16305bf35F8D2055faB44b01063F9B",11155111:"0xB58d3bA94d16305bf35F8D2055faB44b01063F9B"},a={10:"0x3647EF9212033976204D9d3df3Ed46832888F7fB",8453:"0x3647EF9212033976204D9d3df3Ed46832888F7fB",42161:"0x3647EF9212033976204D9d3df3Ed46832888F7fB",84532:"0x3647EF9212033976204D9d3df3Ed46832888F7fB",11155111:"0x3647EF9212033976204D9d3df3Ed46832888F7fB"},F={10:"0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09",8453:"0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09",42161:"0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09",84532:"0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09",11155111:"0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09"},A={10:"0xA1aDC1b479e5188C4c3780B161426fc25A11d45E",8453:"0xA1aDC1b479e5188C4c3780B161426fc25A11d45E",42161:"0xA1aDC1b479e5188C4c3780B161426fc25A11d45E",84532:"0xA1aDC1b479e5188C4c3780B161426fc25A11d45E",11155111:"0xA1aDC1b479e5188C4c3780B161426fc25A11d45E"},B={10:"0xaEAB5967508DE105fa66bED2575cdF3b17631682",8453:"0xaEAB5967508DE105fa66bED2575cdF3b17631682",42161:"0xaEAB5967508DE105fa66bED2575cdF3b17631682",84532:"0xaEAB5967508DE105fa66bED2575cdF3b17631682",11155111:"0xaEAB5967508DE105fa66bED2575cdF3b17631682"},D={10:"0x290D20454bC26b68924c193e981fCa38f2588975",8453:"0x290D20454bC26b68924c193e981fCa38f2588975",42161:"0x290D20454bC26b68924c193e981fCa38f2588975",84532:"0x290D20454bC26b68924c193e981fCa38f2588975",11155111:"0x290D20454bC26b68924c193e981fCa38f2588975"},x={10:"0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC",8453:"0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC",42161:"0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC",84532:"0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC",11155111:"0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC"},c={10:"0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8",8453:"0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8",42161:"0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8",84532:"0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8",11155111:"0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8"},t={10:"0x2399DAB7d25bE315C2074BEcd50f243f4982D655",8453:"0x2399DAB7d25bE315C2074BEcd50f243f4982D655",42161:"0x2399DAB7d25bE315C2074BEcd50f243f4982D655",84532:"0x2399DAB7d25bE315C2074BEcd50f243f4982D655",11155111:"0x2399DAB7d25bE315C2074BEcd50f243f4982D655"};exports.AllowListIncentive=d;exports.BoostCore=e;exports.BoostRegistry=C;exports.CGDAIncentive=f;exports.ERC20Incentive=b;exports.ERC20VariableCriteriaIncentive=E;exports.ERC20VariableIncentive=a;exports.EventAction=F;exports.ManagedBudget=A;exports.ManagedBudgetWithFees=B;exports.PointsIncentive=D;exports.SignerValidator=x;exports.SimpleAllowList=c;exports.SimpleDenyList=t;
2
- //# sourceMappingURL=deployments-BucJ-gwk.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deployments-BucJ-gwk.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,102 +0,0 @@
1
- const d = {
2
- 10: "0xE79Cc2063A470087604F7690F3Ff5e0759addA06",
3
- 8453: "0xE79Cc2063A470087604F7690F3Ff5e0759addA06",
4
- 42161: "0xE79Cc2063A470087604F7690F3Ff5e0759addA06",
5
- 84532: "0xE79Cc2063A470087604F7690F3Ff5e0759addA06",
6
- 11155111: "0xE79Cc2063A470087604F7690F3Ff5e0759addA06"
7
- }, f = {
8
- 10: "0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC",
9
- 8453: "0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC",
10
- 42161: "0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC",
11
- 84532: "0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC",
12
- 11155111: "0xa017d8DBeB026a80b3E99F8e118bfFC3efd842BC"
13
- }, C = {
14
- 10: "0xCF9A795Fed701aa214598998a2D4566413D906Ce",
15
- 8453: "0xCF9A795Fed701aa214598998a2D4566413D906Ce",
16
- 42161: "0xCF9A795Fed701aa214598998a2D4566413D906Ce",
17
- 84532: "0xCF9A795Fed701aa214598998a2D4566413D906Ce",
18
- 11155111: "0xCF9A795Fed701aa214598998a2D4566413D906Ce"
19
- }, a = {
20
- 10: "0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd",
21
- 8453: "0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd",
22
- 42161: "0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd",
23
- 84532: "0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd",
24
- 11155111: "0x7Df4b5625567AA946d93118Fe8e81Fa4d6b10Cfd"
25
- }, e = {
26
- 10: "0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33",
27
- 8453: "0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33",
28
- 42161: "0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33",
29
- 84532: "0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33",
30
- 11155111: "0x67f6185EB855aCd514fAC9d9e6Bd83b01040Ce33"
31
- }, b = {
32
- 10: "0xB58d3bA94d16305bf35F8D2055faB44b01063F9B",
33
- 8453: "0xB58d3bA94d16305bf35F8D2055faB44b01063F9B",
34
- 42161: "0xB58d3bA94d16305bf35F8D2055faB44b01063F9B",
35
- 84532: "0xB58d3bA94d16305bf35F8D2055faB44b01063F9B",
36
- 11155111: "0xB58d3bA94d16305bf35F8D2055faB44b01063F9B"
37
- }, F = {
38
- 10: "0x3647EF9212033976204D9d3df3Ed46832888F7fB",
39
- 8453: "0x3647EF9212033976204D9d3df3Ed46832888F7fB",
40
- 42161: "0x3647EF9212033976204D9d3df3Ed46832888F7fB",
41
- 84532: "0x3647EF9212033976204D9d3df3Ed46832888F7fB",
42
- 11155111: "0x3647EF9212033976204D9d3df3Ed46832888F7fB"
43
- }, E = {
44
- 10: "0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09",
45
- 8453: "0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09",
46
- 42161: "0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09",
47
- 84532: "0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09",
48
- 11155111: "0xa4b9E4278Fc1C2Cd7f298D6Ab77fE5ed0BAEFa09"
49
- }, A = {
50
- 10: "0xA1aDC1b479e5188C4c3780B161426fc25A11d45E",
51
- 8453: "0xA1aDC1b479e5188C4c3780B161426fc25A11d45E",
52
- 42161: "0xA1aDC1b479e5188C4c3780B161426fc25A11d45E",
53
- 84532: "0xA1aDC1b479e5188C4c3780B161426fc25A11d45E",
54
- 11155111: "0xA1aDC1b479e5188C4c3780B161426fc25A11d45E"
55
- }, B = {
56
- 10: "0xaEAB5967508DE105fa66bED2575cdF3b17631682",
57
- 8453: "0xaEAB5967508DE105fa66bED2575cdF3b17631682",
58
- 42161: "0xaEAB5967508DE105fa66bED2575cdF3b17631682",
59
- 84532: "0xaEAB5967508DE105fa66bED2575cdF3b17631682",
60
- 11155111: "0xaEAB5967508DE105fa66bED2575cdF3b17631682"
61
- }, D = {
62
- 10: "0x290D20454bC26b68924c193e981fCa38f2588975",
63
- 8453: "0x290D20454bC26b68924c193e981fCa38f2588975",
64
- 42161: "0x290D20454bC26b68924c193e981fCa38f2588975",
65
- 84532: "0x290D20454bC26b68924c193e981fCa38f2588975",
66
- 11155111: "0x290D20454bC26b68924c193e981fCa38f2588975"
67
- }, x = {
68
- 10: "0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC",
69
- 8453: "0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC",
70
- 42161: "0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC",
71
- 84532: "0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC",
72
- 11155111: "0xEB43d4fCf7F64863b3D066EE005Fa298F0CFd8eC"
73
- }, c = {
74
- 10: "0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8",
75
- 8453: "0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8",
76
- 42161: "0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8",
77
- 84532: "0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8",
78
- 11155111: "0x6dA00E864f55ceA64d0d24968fb8bb02Cd8C43E8"
79
- }, s = {
80
- 10: "0x2399DAB7d25bE315C2074BEcd50f243f4982D655",
81
- 8453: "0x2399DAB7d25bE315C2074BEcd50f243f4982D655",
82
- 42161: "0x2399DAB7d25bE315C2074BEcd50f243f4982D655",
83
- 84532: "0x2399DAB7d25bE315C2074BEcd50f243f4982D655",
84
- 11155111: "0x2399DAB7d25bE315C2074BEcd50f243f4982D655"
85
- };
86
- export {
87
- d as A,
88
- C as B,
89
- a as C,
90
- e as E,
91
- A as M,
92
- D as P,
93
- c as S,
94
- s as a,
95
- b,
96
- F as c,
97
- x as d,
98
- B as e,
99
- E as f,
100
- f as g
101
- };
102
- //# sourceMappingURL=deployments-CQu0bLhU.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deployments-CQu0bLhU.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}