@merkl/api 0.20.33 → 0.20.35
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 +73 -13
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.d.ts +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/spliceTVL.d.ts +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/spliceTVL.js +2 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.js +7 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.js +7 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.js +5 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.d.ts +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.js +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.d.ts +16 -16
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.js +27 -23
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.js +5 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.js +11 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.js +11 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.js +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.js +5 -38
- package/dist/src/index.d.ts +13 -1
- package/dist/src/modules/v4/chain/chain.controller.d.ts +2 -0
- package/dist/src/modules/v4/chain/chain.model.d.ts +1 -0
- package/dist/src/modules/v4/chain/chain.model.js +1 -0
- package/dist/src/modules/v4/chain/chain.repository.d.ts +11 -0
- package/dist/src/modules/v4/chain/chain.repository.js +4 -1
- package/dist/src/modules/v4/chain/chain.service.js +4 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.js +4 -2
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +3 -3
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +11 -1
- package/dist/src/modules/v4/protocol/protocol.controller.js +2 -1
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
- package/dist/src/modules/v4/protocol/protocol.repository.js +33 -28
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.service.js +8 -1
- package/dist/src/modules/v4/router.d.ts +13 -1
- package/dist/src/utils/generateCardName.d.ts +1 -1
- package/dist/src/utils/generateCardName.js +3 -15
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -10,31 +10,31 @@ type callType = {
|
|
10
10
|
};
|
11
11
|
type callKeysMaverickBP = mandatoryCallKeys & {
|
12
12
|
boostedPositionInformation: string;
|
13
|
-
|
14
|
-
|
13
|
+
token0: string;
|
14
|
+
token1: string;
|
15
15
|
lensAddress: string;
|
16
16
|
};
|
17
17
|
type dataRawMaverickBP = callKeysMaverickBP & {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
amount0: string;
|
19
|
+
amount1: string;
|
20
|
+
decimalsToken0: string;
|
21
|
+
decimalsToken1: string;
|
22
22
|
bpInfoReturnData: {
|
23
23
|
[key: string]: string | number;
|
24
24
|
};
|
25
|
-
|
26
|
-
|
25
|
+
symbolToken0: string;
|
26
|
+
symbolToken1: string;
|
27
27
|
};
|
28
28
|
type dataTypeMaverickBP = dataType & {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
amount0: number;
|
30
|
+
amount1: number;
|
31
|
+
decimalsToken0: number;
|
32
|
+
decimalsToken1: number;
|
33
33
|
lensAddress: string;
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
symbolToken0: string;
|
35
|
+
symbolToken1: string;
|
36
|
+
token0: string;
|
37
|
+
token1: string;
|
38
38
|
};
|
39
39
|
export declare class MaverickBPProcessor extends GenericProcessor<callKeysMaverickBP, dataRawMaverickBP, dataTypeMaverickBP> {
|
40
40
|
rounds: {
|
@@ -14,24 +14,24 @@ export class MaverickBPProcessor extends GenericProcessor {
|
|
14
14
|
],
|
15
15
|
round2: [
|
16
16
|
{
|
17
|
-
key: "
|
17
|
+
key: "symbolToken0",
|
18
18
|
call: "symbol",
|
19
|
-
target: "
|
19
|
+
target: "token0",
|
20
20
|
},
|
21
21
|
{
|
22
|
-
key: "
|
22
|
+
key: "symbolToken1",
|
23
23
|
call: "symbol",
|
24
|
-
target: "
|
24
|
+
target: "token1",
|
25
25
|
},
|
26
26
|
{
|
27
|
-
key: "
|
27
|
+
key: "decimalsToken0",
|
28
28
|
call: "decimals",
|
29
|
-
target: "
|
29
|
+
target: "token0",
|
30
30
|
},
|
31
31
|
{
|
32
|
-
key: "
|
32
|
+
key: "decimalsToken1",
|
33
33
|
call: "decimals",
|
34
|
-
target: "
|
34
|
+
target: "token1",
|
35
35
|
},
|
36
36
|
],
|
37
37
|
round3: [],
|
@@ -41,34 +41,38 @@ export class MaverickBPProcessor extends GenericProcessor {
|
|
41
41
|
typeInfo.lensAddress = MAVERICK_ZKSYNC_BP_LENS_ADDRESS;
|
42
42
|
}
|
43
43
|
processingRound2(typeInfo) {
|
44
|
-
typeInfo.
|
45
|
-
typeInfo.
|
46
|
-
typeInfo.
|
47
|
-
typeInfo.
|
44
|
+
typeInfo.token0 = typeInfo.bpInfoReturnData.tokenA;
|
45
|
+
typeInfo.token1 = typeInfo.bpInfoReturnData.tokenB;
|
46
|
+
typeInfo.amount0 = typeInfo.bpInfoReturnData.amountA.toString();
|
47
|
+
typeInfo.amount1 = typeInfo.bpInfoReturnData.amountB.toString();
|
48
48
|
}
|
49
49
|
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
50
50
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
51
|
-
const
|
52
|
-
const
|
53
|
-
const
|
54
|
-
const
|
55
|
-
const
|
56
|
-
const
|
57
|
-
const tvl =
|
51
|
+
const decimalsToken0 = Number(typeInfo.decimalsToken0);
|
52
|
+
const decimalsToken1 = Number(typeInfo.decimalsToken1);
|
53
|
+
const amount0 = BN2Number(typeInfo.amount0, 18);
|
54
|
+
const amount1 = BN2Number(typeInfo.amount1, 18);
|
55
|
+
const token0PRice = (await pricer.get({ symbol: typeInfo.symbolToken0 })) ?? 0;
|
56
|
+
const token1Price = (await pricer.get({ symbol: typeInfo.symbolToken1 })) ?? 0;
|
57
|
+
const tvl = token0PRice * amount0 + token1Price * amount1;
|
58
58
|
const priceTargetToken = tvl / totalSupply;
|
59
59
|
const { bpInfoReturnData, ...rest } = typeInfo;
|
60
60
|
return {
|
61
61
|
...rest,
|
62
62
|
blacklistedSupply,
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
amount0,
|
64
|
+
amount1,
|
65
|
+
decimalsToken0,
|
66
|
+
decimalsToken1,
|
67
67
|
cardName: generateCardName(type, typeInfo, campaign),
|
68
68
|
priceTargetToken: priceTargetToken,
|
69
69
|
totalSupply,
|
70
70
|
tvl,
|
71
71
|
whitelistedSupplyTargetToken,
|
72
|
+
tokensDisplay: [
|
73
|
+
{ symbol: typeInfo.symbolToken0, address: typeInfo.token0 },
|
74
|
+
{ symbol: typeInfo.symbolToken1, address: typeInfo.token1 },
|
75
|
+
],
|
72
76
|
};
|
73
77
|
}
|
74
78
|
}
|
@@ -25,6 +25,7 @@ export class MetamorphoProcessor extends GenericProcessor {
|
|
25
25
|
blacklistedSupply,
|
26
26
|
priceTargetToken: underlyingTokenPrice,
|
27
27
|
cardName: generateCardName(type, typeInfo, campaign),
|
28
|
+
tokensDisplay: [{ symbol: typeInfo.symbolUnderlyingToken, address: typeInfo.underlying }],
|
28
29
|
};
|
29
30
|
}
|
30
31
|
computeRound3(index, type, typeInfo, calls) {
|
@@ -61,6 +61,7 @@ export class NoLinkVaultProcessor extends GenericProcessor {
|
|
61
61
|
tvl,
|
62
62
|
blacklistedSupply,
|
63
63
|
cardName: generateCardName(type, typeInfo, campaign),
|
64
|
+
tokensDisplay: [{ symbol: typeInfo.baseSymbol, address: typeInfo.base }],
|
64
65
|
};
|
65
66
|
}
|
66
67
|
computeRound1(type, typeInfo) {
|
@@ -24,6 +24,7 @@ export class PendleProcessor extends GenericProcessor {
|
|
24
24
|
priceTargetToken: priceTargetToken,
|
25
25
|
cardName: generateCardName(type, typeInfo, campaign),
|
26
26
|
blacklistedSupply,
|
27
|
+
tokensDisplay: [{ symbol: typeInfo.symbolUnderlyingToken, address: typeInfo.underlying }],
|
27
28
|
};
|
28
29
|
}
|
29
30
|
}
|
@@ -24,6 +24,7 @@ export class PendleYTProcessor extends GenericProcessor {
|
|
24
24
|
priceTargetToken: priceTargetToken,
|
25
25
|
cardName: generateCardName(type, typeInfo, campaign),
|
26
26
|
blacklistedSupply,
|
27
|
+
tokensDisplay: [{ symbol: typeInfo.symbolUnderlyingToken, address: typeInfo.underlying }],
|
27
28
|
};
|
28
29
|
}
|
29
30
|
}
|
@@ -36,6 +36,7 @@ export class RadiantProcessor extends GenericProcessor {
|
|
36
36
|
tvl,
|
37
37
|
cardName: generateCardName(type, typeInfo, campaign),
|
38
38
|
symbolUnderlyingToken: finalSymbol,
|
39
|
+
tokensDisplay: [{ symbol: typeInfo.symbolUnderlyingToken, address: typeInfo.underlyingToken }],
|
39
40
|
};
|
40
41
|
}
|
41
42
|
computeRound3(index, type, typeInfo, calls) {
|
@@ -62,6 +62,10 @@ export class RfxProcessor extends GenericProcessor {
|
|
62
62
|
tvl,
|
63
63
|
symbolShortToken: typeInfo.symbolShortToken,
|
64
64
|
symbolLongToken: typeInfo.symbolLongToken,
|
65
|
+
tokensDisplay: [
|
66
|
+
{ symbol: typeInfo.symbolShortToken, address: typeInfo.shortToken },
|
67
|
+
{ symbol: typeInfo.symbolLongToken, address: typeInfo.longToken },
|
68
|
+
],
|
65
69
|
};
|
66
70
|
}
|
67
71
|
}
|
@@ -22,6 +22,7 @@ export class SatlayerProcessor extends GenericProcessor {
|
|
22
22
|
cardName: generateCardName(type, typeInfo, campaign),
|
23
23
|
blacklistedSupply,
|
24
24
|
totalSupply,
|
25
|
+
tokensDisplay: [{ symbol: typeInfo.symbolUnderlyingToken, address: typeInfo.underlying }],
|
25
26
|
};
|
26
27
|
}
|
27
28
|
}
|
@@ -4,7 +4,7 @@ export class SpliceProcessor extends GenericProcessor {
|
|
4
4
|
// override computeRound1(): void {}
|
5
5
|
async processingRound5(_index, _type, typeInfo, _calls, campaign, _pricer) {
|
6
6
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
7
|
-
const { symbolUnderlyingToken, priceTargetToken, tvl } = await fetchSpliceInformation(campaign.campaignParameters.targetToken);
|
7
|
+
const { symbolUnderlyingToken, address, priceTargetToken, tvl } = await fetchSpliceInformation(campaign.campaignParameters.targetToken);
|
8
8
|
return {
|
9
9
|
...typeInfo,
|
10
10
|
totalSupply,
|
@@ -14,6 +14,7 @@ export class SpliceProcessor extends GenericProcessor {
|
|
14
14
|
blacklistedSupply,
|
15
15
|
cardName: `Supply ${symbolUnderlyingToken} on Splice`,
|
16
16
|
tokenAddress: typeInfo.tokenAddress,
|
17
|
+
tokensDisplay: [{ symbol: symbolUnderlyingToken, address: address }],
|
17
18
|
};
|
18
19
|
}
|
19
20
|
computeRound3(index, type, typeInfo, calls) {
|
@@ -32,6 +32,7 @@ export class SturdySiloProcessor extends GenericProcessor {
|
|
32
32
|
sharePrice,
|
33
33
|
priceTargetToken,
|
34
34
|
cardName: generateCardName(type, typeInfo, campaign),
|
35
|
+
tokensDisplay: [{ symbol: typeInfo.symbolUnderlyingToken, address: typeInfo.underlying }],
|
35
36
|
};
|
36
37
|
}
|
37
38
|
}
|
@@ -74,6 +74,10 @@ export class TempestVaultProcessor extends GenericProcessor {
|
|
74
74
|
totalSupply,
|
75
75
|
tvl,
|
76
76
|
whitelistedSupplyTargetToken,
|
77
|
+
tokensDisplay: [
|
78
|
+
{ symbol: typeInfo.symbolToken0, address: typeInfo.addressToken0 },
|
79
|
+
{ symbol: typeInfo.symbolToken1, address: typeInfo.addressToken1 },
|
80
|
+
],
|
77
81
|
};
|
78
82
|
}
|
79
83
|
}
|
@@ -16,7 +16,7 @@ export class TorosProcessor extends GenericProcessor {
|
|
16
16
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
17
17
|
const priceTargetToken = BN2Number(typeInfo.tokenPrice, 18);
|
18
18
|
const tvl = priceTargetToken * totalSupply;
|
19
|
-
let symbolUnderlyingToken = "
|
19
|
+
let symbolUnderlyingToken = "unknown";
|
20
20
|
const match = typeInfo.name.match(/\b[A-Z]+\b/g);
|
21
21
|
symbolUnderlyingToken = match ? match[0] : "unknown";
|
22
22
|
return {
|
@@ -28,6 +28,7 @@ export class TorosProcessor extends GenericProcessor {
|
|
28
28
|
priceTargetToken,
|
29
29
|
symbolUnderlyingToken,
|
30
30
|
cardName: generateCardName(type, typeInfo, campaign),
|
31
|
+
tokensDisplay: [{ symbol: symbolUnderlyingToken, address: typeInfo.tokenAddress }],
|
31
32
|
};
|
32
33
|
}
|
33
34
|
}
|
@@ -63,6 +63,10 @@ export class UniswapProcessor extends GenericProcessor {
|
|
63
63
|
decimalsToken1,
|
64
64
|
balanceToken0,
|
65
65
|
balanceToken1,
|
66
|
+
tokensDisplay: [
|
67
|
+
{ symbol: typeInfo.symbolToken0, address: typeInfo.token0 },
|
68
|
+
{ symbol: typeInfo.symbolToken1, address: typeInfo.token1 },
|
69
|
+
],
|
66
70
|
};
|
67
71
|
}
|
68
72
|
}
|
@@ -30,6 +30,7 @@ export class VicunaProcessor extends GenericProcessor {
|
|
30
30
|
blacklistedSupply,
|
31
31
|
priceTargetToken,
|
32
32
|
cardName: generateCardName(type, typeInfo, campaign),
|
33
|
+
tokensDisplay: [{ symbol: campaign.campaignParameters.symbolTargetToken, address: typeInfo.tokenAddress }],
|
33
34
|
};
|
34
35
|
}
|
35
36
|
}
|
@@ -50,6 +50,11 @@ export class ZkSwapThreePoolProcessor extends GenericProcessor {
|
|
50
50
|
totalSupply,
|
51
51
|
tvl,
|
52
52
|
whitelistedSupplyTargetToken,
|
53
|
+
tokensDisplay: [
|
54
|
+
{ symbol: typeInfo.symbolToken0, address: typeInfo.token0Address },
|
55
|
+
{ symbol: typeInfo.symbolToken1, address: typeInfo.token1Address },
|
56
|
+
{ symbol: typeInfo.symbolToken2, address: typeInfo.token2Address },
|
57
|
+
],
|
53
58
|
};
|
54
59
|
}
|
55
60
|
}
|
@@ -60,6 +60,7 @@ export class CurveNPoolProcessor extends GenericProcessor {
|
|
60
60
|
hardcodedSymbol = "ETH";
|
61
61
|
if (typeInfo.name.includes("STABLE"))
|
62
62
|
hardcodedSymbol = "USDC";
|
63
|
+
const tokensDisplay = [];
|
63
64
|
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
64
65
|
const symbol = typeInfo[`symbolToken${i}`];
|
65
66
|
let price = (await pricer.get({ symbol: symbol })) ?? 0;
|
@@ -71,6 +72,7 @@ export class CurveNPoolProcessor extends GenericProcessor {
|
|
71
72
|
price = (await pricer.get({ symbol: hardcodedSymbol })) ?? 0;
|
72
73
|
}
|
73
74
|
}
|
75
|
+
tokensDisplay.push({ symbol: symbol, address: typeInfo[`token${i}`] });
|
74
76
|
const decimals = Number(typeInfo[`decimalsToken${i}`]);
|
75
77
|
const amount = BN2Number(typeInfo[`balanceToken${i}`], decimals);
|
76
78
|
tvl += amount * price;
|
@@ -90,6 +92,7 @@ export class CurveNPoolProcessor extends GenericProcessor {
|
|
90
92
|
blacklistedSupply,
|
91
93
|
priceTargetToken,
|
92
94
|
cardName: generateCardName(type, typeInfo, campaign),
|
95
|
+
tokensDisplay,
|
93
96
|
};
|
94
97
|
}
|
95
98
|
}
|
@@ -23,6 +23,7 @@ export class CurveProcessor extends GenericProcessor {
|
|
23
23
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
24
24
|
const lp_price = BN2Number(typeInfo.lp_price, 18);
|
25
25
|
let priceTargetToken = lp_price;
|
26
|
+
let tokensDisplay = [];
|
26
27
|
if (typeInfo.token2) {
|
27
28
|
typeInfo.poolTokens = {
|
28
29
|
[typeInfo.token0]: typeInfo.symbolToken0,
|
@@ -30,6 +31,11 @@ export class CurveProcessor extends GenericProcessor {
|
|
30
31
|
[typeInfo.token2]: typeInfo.symbolToken2,
|
31
32
|
};
|
32
33
|
typeInfo.numberTokens = 3;
|
34
|
+
tokensDisplay = [
|
35
|
+
{ symbol: typeInfo.symbolToken0, address: typeInfo.token0 },
|
36
|
+
{ symbol: typeInfo.symbolToken1, address: typeInfo.token1 },
|
37
|
+
{ symbol: typeInfo.symbolToken2, address: typeInfo.token2 },
|
38
|
+
];
|
33
39
|
}
|
34
40
|
else {
|
35
41
|
typeInfo.poolTokens = {
|
@@ -37,6 +43,10 @@ export class CurveProcessor extends GenericProcessor {
|
|
37
43
|
[typeInfo.token1]: typeInfo.symbolToken1,
|
38
44
|
};
|
39
45
|
typeInfo.numberTokens = 2;
|
46
|
+
tokensDisplay = [
|
47
|
+
{ symbol: typeInfo.symbolToken0, address: typeInfo.token0 },
|
48
|
+
{ symbol: typeInfo.symbolToken1, address: typeInfo.token1 },
|
49
|
+
];
|
40
50
|
}
|
41
51
|
if (type === tokenType.curve_2) {
|
42
52
|
const prices = [];
|
@@ -65,6 +75,7 @@ export class CurveProcessor extends GenericProcessor {
|
|
65
75
|
blacklistedSupply,
|
66
76
|
priceTargetToken,
|
67
77
|
cardName: generateCardName(type, typeInfo, campaign),
|
78
|
+
tokensDisplay,
|
68
79
|
};
|
69
80
|
}
|
70
81
|
}
|
@@ -31,18 +31,28 @@ export class StakedCurveProcessor extends GenericProcessor {
|
|
31
31
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
32
32
|
const lp_price = BN2Number(typeInfo.lp_price, 18);
|
33
33
|
let priceTargetToken = lp_price;
|
34
|
+
let tokensDisplay = [];
|
34
35
|
if (typeInfo.token2) {
|
35
36
|
typeInfo.poolTokens = {
|
36
37
|
[typeInfo.token0]: typeInfo.symbolToken0,
|
37
38
|
[typeInfo.token1]: typeInfo.symbolToken1,
|
38
39
|
[typeInfo.token2]: typeInfo.symbolToken2,
|
39
40
|
};
|
41
|
+
tokensDisplay = [
|
42
|
+
{ symbol: typeInfo.symbolToken0, address: typeInfo.token0 },
|
43
|
+
{ symbol: typeInfo.symbolToken1, address: typeInfo.token1 },
|
44
|
+
{ symbol: typeInfo.symbolToken2, address: typeInfo.token2 },
|
45
|
+
];
|
40
46
|
}
|
41
47
|
else {
|
42
48
|
typeInfo.poolTokens = {
|
43
49
|
[typeInfo.token0]: typeInfo.symbolToken0,
|
44
50
|
[typeInfo.token1]: typeInfo.symbolToken1,
|
45
51
|
};
|
52
|
+
tokensDisplay = [
|
53
|
+
{ symbol: typeInfo.symbolToken0, address: typeInfo.token0 },
|
54
|
+
{ symbol: typeInfo.symbolToken1, address: typeInfo.token1 },
|
55
|
+
];
|
46
56
|
}
|
47
57
|
if (type === tokenType.curve_2) {
|
48
58
|
const prices = [];
|
@@ -72,6 +82,7 @@ export class StakedCurveProcessor extends GenericProcessor {
|
|
72
82
|
blacklistedSupply,
|
73
83
|
priceTargetToken,
|
74
84
|
cardName: generateCardName(type, typeInfo, campaign),
|
85
|
+
tokensDisplay,
|
75
86
|
};
|
76
87
|
}
|
77
88
|
}
|
@@ -44,6 +44,7 @@ export class xU308Processor extends GenericProcessor {
|
|
44
44
|
priceTargetToken,
|
45
45
|
totalSupply,
|
46
46
|
cardName: generateCardName(type, typeInfo, campaign),
|
47
|
+
tokensDisplay: [{ symbol: campaign.campaignParameters.symbolTargetToken, address: typeInfo.tokenAddress }],
|
47
48
|
};
|
48
49
|
}
|
49
50
|
}
|
@@ -8,8 +8,8 @@ export class Erc20Metadata {
|
|
8
8
|
let action = "HOLD";
|
9
9
|
let name = `Hold ${params.symbolTargetToken}`;
|
10
10
|
let mainProtocolId = undefined;
|
11
|
-
const tokens = [{ chainId: computeChainId, address: params.targetToken }];
|
12
11
|
let depositUrl = params.url;
|
12
|
+
let tokens = [{ chainId: computeChainId, address: params.targetToken }];
|
13
13
|
try {
|
14
14
|
const [dynamicData] = await dynamicDataBuilderFactory(CampaignEnum.ERC20).build(computeChainId, [
|
15
15
|
{
|
@@ -21,6 +21,10 @@ export class Erc20Metadata {
|
|
21
21
|
campaignParameters: params,
|
22
22
|
},
|
23
23
|
]);
|
24
|
+
tokens = dynamicData?.typeInfo?.tokensDisplay?.map((token) => ({
|
25
|
+
chainId: computeChainId,
|
26
|
+
address: token.address,
|
27
|
+
}));
|
24
28
|
action = dynamicData?.typeInfo?.action ?? action;
|
25
29
|
name = dynamicData?.typeInfo?.cardName;
|
26
30
|
mainProtocolId = dynamicData?.typeInfo?.protocol?.toLowerCase().replace(" ", "");
|
@@ -28,43 +32,6 @@ export class Erc20Metadata {
|
|
28
32
|
if (!!protocol) {
|
29
33
|
mainProtocolId = protocol?.id;
|
30
34
|
}
|
31
|
-
// Case of lending protocols and receipt tokens
|
32
|
-
if (!!dynamicData && !!dynamicData.typeInfo?.underlying) {
|
33
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.underlying });
|
34
|
-
}
|
35
|
-
// 2nd case of lending protocols and receipt tokens
|
36
|
-
if (!!dynamicData && !!dynamicData.typeInfo?.underlyingToken) {
|
37
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.underlyingToken });
|
38
|
-
}
|
39
|
-
// Case of perps protocols
|
40
|
-
if (!!dynamicData && !!dynamicData.typeInfo?.shortToken && !!dynamicData.typeInfo?.longToken) {
|
41
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.shortToken });
|
42
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.longToken });
|
43
|
-
}
|
44
|
-
// Case of weird AMMs
|
45
|
-
if (!!dynamicData && !!dynamicData.typeInfo?.tokenA && !!dynamicData.typeInfo?.tokenB) {
|
46
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.tokenA });
|
47
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.tokenB });
|
48
|
-
}
|
49
|
-
// Case of AMMs
|
50
|
-
if (!!dynamicData && !!dynamicData.typeInfo?.token0 && !!dynamicData.typeInfo?.token1) {
|
51
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token0 });
|
52
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token1 });
|
53
|
-
}
|
54
|
-
// Case of quad vaults
|
55
|
-
if (!!dynamicData && !!dynamicData.typeInfo?.token2 && !!dynamicData.typeInfo?.token3) {
|
56
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token2 });
|
57
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token3 });
|
58
|
-
}
|
59
|
-
// Case of tripools
|
60
|
-
if (!!dynamicData &&
|
61
|
-
!!dynamicData.typeInfo?.token0Address &&
|
62
|
-
!!dynamicData.typeInfo?.token1Address &&
|
63
|
-
!!dynamicData.typeInfo?.token2Address) {
|
64
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token0Address });
|
65
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token1Address });
|
66
|
-
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token2Address });
|
67
|
-
}
|
68
35
|
depositUrl = Erc20Metadata.generateUrl(computeChainId, params, dynamicData);
|
69
36
|
}
|
70
37
|
catch {
|
package/dist/src/index.d.ts
CHANGED
@@ -1892,6 +1892,7 @@ declare const app: Elysia<"", false, {
|
|
1892
1892
|
items?: number | undefined;
|
1893
1893
|
tags?: string[] | undefined;
|
1894
1894
|
page?: number | undefined;
|
1895
|
+
test?: boolean | undefined;
|
1895
1896
|
ids?: string[] | undefined;
|
1896
1897
|
opportunityTag?: string | undefined;
|
1897
1898
|
};
|
@@ -1919,7 +1920,16 @@ declare const app: Elysia<"", false, {
|
|
1919
1920
|
get: {
|
1920
1921
|
body: unknown;
|
1921
1922
|
params: {};
|
1922
|
-
query:
|
1923
|
+
query: {
|
1924
|
+
id?: string | undefined;
|
1925
|
+
name?: string | undefined;
|
1926
|
+
items?: number | undefined;
|
1927
|
+
tags?: string[] | undefined;
|
1928
|
+
page?: number | undefined;
|
1929
|
+
test?: boolean | undefined;
|
1930
|
+
ids?: string[] | undefined;
|
1931
|
+
opportunityTag?: string | undefined;
|
1932
|
+
};
|
1923
1933
|
headers: unknown;
|
1924
1934
|
response: {
|
1925
1935
|
200: number;
|
@@ -2847,6 +2857,7 @@ declare const app: Elysia<"", false, {
|
|
2847
2857
|
params: {};
|
2848
2858
|
query: {
|
2849
2859
|
name?: string | undefined;
|
2860
|
+
test?: boolean | undefined;
|
2850
2861
|
};
|
2851
2862
|
headers: unknown;
|
2852
2863
|
response: {
|
@@ -2873,6 +2884,7 @@ declare const app: Elysia<"", false, {
|
|
2873
2884
|
params: {};
|
2874
2885
|
query: {
|
2875
2886
|
name?: string | undefined;
|
2887
|
+
test?: boolean | undefined;
|
2876
2888
|
};
|
2877
2889
|
headers: unknown;
|
2878
2890
|
response: {
|
@@ -45,6 +45,7 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
45
45
|
params: {};
|
46
46
|
query: {
|
47
47
|
name?: string | undefined;
|
48
|
+
test?: boolean | undefined;
|
48
49
|
};
|
49
50
|
headers: unknown;
|
50
51
|
response: {
|
@@ -71,6 +72,7 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
71
72
|
params: {};
|
72
73
|
query: {
|
73
74
|
name?: string | undefined;
|
75
|
+
test?: boolean | undefined;
|
74
76
|
};
|
75
77
|
headers: unknown;
|
76
78
|
response: {
|
@@ -12,6 +12,7 @@ export declare const ChainResourceDto: import("@sinclair/typebox").TObject<{
|
|
12
12
|
}>;
|
13
13
|
export declare const GetChainQueryDto: import("@sinclair/typebox").TObject<{
|
14
14
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
15
|
+
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
15
16
|
}>;
|
16
17
|
export declare const ChainUniqueDto: import("@sinclair/typebox").TObject<{
|
17
18
|
chainId: import("@sinclair/typebox").TNumber;
|
@@ -8,6 +8,7 @@ export const ChainResourceDto = t.Object({
|
|
8
8
|
});
|
9
9
|
export const GetChainQueryDto = t.Object({
|
10
10
|
name: t.Optional(t.String({ description: "Search by blockchain name" })),
|
11
|
+
test: t.Optional(t.Boolean({ description: "Includes chains that have only test opportunities.", default: false })),
|
11
12
|
});
|
12
13
|
export const ChainUniqueDto = t.Object({
|
13
14
|
chainId: t.Numeric(),
|
@@ -22,6 +22,17 @@ export declare class ChainRepository {
|
|
22
22
|
contains: string;
|
23
23
|
mode: "insensitive";
|
24
24
|
} | undefined;
|
25
|
+
Opportunity: {
|
26
|
+
some: {
|
27
|
+
Campaigns: {
|
28
|
+
some: {
|
29
|
+
RewardToken: {
|
30
|
+
isTest: false;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
};
|
34
|
+
};
|
35
|
+
} | undefined;
|
25
36
|
};
|
26
37
|
};
|
27
38
|
/** Returns many chains based on query
|
@@ -11,7 +11,10 @@ export class ChainRepository {
|
|
11
11
|
}
|
12
12
|
static transformQueryToPrismaFilters(query) {
|
13
13
|
return {
|
14
|
-
where: {
|
14
|
+
where: {
|
15
|
+
name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
|
16
|
+
Opportunity: query.test ? undefined : { some: { Campaigns: { some: { RewardToken: { isTest: false } } } } },
|
17
|
+
},
|
15
18
|
};
|
16
19
|
}
|
17
20
|
/** Returns many chains based on query
|
@@ -6,9 +6,11 @@ export class ChainService {
|
|
6
6
|
static async get(chainId) {
|
7
7
|
return ChainRepository.read(chainId);
|
8
8
|
}
|
9
|
-
//TODO: determine find vs get nomenclature and cache handling
|
10
9
|
static async findMany(query) {
|
11
|
-
|
10
|
+
// Bypass cache in test mode
|
11
|
+
if (query.test)
|
12
|
+
return ChainRepository.findMany(query);
|
13
|
+
return await CacheService.wrap(TTLPresets.MIN_10, ChainRepository.findMany, query);
|
12
14
|
}
|
13
15
|
static async countMany(query) {
|
14
16
|
return await ChainRepository.countMany(query);
|
@@ -166,9 +166,11 @@ export class OpportunityService {
|
|
166
166
|
* @returns A list of opportunities
|
167
167
|
*/
|
168
168
|
static async findMany(query) {
|
169
|
+
// Bypass cache in test mode
|
170
|
+
if (query.test)
|
171
|
+
return (await OpportunityRepository.findMany(query)).map(c => OpportunityService.formatResponse(c));
|
169
172
|
return await CacheService.wrap(TTLPresets.MIN_5, async (query) => {
|
170
|
-
|
171
|
-
return opportunities.map(c => OpportunityService.formatResponse(c));
|
173
|
+
return (await OpportunityRepository.findMany(query)).map(c => OpportunityService.formatResponse(c));
|
172
174
|
}, query);
|
173
175
|
}
|
174
176
|
/**
|