@merkl/api 0.17.34 → 0.17.36
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/index.js +1 -1
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.d.ts +0 -2
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.js +2 -54
- package/dist/src/eden/index.d.ts +5 -5
- package/dist/src/factories/metadataFactory/factory.d.ts +3 -0
- package/dist/src/factories/metadataFactory/factory.js +56 -0
- package/dist/src/factories/metadataFactory/implementations/Ajna.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Ajna.js +52 -0
- package/dist/src/factories/metadataFactory/implementations/Ambiant.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Ambiant.js +31 -0
- package/dist/src/factories/metadataFactory/implementations/Badger.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Badger.js +25 -0
- package/dist/src/factories/metadataFactory/implementations/Clamm.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Clamm.js +50 -0
- package/dist/src/factories/metadataFactory/implementations/Compound.d.ts +16 -0
- package/dist/src/factories/metadataFactory/implementations/Compound.js +20 -0
- package/dist/src/factories/metadataFactory/implementations/Default.d.ts +13 -0
- package/dist/src/factories/metadataFactory/implementations/Default.js +11 -0
- package/dist/src/factories/metadataFactory/implementations/Dolomite.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Dolomite.js +17 -0
- package/dist/src/factories/metadataFactory/implementations/EigenLayer.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/EigenLayer.js +11 -0
- package/dist/src/factories/metadataFactory/implementations/Encompassing.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Encompassing.js +37 -0
- package/dist/src/factories/metadataFactory/implementations/Erc20.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Erc20.js +71 -0
- package/dist/src/factories/metadataFactory/implementations/Erc20Snapshot.d.ts +14 -0
- package/dist/src/factories/metadataFactory/implementations/Erc20Snapshot.js +10 -0
- package/dist/src/factories/metadataFactory/implementations/Euler.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Euler.js +34 -0
- package/dist/src/factories/metadataFactory/implementations/EventBased.d.ts +20 -0
- package/dist/src/factories/metadataFactory/implementations/EventBased.js +45 -0
- package/dist/src/factories/metadataFactory/implementations/Hyperdrive.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Hyperdrive.js +21 -0
- package/dist/src/factories/metadataFactory/implementations/Invalid.d.ts +11 -0
- package/dist/src/factories/metadataFactory/implementations/Invalid.js +10 -0
- package/dist/src/factories/metadataFactory/implementations/Ion.d.ts +16 -0
- package/dist/src/factories/metadataFactory/implementations/Ion.js +15 -0
- package/dist/src/factories/metadataFactory/implementations/JsonAirdrop.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/JsonAirdrop.js +38 -0
- package/dist/src/factories/metadataFactory/implementations/Morpho.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Morpho.js +21 -0
- package/dist/src/factories/metadataFactory/implementations/Radiant.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Radiant.js +11 -0
- package/dist/src/factories/metadataFactory/implementations/Silo.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Silo.js +15 -0
- package/dist/src/factories/metadataFactory/implementations/UniswapV4Metadata.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/UniswapV4Metadata.js +28 -0
- package/dist/src/factories/metadataFactory/implementations/Vest.d.ts +15 -0
- package/dist/src/factories/metadataFactory/implementations/Vest.js +12 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +12 -12
- package/dist/src/modules/v4/dungeonKeeper/dungeonKeeper.controller.d.ts +2 -1
- package/dist/src/modules/v4/explorer/explorer.controller.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +0 -11
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +4 -4
- package/dist/src/modules/v4/opportunity/opportunity.service.js +10 -86
- package/dist/src/modules/v4/router.d.ts +1 -1
- package/dist/src/routes/v3/opportunity.js +2 -30
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/entities/opportunity.d.ts +0 -22
- package/dist/src/entities/opportunity.js +0 -1073
- package/dist/src/modules/v4/dungeonKeeper/index.d.ts +0 -2
- package/dist/src/modules/v4/dungeonKeeper/index.js +0 -2
- package/dist/src/modules/v4/explorer/index.d.ts +0 -1
- package/dist/src/modules/v4/explorer/index.js +0 -1
- package/dist/src/modules/v4/opportunity/subservices/getAjnaMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getAjnaMetadata.service.js +0 -50
- package/dist/src/modules/v4/opportunity/subservices/getAmbientMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getAmbientMetadata.service.js +0 -29
- package/dist/src/modules/v4/opportunity/subservices/getBadgerMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getBadgerMetadata.service.js +0 -23
- package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.js +0 -48
- package/dist/src/modules/v4/opportunity/subservices/getCompoundMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getCompoundMetadata.service.js +0 -18
- package/dist/src/modules/v4/opportunity/subservices/getDolomiteMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getDolomiteMetadata.service.js +0 -15
- package/dist/src/modules/v4/opportunity/subservices/getEigenLayerMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getEigenLayerMetadata.service.js +0 -9
- package/dist/src/modules/v4/opportunity/subservices/getEncompassingMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getEncompassingMetadata.service.js +0 -35
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.d.ts +0 -5
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +0 -69
- package/dist/src/modules/v4/opportunity/subservices/getErc20SnapshotMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getErc20SnapshotMetadata.service.js +0 -8
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.js +0 -34
- package/dist/src/modules/v4/opportunity/subservices/getEventBasedMetadata.service.ts.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getEventBasedMetadata.service.ts.js +0 -43
- package/dist/src/modules/v4/opportunity/subservices/getHyperdriveMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getHyperdriveMetadata.service.js +0 -19
- package/dist/src/modules/v4/opportunity/subservices/getIonMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getIonMetadata.service.js +0 -13
- package/dist/src/modules/v4/opportunity/subservices/getJsonAirDropMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getJsonAirDropMetadata.service.js +0 -36
- package/dist/src/modules/v4/opportunity/subservices/getMorphoMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getMorphoMetadata.service.js +0 -19
- package/dist/src/modules/v4/opportunity/subservices/getRadiantMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getRadiantMetadata.service.js +0 -9
- package/dist/src/modules/v4/opportunity/subservices/getSiloMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getSiloMetadata.service.js +0 -13
- package/dist/src/modules/v4/opportunity/subservices/getUniswapV4Metadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getUniswapV4Metadata.service.js +0 -26
- package/dist/src/modules/v4/opportunity/subservices/getVestMetadata.service.d.ts +0 -3
- package/dist/src/modules/v4/opportunity/subservices/getVestMetadata.service.js +0 -10
@@ -0,0 +1,71 @@
|
|
1
|
+
import { log } from "../../../utils/logger";
|
2
|
+
import { Campaign as CampaignEnum } from "@sdk";
|
3
|
+
import { CampaignService } from "../../../modules/v4/campaign";
|
4
|
+
import { ProtocolService } from "../../../modules/v4/protocol";
|
5
|
+
export class Erc20Metadata {
|
6
|
+
async getMetadata(computeChainId, params, _subType, rewardTokenAddress, distributionChainId, campaignId) {
|
7
|
+
let action = "HOLD";
|
8
|
+
let name = `Hold ${params.symbolTargetToken}`;
|
9
|
+
let mainProtocolId = undefined;
|
10
|
+
const tokens = [{ chainId: computeChainId, address: params.targetToken }];
|
11
|
+
try {
|
12
|
+
const [dynamicData] = (await CampaignService.fetchDynamicData(computeChainId, CampaignEnum[CampaignEnum.ERC20], [
|
13
|
+
{
|
14
|
+
campaignId,
|
15
|
+
rewardToken: rewardTokenAddress,
|
16
|
+
amount: "1",
|
17
|
+
chainId: distributionChainId,
|
18
|
+
computeChainId,
|
19
|
+
campaignParameters: params,
|
20
|
+
},
|
21
|
+
]));
|
22
|
+
action = dynamicData?.typeInfo?.action ?? action;
|
23
|
+
name = dynamicData?.typeInfo?.cardName;
|
24
|
+
mainProtocolId = dynamicData?.typeInfo?.protocol?.toLowerCase().replace(" ", "");
|
25
|
+
const protocol = (await ProtocolService.findMany({ id: mainProtocolId }))?.[0];
|
26
|
+
if (!!protocol) {
|
27
|
+
mainProtocolId = protocol?.id;
|
28
|
+
}
|
29
|
+
// Case of lending protocols and receipt tokens
|
30
|
+
if (!!dynamicData && !!dynamicData.typeInfo?.underlying) {
|
31
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.underlying });
|
32
|
+
}
|
33
|
+
// Case of perps protocols
|
34
|
+
if (!!dynamicData && !!dynamicData.typeInfo?.shortToken && !!dynamicData.typeInfo?.longToken) {
|
35
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.shortToken });
|
36
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.longToken });
|
37
|
+
}
|
38
|
+
// Case of weird AMMs
|
39
|
+
if (!!dynamicData && !!dynamicData.typeInfo?.tokenA && !!dynamicData.typeInfo?.tokenB) {
|
40
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.tokenA });
|
41
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.tokenB });
|
42
|
+
}
|
43
|
+
// Case of AMMs
|
44
|
+
if (!!dynamicData && !!dynamicData.typeInfo?.token0 && !!dynamicData.typeInfo?.token1) {
|
45
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token0 });
|
46
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token1 });
|
47
|
+
}
|
48
|
+
// Case of tripools
|
49
|
+
if (!!dynamicData &&
|
50
|
+
!!dynamicData.typeInfo?.token0Address &&
|
51
|
+
!!dynamicData.typeInfo?.token1Address &&
|
52
|
+
!!dynamicData.typeInfo?.token2Address) {
|
53
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token0Address });
|
54
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token1Address });
|
55
|
+
tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token2Address });
|
56
|
+
}
|
57
|
+
}
|
58
|
+
catch {
|
59
|
+
log.warn(`failed to fetch dynamic data for ERC20 campaign ${campaignId}`);
|
60
|
+
}
|
61
|
+
if (mainProtocolId === "unknown") {
|
62
|
+
mainProtocolId = undefined;
|
63
|
+
}
|
64
|
+
return {
|
65
|
+
action,
|
66
|
+
name,
|
67
|
+
tokens,
|
68
|
+
mainProtocol: mainProtocolId,
|
69
|
+
};
|
70
|
+
}
|
71
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { Campaign as CampaignEnum, CampaignParameters, ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.ERC20_SNAPSHOT;
|
4
|
+
export declare class Erc20SnapshotMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): Promise<{
|
6
|
+
name: string;
|
7
|
+
action: "DROP";
|
8
|
+
tokens: {
|
9
|
+
chainId: ChainId;
|
10
|
+
address: any;
|
11
|
+
}[];
|
12
|
+
}>;
|
13
|
+
}
|
14
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
2
|
+
export class Erc20SnapshotMetadata {
|
3
|
+
async getMetadata(computeChainId, params) {
|
4
|
+
return {
|
5
|
+
name: ["Get", params.symbolTargetToken, "airdrop"].join(" "),
|
6
|
+
action: OpportunityAction.DROP,
|
7
|
+
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
8
|
+
};
|
9
|
+
}
|
10
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { Campaign as CampaignEnum, type CampaignParameters, type ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.EULER;
|
4
|
+
export declare class EulerMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], subType: CampaignParameters<campaignType>["campaignSubType"], rewardTokenAddress: string, _distributionChainId: ChainId, campaignId: string): Promise<{
|
6
|
+
name: string;
|
7
|
+
tokens: {
|
8
|
+
chainId: ChainId;
|
9
|
+
address: any;
|
10
|
+
}[];
|
11
|
+
action: "LEND" | "BORROW";
|
12
|
+
mainProtocol: string;
|
13
|
+
}>;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { log } from "../../../utils/logger";
|
2
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
3
|
+
import { Campaign as CampaignEnum } from "@sdk";
|
4
|
+
import { CampaignService } from "../../../modules/v4/campaign";
|
5
|
+
export class EulerMetadata {
|
6
|
+
async getMetadata(computeChainId, params, subType, rewardTokenAddress, _distributionChainId, campaignId) {
|
7
|
+
let name = `Hold ${params.symbolTargetToken}`;
|
8
|
+
try {
|
9
|
+
const [dynamicData] = (await CampaignService.fetchDynamicData(computeChainId, CampaignEnum[CampaignEnum.EULER], [
|
10
|
+
{
|
11
|
+
campaignSubType: subType,
|
12
|
+
campaignParameters: params,
|
13
|
+
computeChainId,
|
14
|
+
campaignId,
|
15
|
+
rewardToken: rewardTokenAddress,
|
16
|
+
amount: "1",
|
17
|
+
},
|
18
|
+
]));
|
19
|
+
name = dynamicData?.typeInfo?.cardName;
|
20
|
+
}
|
21
|
+
catch {
|
22
|
+
log.warn(`failed to fetch dynamic data for ERC20 campaign ${campaignId}`);
|
23
|
+
}
|
24
|
+
return {
|
25
|
+
name,
|
26
|
+
tokens: [
|
27
|
+
{ chainId: computeChainId, address: params.targetToken },
|
28
|
+
{ chainId: computeChainId, address: params.addressAsset },
|
29
|
+
],
|
30
|
+
action: [OpportunityAction.LEND, OpportunityAction.BORROW, OpportunityAction.BORROW][subType],
|
31
|
+
mainProtocol: "euler",
|
32
|
+
};
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { MetadataBuilder } from "../interface";
|
2
|
+
import type { Campaign as CampaignEnum, CampaignParameters, ChainId } from "@sdk";
|
3
|
+
type campaignType = CampaignEnum.EVENT_BASED;
|
4
|
+
export declare class EventBasedMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], _subType: CampaignParameters<campaignType>["campaignSubType"]): Promise<{
|
6
|
+
action: "INVALID";
|
7
|
+
name: string;
|
8
|
+
tokens: {
|
9
|
+
chainId: ChainId;
|
10
|
+
address: any;
|
11
|
+
}[];
|
12
|
+
mainProtocol: string;
|
13
|
+
} | {
|
14
|
+
action: string;
|
15
|
+
name: string;
|
16
|
+
tokens: never[];
|
17
|
+
mainProtocol: undefined;
|
18
|
+
}>;
|
19
|
+
}
|
20
|
+
export {};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
export class EventBasedMetadata {
|
2
|
+
async getMetadata(computeChainId, params, _subType) {
|
3
|
+
try {
|
4
|
+
const action = "INVALID";
|
5
|
+
const mainProtocolId = "Hanji";
|
6
|
+
let name = `${params.eventID.split("(")[0]} on ${mainProtocolId}`;
|
7
|
+
let tokens = [{ chainId: computeChainId, address: params.contract }];
|
8
|
+
if (params.contract === "0xd0bc067cf877f7b76ceb331891331d9e6acda1a7") {
|
9
|
+
name = `Trade USDC/XTZ on ${mainProtocolId}`;
|
10
|
+
tokens = [
|
11
|
+
{ chainId: computeChainId, address: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9" },
|
12
|
+
{ chainId: computeChainId, address: "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb" },
|
13
|
+
];
|
14
|
+
}
|
15
|
+
if (params.contract === "0x65ea4dd7f789c71c0f57ed84b3bdc3062898d3cb") {
|
16
|
+
name = `Trade USDC/ETH on ${mainProtocolId}`;
|
17
|
+
tokens = [
|
18
|
+
{ chainId: computeChainId, address: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9" },
|
19
|
+
{ chainId: computeChainId, address: "0xfc24f770F94edBca6D6f885E12d4317320BcB401" },
|
20
|
+
];
|
21
|
+
}
|
22
|
+
if (params.contract === "0xbb6b01d94e3f6ebae8647cb56d544f57928ab758") {
|
23
|
+
name = `Trade USDC/BTC on ${mainProtocolId}`;
|
24
|
+
tokens = [
|
25
|
+
{ chainId: computeChainId, address: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9" },
|
26
|
+
{ chainId: computeChainId, address: "0xbFc94CD2B1E55999Cfc7347a9313e88702B83d0F" },
|
27
|
+
];
|
28
|
+
}
|
29
|
+
return {
|
30
|
+
action,
|
31
|
+
name,
|
32
|
+
tokens,
|
33
|
+
mainProtocol: mainProtocolId,
|
34
|
+
};
|
35
|
+
}
|
36
|
+
catch (error) {
|
37
|
+
return {
|
38
|
+
action: "INVALID",
|
39
|
+
name: "Event Based Campaign",
|
40
|
+
tokens: [],
|
41
|
+
mainProtocol: undefined,
|
42
|
+
};
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { type Campaign as CampaignEnum, type CampaignParameters, type ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.HYPERDRIVELOGPROCESSOR | CampaignEnum.HYPERDRIVELOGFIXPROCESSOR;
|
4
|
+
export declare class HyperdriveMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], subType: CampaignParameters<campaignType>["campaignSubType"]): Promise<{
|
6
|
+
action: "POOL" | "LONG" | "SHORT";
|
7
|
+
name: string;
|
8
|
+
tokens: {
|
9
|
+
chainId: ChainId;
|
10
|
+
address: any;
|
11
|
+
}[];
|
12
|
+
mainProtocol: string;
|
13
|
+
}>;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
2
|
+
import { HyperDriveSubCampaignType } from "@sdk";
|
3
|
+
export class HyperdriveMetadata {
|
4
|
+
async getMetadata(computeChainId, params, subType) {
|
5
|
+
const subtypes = [
|
6
|
+
{ name: "Add Liquidity on", action: OpportunityAction.POOL },
|
7
|
+
{ name: "Open Long on", action: OpportunityAction.LONG },
|
8
|
+
{ name: "Open Short on", action: OpportunityAction.SHORT },
|
9
|
+
];
|
10
|
+
if (subType === HyperDriveSubCampaignType.LP) {
|
11
|
+
subType = 0;
|
12
|
+
}
|
13
|
+
const subtypeData = subtypes[subType];
|
14
|
+
return {
|
15
|
+
action: subtypeData.action,
|
16
|
+
name: [subtypeData.name, params.symbolTargetToken].join(" "),
|
17
|
+
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
18
|
+
mainProtocol: "hyperdrive",
|
19
|
+
};
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Campaign as CampaignEnum } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.INVALID;
|
4
|
+
export declare class InvalidMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(): Promise<{
|
6
|
+
name: string;
|
7
|
+
action: "INVALID";
|
8
|
+
tokens: never[];
|
9
|
+
}>;
|
10
|
+
}
|
11
|
+
export {};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { Campaign as CampaignEnum } from "@sdk";
|
2
|
+
import type { CampaignParameters, ChainId } from "@sdk";
|
3
|
+
import type { MetadataBuilder } from "../interface";
|
4
|
+
type campaignType = CampaignEnum.ION;
|
5
|
+
export declare class IonMetadata implements MetadataBuilder<campaignType> {
|
6
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): Promise<{
|
7
|
+
action: "LEND";
|
8
|
+
name: string;
|
9
|
+
tokens: {
|
10
|
+
chainId: ChainId;
|
11
|
+
address: any;
|
12
|
+
}[];
|
13
|
+
mainProtocol: string;
|
14
|
+
}>;
|
15
|
+
}
|
16
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
2
|
+
export class IonMetadata {
|
3
|
+
async getMetadata(computeChainId, params) {
|
4
|
+
// TODO this is not finalized at all
|
5
|
+
return {
|
6
|
+
action: OpportunityAction.LEND,
|
7
|
+
name: ["Ion", "strategy for", params.symbolBorrowToken].join(" "),
|
8
|
+
tokens: [
|
9
|
+
{ chainId: computeChainId, address: params.borrowToken },
|
10
|
+
{ chainId: computeChainId, address: params.collateralToken },
|
11
|
+
],
|
12
|
+
mainProtocol: "ion",
|
13
|
+
};
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { Campaign as CampaignEnum, CampaignParameters, ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.JSON_AIRDROP;
|
4
|
+
export declare class JsonAirdropMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], _subType: CampaignParameters<campaignType>["campaignSubType"], _rewardTokenAddress: string, _distributionChainId: ChainId, _campaignId: string, creator: string): Promise<{
|
6
|
+
action: "DROP";
|
7
|
+
name: string;
|
8
|
+
tokens: {
|
9
|
+
chainId: ChainId;
|
10
|
+
address: string;
|
11
|
+
}[];
|
12
|
+
mainProtocol: string | undefined;
|
13
|
+
}>;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { log } from "../../../utils/logger";
|
2
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
3
|
+
export class JsonAirdropMetadata {
|
4
|
+
async getMetadata(computeChainId, params, _subType, _rewardTokenAddress, _distributionChainId, _campaignId, creator) {
|
5
|
+
const ACI = "0xdeadD8aB03075b7FBA81864202a2f59EE25B312b".toLowerCase();
|
6
|
+
const aaveDAO = "0x5300A1a15135EA4dc7aD5a167152C01EFc9b192A".toLowerCase();
|
7
|
+
const aciPrefix = creator.toLowerCase() === ACI && "Get Merit rewards -";
|
8
|
+
const aavePrefix = creator.toLowerCase() === aaveDAO && "Get aAMPL distribution -";
|
9
|
+
const prefix = aavePrefix ? aavePrefix : aciPrefix ? aciPrefix : "Get airdrop in";
|
10
|
+
let tokenAddress;
|
11
|
+
try {
|
12
|
+
const res = await fetch(params.jsonUrl);
|
13
|
+
if (!res.ok)
|
14
|
+
throw new Error(`Response status: ${res.status}`);
|
15
|
+
tokenAddress = (await res.json()).rewardToken;
|
16
|
+
return {
|
17
|
+
action: OpportunityAction.DROP,
|
18
|
+
name: `${prefix} ${params.symbolRewardToken}`,
|
19
|
+
tokens: [
|
20
|
+
{
|
21
|
+
chainId: computeChainId,
|
22
|
+
address: tokenAddress, // TODO: Make sure targetToken is set
|
23
|
+
},
|
24
|
+
],
|
25
|
+
mainProtocol: aavePrefix || aciPrefix ? "aave" : undefined,
|
26
|
+
};
|
27
|
+
}
|
28
|
+
catch (err) {
|
29
|
+
log.error("failed to fetch token address on IPFS", err);
|
30
|
+
return {
|
31
|
+
action: OpportunityAction.DROP,
|
32
|
+
name: `${prefix} ${params.symbolRewardToken}`,
|
33
|
+
tokens: [],
|
34
|
+
mainProtocol: aavePrefix || aciPrefix ? "aave" : undefined,
|
35
|
+
};
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { type Campaign as CampaignEnum, type CampaignParameters, type ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.MORPHO;
|
4
|
+
export declare class MorphoMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], subType: CampaignParameters<campaignType>["campaignSubType"]): Promise<{
|
6
|
+
action: "LEND" | "BORROW";
|
7
|
+
tokens: {
|
8
|
+
chainId: ChainId;
|
9
|
+
address: any;
|
10
|
+
}[];
|
11
|
+
name: `Supply ${string} on ${string}` | `Borrow ${string} on ${string}` | `Deposit in ${string} - Metamorpho` | `Lend ${string} on ${string}`;
|
12
|
+
mainProtocol: string;
|
13
|
+
}>;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
2
|
+
import { BN2Number } from "@sdk";
|
3
|
+
export class MorphoMetadata {
|
4
|
+
async getMetadata(computeChainId, params, subType) {
|
5
|
+
const morphoParams = params;
|
6
|
+
const market = `${morphoParams.symbolLoanToken}/${morphoParams.symbolBorrowToken} ${morphoParams?.LLTV && BN2Number(morphoParams?.LLTV, 16)}%`;
|
7
|
+
const subtypes = [
|
8
|
+
{ name: `Deposit in ${morphoParams.nameTargetToken} - Metamorpho`, action: OpportunityAction.LEND },
|
9
|
+
{ name: `Supply ${morphoParams.symbolLoanToken} on ${market}`, action: OpportunityAction.LEND },
|
10
|
+
{ name: `Borrow ${morphoParams.symbolLoanToken} on ${market}`, action: OpportunityAction.BORROW },
|
11
|
+
{ name: `Lend ${morphoParams.symbolBorrowToken} on ${market}`, action: OpportunityAction.LEND },
|
12
|
+
];
|
13
|
+
const subtype = subtypes[subType];
|
14
|
+
return {
|
15
|
+
action: subtype.action,
|
16
|
+
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
17
|
+
name: subtype.name,
|
18
|
+
mainProtocol: "morpho",
|
19
|
+
};
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { Campaign as CampaignEnum, CampaignParameters, ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.RADIANT;
|
4
|
+
export declare class RadiantMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], subType: CampaignParameters<campaignType>["campaignSubType"]): Promise<{
|
6
|
+
action: "LEND" | "BORROW";
|
7
|
+
name: string;
|
8
|
+
tokens: {
|
9
|
+
chainId: ChainId;
|
10
|
+
address: any;
|
11
|
+
}[];
|
12
|
+
mainProtocol: string;
|
13
|
+
}>;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
2
|
+
export class RadiantMetadata {
|
3
|
+
async getMetadata(computeChainId, params, subType) {
|
4
|
+
return {
|
5
|
+
action: subType <= 1 ? OpportunityAction.LEND : OpportunityAction.BORROW,
|
6
|
+
name: [subType <= 1 ? "Lend" : "Borrow", params.symbolTargetToken].join(" "),
|
7
|
+
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
8
|
+
mainProtocol: "radiant",
|
9
|
+
};
|
10
|
+
}
|
11
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { Campaign as CampaignEnum, CampaignParameters, ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.SILO;
|
4
|
+
export declare class SiloMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], subType: CampaignParameters<campaignType>["campaignSubType"]): Promise<{
|
6
|
+
action: "LEND" | "BORROW";
|
7
|
+
name: string;
|
8
|
+
tokens: {
|
9
|
+
chainId: ChainId;
|
10
|
+
address: any;
|
11
|
+
}[];
|
12
|
+
mainProtocol: string;
|
13
|
+
}>;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
2
|
+
export class SiloMetadata {
|
3
|
+
async getMetadata(computeChainId, params, subType) {
|
4
|
+
let suffix = ["Deposit", "Protected Deposit", "Debt"][subType];
|
5
|
+
const assetSymbol = params.symbolTargetToken;
|
6
|
+
if (params.forwarders.length === 1 && assetSymbol)
|
7
|
+
suffix += ` (${assetSymbol} Market)`;
|
8
|
+
return {
|
9
|
+
action: subType <= 1 ? OpportunityAction.LEND : OpportunityAction.BORROW,
|
10
|
+
name: [subType <= 1 ? "Lend" : "Borrow", params.symbolTargetToken, suffix].join(" "),
|
11
|
+
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
12
|
+
mainProtocol: "silo",
|
13
|
+
};
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { Campaign as CampaignEnum, CampaignParameters, ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.UNISWAP_V4;
|
4
|
+
export declare class UniswapV4Metadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], _subType: CampaignParameters<campaignType>["campaignSubType"]): Promise<{
|
6
|
+
name: string;
|
7
|
+
action: "POOL";
|
8
|
+
tokens: {
|
9
|
+
chainId: ChainId;
|
10
|
+
address: any;
|
11
|
+
}[];
|
12
|
+
mainProtocol: string;
|
13
|
+
}>;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
2
|
+
export class UniswapV4Metadata {
|
3
|
+
async getMetadata(computeChainId, params, _subType) {
|
4
|
+
const whitelistNameString = "";
|
5
|
+
// if (params.whitelist.length > 0) {
|
6
|
+
// for (const whitelist of params.whitelist) {
|
7
|
+
// if (whitelistNameString.length > 0) {
|
8
|
+
// whitelistNameString += "or";
|
9
|
+
// }
|
10
|
+
// const forwarder = params.forwarders.find(x => getAddress(x.sender) === getAddress(whitelist));
|
11
|
+
// const forwarderType = (forwarder as CLAMMForwarder)?.type;
|
12
|
+
// const forwarderName = !!forwarderType ? almName(forwarderType) : null;
|
13
|
+
// if (!!forwarderName) {
|
14
|
+
// whitelistNameString += ` ${forwarderName} `;
|
15
|
+
// }
|
16
|
+
// }
|
17
|
+
// }
|
18
|
+
return {
|
19
|
+
name: `Provide liquidity to ${whitelistNameString} UniswapV4 ${params.symbolCurrency0}-${params.symbolCurrency1}${params.lpFee ? ` ${params.lpFee}%` : ""}`,
|
20
|
+
action: OpportunityAction.POOL,
|
21
|
+
tokens: [
|
22
|
+
{ chainId: computeChainId, address: params.currency0 },
|
23
|
+
{ chainId: computeChainId, address: params.currency1 },
|
24
|
+
],
|
25
|
+
mainProtocol: "uniswapv4",
|
26
|
+
};
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { Campaign as CampaignEnum, CampaignParameters, ChainId } from "@sdk";
|
2
|
+
import type { MetadataBuilder } from "../interface";
|
3
|
+
type campaignType = CampaignEnum.VEST;
|
4
|
+
export declare class VestMetadata implements MetadataBuilder<campaignType> {
|
5
|
+
getMetadata(computeChainId: ChainId, _params: CampaignParameters<campaignType>["campaignParameters"], _subType: CampaignParameters<campaignType>["campaignSubType"]): Promise<{
|
6
|
+
action: "LEND";
|
7
|
+
name: string;
|
8
|
+
tokens: {
|
9
|
+
chainId: ChainId;
|
10
|
+
address: string;
|
11
|
+
}[];
|
12
|
+
mainProtocol: string;
|
13
|
+
}>;
|
14
|
+
}
|
15
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { VEST_TOKEN } from "../../../libs/campaigns/campaignTypes/VestDynamicData";
|
2
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
3
|
+
export class VestMetadata {
|
4
|
+
async getMetadata(computeChainId, _params, _subType) {
|
5
|
+
return {
|
6
|
+
action: OpportunityAction.LEND,
|
7
|
+
name: ["Vest", "supply", "treasury"].join(" "),
|
8
|
+
tokens: [{ chainId: computeChainId, address: VEST_TOKEN }],
|
9
|
+
mainProtocol: "vest",
|
10
|
+
};
|
11
|
+
}
|
12
|
+
}
|
package/dist/src/index.d.ts
CHANGED
@@ -222,7 +222,7 @@ declare const app: Elysia<"", false, {
|
|
222
222
|
identifier: string;
|
223
223
|
name: string;
|
224
224
|
status: "PAST" | "LIVE" | "SOON";
|
225
|
-
action:
|
225
|
+
action: any;
|
226
226
|
tokens: ({
|
227
227
|
symbol: string;
|
228
228
|
name: string | null;
|
@@ -97,21 +97,21 @@ export const tokenTypeToProtocol = {
|
|
97
97
|
[tokenType.aave_borrowing]: { protocol: "Aave", action: OpportunityAction.BORROW },
|
98
98
|
[tokenType.anglesLiquid]: { protocol: "Angles", action: OpportunityAction.LEND },
|
99
99
|
[tokenType.aave_lending]: { protocol: "Aave", action: OpportunityAction.LEND },
|
100
|
-
[tokenType.aerodrome]: { protocol: "Aerodrome
|
101
|
-
[tokenType.akron]: { protocol: "Akron
|
100
|
+
[tokenType.aerodrome]: { protocol: "Aerodrome", action: OpportunityAction.POOL },
|
101
|
+
[tokenType.akron]: { protocol: "Akron", action: OpportunityAction.POOL },
|
102
102
|
[tokenType.aura]: { protocol: "Aura", action: OpportunityAction.POOL },
|
103
103
|
[tokenType.balancerGauge]: { protocol: "Balancer Gauge", action: OpportunityAction.POOL },
|
104
|
-
[tokenType.balancerPool]: { protocol: "Balancer
|
105
|
-
[tokenType.baseswap]: { protocol: "Baseswap
|
106
|
-
[tokenType.beefy]: { protocol: "Moo Velodrome
|
104
|
+
[tokenType.balancerPool]: { protocol: "Balancer", action: OpportunityAction.POOL },
|
105
|
+
[tokenType.baseswap]: { protocol: "Baseswap", action: OpportunityAction.HOLD },
|
106
|
+
[tokenType.beefy]: { protocol: "Moo Velodrome", action: OpportunityAction.POOL },
|
107
107
|
[tokenType.compound]: { protocol: "Compound", action: OpportunityAction.LEND },
|
108
108
|
[tokenType.curve]: { protocol: "Curve", action: OpportunityAction.POOL },
|
109
109
|
[tokenType.curve_2]: { protocol: "Curve", action: OpportunityAction.POOL },
|
110
|
-
[tokenType.dragonswap]: { protocol: "Dragonswap
|
110
|
+
[tokenType.dragonswap]: { protocol: "Dragonswap", action: OpportunityAction.POOL },
|
111
111
|
[tokenType.enzyme]: { protocol: "Enzyme", action: OpportunityAction.HOLD },
|
112
|
-
[tokenType.euler_borrow]: { protocol: "Euler
|
113
|
-
[tokenType.euler_lend]: { protocol: "Euler
|
114
|
-
[tokenType.fenix]: { protocol: "Fenix
|
112
|
+
[tokenType.euler_borrow]: { protocol: "Euler", action: OpportunityAction.BORROW },
|
113
|
+
[tokenType.euler_lend]: { protocol: "Euler", action: OpportunityAction.LEND },
|
114
|
+
[tokenType.fenix]: { protocol: "Fenix", action: OpportunityAction.HOLD },
|
115
115
|
[tokenType.filament]: { protocol: "Filament", action: OpportunityAction.HOLD },
|
116
116
|
[tokenType.fluid]: { protocol: "Fluid", action: OpportunityAction.LEND },
|
117
117
|
[tokenType.fraxlend]: { protocol: "Fraxlend", action: OpportunityAction.LEND },
|
@@ -135,8 +135,8 @@ export const tokenTypeToProtocol = {
|
|
135
135
|
[tokenType.sturdy_silo]: { protocol: "Sturdy", action: OpportunityAction.LEND },
|
136
136
|
[tokenType.syncswap]: { protocol: "SyncSwap", action: OpportunityAction.POOL },
|
137
137
|
[tokenType.toros]: { protocol: "Toros", action: OpportunityAction.HOLD },
|
138
|
-
[tokenType.uniswapv2]: { protocol: "Uniswap
|
139
|
-
[tokenType.velodrome]: { protocol: "Velodrome
|
138
|
+
[tokenType.uniswapv2]: { protocol: "Uniswap", action: OpportunityAction.POOL },
|
139
|
+
[tokenType.velodrome]: { protocol: "Velodrome", action: OpportunityAction.POOL },
|
140
140
|
[tokenType.venus]: { protocol: "Venus", action: OpportunityAction.LEND },
|
141
141
|
[tokenType.unknown]: { protocol: "Unknown", action: OpportunityAction.HOLD },
|
142
142
|
[tokenType.yei_borrowing]: { protocol: "Yei Finance", action: OpportunityAction.HOLD },
|
@@ -152,7 +152,7 @@ export const tokenTypeToProtocol = {
|
|
152
152
|
[tokenType.maha]: { protocol: "Maha", action: OpportunityAction.HOLD },
|
153
153
|
[tokenType.tempest]: { protocol: "Tempest", action: OpportunityAction.POOL },
|
154
154
|
[tokenType.pendleYT]: { protocol: "Pendle", action: OpportunityAction.HOLD },
|
155
|
-
[tokenType.pancakeswap]: { protocol: "PancakeSwap
|
155
|
+
[tokenType.pancakeswap]: { protocol: "PancakeSwap", action: OpportunityAction.POOL },
|
156
156
|
[tokenType.tempestStaking]: { protocol: "Tempest", action: OpportunityAction.HOLD },
|
157
157
|
[tokenType.holdstation]: { protocol: "HoldStation", action: OpportunityAction.HOLD },
|
158
158
|
[tokenType.noLinkVault]: { protocol: "NoLinkVault", action: OpportunityAction.HOLD },
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
2
2
|
import Elysia from "elysia";
|
3
|
-
import { ExplorerService } from ".";
|
4
3
|
import { CreateExplorerDto } from "./explorer.model";
|
4
|
+
import { ExplorerService } from "./explorer.service";
|
5
5
|
// ─── Explorer Controller ───────────────────────────────────────────────────────
|
6
6
|
export const ExplorerController = new Elysia({ prefix: "/explorers", detail: { tags: ["Explorers"] } })
|
7
7
|
// ─── Create An Explorer ──────────────────────────────────────────────────────
|