@merkl/api 0.16.31 → 0.16.33

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 (39) hide show
  1. package/dist/src/eden/index.d.ts +308 -63
  2. package/dist/src/index.d.ts +64 -19
  3. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +6 -2
  4. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/GenericProcessor.d.ts +16 -1
  5. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/GenericProcessor.js +84 -10
  6. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/ownerFinder.js +1 -0
  7. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -2
  8. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +3 -3
  9. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/HanjiVaultProcessor.d.ts +43 -0
  10. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/HanjiVaultProcessor.js +58 -0
  11. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/curveNPoolProcessor.js +0 -1
  12. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/processorMapping.js +2 -2
  13. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.d.ts +1 -1
  14. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +17 -19
  15. package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +13 -2
  16. package/dist/src/modules/v4/boost/boost.controller.d.ts +0 -19
  17. package/dist/src/modules/v4/boost/boost.controller.js +1 -2
  18. package/dist/src/modules/v4/boost/boost.service.d.ts +0 -4
  19. package/dist/src/modules/v4/boost/boost.service.js +0 -23
  20. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +64 -0
  21. package/dist/src/modules/v4/campaign/campaign.controller.js +20 -0
  22. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +37 -0
  23. package/dist/src/modules/v4/campaign/campaign.repository.js +7 -0
  24. package/dist/src/modules/v4/campaign/campaign.service.d.ts +37 -0
  25. package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -1
  26. package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +69 -318
  27. package/dist/src/modules/v4/programPayload/programPayload.repository.js +237 -54
  28. package/dist/src/modules/v4/router.d.ts +64 -19
  29. package/dist/src/utils/decodeCalls.js +7 -1
  30. package/dist/src/utils/encodeCalls.js +17 -1
  31. package/dist/src/utils/generateCardName.d.ts +3 -0
  32. package/dist/src/utils/generateCardName.js +25 -3
  33. package/dist/src/utils/generateIcons.js +5 -0
  34. package/dist/tsconfig.package.tsbuildinfo +1 -1
  35. package/package.json +1 -1
  36. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/StakingProcessor.d.ts +0 -41
  37. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/StakingProcessor.js +0 -70
  38. package/dist/src/libs/campaigns/utils/getLastEligibilityRatio.d.ts +0 -2
  39. package/dist/src/libs/campaigns/utils/getLastEligibilityRatio.js +0 -65
@@ -25,6 +25,17 @@ export class GenericProcessor {
25
25
  round3: [],
26
26
  round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
27
27
  };
28
+ stakingRounds = {
29
+ round1: [
30
+ { key: "lockNFT", call: "lockNFT", target: "stakingContract", optional: true },
31
+ { key: "eip712DomainName", call: "eip712DomainName", target: "stakingContract", optional: true },
32
+ { key: "stakingName", call: "name", target: "stakingContract", optional: true },
33
+ { key: "stakingSymbol", call: "symbol", target: "stakingContract", optional: true },
34
+ ],
35
+ round2: [{ key: "stakingSymbol", call: "symbol", target: "lockNFT", optional: true }],
36
+ round3: [],
37
+ round4: [],
38
+ };
28
39
  debug = false;
29
40
  processingRound1(_typeInfo) { }
30
41
  processingRound2(_typeInfo, _campaign) { }
@@ -60,48 +71,66 @@ export class GenericProcessor {
60
71
  computeRound1(type, typeInfo) {
61
72
  typeInfo = { type, ...tokenTypeToProtocol[type], ...typeInfo };
62
73
  this.processingRound1(typeInfo);
74
+ let calls = this.encodeNextRound(Round.one, type, typeInfo);
75
+ if (typeInfo.isStaking === "true") {
76
+ calls = calls.concat(this.encodeStakingNextRound(Round.one, type, typeInfo));
77
+ }
63
78
  if (this.debug) {
64
79
  console.log("Round 1", {
65
80
  type: type,
66
- calls: this.encodeNextRound(Round.one, type, typeInfo),
81
+ calls,
67
82
  typeInfo,
68
83
  });
69
84
  }
70
85
  return {
71
86
  type: type,
72
- calls: this.encodeNextRound(Round.one, type, typeInfo),
87
+ calls,
73
88
  typeInfo,
74
89
  };
75
90
  }
76
91
  computeRound2(index, type, typeInfo, calls, campaign) {
77
92
  this.decodePreviousRound(Round.one, calls, typeInfo, type, index);
93
+ if (typeInfo.isStaking === "true") {
94
+ this.decodePreviousStakingRound(Round.one, calls, typeInfo, type, index + this.rounds.round1.length);
95
+ }
78
96
  this.processingRound2(typeInfo, campaign);
97
+ let nextCalls = this.encodeNextRound(Round.two, type, typeInfo);
98
+ if (typeInfo.isStaking === "true") {
99
+ nextCalls = nextCalls.concat(this.encodeStakingNextRound(Round.two, type, typeInfo));
100
+ }
79
101
  if (this.debug) {
80
102
  console.log("Round 2", {
81
103
  type: type,
82
- calls: this.encodeNextRound(Round.two, type, typeInfo),
104
+ calls: nextCalls,
83
105
  typeInfo,
84
106
  });
85
107
  }
86
108
  return {
87
109
  type: type,
88
- calls: this.encodeNextRound(Round.two, type, typeInfo),
110
+ calls: nextCalls,
89
111
  typeInfo,
90
112
  };
91
113
  }
92
114
  computeRound3(index, type, typeInfo, calls) {
93
115
  this.decodePreviousRound(Round.two, calls, typeInfo, type, index);
116
+ if (typeInfo.isStaking === "true") {
117
+ this.decodePreviousStakingRound(Round.two, calls, typeInfo, type, index + this.rounds.round2.length);
118
+ }
94
119
  this.processingRound3(typeInfo);
120
+ let nextCalls = this.encodeNextRound(Round.three, type, typeInfo);
121
+ if (typeInfo.isStaking === "true") {
122
+ nextCalls = nextCalls.concat(this.encodeStakingNextRound(Round.three, type, typeInfo));
123
+ }
95
124
  if (this.debug) {
96
125
  console.log("Round 3", {
97
126
  type: type,
98
- calls: this.encodeNextRound(Round.three, type, typeInfo),
127
+ calls: nextCalls,
99
128
  typeInfo,
100
129
  });
101
130
  }
102
131
  return {
103
132
  type: type,
104
- calls: this.encodeNextRound(Round.three, type, typeInfo),
133
+ calls: nextCalls,
105
134
  typeInfo,
106
135
  };
107
136
  }
@@ -109,19 +138,24 @@ export class GenericProcessor {
109
138
  const blacklistedLiquidityCalls = this.generateBlackListCall(type, typeInfo, campaign);
110
139
  const whitelistedLiquidityCalls = this.generateWhitelistCall(type, typeInfo, campaign);
111
140
  this.decodePreviousRound(Round.three, calls, typeInfo, type, index);
141
+ if (typeInfo.isStaking === "true") {
142
+ this.decodePreviousStakingRound(Round.three, calls, typeInfo, type, index + this.rounds.round3.length);
143
+ }
112
144
  this.processingRound4(typeInfo);
145
+ let nextCalls = this.encodeNextRound(Round.four, type, typeInfo);
146
+ if (typeInfo.isStaking === "true") {
147
+ nextCalls = nextCalls.concat(this.encodeStakingNextRound(Round.four, type, typeInfo));
148
+ }
113
149
  if (this.debug) {
114
150
  console.log("Round 4", {
115
151
  type: type,
116
- calls: this.encodeNextRound(Round.four, type, typeInfo),
152
+ calls: nextCalls,
117
153
  typeInfo,
118
154
  });
119
155
  }
120
156
  return {
121
157
  type: type,
122
- calls: whitelistedLiquidityCalls
123
- .concat(blacklistedLiquidityCalls)
124
- .concat(this.encodeNextRound(Round.four, type, typeInfo)),
158
+ calls: whitelistedLiquidityCalls.concat(blacklistedLiquidityCalls).concat(nextCalls),
125
159
  typeInfo: {
126
160
  ...typeInfo,
127
161
  },
@@ -133,6 +167,9 @@ export class GenericProcessor {
133
167
  typeInfo.blacklistedSupply = this.decodeListedSupply(index, campaign.campaignParameters.decimalsTargetToken, campaign.campaignParameters.blacklist, calls);
134
168
  index = index + campaign.campaignParameters.blacklist.length;
135
169
  this.decodePreviousRound(Round.four, calls, typeInfo, type, index);
170
+ if (typeInfo.isStaking === "true") {
171
+ this.decodePreviousStakingRound(Round.four, calls, typeInfo, type, index + this.rounds.round4.length);
172
+ }
136
173
  const outputInfo = (await this.processingRound5(index, type, typeInfo, calls, campaign, pricer));
137
174
  if (this.debug) {
138
175
  console.log("Round 5", {
@@ -216,6 +253,20 @@ export class GenericProcessor {
216
253
  this.decodeRound(this.rounds.round4, index, calls, type, data);
217
254
  }
218
255
  }
256
+ decodePreviousStakingRound(round, calls, data, type, index) {
257
+ if (round === Round.one) {
258
+ this.decodeRound(this.stakingRounds.round1, index, calls, type, data);
259
+ }
260
+ if (round === Round.two) {
261
+ this.decodeRound(this.stakingRounds.round2, index, calls, type, data);
262
+ }
263
+ if (round === Round.three) {
264
+ this.decodeRound(this.stakingRounds.round3, index, calls, type, data);
265
+ }
266
+ if (round === Round.four) {
267
+ this.decodeRound(this.stakingRounds.round4, index, calls, type, data);
268
+ }
269
+ }
219
270
  encodeRound(round, callInfo, type) {
220
271
  return round
221
272
  .map(({ call, target, metaData, optional }) => {
@@ -252,4 +303,27 @@ export class GenericProcessor {
252
303
  }
253
304
  return calls;
254
305
  }
306
+ encodeStakingNextRound(round, type, data) {
307
+ const keys = Object.keys(data);
308
+ const callInfo = keys.reduce((acc, key) => {
309
+ if (data[key]) {
310
+ acc[key] = data[key];
311
+ }
312
+ return acc;
313
+ }, {});
314
+ let calls = [];
315
+ if (round === Round.one) {
316
+ calls = this.encodeRound(this.stakingRounds.round1, callInfo, type);
317
+ }
318
+ if (round === Round.two) {
319
+ calls = this.encodeRound(this.stakingRounds.round2, callInfo, type);
320
+ }
321
+ if (round === Round.three) {
322
+ calls = this.encodeRound(this.stakingRounds.round3, callInfo, type);
323
+ }
324
+ if (round === Round.four) {
325
+ calls = this.encodeRound(this.stakingRounds.round4, callInfo, type);
326
+ }
327
+ return calls;
328
+ }
255
329
  }
@@ -2,6 +2,7 @@ import { tokenType } from "./tokenType";
2
2
  const ownerAddresses = {
3
3
  "0xbF7E49483881C76487b0989CD7d9A8239B20CA41": tokenType.curve_2,
4
4
  "0x42a856dbEBB97AbC1269EAB32f3bb40C15102819": tokenType.satlayer,
5
+ "0x4C911bf7A008C497719CBEb1a376f1cEc9e2c1d6": tokenType.hanji_liquidity_vault_token,
5
6
  };
6
7
  export function getTypeFromOwnerAddress(address) {
7
8
  if (ownerAddresses[address]) {
@@ -61,7 +61,6 @@ export declare enum tokenType {
61
61
  pancakeswap = "pancakeswap",
62
62
  tempestStaking = "tempestStaking",
63
63
  holdstation = "holdstation",
64
- staking = "staking",
65
64
  noLinkVault = "noLinkVault",
66
65
  cpmmGamma = "cpmmGamma",
67
66
  crosscurve = "crosscurve",
@@ -89,7 +88,8 @@ export declare enum tokenType {
89
88
  spectra_yt = "spectra_yt",
90
89
  hourglass = "hourglass",
91
90
  katana = "katana",
92
- balancerV3 = "balancerV3"
91
+ balancerV3 = "balancerV3",
92
+ hanji_liquidity_vault_token = "hanji_liquidity_vault_token"
93
93
  }
94
94
  export declare const tokenTypeToProtocol: {
95
95
  [key in tokenType]: {
@@ -62,7 +62,6 @@ export var tokenType;
62
62
  tokenType["pancakeswap"] = "pancakeswap";
63
63
  tokenType["tempestStaking"] = "tempestStaking";
64
64
  tokenType["holdstation"] = "holdstation";
65
- tokenType["staking"] = "staking";
66
65
  tokenType["noLinkVault"] = "noLinkVault";
67
66
  tokenType["cpmmGamma"] = "cpmmGamma";
68
67
  tokenType["crosscurve"] = "crosscurve";
@@ -91,6 +90,7 @@ export var tokenType;
91
90
  tokenType["hourglass"] = "hourglass";
92
91
  tokenType["katana"] = "katana";
93
92
  tokenType["balancerV3"] = "balancerV3";
93
+ tokenType["hanji_liquidity_vault_token"] = "hanji_liquidity_vault_token";
94
94
  })(tokenType || (tokenType = {}));
95
95
  export const tokenTypeToProtocol = {
96
96
  [tokenType.aave_borrowing]: { protocol: "Aave", action: OpportunityAction.BORROW },
@@ -154,12 +154,11 @@ export const tokenTypeToProtocol = {
154
154
  [tokenType.pancakeswap]: { protocol: "PancakeSwap V2", action: OpportunityAction.POOL },
155
155
  [tokenType.tempestStaking]: { protocol: "Tempest", action: OpportunityAction.HOLD },
156
156
  [tokenType.holdstation]: { protocol: "HoldStation", action: OpportunityAction.HOLD },
157
- [tokenType.staking]: { protocol: "Staking", action: OpportunityAction.HOLD },
158
157
  [tokenType.noLinkVault]: { protocol: "NoLinkVault", action: OpportunityAction.HOLD },
159
158
  [tokenType.cpmmGamma]: { protocol: "GammaSwap", action: OpportunityAction.POOL },
160
159
  [tokenType.crosscurve]: { protocol: "CrossCurve", action: OpportunityAction.POOL },
161
160
  [tokenType.curveNPool]: { protocol: "Curve", action: OpportunityAction.POOL },
162
- [tokenType.vicuna]: { protocol: "Vicuna", action: OpportunityAction.HOLD },
161
+ [tokenType.vicuna]: { protocol: "Vicuna", action: OpportunityAction.POOL },
163
162
  [tokenType.traderJoe]: { protocol: "Trader Joe", action: OpportunityAction.HOLD },
164
163
  [tokenType.avalon_lending]: { protocol: "Avalon", action: OpportunityAction.HOLD },
165
164
  [tokenType.avalon_borrowing]: { protocol: "Avalon", action: OpportunityAction.HOLD },
@@ -182,4 +181,5 @@ export const tokenTypeToProtocol = {
182
181
  [tokenType.hourglass]: { protocol: "Hourglass", action: OpportunityAction.HOLD },
183
182
  [tokenType.katana]: { protocol: "Katana", action: OpportunityAction.POOL },
184
183
  [tokenType.balancerV3]: { protocol: "Balancer", action: OpportunityAction.POOL },
184
+ [tokenType.hanji_liquidity_vault_token]: { protocol: "Hanji", action: OpportunityAction.POOL },
185
185
  };
@@ -0,0 +1,43 @@
1
+ import type { Pricer } from "../../../../../utils/pricer";
2
+ import { type Campaign, type CampaignParameters } from "@sdk";
3
+ import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
4
+ import type { tokenType, tokenTypeStruct } from "../helpers/tokenType";
5
+ type callType = {
6
+ key: keyof dataRawHanjiN;
7
+ call: string;
8
+ target: keyof callKeysHanjiN;
9
+ metaData?: keyof callKeysHanjiN | string;
10
+ optional?: boolean;
11
+ };
12
+ type callKeysHanjiN = mandatoryCallKeys & {
13
+ owner: string;
14
+ [key: `token${number}`]: string;
15
+ [key: `symbolToken${number}`]: string;
16
+ [key: `decimalsToken${number}`]: string;
17
+ [key: `balanceToken${number}`]: string;
18
+ [key: `${number}`]: string;
19
+ name: string;
20
+ helper: string;
21
+ tvl: string;
22
+ };
23
+ type dataRawHanjiN = callKeysHanjiN & {
24
+ numberTokens: number;
25
+ };
26
+ type dataTypeHanjiN = dataType & {
27
+ numberTokens: number;
28
+ tvl: number;
29
+ };
30
+ export declare class HanjiVaultProcessor extends GenericProcessor<callKeysHanjiN, dataRawHanjiN, dataTypeHanjiN> {
31
+ rounds: {
32
+ round1: callType[];
33
+ round2: callType[];
34
+ round3: callType[];
35
+ round4: callType[];
36
+ };
37
+ processingRound2(typeInfo: dataRawHanjiN): void;
38
+ processingRound3(typeInfo: dataRawHanjiN): void;
39
+ computeRound3(index: number, type: tokenType, typeInfo: dataRawHanjiN, calls: string[]): tokenTypeStruct;
40
+ computeRound4(index: number, type: tokenType, typeInfo: dataRawHanjiN, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
41
+ processingRound5(_index: number, type: tokenType, typeInfo: dataRawHanjiN, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeHanjiN>;
42
+ }
43
+ export {};
@@ -0,0 +1,58 @@
1
+ import { generateCardName } from "../../../../../utils/generateCardName";
2
+ import { BN2Number } from "@sdk";
3
+ import { GenericProcessor } from "../GenericProcessor";
4
+ export class HanjiVaultProcessor extends GenericProcessor {
5
+ rounds = {
6
+ round1: [{ key: "numberTokens", call: "getTokensCount", target: "owner" }],
7
+ round2: [],
8
+ round3: [],
9
+ round4: [
10
+ { key: "tvl", call: "getTotalValue", target: "helper", metaData: "owner" },
11
+ { key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
12
+ ],
13
+ };
14
+ // override computeRound1(): void {}
15
+ processingRound2(typeInfo) {
16
+ typeInfo.helper = "0x6b285F02DE1a48B3D58Ab65759494f8ab83cF64d";
17
+ typeInfo.numberTokens = Number(typeInfo.numberTokens);
18
+ for (let i = 0; i < typeInfo.numberTokens; i++) {
19
+ typeInfo[`${i}`] = i.toString();
20
+ this.rounds.round2 = this.rounds.round2.concat([
21
+ { key: `token${i}`, call: "tokens", target: "owner", metaData: i.toString() },
22
+ ]);
23
+ }
24
+ }
25
+ processingRound3(typeInfo) {
26
+ for (let i = 0; i < typeInfo.numberTokens; i++) {
27
+ this.rounds.round3 = this.rounds.round3.concat([{ key: `symbolToken${i}`, call: "symbol", target: `token${i}` }]);
28
+ }
29
+ }
30
+ computeRound3(index, type, typeInfo, calls) {
31
+ for (let i = 0; i < typeInfo.numberTokens; i++) {
32
+ this.rounds.round2 = this.rounds.round2.concat([
33
+ { key: `token${i}`, call: "tokens", target: "tokenAddress", metaData: i.toString() },
34
+ ]);
35
+ }
36
+ return super.computeRound3(index, type, typeInfo, calls);
37
+ }
38
+ computeRound4(index, type, typeInfo, calls, campaign) {
39
+ for (let i = 0; i < typeInfo.numberTokens; i++) {
40
+ this.rounds.round3 = this.rounds.round3.concat([{ key: `symbolToken${i}`, call: "symbol", target: `token${i}` }]);
41
+ }
42
+ return super.computeRound4(index, type, typeInfo, calls, campaign);
43
+ }
44
+ async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
45
+ const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
46
+ const tvl = BN2Number(typeInfo.tvl, 18);
47
+ const priceTargetToken = tvl / totalSupply;
48
+ return {
49
+ ...typeInfo,
50
+ totalSupply,
51
+ tvl,
52
+ whitelistedSupplyTargetToken,
53
+ blacklistedSupply,
54
+ priceTargetToken,
55
+ cardName: generateCardName(type, typeInfo, campaign),
56
+ };
57
+ }
58
+ }
@@ -62,7 +62,6 @@ export class CurveNPoolProcessor extends GenericProcessor {
62
62
  hardcodedSymbol = "USDC";
63
63
  for (let i = 0; i < typeInfo.numberTokens; i++) {
64
64
  const symbol = typeInfo[`symbolToken${i}`];
65
- const parsedSymbol = symbol.split("_")[0].slice(1);
66
65
  let price = (await pricer.get({ symbol: symbol })) ?? 0;
67
66
  if (price === 0) {
68
67
  // For cross curve
@@ -18,6 +18,7 @@ import { FluidProcessor } from "./FluidProcessor";
18
18
  import { FraxProcessor } from "./FraxProcessor";
19
19
  import { GammaProcessor } from "./GammaProcessor";
20
20
  import { GearboxProcessor } from "./GearboxProcessor";
21
+ import { HanjiVaultProcessor } from "./HanjiVaultProcessor";
21
22
  import { HoldStationProcessor } from "./HoldStationProcessor";
22
23
  import { HourglassProcessor } from "./HourglassProcessor";
23
24
  import { MaverickBPProcessor } from "./MaverickBPProcessor";
@@ -31,7 +32,6 @@ import { SatlayerProcessor } from "./Satlayer";
31
32
  import { SpectraProcessor } from "./SpectraProcessor";
32
33
  import { SpectraYTProcessor } from "./SpectraYTProcessor";
33
34
  import { SpliceProcessor } from "./SpliceProcessor";
34
- import { StakingProcessor } from "./StakingProcessor";
35
35
  import { SturdySiloProcessor } from "./SturdySiloProcessor";
36
36
  import { TempestVaultProcessor } from "./TempestVaultProcessor";
37
37
  import { TorosProcessor } from "./TorosProcessor";
@@ -102,7 +102,6 @@ export const processorMapping = {
102
102
  [tokenType.pancakeswap]: UniswapProcessor,
103
103
  [tokenType.tempestStaking]: TempestVaultProcessor,
104
104
  [tokenType.holdstation]: HoldStationProcessor,
105
- [tokenType.staking]: StakingProcessor,
106
105
  [tokenType.noLinkVault]: NoLinkVaultProcessor,
107
106
  [tokenType.cpmmGamma]: GammaProcessor,
108
107
  [tokenType.venus]: AssetProcessor,
@@ -132,4 +131,5 @@ export const processorMapping = {
132
131
  [tokenType.hourglass]: HourglassProcessor,
133
132
  [tokenType.katana]: UniswapProcessor,
134
133
  [tokenType.balancerV3]: BalancerV3PoolProcessor,
134
+ [tokenType.hanji_liquidity_vault_token]: HanjiVaultProcessor,
135
135
  };
@@ -1,3 +1,3 @@
1
- import { type Campaign, type CampaignParameters, type ResultDto } from "@sdk";
1
+ import type { Campaign, CampaignParameters, ResultDto } from "@sdk";
2
2
  import { type tokenTypeStruct } from "./helpers/tokenType";
3
3
  export declare function getTokenTypeRound1(calls: ResultDto[], targetToken: string, index: number, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
@@ -1,5 +1,4 @@
1
1
  import { decodeCall, decodeReturnValue } from "../../../../utils/decodeCalls";
2
- import { ChainId } from "@sdk";
3
2
  import { enzymeFundValueCalculatorRouterMapping, getTypeFromFactoryAddress } from "./helpers/factoryFinder";
4
3
  import { getTypeFromAddressChain } from "./helpers/hardcoded";
5
4
  import { getTypeFromOwnerAddress } from "./helpers/ownerFinder";
@@ -154,12 +153,14 @@ function satisfiesNameConditions(name, type) {
154
153
  return false;
155
154
  }
156
155
  }
157
- function generateResult(type, name, targetToken, typeInfo) {
156
+ function generateResult(type, name, targetToken, typeInfo, campaign) {
158
157
  const ProcessorClass = processorMapping[type];
159
158
  if (!ProcessorClass) {
160
159
  throw new Error(`Processor not found for key: ${type}`);
161
160
  }
162
161
  const processorObject = new ProcessorClass();
162
+ if (campaign)
163
+ typeInfo = { ...typeInfo, ...parseForStaking(campaign) };
163
164
  typeInfo = {
164
165
  ...typeInfo,
165
166
  name: name,
@@ -169,25 +170,25 @@ function generateResult(type, name, targetToken, typeInfo) {
169
170
  };
170
171
  return processorObject.computeRound1(type, typeInfo);
171
172
  }
172
- function processNamingConditions(type, name, targetToken) {
173
+ function processNamingConditions(type, name, targetToken, campaign) {
173
174
  if (satisfiesNameConditions(name, type)) {
174
- return generateResult(type, name, targetToken, {});
175
+ return generateResult(type, name, targetToken, {}, campaign);
175
176
  }
176
177
  }
177
- function processNamingConditionsInOrder(types, name, targetToken) {
178
+ function processNamingConditionsInOrder(types, name, targetToken, campaign) {
178
179
  for (const type of types) {
179
- const result = processNamingConditions(type, name, targetToken);
180
+ const result = processNamingConditions(type, name, targetToken, campaign);
180
181
  if (result)
181
182
  return result;
182
183
  }
183
184
  }
184
- function parseForFactory(calls, targetToken) {
185
+ function parseForFactory(calls, targetToken, campaign) {
185
186
  try {
186
187
  const factory = decodeReturnValue(calls.factory, "factory");
187
188
  const name = decodeReturnValue(calls.name, "name");
188
189
  const type = getTypeFromFactoryAddress(factory);
189
190
  if (type !== tokenType.unknown)
190
- return generateResult(type, name, targetToken, { factory });
191
+ return generateResult(type, name, targetToken, { factory }, campaign);
191
192
  }
192
193
  catch (e) {
193
194
  // No factory on this token
@@ -266,15 +267,14 @@ function checkAgainstHardcoded(calls, chainId, targetToken) {
266
267
  // Not a hardcoded address
267
268
  }
268
269
  }
269
- function parseForStaking(campaign, calls, targetToken) {
270
+ function parseForStaking(campaign) {
270
271
  try {
271
272
  const whitelist = campaign.campaignParameters.whitelist;
272
- if (whitelist.length === 1 && campaign.chainId !== ChainId.ARBITRUM) {
273
+ if (whitelist.length === 1) {
273
274
  const forwarders = campaign.campaignParameters.forwarders;
274
275
  if (forwarders.length === 1) {
275
276
  if (forwarders[0].sender === whitelist[0]) {
276
- const name = decodeReturnValue(calls.name, "name");
277
- return generateResult(tokenType.staking, name, targetToken, { stakingContract: whitelist[0] });
277
+ return { isStaking: "true", stakingContract: whitelist[0] };
278
278
  }
279
279
  }
280
280
  }
@@ -283,6 +283,7 @@ function parseForStaking(campaign, calls, targetToken) {
283
283
  // No factory on this token
284
284
  // console.log(e);
285
285
  }
286
+ return { isStaking: "false" };
286
287
  }
287
288
  export function getTokenTypeRound1(calls, targetToken, index, campaign) {
288
289
  const returnValueOfCalls = calls.map(call => call.returnData);
@@ -295,7 +296,7 @@ export function getTokenTypeRound1(calls, targetToken, index, campaign) {
295
296
  owner: returnValueOfCalls[index + 5],
296
297
  vault: returnValueOfCalls[index + 6],
297
298
  };
298
- let result = parseForFactory(returnValue, targetToken);
299
+ let result = parseForFactory(returnValue, targetToken, campaign);
299
300
  if (result)
300
301
  return result;
301
302
  result = parseForOwner(returnValue, targetToken);
@@ -308,9 +309,6 @@ export function getTokenTypeRound1(calls, targetToken, index, campaign) {
308
309
  if (result)
309
310
  return result;
310
311
  result = parseForMetamorpho(returnValue, targetToken);
311
- if (result)
312
- return result;
313
- result = parseForStaking(campaign, returnValue, targetToken);
314
312
  if (result)
315
313
  return result;
316
314
  let name;
@@ -318,15 +316,15 @@ export function getTokenTypeRound1(calls, targetToken, index, campaign) {
318
316
  name = decodeCall(returnValueOfCalls, index + 2, "name");
319
317
  }
320
318
  catch {
321
- return generateResult(tokenType.unknown, "Unknown", targetToken, {});
319
+ return generateResult(tokenType.unknown, "Unknown", targetToken, {}, campaign);
322
320
  }
323
321
  result = parseForBalancer(returnValue, targetToken, name);
324
322
  if (result)
325
323
  return result;
326
324
  // Order matters
327
325
  const ordered_token_Type = Object.values(tokenType).filter(value => typeof value === "string");
328
- result = processNamingConditionsInOrder(ordered_token_Type, name, targetToken);
326
+ result = processNamingConditionsInOrder(ordered_token_Type, name, targetToken, campaign);
329
327
  if (result)
330
328
  return result;
331
- return generateResult(tokenType.unknown, name, targetToken, {});
329
+ return generateResult(tokenType.unknown, name, targetToken, {}, campaign);
332
330
  }
@@ -1,3 +1,4 @@
1
+ import { ComputedValueService } from "../../../modules/v4/computedValue";
1
2
  import { engineDbClient } from "../../../utils/prisma";
2
3
  import { BN2Number, ERC20Interface, NULL_ADDRESS, RadiantInterface, RadiantPoolInterface, YEAR, } from "@sdk";
3
4
  import { Contract } from "ethers";
@@ -5,7 +6,6 @@ import { log } from "../../../utils/logger";
5
6
  import { Pricer } from "../../../utils/pricer";
6
7
  import { providers } from "../../../utils/providers";
7
8
  import { merklChainDataWithCache } from "../../merklChainData";
8
- import { getLastEligibilityRatio } from "../utils/getLastEligibilityRatio";
9
9
  export async function RadiantDynamicData(chainId, campaigns) {
10
10
  const pricer = await Pricer.load();
11
11
  const calls = [];
@@ -58,7 +58,18 @@ export async function RadiantDynamicData(chainId, campaigns) {
58
58
  .filter(c => c.campaignParameters?.symbolRewardToken === "mtwRDNT")
59
59
  .sort((a, b) => b.endTimestamp - a.endTimestamp)
60
60
  .map(c => c?.campaignId);
61
- const lastEligibilityRatio = await getLastEligibilityRatio(campaign, chainId, currentRoot, backupCampaignIds);
61
+ let lastEligibilityRatio = 1;
62
+ if (!!campaign.campaignParameters.hooks?.length) {
63
+ for (const campaignId of [campaign.campaignId, ...backupCampaignIds]) {
64
+ lastEligibilityRatio =
65
+ (await ComputedValueService.findCampaignValue({
66
+ campaignId: `${campaignId}-${chainId}`,
67
+ field: "averageBoost",
68
+ }))?.averageBoost ?? 1;
69
+ if (lastEligibilityRatio !== 1)
70
+ break;
71
+ }
72
+ }
62
73
  const priceRewardToken = (await pricer.get({
63
74
  address: campaign.rewardToken,
64
75
  chainId,
@@ -77,25 +77,6 @@ export declare const BoostController: Elysia<"/boosts", false, {
77
77
  };
78
78
  };
79
79
  };
80
- } & {
81
- boosts: {
82
- openblock: {
83
- zksync: {
84
- get: {
85
- body: unknown;
86
- params: {};
87
- query: unknown;
88
- headers: unknown;
89
- response: {
90
- 200: {
91
- address: string;
92
- boost: string;
93
- }[];
94
- };
95
- };
96
- };
97
- };
98
- };
99
80
  }, {
100
81
  derive: {};
101
82
  resolve: {};
@@ -12,5 +12,4 @@ export const BoostController = new Elysia({ prefix: "/boosts", detail: { tags: [
12
12
  query: getZksyncBoost,
13
13
  body: getEulerBoostBody,
14
14
  detail: { hide: true },
15
- })
16
- .get("/openblock/zksync", async () => BoostService.getOpenBlockBoostDefault());
15
+ });
@@ -8,8 +8,4 @@ export declare class BoostService {
8
8
  address: string;
9
9
  boost: string;
10
10
  }[]>;
11
- static getOpenBlockBoostDefault(): Promise<{
12
- address: string;
13
- boost: string;
14
- }[]>;
15
11
  }
@@ -17,27 +17,4 @@ export class BoostService {
17
17
  }
18
18
  return response.data.map(({ address, boost }) => ({ address, boost: boost.toString() }));
19
19
  }
20
- static async getOpenBlockBoostDefault() {
21
- return [
22
- { address: "0x684566c9ffcac7f6a04c3a9997000d2d58c00824", boost: "0" },
23
- { address: "0x29dfdd80d6acc0f9028d8a6fa7d7d448342e25c1", boost: "0" },
24
- { address: "0x5b9effdcbd65946f2b143725dc244563248aa4ee", boost: "0" },
25
- { address: "0xd2262a05e225ce0c61fb699fdcf14068132dd362", boost: "0" },
26
- { address: "0x7da8481e24303d55f29f0c06174f18b30b81c9ac", boost: "0" },
27
- { address: "0x1d098a8d7fa63a39e0884b720f86f9ba8cbbeef1", boost: "0" },
28
- { address: "0x7f3e3d663a5f29274d0809020c675f5cc3d1429a", boost: "0" },
29
- { address: "0x7f04f7fdad3272b806e3d57bec445e0ece82f2ad", boost: "0" },
30
- { address: "0xfe769b6f39a000ff508b5baf8fbe3a1f516f258c", boost: "0" },
31
- { address: "0xd635736f8ac2241cdfcc3ee02d3f3bac1f78431f", boost: "0" },
32
- { address: "0xb38c7e2b4ba3cdc4eaea863cbb01470353c5ea16", boost: "0" },
33
- { address: "0xe37885b5e1187f7f618407fb0c14a3383998348e", boost: "0" },
34
- { address: "0xe01f660b304be815627628c38c2dcdf37f68245e", boost: "0" },
35
- { address: "0xe746db07d2b4babf5f2051d40987b7278414192f", boost: "0" },
36
- { address: "0xa0265ed27561b25c0e7ad3ed1fed74c2ee5f8cdf", boost: "0" },
37
- { address: "0xdf5ad5a87fceaacb1ecef40e8e61c42c92339a10", boost: "0" },
38
- { address: "0xc91fc9dd7f1bb6ec429eddb577b9ace6236b2147", boost: "0" },
39
- { address: "0x8b81420441ac3933c58d1190c8499c2f89eb1263", boost: "0" },
40
- { address: "0x0000000000000000000000000000000000000000", boost: "1" },
41
- ];
42
- }
43
20
  }