@boostxyz/sdk 7.8.0 → 8.0.0-canary.0

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 (125) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +1 -1
  3. package/dist/Actions/EventAction.cjs +1 -1
  4. package/dist/Actions/EventAction.cjs.map +1 -1
  5. package/dist/Actions/EventAction.d.ts +4 -4
  6. package/dist/Actions/EventAction.js +97 -97
  7. package/dist/Actions/EventAction.js.map +1 -1
  8. package/dist/{AllowList-DiU7g4Hs.js → AllowList-CWqAYlwr.js} +28 -28
  9. package/dist/{AllowList-DiU7g4Hs.js.map → AllowList-CWqAYlwr.js.map} +1 -1
  10. package/dist/{AllowList-BJ9HQGFs.cjs → AllowList-Lpqz7tn9.cjs} +2 -2
  11. package/dist/{AllowList-BJ9HQGFs.cjs.map → AllowList-Lpqz7tn9.cjs.map} +1 -1
  12. package/dist/AllowLists/AllowList.cjs +1 -1
  13. package/dist/AllowLists/AllowList.js +3 -3
  14. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  15. package/dist/AllowLists/SimpleAllowList.js +8 -8
  16. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  17. package/dist/AllowLists/SimpleDenyList.js +3 -3
  18. package/dist/Auth/PassthroughAuth.cjs +1 -1
  19. package/dist/Auth/PassthroughAuth.js +1 -1
  20. package/dist/BoostCore.cjs +2 -2
  21. package/dist/BoostCore.cjs.map +1 -1
  22. package/dist/BoostCore.d.ts +106 -23
  23. package/dist/BoostCore.d.ts.map +1 -1
  24. package/dist/BoostCore.js +518 -451
  25. package/dist/BoostCore.js.map +1 -1
  26. package/dist/BoostRegistry.cjs +1 -1
  27. package/dist/BoostRegistry.js +46 -46
  28. package/dist/{Budget-YIhV65cc.js → Budget-BPPXnBAK.js} +36 -36
  29. package/dist/{Budget-YIhV65cc.js.map → Budget-BPPXnBAK.js.map} +1 -1
  30. package/dist/{Budget-D_zhh1rh.cjs → Budget-rZm-AY09.cjs} +2 -2
  31. package/dist/{Budget-D_zhh1rh.cjs.map → Budget-rZm-AY09.cjs.map} +1 -1
  32. package/dist/Budgets/Budget.cjs +1 -1
  33. package/dist/Budgets/Budget.js +2 -2
  34. package/dist/Budgets/ManagedBudget.cjs +1 -1
  35. package/dist/Budgets/ManagedBudget.js +24 -24
  36. package/dist/Deployable/Contract.cjs +1 -1
  37. package/dist/Deployable/Contract.cjs.map +1 -1
  38. package/dist/Deployable/Contract.d.ts +8 -0
  39. package/dist/Deployable/Contract.d.ts.map +1 -1
  40. package/dist/Deployable/Contract.js +14 -4
  41. package/dist/Deployable/Contract.js.map +1 -1
  42. package/dist/Deployable/Deployable.cjs +1 -1
  43. package/dist/Deployable/Deployable.cjs.map +1 -1
  44. package/dist/Deployable/Deployable.d.ts +7 -0
  45. package/dist/Deployable/Deployable.d.ts.map +1 -1
  46. package/dist/Deployable/Deployable.js +13 -4
  47. package/dist/Deployable/Deployable.js.map +1 -1
  48. package/dist/Deployable/DeployableTarget.cjs +1 -1
  49. package/dist/Deployable/DeployableTarget.js +7 -7
  50. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  51. package/dist/Deployable/DeployableTargetWithRBAC.js +16 -16
  52. package/dist/{Incentive-CrnbYN_a.cjs → Incentive-Bse5BKbF.cjs} +2 -2
  53. package/dist/{Incentive-CrnbYN_a.cjs.map → Incentive-Bse5BKbF.cjs.map} +1 -1
  54. package/dist/{Incentive-CeoEla-t.js → Incentive-D1sYPD0W.js} +23 -23
  55. package/dist/{Incentive-CeoEla-t.js.map → Incentive-D1sYPD0W.js.map} +1 -1
  56. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  57. package/dist/Incentives/AllowListIncentive.js +17 -17
  58. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  59. package/dist/Incentives/CGDAIncentive.js +38 -38
  60. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  61. package/dist/Incentives/ERC20Incentive.js +13 -13
  62. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs +1 -1
  63. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs.map +1 -1
  64. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.d.ts +6 -6
  65. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js +22 -22
  66. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js.map +1 -1
  67. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +1 -1
  68. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs.map +1 -1
  69. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.d.ts +6 -6
  70. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +91 -91
  71. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js.map +1 -1
  72. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
  73. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
  74. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +6 -6
  75. package/dist/Incentives/ERC20VariableCriteriaIncentive.js +9 -9
  76. package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
  77. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +1 -1
  78. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs.map +1 -1
  79. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.d.ts +6 -6
  80. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +9 -9
  81. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js.map +1 -1
  82. package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
  83. package/dist/Incentives/ERC20VariableIncentive.js +12 -12
  84. package/dist/Incentives/Incentive.cjs +1 -1
  85. package/dist/Incentives/Incentive.js +2 -2
  86. package/dist/Incentives/PointsIncentive.cjs +1 -1
  87. package/dist/Incentives/PointsIncentive.js +10 -10
  88. package/dist/{SimpleDenyList-Dr03aOeP.js → SimpleDenyList-BtEUdiAj.js} +14 -14
  89. package/dist/{SimpleDenyList-Dr03aOeP.js.map → SimpleDenyList-BtEUdiAj.js.map} +1 -1
  90. package/dist/{SimpleDenyList-7-VTqfsH.cjs → SimpleDenyList-DEoMIYhE.cjs} +2 -2
  91. package/dist/{SimpleDenyList-7-VTqfsH.cjs.map → SimpleDenyList-DEoMIYhE.cjs.map} +1 -1
  92. package/dist/{Validator-rYW7PMwW.cjs → Validator-DHS4vjSa.cjs} +2 -2
  93. package/dist/{Validator-rYW7PMwW.cjs.map → Validator-DHS4vjSa.cjs.map} +1 -1
  94. package/dist/{Validator-DgvB9wge.js → Validator-Kpvmj9Bs.js} +9 -9
  95. package/dist/{Validator-DgvB9wge.js.map → Validator-Kpvmj9Bs.js.map} +1 -1
  96. package/dist/Validators/LimitedSignerValidator.cjs +1 -1
  97. package/dist/Validators/LimitedSignerValidator.js +17 -17
  98. package/dist/Validators/SignerValidator.cjs +1 -1
  99. package/dist/Validators/SignerValidator.js +3 -3
  100. package/dist/Validators/Validator.cjs +1 -1
  101. package/dist/Validators/Validator.js +2 -2
  102. package/dist/{deployments-CHQ30INq.js → deployments-Coa8CGi2.js} +67 -67
  103. package/dist/{deployments-CHQ30INq.js.map → deployments-Coa8CGi2.js.map} +1 -1
  104. package/dist/{deployments-BjBgk03b.cjs → deployments-Dgzcz4Ev.cjs} +2 -2
  105. package/dist/deployments-Dgzcz4Ev.cjs.map +1 -0
  106. package/dist/deployments.json +46 -46
  107. package/dist/generated-BzLYuFx3.cjs +3 -0
  108. package/dist/generated-BzLYuFx3.cjs.map +1 -0
  109. package/dist/{generated-B6mEIx8i.js → generated-D6oDILUw.js} +250 -193
  110. package/dist/generated-D6oDILUw.js.map +1 -0
  111. package/dist/index.cjs +1 -1
  112. package/dist/index.js +16 -16
  113. package/dist/utils.cjs.map +1 -1
  114. package/dist/utils.d.ts.map +1 -1
  115. package/dist/utils.js.map +1 -1
  116. package/package.json +1 -1
  117. package/src/BoostCore.test.ts +34 -23
  118. package/src/BoostCore.ts +124 -26
  119. package/src/Deployable/Contract.ts +11 -0
  120. package/src/Deployable/Deployable.ts +10 -0
  121. package/src/utils.ts +0 -1
  122. package/dist/deployments-BjBgk03b.cjs.map +0 -1
  123. package/dist/generated-B6mEIx8i.js.map +0 -1
  124. package/dist/generated-dd4FN0Fo.cjs +0 -3
  125. package/dist/generated-dd4FN0Fo.cjs.map +0 -1
package/src/BoostCore.ts CHANGED
@@ -30,6 +30,7 @@ import {
30
30
  import { bytecode } from '@boostxyz/evm/artifacts/contracts/BoostCore.sol/BoostCore.json';
31
31
  import {
32
32
  type GetTransactionReceiptParameters,
33
+ deployContract,
33
34
  getAccount,
34
35
  getChains,
35
36
  getTransactionReceipt,
@@ -40,6 +41,8 @@ import {
40
41
  type Address,
41
42
  type ContractEventName,
42
43
  type Hex,
44
+ encodeDeployData,
45
+ encodeFunctionData,
43
46
  encodePacked,
44
47
  keccak256,
45
48
  parseEventLogs,
@@ -164,6 +167,7 @@ import {
164
167
  type ReadParams,
165
168
  type WriteParams,
166
169
  assertValidAddressByChainId,
170
+ getDeployedContractAddress,
167
171
  } from './utils';
168
172
 
169
173
  /**
@@ -272,26 +276,13 @@ export interface BoostCoreOptionsWithPayload extends DeployableOptions {
272
276
  owner: Address;
273
277
  }
274
278
 
275
- /**
276
- * Typeguard to determine if a user is intending to deploy a new instance of the Boost Core contracts with {@link BoostCoreOptionsWithPayload}.
277
- *
278
- * @param {*} opts
279
- * @returns {opts is BoostCoreOptionsWithPayload}
280
- */
281
- // biome-ignore lint/suspicious/noExplicitAny: type guard
282
- function isBoostCoreDeployable(opts: any): opts is BoostCoreOptionsWithPayload {
283
- return opts.registryAddress && opts.protocolFeeReceiver && opts.owner;
284
- }
285
-
286
279
  /**
287
280
  * A union representing both of the valid Boost Core instantiation parameters.
288
281
  *
289
282
  * @export
290
283
  * @typedef {BoostCoreConfig}
291
284
  */
292
- export type BoostCoreConfig =
293
- | BoostCoreDeployedOptions
294
- | BoostCoreOptionsWithPayload;
285
+ export type BoostCoreConfig = BoostCoreDeployedOptions;
295
286
 
296
287
  /**
297
288
  * The interface required to create a new Boost.
@@ -330,10 +321,10 @@ export type IncentiveDisbursalInfo = {
330
321
  * @export
331
322
  * @class BoostCore
332
323
  * @typedef {BoostCore}
333
- * @extends {Deployable<[Address, Address, Address]>}
324
+ * @extends {Deployable<[]>}
334
325
  */
335
326
  export class BoostCore extends Deployable<
336
- [Address, Address, Address],
327
+ BoostCoreOptionsWithPayload,
337
328
  typeof boostCoreAbi
338
329
  > {
339
330
  /**
@@ -368,12 +359,6 @@ export class BoostCore extends Deployable<
368
359
  constructor({ config, account, ...options }: BoostCoreConfig) {
369
360
  if (isBoostCoreDeployed(options) && options.address) {
370
361
  super({ account, config }, options.address);
371
- } else if (isBoostCoreDeployable(options)) {
372
- super({ account, config }, [
373
- options.registryAddress,
374
- options.protocolFeeReceiver,
375
- options.owner,
376
- ]);
377
362
  } else {
378
363
  const { address } = assertValidAddressByChainId(
379
364
  config,
@@ -2140,25 +2125,138 @@ export class BoostCore extends Deployable<
2140
2125
  * @inheritdoc
2141
2126
  *
2142
2127
  * @public
2143
- * @param {?[Address, Address, Address]} [_payload]
2128
+ * @param {?[]} [_payload]
2144
2129
  * @param {?DeployableOptions} [_options]
2145
2130
  * @returns {GenericDeployableParams}
2146
2131
  */
2147
2132
  public override buildParameters(
2148
- _payload?: [Address, Address, Address],
2133
+ _payload?: BoostCoreOptionsWithPayload,
2149
2134
  _options?: DeployableOptions,
2150
2135
  ): GenericDeployableParams {
2151
- const [payload, options] = this.validateDeploymentConfig(
2136
+ const [_unused, options] = this.validateDeploymentConfig(
2152
2137
  _payload,
2153
2138
  _options,
2154
2139
  );
2155
2140
  return {
2156
2141
  abi: boostCoreAbi,
2157
2142
  bytecode: bytecode as Hex,
2158
- args: payload,
2143
+ args: [], // UUPS constructor should have no arguments - uses initializer instead
2159
2144
  ...this.optionallyAttachAccount(options.account),
2160
2145
  };
2161
2146
  }
2147
+
2148
+ /**
2149
+ * Override the deploy method to handle UUPS proxy deployment with initialization
2150
+ *
2151
+ * @protected
2152
+ * @async
2153
+ * @param {?[]} [_payload]
2154
+ * @param {?DeployableOptions} [_options]
2155
+ * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
2156
+ * @returns {Promise<this>}
2157
+ */
2158
+ public override async deploy(
2159
+ _payload?: BoostCoreOptionsWithPayload,
2160
+ _options?: DeployableOptions,
2161
+ waitParams?: Omit<Parameters<typeof waitForTransactionReceipt>[1], 'hash'>,
2162
+ ): Promise<this> {
2163
+ // Check if this is a UUPS deployment by checking if we have the required parameters
2164
+ const payload = _payload || this._payload;
2165
+ if (
2166
+ payload &&
2167
+ typeof payload === 'object' &&
2168
+ 'registryAddress' in payload
2169
+ ) {
2170
+ const corePayload = payload;
2171
+ const options = _options || {
2172
+ config: this._config,
2173
+ account: this._account,
2174
+ };
2175
+
2176
+ // Deploy the implementation contract first
2177
+ const implementationAddress = await getDeployedContractAddress(
2178
+ options.config,
2179
+ deployContract(options.config, {
2180
+ abi: boostCoreAbi,
2181
+ bytecode: bytecode as Hex,
2182
+ args: [], // UUPS constructor has no arguments
2183
+ ...this.optionallyAttachAccount(options.account),
2184
+ }),
2185
+ waitParams,
2186
+ );
2187
+
2188
+ // Prepare the initialization call data
2189
+ const initializeCalldata = encodeFunctionData({
2190
+ abi: boostCoreAbi,
2191
+ functionName: 'initialize',
2192
+ args: [
2193
+ corePayload.registryAddress,
2194
+ corePayload.protocolFeeReceiver,
2195
+ corePayload.owner,
2196
+ ],
2197
+ });
2198
+
2199
+ // ERC1967Proxy ABI (constructor only)
2200
+ const ERC1967ProxyABI = [
2201
+ {
2202
+ type: 'constructor',
2203
+ inputs: [
2204
+ {
2205
+ name: 'implementation',
2206
+ type: 'address',
2207
+ internalType: 'address',
2208
+ },
2209
+ {
2210
+ name: '_data',
2211
+ type: 'bytes',
2212
+ internalType: 'bytes',
2213
+ },
2214
+ ],
2215
+ stateMutability: 'payable',
2216
+ },
2217
+ ];
2218
+
2219
+ // ERC1967Proxy bytecode (OpenZeppelin implementation)
2220
+ const ERC1967ProxyBytecode =
2221
+ '0x60806040526040516103dc3803806103dc8339810160408190526100229161023b565b61002c8282610033565b5050610320565b61003c82610091565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561008557610080828261010c565b505050565b61008d61017f565b5050565b806001600160a01b03163b5f036100cb57604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f80846001600160a01b031684604051610128919061030a565b5f60405180830381855af49150503d805f8114610160576040519150601f19603f3d011682016040523d82523d5f602084013e610165565b606091505b5090925090506101768583836101a0565b95945050505050565b341561019e5760405163b398979f60e01b815260040160405180910390fd5b565b6060826101b5576101b0826101ff565b6101f8565b81511580156101cc57506001600160a01b0384163b155b156101f557604051639996b31560e01b81526001600160a01b03851660048201526024016100c2565b50805b9392505050565b80511561020e57805160208201fd5b60405163d6bda27560e01b815260040160405180910390fd5b634e487b7160e01b5f52604160045260245ffd5b5f806040838503121561024c575f80fd5b82516001600160a01b0381168114610262575f80fd5b60208401519092506001600160401b0381111561027d575f80fd5b8301601f8101851361028d575f80fd5b80516001600160401b038111156102a6576102a6610227565b604051601f8201601f19908116603f011681016001600160401b03811182821017156102d4576102d4610227565b6040528181528282016020018710156102eb575f80fd5b8160208401602083015e5f602083830101528093505050509250929050565b5f82518060208501845e5f920191825250919050565b60b08061032c5f395ff3fe6080604052600a600c565b005b60186014601a565b605d565b565b5f60587f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b365f80375f80365f845af43d5f803e8080156076573d5ff35b3d5ffdfea2646970667358221220f563f31c0aa14bad619f09897012e95da451776c4af1ecde8d7624c84200077664736f6c634300081a0033';
2222
+
2223
+ // Deploy ERC1967Proxy with implementation and initialization call
2224
+ const proxyAddress = await getDeployedContractAddress(
2225
+ options.config,
2226
+ deployContract(options.config, {
2227
+ abi: ERC1967ProxyABI,
2228
+ bytecode: encodeDeployData({
2229
+ abi: ERC1967ProxyABI,
2230
+ bytecode: ERC1967ProxyBytecode,
2231
+ args: [implementationAddress, initializeCalldata],
2232
+ }),
2233
+ args: [implementationAddress, initializeCalldata],
2234
+ ...this.optionallyAttachAccount(options.account),
2235
+ }),
2236
+ waitParams,
2237
+ );
2238
+
2239
+ // Set the proxy address as our contract address
2240
+ this._address = proxyAddress;
2241
+
2242
+ // Update the static addresses object so other methods can find this deployment
2243
+ const chainId = options.config.getClient().chain?.id;
2244
+ if (chainId) {
2245
+ (this.constructor as typeof BoostCore).addresses[chainId] =
2246
+ proxyAddress;
2247
+ } else {
2248
+ console.log(
2249
+ 'WARNING: No chain ID found, cannot update addresses object',
2250
+ );
2251
+ }
2252
+ } else {
2253
+ // Fallback to regular deployment if no initialization payload
2254
+ await super.deploy(_payload, _options, waitParams);
2255
+ }
2256
+
2257
+ return this;
2258
+ }
2259
+
2162
2260
  /**
2163
2261
  * Prepares and executes a top-up from a Budget, specifying the net top-up amount
2164
2262
  * that should land in the incentive (the protocol fee is added automatically).
@@ -67,6 +67,17 @@ export class Contract<ContractAbi extends Abi> {
67
67
  return this._address;
68
68
  }
69
69
 
70
+ /**
71
+ * A getter returning this contract's Wagmi configuration.
72
+ *
73
+ * @public
74
+ * @readonly
75
+ * @type {Config}
76
+ */
77
+ public get config() {
78
+ return this._config;
79
+ }
80
+
70
81
  /**
71
82
  * Will set this contract's address and return the instance for chaining. Does not verify that provided address is valid.
72
83
  *
@@ -126,6 +126,16 @@ export class Deployable<
126
126
  return this._payload;
127
127
  }
128
128
 
129
+ /**
130
+ * Returns the attached account, if it exists
131
+ *
132
+ * @readonly
133
+ * @type {Account | undefined}
134
+ */
135
+ get account() {
136
+ return this._account;
137
+ }
138
+
129
139
  /**
130
140
  * Attaches a new payload for use with this deployable's initialization
131
141
  *
package/src/utils.ts CHANGED
@@ -15,7 +15,6 @@ import type {
15
15
  AbiEvent,
16
16
  Address,
17
17
  ContractEventName,
18
- ContractFunctionName,
19
18
  GetLogsParameters,
20
19
  Hash,
21
20
  Hex,
@@ -1 +0,0 @@
1
- {"version":3,"file":"deployments-BjBgk03b.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}