@merkl/api 0.16.1 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database/api/.generated/drizzle/schema.d.ts +8 -9
- package/dist/database/api/.generated/drizzle/schema.js +2 -3
- package/dist/database/api/.generated/drizzle/schema.ts +2 -4
- package/dist/database/api/.generated/edge.js +5 -33
- package/dist/database/api/.generated/index-browser.js +2 -30
- package/dist/database/api/.generated/index.d.ts +123 -210
- package/dist/database/api/.generated/index.js +5 -33
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +2 -32
- package/dist/database/api/.generated/wasm.js +2 -30
- package/dist/src/constants.d.ts +259 -13
- package/dist/src/eden/index.d.ts +98 -98
- package/dist/src/index.d.ts +19 -19
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +6 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +4 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +6 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.d.ts +44 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.js +69 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/HourglassProcessor.d.ts +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/HourglassProcessor.js +31 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +5 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +10 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +6 -6
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +5 -65
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -34
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +7 -7
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +14 -15
- package/dist/src/modules/v4/campaign/campaign.service.js +6 -6
- package/dist/src/modules/v4/chain/chain.repository.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +2 -2
- package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +2 -58
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +2 -3
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -8
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +4 -13
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +9 -9
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +3 -31
- package/dist/src/modules/v4/opportunity/opportunity.model.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +33 -18
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +9 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +15 -15
- package/dist/src/modules/v4/opportunity/opportunity.service.js +3 -2
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +2 -2
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.js +3 -2
- package/dist/src/modules/v4/opportunity/validate-id.pipe.js +3 -3
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.repository.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.service.d.ts +8 -8
- package/dist/src/modules/v4/reward/reward.service.js +2 -2
- package/dist/src/modules/v4/router.d.ts +19 -19
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -2
- package/dist/src/utils/decodeCalls.js +9 -1
- package/dist/src/utils/encodeCalls.js +25 -1
- package/dist/src/utils/generateCardName.d.ts +1 -1
- package/dist/src/utils/generateCardName.js +17 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
@@ -166,7 +166,7 @@ declare const app: Elysia<"", false, {
|
|
166
166
|
depositUrl?: string | undefined;
|
167
167
|
protocols?: string[] | undefined;
|
168
168
|
mainProtocol?: string | undefined;
|
169
|
-
type:
|
169
|
+
type: string;
|
170
170
|
tokens: {
|
171
171
|
chainId: number;
|
172
172
|
address: string;
|
@@ -174,7 +174,7 @@ declare const app: Elysia<"", false, {
|
|
174
174
|
status: "NONE" | "PAST" | "LIVE" | "SOON";
|
175
175
|
identifier: string;
|
176
176
|
chainId: number;
|
177
|
-
action: "
|
177
|
+
action: "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "INVALID";
|
178
178
|
};
|
179
179
|
params: {};
|
180
180
|
query: unknown;
|
@@ -184,7 +184,7 @@ declare const app: Elysia<"", false, {
|
|
184
184
|
response: {
|
185
185
|
200: {
|
186
186
|
name: string;
|
187
|
-
type:
|
187
|
+
type: string;
|
188
188
|
id: string;
|
189
189
|
status: import("../database/api/.generated").$Enums.Status;
|
190
190
|
tags: string[];
|
@@ -218,7 +218,7 @@ declare const app: Elysia<"", false, {
|
|
218
218
|
200: {
|
219
219
|
id: string;
|
220
220
|
chainId: number;
|
221
|
-
type:
|
221
|
+
type: string;
|
222
222
|
identifier: string;
|
223
223
|
name: string;
|
224
224
|
status: "PAST" | "LIVE" | "SOON";
|
@@ -348,7 +348,7 @@ declare const app: Elysia<"", false, {
|
|
348
348
|
icon: string;
|
349
349
|
} | undefined;
|
350
350
|
name: string;
|
351
|
-
type:
|
351
|
+
type: string;
|
352
352
|
status: import("../database/api/.generated").$Enums.Status;
|
353
353
|
tags: string[];
|
354
354
|
identifier: string;
|
@@ -509,7 +509,7 @@ declare const app: Elysia<"", false, {
|
|
509
509
|
body: unknown;
|
510
510
|
params: {};
|
511
511
|
query: {
|
512
|
-
type?:
|
512
|
+
type?: string | undefined;
|
513
513
|
items?: number | undefined;
|
514
514
|
subType?: number | undefined;
|
515
515
|
page?: number | undefined;
|
@@ -646,12 +646,13 @@ declare const app: Elysia<"", false, {
|
|
646
646
|
computedUntil: bigint;
|
647
647
|
processingStarted: bigint;
|
648
648
|
};
|
649
|
+
creatorAddress: string;
|
649
650
|
Creator: {
|
650
651
|
tags: string[];
|
651
652
|
address: string;
|
652
653
|
creatorId: string | null;
|
653
654
|
};
|
654
|
-
type:
|
655
|
+
type: string;
|
655
656
|
id: string;
|
656
657
|
subType: number | null;
|
657
658
|
startTimestamp: bigint;
|
@@ -662,7 +663,6 @@ declare const app: Elysia<"", false, {
|
|
662
663
|
rewardTokenId: string;
|
663
664
|
amount: string;
|
664
665
|
opportunityId: string;
|
665
|
-
creatorAddress: string;
|
666
666
|
}[];
|
667
667
|
})[];
|
668
668
|
readonly 404: {
|
@@ -966,7 +966,7 @@ declare const app: Elysia<"", false, {
|
|
966
966
|
response: {
|
967
967
|
200: {
|
968
968
|
name: string;
|
969
|
-
type:
|
969
|
+
type: string;
|
970
970
|
id: string;
|
971
971
|
status: import("../database/api/.generated").$Enums.Status;
|
972
972
|
tags: string[];
|
@@ -1012,7 +1012,7 @@ declare const app: Elysia<"", false, {
|
|
1012
1012
|
};
|
1013
1013
|
response: {
|
1014
1014
|
200: {
|
1015
|
-
type:
|
1015
|
+
type: string;
|
1016
1016
|
id: string;
|
1017
1017
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
1018
1018
|
subType: number | null;
|
@@ -1063,7 +1063,7 @@ declare const app: Elysia<"", false, {
|
|
1063
1063
|
};
|
1064
1064
|
response: {
|
1065
1065
|
200: {
|
1066
|
-
type:
|
1066
|
+
type: string;
|
1067
1067
|
id: string;
|
1068
1068
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
1069
1069
|
subType: number | null;
|
@@ -1086,7 +1086,7 @@ declare const app: Elysia<"", false, {
|
|
1086
1086
|
body: unknown;
|
1087
1087
|
params: {};
|
1088
1088
|
query: {
|
1089
|
-
type?:
|
1089
|
+
type?: string | undefined;
|
1090
1090
|
items?: number | undefined;
|
1091
1091
|
subType?: number | undefined;
|
1092
1092
|
page?: number | undefined;
|
@@ -1138,12 +1138,13 @@ declare const app: Elysia<"", false, {
|
|
1138
1138
|
computedUntil: bigint;
|
1139
1139
|
processingStarted: bigint;
|
1140
1140
|
};
|
1141
|
+
creatorAddress: string;
|
1141
1142
|
Creator: {
|
1142
1143
|
tags: string[];
|
1143
1144
|
address: string;
|
1144
1145
|
creatorId: string | null;
|
1145
1146
|
};
|
1146
|
-
type:
|
1147
|
+
type: string;
|
1147
1148
|
id: string;
|
1148
1149
|
subType: number | null;
|
1149
1150
|
startTimestamp: bigint;
|
@@ -1154,7 +1155,6 @@ declare const app: Elysia<"", false, {
|
|
1154
1155
|
rewardTokenId: string;
|
1155
1156
|
amount: string;
|
1156
1157
|
opportunityId: string;
|
1157
|
-
creatorAddress: string;
|
1158
1158
|
}[];
|
1159
1159
|
};
|
1160
1160
|
};
|
@@ -1165,7 +1165,7 @@ declare const app: Elysia<"", false, {
|
|
1165
1165
|
body: unknown;
|
1166
1166
|
params: {};
|
1167
1167
|
query: {
|
1168
|
-
type?:
|
1168
|
+
type?: string | undefined;
|
1169
1169
|
items?: number | undefined;
|
1170
1170
|
subType?: number | undefined;
|
1171
1171
|
page?: number | undefined;
|
@@ -2547,7 +2547,7 @@ declare const app: Elysia<"", false, {
|
|
2547
2547
|
} | null;
|
2548
2548
|
} & {
|
2549
2549
|
name: string;
|
2550
|
-
type:
|
2550
|
+
type: string;
|
2551
2551
|
id: string;
|
2552
2552
|
status: import("../database/api/.generated").$Enums.Status;
|
2553
2553
|
tags: string[];
|
@@ -2660,7 +2660,7 @@ declare const app: Elysia<"", false, {
|
|
2660
2660
|
} | null;
|
2661
2661
|
} & {
|
2662
2662
|
name: string;
|
2663
|
-
type:
|
2663
|
+
type: string;
|
2664
2664
|
id: string;
|
2665
2665
|
status: import("../database/api/.generated").$Enums.Status;
|
2666
2666
|
tags: string[];
|
@@ -3166,7 +3166,7 @@ declare const app: Elysia<"", false, {
|
|
3166
3166
|
rewardTokenAddress?: string | undefined;
|
3167
3167
|
distributionChain?: {} | undefined;
|
3168
3168
|
opportunityIdentifier?: string | undefined;
|
3169
|
-
type:
|
3169
|
+
type: string;
|
3170
3170
|
params: {};
|
3171
3171
|
computeChainId: number;
|
3172
3172
|
};
|
@@ -3188,7 +3188,7 @@ declare const app: Elysia<"", false, {
|
|
3188
3188
|
body: unknown;
|
3189
3189
|
params: {};
|
3190
3190
|
query: {
|
3191
|
-
type?:
|
3191
|
+
type?: string | undefined;
|
3192
3192
|
items?: number | undefined;
|
3193
3193
|
subType?: number | undefined;
|
3194
3194
|
page?: number | undefined;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { merklChainDataWithCache } from "../../merklChainData";
|
2
2
|
import { TokenRepository } from "../../../modules/v4/token/token.repository";
|
3
3
|
import { log } from "../../../utils/logger";
|
4
|
-
import { BN2Number, BalancerPoolInterface, ChainInteractionService, ERC20Interface, EnzymeInterface, FactoryInterface, LayerBankERC20Interface, MetamorphoInterface, YEAR, getEnv, } from "@sdk";
|
4
|
+
import { BN2Number, BalancerPoolInterface, BalancerV3StablePoolInterface, ChainInteractionService, ERC20Interface, EnzymeInterface, FactoryInterface, LayerBankERC20Interface, MetamorphoInterface, YEAR, getEnv, } from "@sdk";
|
5
5
|
import { Pricer } from "../../../utils/pricer";
|
6
6
|
import { getLastEligibilityRatio } from "../utils/getLastEligibilityRatio";
|
7
7
|
import { getTVL } from "./ERC20SubTypes/helpers/getTVL";
|
@@ -55,6 +55,11 @@ export async function ERC20DynamicData(chainId, campaigns) {
|
|
55
55
|
callData: LayerBankERC20Interface.encodeFunctionData("owner"),
|
56
56
|
target: targetToken,
|
57
57
|
},
|
58
|
+
{
|
59
|
+
allowFailure: true,
|
60
|
+
callData: BalancerV3StablePoolInterface.encodeFunctionData("getVault"),
|
61
|
+
target: targetToken,
|
62
|
+
},
|
58
63
|
];
|
59
64
|
callsRounds1.push(...typeStruct.calls);
|
60
65
|
tokenTypesByCampaign[campaign.campaignId] = typeStruct;
|
@@ -26,6 +26,7 @@ const factoryAddresses = {
|
|
26
26
|
"0x7Ca46A636b02D4aBC66883D7FF164bDE506DC66a": tokenType.curveNPool, // Curve Corn 3crypto Factory
|
27
27
|
"0xbC0797015fcFc47d9C1856639CaE50D0e69FbEE8": tokenType.curveNPool, // Curve Arbitrum 3crypto Factory
|
28
28
|
"0xA5961898870943c68037F6848d2D866Ed2016bcB": tokenType.curveNPool, // Curve Base
|
29
|
+
"0xB255D6A720BB7c39fee173cE22113397119cB930": tokenType.katana, // Katana Ronin
|
29
30
|
};
|
30
31
|
export function getTypeFromFactoryAddress(address) {
|
31
32
|
if (factoryAddresses[address]) {
|
@@ -86,7 +86,10 @@ export declare enum tokenType {
|
|
86
86
|
vicuna_lending = "vicuna_lending",
|
87
87
|
vicuna_borrowing = "vicuna_borrowing",
|
88
88
|
spectra_lpt = "spectra_lpt",
|
89
|
-
spectra_yt = "spectra_yt"
|
89
|
+
spectra_yt = "spectra_yt",
|
90
|
+
hourglass = "hourglass",
|
91
|
+
katana = "katana",
|
92
|
+
balancerV3 = "balancerV3"
|
90
93
|
}
|
91
94
|
export declare const tokenTypeToProtocol: {
|
92
95
|
[key in tokenType]: {
|
@@ -88,6 +88,9 @@ export var tokenType;
|
|
88
88
|
tokenType["vicuna_borrowing"] = "vicuna_borrowing";
|
89
89
|
tokenType["spectra_lpt"] = "spectra_lpt";
|
90
90
|
tokenType["spectra_yt"] = "spectra_yt";
|
91
|
+
tokenType["hourglass"] = "hourglass";
|
92
|
+
tokenType["katana"] = "katana";
|
93
|
+
tokenType["balancerV3"] = "balancerV3";
|
91
94
|
})(tokenType || (tokenType = {}));
|
92
95
|
export const tokenTypeToProtocol = {
|
93
96
|
[tokenType.aave_borrowing]: { protocol: "Aave", action: OpportunityAction.BORROW },
|
@@ -176,4 +179,7 @@ export const tokenTypeToProtocol = {
|
|
176
179
|
[tokenType.spectra_lpt]: { protocol: "Spectra", action: OpportunityAction.POOL },
|
177
180
|
[tokenType.spectra_yt]: { protocol: "Spectra", action: OpportunityAction.POOL },
|
178
181
|
[tokenType.rfx_slv]: { protocol: "RFX", action: OpportunityAction.POOL },
|
182
|
+
[tokenType.hourglass]: { protocol: "Hourglass", action: OpportunityAction.HOLD },
|
183
|
+
[tokenType.katana]: { protocol: "Katana", action: OpportunityAction.POOL },
|
184
|
+
[tokenType.balancerV3]: { protocol: "Balancer", action: OpportunityAction.POOL },
|
179
185
|
};
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.d.ts
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
import type { Pricer } from "../../../../../utils/pricer";
|
2
|
+
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
|
+
import type { BigNumber } from "ethers";
|
4
|
+
import type { tokenType, tokenTypeStruct } from "../helpers/tokenType";
|
5
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
6
|
+
type callType = {
|
7
|
+
key: keyof dataRawBalancerV3;
|
8
|
+
call: string;
|
9
|
+
target: keyof callKeysBalancerV3;
|
10
|
+
metaData?: keyof callKeysBalancerV3 | string;
|
11
|
+
optional?: boolean;
|
12
|
+
};
|
13
|
+
type callKeysBalancerV3 = mandatoryCallKeys & {
|
14
|
+
[key: `token${number}`]: string;
|
15
|
+
[key: `symbolToken${number}`]: string;
|
16
|
+
[key: `decimalsToken${number}`]: string;
|
17
|
+
[key: `${number}`]: string;
|
18
|
+
name: string;
|
19
|
+
};
|
20
|
+
type dataRawBalancerV3 = callKeysBalancerV3 & {
|
21
|
+
numberTokens: number;
|
22
|
+
[key: `balanceToken${number}`]: BigNumber;
|
23
|
+
tokenInfo: {
|
24
|
+
tokens: string[];
|
25
|
+
tokenInfo: string[][];
|
26
|
+
balancesRaw: BigNumber[];
|
27
|
+
lastBalancesLiveScaled18: BigNumber[];
|
28
|
+
};
|
29
|
+
};
|
30
|
+
type dataTypeBalancerV3 = dataType & {
|
31
|
+
numberTokens: number;
|
32
|
+
};
|
33
|
+
export declare class BalancerV3PoolProcessor extends GenericProcessor<callKeysBalancerV3, dataRawBalancerV3, dataTypeBalancerV3> {
|
34
|
+
rounds: {
|
35
|
+
round1: callType[];
|
36
|
+
round2: callType[];
|
37
|
+
round3: callType[];
|
38
|
+
round4: callType[];
|
39
|
+
};
|
40
|
+
processingRound2(typeInfo: dataRawBalancerV3): void;
|
41
|
+
computeRound3(index: number, type: tokenType, typeInfo: dataRawBalancerV3, calls: string[]): tokenTypeStruct;
|
42
|
+
processingRound5(_index: number, type: tokenType, typeInfo: dataRawBalancerV3, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeBalancerV3>;
|
43
|
+
}
|
44
|
+
export {};
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.js
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { BN2Number } from "@sdk";
|
3
|
+
import { GenericProcessor } from "./GenericProcessor";
|
4
|
+
const matchSingleNumber = (input) => {
|
5
|
+
const regex = /^\d+$/;
|
6
|
+
return regex.test(input);
|
7
|
+
};
|
8
|
+
export class BalancerV3PoolProcessor extends GenericProcessor {
|
9
|
+
rounds = {
|
10
|
+
round1: [
|
11
|
+
{ key: "numberTokens", call: "getTokens", target: "tokenAddress" },
|
12
|
+
{ key: "tokenInfo", call: "getTokenInfo", target: "tokenAddress" },
|
13
|
+
],
|
14
|
+
round2: [],
|
15
|
+
round3: [],
|
16
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
17
|
+
};
|
18
|
+
// override computeRound1(): void {}
|
19
|
+
processingRound2(typeInfo) {
|
20
|
+
typeInfo.numberTokens = Number(typeInfo.numberTokens);
|
21
|
+
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
22
|
+
typeInfo[`token${i}`] = typeInfo.tokenInfo.tokens[i];
|
23
|
+
this.rounds.round2 = this.rounds.round2.concat([
|
24
|
+
{ key: `symbolToken${i}`, call: "symbol", target: `token${i}` },
|
25
|
+
{ key: `decimalsToken${i}`, call: "decimals", target: `token${i}` },
|
26
|
+
]);
|
27
|
+
typeInfo[`balanceToken${i}`] = typeInfo.tokenInfo.balancesRaw[i];
|
28
|
+
}
|
29
|
+
}
|
30
|
+
computeRound3(index, type, typeInfo, calls) {
|
31
|
+
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
32
|
+
this.rounds.round2 = this.rounds.round2.concat([
|
33
|
+
{ key: `symbolToken${i}`, call: "symbol", target: `token${i}` },
|
34
|
+
{ key: `decimalsToken${i}`, call: "decimals", target: `token${i}` },
|
35
|
+
]);
|
36
|
+
}
|
37
|
+
return super.computeRound3(index, type, typeInfo, calls);
|
38
|
+
}
|
39
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
40
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
41
|
+
let tvl = 0;
|
42
|
+
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
43
|
+
const symbol = typeInfo[`symbolToken${i}`];
|
44
|
+
const price = (await pricer.get({ symbol: symbol })) ?? 0;
|
45
|
+
const decimals = Number(typeInfo[`decimalsToken${i}`]);
|
46
|
+
const amount = BN2Number(typeInfo[`balanceToken${i}`], decimals);
|
47
|
+
tvl += amount * price;
|
48
|
+
}
|
49
|
+
const priceTargetToken = tvl / totalSupply;
|
50
|
+
// Remove all keys that start with a number or balanceToken
|
51
|
+
for (const key in typeInfo) {
|
52
|
+
if (key.startsWith("balanceToken") ||
|
53
|
+
key.startsWith("decimalsToken") ||
|
54
|
+
matchSingleNumber(key) ||
|
55
|
+
key.startsWith("tokenInfo")) {
|
56
|
+
delete typeInfo[key];
|
57
|
+
}
|
58
|
+
}
|
59
|
+
return {
|
60
|
+
...typeInfo,
|
61
|
+
totalSupply,
|
62
|
+
tvl,
|
63
|
+
whitelistedSupplyTargetToken,
|
64
|
+
blacklistedSupply,
|
65
|
+
priceTargetToken,
|
66
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
67
|
+
};
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import type { Pricer } from "../../../../../utils/pricer";
|
2
|
+
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
|
+
import type { BigNumber } from "ethers";
|
4
|
+
import type { tokenType } from "../helpers/tokenType";
|
5
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
6
|
+
type callType = {
|
7
|
+
key: keyof dataRawHourglass;
|
8
|
+
call: string;
|
9
|
+
target: keyof callKeysHourglass;
|
10
|
+
metaData?: keyof callKeysHourglass;
|
11
|
+
};
|
12
|
+
export type callKeysHourglass = mandatoryCallKeys & {
|
13
|
+
depositor: string;
|
14
|
+
underlying: string;
|
15
|
+
symbolUnderlyingToken: string;
|
16
|
+
decimalsUnderlying: string;
|
17
|
+
balanceOfUnderlying: string;
|
18
|
+
};
|
19
|
+
type dataRawHourglass = callKeysHourglass & {};
|
20
|
+
type dataTypeHourglass = dataType & {
|
21
|
+
underlying: string;
|
22
|
+
symbolUnderlyingToken: string;
|
23
|
+
decimalsUnderlying: number;
|
24
|
+
priceTargetToken: number;
|
25
|
+
balanceOfUnderlying: BigNumber;
|
26
|
+
};
|
27
|
+
export declare class HourglassProcessor extends GenericProcessor<callKeysHourglass, dataRawHourglass, dataTypeHourglass> {
|
28
|
+
rounds: {
|
29
|
+
round1: callType[];
|
30
|
+
round2: callType[];
|
31
|
+
round3: callType[];
|
32
|
+
round4: callType[];
|
33
|
+
};
|
34
|
+
processingRound5(_index: number, type: tokenType, typeInfo: dataRawHourglass, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeHourglass>;
|
35
|
+
}
|
36
|
+
export {};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { BN2Number } from "@sdk";
|
3
|
+
import { GenericProcessor } from "./GenericProcessor";
|
4
|
+
export class HourglassProcessor extends GenericProcessor {
|
5
|
+
rounds = {
|
6
|
+
round1: [{ key: "depositor", call: "depositor", target: "tokenAddress" }],
|
7
|
+
round2: [{ key: "underlying", call: "underlying", target: "depositor" }],
|
8
|
+
round3: [
|
9
|
+
{ key: "symbolUnderlyingToken", call: "symbol", target: "underlying" },
|
10
|
+
{ key: "decimalsUnderlying", call: "decimals", target: "underlying" },
|
11
|
+
{ key: "balanceOfUnderlying", call: "balanceOf", target: "underlying", metaData: "depositor" },
|
12
|
+
],
|
13
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
14
|
+
};
|
15
|
+
// // override computeRound1(): void {}
|
16
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
17
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
18
|
+
const priceUnderlying = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 0;
|
19
|
+
const tvl = BN2Number(typeInfo.balanceOfUnderlying, Number(typeInfo.decimalsUnderlying)) * priceUnderlying;
|
20
|
+
const priceTargetToken = tvl / totalSupply;
|
21
|
+
return {
|
22
|
+
...typeInfo,
|
23
|
+
whitelistedSupplyTargetToken,
|
24
|
+
tvl: tvl,
|
25
|
+
priceTargetToken,
|
26
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
27
|
+
blacklistedSupply,
|
28
|
+
totalSupply,
|
29
|
+
};
|
30
|
+
}
|
31
|
+
}
|
@@ -5,6 +5,7 @@ import { AssetProcessor } from "./AssetProcessor";
|
|
5
5
|
import { AuraProcessor } from "./AuraProcessor";
|
6
6
|
import { BalancerGaugeProcessor } from "./BalancerGaugeProcessor";
|
7
7
|
import { BalancerPoolProcessor } from "./BalancerPoolProcessor";
|
8
|
+
import { BalancerV3PoolProcessor } from "./BalancerV3PoolProcessor";
|
8
9
|
import { BeefyProcessor } from "./BeefyProcessor";
|
9
10
|
import { CompoundProcessor } from "./CompoundProcessor";
|
10
11
|
import { ERC4626Processor } from "./ERC4626Processor";
|
@@ -18,6 +19,7 @@ import { GammaProcessor } from "./GammaProcessor";
|
|
18
19
|
import { GearboxProcessor } from "./GearboxProcessor";
|
19
20
|
import { GenericProcessor } from "./GenericProcessor";
|
20
21
|
import { HoldStationProcessor } from "./HoldStationProcessor";
|
22
|
+
import { HourglassProcessor } from "./HourglassProcessor";
|
21
23
|
import { MaverickBPProcessor } from "./MaverickBPProcessor";
|
22
24
|
import { MetamorphoProcessor } from "./MetamorphoProcessor";
|
23
25
|
import { NoLinkVaultProcessor } from "./NoLinkVaultProcessor";
|
@@ -127,4 +129,7 @@ export const processorMapping = {
|
|
127
129
|
[tokenType.spectra_lpt]: SpectraProcessor,
|
128
130
|
[tokenType.spectra_yt]: SpectraYTProcessor,
|
129
131
|
[tokenType.rfx_slv]: ERC4626Processor,
|
132
|
+
[tokenType.hourglass]: HourglassProcessor,
|
133
|
+
[tokenType.katana]: UniswapProcessor,
|
134
|
+
[tokenType.balancerV3]: BalancerV3PoolProcessor,
|
130
135
|
};
|
@@ -8,6 +8,8 @@ import { processorMapping } from "./processor/processorMapping";
|
|
8
8
|
function satisfiesNameConditions(name, type) {
|
9
9
|
const lowerCaseName = name.toLowerCase();
|
10
10
|
switch (type) {
|
11
|
+
case tokenType.hourglass:
|
12
|
+
return lowerCaseName.startsWith("ct-hourglass");
|
11
13
|
case tokenType.fraxlend:
|
12
14
|
return lowerCaseName.includes("fraxlend interest bearing");
|
13
15
|
case tokenType.sturdy_aggregator:
|
@@ -244,6 +246,13 @@ function parseForBalancer(calls, targetToken, name) {
|
|
244
246
|
catch (e) {
|
245
247
|
// Not a balancer pool
|
246
248
|
}
|
249
|
+
try {
|
250
|
+
decodeReturnValue(calls.vault, "getVault");
|
251
|
+
return generateResult(tokenType.balancerV3, name, targetToken, {});
|
252
|
+
}
|
253
|
+
catch (e) {
|
254
|
+
// Not a balancer v3 pool
|
255
|
+
}
|
247
256
|
}
|
248
257
|
function checkAgainstHardcoded(calls, chainId, targetToken) {
|
249
258
|
// Check for balancer pools
|
@@ -284,6 +293,7 @@ export function getTokenTypeRound1(calls, targetToken, index, campaign) {
|
|
284
293
|
poolId: returnValueOfCalls[index + 3],
|
285
294
|
creator: returnValueOfCalls[index + 4],
|
286
295
|
owner: returnValueOfCalls[index + 5],
|
296
|
+
vault: returnValueOfCalls[index + 6],
|
287
297
|
};
|
288
298
|
let result = parseForFactory(returnValue, targetToken);
|
289
299
|
if (result)
|
@@ -38,7 +38,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
38
38
|
};
|
39
39
|
response: {
|
40
40
|
200: {
|
41
|
-
type:
|
41
|
+
type: string;
|
42
42
|
id: string;
|
43
43
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
44
44
|
subType: number | null;
|
@@ -89,7 +89,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
89
89
|
};
|
90
90
|
response: {
|
91
91
|
200: {
|
92
|
-
type:
|
92
|
+
type: string;
|
93
93
|
id: string;
|
94
94
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
95
95
|
subType: number | null;
|
@@ -112,7 +112,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
112
112
|
body: unknown;
|
113
113
|
params: {};
|
114
114
|
query: {
|
115
|
-
type?:
|
115
|
+
type?: string | undefined;
|
116
116
|
items?: number | undefined;
|
117
117
|
subType?: number | undefined;
|
118
118
|
page?: number | undefined;
|
@@ -164,12 +164,13 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
164
164
|
computedUntil: bigint;
|
165
165
|
processingStarted: bigint;
|
166
166
|
};
|
167
|
+
creatorAddress: string;
|
167
168
|
Creator: {
|
168
169
|
tags: string[];
|
169
170
|
address: string;
|
170
171
|
creatorId: string | null;
|
171
172
|
};
|
172
|
-
type:
|
173
|
+
type: string;
|
173
174
|
id: string;
|
174
175
|
subType: number | null;
|
175
176
|
startTimestamp: bigint;
|
@@ -180,7 +181,6 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
180
181
|
rewardTokenId: string;
|
181
182
|
amount: string;
|
182
183
|
opportunityId: string;
|
183
|
-
creatorAddress: string;
|
184
184
|
}[];
|
185
185
|
};
|
186
186
|
};
|
@@ -191,7 +191,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
191
191
|
body: unknown;
|
192
192
|
params: {};
|
193
193
|
query: {
|
194
|
-
type?:
|
194
|
+
type?: string | undefined;
|
195
195
|
items?: number | undefined;
|
196
196
|
subType?: number | undefined;
|
197
197
|
page?: number | undefined;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import type { Resource } from "../prisma";
|
2
2
|
import { type Token } from "../token";
|
3
|
-
import {
|
4
|
-
import { type CampaignParameters } from "@sdk";
|
3
|
+
import type { Campaign as CampaignEnum, CampaignParameters } from "@sdk";
|
5
4
|
import { type Chain } from "../chain/chain.model";
|
6
5
|
import { type Status } from "../status/status.model";
|
7
6
|
/**
|
@@ -9,46 +8,15 @@ import { type Status } from "../status/status.model";
|
|
9
8
|
* @description Target description of rewards campaigns
|
10
9
|
* @see {@link Resource}
|
11
10
|
*/
|
12
|
-
export type Campaign
|
11
|
+
export type Campaign = Resource<"Campaign", "opportunityId" | "rewardTokenId" | "params", {
|
13
12
|
chain: Chain["model"];
|
14
13
|
rewardToken: Token["model"];
|
15
14
|
distributionChain?: Chain["model"];
|
16
15
|
campaignStatus?: Status["model"];
|
17
16
|
}>;
|
18
|
-
export type CampaignWithParams<C extends
|
19
|
-
params: CampaignParameters<
|
17
|
+
export type CampaignWithParams<C extends CampaignEnum = CampaignEnum> = Campaign & Resource<"Campaign", "opportunityId" | "rewardTokenId" | (keyof Campaign["model"] & keyof Resource<"Campaign">), {
|
18
|
+
params: CampaignParameters<C>["campaignParameters"];
|
20
19
|
}>;
|
21
|
-
export declare const campaignTypeToEnumMap: {
|
22
|
-
readonly INVALID: any;
|
23
|
-
readonly CLAMM: any;
|
24
|
-
readonly ERC20: any;
|
25
|
-
readonly BADGER: any;
|
26
|
-
readonly AJNA: any;
|
27
|
-
readonly COMPOUND: any;
|
28
|
-
readonly EULER: any;
|
29
|
-
readonly DOLOMITE: any;
|
30
|
-
readonly ERC20_SNAPSHOT: any;
|
31
|
-
readonly MORPHO: any;
|
32
|
-
readonly RADIANT: any;
|
33
|
-
readonly SILO: any;
|
34
|
-
readonly JSON_AIRDROP: any;
|
35
|
-
readonly UNISWAP_V4: any;
|
36
|
-
readonly EIGENLAYER: any;
|
37
|
-
readonly VEST: any;
|
38
|
-
readonly ERC20LOGPROCESSOR: any;
|
39
|
-
readonly ERC20REBASELOGPROCESSOR: any;
|
40
|
-
readonly ION: any;
|
41
|
-
readonly ERC20TRANSFERS: any;
|
42
|
-
readonly ERC20_FIX_APR: any;
|
43
|
-
readonly HYPERDRIVELOGPROCESSOR: any;
|
44
|
-
readonly HYPERDRIVELOGFIXPROCESSOR: any;
|
45
|
-
readonly AMBIENTPROCESSOR: any;
|
46
|
-
readonly M0: any;
|
47
|
-
readonly MORPHOSUPPLY: any;
|
48
|
-
readonly SYNCSWAP_VAULT: any;
|
49
|
-
readonly UNISWAP_V4_LP: any;
|
50
|
-
};
|
51
|
-
export type ConvertedCampaignType<C extends CampaignType> = (typeof campaignTypeToEnumMap)[C];
|
52
20
|
export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
|
53
21
|
distributionChain: import("@sinclair/typebox").TNumber;
|
54
22
|
campaignId: import("@sinclair/typebox").TString;
|
@@ -130,35 +98,7 @@ export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
|
|
130
98
|
creatorAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
131
99
|
creatorId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
132
100
|
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
133
|
-
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").
|
134
|
-
INVALID: "INVALID";
|
135
|
-
ERC20: "ERC20";
|
136
|
-
CLAMM: "CLAMM";
|
137
|
-
ERC20_SNAPSHOT: "ERC20_SNAPSHOT";
|
138
|
-
JSON_AIRDROP: "JSON_AIRDROP";
|
139
|
-
SILO: "SILO";
|
140
|
-
RADIANT: "RADIANT";
|
141
|
-
MORPHO: "MORPHO";
|
142
|
-
DOLOMITE: "DOLOMITE";
|
143
|
-
BADGER: "BADGER";
|
144
|
-
COMPOUND: "COMPOUND";
|
145
|
-
AJNA: "AJNA";
|
146
|
-
EULER: "EULER";
|
147
|
-
UNISWAP_V4: "UNISWAP_V4";
|
148
|
-
ION: "ION";
|
149
|
-
EIGENLAYER: "EIGENLAYER";
|
150
|
-
ERC20TRANSFERS: "ERC20TRANSFERS";
|
151
|
-
ERC20LOGPROCESSOR: "ERC20LOGPROCESSOR";
|
152
|
-
ERC20REBASELOGPROCESSOR: "ERC20REBASELOGPROCESSOR";
|
153
|
-
VEST: "VEST";
|
154
|
-
ERC20_FIX_APR: "ERC20_FIX_APR";
|
155
|
-
HYPERDRIVELOGPROCESSOR: "HYPERDRIVELOGPROCESSOR";
|
156
|
-
HYPERDRIVELOGFIXPROCESSOR: "HYPERDRIVELOGFIXPROCESSOR";
|
157
|
-
AMBIENTPROCESSOR: "AMBIENTPROCESSOR";
|
158
|
-
M0: "M0";
|
159
|
-
MORPHOSUPPLY: "MORPHOSUPPLY";
|
160
|
-
SYNCSWAP_VAULT: "SYNCSWAP_VAULT";
|
161
|
-
}>>;
|
101
|
+
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
162
102
|
subType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
163
103
|
campaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
164
104
|
mainParameter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|