@merkl/api 0.13.14 → 0.14.0
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 +25 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/jobs/etl/pendings.js +3 -1
- package/dist/src/jobs/etl/reward-breakdowns.js +3 -1
- package/dist/src/jobs/etl/rewards.js +4 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.d.ts +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerBorrowProcessor.d.ts +8 -12
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerBorrowProcessor.js +28 -24
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerLendProcessor.d.ts +7 -11
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerLendProcessor.js +20 -21
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.d.ts +6 -5
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +4 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.js +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RfxProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RfxProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.d.ts +3 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.js +2 -2
- package/dist/src/libs/campaigns/campaignsDynamicData.js +1 -2
- package/dist/src/modules/v4/bucket/bucket.model.d.ts +10 -0
- package/dist/src/modules/v4/bucket/bucket.model.js +85 -0
- package/dist/src/modules/v4/bucket/bucket.service.d.ts +8 -6
- package/dist/src/modules/v4/bucket/bucket.service.js +145 -83
- package/dist/src/modules/v4/campaign/campaign.repository.js +1 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +5 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.js +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +2 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +4 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +61 -1
- package/dist/src/modules/v4/router.d.ts +5 -0
- package/dist/src/utils/generateCardName.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.js +0 -165
@@ -1,3 +1,4 @@
|
|
1
|
-
import type { ResultDto } from "@sdk";
|
1
|
+
import type { CampaignParameters, ResultDto } from "@sdk";
|
2
|
+
import type { ERC20SupportedCampaignType } from "../ERC20DynamicData";
|
2
3
|
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
3
|
-
export declare function getTokenTypeRound2(index: number, type: tokenType, typeInfo: any, calls: ResultDto[]): tokenTypeStruct;
|
4
|
+
export declare function getTokenTypeRound2(index: number, type: tokenType, typeInfo: any, calls: ResultDto[], campaign?: CampaignParameters<ERC20SupportedCampaignType>): tokenTypeStruct;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { processorMapping } from "./processor/processorMapping";
|
2
|
-
export function getTokenTypeRound2(index, type, typeInfo, calls) {
|
2
|
+
export function getTokenTypeRound2(index, type, typeInfo, calls, campaign) {
|
3
3
|
try {
|
4
4
|
const returnValueOfCalls = calls.map(call => call.returnData);
|
5
5
|
const ProcessorClass = processorMapping[type];
|
@@ -7,7 +7,7 @@ export function getTokenTypeRound2(index, type, typeInfo, calls) {
|
|
7
7
|
throw new Error(`Processor not found for key: ${type}`);
|
8
8
|
}
|
9
9
|
const processorObject = new ProcessorClass();
|
10
|
-
return processorObject.computeRound2(index, type, typeInfo, returnValueOfCalls);
|
10
|
+
return processorObject.computeRound2(index, type, typeInfo, returnValueOfCalls, campaign);
|
11
11
|
}
|
12
12
|
catch (error) {
|
13
13
|
console.error(error);
|
@@ -9,7 +9,6 @@ import { DolomiteDynamicData } from "./campaignTypes/DolomiteDynamicData";
|
|
9
9
|
import { ERC20DynamicData } from "./campaignTypes/ERC20DynamicData";
|
10
10
|
import { ERC20_SNAPSHOTDynamicData } from "./campaignTypes/ERC20_SNAPSHOTDynamicData";
|
11
11
|
import { EigenLayerDynamicData } from "./campaignTypes/EigenLayerDynamicData";
|
12
|
-
import { EulerDynamicData } from "./campaignTypes/EulerDynamicData";
|
13
12
|
import { HyperdriveDynamicData } from "./campaignTypes/HyperdriveDynamicData";
|
14
13
|
import { JSON_AIRDROPDynamicData } from "./campaignTypes/JSON_AIRDROPDynamicData";
|
15
14
|
import { MORPHODynamicData } from "./campaignTypes/MORPHODynamicData";
|
@@ -53,7 +52,7 @@ export async function campaignsDynamicData(chainId, campaigns, type) {
|
|
53
52
|
return MORPHODynamicData(chainId, campaigns);
|
54
53
|
}
|
55
54
|
case Campaign.EULER: {
|
56
|
-
return
|
55
|
+
return ERC20DynamicData(chainId, campaigns);
|
57
56
|
}
|
58
57
|
case Campaign.DOLOMITE: {
|
59
58
|
return DolomiteDynamicData(chainId, campaigns);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare const mimeTypes: readonly ["audio/aac", "application/x-abiword", "image/apng", "application/x-freearc", "image/avif", "video/x-msvideo", "application/vnd.amazon.ebook", "application/octet-stream", "image/bmp", "application/x-bzip", "application/x-bzip2", "application/x-cdf", "application/x-csh", "text/css", "text/csv", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-fontobject", "application/epub+zip", "application/gzip", "application/x-gzip", "image/gif", "text/html", "image/vnd.microsoft.icon", "text/calendar", "application/java-archive", "image/jpeg", "text/javascript", "application/json", "application/ld+json", "audio/midi", "audio/x-midi", "text/javascript", "audio/mpeg", "video/mp4", "video/mpeg", "application/vnd.apple.installer+xml", "application/vnd.oasis.opendocument.presentation", "application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.text", "audio/ogg", "video/ogg", "application/ogg", "audio/ogg", "font/otf", "image/png", "application/pdf", "application/x-httpd-php", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.rar", "application/rtf", "application/x-sh", "image/svg+xml", "application/x-tar", "image/tiff", "video/mp2t", "font/ttf", "text/plain", "application/vnd.visio", "audio/wav", "audio/webm", "video/webm", "image/webp", "font/woff", "font/woff2", "application/xhtml+xml", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/xml", "text/xml", "application/atom+xml", "application/xml", "application/vnd.mozilla.xul+xml", "application/zip", "application/x-zip-compressed", "audio/video", "video/3gpp", "audio/3gpp", "audio/video", "video/3gpp2", "audio/3gpp2", "application/x-7z-compressed"];
|
2
|
+
export type MimeType = (typeof mimeTypes)[number];
|
3
|
+
export type UploadOptions<T> = {
|
4
|
+
type?: MimeType;
|
5
|
+
compression?: boolean;
|
6
|
+
overwrite?: boolean;
|
7
|
+
isPublic?: boolean;
|
8
|
+
transform?: (obj: T) => string;
|
9
|
+
separator?: string;
|
10
|
+
};
|
@@ -0,0 +1,85 @@
|
|
1
|
+
export const mimeTypes = [
|
2
|
+
"audio/aac",
|
3
|
+
"application/x-abiword",
|
4
|
+
"image/apng",
|
5
|
+
"application/x-freearc",
|
6
|
+
"image/avif",
|
7
|
+
"video/x-msvideo",
|
8
|
+
"application/vnd.amazon.ebook",
|
9
|
+
"application/octet-stream",
|
10
|
+
"image/bmp",
|
11
|
+
"application/x-bzip",
|
12
|
+
"application/x-bzip2",
|
13
|
+
"application/x-cdf",
|
14
|
+
"application/x-csh",
|
15
|
+
"text/css",
|
16
|
+
"text/csv",
|
17
|
+
"application/msword",
|
18
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
19
|
+
"application/vnd.ms-fontobject",
|
20
|
+
"application/epub+zip",
|
21
|
+
"application/gzip",
|
22
|
+
"application/x-gzip",
|
23
|
+
"image/gif",
|
24
|
+
"text/html",
|
25
|
+
"image/vnd.microsoft.icon",
|
26
|
+
"text/calendar",
|
27
|
+
"application/java-archive",
|
28
|
+
"image/jpeg",
|
29
|
+
"text/javascript",
|
30
|
+
"application/json",
|
31
|
+
"application/ld+json",
|
32
|
+
"audio/midi",
|
33
|
+
"audio/x-midi",
|
34
|
+
"text/javascript",
|
35
|
+
"audio/mpeg",
|
36
|
+
"video/mp4",
|
37
|
+
"video/mpeg",
|
38
|
+
"application/vnd.apple.installer+xml",
|
39
|
+
"application/vnd.oasis.opendocument.presentation",
|
40
|
+
"application/vnd.oasis.opendocument.spreadsheet",
|
41
|
+
"application/vnd.oasis.opendocument.text",
|
42
|
+
"audio/ogg",
|
43
|
+
"video/ogg",
|
44
|
+
"application/ogg",
|
45
|
+
"audio/ogg",
|
46
|
+
"font/otf",
|
47
|
+
"image/png",
|
48
|
+
"application/pdf",
|
49
|
+
"application/x-httpd-php",
|
50
|
+
"application/vnd.ms-powerpoint",
|
51
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
52
|
+
"application/vnd.rar",
|
53
|
+
"application/rtf",
|
54
|
+
"application/x-sh",
|
55
|
+
"image/svg+xml",
|
56
|
+
"application/x-tar",
|
57
|
+
"image/tiff",
|
58
|
+
"video/mp2t",
|
59
|
+
"font/ttf",
|
60
|
+
"text/plain",
|
61
|
+
"application/vnd.visio",
|
62
|
+
"audio/wav",
|
63
|
+
"audio/webm",
|
64
|
+
"video/webm",
|
65
|
+
"image/webp",
|
66
|
+
"font/woff",
|
67
|
+
"font/woff2",
|
68
|
+
"application/xhtml+xml",
|
69
|
+
"application/vnd.ms-excel",
|
70
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
71
|
+
"application/xml",
|
72
|
+
"text/xml",
|
73
|
+
"application/atom+xml",
|
74
|
+
"application/xml",
|
75
|
+
"application/vnd.mozilla.xul+xml",
|
76
|
+
"application/zip",
|
77
|
+
"application/x-zip-compressed",
|
78
|
+
"audio/video",
|
79
|
+
"video/3gpp",
|
80
|
+
"audio/3gpp",
|
81
|
+
"audio/video",
|
82
|
+
"video/3gpp2",
|
83
|
+
"audio/3gpp2",
|
84
|
+
"application/x-7z-compressed",
|
85
|
+
];
|
@@ -1,8 +1,10 @@
|
|
1
|
-
import type {
|
1
|
+
import type { UploadOptions } from "./bucket.model";
|
2
2
|
export declare class BucketService {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
#private;
|
4
|
+
defaultUploadOptions: UploadOptions<unknown>;
|
5
|
+
constructor(bucket: string);
|
6
|
+
pushArray<T>(filename: string, arr: T[], options?: UploadOptions<T>): Promise<number>;
|
7
|
+
push(filename: string, text: string, options?: Omit<UploadOptions<never>, "transform">): Promise<number>;
|
8
|
+
pullArray<T>(filename: string, callback: (elem: string) => T, separator?: string): Promise<T[]>;
|
9
|
+
pull(filename: string): Promise<string>;
|
8
10
|
}
|
@@ -1,97 +1,159 @@
|
|
1
|
-
import { log } from "../../../utils/logger";
|
2
1
|
import { Storage } from "@google-cloud/storage";
|
2
|
+
import { S3Client, gzipSync } from "bun";
|
3
|
+
// ─── BucketService Class ─────────────────────────────────────────────────────
|
3
4
|
export class BucketService {
|
4
|
-
// ───
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
// ─── Private Properties ──────────────────────────────────────────────
|
6
|
+
#s3Client;
|
7
|
+
#gcsBucket;
|
8
|
+
#encoder;
|
9
|
+
#decoder;
|
10
|
+
// ─── Default Options ─────────────────────────────────────────────────────────
|
11
|
+
defaultUploadOptions = {
|
12
|
+
type: "text/plain",
|
13
|
+
compression: true,
|
14
|
+
overwrite: true,
|
15
|
+
isPublic: false,
|
16
|
+
transform: obj => `${JSON.stringify(obj)}`,
|
17
|
+
separator: "\n",
|
18
|
+
};
|
19
|
+
// ─── Constructor ─────────────────────────────────────────────────────
|
20
|
+
constructor(bucket) {
|
21
|
+
this.#s3Client = new S3Client({
|
22
|
+
accessKeyId: process.env.GCS_ACCESS_ID,
|
23
|
+
secretAccessKey: process.env.GCS_SECRET,
|
24
|
+
endpoint: process.env.GCS_ENDPOINT,
|
25
|
+
bucket,
|
26
|
+
});
|
27
|
+
this.#gcsBucket = new Storage().bucket(bucket);
|
28
|
+
this.#encoder = new TextEncoder();
|
29
|
+
this.#decoder = new TextDecoder();
|
12
30
|
}
|
13
|
-
// ───
|
14
|
-
|
15
|
-
const
|
16
|
-
|
17
|
-
|
18
|
-
const
|
19
|
-
|
31
|
+
// ─── Process And Upload Chunks Of Data ───────────────────────────────
|
32
|
+
async pushArray(filename, arr, options) {
|
33
|
+
// const start = performance.now();
|
34
|
+
// ─── Initialization ──────────────────────────────────────────
|
35
|
+
options = { ...this.defaultUploadOptions, ...options };
|
36
|
+
const file = this.#s3Client.file(filename);
|
37
|
+
const writer = file.writer({
|
38
|
+
retry: 2,
|
39
|
+
queueSize: 10,
|
40
|
+
partSize: 5 * 1024 * 1024,
|
41
|
+
type: options.type,
|
42
|
+
});
|
43
|
+
// ─── Objects Array To Uint8Array ─────────────────────────────
|
44
|
+
const sink = new Bun.ArrayBufferSink();
|
45
|
+
sink.start({
|
46
|
+
asUint8Array: true,
|
47
|
+
});
|
48
|
+
for (let i = 0; i < arr.length; i++)
|
49
|
+
sink.write(this.#encoder.encode(`${options.transform(arr[i])}${options.separator}`));
|
50
|
+
let data = sink.end();
|
51
|
+
if (options.compression)
|
52
|
+
data = gzipSync(data);
|
53
|
+
// ─── ReadableStream Initialization From Blob ─────────────────
|
54
|
+
const blob = new Blob([data]);
|
55
|
+
const stream = blob.stream(50 * 1024 * 1024);
|
56
|
+
const reader = stream.getReader();
|
57
|
+
// ─── Start Writing Data To Bucket ────────────────────────────
|
58
|
+
if (options.overwrite && (await file.exists()))
|
20
59
|
await file.delete();
|
60
|
+
let bytes = 0;
|
61
|
+
try {
|
62
|
+
while (true) {
|
63
|
+
const { done, value } = await reader.read();
|
64
|
+
if (done)
|
65
|
+
break;
|
66
|
+
bytes += await writer.write(value);
|
67
|
+
}
|
68
|
+
await writer.end();
|
21
69
|
}
|
22
|
-
|
23
|
-
|
24
|
-
cacheControl: "public, max-age=300",
|
25
|
-
});
|
26
|
-
if (isPublic) {
|
27
|
-
await file.makePublic();
|
70
|
+
finally {
|
71
|
+
reader.releaseLock();
|
28
72
|
}
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
73
|
+
// ─── Setting Proper Metadata ─────────────────────────────────
|
74
|
+
if (options.compression)
|
75
|
+
await this.#gcsBucket.file(filename).setMetadata({ contentEncoding: "gzip" });
|
76
|
+
if (options.isPublic)
|
77
|
+
await this.#gcsBucket.makePublic();
|
78
|
+
// ─── Return The Number Of Bytes Written ──────────────────────
|
79
|
+
return bytes;
|
80
|
+
}
|
81
|
+
// ─── Upload Data To Bucket ───────────────────────────────────────────
|
82
|
+
async push(filename, text, options) {
|
83
|
+
// const start = performance.now();
|
84
|
+
// ─── Initialization ──────────────────────────────────────────
|
85
|
+
options = { ...this.defaultUploadOptions, ...options };
|
86
|
+
const file = this.#s3Client.file(filename);
|
87
|
+
const data = options.compression ? gzipSync(this.#encoder.encode(text)) : this.#encoder.encode(text);
|
88
|
+
const writer = file.writer({
|
89
|
+
retry: 2,
|
90
|
+
queueSize: 10,
|
91
|
+
partSize: 5 * 1024 * 1024,
|
92
|
+
type: options.type,
|
36
93
|
});
|
37
|
-
|
38
|
-
|
94
|
+
const blob = new Blob([data]);
|
95
|
+
const stream = blob.stream(50 * 1024 * 1024);
|
96
|
+
const reader = stream.getReader();
|
97
|
+
if (options.overwrite && (await file.exists()))
|
98
|
+
await file.delete();
|
99
|
+
// ─── Start Writing Data To Bucket ────────────────────────────
|
100
|
+
let bytes = 0;
|
101
|
+
try {
|
102
|
+
while (true) {
|
103
|
+
const { done, value } = await reader.read();
|
104
|
+
if (done)
|
105
|
+
break;
|
106
|
+
bytes += await writer.write(value);
|
107
|
+
}
|
108
|
+
await writer.end();
|
39
109
|
}
|
40
|
-
|
41
|
-
|
42
|
-
withLog && log.local(`✅ successfully updated https://storage.cloud.google.com/${bucketName}/${fileName}`);
|
43
|
-
}
|
44
|
-
// ─── Read An Object As A Stream ──────────────────────────────────────
|
45
|
-
static async readStreamFromBucket(fileName, bucketName, projectID, hook = line => JSON.parse(line), withLog = true) {
|
46
|
-
const storage = new Storage({ projectId: projectID });
|
47
|
-
const bucket = storage.bucket(bucketName);
|
48
|
-
const file = bucket.file(fileName);
|
49
|
-
const [exists] = await file.exists();
|
50
|
-
if (!exists) {
|
51
|
-
throw new Error(`File ${fileName} does not exist in bucket ${bucketName}`);
|
110
|
+
finally {
|
111
|
+
reader.releaseLock();
|
52
112
|
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
113
|
+
// ─── Setting Proper Metadata ─────────────────────────────────
|
114
|
+
if (options.compression)
|
115
|
+
await this.#gcsBucket.file(filename).setMetadata({ contentEncoding: "gzip" });
|
116
|
+
if (options.isPublic)
|
117
|
+
await this.#gcsBucket.makePublic();
|
118
|
+
// ─── Return The Number Of Bytes Written ──────────────────────
|
119
|
+
return bytes;
|
120
|
+
}
|
121
|
+
// ─── Download And Process Chunks Of Data ─────────────────────────────
|
122
|
+
async pullArray(filename, callback, separator = "\n") {
|
123
|
+
const file = this.#s3Client.file(filename);
|
124
|
+
if (!(await file.exists))
|
125
|
+
throw new Error("File does not exists.");
|
126
|
+
const stream = file.stream();
|
127
|
+
const data = [];
|
128
|
+
let buffer = "";
|
129
|
+
for await (const chunk of stream) {
|
130
|
+
buffer += this.#decoder.decode(chunk);
|
131
|
+
const lines = buffer.split(separator);
|
132
|
+
buffer = lines.pop() || "";
|
133
|
+
for (const line of lines) {
|
134
|
+
try {
|
135
|
+
data.push(callback(line));
|
70
136
|
}
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
if (buffer.trim()) {
|
75
|
-
const res = hook(buffer);
|
76
|
-
data.push(res);
|
137
|
+
catch (err) {
|
138
|
+
if (err instanceof Error && err.message === "JSON Parse error: Unexpected EOF")
|
139
|
+
break;
|
77
140
|
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
}
|
84
|
-
// ─── Delete A File ───────────────────────────────────────────────────
|
85
|
-
static async deleteFile(fileName, bucketName, projectID) {
|
86
|
-
const storage = new Storage({ projectId: projectID });
|
87
|
-
const bucket = storage.bucket(bucketName);
|
88
|
-
const file = bucket.file(fileName);
|
89
|
-
await file.delete();
|
141
|
+
}
|
142
|
+
}
|
143
|
+
if (buffer.trim())
|
144
|
+
data.push(callback(buffer));
|
145
|
+
return data;
|
90
146
|
}
|
91
|
-
// ───
|
92
|
-
|
93
|
-
const
|
94
|
-
|
95
|
-
|
147
|
+
// ─── Download Data From Bucket ───────────────────────────────────────
|
148
|
+
async pull(filename) {
|
149
|
+
const file = this.#s3Client.file(filename);
|
150
|
+
if (!(await file.exists))
|
151
|
+
throw new Error("File does not exists.");
|
152
|
+
const stream = file.stream();
|
153
|
+
let buffer = "";
|
154
|
+
for await (const chunk of stream)
|
155
|
+
buffer += this.#decoder.decode(chunk);
|
156
|
+
buffer = buffer.trim();
|
157
|
+
return buffer;
|
96
158
|
}
|
97
159
|
}
|
@@ -3,7 +3,7 @@ import { log } from "../../../utils/logger";
|
|
3
3
|
import { apiDbClient, engineDbClient } from "../../../utils/prisma";
|
4
4
|
import { ALL_CAMPAIGNS_FOR_CHAIN_AFTER } from "../../../utils/queries/allCampaigns";
|
5
5
|
import { Prisma, RunStatus } from "../../../../database/api/.generated";
|
6
|
-
import { MAX_COMPUTE_JOB_TIME
|
6
|
+
import { MAX_COMPUTE_JOB_TIME } from "@sdk";
|
7
7
|
import moment from "moment";
|
8
8
|
import { OpportunityService } from "../opportunity";
|
9
9
|
import { TokenService } from "../token";
|
@@ -235,7 +235,6 @@ export class CampaignRepository {
|
|
235
235
|
where: {
|
236
236
|
distributionChainId,
|
237
237
|
startTimestamp: { lte: currentTime }, // The campaign has started
|
238
|
-
endTimestamp: { gte: currentTime - WEEK }, // The campaign ended less than a week ago
|
239
238
|
params: {
|
240
239
|
path: ["shouldIgnore"],
|
241
240
|
equals: Prisma.AnyNull,
|
@@ -108,6 +108,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
108
108
|
query: {
|
109
109
|
sort?: string | undefined;
|
110
110
|
name?: string | undefined;
|
111
|
+
type?: string | undefined;
|
111
112
|
tokens?: string | undefined;
|
112
113
|
status?: string | undefined;
|
113
114
|
items?: number | undefined;
|
@@ -224,6 +225,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
224
225
|
query: {
|
225
226
|
sort?: string | undefined;
|
226
227
|
name?: string | undefined;
|
228
|
+
type?: string | undefined;
|
227
229
|
tokens?: string | undefined;
|
228
230
|
status?: string | undefined;
|
229
231
|
items?: number | undefined;
|
@@ -696,6 +698,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
696
698
|
query: {
|
697
699
|
sort?: string | undefined;
|
698
700
|
name?: string | undefined;
|
701
|
+
type?: string | undefined;
|
699
702
|
tokens?: string | undefined;
|
700
703
|
status?: string | undefined;
|
701
704
|
items?: number | undefined;
|
@@ -732,6 +735,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
732
735
|
query: {
|
733
736
|
sort?: string | undefined;
|
734
737
|
name?: string | undefined;
|
738
|
+
type?: string | undefined;
|
735
739
|
tokens?: string | undefined;
|
736
740
|
status?: string | undefined;
|
737
741
|
items?: number | undefined;
|
@@ -769,6 +773,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
769
773
|
query: {
|
770
774
|
sort?: string | undefined;
|
771
775
|
name?: string | undefined;
|
776
|
+
type?: string | undefined;
|
772
777
|
tokens?: string | undefined;
|
773
778
|
status?: string | undefined;
|
774
779
|
items?: number | undefined;
|
@@ -283,6 +283,7 @@ export declare const GetOpportunitiesQueryDto: import("@sinclair/typebox").TObje
|
|
283
283
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
284
284
|
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRegExp>;
|
285
285
|
action: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRegExp>;
|
286
|
+
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
286
287
|
creatorAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
287
288
|
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
288
289
|
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
@@ -58,6 +58,7 @@ export const GetOpportunitiesQueryDto = t.Object({
|
|
58
58
|
action: t.Optional(t.RegExp(/^(POOL|HOLD|DROP|LEND|BORROW)(,(POOL|HOLD|DROP|LEND|BORROW)){0,4}$/, {
|
59
59
|
description: "A comma seprated list actions. Legal values are: `POOL`, `HOLD`, `DROP`, `LEND`, `BORROW`",
|
60
60
|
})),
|
61
|
+
type: t.Optional(t.String({ description: "A comma separated list of Opportunity type" })),
|
61
62
|
creatorAddress: t.Optional(t.String({ description: "Filter by creator address" })),
|
62
63
|
tags: t.Optional(t.String({ description: "Filter by tag" })),
|
63
64
|
test: t.Optional(t.Boolean({ description: "Include opportunities with test campaigns" })),
|
@@ -241,6 +241,7 @@ export class OpportunityRepository {
|
|
241
241
|
const actions = query.action?.split(",");
|
242
242
|
const status = query.status?.split(",");
|
243
243
|
const tokens = query.tokens?.split(",");
|
244
|
+
const types = query.type?.split(",");
|
244
245
|
const protocols = query.mainProtocolId?.split(",");
|
245
246
|
const sort = (query.sort === "rewards" ? "dailyRewards" : query.sort) ?? "dailyRewards";
|
246
247
|
const order = query.order ?? "desc";
|
@@ -253,6 +254,7 @@ export class OpportunityRepository {
|
|
253
254
|
orderBy,
|
254
255
|
where: {
|
255
256
|
tags: !filters.tags ? undefined : { has: filters.tags },
|
257
|
+
type: !filters.type ? undefined : { in: types },
|
256
258
|
tvl: filters.minimumTvl ? { gte: filters.minimumTvl } : undefined,
|
257
259
|
chainId: !chainIds ? undefined : { in: chainIds },
|
258
260
|
name: !filters.name ? undefined : { contains: filters.name, mode: "insensitive" },
|
@@ -251,6 +251,10 @@ export declare enum modeCampaigns {
|
|
251
251
|
Kim_V4_WETH_MODE_Mode = "Kim V4 WETH/Mode 0x8cfE2A02dfBAbC56aE7e573170E35f88A38BeA55",
|
252
252
|
Kim_Steer_CRS_V2_KIM_MODE_Mode = "Kim Steer CRS V2 Kim/Mode 0x86D9d9dd7A2c3146c6FAd51646F210Cb2E5FC12F",
|
253
253
|
Kim_Steer_CRS_V2_and_EES_V2_WETH_USDT = "Kim Steer CRS V2 & EES V2 WETH/USDT 0xD8Abc2be7AD5D17940112969973357a3a3562998",
|
254
|
+
Kim_Ichi_SSD_Mode_Kim = "Kim Ichi SSD Mode/Kim 0x86d9d9dd7a2c3146c6fad51646f210cb2e5fc12f",
|
255
|
+
Kim_Steer_SSS_V2_weETH_ETH = "Kim Steer SSS V2 weETH/ETH 0xe24c8feb38ca2b18b542994bfba7e70880171035",
|
256
|
+
Kim_Ichi_SSD_wMLT_Mode = "Kim Ichi SSD wMLT/Mode 0xa186548320bdb79c714719e107ad5753ecb452d4",
|
257
|
+
Kim_Steer_CRS_V2_ezETH_ETH = "Kim Steer CRS V2 ezETH/ETH 0xd9a06f63e523757973ffd1a4606a1260252636d2",
|
254
258
|
Ironclad_Borrow_uniBTC_Mode = "Ironclad Borrow uniBTC 0x80215c38DCb6ae91520F8251A077c124e7259688",
|
255
259
|
Bedrock_Ionic_Supply_ionuniBTC_Mode = "Bedrock Ionic Supply uniBTC 0xa48750877a83f7dec11f722178c317b54a44d142",
|
256
260
|
Bedrock_Ironclad_Supply_uniBTC_Mode = "Bedrock Ironclad Supply uniBTC 0x0F041cf2ae959f39215EFfB50d681Df55D4d90B1"
|
@@ -256,6 +256,10 @@ export var modeCampaigns;
|
|
256
256
|
modeCampaigns["Kim_V4_WETH_MODE_Mode"] = "Kim V4 WETH/Mode 0x8cfE2A02dfBAbC56aE7e573170E35f88A38BeA55";
|
257
257
|
modeCampaigns["Kim_Steer_CRS_V2_KIM_MODE_Mode"] = "Kim Steer CRS V2 Kim/Mode 0x86D9d9dd7A2c3146c6FAd51646F210Cb2E5FC12F";
|
258
258
|
modeCampaigns["Kim_Steer_CRS_V2_and_EES_V2_WETH_USDT"] = "Kim Steer CRS V2 & EES V2 WETH/USDT 0xD8Abc2be7AD5D17940112969973357a3a3562998";
|
259
|
+
modeCampaigns["Kim_Ichi_SSD_Mode_Kim"] = "Kim Ichi SSD Mode/Kim 0x86d9d9dd7a2c3146c6fad51646f210cb2e5fc12f";
|
260
|
+
modeCampaigns["Kim_Steer_SSS_V2_weETH_ETH"] = "Kim Steer SSS V2 weETH/ETH 0xe24c8feb38ca2b18b542994bfba7e70880171035";
|
261
|
+
modeCampaigns["Kim_Ichi_SSD_wMLT_Mode"] = "Kim Ichi SSD wMLT/Mode 0xa186548320bdb79c714719e107ad5753ecb452d4";
|
262
|
+
modeCampaigns["Kim_Steer_CRS_V2_ezETH_ETH"] = "Kim Steer CRS V2 ezETH/ETH 0xd9a06f63e523757973ffd1a4606a1260252636d2";
|
259
263
|
modeCampaigns["Ironclad_Borrow_uniBTC_Mode"] = "Ironclad Borrow uniBTC 0x80215c38DCb6ae91520F8251A077c124e7259688";
|
260
264
|
modeCampaigns["Bedrock_Ionic_Supply_ionuniBTC_Mode"] = "Bedrock Ionic Supply uniBTC 0xa48750877a83f7dec11f722178c317b54a44d142";
|
261
265
|
modeCampaigns["Bedrock_Ironclad_Supply_uniBTC_Mode"] = "Bedrock Ironclad Supply uniBTC 0x0F041cf2ae959f39215EFfB50d681Df55D4d90B1";
|
@@ -1581,7 +1585,7 @@ const ModeInterfaceCampaigns = {
|
|
1581
1585
|
campaignType: Campaign.CLAMM,
|
1582
1586
|
computeChainId: ChainId.MODE,
|
1583
1587
|
hooks: [],
|
1584
|
-
poolAddress: "
|
1588
|
+
poolAddress: "0xd8abc2be7ad5d17940112969973357a3a3562998",
|
1585
1589
|
whitelist: ["0x879F9998c68cdaF28e4808fCc2b4f174c3CC5D97", "0x908731366f82668dDd3aE3B2498ADF52604E892d"],
|
1586
1590
|
blacklist: [],
|
1587
1591
|
url: "https://app.kim.exchange/liquidity/wizard?token0=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&token1=0xf0f161fda2712db8b566946122a5af183995e2ed",
|
@@ -1591,6 +1595,20 @@ const ModeInterfaceCampaigns = {
|
|
1591
1595
|
weightToken0: 4000,
|
1592
1596
|
weightToken1: 4000,
|
1593
1597
|
},
|
1598
|
+
[modeCampaigns.Kim_Ichi_SSD_Mode_Kim]: {
|
1599
|
+
campaignType: Campaign.CLAMM,
|
1600
|
+
computeChainId: ChainId.MODE,
|
1601
|
+
hooks: [],
|
1602
|
+
poolAddress: "0x86D9d9dd7A2c3146c6FAd51646F210Cb2E5FC12F",
|
1603
|
+
whitelist: ["0x70F4A63DD7e81Cf43B8b0E1cf09a8fc70B7C278b"],
|
1604
|
+
blacklist: [],
|
1605
|
+
url: "https://app.kim.exchange/pools/vaults/ichi/0x70f4a63dd7e81cf43b8b0e1cf09a8fc70b7c278b",
|
1606
|
+
forwarders: [],
|
1607
|
+
isOutOfRangeIncentivized: false,
|
1608
|
+
weightFees: 2000,
|
1609
|
+
weightToken0: 4000,
|
1610
|
+
weightToken1: 4000,
|
1611
|
+
},
|
1594
1612
|
[modeCampaigns.Kim_Gamma_WETH_KIM_Mode]: {
|
1595
1613
|
campaignType: Campaign.CLAMM,
|
1596
1614
|
computeChainId: ChainId.MODE,
|
@@ -1678,6 +1696,48 @@ const ModeInterfaceCampaigns = {
|
|
1678
1696
|
weightToken0: 4000,
|
1679
1697
|
weightToken1: 4000,
|
1680
1698
|
},
|
1699
|
+
[modeCampaigns.Kim_Steer_SSS_V2_weETH_ETH]: {
|
1700
|
+
campaignType: Campaign.CLAMM,
|
1701
|
+
computeChainId: ChainId.MODE,
|
1702
|
+
hooks: [],
|
1703
|
+
poolAddress: "0xE24C8feB38ca2B18b542994BFBA7E70880171035",
|
1704
|
+
whitelist: ["0x5Aa27D5d8aff8Cd5e683e23812124AcE4aA5af7D"],
|
1705
|
+
blacklist: [],
|
1706
|
+
url: "https://app.kim.exchange/pools/vaults/0x5aa27d5d8aff8cd5e683e23812124ace4aa5af7d",
|
1707
|
+
forwarders: [],
|
1708
|
+
isOutOfRangeIncentivized: false,
|
1709
|
+
weightFees: 2000,
|
1710
|
+
weightToken0: 4000,
|
1711
|
+
weightToken1: 4000,
|
1712
|
+
},
|
1713
|
+
[modeCampaigns.Kim_Steer_CRS_V2_ezETH_ETH]: {
|
1714
|
+
campaignType: Campaign.CLAMM,
|
1715
|
+
computeChainId: ChainId.MODE,
|
1716
|
+
hooks: [],
|
1717
|
+
poolAddress: "0xD9a06f63E523757973ffd1a4606A1260252636D2",
|
1718
|
+
whitelist: ["0x83556D8bBa69bdD159f50B2127ccc88bebF73e39"],
|
1719
|
+
blacklist: [],
|
1720
|
+
url: "https://app.kim.exchange/pools/vaults/0x83556d8bba69bdd159f50b2127ccc88bebf73e39",
|
1721
|
+
forwarders: [],
|
1722
|
+
isOutOfRangeIncentivized: false,
|
1723
|
+
weightFees: 2000,
|
1724
|
+
weightToken0: 4000,
|
1725
|
+
weightToken1: 4000,
|
1726
|
+
},
|
1727
|
+
[modeCampaigns.Kim_Ichi_SSD_wMLT_Mode]: {
|
1728
|
+
campaignType: Campaign.CLAMM,
|
1729
|
+
computeChainId: ChainId.MODE,
|
1730
|
+
hooks: [],
|
1731
|
+
poolAddress: "0xA186548320Bdb79c714719e107aD5753eCb452d4",
|
1732
|
+
whitelist: ["0x2660F0291F62FE9ce515b88B8080ce829e5c01c3"],
|
1733
|
+
blacklist: [],
|
1734
|
+
url: "https://app.kim.exchange/pools/vaults/ichi/0x2660f0291f62fe9ce515b88b8080ce829e5c01c3",
|
1735
|
+
forwarders: [],
|
1736
|
+
isOutOfRangeIncentivized: false,
|
1737
|
+
weightFees: 2000,
|
1738
|
+
weightToken0: 4000,
|
1739
|
+
weightToken1: 4000,
|
1740
|
+
},
|
1681
1741
|
[modeCampaigns.Kim_V4_WETH_MODE_Mode]: {
|
1682
1742
|
campaignType: Campaign.CLAMM,
|
1683
1743
|
computeChainId: ChainId.MODE,
|
@@ -123,6 +123,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
123
123
|
query: {
|
124
124
|
sort?: string | undefined;
|
125
125
|
name?: string | undefined;
|
126
|
+
type?: string | undefined;
|
126
127
|
tokens?: string | undefined;
|
127
128
|
status?: string | undefined;
|
128
129
|
items?: number | undefined;
|
@@ -239,6 +240,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
239
240
|
query: {
|
240
241
|
sort?: string | undefined;
|
241
242
|
name?: string | undefined;
|
243
|
+
type?: string | undefined;
|
242
244
|
tokens?: string | undefined;
|
243
245
|
status?: string | undefined;
|
244
246
|
items?: number | undefined;
|
@@ -711,6 +713,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
711
713
|
query: {
|
712
714
|
sort?: string | undefined;
|
713
715
|
name?: string | undefined;
|
716
|
+
type?: string | undefined;
|
714
717
|
tokens?: string | undefined;
|
715
718
|
status?: string | undefined;
|
716
719
|
items?: number | undefined;
|
@@ -747,6 +750,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
747
750
|
query: {
|
748
751
|
sort?: string | undefined;
|
749
752
|
name?: string | undefined;
|
753
|
+
type?: string | undefined;
|
750
754
|
tokens?: string | undefined;
|
751
755
|
status?: string | undefined;
|
752
756
|
items?: number | undefined;
|
@@ -784,6 +788,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
784
788
|
query: {
|
785
789
|
sort?: string | undefined;
|
786
790
|
name?: string | undefined;
|
791
|
+
type?: string | undefined;
|
787
792
|
tokens?: string | undefined;
|
788
793
|
status?: string | undefined;
|
789
794
|
items?: number | undefined;
|