@merkl/api 0.10.245 → 0.10.247
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/backgroundJobs/jobs/campaignsCacheUpdater.js +4 -0
- package/dist/src/entities/opportunity.js +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/getTVL.d.ts +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/getTVL.js +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AssetProcessor.js +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +4 -0
- package/dist/src/modules/v4/interaction/interaction.service.js +13 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +12 -1
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +7 -2
- package/dist/src/utils/decodeCalls.js +10 -0
- package/dist/src/utils/encodeCalls.js +10 -0
- package/dist/src/utils/generateCardName.js +4 -2
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -119,6 +119,10 @@ export const campaignsCacheUpdater = new Elysia().get("/v3/update", async ({ que
|
|
119
119
|
identifier: mainParameter,
|
120
120
|
type: CampaignService.getTypeFromV3(+type),
|
121
121
|
});
|
122
|
+
// @TO_REMOVE - 17 is the VEST campaign type, needs to be removed when updating SDK with VEST
|
123
|
+
if (type === "17") {
|
124
|
+
continue;
|
125
|
+
}
|
122
126
|
await OpportunityRepository.updateRecords(opportunityId, apr, tvl, dailyRewards);
|
123
127
|
}
|
124
128
|
await OpportunityService.updateMetadata(chainId);
|
@@ -194,6 +194,7 @@ export const extractOpportunities = {
|
|
194
194
|
[Campaign.ERC20]: (campaign, campaigns, prices) => {
|
195
195
|
const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
|
196
196
|
const { active, all } = campaigns;
|
197
|
+
// DEPRECATED!!!!
|
197
198
|
const map = {
|
198
199
|
actions: {
|
199
200
|
pool: [
|
@@ -212,6 +213,10 @@ export const extractOpportunities = {
|
|
212
213
|
"pancakeswap",
|
213
214
|
"tempest",
|
214
215
|
"cross_curve",
|
216
|
+
"zkswap",
|
217
|
+
"maverickBoostedPosition",
|
218
|
+
"zkSwapThreePool",
|
219
|
+
"syncswap",
|
215
220
|
],
|
216
221
|
borrow: ["radiant_borrow", "aave_borrowing", "euler_borrow", "zerolend_borrowing"],
|
217
222
|
lend: [
|
@@ -229,6 +234,9 @@ export const extractOpportunities = {
|
|
229
234
|
"euler_lend",
|
230
235
|
"layerbank",
|
231
236
|
"zerolend_lending",
|
237
|
+
"venus",
|
238
|
+
"reactor_fusion",
|
239
|
+
"woofi",
|
232
240
|
],
|
233
241
|
},
|
234
242
|
icons: {
|
@@ -3,6 +3,7 @@ import { BN2Number, BalancerPoolInterface, ERC20Interface, EnzymeInterface, Fact
|
|
3
3
|
import { batchMulticallCallWithRetry } from "../../../utils/generic";
|
4
4
|
import { Pricer } from "../../../utils/pricer";
|
5
5
|
import { getLastEligibilityRatio } from "../utils/getLastEligibilityRatio";
|
6
|
+
import { getTVL } from "./ERC20SubTypes/helpers/getTVL";
|
6
7
|
import { tokenType } from "./ERC20SubTypes/helpers/tokenType";
|
7
8
|
import { getTokenPricesInfo } from "./ERC20SubTypes/subtypesPrices";
|
8
9
|
import { getTokenTypeRound1 } from "./ERC20SubTypes/subtypesRound1";
|
@@ -146,7 +147,7 @@ export async function ERC20DynamicData(chainId, campaigns) {
|
|
146
147
|
campaign.campaignParameters.duration /
|
147
148
|
(whitelistedSupplyTargetToken * priceTargetToken),
|
148
149
|
totalSupplyTargetToken,
|
149
|
-
tvl: whitelistedSupplyTargetToken
|
150
|
+
tvl: getTVL(tokenTypesByCampaign[campaign.campaignId].typeInfo.type, totalSupplyTargetToken, whitelistedSupplyTargetToken, priceTargetToken),
|
150
151
|
type: tokenTypesByCampaign[campaign.campaignId].type,
|
151
152
|
typeInfo: tokenTypesByCampaign[campaign.campaignId].typeInfo,
|
152
153
|
priceRewardToken: priceRewardToken,
|
@@ -61,7 +61,9 @@ export declare enum tokenType {
|
|
61
61
|
staking = "staking",
|
62
62
|
noLinkVault = "noLinkVault",
|
63
63
|
cpmmGamma = "cpmmGamma",
|
64
|
-
crosscurve = "crosscurve"
|
64
|
+
crosscurve = "crosscurve",
|
65
|
+
venus = "venus",
|
66
|
+
reactor_fusion = "reactor_fusion"
|
65
67
|
}
|
66
68
|
export declare const tokenTypeToProtocol: {
|
67
69
|
[key in tokenType]: {
|
@@ -63,6 +63,8 @@ export var tokenType;
|
|
63
63
|
tokenType["noLinkVault"] = "noLinkVault";
|
64
64
|
tokenType["cpmmGamma"] = "cpmmGamma";
|
65
65
|
tokenType["crosscurve"] = "crosscurve";
|
66
|
+
tokenType["venus"] = "venus";
|
67
|
+
tokenType["reactor_fusion"] = "reactor_fusion";
|
66
68
|
})(tokenType || (tokenType = {}));
|
67
69
|
export const tokenTypeToProtocol = {
|
68
70
|
[tokenType.aave_borrowing]: { protocol: "Aave" },
|
@@ -98,6 +100,7 @@ export const tokenTypeToProtocol = {
|
|
98
100
|
[tokenType.ra]: { protocol: "Ra" },
|
99
101
|
[tokenType.radiant_borrow]: { protocol: "Radiant" },
|
100
102
|
[tokenType.radiant_lend]: { protocol: "Radiant" },
|
103
|
+
[tokenType.reactor_fusion]: { protocol: "Reactor Fusion" },
|
101
104
|
[tokenType.silostaking]: { protocol: "Silo Staking", symbolUnderlyingToken: "SEI" },
|
102
105
|
[tokenType.splice]: { protocol: "Splice" },
|
103
106
|
[tokenType.sturdy_aggregator]: { protocol: "Sturdy" },
|
@@ -106,6 +109,7 @@ export const tokenTypeToProtocol = {
|
|
106
109
|
[tokenType.toros]: { protocol: "Toros" },
|
107
110
|
[tokenType.uniswapv2]: { protocol: "Uniswap V2" },
|
108
111
|
[tokenType.velodrome]: { protocol: "Velodrome V2" },
|
112
|
+
[tokenType.venus]: { protocol: "Venus" },
|
109
113
|
[tokenType.unknown]: { protocol: "Unknown" },
|
110
114
|
[tokenType.yei_borrowing]: { protocol: "Yei Finance" },
|
111
115
|
[tokenType.yei_lending]: { protocol: "Yei Finance" },
|
@@ -24,8 +24,8 @@ export class AssetProcessor extends GenericProcessor {
|
|
24
24
|
}
|
25
25
|
async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
|
26
26
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
27
|
-
let exchangeRate = BN2Number(typeInfo.exchangeRate
|
28
|
-
if (type === tokenType.moonwell) {
|
27
|
+
let exchangeRate = BN2Number(typeInfo.exchangeRate);
|
28
|
+
if (type === tokenType.moonwell || type === tokenType.venus) {
|
29
29
|
exchangeRate =
|
30
30
|
exchangeRate /
|
31
31
|
10 ** (Number(typeInfo.decimalsUnderlyingToken) - campaign.campaignParameters.decimalsTargetToken);
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js
CHANGED
@@ -50,8 +50,8 @@ export class MaverickBPProcessor extends GenericProcessor {
|
|
50
50
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
51
51
|
const decimalsTokenA = Number(typeInfo.decimalsTokenA);
|
52
52
|
const decimalsTokenB = Number(typeInfo.decimalsTokenB);
|
53
|
-
const amountA = BN2Number(typeInfo.amountA,
|
54
|
-
const amountB = BN2Number(typeInfo.amountB,
|
53
|
+
const amountA = BN2Number(typeInfo.amountA, 18);
|
54
|
+
const amountB = BN2Number(typeInfo.amountB, 18);
|
55
55
|
const tokenAPRice = (await pricer.get({ symbol: typeInfo.symbolTokenA })) ?? 0;
|
56
56
|
const tokenBPrice = (await pricer.get({ symbol: typeInfo.symbolTokenB })) ?? 0;
|
57
57
|
const tvl = tokenAPRice * amountA + tokenBPrice * amountB;
|
@@ -33,6 +33,10 @@ function satisfiesNameConditions(name, type) {
|
|
33
33
|
return lowerCaseName.includes("radiant variable debt");
|
34
34
|
case tokenType.ionic:
|
35
35
|
return lowerCaseName.includes("ionic");
|
36
|
+
case tokenType.venus:
|
37
|
+
return lowerCaseName.startsWith("venus");
|
38
|
+
case tokenType.reactor_fusion:
|
39
|
+
return lowerCaseName.startsWith("reactorfusion");
|
36
40
|
case tokenType.rfx:
|
37
41
|
return lowerCaseName.includes("rfx");
|
38
42
|
case tokenType.layerbank:
|
@@ -70,6 +70,19 @@ export class InteractionService {
|
|
70
70
|
"function approve(address, uint256) returns (bool)",
|
71
71
|
"function allowance(address owner, address spender) returns (uint256)",
|
72
72
|
]);
|
73
|
+
if (tokenAddress === ETH_ADDRESS)
|
74
|
+
return {
|
75
|
+
approved: true,
|
76
|
+
allowance: 0n,
|
77
|
+
approval: {
|
78
|
+
to: tokenAddress,
|
79
|
+
data: encodeFunctionData({
|
80
|
+
abi,
|
81
|
+
functionName: "approve",
|
82
|
+
args: [spender, amount],
|
83
|
+
}),
|
84
|
+
},
|
85
|
+
};
|
73
86
|
const decode = (r) => decodeFunctionResult({
|
74
87
|
abi,
|
75
88
|
functionName: "allowance",
|
@@ -28,8 +28,15 @@ export const getErc20Metadata = async (chainId, campaignId, rewardToken, amount,
|
|
28
28
|
"dragonswap",
|
29
29
|
"poolside",
|
30
30
|
"koi",
|
31
|
+
"pancakeswap",
|
32
|
+
"tempest",
|
33
|
+
"cross_curve",
|
34
|
+
"zkswap",
|
35
|
+
"maverickBoostedPosition",
|
36
|
+
"zkSwapThreePool",
|
37
|
+
"syncswap",
|
31
38
|
],
|
32
|
-
BORROW: ["radiant_borrow", "aave_borrowing", "euler_borrow"],
|
39
|
+
BORROW: ["radiant_borrow", "aave_borrowing", "euler_borrow", "zerolend_borrowing"],
|
33
40
|
LEND: [
|
34
41
|
"gearbox",
|
35
42
|
"compound",
|
@@ -44,6 +51,10 @@ export const getErc20Metadata = async (chainId, campaignId, rewardToken, amount,
|
|
44
51
|
"silostaking",
|
45
52
|
"euler_lend",
|
46
53
|
"layerbank",
|
54
|
+
"zerolend_lending",
|
55
|
+
"venus",
|
56
|
+
"woofi",
|
57
|
+
"reactor_fusion",
|
47
58
|
],
|
48
59
|
},
|
49
60
|
};
|
@@ -5,7 +5,7 @@ import type { Resource } from "../prisma";
|
|
5
5
|
* @see {@link Resource}
|
6
6
|
*/
|
7
7
|
export type Protocol = Resource<"Protocol">;
|
8
|
-
declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "
|
8
|
+
declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "syncswap-v3", "neptune", "zkSwapThreePool", "syncswap", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "venus", "woofi", "reactor_fusion", "eigenlayer"];
|
9
9
|
export type ProtocolId = (typeof protocolTypes)[number];
|
10
10
|
export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
|
11
11
|
id: import("@sinclair/typebox").TString;
|
@@ -39,6 +39,10 @@ const protocolTypes = [
|
|
39
39
|
"dragonswap",
|
40
40
|
"poolside",
|
41
41
|
"koi",
|
42
|
+
"syncswap-v3",
|
43
|
+
"neptune",
|
44
|
+
"zkSwapThreePool",
|
45
|
+
"syncswap",
|
42
46
|
// ─── LP Lending ──────────────────────────────────────────────────────
|
43
47
|
"radiant",
|
44
48
|
"aave",
|
@@ -58,9 +62,10 @@ const protocolTypes = [
|
|
58
62
|
"ajna",
|
59
63
|
"layerbank",
|
60
64
|
"ion",
|
65
|
+
"venus",
|
66
|
+
"woofi",
|
67
|
+
"reactor_fusion",
|
61
68
|
"eigenlayer",
|
62
|
-
"syncswap-v3",
|
63
|
-
"neptune",
|
64
69
|
];
|
65
70
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
66
71
|
export const ProtocolResourceDto = t.Object({
|
@@ -77,7 +77,15 @@ export function decodeCall(calls, index, key, type) {
|
|
77
77
|
case tokenType.moonwell:
|
78
78
|
return MoonwellInterface.decodeFunctionResult("underlying", returnData)[0];
|
79
79
|
case tokenType.ionic:
|
80
|
+
case tokenType.venus:
|
80
81
|
return IonicInterface.decodeFunctionResult("underlying", returnData)[0];
|
82
|
+
case tokenType.reactor_fusion:
|
83
|
+
try {
|
84
|
+
return IonicInterface.decodeFunctionResult("underlying", returnData)[0];
|
85
|
+
}
|
86
|
+
catch (e) {
|
87
|
+
return "0x000000000000000000000000000000000000800A";
|
88
|
+
}
|
81
89
|
case tokenType.layerbank:
|
82
90
|
return LayerBankInterface.decodeFunctionResult("underlying", returnData)[0];
|
83
91
|
case tokenType.holdstation:
|
@@ -102,6 +110,8 @@ export function decodeCall(calls, index, key, type) {
|
|
102
110
|
case tokenType.ionic:
|
103
111
|
return IonicInterface.decodeFunctionResult("exchangeRateCurrent", returnData)[0];
|
104
112
|
case tokenType.moonwell:
|
113
|
+
case tokenType.venus:
|
114
|
+
case tokenType.reactor_fusion:
|
105
115
|
return MoonwellInterface.decodeFunctionResult("exchangeRateStored", returnData)[0];
|
106
116
|
default:
|
107
117
|
throw new Error(`Need tokenType for this key ${key}`);
|
@@ -51,6 +51,8 @@ export function createCall(target, key, type, metaData) {
|
|
51
51
|
case tokenType.ionic:
|
52
52
|
return { allowFailure: true, callData: IonicInterface.encodeFunctionData("exchangeRateCurrent"), target };
|
53
53
|
case tokenType.moonwell:
|
54
|
+
case tokenType.venus:
|
55
|
+
case tokenType.reactor_fusion:
|
54
56
|
return { allowFailure: true, callData: MoonwellInterface.encodeFunctionData("exchangeRateStored"), target };
|
55
57
|
case tokenType.layerbank:
|
56
58
|
return { allowFailure: true, callData: LayerBankInterface.encodeFunctionData("exchangeRate"), target };
|
@@ -101,6 +103,8 @@ export function createCall(target, key, type, metaData) {
|
|
101
103
|
case tokenType.aura:
|
102
104
|
return { allowFailure: true, callData: AuraInterface.encodeFunctionData("asset"), target };
|
103
105
|
case tokenType.ionic:
|
106
|
+
case tokenType.venus:
|
107
|
+
case tokenType.reactor_fusion:
|
104
108
|
return { allowFailure: true, callData: IonicInterface.encodeFunctionData("underlying"), target };
|
105
109
|
case tokenType.layerbank:
|
106
110
|
return { allowFailure: true, callData: LayerBankInterface.encodeFunctionData("underlying"), target };
|
@@ -340,6 +344,12 @@ export function createCall(target, key, type, metaData) {
|
|
340
344
|
callData: CPMMGammaPoolMainInterface.encodeFunctionData("getLatestCFMMBalances"),
|
341
345
|
target: target,
|
342
346
|
};
|
347
|
+
case "getReserves":
|
348
|
+
return {
|
349
|
+
allowFailure: true,
|
350
|
+
callData: UniswapV2PoolInterface.encodeFunctionData("getReserves"),
|
351
|
+
target: target,
|
352
|
+
};
|
343
353
|
default:
|
344
354
|
throw new Error(`Unknown key ${key}`);
|
345
355
|
}
|
@@ -59,6 +59,8 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
|
|
59
59
|
case tokenType.ironclad_lending:
|
60
60
|
case tokenType.zerolend_lending:
|
61
61
|
case tokenType.fraxlend:
|
62
|
+
case tokenType.venus:
|
63
|
+
case tokenType.reactor_fusion:
|
62
64
|
case tokenType.euler_lend:
|
63
65
|
return `Supply ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
64
66
|
case tokenType.metamorpho:
|
@@ -87,9 +89,9 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
|
|
87
89
|
case tokenType.woofi:
|
88
90
|
return `Supercharge ${typeInfo.symbolUnderlying} on ${typeInfo.protocol}`;
|
89
91
|
case tokenType.maverickBoostedPosition:
|
90
|
-
return `
|
92
|
+
return `Maverick Boosted Position ${campaign.campaignParameters.symbolTargetToken}`;
|
91
93
|
case tokenType.zkSwapThreePool:
|
92
|
-
return
|
94
|
+
return `${typeInfo.protocol} ${typeInfo.symbolToken0}/${typeInfo.symbolToken1}/${typeInfo.symbolToken2}`;
|
93
95
|
case tokenType.maha:
|
94
96
|
return `Stake ${typeInfo.symbolToken0}/${typeInfo.symbolToken1} LP on ${typeInfo.protocol}`;
|
95
97
|
case tokenType.tempest:
|