@merkl/api 0.10.356 → 0.10.357

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 (53) hide show
  1. package/dist/database/api/.generated/edge.js +45 -19
  2. package/dist/database/api/.generated/index-browser.js +49 -23
  3. package/dist/database/api/.generated/index.d.ts +11316 -8029
  4. package/dist/database/api/.generated/index.js +45 -19
  5. package/dist/database/api/.generated/package.json +1 -1
  6. package/dist/database/api/.generated/schema.prisma +39 -15
  7. package/dist/database/api/.generated/wasm.js +49 -23
  8. package/dist/src/eden/index.d.ts +3 -0
  9. package/dist/src/index.d.ts +1 -0
  10. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +6 -2
  11. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +5 -0
  12. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/hardcoded.d.ts +3 -0
  13. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/hardcoded.js +26 -0
  14. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/ownerFinder.d.ts +2 -0
  15. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/ownerFinder.js +11 -0
  16. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +7 -1
  17. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +12 -0
  18. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.d.ts +1 -1
  19. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +1 -1
  20. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.d.ts +1 -1
  21. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js +1 -1
  22. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.d.ts +4 -2
  23. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.js +32 -4
  24. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RfxProcessor.d.ts +1 -1
  25. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RfxProcessor.js +1 -1
  26. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/Satlayer.d.ts +34 -0
  27. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/Satlayer.js +27 -0
  28. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +7 -0
  29. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +71 -20
  30. package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +116 -0
  31. package/dist/src/modules/v4/computedValue/computedValue.controller.js +43 -0
  32. package/dist/src/modules/v4/computedValue/computedValue.model.d.ts +27 -0
  33. package/dist/src/modules/v4/computedValue/computedValue.model.js +22 -0
  34. package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +13 -0
  35. package/dist/src/modules/v4/computedValue/computedValue.repository.js +41 -0
  36. package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +13 -0
  37. package/dist/src/modules/v4/computedValue/computedValue.service.js +15 -0
  38. package/dist/src/modules/v4/computedValue/index.d.ts +3 -0
  39. package/dist/src/modules/v4/computedValue/index.js +3 -0
  40. package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +1 -0
  41. package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +1 -1
  42. package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +1 -0
  43. package/dist/src/modules/v4/dynamicData/dynamicData.model.js +1 -0
  44. package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -1
  45. package/dist/src/modules/v4/dynamicData/dynamicData.service.js +2 -2
  46. package/dist/src/modules/v4/opportunity/opportunity.controller.js +1 -1
  47. package/dist/src/modules/v4/router.d.ts +1 -0
  48. package/dist/src/utils/decodeCalls.d.ts +1 -0
  49. package/dist/src/utils/decodeCalls.js +12 -1
  50. package/dist/src/utils/encodeCalls.js +4 -0
  51. package/dist/src/utils/generateCardName.js +8 -0
  52. package/dist/tsconfig.package.tsbuildinfo +1 -1
  53. package/package.json +1 -1
@@ -1,6 +1,8 @@
1
- import { decodeCall } from "../../../../utils/decodeCalls";
1
+ import { decodeCall, decodeReturnValue } from "../../../../utils/decodeCalls";
2
2
  import { ChainId } from "@sdk";
3
3
  import { enzymeFundValueCalculatorRouterMapping, getTypeFromFactoryAddress } from "./helpers/factoryFinder";
4
+ import { getTypeFromAddressChain } from "./helpers/hardcoded";
5
+ import { getTypeFromOwnerAddress } from "./helpers/ownerFinder";
4
6
  import { tokenType } from "./helpers/tokenType";
5
7
  import { processorMapping } from "./processor/processorMapping";
6
8
  function satisfiesNameConditions(name, type) {
@@ -107,9 +109,17 @@ function satisfiesNameConditions(name, type) {
107
109
  case tokenType.holdstation:
108
110
  return lowerCaseName.startsWith("hs");
109
111
  case tokenType.noLinkVault:
110
- return lowerCaseName.startsWith("unifi eth");
112
+ return lowerCaseName.startsWith("unifi");
111
113
  case tokenType.vicuna:
112
114
  return lowerCaseName.startsWith("vifi");
115
+ case tokenType.avalon_borrowing:
116
+ return lowerCaseName.includes("avalon") && lowerCaseName.includes("debt");
117
+ case tokenType.avalon_lending:
118
+ return lowerCaseName.includes("avalon");
119
+ case tokenType.superlend_borrowing:
120
+ return lowerCaseName.includes("superlend") && lowerCaseName.includes("debt");
121
+ case tokenType.superlend_lending:
122
+ return lowerCaseName.includes("superlend");
113
123
  default:
114
124
  return false;
115
125
  }
@@ -141,23 +151,38 @@ function processNamingConditionsInOrder(types, name, targetToken) {
141
151
  return result;
142
152
  }
143
153
  }
144
- function parseForFactory(calls, index, targetToken) {
154
+ function parseForFactory(calls, targetToken) {
145
155
  try {
146
- const factory = decodeCall(calls, index, "factory");
147
- const name = decodeCall(calls, index + 2, "name");
156
+ const factory = decodeReturnValue(calls.factory, "factory");
157
+ const name = decodeReturnValue(calls.name, "name");
148
158
  const type = getTypeFromFactoryAddress(factory);
159
+ console.log("factory: ", factory);
149
160
  if (type !== tokenType.unknown)
150
161
  return generateResult(type, name, targetToken, { factory });
151
162
  }
152
163
  catch (e) {
153
164
  // No factory on this token
165
+ // console.log(e);
154
166
  }
155
167
  }
156
- function parseForEnzyme(calls, index, targetToken) {
168
+ function parseForOwner(calls, targetToken) {
169
+ try {
170
+ const owner = decodeReturnValue(calls.owner, "owner");
171
+ const name = decodeReturnValue(calls.name, "name");
172
+ const type = getTypeFromOwnerAddress(owner);
173
+ if (type !== tokenType.unknown)
174
+ return generateResult(type, name, targetToken, { owner: owner });
175
+ }
176
+ catch (e) {
177
+ // No factory on this token
178
+ // console.log(e);
179
+ }
180
+ }
181
+ function parseForEnzyme(calls, targetToken) {
157
182
  // Enzyme check
158
183
  try {
159
- const dispatcher = decodeCall(calls, index + 4, "getCreator");
160
- const name = decodeCall(calls, index + 2, "name");
184
+ const dispatcher = decodeReturnValue(calls.creator, "getCreator");
185
+ const name = decodeReturnValue(calls.name, "name");
161
186
  const type = getTypeFromFactoryAddress(dispatcher);
162
187
  const fundValueCalculator = enzymeFundValueCalculatorRouterMapping[dispatcher];
163
188
  const typeInfo = {
@@ -172,35 +197,47 @@ function parseForEnzyme(calls, index, targetToken) {
172
197
  // No factory on this token
173
198
  }
174
199
  }
175
- function parseForMetamorpho(calls, index, targetToken) {
200
+ function parseForMetamorpho(calls, targetToken) {
176
201
  // MetaMorpho check
177
202
  try {
178
- decodeCall(calls, index + 1, "MORPHO");
179
- const name = decodeCall(calls, index + 2, "name");
203
+ decodeReturnValue(calls.metamorpho, "MORPHO");
204
+ const name = decodeReturnValue(calls.name, "name");
180
205
  return generateResult(tokenType.metamorpho, name, targetToken, {});
181
206
  }
182
207
  catch (e) {
183
208
  // Not a metamorpho token
184
209
  }
185
210
  }
186
- function parseForBalancer(calls, index, targetToken, name) {
211
+ function parseForBalancer(calls, targetToken, name) {
187
212
  // Check for balancer pools
188
213
  try {
189
- decodeCall(calls, index + 3, "getPoolId");
214
+ decodeReturnValue(calls.poolId, "getPoolId");
190
215
  return generateResult(tokenType.balancerPool, name, targetToken, {});
191
216
  }
192
217
  catch (e) {
193
218
  // Not a balancer pool
194
219
  }
195
220
  }
196
- function parseForStaking(campaign, calls, index, targetToken) {
221
+ function checkAgainstHardcoded(calls, chainId, targetToken) {
222
+ // Check for balancer pools
223
+ try {
224
+ const name = decodeReturnValue(calls.name, "name");
225
+ const type = getTypeFromAddressChain(chainId, targetToken);
226
+ if (type !== tokenType.unknown)
227
+ return generateResult(type, name, targetToken, {});
228
+ }
229
+ catch (e) {
230
+ // Not a hardcoded address
231
+ }
232
+ }
233
+ function parseForStaking(campaign, calls, targetToken) {
197
234
  try {
198
235
  const whitelist = campaign.campaignParameters.whitelist;
199
236
  if (whitelist.length === 1 && campaign.chainId !== ChainId.ARBITRUM) {
200
237
  const forwarders = campaign.campaignParameters.forwarders;
201
238
  if (forwarders.length === 1) {
202
239
  if (forwarders[0].sender === whitelist[0]) {
203
- const name = decodeCall(calls, index + 2, "name");
240
+ const name = decodeReturnValue(calls.name, "name");
204
241
  return generateResult(tokenType.staking, name, targetToken, { stakingContract: whitelist[0] });
205
242
  }
206
243
  }
@@ -213,16 +250,30 @@ function parseForStaking(campaign, calls, index, targetToken) {
213
250
  }
214
251
  export function getTokenTypeRound1(calls, targetToken, index, campaign) {
215
252
  const returnValueOfCalls = calls.map(call => call.returnData);
216
- let result = parseForFactory(returnValueOfCalls, index, targetToken);
253
+ const returnValue = {
254
+ factory: returnValueOfCalls[index],
255
+ metamorpho: returnValueOfCalls[index + 1],
256
+ name: returnValueOfCalls[index + 2],
257
+ poolId: returnValueOfCalls[index + 3],
258
+ creator: returnValueOfCalls[index + 4],
259
+ owner: returnValueOfCalls[index + 5],
260
+ };
261
+ let result = parseForFactory(returnValue, targetToken);
262
+ if (result)
263
+ return result;
264
+ result = parseForOwner(returnValue, targetToken);
265
+ if (result)
266
+ return result;
267
+ result = checkAgainstHardcoded(returnValue, campaign.computeChainId, targetToken);
217
268
  if (result)
218
269
  return result;
219
- result = parseForEnzyme(returnValueOfCalls, index, targetToken);
270
+ result = parseForEnzyme(returnValue, targetToken);
220
271
  if (result)
221
272
  return result;
222
- result = parseForMetamorpho(returnValueOfCalls, index, targetToken);
273
+ result = parseForMetamorpho(returnValue, targetToken);
223
274
  if (result)
224
275
  return result;
225
- result = parseForStaking(campaign, returnValueOfCalls, index, targetToken);
276
+ result = parseForStaking(campaign, returnValue, targetToken);
226
277
  if (result)
227
278
  return result;
228
279
  let name;
@@ -232,7 +283,7 @@ export function getTokenTypeRound1(calls, targetToken, index, campaign) {
232
283
  catch (e) {
233
284
  return generateResult(tokenType.unknown, "Unknown", targetToken, {});
234
285
  }
235
- result = parseForBalancer(returnValueOfCalls, index, targetToken, name);
286
+ result = parseForBalancer(returnValue, targetToken, name);
236
287
  if (result)
237
288
  return result;
238
289
  // Order matters
@@ -0,0 +1,116 @@
1
+ import Elysia from "elysia";
2
+ export declare const computedValueController: Elysia<"/value", false, {
3
+ decorator: {};
4
+ store: {};
5
+ derive: {};
6
+ resolve: {};
7
+ }, {
8
+ type: {};
9
+ error: {};
10
+ }, {
11
+ schema: {};
12
+ macro: {};
13
+ macroFn: {};
14
+ }, {
15
+ value: {
16
+ campaign: {
17
+ ":campaignId": {
18
+ ":field": {
19
+ get: {
20
+ body: unknown;
21
+ params: {
22
+ campaignId: string;
23
+ field: string;
24
+ };
25
+ query: unknown;
26
+ headers: unknown;
27
+ response: {
28
+ 200: {
29
+ [x: string]: File;
30
+ [x: number]: File;
31
+ } | null;
32
+ };
33
+ };
34
+ };
35
+ };
36
+ };
37
+ };
38
+ } & {
39
+ value: {
40
+ user: {
41
+ ":address": {
42
+ ":field": {
43
+ get: {
44
+ body: unknown;
45
+ params: {
46
+ address: string;
47
+ field: string;
48
+ };
49
+ query: unknown;
50
+ headers: unknown;
51
+ response: {
52
+ 200: {
53
+ [x: string]: never;
54
+ [x: number]: never;
55
+ }[];
56
+ };
57
+ };
58
+ };
59
+ };
60
+ };
61
+ };
62
+ } & {
63
+ value: {
64
+ engine: {
65
+ campaign: {
66
+ post: {
67
+ body: {
68
+ value: number;
69
+ campaignId: string;
70
+ field: string;
71
+ };
72
+ params: {};
73
+ query: unknown;
74
+ headers: {
75
+ authorization: string;
76
+ };
77
+ response: {
78
+ 200: void;
79
+ };
80
+ };
81
+ };
82
+ };
83
+ };
84
+ } & {
85
+ value: {
86
+ engine: {
87
+ user: {
88
+ post: {
89
+ body: {
90
+ reason: string;
91
+ value: number;
92
+ address: string;
93
+ campaignId: string;
94
+ field: string;
95
+ }[];
96
+ params: {};
97
+ query: unknown;
98
+ headers: {
99
+ authorization: string;
100
+ };
101
+ response: {
102
+ 200: void;
103
+ };
104
+ };
105
+ };
106
+ };
107
+ };
108
+ }, {
109
+ derive: {};
110
+ resolve: {};
111
+ schema: {};
112
+ }, {
113
+ derive: {};
114
+ resolve: {};
115
+ schema: {};
116
+ }>;
@@ -0,0 +1,43 @@
1
+ import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
2
+ import { throwOnInvalidRequiredAddress } from "../../../utils/throw";
3
+ import Elysia from "elysia";
4
+ import { GetCampaignComputedValue, GetUserComputedValues, UpsertCampaignComputedValue, UpsertUserComputedValues, } from "./computedValue.model";
5
+ import { ComputedValueService } from "./computedValue.service";
6
+ export const computedValueController = new Elysia({
7
+ prefix: "/value",
8
+ detail: { tags: ["Engine"], hide: true },
9
+ })
10
+ // ─── Get a Campaign Value ──────────────────────────────────────
11
+ .get("/campaign/:campaignId/:field", async ({ params }) => ComputedValueService.findCampaignValue(params), {
12
+ params: GetCampaignComputedValue,
13
+ detail: { hide: true },
14
+ })
15
+ // ─── Get user Values ──────────────────────────────────────
16
+ .get("/user/:address/:field", async ({ params }) => ComputedValueService.findUserValues(params), {
17
+ params: GetUserComputedValues,
18
+ beforeHandle: ({ params }) => {
19
+ throwOnInvalidRequiredAddress(params.address);
20
+ },
21
+ detail: { hide: true },
22
+ })
23
+ // ─── Update a Campaign Value ──────────────────────────────────────
24
+ .post("/engine/campaign", async ({ body }) => await ComputedValueService.upsertCampaignComputedValue(body), {
25
+ headers: AuthorizationHeadersDto,
26
+ body: UpsertCampaignComputedValue,
27
+ beforeHandle: ({ headers }) => {
28
+ EngineGuard({ headers });
29
+ },
30
+ detail: { hide: true },
31
+ })
32
+ // ─── Update some User Values ──────────────────────────────────────
33
+ .post("/engine/user", async ({ body }) => await ComputedValueService.upsertUserComputedValues(body), {
34
+ headers: AuthorizationHeadersDto,
35
+ body: UpsertUserComputedValues,
36
+ beforeHandle: ({ headers, body }) => {
37
+ EngineGuard({ headers });
38
+ for (const item of body) {
39
+ throwOnInvalidRequiredAddress(item.address);
40
+ }
41
+ },
42
+ detail: { hide: true },
43
+ });
@@ -0,0 +1,27 @@
1
+ import type { Resource } from "../prisma";
2
+ export type CampaignComputedFields = keyof Resource<"CampaignComputedValue", "campaignId">["model"];
3
+ export type UserComputedFields = keyof Resource<"UserComputedValue", "campaignId" | "address" | "reason">["model"];
4
+ export declare const GetCampaignComputedValue: import("@sinclair/typebox").TObject<{
5
+ campaignId: import("@sinclair/typebox").TString;
6
+ field: import("@sinclair/typebox").TString;
7
+ }>;
8
+ export declare const UpsertCampaignComputedValue: import("@sinclair/typebox").TObject<{
9
+ campaignId: import("@sinclair/typebox").TString;
10
+ value: import("@sinclair/typebox").TNumber;
11
+ field: import("@sinclair/typebox").TString;
12
+ }>;
13
+ export declare const GetUserComputedValues: import("@sinclair/typebox").TObject<{
14
+ address: import("@sinclair/typebox").TString;
15
+ field: import("@sinclair/typebox").TString;
16
+ }>;
17
+ export declare const UpsertUserComputedValues: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
18
+ campaignId: import("@sinclair/typebox").TString;
19
+ address: import("@sinclair/typebox").TString;
20
+ reason: import("@sinclair/typebox").TString;
21
+ value: import("@sinclair/typebox").TNumber;
22
+ field: import("@sinclair/typebox").TString;
23
+ }>>;
24
+ export type GetCampaignComputedValueModel = typeof GetCampaignComputedValue.static;
25
+ export type UpsertCampaignComputedValueModel = typeof UpsertCampaignComputedValue.static;
26
+ export type GetUserComputedValuesModel = typeof GetUserComputedValues.static;
27
+ export type UpsertUserComputedValuesModel = typeof UpsertUserComputedValues.static;
@@ -0,0 +1,22 @@
1
+ import { t } from "elysia";
2
+ // ─── DTOs ────────────────────────────────────────────────────────────────────
3
+ export const GetCampaignComputedValue = t.Object({
4
+ campaignId: t.String(),
5
+ field: t.String(),
6
+ });
7
+ export const UpsertCampaignComputedValue = t.Object({
8
+ campaignId: t.String(),
9
+ value: t.Number(),
10
+ field: t.String(),
11
+ });
12
+ export const GetUserComputedValues = t.Object({
13
+ address: t.String(),
14
+ field: t.String(),
15
+ });
16
+ export const UpsertUserComputedValues = t.Array(t.Object({
17
+ campaignId: t.String(),
18
+ address: t.String(),
19
+ reason: t.String(),
20
+ value: t.Number(),
21
+ field: t.String(),
22
+ }));
@@ -0,0 +1,13 @@
1
+ import type { GetCampaignComputedValueModel, GetUserComputedValuesModel, UpsertCampaignComputedValueModel, UpsertUserComputedValuesModel } from "./computedValue.model";
2
+ export declare class ComputedValueRepository {
3
+ static findCampaignValue(params: GetCampaignComputedValueModel): Promise<{
4
+ [x: string]: never;
5
+ [x: number]: never;
6
+ } | null>;
7
+ static upsertCampaignComputedValue(data: UpsertCampaignComputedValueModel): Promise<void>;
8
+ static findUserValues(params: GetUserComputedValuesModel): Promise<{
9
+ [x: string]: never;
10
+ [x: number]: never;
11
+ }[]>;
12
+ static upsertUserComputedValues(data: UpsertUserComputedValuesModel): Promise<void>;
13
+ }
@@ -0,0 +1,41 @@
1
+ import { apiDbClient } from "../../../utils/prisma";
2
+ export class ComputedValueRepository {
3
+ static async findCampaignValue(params) {
4
+ return await apiDbClient.campaignComputedValue.findUnique({
5
+ where: { campaignId: params.campaignId },
6
+ select: { [params.field]: true },
7
+ });
8
+ }
9
+ static async upsertCampaignComputedValue(data) {
10
+ await apiDbClient.campaignComputedValue.upsert({
11
+ where: { campaignId: data.campaignId },
12
+ update: { [data.field]: data.value },
13
+ create: {
14
+ campaignId: data.campaignId,
15
+ [data.field]: data.value,
16
+ },
17
+ });
18
+ }
19
+ static async findUserValues(params) {
20
+ return await apiDbClient.userComputedValue.findMany({
21
+ where: { address: params.address },
22
+ select: { [params.field]: true },
23
+ });
24
+ }
25
+ static async upsertUserComputedValues(data) {
26
+ await apiDbClient.$transaction(data.map(item => {
27
+ return apiDbClient.userComputedValue.upsert({
28
+ where: {
29
+ campaignId_address_reason: { campaignId: item.campaignId, address: item.address, reason: item.reason },
30
+ },
31
+ update: { [item.field]: item.value },
32
+ create: {
33
+ campaignId: item.campaignId,
34
+ address: item.address,
35
+ reason: item.reason,
36
+ [item.field]: item.value,
37
+ },
38
+ });
39
+ }));
40
+ }
41
+ }
@@ -0,0 +1,13 @@
1
+ import type { GetCampaignComputedValueModel, GetUserComputedValuesModel, UpsertCampaignComputedValueModel, UpsertUserComputedValuesModel } from "./computedValue.model";
2
+ export declare class ComputedValueService {
3
+ static findCampaignValue(params: GetCampaignComputedValueModel): Promise<{
4
+ [x: string]: never;
5
+ [x: number]: never;
6
+ } | null>;
7
+ static upsertCampaignComputedValue(data: UpsertCampaignComputedValueModel): Promise<void>;
8
+ static findUserValues(params: GetUserComputedValuesModel): Promise<{
9
+ [x: string]: never;
10
+ [x: number]: never;
11
+ }[]>;
12
+ static upsertUserComputedValues(data: UpsertUserComputedValuesModel): Promise<void>;
13
+ }
@@ -0,0 +1,15 @@
1
+ import { ComputedValueRepository } from "./computedValue.repository";
2
+ export class ComputedValueService {
3
+ static async findCampaignValue(params) {
4
+ return await ComputedValueRepository.findCampaignValue(params);
5
+ }
6
+ static async upsertCampaignComputedValue(data) {
7
+ await ComputedValueRepository.upsertCampaignComputedValue(data);
8
+ }
9
+ static async findUserValues(params) {
10
+ return await ComputedValueRepository.findUserValues(params);
11
+ }
12
+ static async upsertUserComputedValues(data) {
13
+ await ComputedValueRepository.upsertUserComputedValues(data);
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./computedValue.model";
2
+ export * from "./computedValue.controller";
3
+ export * from "./computedValue.service";
@@ -0,0 +1,3 @@
1
+ export * from "./computedValue.model";
2
+ export * from "./computedValue.controller";
3
+ export * from "./computedValue.service";
@@ -18,6 +18,7 @@ export declare const DynamicDataController: Elysia<"/dynamic-data", false, {
18
18
  body: unknown;
19
19
  params: {};
20
20
  query: {
21
+ decimals?: number | undefined;
21
22
  chainId: number;
22
23
  tokenAddress: string;
23
24
  };
@@ -10,7 +10,7 @@ export const DynamicDataController = new Elysia({
10
10
  detail: { tags: ["DynamicData"], hide: true },
11
11
  })
12
12
  // ─── Get type Info By Token Address ───────────────────────────────────────
13
- .get("/", async ({ query }) => await DynamicDataService.queryERC20DynamicData(query.chainId, query.tokenAddress), {
13
+ .get("/", async ({ query }) => await DynamicDataService.queryERC20DynamicData(query.chainId, query.tokenAddress, query.decimals), {
14
14
  query: DynamicDataSourceIdentifier,
15
15
  headers: AuthorizationHeadersDto,
16
16
  beforeHandle: ({ query, headers }) => {
@@ -2,6 +2,7 @@ import type { SinglePayloadInputDto } from "../programPayload";
2
2
  export declare const DynamicDataSourceIdentifier: import("@sinclair/typebox").TObject<{
3
3
  chainId: import("@sinclair/typebox").TNumber;
4
4
  tokenAddress: import("@sinclair/typebox").TString;
5
+ decimals: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
5
6
  }>;
6
7
  export declare const DynamicDataExtendedDto: import("@sinclair/typebox").TObject<{
7
8
  targetTokenSymbol: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -4,6 +4,7 @@ import { t } from "elysia";
4
4
  export const DynamicDataSourceIdentifier = t.Object({
5
5
  chainId: t.Numeric(),
6
6
  tokenAddress: t.String(),
7
+ decimals: t.Optional(t.Numeric()),
7
8
  });
8
9
  export const DynamicDataExtendedDto = t.Object({
9
10
  targetTokenSymbol: t.Optional(t.String()),
@@ -13,7 +13,7 @@ type output = {
13
13
  export declare class DynamicDataService {
14
14
  #private;
15
15
  /** Fetches a single price */
16
- static queryERC20DynamicData(chainId: ChainId, tokenAddress: string): Promise<output>;
16
+ static queryERC20DynamicData(chainId: ChainId, tokenAddress: string, decimals?: number): Promise<output>;
17
17
  static queryDynamicData(campaign: SimplifiedCampaignDtoModel): Promise<any>;
18
18
  static queryDynamicDataFromCampaignId(query: GetCampaignQueryModel): Promise<any>;
19
19
  /**
@@ -8,7 +8,7 @@ import { CampaignRepository } from "../campaign/campaign.repository";
8
8
  export class DynamicDataService {
9
9
  // ─── DynamicDatas ──────────────────────────────────────────────────────────
10
10
  /** Fetches a single price */
11
- static async queryERC20DynamicData(chainId, tokenAddress) {
11
+ static async queryERC20DynamicData(chainId, tokenAddress, decimals = 18) {
12
12
  const campaigns = [
13
13
  {
14
14
  campaignId: tokenAddress,
@@ -26,7 +26,7 @@ export class DynamicDataService {
26
26
  campaignParameters: {
27
27
  blacklist: [],
28
28
  decimalsRewardToken: 18,
29
- decimalsTargetToken: 18,
29
+ decimalsTargetToken: decimals,
30
30
  duration: 30,
31
31
  whitelist: [],
32
32
  forwarders: [],
@@ -91,7 +91,7 @@ export const OpportunityController = new Elysia({
91
91
  .get("/:id/campaigns", async ({ query, params }) => {
92
92
  try {
93
93
  if (!params.id.includes("-"))
94
- return await OpportunityService.getUniqueWithCampaignsOrThrow(params.id);
94
+ return await OpportunityService.getUniqueWithCampaignsOrThrow(params.id, query.test ?? false);
95
95
  const [chainId, type, identifier] = params.id.split("-");
96
96
  const oppWithCampaigns = await OpportunityService.getUniqueWithCampaignsOrThrow({
97
97
  chainId: +chainId,
@@ -2656,6 +2656,7 @@ export declare const v4: Elysia<"/v4", false, {
2656
2656
  body: unknown;
2657
2657
  params: {};
2658
2658
  query: {
2659
+ decimals?: number | undefined;
2659
2660
  chainId: number;
2660
2661
  tokenAddress: string;
2661
2662
  };
@@ -1,2 +1,3 @@
1
1
  import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
2
2
  export declare function decodeCall(calls: string[], index: number, key: string, type?: tokenType): any;
3
+ export declare function decodeReturnValue(returnData: string, key: string, type?: tokenType): any;
@@ -1,9 +1,14 @@
1
1
  import { AaveInterface, AccountantWithRateProvidersInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerVaultInterface, BeefyInterface, CPMMGammaPoolMainInterface, CompoundInterface, CurveInterface, CurveStableSwapNGInterface, DefutureVaultInterface, ERC20Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, IonicInterface, LayerBankInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, PendleYTInterface, RadiantInterface, RfxInterface, RswEthStrategyInterface, SturdyInterface, SymetricAmbientStrategyInterface, TorosInterface, UniswapV2PoolInterface, VePufferInterface, ZFStableLPINterface, ZFStableSwapThreePoolInterface, } from "@sdk";
2
- import { SyncSwapClassicPoolInterface } from "libs/sdk/src/merkl/interface";
2
+ import { LayerBankERC20Interface, SyncSwapClassicPoolInterface } from "libs/sdk/src/merkl/interface";
3
3
  import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
4
4
  export function decodeCall(calls, index, key, type) {
5
5
  const returnData = calls[index];
6
+ return decodeReturnValue(returnData, key, type);
7
+ }
8
+ export function decodeReturnValue(returnData, key, type) {
6
9
  switch (key) {
10
+ case "domain":
11
+ return CurveStableSwapNGInterface.decodeFunctionResult("DOMAIN_SEPARATOR", returnData)[0];
7
12
  case "SY":
8
13
  return PendleYTInterface.decodeFunctionResult("SY", returnData)[0];
9
14
  case "symbol":
@@ -24,6 +29,8 @@ export function decodeCall(calls, index, key, type) {
24
29
  return EnzymeInterface.decodeFunctionResult("getCreator", returnData)[0];
25
30
  case "factory":
26
31
  return FactoryInterface.decodeFunctionResult("factory", returnData)[0];
32
+ case "owner":
33
+ return LayerBankERC20Interface.decodeFunctionResult("owner", returnData)[0];
27
34
  case "token0":
28
35
  return UniswapV2PoolInterface.decodeFunctionResult("token0", returnData)[0];
29
36
  case "token1":
@@ -69,6 +76,10 @@ export function decodeCall(calls, index, key, type) {
69
76
  case tokenType.ironclad_borrowing:
70
77
  case tokenType.zerolend_lending:
71
78
  case tokenType.zerolend_borrowing:
79
+ case tokenType.avalon_lending:
80
+ case tokenType.avalon_borrowing:
81
+ case tokenType.superlend_lending:
82
+ case tokenType.superlend_borrowing:
72
83
  case tokenType.yei_borrowing:
73
84
  case tokenType.yei_lending:
74
85
  return AaveInterface.decodeFunctionResult("UNDERLYING_ASSET_ADDRESS", returnData)[0];
@@ -130,6 +130,10 @@ export function createCall(target, key, type, metaData) {
130
130
  case tokenType.ironclad_borrowing:
131
131
  case tokenType.zerolend_lending:
132
132
  case tokenType.zerolend_borrowing:
133
+ case tokenType.avalon_lending:
134
+ case tokenType.avalon_borrowing:
135
+ case tokenType.superlend_lending:
136
+ case tokenType.superlend_borrowing:
133
137
  case tokenType.yei_borrowing:
134
138
  case tokenType.yei_lending:
135
139
  return { allowFailure: true, callData: AaveInterface.encodeFunctionData("UNDERLYING_ASSET_ADDRESS"), target };
@@ -49,6 +49,8 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
49
49
  case tokenType.yei_borrowing:
50
50
  case tokenType.ironclad_borrowing:
51
51
  case tokenType.zerolend_borrowing:
52
+ case tokenType.avalon_borrowing:
53
+ case tokenType.superlend_borrowing:
52
54
  case tokenType.euler_borrow:
53
55
  return `Borrow ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
54
56
  case tokenType.ionic:
@@ -59,6 +61,8 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
59
61
  case tokenType.yei_lending:
60
62
  case tokenType.ironclad_lending:
61
63
  case tokenType.zerolend_lending:
64
+ case tokenType.avalon_lending:
65
+ case tokenType.superlend_lending:
62
66
  case tokenType.fraxlend:
63
67
  case tokenType.venus:
64
68
  case tokenType.reactor_fusion:
@@ -117,6 +121,10 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
117
121
  const parsedNameForCard = parsedName.join(" ");
118
122
  return `Deposit liquidity on ${parsedNameForCard} vault on Vicuna Finance`;
119
123
  }
124
+ case tokenType.satlayer:
125
+ return `Restake ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
126
+ case tokenType.veda:
127
+ return `Deposit into ${typeInfo.name.replace("Ether.Fi", "Veda")}`;
120
128
  default:
121
129
  return `Hold ${typeInfo.name} (${campaign.campaignParameters.symbolTargetToken})`;
122
130
  }