@merkl/api 0.16.14 → 0.16.16
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.
- package/dist/src/eden/index.d.ts +270 -0
- package/dist/src/entities/opportunity.js +7 -200
- package/dist/src/index.d.ts +62 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.d.ts +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.js +10 -12
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerPoolProcessor.d.ts +8 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerPoolProcessor.js +11 -15
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.js +4 -5
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +6 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/VicunaProcessor.js +0 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveProcessor.d.ts +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveProcessor.js +2 -0
- package/dist/src/modules/v4/referral/referral.controller.d.ts +82 -0
- package/dist/src/modules/v4/referral/referral.controller.js +25 -0
- package/dist/src/modules/v4/referral/referral.model.d.ts +10 -0
- package/dist/src/modules/v4/referral/referral.model.js +12 -0
- package/dist/src/modules/v4/referral/referral.service.d.ts +216 -0
- package/dist/src/modules/v4/referral/referral.service.js +170 -0
- package/dist/src/modules/v4/router.d.ts +62 -0
- package/dist/src/modules/v4/router.js +3 -1
- package/dist/src/utils/generateIcons.d.ts +3 -0
- package/dist/src/utils/generateIcons.js +53 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -3142,6 +3142,58 @@ declare const eden: {
|
|
3142
3142
|
}>>;
|
3143
3143
|
};
|
3144
3144
|
};
|
3145
|
+
referral: {
|
3146
|
+
code: {
|
3147
|
+
get: (options: {
|
3148
|
+
headers?: Record<string, unknown> | undefined;
|
3149
|
+
query: {
|
3150
|
+
chainId: number;
|
3151
|
+
address: string;
|
3152
|
+
referralKey: string;
|
3153
|
+
};
|
3154
|
+
fetch?: RequestInit | undefined;
|
3155
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
3156
|
+
200: {
|
3157
|
+
code: string;
|
3158
|
+
referrer: boolean;
|
3159
|
+
referredUsers: never[];
|
3160
|
+
transaction: {
|
3161
|
+
to: string;
|
3162
|
+
data: `0x${string}`;
|
3163
|
+
};
|
3164
|
+
} | {
|
3165
|
+
code: any;
|
3166
|
+
referrer: boolean;
|
3167
|
+
referredUsers: any;
|
3168
|
+
transaction?: undefined;
|
3169
|
+
};
|
3170
|
+
}>>;
|
3171
|
+
};
|
3172
|
+
redeem: {
|
3173
|
+
get: (options: {
|
3174
|
+
headers?: Record<string, unknown> | undefined;
|
3175
|
+
query: {
|
3176
|
+
code: string;
|
3177
|
+
chainId: number;
|
3178
|
+
referralKey: string;
|
3179
|
+
};
|
3180
|
+
fetch?: RequestInit | undefined;
|
3181
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
3182
|
+
200: {
|
3183
|
+
code: string;
|
3184
|
+
referrer: any;
|
3185
|
+
transaction?: undefined;
|
3186
|
+
} | {
|
3187
|
+
code: string;
|
3188
|
+
referrer: any;
|
3189
|
+
transaction: {
|
3190
|
+
to: string;
|
3191
|
+
data: `0x${string}`;
|
3192
|
+
};
|
3193
|
+
};
|
3194
|
+
}>>;
|
3195
|
+
};
|
3196
|
+
};
|
3145
3197
|
} | {
|
3146
3198
|
derive: {};
|
3147
3199
|
resolve: {};
|
@@ -6191,6 +6243,58 @@ declare const eden: {
|
|
6191
6243
|
}>>;
|
6192
6244
|
};
|
6193
6245
|
};
|
6246
|
+
referral: {
|
6247
|
+
code: {
|
6248
|
+
get: (options: {
|
6249
|
+
headers?: Record<string, unknown> | undefined;
|
6250
|
+
query: {
|
6251
|
+
chainId: number;
|
6252
|
+
address: string;
|
6253
|
+
referralKey: string;
|
6254
|
+
};
|
6255
|
+
fetch?: RequestInit | undefined;
|
6256
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6257
|
+
200: {
|
6258
|
+
code: string;
|
6259
|
+
referrer: boolean;
|
6260
|
+
referredUsers: never[];
|
6261
|
+
transaction: {
|
6262
|
+
to: string;
|
6263
|
+
data: `0x${string}`;
|
6264
|
+
};
|
6265
|
+
} | {
|
6266
|
+
code: any;
|
6267
|
+
referrer: boolean;
|
6268
|
+
referredUsers: any;
|
6269
|
+
transaction?: undefined;
|
6270
|
+
};
|
6271
|
+
}>>;
|
6272
|
+
};
|
6273
|
+
redeem: {
|
6274
|
+
get: (options: {
|
6275
|
+
headers?: Record<string, unknown> | undefined;
|
6276
|
+
query: {
|
6277
|
+
code: string;
|
6278
|
+
chainId: number;
|
6279
|
+
referralKey: string;
|
6280
|
+
};
|
6281
|
+
fetch?: RequestInit | undefined;
|
6282
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6283
|
+
200: {
|
6284
|
+
code: string;
|
6285
|
+
referrer: any;
|
6286
|
+
transaction?: undefined;
|
6287
|
+
} | {
|
6288
|
+
code: string;
|
6289
|
+
referrer: any;
|
6290
|
+
transaction: {
|
6291
|
+
to: string;
|
6292
|
+
data: `0x${string}`;
|
6293
|
+
};
|
6294
|
+
};
|
6295
|
+
}>>;
|
6296
|
+
};
|
6297
|
+
};
|
6194
6298
|
};
|
6195
6299
|
v3: {
|
6196
6300
|
app: {
|
@@ -10715,6 +10819,68 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10715
10819
|
};
|
10716
10820
|
};
|
10717
10821
|
};
|
10822
|
+
} & {
|
10823
|
+
v4: {
|
10824
|
+
referral: {
|
10825
|
+
code: {
|
10826
|
+
get: {
|
10827
|
+
body: unknown;
|
10828
|
+
params: {};
|
10829
|
+
query: {
|
10830
|
+
chainId: number;
|
10831
|
+
address: string;
|
10832
|
+
referralKey: string;
|
10833
|
+
};
|
10834
|
+
headers: unknown;
|
10835
|
+
response: {
|
10836
|
+
200: {
|
10837
|
+
code: string;
|
10838
|
+
referrer: boolean;
|
10839
|
+
referredUsers: never[];
|
10840
|
+
transaction: {
|
10841
|
+
to: string;
|
10842
|
+
data: `0x${string}`;
|
10843
|
+
};
|
10844
|
+
} | {
|
10845
|
+
code: any;
|
10846
|
+
referrer: boolean;
|
10847
|
+
referredUsers: any;
|
10848
|
+
transaction?: undefined;
|
10849
|
+
};
|
10850
|
+
};
|
10851
|
+
};
|
10852
|
+
};
|
10853
|
+
};
|
10854
|
+
} & {
|
10855
|
+
referral: {
|
10856
|
+
redeem: {
|
10857
|
+
get: {
|
10858
|
+
body: unknown;
|
10859
|
+
params: {};
|
10860
|
+
query: {
|
10861
|
+
code: string;
|
10862
|
+
chainId: number;
|
10863
|
+
referralKey: string;
|
10864
|
+
};
|
10865
|
+
headers: unknown;
|
10866
|
+
response: {
|
10867
|
+
200: {
|
10868
|
+
code: string;
|
10869
|
+
referrer: any;
|
10870
|
+
transaction?: undefined;
|
10871
|
+
} | {
|
10872
|
+
code: string;
|
10873
|
+
referrer: any;
|
10874
|
+
transaction: {
|
10875
|
+
to: string;
|
10876
|
+
data: `0x${string}`;
|
10877
|
+
};
|
10878
|
+
};
|
10879
|
+
};
|
10880
|
+
};
|
10881
|
+
};
|
10882
|
+
};
|
10883
|
+
};
|
10718
10884
|
} & {
|
10719
10885
|
v3: {
|
10720
10886
|
app: {
|
@@ -14645,6 +14811,58 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14645
14811
|
}>>;
|
14646
14812
|
};
|
14647
14813
|
};
|
14814
|
+
referral: {
|
14815
|
+
code: {
|
14816
|
+
get: (options: {
|
14817
|
+
headers?: Record<string, unknown> | undefined;
|
14818
|
+
query: {
|
14819
|
+
chainId: number;
|
14820
|
+
address: string;
|
14821
|
+
referralKey: string;
|
14822
|
+
};
|
14823
|
+
fetch?: RequestInit | undefined;
|
14824
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
14825
|
+
200: {
|
14826
|
+
code: string;
|
14827
|
+
referrer: boolean;
|
14828
|
+
referredUsers: never[];
|
14829
|
+
transaction: {
|
14830
|
+
to: string;
|
14831
|
+
data: `0x${string}`;
|
14832
|
+
};
|
14833
|
+
} | {
|
14834
|
+
code: any;
|
14835
|
+
referrer: boolean;
|
14836
|
+
referredUsers: any;
|
14837
|
+
transaction?: undefined;
|
14838
|
+
};
|
14839
|
+
}>>;
|
14840
|
+
};
|
14841
|
+
redeem: {
|
14842
|
+
get: (options: {
|
14843
|
+
headers?: Record<string, unknown> | undefined;
|
14844
|
+
query: {
|
14845
|
+
code: string;
|
14846
|
+
chainId: number;
|
14847
|
+
referralKey: string;
|
14848
|
+
};
|
14849
|
+
fetch?: RequestInit | undefined;
|
14850
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
14851
|
+
200: {
|
14852
|
+
code: string;
|
14853
|
+
referrer: any;
|
14854
|
+
transaction?: undefined;
|
14855
|
+
} | {
|
14856
|
+
code: string;
|
14857
|
+
referrer: any;
|
14858
|
+
transaction: {
|
14859
|
+
to: string;
|
14860
|
+
data: `0x${string}`;
|
14861
|
+
};
|
14862
|
+
};
|
14863
|
+
}>>;
|
14864
|
+
};
|
14865
|
+
};
|
14648
14866
|
} | {
|
14649
14867
|
derive: {};
|
14650
14868
|
resolve: {};
|
@@ -17694,6 +17912,58 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17694
17912
|
}>>;
|
17695
17913
|
};
|
17696
17914
|
};
|
17915
|
+
referral: {
|
17916
|
+
code: {
|
17917
|
+
get: (options: {
|
17918
|
+
headers?: Record<string, unknown> | undefined;
|
17919
|
+
query: {
|
17920
|
+
chainId: number;
|
17921
|
+
address: string;
|
17922
|
+
referralKey: string;
|
17923
|
+
};
|
17924
|
+
fetch?: RequestInit | undefined;
|
17925
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
17926
|
+
200: {
|
17927
|
+
code: string;
|
17928
|
+
referrer: boolean;
|
17929
|
+
referredUsers: never[];
|
17930
|
+
transaction: {
|
17931
|
+
to: string;
|
17932
|
+
data: `0x${string}`;
|
17933
|
+
};
|
17934
|
+
} | {
|
17935
|
+
code: any;
|
17936
|
+
referrer: boolean;
|
17937
|
+
referredUsers: any;
|
17938
|
+
transaction?: undefined;
|
17939
|
+
};
|
17940
|
+
}>>;
|
17941
|
+
};
|
17942
|
+
redeem: {
|
17943
|
+
get: (options: {
|
17944
|
+
headers?: Record<string, unknown> | undefined;
|
17945
|
+
query: {
|
17946
|
+
code: string;
|
17947
|
+
chainId: number;
|
17948
|
+
referralKey: string;
|
17949
|
+
};
|
17950
|
+
fetch?: RequestInit | undefined;
|
17951
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
17952
|
+
200: {
|
17953
|
+
code: string;
|
17954
|
+
referrer: any;
|
17955
|
+
transaction?: undefined;
|
17956
|
+
} | {
|
17957
|
+
code: string;
|
17958
|
+
referrer: any;
|
17959
|
+
transaction: {
|
17960
|
+
to: string;
|
17961
|
+
data: `0x${string}`;
|
17962
|
+
};
|
17963
|
+
};
|
17964
|
+
}>>;
|
17965
|
+
};
|
17966
|
+
};
|
17697
17967
|
};
|
17698
17968
|
v3: {
|
17699
17969
|
app: {
|
@@ -123,7 +123,11 @@ export const extractOpportunities = {
|
|
123
123
|
tokenIcons: [params.baseToken, params.quoteToken],
|
124
124
|
rewardTokenIcons: getRewardTokenIcons(campaigns.active),
|
125
125
|
dailyRewardTokens: getRewardTokens(campaigns.active),
|
126
|
-
campaigns: {
|
126
|
+
campaigns: {
|
127
|
+
...campaigns,
|
128
|
+
type: Campaign.AMBIENTPROCESSOR,
|
129
|
+
ids: campaigns.all.map(c => c.campaignId),
|
130
|
+
},
|
127
131
|
};
|
128
132
|
return opportunity;
|
129
133
|
},
|
@@ -244,97 +248,6 @@ export const extractOpportunities = {
|
|
244
248
|
[Campaign.ERC20]: (campaign, campaigns, prices) => {
|
245
249
|
const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
|
246
250
|
const { active, all } = campaigns;
|
247
|
-
// DEPRECATED!!!!
|
248
|
-
const map = {
|
249
|
-
actions: {
|
250
|
-
pool: [
|
251
|
-
"uniswapv2",
|
252
|
-
"velodrome",
|
253
|
-
"aerodrome",
|
254
|
-
"balancerGauge",
|
255
|
-
"balancerPool",
|
256
|
-
"curve",
|
257
|
-
"aura",
|
258
|
-
"akron",
|
259
|
-
"beefy",
|
260
|
-
"dragonswap",
|
261
|
-
"poolside",
|
262
|
-
"koi",
|
263
|
-
"pancakeswap",
|
264
|
-
"tempest",
|
265
|
-
"cross_curve",
|
266
|
-
"curve",
|
267
|
-
"curve_2",
|
268
|
-
"curveNPool",
|
269
|
-
"zkswap",
|
270
|
-
"maverickBoostedPosition",
|
271
|
-
"zkSwapThreePool",
|
272
|
-
"syncswap",
|
273
|
-
"rfx",
|
274
|
-
],
|
275
|
-
borrow: [
|
276
|
-
"radiant_borrow",
|
277
|
-
"aave_borrowing",
|
278
|
-
"euler_borrow",
|
279
|
-
"zerolend_borrowing",
|
280
|
-
"vicuna_borrowing",
|
281
|
-
"takotako_borrowing",
|
282
|
-
"lendle_borrowing",
|
283
|
-
],
|
284
|
-
lend: [
|
285
|
-
"gearbox",
|
286
|
-
"compound",
|
287
|
-
"radiant_lend",
|
288
|
-
"aave_lending",
|
289
|
-
"vicuna_lending",
|
290
|
-
"takotako_lending",
|
291
|
-
"lendle_lending",
|
292
|
-
"vicuna_lending",
|
293
|
-
"sturdy_aggregator",
|
294
|
-
"sturdy_silo",
|
295
|
-
"fraxlend",
|
296
|
-
"moonwell",
|
297
|
-
"ionic",
|
298
|
-
"fluid",
|
299
|
-
"silostaking",
|
300
|
-
"euler_lend",
|
301
|
-
"layerbank",
|
302
|
-
"zerolend_lending",
|
303
|
-
"venus",
|
304
|
-
"reactor_fusion",
|
305
|
-
"woofi",
|
306
|
-
],
|
307
|
-
},
|
308
|
-
icons: {
|
309
|
-
pool: () => {
|
310
|
-
if (["balancerGauge", "balancerPool"].includes(campaign.type ?? ""))
|
311
|
-
return Object.values(typeInfo.poolTokens ?? {})
|
312
|
-
.map(tkn => tkn?.symbol)
|
313
|
-
.filter(tkn => tkn);
|
314
|
-
if (["curve"].includes(campaign.type ?? ""))
|
315
|
-
return Object.values(typeInfo.poolTokens ?? {}).filter(tkn => tkn);
|
316
|
-
if (["rfx"].includes(campaign.type ?? "")) {
|
317
|
-
return [typeInfo.symbolShortToken, typeInfo.symbolLongToken];
|
318
|
-
}
|
319
|
-
if (["maverickBoostedPosition"].includes(campaign.type ?? "")) {
|
320
|
-
return [typeInfo.symbolTokenA, typeInfo.symbolTokenB];
|
321
|
-
}
|
322
|
-
return [typeInfo.symbolToken0, typeInfo.symbolToken1];
|
323
|
-
},
|
324
|
-
lend: () => (campaign.type === "compound" ? [typeInfo.symbolBaseToken] : [typeInfo.symbolUnderlyingToken]),
|
325
|
-
borrow: () => [typeInfo.symbolUnderlyingToken],
|
326
|
-
hold: () => {
|
327
|
-
if (["toros", "enzyme"].includes(campaign.type))
|
328
|
-
return [typeInfo.symbolUnderlyingToken];
|
329
|
-
return [campaign.campaignParameters.symbolTargetToken];
|
330
|
-
},
|
331
|
-
},
|
332
|
-
};
|
333
|
-
const action = typeInfo.action.toLowerCase() ?? "hold";
|
334
|
-
// (Object.entries(map.actions).find(([_action, _types]) =>
|
335
|
-
// _types.includes(campaign.type ?? "")
|
336
|
-
// )?.[0] as ERC20Actions) ?? "hold";
|
337
|
-
const icons = map.icons[action]();
|
338
251
|
const opportunity = {
|
339
252
|
id: `${Campaign.ERC20}_${mainParameter}`,
|
340
253
|
platform: params.symbolTargetToken,
|
@@ -342,12 +255,12 @@ export const extractOpportunities = {
|
|
342
255
|
chainId: !computeChainId ? chainId : computeChainId,
|
343
256
|
distributionChainId: chainId,
|
344
257
|
tvl,
|
345
|
-
action,
|
258
|
+
action: typeInfo.action ? typeInfo.action.toLowerCase() : "hold",
|
346
259
|
apr: getApr(active),
|
347
260
|
status: getStatus(all),
|
348
261
|
tags: getTags(campaigns.all),
|
349
262
|
dailyrewards: getDailyRewards(active, prices),
|
350
|
-
tokenIcons: icons,
|
263
|
+
tokenIcons: typeInfo.icons,
|
351
264
|
campaigns: { ...campaigns, type: Campaign.ERC20, ids: campaigns.all.map(c => c.campaignId) },
|
352
265
|
rewardTokenIcons: getRewardTokenIcons(campaigns.active),
|
353
266
|
dailyRewardTokens: getRewardTokens(campaigns.active),
|
@@ -651,112 +564,6 @@ export const extractOpportunities = {
|
|
651
564
|
};
|
652
565
|
return opportunity;
|
653
566
|
},
|
654
|
-
[Campaign.ERC20]: (campaign, campaigns, prices) => {
|
655
|
-
const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
|
656
|
-
const { active, all } = campaigns;
|
657
|
-
// DEPRECATED!!!!
|
658
|
-
const map = {
|
659
|
-
actions: {
|
660
|
-
pool: [
|
661
|
-
"uniswapv2",
|
662
|
-
"velodrome",
|
663
|
-
"aerodrome",
|
664
|
-
"balancerGauge",
|
665
|
-
"balancerPool",
|
666
|
-
"curve",
|
667
|
-
"aura",
|
668
|
-
"akron",
|
669
|
-
"beefy",
|
670
|
-
"dragonswap",
|
671
|
-
"poolside",
|
672
|
-
"koi",
|
673
|
-
"pancakeswap",
|
674
|
-
"tempest",
|
675
|
-
"cross_curve",
|
676
|
-
"zkswap",
|
677
|
-
"maverickBoostedPosition",
|
678
|
-
"zkSwapThreePool",
|
679
|
-
"syncswap",
|
680
|
-
"rfx",
|
681
|
-
],
|
682
|
-
borrow: [
|
683
|
-
"radiant_borrow",
|
684
|
-
"aave_borrowing",
|
685
|
-
"euler_borrow",
|
686
|
-
"zerolend_borrowing",
|
687
|
-
"takotako_borrowing",
|
688
|
-
"lendle_borrowing",
|
689
|
-
"vicuna_borrowing",
|
690
|
-
],
|
691
|
-
lend: [
|
692
|
-
"gearbox",
|
693
|
-
"compound",
|
694
|
-
"radiant_lend",
|
695
|
-
"aave_lending",
|
696
|
-
"vicuna_lending",
|
697
|
-
"takotako_lending",
|
698
|
-
"lendle_lending",
|
699
|
-
"sturdy_aggregator",
|
700
|
-
"sturdy_silo",
|
701
|
-
"fraxlend",
|
702
|
-
"moonwell",
|
703
|
-
"ionic",
|
704
|
-
"fluid",
|
705
|
-
"silostaking",
|
706
|
-
"euler_lend",
|
707
|
-
"layerbank",
|
708
|
-
"zerolend_lending",
|
709
|
-
"venus",
|
710
|
-
"reactor_fusion",
|
711
|
-
"woofi",
|
712
|
-
],
|
713
|
-
},
|
714
|
-
icons: {
|
715
|
-
pool: () => {
|
716
|
-
if (["balancerGauge", "balancerPool", "aura"].includes(campaign.type ?? ""))
|
717
|
-
return Object.values(typeInfo.poolTokens ?? {})
|
718
|
-
.map(tkn => tkn?.symbol)
|
719
|
-
.filter(tkn => tkn);
|
720
|
-
if (["curve"].includes(campaign.type ?? ""))
|
721
|
-
return Object.values(typeInfo.poolTokens ?? {}).filter(tkn => tkn);
|
722
|
-
if (["rfx"].includes(campaign.type ?? "")) {
|
723
|
-
return [typeInfo.symbolShortToken, typeInfo.symbolLongToken];
|
724
|
-
}
|
725
|
-
if (["maverickBoostedPosition"].includes(campaign.type ?? "")) {
|
726
|
-
return [typeInfo.symbolTokenA, typeInfo.symbolTokenB];
|
727
|
-
}
|
728
|
-
return [typeInfo.symbolToken0, typeInfo.symbolToken1];
|
729
|
-
},
|
730
|
-
lend: () => (campaign.type === "compound" ? [typeInfo.symbolBaseToken] : [typeInfo.symbolUnderlyingToken]),
|
731
|
-
borrow: () => [typeInfo.symbolUnderlyingToken],
|
732
|
-
hold: () => {
|
733
|
-
if (["toros", "enzyme"].includes(campaign.type))
|
734
|
-
return [typeInfo.symbolUnderlyingToken];
|
735
|
-
return [campaign.campaignParameters.symbolTargetToken];
|
736
|
-
},
|
737
|
-
},
|
738
|
-
};
|
739
|
-
const action = Object.entries(map.actions).find(([_action, _types]) => _types.includes(campaign.type ?? ""))?.[0] ?? "hold";
|
740
|
-
const icons = map.icons[action]();
|
741
|
-
const opportunity = {
|
742
|
-
id: `${Campaign.ERC20}_${mainParameter}`,
|
743
|
-
platform: params.symbolTargetToken,
|
744
|
-
name: typeInfo?.cardName,
|
745
|
-
chainId: !computeChainId ? chainId : computeChainId,
|
746
|
-
distributionChainId: chainId,
|
747
|
-
tvl,
|
748
|
-
action,
|
749
|
-
apr: getApr(active),
|
750
|
-
status: getStatus(all),
|
751
|
-
tags: getTags(campaigns.all),
|
752
|
-
dailyrewards: getDailyRewards(active, prices),
|
753
|
-
tokenIcons: icons,
|
754
|
-
campaigns: { ...campaigns, type: Campaign.ERC20, ids: campaigns.all.map(c => c.campaignId) },
|
755
|
-
rewardTokenIcons: getRewardTokenIcons(campaigns.active),
|
756
|
-
dailyRewardTokens: getRewardTokens(campaigns.active),
|
757
|
-
};
|
758
|
-
return opportunity;
|
759
|
-
},
|
760
567
|
[Campaign.ERC20LOGPROCESSOR]: (campaign, campaigns, prices) => {
|
761
568
|
const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
|
762
569
|
const { active, all } = campaigns;
|
package/dist/src/index.d.ts
CHANGED
@@ -3919,6 +3919,68 @@ declare const app: Elysia<"", false, {
|
|
3919
3919
|
};
|
3920
3920
|
};
|
3921
3921
|
};
|
3922
|
+
} & {
|
3923
|
+
v4: {
|
3924
|
+
referral: {
|
3925
|
+
code: {
|
3926
|
+
get: {
|
3927
|
+
body: unknown;
|
3928
|
+
params: {};
|
3929
|
+
query: {
|
3930
|
+
chainId: number;
|
3931
|
+
address: string;
|
3932
|
+
referralKey: string;
|
3933
|
+
};
|
3934
|
+
headers: unknown;
|
3935
|
+
response: {
|
3936
|
+
200: {
|
3937
|
+
code: string;
|
3938
|
+
referrer: boolean;
|
3939
|
+
referredUsers: never[];
|
3940
|
+
transaction: {
|
3941
|
+
to: string;
|
3942
|
+
data: `0x${string}`;
|
3943
|
+
};
|
3944
|
+
} | {
|
3945
|
+
code: any;
|
3946
|
+
referrer: boolean;
|
3947
|
+
referredUsers: any;
|
3948
|
+
transaction?: undefined;
|
3949
|
+
};
|
3950
|
+
};
|
3951
|
+
};
|
3952
|
+
};
|
3953
|
+
};
|
3954
|
+
} & {
|
3955
|
+
referral: {
|
3956
|
+
redeem: {
|
3957
|
+
get: {
|
3958
|
+
body: unknown;
|
3959
|
+
params: {};
|
3960
|
+
query: {
|
3961
|
+
code: string;
|
3962
|
+
chainId: number;
|
3963
|
+
referralKey: string;
|
3964
|
+
};
|
3965
|
+
headers: unknown;
|
3966
|
+
response: {
|
3967
|
+
200: {
|
3968
|
+
code: string;
|
3969
|
+
referrer: any;
|
3970
|
+
transaction?: undefined;
|
3971
|
+
} | {
|
3972
|
+
code: string;
|
3973
|
+
referrer: any;
|
3974
|
+
transaction: {
|
3975
|
+
to: string;
|
3976
|
+
data: `0x${string}`;
|
3977
|
+
};
|
3978
|
+
};
|
3979
|
+
};
|
3980
|
+
};
|
3981
|
+
};
|
3982
|
+
};
|
3983
|
+
};
|
3922
3984
|
} & {
|
3923
3985
|
v3: {
|
3924
3986
|
app: {
|
@@ -156,7 +156,7 @@ export const tokenTypeToProtocol = {
|
|
156
156
|
[tokenType.holdstation]: { protocol: "HoldStation", action: OpportunityAction.HOLD },
|
157
157
|
[tokenType.staking]: { protocol: "Staking", action: OpportunityAction.HOLD },
|
158
158
|
[tokenType.noLinkVault]: { protocol: "NoLinkVault", action: OpportunityAction.HOLD },
|
159
|
-
[tokenType.cpmmGamma]: { protocol: "GammaSwap", action: OpportunityAction.
|
159
|
+
[tokenType.cpmmGamma]: { protocol: "GammaSwap", action: OpportunityAction.POOL },
|
160
160
|
[tokenType.crosscurve]: { protocol: "CrossCurve", action: OpportunityAction.POOL },
|
161
161
|
[tokenType.curveNPool]: { protocol: "Curve", action: OpportunityAction.POOL },
|
162
162
|
[tokenType.vicuna]: { protocol: "Vicuna", action: OpportunityAction.HOLD },
|
@@ -28,6 +28,10 @@ type dataRawAura = callKeysAura & {
|
|
28
28
|
poolTokens: Array<{
|
29
29
|
token: string;
|
30
30
|
balance: string;
|
31
|
+
amountInPool: number;
|
32
|
+
symbol: string;
|
33
|
+
decimals: number;
|
34
|
+
price: number;
|
31
35
|
}>;
|
32
36
|
};
|
33
37
|
type dataTypeAura = dataType & {
|
@@ -46,6 +50,10 @@ type dataTypeAura = dataType & {
|
|
46
50
|
poolTokens: Array<{
|
47
51
|
token: string;
|
48
52
|
balance: string;
|
53
|
+
amountInPool: number;
|
54
|
+
symbol: string;
|
55
|
+
decimals: number;
|
56
|
+
price: number;
|
49
57
|
}>;
|
50
58
|
};
|
51
59
|
export declare class AuraProcessor extends GenericProcessor<callKeysAura, dataRawAura, dataTypeAura> {
|
@@ -38,6 +38,10 @@ export class AuraProcessor extends GenericProcessor {
|
|
38
38
|
poolTokens.push({
|
39
39
|
token: token,
|
40
40
|
balance: balances[i].toString(),
|
41
|
+
amountInPool: 0,
|
42
|
+
symbol: "",
|
43
|
+
decimals: 0,
|
44
|
+
price: 0,
|
41
45
|
});
|
42
46
|
i++;
|
43
47
|
typeInfo.poolTokens = poolTokens;
|
@@ -57,21 +61,16 @@ export class AuraProcessor extends GenericProcessor {
|
|
57
61
|
const gaugeBalance = BN2Number(typeInfo.gaugeBalance, 18);
|
58
62
|
const auraBalance = BN2Number(typeInfo.auraBalance, 18);
|
59
63
|
const totalSupplyGauge = BN2Number(typeInfo.totalSupplyGauge, 18);
|
60
|
-
const poolTokensinfo = {};
|
61
64
|
let poolTvl = 0;
|
62
65
|
const symbols = [];
|
63
66
|
let indexUpdated = index + this.rounds.round4.length;
|
64
67
|
for (const poolToken of typeInfo.poolTokens) {
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
price: (await pricer.get({ symbol: symbol })) ?? 0,
|
72
|
-
};
|
73
|
-
poolTvl += poolTokensinfo[poolToken.token].price * poolTokensinfo[poolToken.token].amountInPool;
|
74
|
-
symbols.push(symbol);
|
68
|
+
poolToken.symbol = decodeCall(calls, indexUpdated++, "symbol");
|
69
|
+
poolToken.decimals = decodeCall(calls, indexUpdated++, "decimals");
|
70
|
+
poolToken.amountInPool = BN2Number(poolToken.balance, poolToken.decimals);
|
71
|
+
poolToken.price = (await pricer.get({ symbol: poolToken.symbol })) ?? 0;
|
72
|
+
poolTvl += poolToken.price * poolToken.amountInPool;
|
73
|
+
symbols.push(poolToken.symbol);
|
75
74
|
}
|
76
75
|
const percentageOfSupplyInAura = (auraBalance / totalSupplyGauge) * (gaugeBalance / totalSupplyBalancerPool);
|
77
76
|
const tvl = poolTvl * percentageOfSupplyInAura;
|
@@ -85,7 +84,6 @@ export class AuraProcessor extends GenericProcessor {
|
|
85
84
|
totalSupply,
|
86
85
|
whitelistedSupplyTargetToken,
|
87
86
|
blacklistedSupply,
|
88
|
-
poolTokens: poolTokensinfo,
|
89
87
|
tvl: tvl,
|
90
88
|
priceTargetToken: priceTargetToken,
|
91
89
|
cardName: generateCardName(type, typeInfo, campaign, symbols),
|