@merkl/api 0.10.209 → 0.10.211
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/database/api/.generated/edge.js +6 -4
- package/dist/database/api/.generated/index-browser.js +3 -1
- package/dist/database/api/.generated/index.d.ts +3 -1
- package/dist/database/api/.generated/index.js +6 -4
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +2 -0
- package/dist/database/api/.generated/wasm.js +3 -1
- package/dist/database/api/seeder/resources/protocol.d.ts +27 -0
- package/dist/database/api/seeder/resources/protocol.js +16 -0
- package/dist/src/eden/index.d.ts +201 -9
- package/dist/src/entities/opportunity.js +37 -1
- package/dist/src/index.d.ts +77 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveNPoolProcessor.d.ts +39 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveNPoolProcessor.js +81 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/EigenLayerDynamicData.d.ts +3 -0
- package/dist/src/libs/campaigns/campaignTypes/EigenLayerDynamicData.js +67 -0
- package/dist/src/libs/campaigns/campaignsDynamicData.js +4 -0
- package/dist/src/libs/positions/EigenLayer/index.d.ts +6 -0
- package/dist/src/libs/positions/EigenLayer/index.js +53 -0
- package/dist/src/libs/positions/ajna/index.d.ts +4 -39
- package/dist/src/libs/positions/ajna/index.js +2 -2
- package/dist/src/libs/positions/badger/index.d.ts +3 -24
- package/dist/src/libs/positions/badger/index.js +1 -1
- package/dist/src/libs/positions/index.js +4 -0
- package/dist/src/libs/positions/morpho/index.d.ts +4 -38
- package/dist/src/libs/positions/prepareFetch.js +29 -1
- package/dist/src/libs/positions/types.d.ts +55 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +2 -2
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +4 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +1 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.js +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getEigenLayerMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getEigenLayerMetadata.service.js +9 -0
- package/dist/src/modules/v4/programPayload/index.d.ts +3 -0
- package/dist/src/modules/v4/programPayload/index.js +3 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +93 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.js +38 -0
- package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +122 -0
- package/dist/src/modules/v4/programPayload/programPayload.model.js +130 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +39 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +359 -0
- package/dist/src/modules/v4/programPayload/programPayload.service.d.ts +8 -0
- package/dist/src/modules/v4/programPayload/programPayload.service.js +92 -0
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +2 -0
- package/dist/src/modules/v4/router.d.ts +77 -3
- package/dist/src/modules/v4/router.js +3 -1
- package/dist/src/utils/decodeCalls.js +5 -3
- package/dist/src/utils/encodeCalls.js +11 -13
- package/dist/src/utils/generateCardName.js +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -0,0 +1,67 @@
|
|
1
|
+
import { BN2Number, ChainInteractionService, EigenLayerStrategyInterface, EigenLayerStrategy__factory, YEAR, } from "@sdk";
|
2
|
+
import { log } from "../../../utils/logger";
|
3
|
+
import { Pricer } from "../../../utils/pricer";
|
4
|
+
export async function EigenLayerDynamicData(_chainId, campaigns) {
|
5
|
+
const pricer = await Pricer.load();
|
6
|
+
const calls = [];
|
7
|
+
for (const campaign of campaigns) {
|
8
|
+
calls.push({
|
9
|
+
allowFailure: true,
|
10
|
+
callData: EigenLayerStrategyInterface.encodeFunctionData("totalShares"),
|
11
|
+
target: campaign.campaignParameters.strategy,
|
12
|
+
});
|
13
|
+
}
|
14
|
+
return {
|
15
|
+
cached: false,
|
16
|
+
call: {
|
17
|
+
callData: calls,
|
18
|
+
handler: () => { },
|
19
|
+
reducer: async (result) => {
|
20
|
+
let i = 0;
|
21
|
+
const dynamicData = [];
|
22
|
+
for (const campaign of campaigns) {
|
23
|
+
let totalSupplyShares;
|
24
|
+
let totalSupplyStrategy;
|
25
|
+
try {
|
26
|
+
totalSupplyShares = EigenLayerStrategyInterface.decodeFunctionResult("totalShares", result[i++])[0];
|
27
|
+
}
|
28
|
+
catch {
|
29
|
+
log.warn(`Error getting totalShares for campaign ${campaign.campaignId} and strategy ${campaign.campaignParameters.strategy}`);
|
30
|
+
totalSupplyShares = 0.0000001;
|
31
|
+
}
|
32
|
+
try {
|
33
|
+
totalSupplyStrategy = BN2Number(await EigenLayerStrategy__factory.connect(campaign.campaignParameters.strategy, ChainInteractionService(campaign.computeChainId).provider()).sharesToUnderlying(totalSupplyShares), campaign.campaignParameters.decimalsUnderlyingToken);
|
34
|
+
}
|
35
|
+
catch {
|
36
|
+
log.warn(`Error getting totalSupply for campaign ${campaign.campaignId} and strategy ${campaign.campaignParameters.strategy}`);
|
37
|
+
totalSupplyStrategy = 0.0000001;
|
38
|
+
}
|
39
|
+
const priceRewardToken = (await pricer.get({
|
40
|
+
address: campaign.rewardToken,
|
41
|
+
chainId: campaign.chainId,
|
42
|
+
symbol: campaign.campaignParameters.symbolRewardToken,
|
43
|
+
})) ?? 0;
|
44
|
+
const priceTargetToken = (await pricer.get({
|
45
|
+
address: campaign.campaignParameters.underlyingToken,
|
46
|
+
chainId: campaign.computeChainId,
|
47
|
+
symbol: campaign.campaignParameters.symbolUnderlyingToken,
|
48
|
+
})) ?? 0;
|
49
|
+
const tvl = totalSupplyStrategy * priceTargetToken;
|
50
|
+
dynamicData.push({
|
51
|
+
...campaign,
|
52
|
+
apr: (priceRewardToken *
|
53
|
+
BN2Number(campaign.amount, campaign.campaignParameters.decimalsRewardToken) *
|
54
|
+
YEAR *
|
55
|
+
100) /
|
56
|
+
campaign.campaignParameters.duration /
|
57
|
+
(totalSupplyStrategy * priceTargetToken),
|
58
|
+
totalSupplyTargetToken: totalSupplyStrategy,
|
59
|
+
tvl,
|
60
|
+
priceRewardToken: priceRewardToken,
|
61
|
+
});
|
62
|
+
}
|
63
|
+
return dynamicData;
|
64
|
+
},
|
65
|
+
},
|
66
|
+
};
|
67
|
+
}
|
@@ -8,6 +8,7 @@ import { CompoundDynamicData } from "./campaignTypes/CompoundDynamicData";
|
|
8
8
|
import { DolomiteDynamicData } from "./campaignTypes/DolomiteDynamicData";
|
9
9
|
import { ERC20DynamicData } from "./campaignTypes/ERC20DynamicData";
|
10
10
|
import { ERC20_SNAPSHOTDynamicData } from "./campaignTypes/ERC20_SNAPSHOTDynamicData";
|
11
|
+
import { EigenLayerDynamicData } from "./campaignTypes/EigenLayerDynamicData";
|
11
12
|
import { EulerDynamicData } from "./campaignTypes/EulerDynamicData";
|
12
13
|
import { JSON_AIRDROPDynamicData } from "./campaignTypes/JSON_AIRDROPDynamicData";
|
13
14
|
import { MORPHODynamicData } from "./campaignTypes/MORPHODynamicData";
|
@@ -61,6 +62,9 @@ export async function campaignsDynamicData(chainId, campaigns, type) {
|
|
61
62
|
case Campaign.COMPOUND: {
|
62
63
|
return CompoundDynamicData(chainId, campaigns);
|
63
64
|
}
|
65
|
+
case Campaign.EIGENLAYER: {
|
66
|
+
return EigenLayerDynamicData(chainId, campaigns);
|
67
|
+
}
|
64
68
|
}
|
65
69
|
return {
|
66
70
|
cached: false,
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { type MerklChainId } from "@sdk";
|
2
|
+
import type { UncachedResult } from "../../../utils/execute";
|
3
|
+
import type { EigenLayerFetchedCampaign, PositionType } from "../types";
|
4
|
+
export declare function getEigenLayerUserPositions(user: string, _chainId: MerklChainId, campaigns: {
|
5
|
+
[mainparameter: string]: EigenLayerFetchedCampaign;
|
6
|
+
}): Promise<UncachedResult<PositionType>>;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { BN2Number, ChainInteractionService, EigenLayerStrategyInterface, EigenLayerStrategy__factory, } from "@sdk";
|
2
|
+
export async function getEigenLayerUserPositions(user, _chainId, campaigns) {
|
3
|
+
/**
|
4
|
+
* Fetch user positions
|
5
|
+
*/
|
6
|
+
const calls = [];
|
7
|
+
for (const mainParameter of Object.keys(campaigns)) {
|
8
|
+
calls.push({
|
9
|
+
allowFailure: true,
|
10
|
+
callData: EigenLayerStrategyInterface.encodeFunctionData("shares", [user]),
|
11
|
+
target: campaigns[mainParameter].strategy,
|
12
|
+
});
|
13
|
+
}
|
14
|
+
return {
|
15
|
+
cached: false,
|
16
|
+
call: {
|
17
|
+
callData: calls,
|
18
|
+
handler: () => { },
|
19
|
+
reducer: async (result) => {
|
20
|
+
let j = 0;
|
21
|
+
const finalRes = {};
|
22
|
+
for (const campaignId of Object.keys(campaigns)) {
|
23
|
+
let userShares = 0;
|
24
|
+
let userSupply = 0;
|
25
|
+
const strategy = campaigns[campaignId].strategy;
|
26
|
+
userShares = EigenLayerStrategyInterface.decodeFunctionResult("shares", result[j++])[0];
|
27
|
+
userSupply = BN2Number(await EigenLayerStrategy__factory.connect(strategy, ChainInteractionService(_chainId).provider()).sharesToUnderlying(userShares), campaigns[campaignId].decimals);
|
28
|
+
const res = {
|
29
|
+
userPositions: [],
|
30
|
+
decimals: campaigns[campaignId].decimals,
|
31
|
+
totalSupply: BN2Number(campaigns[campaignId].totalSupplyTargetToken, campaigns[campaignId].decimals),
|
32
|
+
userTVL: 0,
|
33
|
+
};
|
34
|
+
if (userSupply > 0) {
|
35
|
+
res.userPositions.push({
|
36
|
+
balance: userSupply,
|
37
|
+
token: strategy,
|
38
|
+
origin: "Direct",
|
39
|
+
totalSupply: campaigns.campaignId.totalSupplyTargetToken,
|
40
|
+
tvl: campaigns[campaignId].tvl,
|
41
|
+
});
|
42
|
+
// to modify
|
43
|
+
}
|
44
|
+
// Add to final result if there are positions
|
45
|
+
if (res.userPositions.length > 0) {
|
46
|
+
finalRes[`14_${campaignId}`] = { ...res };
|
47
|
+
}
|
48
|
+
}
|
49
|
+
return finalRes;
|
50
|
+
},
|
51
|
+
},
|
52
|
+
};
|
53
|
+
}
|
@@ -1,41 +1,6 @@
|
|
1
|
-
import { type
|
1
|
+
import { type MerklChainId } from "@sdk";
|
2
2
|
import type { UncachedResult } from "../../../utils/execute";
|
3
|
-
|
4
|
-
balance: number;
|
5
|
-
token: string;
|
6
|
-
origin: string;
|
7
|
-
totalSupply: number;
|
8
|
-
tvl: number;
|
9
|
-
};
|
10
|
-
export type FetchedCampaign = {
|
11
|
-
rewardToken: string;
|
12
|
-
targetToken: string;
|
13
|
-
symbolRewardToken: string;
|
14
|
-
subtype: number;
|
15
|
-
tvl: number;
|
16
|
-
poolId: string;
|
17
|
-
decimals: number;
|
18
|
-
totalSupplyTargetToken: number;
|
19
|
-
computedtotalSupply: number;
|
20
|
-
amount: number;
|
21
|
-
forwarders?: {
|
22
|
-
[address: string]: ForwarderParameters<Forwarder>;
|
23
|
-
};
|
24
|
-
};
|
25
|
-
export type MorphoPositionType = {
|
26
|
-
[mainParameter: string]: {
|
27
|
-
userPositions: UserPosition[];
|
28
|
-
decimals: number;
|
29
|
-
totalSupply: number;
|
30
|
-
userTVL: number;
|
31
|
-
};
|
32
|
-
};
|
33
|
-
export type Res = {
|
34
|
-
userPositions: UserPosition[];
|
35
|
-
decimals: number;
|
36
|
-
totalSupply: number;
|
37
|
-
userTVL: number;
|
38
|
-
};
|
3
|
+
import type { AjnaFetchedCampaign, PositionType } from "../types";
|
39
4
|
export declare function getAjnaUserPositions(user: string, _chainId: MerklChainId, campaigns: {
|
40
|
-
[mainparameter: string]:
|
41
|
-
}): Promise<UncachedResult<
|
5
|
+
[mainparameter: string]: AjnaFetchedCampaign;
|
6
|
+
}): Promise<UncachedResult<PositionType>>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { batchMulticallCallWithRetry } from "../../../utils/generic";
|
2
|
-
import { AjnaSubCampaignType, BN2Number, NETWORK_LABELS, PoolInfoUtilsInterface
|
2
|
+
import { AjnaSubCampaignType, BN2Number, NETWORK_LABELS, PoolInfoUtilsInterface } from "@sdk";
|
3
3
|
import { POOL_INFO_UTILS } from "@sdk";
|
4
4
|
import axios from "axios";
|
5
5
|
export async function getAjnaUserPositions(user, _chainId, campaigns) {
|
@@ -28,7 +28,7 @@ export async function getAjnaUserPositions(user, _chainId, campaigns) {
|
|
28
28
|
call: {
|
29
29
|
callData: calls,
|
30
30
|
handler: () => { },
|
31
|
-
reducer: async (
|
31
|
+
reducer: async (_result) => {
|
32
32
|
const finalRes = {};
|
33
33
|
const resCalls = await batchMulticallCallWithRetry(_chainId, {
|
34
34
|
calls,
|
@@ -1,27 +1,6 @@
|
|
1
1
|
import { type MerklChainId } from "@sdk";
|
2
2
|
import type { UncachedResult } from "../../../utils/execute";
|
3
|
-
import type {
|
4
|
-
export type UserPosition = {
|
5
|
-
balance: number;
|
6
|
-
token: string;
|
7
|
-
origin: string;
|
8
|
-
totalSupply: number;
|
9
|
-
tvl: number;
|
10
|
-
};
|
11
|
-
export type MorphoPositionType = {
|
12
|
-
[mainParameter: string]: {
|
13
|
-
userPositions: UserPosition[];
|
14
|
-
decimals: number;
|
15
|
-
totalSupply: number;
|
16
|
-
userTVL: number;
|
17
|
-
};
|
18
|
-
};
|
19
|
-
export type Res = {
|
20
|
-
userPositions: UserPosition[];
|
21
|
-
decimals: number;
|
22
|
-
totalSupply: number;
|
23
|
-
userTVL: number;
|
24
|
-
};
|
3
|
+
import type { BadgerFetchedCampaign, PositionType } from "../types";
|
25
4
|
export declare function getBadgerUserPositions(user: string, _chainId: MerklChainId, campaigns: {
|
26
|
-
[mainparameter: string]:
|
27
|
-
}): Promise<UncachedResult<
|
5
|
+
[mainparameter: string]: BadgerFetchedCampaign;
|
6
|
+
}): Promise<UncachedResult<PositionType>>;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Campaign, withTimeout } from "@sdk";
|
2
2
|
import { MERKL_USER_POSITION_FETCHING_GLOBAL_TIMEOUT } from "../../constants";
|
3
3
|
import { executeSimple } from "../../utils/execute";
|
4
|
+
import { getEigenLayerUserPositions } from "./EigenLayer";
|
4
5
|
import { getAjnaUserPositions } from "./ajna";
|
5
6
|
import { getBadgerUserPositions } from "./badger";
|
6
7
|
import { getClammUserPositions } from "./clamm";
|
@@ -42,6 +43,9 @@ chainId, user) {
|
|
42
43
|
break;
|
43
44
|
case Campaign.COMPOUND:
|
44
45
|
promises.push(withTimeout(executeSimple(chainId, getCompoundUserPositions(user, chainId, positionsToCheck[numkey])), MERKL_USER_POSITION_FETCHING_GLOBAL_TIMEOUT));
|
46
|
+
break;
|
47
|
+
case Campaign.EIGENLAYER:
|
48
|
+
promises.push(withTimeout(executeSimple(chainId, getEigenLayerUserPositions(user, chainId, positionsToCheck[numkey])), MERKL_USER_POSITION_FETCHING_GLOBAL_TIMEOUT));
|
45
49
|
}
|
46
50
|
}
|
47
51
|
return Object.assign({}, ...(await Promise.all(promises)));
|
@@ -1,40 +1,6 @@
|
|
1
|
-
import { type
|
1
|
+
import { type MerklChainId } from "@sdk";
|
2
2
|
import type { UncachedResult } from "../../../utils/execute";
|
3
|
-
|
4
|
-
[mainParameter: string]: {
|
5
|
-
userPositions: UserPosition[];
|
6
|
-
decimals: number;
|
7
|
-
totalSupply: number;
|
8
|
-
userTVL: number;
|
9
|
-
};
|
10
|
-
};
|
11
|
-
export type FetchedCampaign = {
|
12
|
-
rewardToken: string;
|
13
|
-
targetToken: string;
|
14
|
-
symbolRewardToken: string;
|
15
|
-
subtype: number;
|
16
|
-
tvl: number;
|
17
|
-
marketId: string;
|
18
|
-
decimals: number;
|
19
|
-
totalSupplyTargetToken: number;
|
20
|
-
amount: number;
|
21
|
-
forwarders?: {
|
22
|
-
[address: string]: ForwarderParameters<Forwarder>;
|
23
|
-
};
|
24
|
-
};
|
25
|
-
export type UserPosition = {
|
26
|
-
balance: number;
|
27
|
-
token: string;
|
28
|
-
origin: string;
|
29
|
-
totalSupply: number;
|
30
|
-
tvl: number;
|
31
|
-
};
|
32
|
-
export type Res = {
|
33
|
-
userPositions: UserPosition[];
|
34
|
-
decimals: number;
|
35
|
-
totalSupply: number;
|
36
|
-
userTVL: number;
|
37
|
-
};
|
3
|
+
import type { MorphoFetchedCampaign, PositionType } from "../types";
|
38
4
|
export declare function getMorphoUserPositions(user: string, _chainId: MerklChainId, campaigns: {
|
39
|
-
[mainparameter: string]:
|
40
|
-
}): Promise<UncachedResult<
|
5
|
+
[mainparameter: string]: MorphoFetchedCampaign;
|
6
|
+
}): Promise<UncachedResult<PositionType>>;
|
@@ -312,8 +312,34 @@ function prepareCompoundFetch(previous, campaign) {
|
|
312
312
|
};
|
313
313
|
return previous;
|
314
314
|
}
|
315
|
+
function prepareEigenLayerFetch(previous, campaign) {
|
316
|
+
if (campaign.campaignType !== Campaign.EIGENLAYER) {
|
317
|
+
return previous;
|
318
|
+
}
|
319
|
+
const forwarders = {};
|
320
|
+
if (campaign.campaignParameters.forwarders && campaign.campaignParameters.forwarders.length > 0) {
|
321
|
+
for (const forwarder of campaign.campaignParameters.forwarders) {
|
322
|
+
forwarders[utils.getAddress(forwarder.sender)] = forwarder;
|
323
|
+
}
|
324
|
+
}
|
325
|
+
previous[campaign.mainParameter] = {
|
326
|
+
rewardToken: campaign.rewardToken,
|
327
|
+
symbolRewardToken: campaign.campaignParameters.symbolRewardToken,
|
328
|
+
tvl: campaign.tvl,
|
329
|
+
forwarders: forwarders,
|
330
|
+
targetToken: campaign.campaignParameters.strategy,
|
331
|
+
decimalsTargetToken: campaign.campaignParameters.decimalsUnderlyingToken,
|
332
|
+
totalSupplyTargetToken: campaign.totalSupplyTargetToken,
|
333
|
+
underlyingToken: campaign.campaignParameters.underlyingToken,
|
334
|
+
symbolUnderlyingToken: campaign.campaignParameters.symbolUnderlyingToken,
|
335
|
+
decimals: campaign.campaignParameters.decimalsUnderlyingToken,
|
336
|
+
amount: Number.parseFloat((BigInt(campaign.amount) / BigInt(10 ** campaign.campaignParameters.decimalsRewardToken)).toString()),
|
337
|
+
};
|
338
|
+
return previous;
|
339
|
+
}
|
315
340
|
export function prepareFetch(type, previous, // FIXME
|
316
|
-
campaign
|
341
|
+
campaign //FIXME
|
342
|
+
) {
|
317
343
|
switch (type) {
|
318
344
|
case Campaign.CLAMM:
|
319
345
|
return prepareClammFetch(previous, campaign);
|
@@ -333,6 +359,8 @@ campaign) {
|
|
333
359
|
return prepareAjnaFetch(previous, campaign);
|
334
360
|
case Campaign.COMPOUND:
|
335
361
|
return prepareCompoundFetch(previous, campaign);
|
362
|
+
case Campaign.EIGENLAYER:
|
363
|
+
return prepareEigenLayerFetch(previous, campaign);
|
336
364
|
default:
|
337
365
|
return previous;
|
338
366
|
}
|
@@ -1,3 +1,42 @@
|
|
1
|
+
import type { Forwarder, ForwarderParameters } from "@sdk";
|
2
|
+
export interface BucketData {
|
3
|
+
bucket_index: number;
|
4
|
+
deposit: string;
|
5
|
+
bucket_price: string;
|
6
|
+
}
|
7
|
+
export type UserPosition = {
|
8
|
+
balance: number;
|
9
|
+
token: string;
|
10
|
+
origin: string;
|
11
|
+
totalSupply: number;
|
12
|
+
tvl: number;
|
13
|
+
};
|
14
|
+
export type PositionType = {
|
15
|
+
[mainParameter: string]: {
|
16
|
+
userPositions: UserPosition[];
|
17
|
+
decimals: number;
|
18
|
+
totalSupply: number;
|
19
|
+
userTVL: number;
|
20
|
+
};
|
21
|
+
};
|
22
|
+
export type FetchedCampaign = {
|
23
|
+
computedtotalSupply: number;
|
24
|
+
rewardToken: string;
|
25
|
+
symbolRewardToken: string;
|
26
|
+
tvl: number;
|
27
|
+
decimals: number;
|
28
|
+
totalSupplyTargetToken: number;
|
29
|
+
amount: number;
|
30
|
+
forwarders?: {
|
31
|
+
[address: string]: ForwarderParameters<Forwarder>;
|
32
|
+
};
|
33
|
+
};
|
34
|
+
export type Res = {
|
35
|
+
userPositions: UserPosition[];
|
36
|
+
decimals: number;
|
37
|
+
totalSupply: number;
|
38
|
+
userTVL: number;
|
39
|
+
};
|
1
40
|
export type CLAMMPosition = {
|
2
41
|
userPositions: {
|
3
42
|
almAddress: string;
|
@@ -18,3 +57,19 @@ export type CLAMMPosition = {
|
|
18
57
|
userTotalLiquidity: number;
|
19
58
|
userInRangeLiquidity: number;
|
20
59
|
};
|
60
|
+
export type AjnaFetchedCampaign = FetchedCampaign & {
|
61
|
+
subtype: number;
|
62
|
+
poolId: string;
|
63
|
+
quoteToken: string;
|
64
|
+
};
|
65
|
+
export type BadgerFetchedCampaign = FetchedCampaign & {
|
66
|
+
targetToken: string;
|
67
|
+
};
|
68
|
+
export type MorphoFetchedCampaign = FetchedCampaign & {
|
69
|
+
targetToken: string;
|
70
|
+
subtype: number;
|
71
|
+
marketId?: string;
|
72
|
+
};
|
73
|
+
export type EigenLayerFetchedCampaign = FetchedCampaign & {
|
74
|
+
strategy: string;
|
75
|
+
};
|
@@ -60,7 +60,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
60
60
|
body: unknown;
|
61
61
|
params: {};
|
62
62
|
query: {
|
63
|
-
type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | undefined;
|
63
|
+
type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | undefined;
|
64
64
|
items?: number | undefined;
|
65
65
|
subType?: number | undefined;
|
66
66
|
page?: number | undefined;
|
@@ -132,7 +132,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
132
132
|
body: unknown;
|
133
133
|
params: {};
|
134
134
|
query: {
|
135
|
-
type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | undefined;
|
135
|
+
type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | undefined;
|
136
136
|
items?: number | undefined;
|
137
137
|
subType?: number | undefined;
|
138
138
|
page?: number | undefined;
|
@@ -33,6 +33,8 @@ export declare const campaignTypeToEnumMap: {
|
|
33
33
|
readonly SILO: any;
|
34
34
|
readonly JSON_AIRDROP: any;
|
35
35
|
readonly UNISWAP_V4: any;
|
36
|
+
readonly EIGENLAYER: any;
|
37
|
+
readonly ION: any;
|
36
38
|
};
|
37
39
|
export type ConvertedCampaignType<C extends CampaignType> = (typeof campaignTypeToEnumMap)[C];
|
38
40
|
export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
|
@@ -117,6 +119,8 @@ export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
|
|
117
119
|
AJNA: "AJNA";
|
118
120
|
EULER: "EULER";
|
119
121
|
UNISWAP_V4: "UNISWAP_V4";
|
122
|
+
ION: "ION";
|
123
|
+
EIGENLAYER: "EIGENLAYER";
|
120
124
|
}>>;
|
121
125
|
subType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
122
126
|
campaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
@@ -20,6 +20,8 @@ export const campaignTypeToEnumMap = {
|
|
20
20
|
SILO: CampaignTypeEnum.SILO,
|
21
21
|
JSON_AIRDROP: CampaignTypeEnum.JSON_AIRDROP,
|
22
22
|
UNISWAP_V4: CampaignTypeEnum.UNISWAP_V4,
|
23
|
+
EIGENLAYER: CampaignTypeEnum.EIGENLAYER,
|
24
|
+
ION: CampaignTypeEnum.ION,
|
23
25
|
};
|
24
26
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
25
27
|
export const CampaignUniqueDto = t.Object({
|
@@ -17,7 +17,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
17
17
|
post: {
|
18
18
|
body: {
|
19
19
|
name?: string | undefined;
|
20
|
-
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4";
|
20
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
21
21
|
tokens: {
|
22
22
|
chainId: number;
|
23
23
|
address: string;
|
@@ -315,6 +315,8 @@ export declare const CreateOpportunityDto: import("@sinclair/typebox").TObject<{
|
|
315
315
|
AJNA: "AJNA";
|
316
316
|
EULER: "EULER";
|
317
317
|
UNISWAP_V4: "UNISWAP_V4";
|
318
|
+
ION: "ION";
|
319
|
+
EIGENLAYER: "EIGENLAYER";
|
318
320
|
}>;
|
319
321
|
identifier: import("@sinclair/typebox").TString;
|
320
322
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
@@ -12,6 +12,7 @@ import { getBadgerMetadata } from "./subservices/getBadgerMetadata.service";
|
|
12
12
|
import { getClammMetadata } from "./subservices/getClammMetadata.service";
|
13
13
|
import { getCompoundMetadata } from "./subservices/getCompoundMetadata.service";
|
14
14
|
import { getDolomiteMetadata } from "./subservices/getDolomiteMetadata.service";
|
15
|
+
import { getEigenLayerMetadata } from "./subservices/getEigenLayerMetadata.service";
|
15
16
|
import { getErc20Metadata } from "./subservices/getErc20Metadata.service";
|
16
17
|
import { getErc20SnapshotMetadata } from "./subservices/getErc20SnapshotMetadata.service";
|
17
18
|
import { getEulerMetadata } from "./subservices/getEulerMetadata.service";
|
@@ -64,6 +65,8 @@ export class OpportunityService {
|
|
64
65
|
return getCompoundMetadata(chainId, campaign.subType, campaignParams);
|
65
66
|
case "AJNA":
|
66
67
|
return getAjnaMetadata(chainId, campaign.subType, campaignParams);
|
68
|
+
case "EIGENLAYER":
|
69
|
+
return getEigenLayerMetadata(chainId, campaignParams);
|
67
70
|
case "EULER":
|
68
71
|
return getEulerMetadata(chainId, campaign.campaignId, campaign.subType, campaign.rewardTokenAddress, campaign.amount, campaignParams);
|
69
72
|
case "INVALID":
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../../database/api/.generated";
|
2
|
+
export const getEigenLayerMetadata = async (chainId, params) => {
|
3
|
+
return {
|
4
|
+
action: OpportunityAction.LEND,
|
5
|
+
name: ["EigenLayer", "strategy for", params.symbolUnderlyingToken].join(" "),
|
6
|
+
tokens: [{ chainId, address: params.underlyingToken }],
|
7
|
+
mainProtocol: "eigenlayer",
|
8
|
+
};
|
9
|
+
};
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import Elysia from "elysia";
|
2
|
+
export declare const ProgramPayloadController: Elysia<"/program-payload", false, {
|
3
|
+
decorator: {};
|
4
|
+
store: {};
|
5
|
+
derive: {};
|
6
|
+
resolve: {};
|
7
|
+
}, {
|
8
|
+
type: {};
|
9
|
+
error: {};
|
10
|
+
}, {
|
11
|
+
schema: {};
|
12
|
+
macro: {};
|
13
|
+
macroFn: {};
|
14
|
+
}, {
|
15
|
+
"program-payload": {
|
16
|
+
index: {
|
17
|
+
get: {
|
18
|
+
body: unknown;
|
19
|
+
params: {};
|
20
|
+
query: {
|
21
|
+
creator: string;
|
22
|
+
startTimestamp: number;
|
23
|
+
endTimestamp: number;
|
24
|
+
campaign: string;
|
25
|
+
distributionChainId: number;
|
26
|
+
amount: string;
|
27
|
+
rewardToken: string;
|
28
|
+
program: string;
|
29
|
+
};
|
30
|
+
headers: unknown;
|
31
|
+
response: {
|
32
|
+
[x: string]: any;
|
33
|
+
200: any;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
};
|
37
|
+
};
|
38
|
+
} & {
|
39
|
+
"program-payload": {
|
40
|
+
config: {
|
41
|
+
get: {
|
42
|
+
body: unknown;
|
43
|
+
params: {};
|
44
|
+
query: {
|
45
|
+
creator: string;
|
46
|
+
startTimestamp: number;
|
47
|
+
endTimestamp: number;
|
48
|
+
campaign: string;
|
49
|
+
distributionChainId: number;
|
50
|
+
amount: string;
|
51
|
+
rewardToken: string;
|
52
|
+
program: string;
|
53
|
+
};
|
54
|
+
headers: unknown;
|
55
|
+
response: {
|
56
|
+
[x: string]: any;
|
57
|
+
200: any;
|
58
|
+
};
|
59
|
+
};
|
60
|
+
};
|
61
|
+
};
|
62
|
+
} & {
|
63
|
+
"program-payload": {
|
64
|
+
program: {
|
65
|
+
get: {
|
66
|
+
body: unknown;
|
67
|
+
params: {};
|
68
|
+
query: {
|
69
|
+
creator: string;
|
70
|
+
startTimestamp: number;
|
71
|
+
endTimestamp: number;
|
72
|
+
distributionChainId: number;
|
73
|
+
amount: string;
|
74
|
+
rewardToken: string;
|
75
|
+
program: string;
|
76
|
+
};
|
77
|
+
headers: unknown;
|
78
|
+
response: {
|
79
|
+
[x: string]: any;
|
80
|
+
200: any;
|
81
|
+
};
|
82
|
+
};
|
83
|
+
};
|
84
|
+
};
|
85
|
+
}, {
|
86
|
+
derive: {};
|
87
|
+
resolve: {};
|
88
|
+
schema: {};
|
89
|
+
}, {
|
90
|
+
derive: {};
|
91
|
+
resolve: {};
|
92
|
+
schema: {};
|
93
|
+
}>;
|