@merkl/api 0.20.112 → 0.20.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/eden/index.d.ts +2 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/default.d.ts +3 -3
- package/dist/src/engine/implementations/Ajna/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Ambient/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Badger/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Clamm/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Compound/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/CompoundV3/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Default/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Dolomite/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/EigenLayer/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Encompassing/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Erc20/metadata.d.ts +1 -12
- package/dist/src/engine/implementations/Erc20/metadata.js +3 -3
- package/dist/src/engine/implementations/Erc20Snapshot/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Erc721/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/ErcMultiToken/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Euler/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Euler/metadata.js +2 -2
- package/dist/src/engine/implementations/EventBased/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Hyperdrive/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Invalid/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Ion/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/JsonAirdrop/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Morpho/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Radiant/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Silo/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/UniswapV4/metadata.d.ts +2 -2
- package/dist/src/engine/implementations/Vest/metadata.d.ts +2 -2
- package/dist/src/jobs/update-dynamic-data.js +2 -2
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +2 -2
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +4 -4
- package/dist/src/modules/v4/campaign/campaign.service.js +3 -3
- package/dist/src/modules/v4/campaign/campaign.test.controller.js +4 -4
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +3 -3
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +10 -10
- package/dist/src/modules/v4/opportunity/opportunity.converter.d.ts +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.converter.js +5 -5
- package/dist/src/modules/v4/opportunity/opportunity.service.js +2 -2
- package/dist/src/modules/v4/opportunity/validate-id.pipe.js +3 -3
- package/dist/src/modules/v4/reward/reward.service.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.service.js +2 -2
- package/dist/src/routes/v3/campaigns.js +3 -3
- package/dist/src/routes/v3/campaignsForMainParameter.js +2 -2
- package/dist/src/scripts/reparse-opportunities.js +2 -2
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Campaign as CampaignResource, CampaignWithParams } from "@/modules/v4/campaign/campaign.model";
|
2
|
-
import type { Campaign as
|
2
|
+
import type { Campaign as CampaignType } from "@sdk";
|
3
3
|
declare const eden: {
|
4
4
|
derive: {};
|
5
5
|
resolve: {};
|
@@ -16118,7 +16118,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
16118
16118
|
export type Opportunity = FromPromise<Api["v4"]["opportunities"]["index"]["get"]>;
|
16119
16119
|
export type Protocol = FromPromise<Api["v4"]["protocols"]["index"]["get"]>;
|
16120
16120
|
export type Campaign = CampaignResource["model"];
|
16121
|
-
export type CampaignParams<C extends
|
16121
|
+
export type CampaignParams<C extends CampaignType> = CampaignWithParams<C>["params"];
|
16122
16122
|
export type Chain = FromPromise<Api["v4"]["chains"]["index"]["get"]>;
|
16123
16123
|
export type Explorer = FromPromise<Api["v4"]["chains"]["index"]["get"]>["explorers"][number];
|
16124
16124
|
export type Token = FromPromise<Api["v4"]["tokens"]["index"]["get"]>;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { Campaign as
|
1
|
+
import type { CampaignParameters, Campaign as CampaignType, MerklChainId } from "@sdk";
|
2
2
|
import type { DynamicDataBuilder } from "../interface";
|
3
|
-
export declare class DefaultDynamicData implements DynamicDataBuilder<
|
4
|
-
build(_chainId: MerklChainId, campaigns: CampaignParameters<
|
3
|
+
export declare class DefaultDynamicData implements DynamicDataBuilder<CampaignType> {
|
4
|
+
build(_chainId: MerklChainId, campaigns: CampaignParameters<CampaignType>[]): Promise<CampaignParameters<CampaignType>[]>;
|
5
5
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import { type Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import { type CampaignParameters, type Campaign as CampaignType, type ChainId } from "@sdk";
|
5
|
+
type campaignType = CampaignType.AJNA;
|
6
6
|
export declare class AjnaMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND" | "BORROW";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import { type Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import { type CampaignParameters, type Campaign as CampaignType, type ChainId } from "@sdk";
|
5
|
+
type campaignType = CampaignType.AMBIENTPROCESSOR;
|
6
6
|
export declare class AmbientMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
name: string;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
2
2
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
3
|
-
import type { Campaign as
|
3
|
+
import type { CampaignParameters, Campaign as CampaignType, ChainId } from "@sdk";
|
4
4
|
import type { MetadataBuilder } from "../../metadata/interface";
|
5
|
-
type campaignType =
|
5
|
+
type campaignType = CampaignType.BADGER;
|
6
6
|
export declare class BadgerMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "BORROW";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import { type ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import { type Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import { type CampaignParameters, type Campaign as CampaignType, ChainId } from "@sdk";
|
5
|
+
type campaignType = CampaignType.CLAMM;
|
6
6
|
export declare const uniswapV3OkuChains: {
|
7
7
|
[ChainId.BLAST]: string;
|
8
8
|
[ChainId.SCROLL]: string;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import { type Campaign as
|
3
|
+
import { type Campaign as CampaignType } from "@sdk";
|
4
4
|
import type { ProtocolId } from "../../../modules/v4/protocol/protocol.model";
|
5
|
-
type campaignType =
|
5
|
+
type campaignType = CampaignType.COMPOUND;
|
6
6
|
export declare class CompoundMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND" | "BORROW";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import { type Campaign as
|
3
|
+
import { type Campaign as CampaignType } from "@sdk";
|
4
4
|
import type { ProtocolId } from "../../../modules/v4/protocol/protocol.model";
|
5
|
-
type campaignType =
|
5
|
+
type campaignType = CampaignType.COMPOUND_V3;
|
6
6
|
export declare class CompoundV3Metadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND" | "BORROW";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import type { Campaign as
|
4
|
-
type campaignType =
|
3
|
+
import type { Campaign as CampaignType } from "@sdk";
|
4
|
+
type campaignType = CampaignType;
|
5
5
|
export declare class DefaultMetadata implements MetadataBuilder<campaignType> {
|
6
6
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
7
7
|
action: "HOLD";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import type { Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import type { Campaign as CampaignType } from "@sdk";
|
5
|
+
type campaignType = CampaignType.DOLOMITE;
|
6
6
|
export declare class DolomiteMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND" | "BORROW";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import type { Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import type { Campaign as CampaignType } from "@sdk";
|
5
|
+
type campaignType = CampaignType.EIGENLAYER;
|
6
6
|
export declare class EigenLayerMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import type { Campaign as
|
4
|
-
type campaignType =
|
3
|
+
import type { Campaign as CampaignType } from "@sdk";
|
4
|
+
type campaignType = CampaignType.ENCOMPASSING;
|
5
5
|
export declare class EncompassingMetadata implements MetadataBuilder<campaignType> {
|
6
6
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
7
7
|
action: "DROP";
|
@@ -1,20 +1,9 @@
|
|
1
1
|
import type { Erc20LikeCampaignEnum } from "@/engine/implementations/Erc20/subTypes";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import type { OpportunityAction } from "@db/api";
|
4
3
|
import type { MetadataBuilder } from "../../metadata/interface";
|
5
4
|
type campaignType = Erc20LikeCampaignEnum;
|
6
5
|
export declare class Erc20Metadata implements MetadataBuilder<campaignType> {
|
7
|
-
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">, opportunityIdentifier: string): Promise<{
|
8
|
-
name: string;
|
9
|
-
action: OpportunityAction;
|
10
|
-
tokens: {
|
11
|
-
chainId: number;
|
12
|
-
address: string;
|
13
|
-
}[];
|
14
|
-
mainProtocol?: import("../../../modules/v4/protocol/protocol.model").ProtocolId;
|
15
|
-
depositUrl?: string;
|
16
|
-
explorerAddress?: string;
|
17
|
-
} | {
|
6
|
+
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">, opportunityIdentifier: string): Promise<import("../../metadata/interface").Metadata | {
|
18
7
|
action: import("@db/api").$Enums.OpportunityAction;
|
19
8
|
name: string;
|
20
9
|
tokens: {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { dynamicDataBuilderFactory } from "@/engine/deprecated/dynamicData/factory";
|
2
2
|
import { OpportunityConvertorService } from "@/modules/v4/opportunity/opportunity.converter";
|
3
3
|
import { log } from "@/utils/logger";
|
4
|
-
import { Campaign as
|
4
|
+
import { Campaign as CampaignType } from "@sdk";
|
5
5
|
import { getAddress } from "viem";
|
6
6
|
import { ProtocolService } from "../../../modules/v4/protocol/protocol.service";
|
7
7
|
import { detectSubType } from "./subTypes/detect";
|
@@ -10,7 +10,7 @@ export class Erc20Metadata {
|
|
10
10
|
async build(campaign, opportunityIdentifier) {
|
11
11
|
const { params, computeChainId, campaignId, rewardToken, distributionChainId, type } = campaign;
|
12
12
|
const [subType] = await detectSubType(computeChainId, [
|
13
|
-
OpportunityConvertorService.convertV4CampaignToV3(
|
13
|
+
OpportunityConvertorService.convertV4CampaignToV3(CampaignType[type], campaign, opportunityIdentifier),
|
14
14
|
]);
|
15
15
|
log.info(`building metadata for subtype ${subType}`);
|
16
16
|
const builder = erc20SubTypeMetadataBuilderFactory(subType);
|
@@ -24,7 +24,7 @@ export class Erc20Metadata {
|
|
24
24
|
const depositUrl = params?.url;
|
25
25
|
let tokens = [{ chainId: computeChainId, address: params.targetToken }];
|
26
26
|
try {
|
27
|
-
const [dynamicData] = await dynamicDataBuilderFactory(
|
27
|
+
const [dynamicData] = await dynamicDataBuilderFactory(CampaignType.ERC20).build(computeChainId, [
|
28
28
|
{
|
29
29
|
campaignId,
|
30
30
|
rewardToken: rewardToken.address,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import type { Campaign as
|
4
|
-
type campaignType =
|
3
|
+
import type { Campaign as CampaignType } from "@sdk";
|
4
|
+
type campaignType = CampaignType.ERC20_SNAPSHOT;
|
5
5
|
export declare class Erc20SnapshotMetadata implements MetadataBuilder<campaignType> {
|
6
6
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
7
7
|
name: string;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import type { Campaign as
|
4
|
-
type campaignType =
|
3
|
+
import type { Campaign as CampaignType } from "@sdk";
|
4
|
+
type campaignType = CampaignType.ERC721 | CampaignType.ERC721FIXAPR;
|
5
5
|
export declare class Erc721Metadata implements MetadataBuilder<campaignType> {
|
6
6
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
7
7
|
action: "HOLD";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
2
2
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
3
|
-
import { type Campaign as
|
3
|
+
import { type Campaign as CampaignType } from "@sdk";
|
4
4
|
import type { MetadataBuilder } from "../../metadata/interface";
|
5
|
-
type campaignType =
|
5
|
+
type campaignType = CampaignType.ERC1155 | CampaignType.ERC1155FIXAPR | CampaignType.ERC6909 | CampaignType.ERC6909FIXAPR;
|
6
6
|
export declare class ErcMultiTokenMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "HOLD";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import { Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import { type CampaignParameters, Campaign as CampaignType, type ChainId } from "@sdk";
|
5
|
+
type campaignType = CampaignType.EULER;
|
6
6
|
export declare class EulerMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
name: string;
|
@@ -2,14 +2,14 @@ import { dynamicDataBuilderFactory } from "@/engine/deprecated/dynamicData/facto
|
|
2
2
|
import { log } from "@/utils/logger";
|
3
3
|
import { sanitizeChainName } from "@/utils/sanitizeChain";
|
4
4
|
import { OpportunityAction } from "@db/api";
|
5
|
-
import { Campaign as
|
5
|
+
import { Campaign as CampaignType } from "@sdk";
|
6
6
|
import { getAddress } from "viem";
|
7
7
|
export class EulerMetadata {
|
8
8
|
async build(campaign) {
|
9
9
|
const { params, computeChainId, campaignId, rewardToken, distributionChainId, subType } = campaign;
|
10
10
|
let name = `Hold ${params.symbolTargetToken}`;
|
11
11
|
try {
|
12
|
-
const [dynamicData] = await dynamicDataBuilderFactory(
|
12
|
+
const [dynamicData] = await dynamicDataBuilderFactory(CampaignType.EULER).build(computeChainId, [
|
13
13
|
{
|
14
14
|
campaignId,
|
15
15
|
rewardToken: rewardToken.address,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import type { Campaign as
|
4
|
-
type campaignType =
|
3
|
+
import type { CampaignParameters, Campaign as CampaignType, ChainId } from "@sdk";
|
4
|
+
type campaignType = CampaignType.EVENT_BASED;
|
5
5
|
export declare class EventBasedMetadata implements MetadataBuilder<campaignType> {
|
6
6
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
7
7
|
action: "SWAP";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import { type Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import { type CampaignParameters, type Campaign as CampaignType, type ChainId } from "@sdk";
|
5
|
+
type campaignType = CampaignType.HYPERDRIVELOGPROCESSOR | CampaignType.HYPERDRIVELOGFIXPROCESSOR;
|
6
6
|
export declare class HyperdriveMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "POOL" | "LONG" | "SHORT";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
|
-
import type { Campaign as
|
3
|
-
type campaignType =
|
2
|
+
import type { Campaign as CampaignType } from "@sdk";
|
3
|
+
type campaignType = CampaignType.INVALID;
|
4
4
|
export declare class InvalidMetadata implements MetadataBuilder<campaignType> {
|
5
5
|
build(): Promise<{
|
6
6
|
name: string;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import type { Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import type { Campaign as CampaignType } from "@sdk";
|
5
|
+
type campaignType = CampaignType.ION;
|
6
6
|
export declare class IonMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
|
-
import type { Campaign as
|
4
|
-
type campaignType =
|
3
|
+
import type { CampaignParameters, Campaign as CampaignType, ChainId } from "@sdk";
|
4
|
+
type campaignType = CampaignType.JSON_AIRDROP;
|
5
5
|
export declare class JsonAirdropMetadata implements MetadataBuilder<campaignType> {
|
6
6
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
7
7
|
action: "DROP";
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import { type Campaign as
|
4
|
+
import { type CampaignParameters, type Campaign as CampaignType, ChainId } from "@sdk";
|
5
5
|
import type { BigNumberish } from "ethers";
|
6
|
-
type campaignType =
|
6
|
+
type campaignType = CampaignType.MORPHO;
|
7
7
|
export declare class MorphoMetadata implements MetadataBuilder<campaignType> {
|
8
8
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
9
9
|
action: "LEND" | "BORROW";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
2
2
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
3
|
-
import { type Campaign as
|
3
|
+
import { type Campaign as CampaignType } from "@sdk";
|
4
4
|
import type { MetadataBuilder } from "../../metadata/interface";
|
5
|
-
type campaignType =
|
5
|
+
type campaignType = CampaignType.RADIANT;
|
6
6
|
export declare class RadiantMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND" | "BORROW";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import type { Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import type { Campaign as CampaignType } from "@sdk";
|
5
|
+
type campaignType = CampaignType.SILO;
|
6
6
|
export declare class SiloMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND" | "BORROW";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import type { Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import type { CampaignParameters, Campaign as CampaignType, ChainId } from "@sdk";
|
5
|
+
type campaignType = CampaignType.UNISWAP_V4;
|
6
6
|
export declare class UniswapV4Metadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
name: string;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { MetadataBuilder } from "@/engine/metadata/interface";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
4
|
-
import type { Campaign as
|
5
|
-
type campaignType =
|
4
|
+
import type { Campaign as CampaignType } from "@sdk";
|
5
|
+
type campaignType = CampaignType.VEST;
|
6
6
|
export declare class VestMetadata implements MetadataBuilder<campaignType> {
|
7
7
|
build(campaign: Omit<CampaignWithParams<campaignType>, "manualOverrides">): Promise<{
|
8
8
|
action: "LEND";
|
@@ -3,7 +3,7 @@ import { DynamicDataService } from "@/modules/v4/dynamicData/dynamicData.service
|
|
3
3
|
import { OpportunityService } from "@/modules/v4/opportunity";
|
4
4
|
import { OpportunityConvertorService } from "@/modules/v4/opportunity/opportunity.converter";
|
5
5
|
import { logger } from "@/utils/logger";
|
6
|
-
import { Campaign as
|
6
|
+
import { Campaign as CampaignType } from "@sdk";
|
7
7
|
import moment from "moment";
|
8
8
|
// ─── Required Env Variables ──────────────────────────────────────────────────
|
9
9
|
const chainId = Number(process.env.CHAIN_ID);
|
@@ -52,7 +52,7 @@ const main = async () => {
|
|
52
52
|
// 4. Update the status of the opportunities associated to live campaigns
|
53
53
|
await OpportunityService.updateMany(liveOpportunityIds, { status: "LIVE" });
|
54
54
|
// 5. Update records for all live campaigns
|
55
|
-
const liveCampaigns = (await CampaignService.findMany({ chainId, status: "LIVE", test: true, withOpportunity: true, items: 10_000 })).map(campaign => OpportunityConvertorService.convertV4CampaignToV3(
|
55
|
+
const liveCampaigns = (await CampaignService.findMany({ chainId, status: "LIVE", test: true, withOpportunity: true, items: 10_000 })).map(campaign => OpportunityConvertorService.convertV4CampaignToV3(CampaignType[campaign.type], campaign, campaign.Opportunity.identifier));
|
56
56
|
const promises = [];
|
57
57
|
for (const type of new Set(liveCampaigns.map(c => c.campaignType))) {
|
58
58
|
promises.push(DynamicDataService.update(chainId, type, liveCampaigns.filter(c => c.campaignType === type)));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Resource } from "@/modules/v4/prisma";
|
2
2
|
import { type Token } from "@/modules/v4/token/token.model";
|
3
|
-
import type { Campaign as
|
3
|
+
import type { CampaignParameters, Campaign as CampaignType } from "@sdk";
|
4
4
|
import { type Chain } from "../chain/chain.model";
|
5
5
|
import { type Status as StatusModel } from "../status/status.model";
|
6
6
|
/**
|
@@ -22,7 +22,7 @@ export type Campaign = Resource<"Campaign", "opportunityId" | "rewardTokenId", {
|
|
22
22
|
startTimestamp: number;
|
23
23
|
createdAt: string;
|
24
24
|
}>;
|
25
|
-
export type CampaignWithParams<C extends
|
25
|
+
export type CampaignWithParams<C extends CampaignType = CampaignType> = Campaign["model"] & {
|
26
26
|
params: CampaignParameters<C>["campaignParameters"];
|
27
27
|
};
|
28
28
|
export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { CampaignConfigMinimalModel, CampaignUnique, CampaignWithParams, CreateCampaignModel, GetCampaignQueryModel, UpdateCampaignCreatorModel, UpdateCampaignModel, UpdateMetaDataCampaignModel } from "@/modules/v4/campaign";
|
2
2
|
import type { CampaignManualOverride } from "@db/api";
|
3
|
-
import { Campaign as
|
3
|
+
import { type CampaignParameters, Campaign as CampaignType, type ChainId } from "@sdk";
|
4
4
|
import type { GetCampaignComputedValueModel } from "../computedValue/computedValue.model";
|
5
5
|
import { CampaignRepository } from "./campaign.repository";
|
6
6
|
export declare abstract class CampaignService {
|
@@ -708,7 +708,7 @@ export declare abstract class CampaignService {
|
|
708
708
|
* @param type index of Campaign enum from sdk
|
709
709
|
* @returns a string
|
710
710
|
*/
|
711
|
-
static getTypeFromV3(type:
|
711
|
+
static getTypeFromV3(type: CampaignType): string;
|
712
712
|
/**
|
713
713
|
* Split a campaigns array into three array for each status
|
714
714
|
* @param campaigns
|
@@ -805,7 +805,7 @@ export declare abstract class CampaignService {
|
|
805
805
|
/**
|
806
806
|
* @deprecated Used only in tentative position fetcher
|
807
807
|
*/
|
808
|
-
static formatAsCampaignParameters<C extends
|
808
|
+
static formatAsCampaignParameters<C extends CampaignType>(campaign: CampaignWithParams): CampaignParameters<C>;
|
809
809
|
/**
|
810
810
|
* Shortcut to get daily amount from total
|
811
811
|
* @param start timestamp
|
@@ -814,7 +814,7 @@ export declare abstract class CampaignService {
|
|
814
814
|
* @returns daily token amount
|
815
815
|
*/
|
816
816
|
static getDailyAmount<T extends bigint | number>(start: T, end: T, amount: bigint): bigint;
|
817
|
-
static createFakeCampaign<C extends
|
817
|
+
static createFakeCampaign<C extends CampaignType>(body: CampaignConfigMinimalModel): CampaignParameters<C>;
|
818
818
|
static createFakeCampaignEngine(body: CampaignConfigMinimalModel): {
|
819
819
|
computeChainId: any;
|
820
820
|
chainId: any;
|
@@ -4,7 +4,7 @@ import { StatusService } from "@/modules/v4/status/status.service";
|
|
4
4
|
import { TokenService } from "@/modules/v4/token/token.service";
|
5
5
|
import { CannotParseOpportunity, InvalidParameter } from "@/utils/error";
|
6
6
|
import { log } from "@/utils/logger";
|
7
|
-
import { Campaign as
|
7
|
+
import { Campaign as CampaignType, NETWORK_LABELS, } from "@sdk";
|
8
8
|
import { utils } from "ethers";
|
9
9
|
import moment from "moment";
|
10
10
|
import { ChainService } from "../chain/chain.service";
|
@@ -276,7 +276,7 @@ export class CampaignService {
|
|
276
276
|
* @returns a string
|
277
277
|
*/
|
278
278
|
static getTypeFromV3(type) {
|
279
|
-
return
|
279
|
+
return CampaignType[type];
|
280
280
|
}
|
281
281
|
/**
|
282
282
|
* Split a campaigns array into three array for each status
|
@@ -348,7 +348,7 @@ export class CampaignService {
|
|
348
348
|
computeChainId: body.computeChainId,
|
349
349
|
campaignParameters: body.params,
|
350
350
|
campaignSubType: body.subType ?? 0,
|
351
|
-
campaignType:
|
351
|
+
campaignType: CampaignType[body.type],
|
352
352
|
chainId: body.distributionChainId ?? 0,
|
353
353
|
creator: body.creatorAddress ?? "creator.address",
|
354
354
|
index: 0, // DEPRECATED
|
@@ -3,7 +3,7 @@ import { InvalidParameter } from "@/errors/InvalidParameter.error";
|
|
3
3
|
import { BackOfficeGuard } from "@/guards/BackOffice.guard";
|
4
4
|
import { AuthorizationHeadersDto } from "@/guards/Engine.guard";
|
5
5
|
import { throwOnUnsupportedChainId } from "@/utils/throw";
|
6
|
-
import { Campaign as
|
6
|
+
import { Campaign as CampaignType } from "@sdk";
|
7
7
|
import Elysia from "elysia";
|
8
8
|
import { DynamicDataSourceIdentifier } from "../dynamicData/dynamicData.model";
|
9
9
|
import { DynamicDataService } from "../dynamicData/dynamicData.service";
|
@@ -25,7 +25,7 @@ export const CampaignTestController = new Elysia({
|
|
25
25
|
if (!id)
|
26
26
|
throw new NotFoundError();
|
27
27
|
const campaign = await CampaignService.findUniqueOrThrow(id, true);
|
28
|
-
const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(
|
28
|
+
const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(CampaignType[campaign.type], CampaignService.format(campaign), campaign.Opportunity.identifier);
|
29
29
|
return await DynamicDataService.update(campaignV3.computeChainId, campaignV3.campaignType, [campaignV3], true);
|
30
30
|
})
|
31
31
|
// ─── Test TVL computation given a campaignId ───────────────────────
|
@@ -36,7 +36,7 @@ export const CampaignTestController = new Elysia({
|
|
36
36
|
test: true,
|
37
37
|
withOpportunity: true,
|
38
38
|
items: 10_000,
|
39
|
-
})).map(campaign => OpportunityConvertorService.convertV4CampaignToV3(
|
39
|
+
})).map(campaign => OpportunityConvertorService.convertV4CampaignToV3(CampaignType[campaign.type], campaign, campaign.Opportunity.identifier));
|
40
40
|
if (!campaigns.length)
|
41
41
|
throw new NotFoundError("Opportunity not found");
|
42
42
|
return await DynamicDataService.update(campaigns[0]?.computeChainId, campaigns[0].campaignType, campaigns, true);
|
@@ -50,7 +50,7 @@ export const CampaignTestController = new Elysia({
|
|
50
50
|
if (!id)
|
51
51
|
throw new NotFoundError();
|
52
52
|
const campaign = await CampaignService.findUniqueOrThrow(id, true);
|
53
|
-
const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(
|
53
|
+
const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(CampaignType[campaign.type], CampaignService.format(campaign), campaign.Opportunity.identifier);
|
54
54
|
listCampaigns.push(campaignV3);
|
55
55
|
}
|
56
56
|
if (!type)
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { Campaign as
|
1
|
+
import { type CampaignParameters, Campaign as CampaignType, type ChainId, type MerklChainId } from "@sdk";
|
2
2
|
export declare class DynamicDataService {
|
3
3
|
/**
|
4
4
|
* @notice Updates all records for opportunities associated to the given campaigns
|
5
5
|
*
|
6
6
|
* @dev The list must ONLY contain campaigns of the same type and the same computeChainId
|
7
7
|
*/
|
8
|
-
static update(chainId: ChainId, type:
|
8
|
+
static update(chainId: ChainId, type: CampaignType, campaigns: CampaignParameters<CampaignType>[], dryRun?: boolean): Promise<unknown[]>;
|
9
9
|
/**
|
10
10
|
* @dev Test function used to create mock ERC20 static campaigns and check tvl and metadata
|
11
11
|
*/
|
@@ -20,5 +20,5 @@ export declare class DynamicDataService {
|
|
20
20
|
/**
|
21
21
|
* @dev Recursive function to handle errors in fetching dynamic data
|
22
22
|
*/
|
23
|
-
static fetchWithRecursiveErrorHandling<R>(fn: (chainId: MerklChainId, campaigns: CampaignParameters<
|
23
|
+
static fetchWithRecursiveErrorHandling<R>(fn: (chainId: MerklChainId, campaigns: CampaignParameters<CampaignType>[]) => Promise<R[]>, campaigns: CampaignParameters<CampaignType>[], chainId: number): Promise<R[]>;
|
24
24
|
}
|