Skip to content

Commit

Permalink
[ADHOC] feat(cli): allow Validator to be optional in seed (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmackz authored Nov 19, 2024
1 parent 2462357 commit fa789d9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-suns-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@boostxyz/cli": minor
---

Make Validator and Allowlist optional in boost seed
29 changes: 17 additions & 12 deletions packages/cli/src/commands/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
BoostRegistry,
type Budget,
type CGDAIncentivePayload,
type CreateBoostPayload,
type DeployablePayloadOrAddress,
type ERC20IncentivePayload,
type ERC20VariableCriteriaIncentivePayload,
Expand Down Expand Up @@ -75,6 +76,7 @@ export const seed: Command<SeedResult | BoostConfig> = async function seed(

if (positionals.at(0) === 'erc20') {
let erc20 = new MockERC20({ config, account }, {});
// @ts-expect-error
await erc20.deploy();
return {
erc20: erc20.assertValidAddress(),
Expand Down Expand Up @@ -183,16 +185,20 @@ export const seed: Command<SeedResult | BoostConfig> = async function seed(

const incentives = await Promise.all(incentivePromises);

const boost = await core.createBoost({
const boostConfig: CreateBoostPayload = {
protocolFee: template.protocolFee,
maxParticipants: template.maxParticipants,
budget: budget,
action: core.EventAction(template.action as EventActionPayload),
validator: core.SignerValidator(template.validator),
action: core.EventAction(template.action),
allowList: await getAllowList(template, { core }),
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
incentives: incentives as any[],
});
incentives,
};

if (template.validator) {
boostConfig.validator = core.SignerValidator(template.validator);
}

const boost = await core.createBoost(boostConfig);
boostIds.push(boost.id.toString());
}

Expand Down Expand Up @@ -413,12 +419,10 @@ export const BoostSeedConfigSchema = z.object({
maxParticipants: z.coerce.bigint(),
budget: z.union([AddressSchema, ManagedBudgetSchema]),
action: z.union([AddressSchema, EventActionSchema]),
validator: z.union([AddressSchema, SignerValidatorSchema]),
allowList: z.union([
AddressSchema,
SimpleDenyListSchema,
SimpleAllowListSchema,
]),
validator: z.union([AddressSchema, SignerValidatorSchema]).optional(),
allowList: z
.union([AddressSchema, SimpleDenyListSchema, SimpleAllowListSchema])
.optional(),
incentives: z.array(
z.union([
AllowListIncentiveSchema,
Expand All @@ -435,6 +439,7 @@ async function getAllowList(
{ allowList }: z.infer<typeof BoostSeedConfigSchema>,
{ core }: { core: BoostCore },
): Promise<AllowList> {
if (!allowList) return core.OpenAllowList();
if (typeof allowList === 'string' && isAddress(allowList))
return await allowListFromAddress(
//@ts-expect-error i do what i want
Expand Down

0 comments on commit fa789d9

Please sign in to comment.