Skip to content

Commit abe901a

Browse files
committed
chore(sdk): flesh out boost payload dependencies
1 parent ddea55d commit abe901a

23 files changed

+865
-91
lines changed

packages/evm/artifacts/index.ts

+180-14
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ export enum StrategyType {
2323
RAFFLE = 2,
2424
}
2525

26+
export enum ERC1155StrategyType {
27+
POOL = 0,
28+
MINT = 1,
29+
}
30+
2631
export type Target = {
2732
isBase: boolean;
2833
instance: Address;
@@ -85,16 +90,24 @@ export interface SignerValidatorPayload {
8590
signers: Address[];
8691
}
8792

93+
export const prepareSignerValidatorPayload = ({
94+
signers
95+
}: SignerValidatorPayload) => {
96+
return encodeAbiParameters(
97+
[
98+
{ type: 'address[]', name: 'signers' },
99+
],
100+
[signers],
101+
);
102+
};
103+
88104
export function signerValidator({
89105
signers,
90106
}: SignerValidatorPayload): Target {
91107
return {
92108
isBase: true,
93109
instance: zeroAddress,
94-
parameters: encodeAbiParameters(
95-
[{ type: 'address[]', name: 'signers' }],
96-
[signers],
97-
),
110+
parameters: prepareSignerValidatorPayload({ signers })
98111
};
99112
}
100113

@@ -103,20 +116,56 @@ export interface SimpleAllowListPayload {
103116
allowed: Address[];
104117
}
105118

119+
export const prepareSimpleAllowListPayload = ({
120+
owner,
121+
allowed
122+
}: SimpleAllowListPayload) => {
123+
return encodeAbiParameters(
124+
[
125+
{ type: 'address', name: 'owner' },
126+
{ type: 'address[]', name: 'allowed' },
127+
],
128+
[owner, allowed],
129+
);
130+
};
131+
106132
export function simpleAllowList({
107133
owner,
108134
allowed,
109135
}: SimpleAllowListPayload): Target {
110136
return {
111137
isBase: true,
112138
instance: zeroAddress,
113-
parameters: encodeAbiParameters(
114-
[
115-
{ type: 'address', name: 'owner' },
116-
{ type: 'address[]', name: 'allowed' },
117-
],
118-
[owner, allowed],
119-
),
139+
parameters: prepareSimpleAllowListPayload({owner, allowed})
140+
};
141+
}
142+
143+
export interface SimpleDenyListPayload {
144+
owner: Address;
145+
allowed: Address[];
146+
}
147+
148+
export const prepareSimpleDenyListPayload = ({
149+
owner,
150+
allowed
151+
}: SimpleDenyListPayload) => {
152+
return encodeAbiParameters(
153+
[
154+
{ type: 'address', name: 'owner' },
155+
{ type: 'address[]', name: 'allowed' },
156+
],
157+
[owner, allowed],
158+
);
159+
};
160+
161+
export function simpleDenyList({
162+
owner,
163+
allowed,
164+
}: SimpleDenyListPayload): Target {
165+
return {
166+
isBase: true,
167+
instance: zeroAddress,
168+
parameters: prepareSimpleDenyListPayload({owner, allowed})
120169
};
121170
}
122171

@@ -126,6 +175,9 @@ export interface BoostPayload {
126175
validator: Target;
127176
allowList: Target;
128177
incentives: Target[];
178+
protocolFee?: bigint;
179+
referralFee?: bigint;
180+
maxParticipants?: bigint;
129181
owner: Address;
130182
}
131183

@@ -135,6 +187,9 @@ export function prepareBoostPayload({
135187
validator,
136188
allowList,
137189
incentives,
190+
protocolFee = 0n,
191+
referralFee = 0n,
192+
maxParticipants = 0n,
138193
owner,
139194
}: BoostPayload): Hex {
140195
return LibZip.cdCompress(
@@ -151,9 +206,9 @@ export function prepareBoostPayload({
151206
validator,
152207
allowList,
153208
incentives,
154-
protocolFee: 0n,
155-
referralFee: 0n,
156-
maxParticipants: 0n,
209+
protocolFee,
210+
referralFee,
211+
maxParticipants,
157212
owner,
158213
},
159214
],
@@ -247,6 +302,115 @@ export function prepareFungibleTransfer({
247302
);
248303
}
249304

305+
export interface PreparePointsIncentivePayload {
306+
venue: Address;
307+
selector: Hex;
308+
quantity: bigint;
309+
limit: bigint;
310+
}
311+
312+
export const preparePointsIncentivePayload = ({
313+
venue,
314+
selector,
315+
quantity,
316+
limit,
317+
}: PreparePointsIncentivePayload) => {
318+
return encodeAbiParameters(
319+
[
320+
{ type: 'address', name: 'venue' },
321+
{ type: 'bytes4', name: 'selector' },
322+
{ type: 'uint256', name: 'quantity' },
323+
{ type: 'uint256', name: 'limit' },
324+
],
325+
[venue,
326+
selector,
327+
quantity,
328+
limit],
329+
);
330+
};
331+
332+
export interface PrepareCGDAIncentivePayload {
333+
asset: Address;
334+
initialReward: bigint;
335+
rewardDecay: bigint;
336+
rewardBoost: bigint;
337+
totalBudget: bigint;
338+
}
339+
340+
export const prepareCGDAIncentivePayload = ({
341+
asset,
342+
initialReward,
343+
rewardDecay,
344+
rewardBoost,
345+
totalBudget
346+
}: PrepareCGDAIncentivePayload) => {
347+
return encodeAbiParameters(
348+
[
349+
{ type: 'address', name: 'asset' },
350+
{ type: 'uint256', name: 'initialReward' },
351+
{ type: 'uint256', name: 'rewardDecay' },
352+
{ type: 'uint256', name: 'rewardBoost' },
353+
{ type: 'uint256', name: 'totalBudget' },
354+
],
355+
[asset,
356+
initialReward,
357+
rewardDecay,
358+
rewardBoost,
359+
totalBudget],
360+
);
361+
};
362+
363+
export interface PrepareERC1155IncentivePayload {
364+
asset: Address;
365+
strategy: ERC1155StrategyType;
366+
tokenId: bigint;
367+
limit: bigint;
368+
extraData: Hex;
369+
}
370+
371+
export const prepareERC1155IncentivePayload = ({
372+
asset,
373+
strategy,
374+
tokenId,
375+
limit,
376+
extraData
377+
}: PrepareERC1155IncentivePayload) => {
378+
return encodeAbiParameters(
379+
[
380+
{ type: 'address', name: 'asset' },
381+
{ type: 'uint8', name: 'strategy' },
382+
{ type: 'uint256', name: 'tokenId' },
383+
{ type: 'uint256', name: 'limit' },
384+
{ type: 'bytes', name: 'extraData' },
385+
],
386+
[asset,
387+
strategy,
388+
tokenId,
389+
limit,
390+
extraData],
391+
);
392+
};
393+
394+
export interface PrepareAllowListIncentivePayload {
395+
allowList: Address
396+
limit: bigint
397+
}
398+
399+
export const prepareAllowListIncentivePayload = ({
400+
allowList,
401+
limit
402+
}: PrepareAllowListIncentivePayload) => {
403+
return encodeAbiParameters(
404+
[
405+
{ type: 'address', name: 'allowList' },
406+
{ type: 'uint256', name: 'limit' },
407+
],
408+
[allowList,
409+
limit
410+
],
411+
);
412+
};
413+
250414
export interface PrepareERC20IncentivePayload {
251415
asset: Address;
252416
strategy: StrategyType;
@@ -278,6 +442,8 @@ export interface ContractActionPayload {
278442
value: bigint;
279443
}
280444

445+
export type ERC721MintActionPayload = ContractActionPayload
446+
281447
export interface PrepareSimpleBudgetPayload {
282448
owner: Address;
283449
authorized: Address[];

0 commit comments

Comments
 (0)