Skip to content

Commit 015e29e

Browse files
[ADHOC] feat(evm,sdk): BREAKING erc20variablecriteria v2 upgrade (#425)
Co-authored-by: Jonathan Diep <[email protected]>
1 parent a0f4430 commit 015e29e

31 files changed

+855
-2288
lines changed

.changeset/pre.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"mode": "pre",
3+
"tag": "canary",
4+
"initialVersions": {
5+
"agora-vote": "1.0.1-alpha.3",
6+
"delegate-action": "1.0.1-alpha.3",
7+
"ens-register": "1.0.1-alpha.3",
8+
"swap-specific-dex": "1.0.1-alpha.3",
9+
"zora-mint": "1.0.1-alpha.3",
10+
"@boostxyz/cli": "5.1.0",
11+
"@boostxyz/evm": "6.0.4",
12+
"@boostxyz/sdk": "6.1.3",
13+
"@boostxyz/signatures": "1.3.0",
14+
"@boostxyz/test": "1.0.1-alpha.3"
15+
},
16+
"changesets": []
17+
}

.changeset/warm-rivers-act.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@boostxyz/cli": major
3+
"@boostxyz/evm": major
4+
"@boostxyz/sdk": major
5+
---
6+
7+
**BREAKING** Append v2 to ERC20VariableCriteria and ERC20PeggedVariableCriteria to force upgrades to new variable criteria functionality

packages/cli/src/commands/deploy.ts

+10-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import VestingBudgetArtifact from '@boostxyz/evm/artifacts/contracts/budgets/Ves
99
import AllowListIncentiveArtifact from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';
1010
import CGDAIncentiveArtifact from '@boostxyz/evm/artifacts/contracts/incentives/CGDAIncentive.sol/CGDAIncentive.json';
1111
import ERC20IncentiveArtifact from '@boostxyz/evm/artifacts/contracts/incentives/ERC20Incentive.sol/ERC20Incentive.json';
12-
import ERC20VariableCriteriaIncentiveArtifact from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentive.sol/ERC20VariableCriteriaIncentive.json';
12+
import ERC20VariableCriteriaIncentiveV2Artifact from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentiveV2.sol/ERC20VariableCriteriaIncentiveV2.json';
1313
import ERC20VariableIncentiveArtifact from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableIncentive.sol/ERC20VariableIncentive.json';
1414
import ERC1155IncentiveArtifact from '@boostxyz/evm/artifacts/contracts/incentives/ERC1155Incentive.sol/ERC1155Incentive.json';
1515
import PointsIncentiveArtifact from '@boostxyz/evm/artifacts/contracts/incentives/PointsIncentive.sol/PointsIncentive.json';
@@ -22,7 +22,7 @@ import {
2222
CGDAIncentive,
2323
type DeployableOptions,
2424
ERC20Incentive,
25-
ERC20VariableCriteriaIncentive,
25+
ERC20VariableCriteriaIncentiveV2,
2626
ERC20VariableIncentive,
2727
EventAction,
2828
LimitedSignerValidator,
@@ -65,7 +65,7 @@ export type DeployResult = {
6565
CGDA_INCENTIVE_BASE: string;
6666
ERC20_INCENTIVE_BASE: string;
6767
ERC20_VARIABLE_INCENTIVE_BASE: string;
68-
ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE: string;
68+
ERC20_VARIABLE_CRITERIA_INCENTIVE_V2_BASE: string;
6969
ERC1155_INCENTIVE_BASE: string;
7070
POINTS_INCENTIVE_BASE: string;
7171
SIGNER_VALIDATOR_BASE: string;
@@ -245,11 +245,11 @@ export const deploy: Command<DeployResult> = async function deploy(
245245
}),
246246
);
247247

248-
const erc20VariableCriteriaIncentiveBase = await getDeployedContractAddress(
248+
const erc20VariableCriteriaIncentiveV2Base = await getDeployedContractAddress(
249249
config,
250250
deployContract(config, {
251-
abi: ERC20VariableCriteriaIncentiveArtifact.abi,
252-
bytecode: ERC20VariableCriteriaIncentiveArtifact.bytecode as Hex,
251+
abi: ERC20VariableCriteriaIncentiveV2Artifact.abi,
252+
bytecode: ERC20VariableCriteriaIncentiveV2Artifact.bytecode as Hex,
253253
account,
254254
}),
255255
);
@@ -327,9 +327,9 @@ export const deploy: Command<DeployResult> = async function deploy(
327327
[chainId]: erc20VariableIncentiveBase,
328328
} as Record<number, Address>;
329329
},
330-
ERC20VariableCriteriaIncentive: class TERC20VariableCriteriaIncentive extends ERC20VariableCriteriaIncentive {
330+
ERC20VariableCriteriaIncentiveV2: class TERC20VariableCriteriaIncentiveV2 extends ERC20VariableCriteriaIncentiveV2 {
331331
public static override bases: Record<number, Address> = {
332-
[chainId]: erc20VariableCriteriaIncentiveBase,
332+
[chainId]: erc20VariableCriteriaIncentiveV2Base,
333333
} as Record<number, Address>;
334334
},
335335
// ERC1155Incentive: class TERC1155Incentive extends ERC1155Incentive {
@@ -374,7 +374,8 @@ export const deploy: Command<DeployResult> = async function deploy(
374374
CGDA_INCENTIVE_BASE: cgdaIncentiveBase,
375375
ERC20_INCENTIVE_BASE: erc20IncentiveBase,
376376
ERC20_VARIABLE_INCENTIVE_BASE: erc20VariableIncentiveBase,
377-
ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE: erc20VariableCriteriaIncentiveBase,
377+
ERC20_VARIABLE_CRITERIA_INCENTIVE_V2_BASE:
378+
erc20VariableCriteriaIncentiveV2Base,
378379
ERC1155_INCENTIVE_BASE: erc1155IncentiveBase,
379380
POINTS_INCENTIVE_BASE: pointsIncentiveBase,
380381
SIGNER_VALIDATOR_BASE: signerValidatorBase,

packages/cli/src/commands/seed.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import {
1313
type DeployableOptions,
1414
type DeployablePayloadOrAddress,
1515
type ERC20IncentivePayload,
16-
type ERC20PeggedVariableCriteriaIncentivePayload,
17-
type ERC20VariableCriteriaIncentivePayload,
16+
type ERC20PeggedVariableCriteriaIncentiveV2Payload,
17+
type ERC20VariableCriteriaIncentiveV2Payload,
1818
type ERC20VariableIncentivePayload,
1919
type EventActionPayload,
2020
FilterType,
@@ -183,22 +183,22 @@ export const seed: Command<SeedResult | BoostConfig> = async function seed(
183183
account,
184184
});
185185
return core.ERC20Incentive(incentive);
186-
case 'ERC20VariableCriteriaIncentive':
186+
case 'ERC20VariableCriteriaIncentiveV2':
187187
amount += incentive.limit;
188188
if (incentive.shouldMintAndAllocate)
189189
await fundBudgetForIncentive(budget, amount, incentive.asset, {
190190
config,
191191
account,
192192
});
193-
return core.ERC20VariableCriteriaIncentive(incentive);
194-
case 'ERC20PeggedVariableCriteriaIncentive':
193+
return core.ERC20VariableCriteriaIncentiveV2(incentive);
194+
case 'ERC20PeggedVariableCriteriaIncentiveV2':
195195
amount += incentive.limit;
196196
if (incentive.shouldMintAndAllocate)
197197
await fundBudgetForIncentive(budget, amount, incentive.asset, {
198198
config,
199199
account,
200200
});
201-
return core.ERC20PeggedVariableCriteriaIncentive(incentive);
201+
return core.ERC20PeggedVariableCriteriaIncentiveV2(incentive);
202202
case 'ERC20VariableIncentive':
203203
amount += incentive.limit;
204204
if (incentive.shouldMintAndAllocate)
@@ -350,10 +350,10 @@ export type BoostConfig = {
350350
| (Identifiable<ERC20IncentivePayload> & {
351351
shouldMintAndAllocate?: boolean;
352352
})
353-
| (Identifiable<ERC20PeggedVariableCriteriaIncentivePayload> & {
353+
| (Identifiable<ERC20PeggedVariableCriteriaIncentiveV2Payload> & {
354354
shouldMintAndAllocate?: boolean;
355355
})
356-
| (Identifiable<ERC20VariableCriteriaIncentivePayload> & {
356+
| (Identifiable<ERC20VariableCriteriaIncentiveV2Payload> & {
357357
shouldMintAndAllocate?: boolean;
358358
})
359359
| (Identifiable<ERC20VariableIncentivePayload> & {
@@ -453,8 +453,8 @@ export const IncentiveCriteriaSchema = z.object({
453453
valueType: z.nativeEnum(ValueType),
454454
});
455455

456-
export const ERC20VariableCriteriaIncentiveSchema = z.object({
457-
type: z.literal('ERC20VariableCriteriaIncentive'),
456+
export const ERC20VariableCriteriaIncentiveV2Schema = z.object({
457+
type: z.literal('ERC20VariableCriteriaIncentiveV2'),
458458
asset: AddressSchema,
459459
shouldMintAndAllocate: z.boolean().optional().default(false),
460460
reward: z.coerce.bigint(),
@@ -463,8 +463,8 @@ export const ERC20VariableCriteriaIncentiveSchema = z.object({
463463
criteria: IncentiveCriteriaSchema,
464464
});
465465

466-
export const ERC20PeggedVariableCriteriaIncentiveSchema = z.object({
467-
type: z.literal('ERC20PeggedVariableCriteriaIncentive'),
466+
export const ERC20PeggedVariableCriteriaIncentiveV2Schema = z.object({
467+
type: z.literal('ERC20PeggedVariableCriteriaIncentiveV2'),
468468
asset: AddressSchema,
469469
shouldMintAndAllocate: z.boolean().optional().default(false),
470470
maxReward: z.coerce.bigint(),
@@ -513,8 +513,8 @@ export const BoostSeedConfigSchema = z.object({
513513
z.union([
514514
AllowListIncentiveSchema,
515515
ERC20IncentiveSchema,
516-
ERC20VariableCriteriaIncentiveSchema,
517-
ERC20PeggedVariableCriteriaIncentiveSchema,
516+
ERC20VariableCriteriaIncentiveV2Schema,
517+
ERC20PeggedVariableCriteriaIncentiveV2Schema,
518518
ERC20VariableIncentiveSchema,
519519
CGDAIncentiveSchema,
520520
PointsIncentiveSchema,
@@ -651,10 +651,10 @@ export async function getCreateBoostPayloadFromBoostConfig(
651651
return core.PointsIncentive(incentive);
652652
case 'ERC20Incentive':
653653
return core.ERC20Incentive(incentive);
654-
case 'ERC20VariableCriteriaIncentive':
655-
return core.ERC20VariableCriteriaIncentive(incentive);
656-
case 'ERC20PeggedVariableCriteriaIncentive':
657-
return core.ERC20PeggedVariableCriteriaIncentive(incentive);
654+
case 'ERC20VariableCriteriaIncentiveV2':
655+
return core.ERC20VariableCriteriaIncentiveV2(incentive);
656+
case 'ERC20PeggedVariableCriteriaIncentiveV2':
657+
return core.ERC20PeggedVariableCriteriaIncentiveV2(incentive);
658658
case 'ERC20VariableIncentive':
659659
return core.ERC20VariableIncentive(incentive);
660660
case 'CGDAIncentive':

packages/evm/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ by the Signer.
9393
`LimitedSignerValidator` hard caps the claim quantity for a given incentive
9494
regardless of the validity of individual action requests presented to the signer.
9595

96-
Most incentives hard-cap each address to one claim, but `ERC20PeggedVariableCriteriaIncentive`
96+
Most incentives hard-cap each address to one claim, but `ERC20PeggedVariableCriteriaIncentiveV2`
9797
and `ERC20VariableIncentive` do not, by design. `ERC1155Incentive` catalogs
9898
individual claims by transaction hash, as opposed to claimant.

0 commit comments

Comments
 (0)