@boostxyz/sdk 0.0.0-alpha.11 → 0.0.0-alpha.13
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 +2 -2
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +2 -2
- 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 +117 -33
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +309 -121
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +2 -2
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +2 -2
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +23 -19
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +2 -2
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +6 -5
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +27 -5
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +438 -347
- 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 +26 -5
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +125 -64
- 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 +2 -2
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +41 -37
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/SimpleBudget.d.ts +2 -2
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +2 -2
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +6 -6
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +22 -17
- 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 +2 -2
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +17 -13
- 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 +14 -2
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +27 -23
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +2 -2
- 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 +2 -2
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +17 -13
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +2 -2
- 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 +34 -30
- 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 +2 -2
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +13 -9
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-4PtOPXTc.js → SimpleDenyList-C21O9Yfi.js} +23 -19
- package/dist/SimpleDenyList-C21O9Yfi.js.map +1 -0
- package/dist/SimpleDenyList-DeJRKD2D.cjs +2 -0
- package/dist/{SimpleDenyList-4PtOPXTc.js.map → SimpleDenyList-DeJRKD2D.cjs.map} +1 -1
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +2 -2
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +18 -14
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/deployments-BvFcK_eR.js +40 -0
- package/dist/deployments-BvFcK_eR.js.map +1 -0
- package/dist/deployments-Ho4PnGCS.cjs +2 -0
- package/dist/deployments-Ho4PnGCS.cjs.map +1 -0
- package/dist/deployments.json +38 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +122 -20
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +98 -28
- package/dist/errors.js.map +1 -1
- package/dist/{generated-BDeDiaCK.js → generated-LpgSHrH0.js} +150 -110
- package/dist/generated-LpgSHrH0.js.map +1 -0
- package/dist/generated-tq_HLZJ0.cjs +3 -0
- package/dist/generated-tq_HLZJ0.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +115 -108
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +25 -11
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -23
- package/dist/utils.js.map +1 -1
- package/package.json +10 -6
- package/src/Actions/Action.test.ts +8 -4
- package/src/Actions/ContractAction.ts +5 -3
- package/src/Actions/ERC721MintAction.ts +5 -3
- package/src/Actions/EventAction.test.ts +528 -100
- package/src/Actions/EventAction.ts +302 -60
- package/src/AllowLists/AllowList.test.ts +1 -1
- package/src/AllowLists/SimpleAllowList.ts +6 -3
- package/src/AllowLists/SimpleDenyList.ts +6 -3
- package/src/BoostCore.test.ts +31 -91
- package/src/BoostCore.ts +137 -34
- package/src/BoostRegistry.ts +89 -21
- package/src/Budgets/ManagedBudget.ts +6 -4
- package/src/Budgets/SimpleBudget.ts +4 -3
- package/src/Budgets/VestingBudget.ts +4 -3
- package/src/Deployable/DeployableTarget.ts +22 -11
- package/src/Incentives/AllowListIncentive.ts +6 -3
- package/src/Incentives/CGDAIncentive.ts +6 -3
- package/src/Incentives/ERC1155Incentive.ts +4 -3
- package/src/Incentives/ERC20Incentive.ts +6 -3
- package/src/Incentives/ERC20VariableIncentive.ts +6 -3
- package/src/Incentives/PointsIncentive.ts +6 -3
- package/src/Validators/SignerValidator.ts +6 -3
- package/src/errors.ts +177 -21
- package/src/utils.ts +60 -11
- package/dist/SimpleDenyList-CqT0BMP7.cjs +0 -2
- package/dist/SimpleDenyList-CqT0BMP7.cjs.map +0 -1
- package/dist/generated-BDeDiaCK.js.map +0 -1
- package/dist/generated-wKBNvm48.cjs +0 -3
- package/dist/generated-wKBNvm48.cjs.map +0 -1
package/src/BoostRegistry.ts
CHANGED
|
@@ -15,30 +15,41 @@ import {
|
|
|
15
15
|
type Hex,
|
|
16
16
|
isAddress,
|
|
17
17
|
} from 'viem';
|
|
18
|
+
import { BoostRegistry as BoostRegistryBases } from '../dist/deployments.json';
|
|
18
19
|
import {
|
|
19
20
|
Deployable,
|
|
20
21
|
type DeployableOptions,
|
|
21
22
|
type GenericDeployableParams,
|
|
22
23
|
} from './Deployable/Deployable';
|
|
23
24
|
import type { DeployableTarget } from './Deployable/DeployableTarget';
|
|
24
|
-
import
|
|
25
|
-
GenericLog,
|
|
26
|
-
HashAndSimulatedResult,
|
|
27
|
-
ReadParams,
|
|
28
|
-
RegistryType,
|
|
29
|
-
WriteParams,
|
|
25
|
+
import {
|
|
26
|
+
type GenericLog,
|
|
27
|
+
type HashAndSimulatedResult,
|
|
28
|
+
type ReadParams,
|
|
29
|
+
type RegistryType,
|
|
30
|
+
type WriteParams,
|
|
31
|
+
assertValidAddressByChainId,
|
|
30
32
|
} from './utils';
|
|
31
33
|
|
|
32
|
-
export { boostRegistryAbi };
|
|
33
|
-
|
|
34
34
|
/**
|
|
35
|
-
* The
|
|
36
|
-
* By default, `new BoostRegistry` will use this address if not otherwise provided.
|
|
35
|
+
* The address of the deployed `BoostRegistry` instance. In prerelease mode, this will be its sepolia address
|
|
37
36
|
*
|
|
38
37
|
* @type {Address}
|
|
39
38
|
*/
|
|
40
|
-
export const BOOST_REGISTRY_ADDRESS
|
|
41
|
-
|
|
39
|
+
export const BOOST_REGISTRY_ADDRESS = (
|
|
40
|
+
BoostRegistryBases as Record<string, Address>
|
|
41
|
+
)[__DEFAULT_CHAIN_ID__];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The fixed addresses for the deployed Boost Registry.
|
|
45
|
+
* By default, `new BoostRegistry` will use the address deployed to the currently connected chain, or `BOOST_REGISTRY_ADDRESS` if not provided.
|
|
46
|
+
*
|
|
47
|
+
* @type {Record<number, Address>}
|
|
48
|
+
*/
|
|
49
|
+
export const BOOST_REGISTRY_ADDRESSES: Record<number, Address> = {
|
|
50
|
+
...(BoostRegistryBases as Record<number, Address>),
|
|
51
|
+
31337: import.meta.env.VITE_BOOST_REGISTRY_ADDRESS,
|
|
52
|
+
};
|
|
42
53
|
|
|
43
54
|
/**
|
|
44
55
|
* A record of `BoostRegistry` event names to `AbiEvent` objects for use with `getLogs`
|
|
@@ -151,6 +162,26 @@ export class BoostRegistry extends Deployable<
|
|
|
151
162
|
never[],
|
|
152
163
|
typeof boostRegistryAbi
|
|
153
164
|
> {
|
|
165
|
+
/**
|
|
166
|
+
* A static property representing a map of stringified chain ID's to the address of the deployed implementation on chain
|
|
167
|
+
*
|
|
168
|
+
* @static
|
|
169
|
+
* @readonly
|
|
170
|
+
* @type {Record<string, Address>}
|
|
171
|
+
*/
|
|
172
|
+
static readonly addresses: Record<number, Address> = BOOST_REGISTRY_ADDRESSES;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A getter that will return Boost registry's static addresses by numerical chain ID
|
|
176
|
+
*
|
|
177
|
+
* @public
|
|
178
|
+
* @readonly
|
|
179
|
+
* @type {Record<number, Address>}
|
|
180
|
+
*/
|
|
181
|
+
public get addresses(): Record<number, Address> {
|
|
182
|
+
return (this.constructor as typeof BoostRegistry).addresses;
|
|
183
|
+
}
|
|
184
|
+
|
|
154
185
|
/**
|
|
155
186
|
* Creates an instance of BoostRegistry.
|
|
156
187
|
*
|
|
@@ -167,7 +198,11 @@ export class BoostRegistry extends Deployable<
|
|
|
167
198
|
} else if (isBoostRegistryDeployable(options)) {
|
|
168
199
|
super({ account, config }, []);
|
|
169
200
|
} else {
|
|
170
|
-
|
|
201
|
+
const { address } = assertValidAddressByChainId(
|
|
202
|
+
config,
|
|
203
|
+
BOOST_REGISTRY_ADDRESSES,
|
|
204
|
+
);
|
|
205
|
+
super({ account, config }, address);
|
|
171
206
|
}
|
|
172
207
|
}
|
|
173
208
|
|
|
@@ -216,7 +251,11 @@ export class BoostRegistry extends Deployable<
|
|
|
216
251
|
const { request, result } = await simulateBoostRegistryRegister(
|
|
217
252
|
this._config,
|
|
218
253
|
{
|
|
219
|
-
|
|
254
|
+
...assertValidAddressByChainId(
|
|
255
|
+
this._config,
|
|
256
|
+
this.addresses,
|
|
257
|
+
params?.chain?.id || params?.chainId,
|
|
258
|
+
),
|
|
220
259
|
args: [registryType, name, implementation],
|
|
221
260
|
...this.optionallyAttachAccount(),
|
|
222
261
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -310,11 +349,20 @@ export class BoostRegistry extends Deployable<
|
|
|
310
349
|
config: this._config,
|
|
311
350
|
account: this._account,
|
|
312
351
|
});
|
|
352
|
+
const { address: baseAddress } = assertValidAddressByChainId(
|
|
353
|
+
this._config,
|
|
354
|
+
target.bases,
|
|
355
|
+
params?.chain?.id || params?.chainId,
|
|
356
|
+
);
|
|
313
357
|
const { request, result } = await simulateBoostRegistryDeployClone(
|
|
314
358
|
this._config,
|
|
315
359
|
{
|
|
316
|
-
|
|
317
|
-
|
|
360
|
+
...assertValidAddressByChainId(
|
|
361
|
+
this._config,
|
|
362
|
+
this.addresses,
|
|
363
|
+
params?.chain?.id || params?.chainId,
|
|
364
|
+
),
|
|
365
|
+
args: [target.registryType, baseAddress, displayName, payload.args[0]],
|
|
318
366
|
...this.optionallyAttachAccount(),
|
|
319
367
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
320
368
|
...(params as any),
|
|
@@ -339,7 +387,11 @@ export class BoostRegistry extends Deployable<
|
|
|
339
387
|
params?: ReadParams<typeof boostRegistryAbi, 'getBaseImplementation'>,
|
|
340
388
|
) {
|
|
341
389
|
return await readBoostRegistryGetBaseImplementation(this._config, {
|
|
342
|
-
|
|
390
|
+
...assertValidAddressByChainId(
|
|
391
|
+
this._config,
|
|
392
|
+
this.addresses,
|
|
393
|
+
params?.chainId,
|
|
394
|
+
),
|
|
343
395
|
args: [identifier],
|
|
344
396
|
...this.optionallyAttachAccount(),
|
|
345
397
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -361,7 +413,11 @@ export class BoostRegistry extends Deployable<
|
|
|
361
413
|
params?: ReadParams<typeof boostRegistryAbi, 'getClone'>,
|
|
362
414
|
) {
|
|
363
415
|
return await readBoostRegistryGetBaseImplementation(this._config, {
|
|
364
|
-
|
|
416
|
+
...assertValidAddressByChainId(
|
|
417
|
+
this._config,
|
|
418
|
+
this.addresses,
|
|
419
|
+
params?.chainId,
|
|
420
|
+
),
|
|
365
421
|
args: [identifier],
|
|
366
422
|
...this.optionallyAttachAccount(),
|
|
367
423
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -383,7 +439,11 @@ export class BoostRegistry extends Deployable<
|
|
|
383
439
|
params?: ReadParams<typeof boostRegistryAbi, 'getClones'>,
|
|
384
440
|
) {
|
|
385
441
|
return await readBoostRegistryGetClones(this._config, {
|
|
386
|
-
|
|
442
|
+
...assertValidAddressByChainId(
|
|
443
|
+
this._config,
|
|
444
|
+
this.addresses,
|
|
445
|
+
params?.chainId,
|
|
446
|
+
),
|
|
387
447
|
args: [deployer],
|
|
388
448
|
...this.optionallyAttachAccount(),
|
|
389
449
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -411,7 +471,11 @@ export class BoostRegistry extends Deployable<
|
|
|
411
471
|
params?: ReadParams<typeof boostRegistryAbi, 'getCloneIdentifier'>,
|
|
412
472
|
) {
|
|
413
473
|
return await readBoostRegistryGetCloneIdentifier(this._config, {
|
|
414
|
-
|
|
474
|
+
...assertValidAddressByChainId(
|
|
475
|
+
this._config,
|
|
476
|
+
this.addresses,
|
|
477
|
+
params?.chainId,
|
|
478
|
+
),
|
|
415
479
|
args: [registryType, base, deployer, displayName],
|
|
416
480
|
...this.optionallyAttachAccount(),
|
|
417
481
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -435,7 +499,11 @@ export class BoostRegistry extends Deployable<
|
|
|
435
499
|
params?: ReadParams<typeof boostRegistryAbi, 'getIdentifier'>,
|
|
436
500
|
) {
|
|
437
501
|
return await readBoostRegistryGetCloneIdentifier(this._config, {
|
|
438
|
-
|
|
502
|
+
...assertValidAddressByChainId(
|
|
503
|
+
this._config,
|
|
504
|
+
this.addresses,
|
|
505
|
+
params?.chainId,
|
|
506
|
+
),
|
|
439
507
|
args: [registryType, displayName],
|
|
440
508
|
...this.optionallyAttachAccount(),
|
|
441
509
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
parseAbiParameters,
|
|
34
34
|
zeroAddress,
|
|
35
35
|
} from 'viem';
|
|
36
|
+
import { ManagedBudget as ManagedBudgetBases } from '../../dist/deployments.json';
|
|
36
37
|
import type {
|
|
37
38
|
DeployableOptions,
|
|
38
39
|
GenericDeployableParams,
|
|
@@ -54,7 +55,6 @@ import {
|
|
|
54
55
|
RegistryType,
|
|
55
56
|
type WriteParams,
|
|
56
57
|
} from '../utils';
|
|
57
|
-
|
|
58
58
|
export { managedBudgetAbi };
|
|
59
59
|
export type { ERC1155TransferPayload, FungibleTransferPayload };
|
|
60
60
|
|
|
@@ -189,10 +189,12 @@ export class ManagedBudget extends DeployableTarget<
|
|
|
189
189
|
*
|
|
190
190
|
* @public
|
|
191
191
|
* @static
|
|
192
|
-
* @type {Address}
|
|
192
|
+
* @type {Record<number, Address>}
|
|
193
193
|
*/
|
|
194
|
-
public static override
|
|
195
|
-
|
|
194
|
+
public static override bases: Record<number, Address> = {
|
|
195
|
+
...(ManagedBudgetBases as Record<number, Address>),
|
|
196
|
+
31337: import.meta.env.VITE_MANAGED_BUDGET_BASE,
|
|
197
|
+
};
|
|
196
198
|
/**
|
|
197
199
|
* @inheritdoc
|
|
198
200
|
*
|
|
@@ -151,10 +151,11 @@ export class SimpleBudget extends DeployableTarget<
|
|
|
151
151
|
*
|
|
152
152
|
* @public
|
|
153
153
|
* @static
|
|
154
|
-
* @type {Address}
|
|
154
|
+
* @type {Record<number, Address>}
|
|
155
155
|
*/
|
|
156
|
-
public static override
|
|
157
|
-
.VITE_SIMPLE_BUDGET_BASE
|
|
156
|
+
public static override bases: Record<number, Address> = {
|
|
157
|
+
31337: import.meta.env.VITE_SIMPLE_BUDGET_BASE,
|
|
158
|
+
};
|
|
158
159
|
/**
|
|
159
160
|
* @inheritdoc
|
|
160
161
|
*
|
|
@@ -127,10 +127,11 @@ export class VestingBudget extends DeployableTarget<
|
|
|
127
127
|
*
|
|
128
128
|
* @public
|
|
129
129
|
* @static
|
|
130
|
-
* @type {Address}
|
|
130
|
+
* @type {Record<number, Address>}
|
|
131
131
|
*/
|
|
132
|
-
public static override
|
|
133
|
-
.VITE_VESTING_BUDGET_BASE
|
|
132
|
+
public static override bases: Record<number, Address> = {
|
|
133
|
+
31337: import.meta.env.VITE_VESTING_BUDGET_BASE,
|
|
134
|
+
};
|
|
134
135
|
/**
|
|
135
136
|
* @inheritdoc
|
|
136
137
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type aCloneableAbi,
|
|
3
|
-
readACloneableGetComponentInterface
|
|
3
|
+
readACloneableGetComponentInterface,
|
|
4
4
|
readACloneableSupportsInterface,
|
|
5
5
|
} from '@boostxyz/evm';
|
|
6
6
|
import { deployContract } from '@wagmi/core';
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type Hex,
|
|
12
12
|
type WaitForTransactionReceiptParameters,
|
|
13
13
|
isAddress,
|
|
14
|
+
isAddressEqual,
|
|
14
15
|
zeroAddress,
|
|
15
16
|
} from 'viem';
|
|
16
17
|
import {
|
|
@@ -38,13 +39,13 @@ export class DeployableTarget<
|
|
|
38
39
|
ContractAbi extends Abi,
|
|
39
40
|
> extends Deployable<Payload, ContractAbi> {
|
|
40
41
|
/**
|
|
41
|
-
* A static property representing the address of the base implementation on chain, used when cloning base contracts.
|
|
42
|
+
* A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.
|
|
42
43
|
*
|
|
43
44
|
* @static
|
|
44
45
|
* @readonly
|
|
45
|
-
* @type {Address}
|
|
46
|
+
* @type {Record<string, Address>}
|
|
46
47
|
*/
|
|
47
|
-
static readonly
|
|
48
|
+
static readonly bases: Record<number, Address> = {};
|
|
48
49
|
/**
|
|
49
50
|
* The target's registry type.
|
|
50
51
|
*
|
|
@@ -61,7 +62,14 @@ export class DeployableTarget<
|
|
|
61
62
|
*/
|
|
62
63
|
protected _isBase = true;
|
|
63
64
|
get isBase() {
|
|
64
|
-
if (
|
|
65
|
+
if (
|
|
66
|
+
!!this.address &&
|
|
67
|
+
Object.values(this.bases).some((base) =>
|
|
68
|
+
// biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above
|
|
69
|
+
isAddressEqual(this.address!, base),
|
|
70
|
+
)
|
|
71
|
+
)
|
|
72
|
+
return true;
|
|
65
73
|
return this._isBase;
|
|
66
74
|
}
|
|
67
75
|
|
|
@@ -83,22 +91,25 @@ export class DeployableTarget<
|
|
|
83
91
|
if (
|
|
84
92
|
typeof payload === 'string' &&
|
|
85
93
|
isAddress(payload) &&
|
|
86
|
-
payload !==
|
|
87
|
-
|
|
94
|
+
payload !== zeroAddress &&
|
|
95
|
+
!Object.values(this.bases).some((base) => {
|
|
96
|
+
if (!payload || !base) return false;
|
|
97
|
+
return isAddressEqual(payload, base);
|
|
98
|
+
})
|
|
88
99
|
)
|
|
89
100
|
isBase = false;
|
|
90
101
|
if (isBase !== undefined) this._isBase = isBase;
|
|
91
102
|
}
|
|
92
103
|
|
|
93
104
|
/**
|
|
94
|
-
* A getter that will return the base implementation's static
|
|
105
|
+
* A getter that will return the base implementation's static addresses by numerical chain ID
|
|
95
106
|
*
|
|
96
107
|
* @public
|
|
97
108
|
* @readonly
|
|
98
|
-
* @type {Address}
|
|
109
|
+
* @type {Record<number, Address>}
|
|
99
110
|
*/
|
|
100
|
-
public get
|
|
101
|
-
return (this.constructor as typeof DeployableTarget).
|
|
111
|
+
public get bases(): Record<number, Address> {
|
|
112
|
+
return (this.constructor as typeof DeployableTarget).bases;
|
|
102
113
|
}
|
|
103
114
|
|
|
104
115
|
/**
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
type Hex,
|
|
18
18
|
encodeAbiParameters,
|
|
19
19
|
} from 'viem';
|
|
20
|
+
import { AllowListIncentive as AllowListIncentiveBases } from '../../dist/deployments.json';
|
|
20
21
|
import { SimpleAllowList } from '../AllowLists/AllowList';
|
|
21
22
|
import type {
|
|
22
23
|
DeployableOptions,
|
|
@@ -92,10 +93,12 @@ export class AllowListIncentive extends DeployableTarget<
|
|
|
92
93
|
*
|
|
93
94
|
* @public
|
|
94
95
|
* @static
|
|
95
|
-
* @type {Address}
|
|
96
|
+
* @type {Record<number, Address>}
|
|
96
97
|
*/
|
|
97
|
-
public static override
|
|
98
|
-
|
|
98
|
+
public static override bases: Record<number, Address> = {
|
|
99
|
+
...(AllowListIncentiveBases as Record<number, Address>),
|
|
100
|
+
31337: import.meta.env.VITE_ALLOWLIST_INCENTIVE_BASE,
|
|
101
|
+
};
|
|
99
102
|
/**
|
|
100
103
|
* @inheritdoc
|
|
101
104
|
*
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
type Hex,
|
|
22
22
|
encodeAbiParameters,
|
|
23
23
|
} from 'viem';
|
|
24
|
+
import { CGDAIncentive as CGDAIncentiveBases } from '../../dist/deployments.json';
|
|
24
25
|
import type {
|
|
25
26
|
DeployableOptions,
|
|
26
27
|
GenericDeployableParams,
|
|
@@ -144,10 +145,12 @@ export class CGDAIncentive extends DeployableTarget<
|
|
|
144
145
|
*
|
|
145
146
|
* @public
|
|
146
147
|
* @static
|
|
147
|
-
* @type {Address}
|
|
148
|
+
* @type {Record<number, Address>}
|
|
148
149
|
*/
|
|
149
|
-
public static override
|
|
150
|
-
|
|
150
|
+
public static override bases: Record<number, Address> = {
|
|
151
|
+
...(CGDAIncentiveBases as Record<number, Address>),
|
|
152
|
+
31337: import.meta.env.VITE_CGDA_INCENTIVE_BASE,
|
|
153
|
+
};
|
|
151
154
|
/**
|
|
152
155
|
* @inheritdoc
|
|
153
156
|
*
|
|
@@ -127,10 +127,11 @@ export class ERC1155Incentive extends DeployableTarget<
|
|
|
127
127
|
*
|
|
128
128
|
* @public
|
|
129
129
|
* @static
|
|
130
|
-
* @type {Address}
|
|
130
|
+
* @type {Record<number, Address>}
|
|
131
131
|
*/
|
|
132
|
-
public static override
|
|
133
|
-
.VITE_ERC1155_INCENTIVE_BASE
|
|
132
|
+
public static override bases: Record<number, Address> = {
|
|
133
|
+
31337: import.meta.env.VITE_ERC1155_INCENTIVE_BASE,
|
|
134
|
+
};
|
|
134
135
|
/**
|
|
135
136
|
* @inheritdoc
|
|
136
137
|
*
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
type Hex,
|
|
25
25
|
encodeAbiParameters,
|
|
26
26
|
} from 'viem';
|
|
27
|
+
import { ERC20Incentive as ERC20IncentiveBases } from '../../dist/deployments.json';
|
|
27
28
|
import type {
|
|
28
29
|
DeployableOptions,
|
|
29
30
|
GenericDeployableParams,
|
|
@@ -110,10 +111,12 @@ export class ERC20Incentive extends DeployableTarget<
|
|
|
110
111
|
*
|
|
111
112
|
* @public
|
|
112
113
|
* @static
|
|
113
|
-
* @type {Address}
|
|
114
|
+
* @type {Record<number, Address>}
|
|
114
115
|
*/
|
|
115
|
-
public static override
|
|
116
|
-
|
|
116
|
+
public static override bases: Record<number, Address> = {
|
|
117
|
+
...(ERC20IncentiveBases as Record<number, Address>),
|
|
118
|
+
31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,
|
|
119
|
+
};
|
|
117
120
|
/**
|
|
118
121
|
* @inheritdoc
|
|
119
122
|
*
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
type Hex,
|
|
22
22
|
encodeAbiParameters,
|
|
23
23
|
} from 'viem';
|
|
24
|
+
import { ERC20VariableIncentive as ERC20VariableIncentiveBases } from '../../dist/deployments.json';
|
|
24
25
|
import type {
|
|
25
26
|
DeployableOptions,
|
|
26
27
|
GenericDeployableParams,
|
|
@@ -96,10 +97,12 @@ export class ERC20VariableIncentive extends DeployableTarget<
|
|
|
96
97
|
*
|
|
97
98
|
* @public
|
|
98
99
|
* @static
|
|
99
|
-
* @type {Address}
|
|
100
|
+
* @type {Record<number, Address>}
|
|
100
101
|
*/
|
|
101
|
-
public static override
|
|
102
|
-
|
|
102
|
+
public static override bases: Record<number, Address> = {
|
|
103
|
+
...(ERC20VariableIncentiveBases as Record<number, Address>),
|
|
104
|
+
31337: import.meta.env.VITE_ERC20_VARIABLE_INCENTIVE_BASE,
|
|
105
|
+
};
|
|
103
106
|
/**
|
|
104
107
|
* @inheritdoc
|
|
105
108
|
*
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type Hex,
|
|
19
19
|
encodeAbiParameters,
|
|
20
20
|
} from 'viem';
|
|
21
|
+
import { PointsIncentive as PointsIncentiveBases } from '../../dist/deployments.json';
|
|
21
22
|
import type {
|
|
22
23
|
DeployableOptions,
|
|
23
24
|
GenericDeployableParams,
|
|
@@ -105,10 +106,12 @@ export class PointsIncentive extends DeployableTarget<
|
|
|
105
106
|
*
|
|
106
107
|
* @public
|
|
107
108
|
* @static
|
|
108
|
-
* @type {Address}
|
|
109
|
+
* @type {Record<number, Address>}
|
|
109
110
|
*/
|
|
110
|
-
public static override
|
|
111
|
-
|
|
111
|
+
public static override bases: Record<number, Address> = {
|
|
112
|
+
...(PointsIncentiveBases as Record<number, Address>),
|
|
113
|
+
31337: import.meta.env.VITE_POINTS_INCENTIVE_BASE,
|
|
114
|
+
};
|
|
112
115
|
/**
|
|
113
116
|
* @inheritdoc
|
|
114
117
|
*
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
encodeAbiParameters,
|
|
19
19
|
} from 'viem';
|
|
20
20
|
import { signTypedData } from 'viem/accounts';
|
|
21
|
+
import { SignerValidator as SignerValidatorBases } from '../../dist/deployments.json';
|
|
21
22
|
import type {
|
|
22
23
|
DeployableOptions,
|
|
23
24
|
GenericDeployableParams,
|
|
@@ -306,10 +307,12 @@ export class SignerValidator extends DeployableTarget<
|
|
|
306
307
|
*
|
|
307
308
|
* @public
|
|
308
309
|
* @static
|
|
309
|
-
* @type {Address}
|
|
310
|
+
* @type {Record<number, Address>}
|
|
310
311
|
*/
|
|
311
|
-
public static override
|
|
312
|
-
|
|
312
|
+
public static override bases: Record<number, Address> = {
|
|
313
|
+
...(SignerValidatorBases as Record<number, Address>),
|
|
314
|
+
31337: import.meta.env.VITE_SIGNER_VALIDATOR_BASE,
|
|
315
|
+
};
|
|
313
316
|
/**
|
|
314
317
|
* @inheritdoc
|
|
315
318
|
*
|