@merkl/api 0.20.114 → 0.20.116
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/database/api/.generated/drizzle/schema.d.ts +17 -0
- package/dist/database/api/.generated/drizzle/schema.js +1 -0
- package/dist/database/api/.generated/drizzle/schema.ts +1 -0
- package/dist/database/api/.generated/edge.js +4 -3
- package/dist/database/api/.generated/index-browser.js +1 -0
- package/dist/database/api/.generated/index.d.ts +58 -1
- package/dist/database/api/.generated/index.js +4 -3
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +1 -0
- package/dist/database/api/.generated/wasm.js +1 -0
- package/dist/src/eden/index.d.ts +121 -3
- package/dist/src/engine/deprecated/dynamicData/factory.js +1 -0
- package/dist/src/engine/deprecated/dynamicData/implementations/ERC721.js +4 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/ERCMultiToken.js +4 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/Erc20.js +4 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/EventBased.js +1 -1
- package/dist/src/engine/deprecated/dynamicData/utils/getFixedApr.d.ts +0 -1
- package/dist/src/engine/deprecated/dynamicData/utils/getFixedApr.js +0 -8
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound1.js +3 -8
- package/dist/src/engine/implementations/EigenLayer/tvl.d.ts +7 -0
- package/dist/src/engine/implementations/EigenLayer/tvl.js +60 -0
- package/dist/src/engine/implementations/Erc20/subTypes/factories.js +6 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/gearbox/tvl.js +1 -1
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/metadata.d.ts +17 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/metadata.js +29 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/tvl.d.ts +6 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/tvl.js +48 -0
- package/dist/src/engine/implementations/Erc20/tvl.js +1 -1
- package/dist/src/engine/metadata/factory.js +1 -0
- package/dist/src/engine/tvl/factory.js +2 -0
- package/dist/src/index.d.ts +41 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -0
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +2 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +4 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +9 -0
- package/dist/src/modules/v4/campaign/campaign.service.js +4 -2
- package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +3 -1
- package/dist/src/modules/v4/campaign/campaign.test.controller.js +14 -3
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +7 -7
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +21 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +10 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +13 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +25 -0
- package/dist/src/modules/v4/reward/reward.model.d.ts +4 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +14 -0
- package/dist/src/modules/v4/router.d.ts +41 -1
- package/dist/src/modules/v4/token/token.controller.d.ts +9 -0
- package/dist/src/modules/v4/token/token.model.d.ts +3 -0
- package/dist/src/modules/v4/token/token.model.js +3 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +4 -0
- package/dist/src/modules/v4/token/token.service.d.ts +33 -0
- package/dist/src/modules/v4/token/token.service.js +20 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +4 -0
- package/dist/src/utils/parseDistributionType.d.ts +1 -0
- package/dist/src/utils/parseDistributionType.js +16 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -61,5 +61,6 @@ const map = {
|
|
61
61
|
[Campaign.ERC1155FIXAPR]: new ERCMultiTokenDynamicData(),
|
62
62
|
[Campaign.ERC721]: new ERC721DynamicData(),
|
63
63
|
[Campaign.ERC721FIXAPR]: new ERC721DynamicData(),
|
64
|
+
[Campaign.MULTILOG]: new DefaultDynamicData(), // TODO
|
64
65
|
};
|
65
66
|
export const dynamicDataBuilderFactory = (campaignType) => map[campaignType];
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import { TokenService } from "@/modules/v4/token/token.service";
|
2
2
|
import { log } from "@/utils/logger";
|
3
|
+
import { parseDistributionType } from "@/utils/parseDistributionType";
|
3
4
|
import { Pricer } from "@/utils/pricer";
|
5
|
+
import { DistributionType } from "@db/api";
|
4
6
|
import { AragornEscrowInterface, BN2Number, ChainInteractionService, ERC20Interface, YEAR, } from "@sdk";
|
5
7
|
import { ERC721SubCampaignType } from "libs/sdk/src/types/merkl/campaignTypes/erc721";
|
6
|
-
import { getFixedApr
|
8
|
+
import { getFixedApr } from "../utils/getFixedApr";
|
7
9
|
export class ERC721DynamicData {
|
8
10
|
async build(chainId, campaigns) {
|
9
11
|
const pricer = await Pricer.load();
|
@@ -69,7 +71,7 @@ export class ERC721DynamicData {
|
|
69
71
|
if (rewardToken.isPoint) {
|
70
72
|
apr = apr / 365 / 100;
|
71
73
|
}
|
72
|
-
else if (
|
74
|
+
else if (parseDistributionType(campaign.campaignParameters) !== DistributionType.DUTCH_AUCTION) {
|
73
75
|
apr = getFixedApr(campaign, priceRewardToken, priceTargetToken);
|
74
76
|
}
|
75
77
|
dynamicData.push({
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { TokenService } from "@/modules/v4/token/token.service";
|
2
2
|
import { log } from "@/utils/logger";
|
3
|
+
import { parseDistributionType } from "@/utils/parseDistributionType";
|
3
4
|
import { Pricer } from "@/utils/pricer";
|
5
|
+
import { DistributionType } from "@db/api";
|
4
6
|
import { BN2Number, ChainInteractionService, CloberBookManagerInterface, CloberPoolInterface, ERC20Interface, ERC6909Interface, YEAR, } from "@sdk";
|
5
|
-
import { getFixedApr
|
7
|
+
import { getFixedApr } from "../utils/getFixedApr";
|
6
8
|
export class ERCMultiTokenDynamicData {
|
7
9
|
async build(chainId, campaigns) {
|
8
10
|
const pricer = await Pricer.load();
|
@@ -143,7 +145,7 @@ export class ERCMultiTokenDynamicData {
|
|
143
145
|
if (rewardToken.isPoint) {
|
144
146
|
apr = apr / 365 / 100;
|
145
147
|
}
|
146
|
-
else if (
|
148
|
+
else if (parseDistributionType(campaign.campaignParameters) !== DistributionType.DUTCH_AUCTION) {
|
147
149
|
apr = getFixedApr(campaign, priceRewardToken, priceTargetToken);
|
148
150
|
}
|
149
151
|
dynamicData.push({
|
@@ -8,9 +8,11 @@ import { ComputedValueService } from "@/modules/v4/computedValue/computedValue.s
|
|
8
8
|
import { TokenRepository } from "@/modules/v4/token/token.repository";
|
9
9
|
import { TokenService } from "@/modules/v4/token/token.service";
|
10
10
|
import { log } from "@/utils/logger";
|
11
|
+
import { parseDistributionType } from "@/utils/parseDistributionType";
|
11
12
|
import { Pricer } from "@/utils/pricer";
|
13
|
+
import { DistributionType } from "@db/api";
|
12
14
|
import { BN2Number, BalancerPoolInterface, BalancerV3StablePoolInterface, ChainId, ChainInteractionService, ERC20Interface, EnzymeInterface, FactoryInterface, LayerBankERC20Interface, MetamorphoInterface, YEAR, getEnv, } from "@sdk";
|
13
|
-
import { getFixedApr
|
15
|
+
import { getFixedApr } from "../utils/getFixedApr";
|
14
16
|
export class Erc20DynamicData {
|
15
17
|
async build(chainId, campaigns) {
|
16
18
|
const pricer = await Pricer.load();
|
@@ -155,7 +157,7 @@ export class Erc20DynamicData {
|
|
155
157
|
if (rewardToken.isPoint) {
|
156
158
|
apr = apr / 365 / 100;
|
157
159
|
}
|
158
|
-
else if (
|
160
|
+
else if (parseDistributionType(campaign.campaignParameters) !== DistributionType.DUTCH_AUCTION) {
|
159
161
|
apr = getFixedApr(campaign, priceRewardToken, priceTargetToken);
|
160
162
|
}
|
161
163
|
dynamicData.push({
|
@@ -69,7 +69,7 @@ export class EventBasedDynamicData {
|
|
69
69
|
const { distributedRewards } = await computeEventBasedPoolRewardsFromMostRecentStateSave(chainId, campaign.campaignId, priceToken, decimalsCurrency0);
|
70
70
|
const c = campaign;
|
71
71
|
const amount = BN2Number(c.amount, c.campaignParameters.decimalsRewardToken);
|
72
|
-
const multiplier = BN2Number(c.campaignParameters.topicToData[0].
|
72
|
+
const multiplier = BN2Number(c.campaignParameters.topicToData[0].multipliers[0], 12 + 9);
|
73
73
|
const startTimestamp = BN2Number(c.startTimestamp, 0);
|
74
74
|
const endTimestamp = BN2Number(c.endTimestamp, 0);
|
75
75
|
const isLive = moment().unix() > startTimestamp && moment().unix() < endTimestamp;
|
@@ -5,5 +5,4 @@ export type BaseFixAPRConfig = {
|
|
5
5
|
rewardTokenPricing: boolean;
|
6
6
|
};
|
7
7
|
export type FixedAprCampaignType = Campaign.ERC20_FIX_APR | Campaign.HYPERDRIVELOGFIXPROCESSOR | Campaign.ERC6909FIXAPR | Campaign.ERC1155FIXAPR | Campaign.ERC721FIXAPR;
|
8
|
-
export declare function hasFixedAprConfig<T>(params: T): params is T & BaseFixAPRConfig;
|
9
8
|
export declare function getFixedApr(campaignParameters: CampaignParameters<FixedAprCampaignType>, priceRewardToken: number, priceTargetToken: number): number;
|
@@ -1,11 +1,3 @@
|
|
1
|
-
// Type guard to check if campaign parameters have fixed APR config
|
2
|
-
export function hasFixedAprConfig(params) {
|
3
|
-
return (typeof params === "object" &&
|
4
|
-
params !== null &&
|
5
|
-
"targetTokenPricing" in params &&
|
6
|
-
"rewardTokenPricing" in params &&
|
7
|
-
"apr" in params);
|
8
|
-
}
|
9
1
|
// TODO: Enhance APR display for non-dollar denominations when front-end is ready.
|
10
2
|
// This should handle cases where one or both token price are unavailable, showing the APR as a direct ratio
|
11
3
|
// (e.g., X reward tokens per Y target tokens) instead of dollar values.
|
@@ -190,18 +190,13 @@ function generateResult(type, name, targetToken, typeInfo, campaign) {
|
|
190
190
|
};
|
191
191
|
return processorObject.computeRound1(type, typeInfo);
|
192
192
|
}
|
193
|
-
function processNamingConditions(type, name, targetToken, campaign) {
|
194
|
-
if (satisfiesNameConditions(name, type)) {
|
195
|
-
return generateResult(type, name, targetToken, {}, campaign);
|
196
|
-
}
|
197
|
-
}
|
198
193
|
export function processNamingConditionsInOrder(name, targetToken, campaign) {
|
199
194
|
// Order matters
|
200
195
|
const types = Object.values(Erc20SubType).filter(value => typeof value === "string");
|
201
196
|
for (const type of types) {
|
202
|
-
|
203
|
-
|
204
|
-
|
197
|
+
if (satisfiesNameConditions(name, type)) {
|
198
|
+
return generateResult(type, name, targetToken, {}, campaign);
|
199
|
+
}
|
205
200
|
}
|
206
201
|
}
|
207
202
|
function parseForFactory(calls, targetToken, campaign) {
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { TVLBuilder, TVLData } from "@/engine/tvl/interface";
|
2
|
+
import { type Campaign, type CampaignParameters, type MerklChainId } from "@sdk";
|
3
|
+
type campaignType = Campaign.EIGENLAYER;
|
4
|
+
export declare class EigenLayerTVLBuilder implements TVLBuilder<campaignType> {
|
5
|
+
build(computeChainId: MerklChainId, campaigns: CampaignParameters<campaignType>[]): Promise<TVLData<Campaign.EIGENLAYER>>;
|
6
|
+
}
|
7
|
+
export {};
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { TokenService } from "@/modules/v4/token/token.service";
|
2
|
+
import { log } from "@/utils/logger";
|
3
|
+
import { TvlType } from "@db/api";
|
4
|
+
import { ChainInteractionService, EigenLayerStrategyInterface, bigIntToNumber, } from "@sdk";
|
5
|
+
export class EigenLayerTVLBuilder {
|
6
|
+
async build(computeChainId, campaigns) {
|
7
|
+
const tvls = [];
|
8
|
+
const firstRound = await ChainInteractionService(computeChainId).fetchAndDecodeObject(campaigns.flatMap(campaign => {
|
9
|
+
const { campaignId, campaignParameters } = campaign;
|
10
|
+
const { strategy } = campaignParameters;
|
11
|
+
return [
|
12
|
+
{
|
13
|
+
callData: EigenLayerStrategyInterface.encodeFunctionData("totalShares"),
|
14
|
+
target: strategy,
|
15
|
+
key: `${campaignId}_totalShares`,
|
16
|
+
decoder: (data) => BigInt(EigenLayerStrategyInterface.decodeFunctionResult("totalShares", data)[0].toString()),
|
17
|
+
},
|
18
|
+
];
|
19
|
+
}));
|
20
|
+
const secondRound = await ChainInteractionService(computeChainId).fetchAndDecodeObject(campaigns.flatMap(campaign => {
|
21
|
+
const { campaignId, campaignParameters } = campaign;
|
22
|
+
const { strategy } = campaignParameters;
|
23
|
+
let totalShares = firstRound[`${campaignId}_totalShares`];
|
24
|
+
if (!totalShares) {
|
25
|
+
log.warn(`Error getting totalShares for campaign ${campaign.campaignId} and strategy ${campaign.campaignParameters.strategy}`);
|
26
|
+
totalShares = 10n;
|
27
|
+
}
|
28
|
+
return [
|
29
|
+
{
|
30
|
+
callData: EigenLayerStrategyInterface.encodeFunctionData("sharesToUnderlying", [totalShares]),
|
31
|
+
target: strategy,
|
32
|
+
key: `${campaignId}_totalUnderlying`,
|
33
|
+
decoder: (data) => BigInt(EigenLayerStrategyInterface.decodeFunctionResult("sharesToUnderlying", data)[0].toString()),
|
34
|
+
},
|
35
|
+
];
|
36
|
+
}));
|
37
|
+
for (const campaign of campaigns) {
|
38
|
+
const { campaignId, campaignParameters } = campaign;
|
39
|
+
const { underlyingToken: underlyingTokenAddress } = campaignParameters;
|
40
|
+
const totalUnderlying = secondRound[`${campaignId}_totalUnderlying`];
|
41
|
+
// We don't fetch token data everytime, we use the database and the associated service
|
42
|
+
const underlyingToken = await TokenService.findUniqueFillOrThrow({
|
43
|
+
chainId: computeChainId,
|
44
|
+
address: underlyingTokenAddress,
|
45
|
+
});
|
46
|
+
tvls.push({
|
47
|
+
campaign,
|
48
|
+
tvl: (bigIntToNumber(totalUnderlying, underlyingToken.decimals) ?? 0) * (underlyingToken.price ?? 0),
|
49
|
+
tvlBreakdown: [
|
50
|
+
{
|
51
|
+
identifier: underlyingToken.id,
|
52
|
+
type: TvlType.TOKEN,
|
53
|
+
value: bigIntToNumber(totalUnderlying, underlyingToken.decimals),
|
54
|
+
},
|
55
|
+
],
|
56
|
+
});
|
57
|
+
}
|
58
|
+
return tvls;
|
59
|
+
}
|
60
|
+
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { Erc20SubType } from ".";
|
2
2
|
import { GearboxMetadata } from "./implementations/gearbox/metadata";
|
3
3
|
import { GearboxTVLBuilder } from "./implementations/gearbox/tvl";
|
4
|
+
import { SuperlendMetadata } from "./implementations/superlend/metadata";
|
5
|
+
import { SuperlendTVLBuilder } from "./implementations/superlend/tvl";
|
4
6
|
/**
|
5
7
|
* @dev TYPE SAFETY DISABLED FOR NOW AS WE DON'T HAVE ALL THE CAMPAIGNS IMPLEMENTED
|
6
8
|
*
|
@@ -9,6 +11,8 @@ import { GearboxTVLBuilder } from "./implementations/gearbox/tvl";
|
|
9
11
|
*/
|
10
12
|
const tvlMap = {
|
11
13
|
[Erc20SubType.gearbox]: new GearboxTVLBuilder(),
|
14
|
+
[Erc20SubType.superlend_borrowing]: new SuperlendTVLBuilder(),
|
15
|
+
[Erc20SubType.superlend_lending]: new SuperlendTVLBuilder(),
|
12
16
|
};
|
13
17
|
export const erc20SubTypeTVLBuilderFactory = (erc20Subtype) => {
|
14
18
|
if (!tvlMap[erc20Subtype]) {
|
@@ -24,6 +28,8 @@ export const erc20SubTypeTVLBuilderFactory = (erc20Subtype) => {
|
|
24
28
|
*/
|
25
29
|
const metadataMap = {
|
26
30
|
[Erc20SubType.gearbox]: new GearboxMetadata(),
|
31
|
+
[Erc20SubType.superlend_borrowing]: new SuperlendMetadata(),
|
32
|
+
[Erc20SubType.superlend_lending]: new SuperlendMetadata(),
|
27
33
|
};
|
28
34
|
export const erc20SubTypeMetadataBuilderFactory = (erc20Subtype) => {
|
29
35
|
if (!metadataMap[erc20Subtype]) {
|
@@ -21,7 +21,7 @@ export class GearboxTVLBuilder {
|
|
21
21
|
for (const [index, campaign] of campaigns.entries()) {
|
22
22
|
const underlyingTokenAddress = GearboxVaultInterface.decodeFunctionResult("underlyingToken", result[2 * index].returnData)[0];
|
23
23
|
const totalAssets = ERC4626Interface.decodeFunctionResult("totalAssets", result[2 * index + 1].returnData)[0];
|
24
|
-
const underlyingToken = await TokenService.
|
24
|
+
const underlyingToken = await TokenService.findUniqueFillOrThrow({
|
25
25
|
chainId: computeChainId,
|
26
26
|
address: underlyingTokenAddress,
|
27
27
|
});
|
package/dist/src/engine/implementations/Erc20/subTypes/implementations/superlend/metadata.d.ts
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
|
+
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
+
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
+
import type { Erc20LikeCampaignEnum } from "../..";
|
5
|
+
export declare class SuperlendMetadata implements MetadataBuilder<Erc20LikeCampaignEnum> {
|
6
|
+
build(campaign: Omit<CampaignWithParams<Erc20LikeCampaignEnum>, "manualOverrides">): Promise<{
|
7
|
+
action: "LEND" | "BORROW";
|
8
|
+
protocol: ProtocolId;
|
9
|
+
name: string;
|
10
|
+
tokens: {
|
11
|
+
chainId: number;
|
12
|
+
address: any;
|
13
|
+
}[];
|
14
|
+
depositUrl: string;
|
15
|
+
explorerAddress: any;
|
16
|
+
}>;
|
17
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { TokenService } from "@/modules/v4/token/token.service";
|
2
|
+
import { OpportunityAction } from "@db/api";
|
3
|
+
import { Aave__factory, ChainInteractionService, TokenInteractionService } from "@sdk";
|
4
|
+
export class SuperlendMetadata {
|
5
|
+
async build(campaign) {
|
6
|
+
const { params, computeChainId } = campaign;
|
7
|
+
const { targetToken } = params;
|
8
|
+
const targetTokenInfo = await TokenService.fetchOnChain({
|
9
|
+
chainId: computeChainId,
|
10
|
+
address: targetToken,
|
11
|
+
});
|
12
|
+
const underlyingToken = await Aave__factory.connect(targetToken, ChainInteractionService(computeChainId).provider()).UNDERLYING_ASSET_ADDRESS();
|
13
|
+
const underlyingTokenSymbol = await TokenInteractionService(computeChainId).symbol(underlyingToken);
|
14
|
+
const action = targetTokenInfo?.name?.toLowerCase().includes("debt")
|
15
|
+
? OpportunityAction.BORROW
|
16
|
+
: OpportunityAction.LEND;
|
17
|
+
return {
|
18
|
+
action,
|
19
|
+
protocol: "superlend",
|
20
|
+
name: `${action === OpportunityAction.BORROW ? "Borrow" : "Supply"} ${underlyingTokenSymbol} on Superlend`,
|
21
|
+
tokens: [
|
22
|
+
{ chainId: computeChainId, address: targetToken },
|
23
|
+
{ chainId: computeChainId, address: underlyingToken },
|
24
|
+
],
|
25
|
+
depositUrl: `https://markets.superlend.xyz/reserve-overview/?underlyingAsset=${underlyingToken}`,
|
26
|
+
explorerAddress: params.targetToken,
|
27
|
+
};
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { Erc20LikeCampaignEnum } from "@/engine/implementations/Erc20/subTypes";
|
2
|
+
import type { TVLBuilder, TVLData } from "@/engine/tvl/interface";
|
3
|
+
import { type CampaignParameters, type MerklChainId } from "@sdk";
|
4
|
+
export declare class SuperlendTVLBuilder implements TVLBuilder<Erc20LikeCampaignEnum> {
|
5
|
+
build(computeChainId: MerklChainId, campaigns: CampaignParameters<Erc20LikeCampaignEnum>[]): Promise<TVLData<any>>;
|
6
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { TokenService } from "@/modules/v4/token/token.service";
|
2
|
+
import { TvlType } from "@db/api";
|
3
|
+
import { AaveInterface, ChainInteractionService, ERC20Interface, bigIntToNumber, } from "@sdk";
|
4
|
+
export class SuperlendTVLBuilder {
|
5
|
+
async build(computeChainId, campaigns) {
|
6
|
+
const tvls = [];
|
7
|
+
const firstRound = await ChainInteractionService(computeChainId).fetchAndDecodeObject(campaigns.flatMap(campaign => {
|
8
|
+
const { campaignId, campaignParameters } = campaign;
|
9
|
+
const { targetToken } = campaignParameters;
|
10
|
+
return [
|
11
|
+
{
|
12
|
+
callData: AaveInterface.encodeFunctionData("UNDERLYING_ASSET_ADDRESS"),
|
13
|
+
target: targetToken,
|
14
|
+
key: `${campaignId}_underlyingToken`,
|
15
|
+
decoder: (data) => AaveInterface.decodeFunctionResult("UNDERLYING_ASSET_ADDRESS", data)[0],
|
16
|
+
},
|
17
|
+
{
|
18
|
+
callData: ERC20Interface.encodeFunctionData("totalSupply"),
|
19
|
+
target: targetToken,
|
20
|
+
key: `${campaignId}_totalSupply`,
|
21
|
+
decoder: (data) => BigInt(ERC20Interface.decodeFunctionResult("totalSupply", data)[0].toString()),
|
22
|
+
},
|
23
|
+
];
|
24
|
+
}));
|
25
|
+
for (const campaign of campaigns) {
|
26
|
+
const { campaignId } = campaign;
|
27
|
+
const underlyingTokenAddress = firstRound[`${campaignId}_underlyingToken`];
|
28
|
+
const totalSupply = firstRound[`${campaignId}_totalSupply`];
|
29
|
+
// We don't fetch token data everytime, we use the database and the associated service
|
30
|
+
const underlyingToken = await TokenService.findUniqueFillOrThrow({
|
31
|
+
chainId: computeChainId,
|
32
|
+
address: underlyingTokenAddress,
|
33
|
+
});
|
34
|
+
tvls.push({
|
35
|
+
campaign,
|
36
|
+
tvl: (bigIntToNumber(totalSupply, underlyingToken.decimals) ?? 0) * (underlyingToken.price ?? 0),
|
37
|
+
tvlBreakdown: [
|
38
|
+
{
|
39
|
+
identifier: underlyingToken.id,
|
40
|
+
type: TvlType.TOKEN,
|
41
|
+
value: bigIntToNumber(totalSupply, underlyingToken.decimals),
|
42
|
+
},
|
43
|
+
],
|
44
|
+
});
|
45
|
+
}
|
46
|
+
return tvls;
|
47
|
+
}
|
48
|
+
}
|
@@ -67,5 +67,6 @@ const map = {
|
|
67
67
|
[Campaign.ERC1155FIXAPR]: new ErcMultiTokenMetadata(),
|
68
68
|
[Campaign.ERC721]: new Erc721Metadata(),
|
69
69
|
[Campaign.ERC721FIXAPR]: new Erc721Metadata(),
|
70
|
+
[Campaign.MULTILOG]: new DefaultMetadata(), // TODO
|
70
71
|
};
|
71
72
|
export const metadataBuilderFactory = (campaignType) => map[campaignType];
|
@@ -2,6 +2,7 @@ import { UniswapV4TVLBuilder } from "@/engine/implementations/UniswapV4/tvl";
|
|
2
2
|
import { Campaign } from "@sdk";
|
3
3
|
import { AjnaTVLBuilder } from "../implementations/Ajna/tvl";
|
4
4
|
import { AmbiantTVLBuilder } from "../implementations/Ambient/tvl";
|
5
|
+
import { EigenLayerTVLBuilder } from "../implementations/EigenLayer/tvl";
|
5
6
|
import { Erc20TVLBuilder } from "../implementations/Erc20/tvl";
|
6
7
|
/**
|
7
8
|
* @dev TYPE SAFETY DISABLED FOR NOW AS WE DON'T HAVE ALL THE CAMPAIGNS IMPLEMENTED
|
@@ -11,6 +12,7 @@ import { Erc20TVLBuilder } from "../implementations/Erc20/tvl";
|
|
11
12
|
*/
|
12
13
|
const map = {
|
13
14
|
[Campaign.AJNA]: new AjnaTVLBuilder(),
|
15
|
+
[Campaign.EIGENLAYER]: new EigenLayerTVLBuilder(),
|
14
16
|
[Campaign.AMBIENTPROCESSOR]: new AmbiantTVLBuilder(),
|
15
17
|
[Campaign.UNISWAP_V4]: new UniswapV4TVLBuilder(),
|
16
18
|
[Campaign.ERC20]: new Erc20TVLBuilder(),
|
package/dist/src/index.d.ts
CHANGED
@@ -297,6 +297,7 @@ declare const app: Elysia<"", false, {
|
|
297
297
|
verified: boolean;
|
298
298
|
isTest: boolean;
|
299
299
|
isPoint: boolean;
|
300
|
+
isPreTGE: boolean;
|
300
301
|
isNative: boolean;
|
301
302
|
} & {
|
302
303
|
price?: number | null | undefined;
|
@@ -361,6 +362,7 @@ declare const app: Elysia<"", false, {
|
|
361
362
|
verified: boolean;
|
362
363
|
isTest: boolean;
|
363
364
|
isPoint: boolean;
|
365
|
+
isPreTGE: boolean;
|
364
366
|
isNative: boolean;
|
365
367
|
} & {
|
366
368
|
price?: number | null | undefined;
|
@@ -451,6 +453,7 @@ declare const app: Elysia<"", false, {
|
|
451
453
|
verified: boolean;
|
452
454
|
isTest: boolean;
|
453
455
|
isPoint: boolean;
|
456
|
+
isPreTGE: boolean;
|
454
457
|
isNative: boolean;
|
455
458
|
price: number | null;
|
456
459
|
};
|
@@ -478,6 +481,7 @@ declare const app: Elysia<"", false, {
|
|
478
481
|
verified: boolean;
|
479
482
|
isTest: boolean;
|
480
483
|
isPoint: boolean;
|
484
|
+
isPreTGE: boolean;
|
481
485
|
isNative: boolean;
|
482
486
|
} & {
|
483
487
|
price?: number | null | undefined;
|
@@ -546,6 +550,7 @@ declare const app: Elysia<"", false, {
|
|
546
550
|
verified: boolean;
|
547
551
|
isTest: boolean;
|
548
552
|
isPoint: boolean;
|
553
|
+
isPreTGE: boolean;
|
549
554
|
isNative: boolean;
|
550
555
|
} & {
|
551
556
|
price?: number | null | undefined;
|
@@ -678,6 +683,8 @@ declare const app: Elysia<"", false, {
|
|
678
683
|
decimals: number;
|
679
684
|
verified: boolean;
|
680
685
|
isTest: boolean;
|
686
|
+
isPoint: boolean;
|
687
|
+
isPreTGE: boolean;
|
681
688
|
};
|
682
689
|
value: number;
|
683
690
|
campaignId: string;
|
@@ -700,6 +707,8 @@ declare const app: Elysia<"", false, {
|
|
700
707
|
decimals: number;
|
701
708
|
verified: boolean;
|
702
709
|
isTest: boolean;
|
710
|
+
isPoint: boolean;
|
711
|
+
isPreTGE: boolean;
|
703
712
|
}[];
|
704
713
|
tags: string[];
|
705
714
|
identifier: string;
|
@@ -811,6 +820,8 @@ declare const app: Elysia<"", false, {
|
|
811
820
|
decimals: number;
|
812
821
|
verified: boolean;
|
813
822
|
isTest: boolean;
|
823
|
+
isPoint: boolean;
|
824
|
+
isPreTGE: boolean;
|
814
825
|
};
|
815
826
|
value: number;
|
816
827
|
campaignId: string;
|
@@ -833,6 +844,8 @@ declare const app: Elysia<"", false, {
|
|
833
844
|
decimals: number;
|
834
845
|
verified: boolean;
|
835
846
|
isTest: boolean;
|
847
|
+
isPoint: boolean;
|
848
|
+
isPreTGE: boolean;
|
836
849
|
}[];
|
837
850
|
tags: string[];
|
838
851
|
identifier: string;
|
@@ -896,6 +909,8 @@ declare const app: Elysia<"", false, {
|
|
896
909
|
decimals: number;
|
897
910
|
verified: boolean;
|
898
911
|
isTest: boolean;
|
912
|
+
isPoint: boolean;
|
913
|
+
isPreTGE: boolean;
|
899
914
|
};
|
900
915
|
}[];
|
901
916
|
}[];
|
@@ -978,6 +993,8 @@ declare const app: Elysia<"", false, {
|
|
978
993
|
decimals: number;
|
979
994
|
verified: boolean;
|
980
995
|
isTest: boolean;
|
996
|
+
isPoint: boolean;
|
997
|
+
isPreTGE: boolean;
|
981
998
|
};
|
982
999
|
value: number;
|
983
1000
|
campaignId: string;
|
@@ -1000,6 +1017,8 @@ declare const app: Elysia<"", false, {
|
|
1000
1017
|
decimals: number;
|
1001
1018
|
verified: boolean;
|
1002
1019
|
isTest: boolean;
|
1020
|
+
isPoint: boolean;
|
1021
|
+
isPreTGE: boolean;
|
1003
1022
|
}[];
|
1004
1023
|
tags: string[];
|
1005
1024
|
identifier: string;
|
@@ -1063,6 +1082,8 @@ declare const app: Elysia<"", false, {
|
|
1063
1082
|
decimals: number;
|
1064
1083
|
verified: boolean;
|
1065
1084
|
isTest: boolean;
|
1085
|
+
isPoint: boolean;
|
1086
|
+
isPreTGE: boolean;
|
1066
1087
|
};
|
1067
1088
|
}[];
|
1068
1089
|
};
|
@@ -1274,6 +1295,7 @@ declare const app: Elysia<"", false, {
|
|
1274
1295
|
verified: boolean;
|
1275
1296
|
isTest: boolean;
|
1276
1297
|
isPoint: boolean;
|
1298
|
+
isPreTGE: boolean;
|
1277
1299
|
isNative: boolean;
|
1278
1300
|
} & {
|
1279
1301
|
price?: number | null | undefined;
|
@@ -1444,6 +1466,7 @@ declare const app: Elysia<"", false, {
|
|
1444
1466
|
verified: boolean;
|
1445
1467
|
isTest: boolean;
|
1446
1468
|
isPoint: boolean;
|
1469
|
+
isPreTGE: boolean;
|
1447
1470
|
isNative: boolean;
|
1448
1471
|
} & {
|
1449
1472
|
price?: number | null | undefined;
|
@@ -1530,6 +1553,7 @@ declare const app: Elysia<"", false, {
|
|
1530
1553
|
verified: boolean;
|
1531
1554
|
isTest: boolean;
|
1532
1555
|
isPoint: boolean;
|
1556
|
+
isPreTGE: boolean;
|
1533
1557
|
isNative: boolean;
|
1534
1558
|
} & {
|
1535
1559
|
price?: number | null | undefined;
|
@@ -1717,6 +1741,7 @@ declare const app: Elysia<"", false, {
|
|
1717
1741
|
verified: boolean;
|
1718
1742
|
isTest: boolean;
|
1719
1743
|
isPoint: boolean;
|
1744
|
+
isPreTGE: boolean;
|
1720
1745
|
isNative: boolean;
|
1721
1746
|
} & {
|
1722
1747
|
price?: number | null | undefined;
|
@@ -2113,6 +2138,7 @@ declare const app: Elysia<"", false, {
|
|
2113
2138
|
verified: boolean;
|
2114
2139
|
isTest: boolean;
|
2115
2140
|
isPoint: boolean;
|
2141
|
+
isPreTGE: boolean;
|
2116
2142
|
isNative: boolean;
|
2117
2143
|
} & {
|
2118
2144
|
price?: number | null | undefined;
|
@@ -2133,8 +2159,8 @@ declare const app: Elysia<"", false, {
|
|
2133
2159
|
body: unknown;
|
2134
2160
|
params: {};
|
2135
2161
|
query: {
|
2162
|
+
distributionChain?: number | undefined;
|
2136
2163
|
campaignId: string;
|
2137
|
-
distributionChain: number;
|
2138
2164
|
};
|
2139
2165
|
headers: {
|
2140
2166
|
authorization: string;
|
@@ -2176,6 +2202,7 @@ declare const app: Elysia<"", false, {
|
|
2176
2202
|
verified: boolean;
|
2177
2203
|
isTest: boolean;
|
2178
2204
|
isPoint: boolean;
|
2205
|
+
isPreTGE: boolean;
|
2179
2206
|
isNative: boolean;
|
2180
2207
|
} & {
|
2181
2208
|
price?: number | null | undefined;
|
@@ -2447,6 +2474,7 @@ declare const app: Elysia<"", false, {
|
|
2447
2474
|
verified: boolean;
|
2448
2475
|
isTest: boolean;
|
2449
2476
|
isPoint: boolean;
|
2477
|
+
isPreTGE: boolean;
|
2450
2478
|
isNative: boolean;
|
2451
2479
|
price?: number | null | undefined;
|
2452
2480
|
} | undefined;
|
@@ -2480,6 +2508,7 @@ declare const app: Elysia<"", false, {
|
|
2480
2508
|
verified: boolean;
|
2481
2509
|
isTest: boolean;
|
2482
2510
|
isPoint: boolean;
|
2511
|
+
isPreTGE: boolean;
|
2483
2512
|
isNative: boolean;
|
2484
2513
|
price?: number | null | undefined;
|
2485
2514
|
} | undefined;
|
@@ -2513,6 +2542,7 @@ declare const app: Elysia<"", false, {
|
|
2513
2542
|
verified: boolean;
|
2514
2543
|
isTest: boolean;
|
2515
2544
|
isPoint: boolean;
|
2545
|
+
isPreTGE: boolean;
|
2516
2546
|
isNative: boolean;
|
2517
2547
|
price: number | null;
|
2518
2548
|
}[];
|
@@ -2545,6 +2575,7 @@ declare const app: Elysia<"", false, {
|
|
2545
2575
|
verified: boolean;
|
2546
2576
|
isTest: boolean;
|
2547
2577
|
isPoint: boolean;
|
2578
|
+
isPreTGE: boolean;
|
2548
2579
|
isNative: boolean;
|
2549
2580
|
} & {
|
2550
2581
|
price?: number | null | undefined;
|
@@ -2588,6 +2619,7 @@ declare const app: Elysia<"", false, {
|
|
2588
2619
|
verified: boolean;
|
2589
2620
|
isTest: boolean;
|
2590
2621
|
isPoint: boolean;
|
2622
|
+
isPreTGE: boolean;
|
2591
2623
|
isNative: boolean;
|
2592
2624
|
} & {
|
2593
2625
|
price?: number | null | undefined;
|
@@ -2650,6 +2682,7 @@ declare const app: Elysia<"", false, {
|
|
2650
2682
|
verified: boolean;
|
2651
2683
|
isTest: boolean;
|
2652
2684
|
isPoint: boolean;
|
2685
|
+
isPreTGE: boolean;
|
2653
2686
|
isNative: boolean;
|
2654
2687
|
price: number | null;
|
2655
2688
|
};
|
@@ -2666,6 +2699,7 @@ declare const app: Elysia<"", false, {
|
|
2666
2699
|
verified?: boolean | undefined;
|
2667
2700
|
isTest?: boolean | undefined;
|
2668
2701
|
isPoint?: boolean | undefined;
|
2702
|
+
isPreTGE?: boolean | undefined;
|
2669
2703
|
};
|
2670
2704
|
params: {
|
2671
2705
|
id: string;
|
@@ -2687,6 +2721,7 @@ declare const app: Elysia<"", false, {
|
|
2687
2721
|
verified: boolean;
|
2688
2722
|
isTest: boolean;
|
2689
2723
|
isPoint: boolean;
|
2724
|
+
isPreTGE: boolean;
|
2690
2725
|
isNative: boolean;
|
2691
2726
|
price: number | null;
|
2692
2727
|
};
|
@@ -2750,6 +2785,7 @@ declare const app: Elysia<"", false, {
|
|
2750
2785
|
verified: boolean;
|
2751
2786
|
isTest: boolean;
|
2752
2787
|
isPoint: boolean;
|
2788
|
+
isPreTGE: boolean;
|
2753
2789
|
isNative: boolean;
|
2754
2790
|
price: number | null;
|
2755
2791
|
};
|
@@ -3686,6 +3722,7 @@ declare const app: Elysia<"", false, {
|
|
3686
3722
|
verified: boolean;
|
3687
3723
|
isTest: boolean;
|
3688
3724
|
isPoint: boolean;
|
3725
|
+
isPreTGE: boolean;
|
3689
3726
|
isNative: boolean;
|
3690
3727
|
price: number | null;
|
3691
3728
|
};
|
@@ -3709,6 +3746,7 @@ declare const app: Elysia<"", false, {
|
|
3709
3746
|
verified: boolean;
|
3710
3747
|
isTest: boolean;
|
3711
3748
|
isPoint: boolean;
|
3749
|
+
isPreTGE: boolean;
|
3712
3750
|
isNative: boolean;
|
3713
3751
|
price: number | null;
|
3714
3752
|
}[];
|
@@ -3807,6 +3845,7 @@ declare const app: Elysia<"", false, {
|
|
3807
3845
|
verified: boolean;
|
3808
3846
|
isTest: boolean;
|
3809
3847
|
isPoint: boolean;
|
3848
|
+
isPreTGE: boolean;
|
3810
3849
|
isNative: boolean;
|
3811
3850
|
price: number | null;
|
3812
3851
|
};
|
@@ -3830,6 +3869,7 @@ declare const app: Elysia<"", false, {
|
|
3830
3869
|
verified: boolean;
|
3831
3870
|
isTest: boolean;
|
3832
3871
|
isPoint: boolean;
|
3872
|
+
isPreTGE: boolean;
|
3833
3873
|
isNative: boolean;
|
3834
3874
|
price: number | null;
|
3835
3875
|
}[];
|