@merkl/api 0.16.21 → 0.16.23
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 +82 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor/GenericProcessor.d.ts → GenericProcessor.d.ts} +21 -14
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor/GenericProcessor.js → GenericProcessor.js} +45 -38
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/AaveProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/AaveProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/AnglesLiquid.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/AnglesLiquid.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/AssetProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/AssetProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/AuraProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/AuraProcessor.js +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/BalancerGaugeProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/BalancerGaugeProcessor.js +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/BalancerPoolProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/BalancerPoolProcessor.js +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/BalancerV3PoolProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/BalancerV3PoolProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/BeefyProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/BeefyProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/CompoundProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/CompoundProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/ERC4626Processor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/ERC4626Processor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/EnzymeProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/EnzymeProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/EqualizerGaugeProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/EqualizerGaugeProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/EulerBorrowProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/EulerBorrowProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/EulerLendProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/EulerLendProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/FluidProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/FluidProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/FraxProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/FraxProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/GammaProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/GammaProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/GearboxProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/GearboxProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/HoldStationProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/HoldStationProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/HourglassProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/HourglassProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/MaverickBPProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/MaverickBPProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/MetamorphoProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/MetamorphoProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/NoLinkVaultProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/NoLinkVaultProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/PendleProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/PendleProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/PendleYTProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/PendleYTProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/RadiantProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/RadiantProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/RfxProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/RfxProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/Satlayer.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/Satlayer.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/SpectraProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/SpectraProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/SpectraYTProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/SpectraYTProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/SpliceProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/SpliceProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/StakingProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/StakingProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/SturdySiloProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/SturdySiloProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/TempestVaultProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/TempestVaultProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/TemplateProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/TemplateProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/TorosProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/TorosProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/UniswapProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/UniswapProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/VicunaProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/VicunaProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/WoofiProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/WoofiProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/ZkSwapThreePoolProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/ZkSwapThreePoolProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/curveNPoolProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/curveNPoolProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/curveProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/curveProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/processorMapping.d.ts +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/processorMapping.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/stakedCurveProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/{processor → implementations}/stakedCurveProcessor.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.d.ts +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/UniswapV4DynamicData.js +23 -15
- package/dist/src/modules/v4/router.d.ts +22 -0
- package/dist/src/modules/v4/status/status.controller.d.ts +22 -0
- package/dist/src/modules/v4/status/status.controller.js +10 -1
- package/dist/src/modules/v4/status/status.model.d.ts +3 -0
- package/dist/src/modules/v4/status/status.model.js +1 -0
- package/dist/src/modules/v4/status/status.repository.d.ts +3 -9
- package/dist/src/modules/v4/status/status.repository.js +16 -6
- package/dist/src/modules/v4/status/status.service.d.ts +1 -0
- package/dist/src/modules/v4/status/status.service.js +13 -0
- package/dist/src/utils/generateIcons.js +7 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/internal/controllers/endingCampaigns.d.ts +0 -43
- package/dist/src/internal/controllers/endingCampaigns.js +0 -41
- package/dist/src/internal/controllers/unclaimed.d.ts +0 -44
- package/dist/src/internal/controllers/unclaimed.js +0 -36
- package/dist/src/internal/index.d.ts +0 -1
- package/dist/src/internal/index.js +0 -34
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Pricer } from "../../../../../utils/pricer";
|
2
2
|
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
|
3
4
|
import type { tokenType, tokenTypeStruct } from "../helpers/tokenType";
|
4
|
-
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
5
5
|
type callType = {
|
6
6
|
key: keyof dataRawCurveN;
|
7
7
|
call: string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
2
|
import { BN2Number } from "@sdk";
|
3
|
-
import { GenericProcessor } from "
|
3
|
+
import { GenericProcessor } from "../GenericProcessor";
|
4
4
|
const matchSingleNumber = (input) => {
|
5
5
|
const regex = /^\d+$/;
|
6
6
|
return regex.test(input);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Pricer } from "../../../../../utils/pricer";
|
2
2
|
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
|
3
4
|
import { tokenType } from "../helpers/tokenType";
|
4
|
-
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
5
5
|
type callType = {
|
6
6
|
key: keyof dataRawCurve;
|
7
7
|
call: string;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
2
|
import { BN2Number } from "@sdk";
|
3
|
+
import { GenericProcessor } from "../GenericProcessor";
|
3
4
|
import { tokenType } from "../helpers/tokenType";
|
4
|
-
import { GenericProcessor } from "./GenericProcessor";
|
5
5
|
export class CurveProcessor extends GenericProcessor {
|
6
6
|
rounds = {
|
7
7
|
round1: [
|
@@ -1,6 +1,6 @@
|
|
1
|
+
import { GenericProcessor } from "../GenericProcessor";
|
2
|
+
import type { callKeys, dataRaw, dataType } from "../GenericProcessor";
|
1
3
|
import { tokenType } from "../helpers/tokenType";
|
2
|
-
import { GenericProcessor } from "./GenericProcessor";
|
3
|
-
import type { callKeys, dataRaw, dataType } from "./GenericProcessor";
|
4
4
|
export declare const processorMapping: {
|
5
5
|
[key in tokenType]: typeof GenericProcessor<callKeys, dataRaw, dataType>;
|
6
6
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { GenericProcessor } from "../GenericProcessor";
|
1
2
|
import { tokenType } from "../helpers/tokenType";
|
2
3
|
import { AaveProcessor } from "./AaveProcessor";
|
3
4
|
import { AnglesLiquidProcessor } from "./AnglesLiquid";
|
@@ -17,7 +18,6 @@ import { FluidProcessor } from "./FluidProcessor";
|
|
17
18
|
import { FraxProcessor } from "./FraxProcessor";
|
18
19
|
import { GammaProcessor } from "./GammaProcessor";
|
19
20
|
import { GearboxProcessor } from "./GearboxProcessor";
|
20
|
-
import { GenericProcessor } from "./GenericProcessor";
|
21
21
|
import { HoldStationProcessor } from "./HoldStationProcessor";
|
22
22
|
import { HourglassProcessor } from "./HourglassProcessor";
|
23
23
|
import { MaverickBPProcessor } from "./MaverickBPProcessor";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Pricer } from "../../../../../utils/pricer";
|
2
2
|
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
|
3
4
|
import { tokenType } from "../helpers/tokenType";
|
4
|
-
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
5
5
|
type callType = {
|
6
6
|
key: keyof dataRawStakedCurve;
|
7
7
|
call: string;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
2
|
import { BN2Number } from "@sdk";
|
3
3
|
import { BigNumber } from "ethers";
|
4
|
+
import { GenericProcessor } from "../GenericProcessor";
|
4
5
|
import { tokenType } from "../helpers/tokenType";
|
5
|
-
import { GenericProcessor } from "./GenericProcessor";
|
6
6
|
export class StakedCurveProcessor extends GenericProcessor {
|
7
7
|
rounds = {
|
8
8
|
round1: [{ key: "underlying", call: "underlying", target: "tokenAddress" }],
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { tokenType } from "./helpers/tokenType";
|
2
|
-
import { processorMapping } from "./
|
2
|
+
import { processorMapping } from "./implementations/processorMapping";
|
3
3
|
export async function getTokenPricesInfo(index, type, typeInfo, calls, campaign, pricer) {
|
4
4
|
const ProcessorClass = processorMapping[type];
|
5
5
|
try {
|
@@ -4,7 +4,7 @@ import { enzymeFundValueCalculatorRouterMapping, getTypeFromFactoryAddress } fro
|
|
4
4
|
import { getTypeFromAddressChain } from "./helpers/hardcoded";
|
5
5
|
import { getTypeFromOwnerAddress } from "./helpers/ownerFinder";
|
6
6
|
import { tokenType } from "./helpers/tokenType";
|
7
|
-
import { processorMapping } from "./
|
7
|
+
import { processorMapping } from "./implementations/processorMapping";
|
8
8
|
function satisfiesNameConditions(name, type) {
|
9
9
|
const lowerCaseName = name.toLowerCase();
|
10
10
|
switch (type) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { processorMapping } from "./
|
1
|
+
import { processorMapping } from "./implementations/processorMapping";
|
2
2
|
export function getTokenTypeRound2(index, type, typeInfo, calls, campaign) {
|
3
3
|
try {
|
4
4
|
const returnValueOfCalls = calls.map(call => call.returnData);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { processorMapping } from "./
|
1
|
+
import { processorMapping } from "./implementations/processorMapping";
|
2
2
|
export function getTokenTypeRound4(index, type, typeInfo, calls, campaign) {
|
3
3
|
try {
|
4
4
|
const ProcessorClass = processorMapping[type];
|
@@ -12,22 +12,30 @@ const CALLS_LENGTH = 2;
|
|
12
12
|
* it's only an estimate
|
13
13
|
*/
|
14
14
|
async function computeUniV4PoolTVLFromMostRecentStateSave(chainId, poolID, priceCurrency0, priceCurrency1, decimalsCurrency0, decimalsCurrency1) {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
let stateSave;
|
16
|
+
let blockNumber;
|
17
|
+
let states = {};
|
18
|
+
try {
|
19
|
+
const currentBlock = await ChainInteractionService(chainId).getBlockNumber();
|
20
|
+
const mostRecentStateSave = await engineDbClient.stateSave.findFirst({
|
21
|
+
where: {
|
22
|
+
id: `UniswapV4_${chainId}_${poolID}`,
|
23
|
+
blockNumber: {
|
24
|
+
lte: currentBlock,
|
25
|
+
},
|
21
26
|
},
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
orderBy: {
|
28
|
+
blockNumber: "desc",
|
29
|
+
},
|
30
|
+
});
|
31
|
+
stateSave = mostRecentStateSave.state;
|
32
|
+
blockNumber = mostRecentStateSave?.blockNumber;
|
33
|
+
states = stateSave.states;
|
34
|
+
// const globalState = stateSave.globalState as { tick: number; liquidity: string };
|
35
|
+
}
|
36
|
+
catch (e) {
|
37
|
+
log.warn(`merklDynamic data - failed to read a recent state of pool ${poolID} on ${NETWORK_LABELS[chainId]}`);
|
38
|
+
}
|
31
39
|
const { fileName, bucketName } = states;
|
32
40
|
// Bucket service
|
33
41
|
let tvl = 0;
|
@@ -3136,6 +3136,28 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3136
3136
|
};
|
3137
3137
|
};
|
3138
3138
|
};
|
3139
|
+
} & {
|
3140
|
+
engine: {
|
3141
|
+
computedUntil: {
|
3142
|
+
":campaignId": {
|
3143
|
+
put: {
|
3144
|
+
body: {
|
3145
|
+
computedUntil: number;
|
3146
|
+
};
|
3147
|
+
params: {
|
3148
|
+
campaignId: string;
|
3149
|
+
};
|
3150
|
+
query: unknown;
|
3151
|
+
headers: {
|
3152
|
+
authorization: string;
|
3153
|
+
};
|
3154
|
+
response: {
|
3155
|
+
200: void;
|
3156
|
+
};
|
3157
|
+
};
|
3158
|
+
};
|
3159
|
+
};
|
3160
|
+
};
|
3139
3161
|
} & {
|
3140
3162
|
engine: {
|
3141
3163
|
overlaps: {
|
@@ -44,6 +44,28 @@ export declare const StatusController: Elysia<"/campaign-status", false, {
|
|
44
44
|
};
|
45
45
|
};
|
46
46
|
};
|
47
|
+
} & {
|
48
|
+
engine: {
|
49
|
+
computedUntil: {
|
50
|
+
":campaignId": {
|
51
|
+
put: {
|
52
|
+
body: {
|
53
|
+
computedUntil: number;
|
54
|
+
};
|
55
|
+
params: {
|
56
|
+
campaignId: string;
|
57
|
+
};
|
58
|
+
query: unknown;
|
59
|
+
headers: {
|
60
|
+
authorization: string;
|
61
|
+
};
|
62
|
+
response: {
|
63
|
+
200: void;
|
64
|
+
};
|
65
|
+
};
|
66
|
+
};
|
67
|
+
};
|
68
|
+
};
|
47
69
|
} & {
|
48
70
|
engine: {
|
49
71
|
overlaps: {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
|
2
2
|
import { throwOnUnsupportedChainId } from "../../../utils/throw";
|
3
3
|
import Elysia from "elysia";
|
4
|
-
import { CampaignUniqueDto, DelayDto, QueryCampaignStatusDto, UpdateCampaignStatusDto } from "./status.model";
|
4
|
+
import { CampaignUniqueDto, ComputedUntilDto, DelayDto, QueryCampaignStatusDto, UpdateCampaignStatusDto, } from "./status.model";
|
5
5
|
import { StatusService } from "./status.service";
|
6
6
|
export const StatusController = new Elysia({ prefix: "/campaign-status", detail: { tags: ["Status"], hide: true } })
|
7
7
|
// ─── Update a Campaign Status ──────────────────────────────────────
|
@@ -12,6 +12,15 @@ export const StatusController = new Elysia({ prefix: "/campaign-status", detail:
|
|
12
12
|
beforeHandle: EngineGuard,
|
13
13
|
headers: AuthorizationHeadersDto,
|
14
14
|
body: UpdateCampaignStatusDto,
|
15
|
+
})
|
16
|
+
// ─── Updates only the computed until field ───────────────────────────
|
17
|
+
.put("/engine/computedUntil/:campaignId", async ({ params, body }) => {
|
18
|
+
const [distributionChain, campaignId] = params.campaignId.split("-");
|
19
|
+
return await StatusService.updateComputedUntil({ distributionChain: +distributionChain, campaignId }, body.computedUntil);
|
20
|
+
}, {
|
21
|
+
beforeHandle: EngineGuard,
|
22
|
+
headers: AuthorizationHeadersDto,
|
23
|
+
body: ComputedUntilDto,
|
15
24
|
})
|
16
25
|
// ─── Is Safe For Overlaps ───────────────────────────────────────────
|
17
26
|
.get("/engine/overlaps", async ({ query }) => await StatusService.isSafeForOverlaps(query), {
|
@@ -35,6 +35,9 @@ export declare const UpdateCampaignStatusDto: import("@sinclair/typebox").TUnion
|
|
35
35
|
error: import("@sinclair/typebox").TString;
|
36
36
|
details: import("@sinclair/typebox").TString;
|
37
37
|
}>]>;
|
38
|
+
export declare const ComputedUntilDto: import("@sinclair/typebox").TObject<{
|
39
|
+
computedUntil: import("@sinclair/typebox").TNumber;
|
40
|
+
}>;
|
38
41
|
export declare const QueryCampaignStatusDto: import("@sinclair/typebox").TObject<{
|
39
42
|
computeChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
40
43
|
status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TEnum<{
|
@@ -26,6 +26,7 @@ export const UpdateCampaignStatusDto = t.Union([
|
|
26
26
|
t.Object({ value: t.Literal(RunStatus.SKIPPED), error: t.String(), details: t.String() }),
|
27
27
|
t.Object({ value: t.Literal(RunStatus.FAILED), error: t.String(), details: t.String() }),
|
28
28
|
]);
|
29
|
+
export const ComputedUntilDto = t.Object({ computedUntil: t.Numeric() });
|
29
30
|
export const QueryCampaignStatusDto = t.Object({
|
30
31
|
computeChainId: t.Optional(t.Numeric()),
|
31
32
|
status: t.Optional(t.Union([t.Array(t.Enum(RunStatus)), t.Enum(RunStatus)])),
|
@@ -59,21 +59,15 @@ export declare class StatusRepository {
|
|
59
59
|
computedUntil: bigint;
|
60
60
|
processingStarted: bigint;
|
61
61
|
}>;
|
62
|
-
static updateProcessing(campaignUnique: CampaignUnique): Promise<
|
62
|
+
static updateProcessing(campaignUnique: CampaignUnique): Promise<void>;
|
63
|
+
static updateComputedUntil(campaignUnique: CampaignUnique, computedUntil: number): Promise<{
|
63
64
|
error: string;
|
64
65
|
details: Prisma.JsonValue;
|
65
66
|
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
66
67
|
campaignId: string;
|
67
68
|
computedUntil: bigint;
|
68
69
|
processingStarted: bigint;
|
69
|
-
}
|
70
|
-
error: string;
|
71
|
-
details: Prisma.JsonValue;
|
72
|
-
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
73
|
-
campaignId: string;
|
74
|
-
computedUntil: bigint;
|
75
|
-
processingStarted: bigint;
|
76
|
-
}]>;
|
70
|
+
}>;
|
77
71
|
static findManyDelay(query: DelayModel): Promise<{
|
78
72
|
startTimestamp: bigint;
|
79
73
|
endTimestamp: bigint;
|
@@ -73,8 +73,8 @@ export class StatusRepository {
|
|
73
73
|
static async updateProcessing(campaignUnique) {
|
74
74
|
const campaignId = CampaignService.hashId(campaignUnique);
|
75
75
|
const now = moment().unix();
|
76
|
-
return await apiDbClient.$transaction(
|
77
|
-
apiDbClient.campaignStatus.findUniqueOrThrow({
|
76
|
+
return await apiDbClient.$transaction(async (_prisma) => {
|
77
|
+
await apiDbClient.campaignStatus.findUniqueOrThrow({
|
78
78
|
where: {
|
79
79
|
campaignId,
|
80
80
|
OR: [
|
@@ -90,8 +90,8 @@ export class StatusRepository {
|
|
90
90
|
},
|
91
91
|
],
|
92
92
|
},
|
93
|
-
})
|
94
|
-
apiDbClient.campaignStatus.update({
|
93
|
+
});
|
94
|
+
await apiDbClient.campaignStatus.update({
|
95
95
|
where: {
|
96
96
|
campaignId,
|
97
97
|
},
|
@@ -101,8 +101,18 @@ export class StatusRepository {
|
|
101
101
|
error: "",
|
102
102
|
details: "{}",
|
103
103
|
},
|
104
|
-
})
|
105
|
-
|
104
|
+
});
|
105
|
+
});
|
106
|
+
}
|
107
|
+
static async updateComputedUntil(campaignUnique, computedUntil) {
|
108
|
+
return await apiDbClient.campaignStatus.update({
|
109
|
+
where: {
|
110
|
+
campaignId: CampaignService.hashId(campaignUnique),
|
111
|
+
},
|
112
|
+
data: {
|
113
|
+
computedUntil,
|
114
|
+
},
|
115
|
+
});
|
106
116
|
}
|
107
117
|
static async findManyDelay(query) {
|
108
118
|
return await apiDbClient.campaign.findMany({
|
@@ -34,6 +34,7 @@ export declare class StatusService {
|
|
34
34
|
processingStarted: bigint;
|
35
35
|
} | null>;
|
36
36
|
static update(campaignUnique: CampaignUnique, status: UpdateStatusModel): Promise<void>;
|
37
|
+
static updateComputedUntil(campaignUnique: CampaignUnique, computedUntil: number): Promise<void>;
|
37
38
|
static isSafeForOverlaps(campaignUnique: CampaignUnique): Promise<boolean>;
|
38
39
|
static findUpdatesAndDelays(): Promise<Record<number, {
|
39
40
|
live: string;
|
@@ -45,6 +45,19 @@ export class StatusService {
|
|
45
45
|
return;
|
46
46
|
}
|
47
47
|
}
|
48
|
+
static async updateComputedUntil(campaignUnique, computedUntil) {
|
49
|
+
// Check if the status exists already, otherwise create it
|
50
|
+
const campaignStatus = await StatusRepository.findUnique(campaignUnique);
|
51
|
+
if (!campaignStatus) {
|
52
|
+
let campaign = await CampaignService.findUnique(campaignUnique);
|
53
|
+
if (!campaign) {
|
54
|
+
await CampaignService.fill([campaignUnique]);
|
55
|
+
campaign = await CampaignService.findUniqueOrThrow(campaignUnique);
|
56
|
+
}
|
57
|
+
await StatusRepository.create(campaignUnique, campaign.startTimestamp);
|
58
|
+
}
|
59
|
+
await StatusRepository.updateComputedUntil(campaignUnique, computedUntil);
|
60
|
+
}
|
48
61
|
static async isSafeForOverlaps(campaignUnique) {
|
49
62
|
const status = await StatusRepository.findUnique(campaignUnique);
|
50
63
|
if (!status) {
|
@@ -44,6 +44,13 @@ export function generateIcons(type, typeInfo, campaign, symbols = [""]) {
|
|
44
44
|
case tokenType.toros:
|
45
45
|
case tokenType.enzyme:
|
46
46
|
return [typeInfo.symbolUnderlyingToken];
|
47
|
+
case tokenType.pendleYT: {
|
48
|
+
let symbol = campaign.campaignParameters.symbolTargetToken;
|
49
|
+
symbol = symbol.split("-").slice(0, 2).join("-");
|
50
|
+
return [symbol];
|
51
|
+
}
|
52
|
+
case tokenType.pendle:
|
53
|
+
return [typeInfo.symbolUnderlyingToken];
|
47
54
|
default:
|
48
55
|
return [campaign.campaignParameters.symbolTargetToken];
|
49
56
|
}
|