@merkl/api 0.16.15 → 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/entities/opportunity.js +7 -200
- 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/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
@@ -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;
|
@@ -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),
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerPoolProcessor.d.ts
CHANGED
@@ -22,6 +22,10 @@ type dataRawBP = callKeysBP & {
|
|
22
22
|
poolTokens: Array<{
|
23
23
|
token: string;
|
24
24
|
balance: string;
|
25
|
+
amountInPool: number;
|
26
|
+
symbol: string;
|
27
|
+
decimals: number;
|
28
|
+
price: number;
|
25
29
|
}>;
|
26
30
|
};
|
27
31
|
type dataTypeBP = dataType & {
|
@@ -30,7 +34,10 @@ type dataTypeBP = dataType & {
|
|
30
34
|
vault: string;
|
31
35
|
poolTokens: Array<{
|
32
36
|
token: string;
|
33
|
-
|
37
|
+
amountInPool: number;
|
38
|
+
symbol: string;
|
39
|
+
decimals: number;
|
40
|
+
price: number;
|
34
41
|
}>;
|
35
42
|
totalSupply: number;
|
36
43
|
blacklistedSupply: number;
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerPoolProcessor.js
CHANGED
@@ -25,7 +25,6 @@ export class BalancerPoolProcessor extends GenericProcessor {
|
|
25
25
|
const vaultBalanceBN = BigNumber.from(typeInfo.vaultBalance);
|
26
26
|
const totalSupplyUpdated = BN2Number(totalSupplyBN.sub(vaultBalanceBN), campaign.campaignParameters.decimalsTargetToken);
|
27
27
|
const vaultBalance = BN2Number(vaultBalanceBN, campaign.campaignParameters.decimalsTargetToken);
|
28
|
-
const poolTokensinfo = {};
|
29
28
|
let tvl = 0;
|
30
29
|
const symbols = [];
|
31
30
|
let indexUpdated = index + this.rounds.round4.length;
|
@@ -36,23 +35,16 @@ export class BalancerPoolProcessor extends GenericProcessor {
|
|
36
35
|
blacklistedSupply -= BN2Number(decodeCall(calls, index + vaultIndex, "balanceOf"), campaign.campaignParameters.decimalsTargetToken); // The vault balance was already removed from the total supply
|
37
36
|
}
|
38
37
|
for (const poolToken of typeInfo.poolTokens) {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
price: (await pricer.get({ symbol: symbol })) ?? 0,
|
46
|
-
};
|
47
|
-
tvl += poolTokensinfo[poolToken.token].price * poolTokensinfo[poolToken.token].amountInPool;
|
48
|
-
symbols.push(symbol);
|
38
|
+
poolToken.symbol = decodeCall(calls, indexUpdated++, "symbol");
|
39
|
+
poolToken.decimals = decodeCall(calls, indexUpdated++, "decimals");
|
40
|
+
poolToken.amountInPool = BN2Number(poolToken.balance, poolToken.decimals);
|
41
|
+
poolToken.price = (await pricer.get({ symbol: poolToken.symbol })) ?? 0;
|
42
|
+
tvl += poolToken.price * poolToken.amountInPool;
|
43
|
+
symbols.push(poolToken.symbol);
|
49
44
|
}
|
50
45
|
const priceTargetToken = tvl / totalSupplyUpdated;
|
51
46
|
return {
|
52
|
-
|
53
|
-
poolId: typeInfo.poolId,
|
54
|
-
vault: typeInfo.vault,
|
55
|
-
poolTokens: poolTokensinfo,
|
47
|
+
...typeInfo,
|
56
48
|
totalSupply: totalSupplyUpdated,
|
57
49
|
whitelistedSupplyTargetToken,
|
58
50
|
blacklistedSupply,
|
@@ -72,6 +64,10 @@ export class BalancerPoolProcessor extends GenericProcessor {
|
|
72
64
|
poolTokens.push({
|
73
65
|
token: token,
|
74
66
|
balance: balances[i].toString(),
|
67
|
+
amountInPool: 0,
|
68
|
+
symbol: "",
|
69
|
+
decimals: 0,
|
70
|
+
price: 0,
|
75
71
|
});
|
76
72
|
}
|
77
73
|
i++;
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.js
CHANGED
@@ -40,8 +40,10 @@ export class BalancerV3PoolProcessor extends GenericProcessor {
|
|
40
40
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
41
41
|
let tvl = 0;
|
42
42
|
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
43
|
-
|
43
|
+
let symbol = typeInfo[`symbolToken${i}`];
|
44
44
|
const price = (await pricer.get({ symbol: symbol })) ?? 0;
|
45
|
+
symbol = symbol.replace("wmooSiloV2Sonic", "");
|
46
|
+
typeInfo[`symbolToken${i}`] = symbol.replace(" (wS Market)", "");
|
45
47
|
const decimals = Number(typeInfo[`decimalsToken${i}`]);
|
46
48
|
const amount = BN2Number(typeInfo[`balanceToken${i}`], decimals);
|
47
49
|
tvl += amount * price;
|
@@ -58,10 +60,7 @@ export class BalancerV3PoolProcessor extends GenericProcessor {
|
|
58
60
|
}
|
59
61
|
const symbols = [];
|
60
62
|
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
61
|
-
|
62
|
-
symbolToClean = symbolToClean.replace("wmooSiloV2Sonic", "");
|
63
|
-
symbolToClean = symbolToClean.replace(" (wS Market)", "");
|
64
|
-
symbols.push(symbolToClean);
|
63
|
+
symbols.push(typeInfo[`symbolToken${i}`]);
|
65
64
|
}
|
66
65
|
return {
|
67
66
|
...typeInfo,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { decodeCall } from "../../../../../utils/decodeCalls";
|
2
2
|
import { createCall } from "../../../../../utils/encodeCalls";
|
3
3
|
import { generateCardName } from "../../../../../utils/generateCardName";
|
4
|
+
import { generateIcons } from "../../../../../utils/generateIcons";
|
4
5
|
import { BN2Number } from "@sdk";
|
5
6
|
import { tokenTypeToProtocol } from "../helpers/tokenType";
|
6
7
|
export var roundType;
|
@@ -130,7 +131,10 @@ export class GenericProcessor {
|
|
130
131
|
console.log("Round 5", {
|
131
132
|
type: type,
|
132
133
|
calls: [],
|
133
|
-
|
134
|
+
typeInfo: {
|
135
|
+
...outputInfo,
|
136
|
+
icons: generateIcons(type, typeInfo, campaign),
|
137
|
+
},
|
134
138
|
});
|
135
139
|
}
|
136
140
|
return {
|
@@ -138,6 +142,7 @@ export class GenericProcessor {
|
|
138
142
|
calls: [],
|
139
143
|
typeInfo: {
|
140
144
|
...outputInfo,
|
145
|
+
icons: generateIcons(type, typeInfo, campaign),
|
141
146
|
},
|
142
147
|
};
|
143
148
|
}
|
@@ -5,6 +5,7 @@ export class StakingProcessor extends GenericProcessor {
|
|
5
5
|
round1: [
|
6
6
|
{ key: "lockNFT", call: "lockNFT", target: "stakingContract", optional: true },
|
7
7
|
{ key: "eip712DomainName", call: "eip712DomainName", target: "stakingContract", optional: true },
|
8
|
+
{ key: "stakingSymbol", call: "symbol", target: "stakingContract", optional: true },
|
8
9
|
],
|
9
10
|
round2: [{ key: "stakingSymbol", call: "symbol", target: "lockNFT", optional: true }],
|
10
11
|
round3: [],
|
@@ -21,7 +21,6 @@ export class VicunaProcessor extends GenericProcessor {
|
|
21
21
|
const vicunaTVL = (await axios("https://vicuna.orthae.xyz/tvl/details")).data;
|
22
22
|
// find the entry that matches the vault address
|
23
23
|
const tvl = findTvlByVaultAddress(vicunaTVL[campaign.chainId], typeInfo.tokenAddress) ?? 0;
|
24
|
-
console.log("tvl", tvl);
|
25
24
|
const priceTargetToken = tvl / totalSupply;
|
26
25
|
return {
|
27
26
|
...typeInfo,
|
@@ -29,12 +29,14 @@ export class CurveProcessor extends GenericProcessor {
|
|
29
29
|
[typeInfo.token1]: typeInfo.symbolToken1,
|
30
30
|
[typeInfo.token2]: typeInfo.symbolToken2,
|
31
31
|
};
|
32
|
+
typeInfo.numberTokens = 3;
|
32
33
|
}
|
33
34
|
else {
|
34
35
|
typeInfo.poolTokens = {
|
35
36
|
[typeInfo.token0]: typeInfo.symbolToken0,
|
36
37
|
[typeInfo.token1]: typeInfo.symbolToken1,
|
37
38
|
};
|
39
|
+
typeInfo.numberTokens = 2;
|
38
40
|
}
|
39
41
|
if (type === tokenType.curve_2) {
|
40
42
|
const prices = [];
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
|
2
|
+
import type { Campaign, CampaignParameters } from "@sdk";
|
3
|
+
export declare function generateIcons(type: tokenType, typeInfo: any, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>, symbols?: string[]): string[];
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
|
2
|
+
import { OpportunityAction } from "../../database/api/.generated";
|
3
|
+
export function generateIcons(type, typeInfo, campaign, symbols = [""]) {
|
4
|
+
const action = typeInfo.action ? typeInfo.action : "HOLD";
|
5
|
+
switch (action) {
|
6
|
+
case OpportunityAction.POOL:
|
7
|
+
switch (type) {
|
8
|
+
case tokenType.balancerGauge:
|
9
|
+
case tokenType.balancerPool:
|
10
|
+
case tokenType.aura:
|
11
|
+
return Object.values(typeInfo.poolTokens ?? {})
|
12
|
+
.map(tkn => tkn?.symbol)
|
13
|
+
.filter(tkn => tkn && !tkn.includes("/"));
|
14
|
+
case tokenType.curve:
|
15
|
+
case tokenType.curve_2:
|
16
|
+
case tokenType.crosscurve: {
|
17
|
+
const icons = [];
|
18
|
+
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
19
|
+
if (typeInfo[`symbolToken${i}`])
|
20
|
+
icons.push(typeInfo[`symbolToken${i}`]);
|
21
|
+
}
|
22
|
+
return icons;
|
23
|
+
}
|
24
|
+
case tokenType.rfx_slv:
|
25
|
+
return [typeInfo.symbolAsset];
|
26
|
+
case tokenType.rfx:
|
27
|
+
return [typeInfo.symbolShortToken, typeInfo.symbolLongToken];
|
28
|
+
case tokenType.maverickBoostedPosition:
|
29
|
+
return [typeInfo.symbolTokenA, typeInfo.symbolTokenB];
|
30
|
+
default:
|
31
|
+
return [typeInfo.symbolToken0, typeInfo.symbolToken1];
|
32
|
+
}
|
33
|
+
case OpportunityAction.LEND:
|
34
|
+
switch (type) {
|
35
|
+
case tokenType.compound:
|
36
|
+
return [typeInfo.symbolBaseToken];
|
37
|
+
default:
|
38
|
+
return [typeInfo.symbolUnderlyingToken];
|
39
|
+
}
|
40
|
+
case OpportunityAction.BORROW:
|
41
|
+
return [typeInfo.symbolUnderlyingToken];
|
42
|
+
case OpportunityAction.HOLD:
|
43
|
+
switch (type) {
|
44
|
+
case tokenType.toros:
|
45
|
+
case tokenType.enzyme:
|
46
|
+
return [typeInfo.symbolUnderlyingToken];
|
47
|
+
default:
|
48
|
+
return [campaign.campaignParameters.symbolTargetToken];
|
49
|
+
}
|
50
|
+
default:
|
51
|
+
return [];
|
52
|
+
}
|
53
|
+
}
|