@merkl/api 0.20.115 → 0.20.116
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 +17 -0
- package/dist/database/api/.generated/drizzle/schema.js +1 -0
- package/dist/database/api/.generated/drizzle/schema.ts +1 -0
- package/dist/database/api/.generated/edge.js +4 -3
- package/dist/database/api/.generated/index-browser.js +1 -0
- package/dist/database/api/.generated/index.d.ts +58 -1
- package/dist/database/api/.generated/index.js +4 -3
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +1 -0
- package/dist/database/api/.generated/wasm.js +1 -0
- package/dist/src/eden/index.d.ts +118 -0
- package/dist/src/engine/deprecated/dynamicData/implementations/ERC721.js +4 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/ERCMultiToken.js +4 -2
- package/dist/src/engine/deprecated/dynamicData/implementations/Erc20.js +4 -2
- package/dist/src/engine/deprecated/dynamicData/utils/getFixedApr.d.ts +0 -1
- package/dist/src/engine/deprecated/dynamicData/utils/getFixedApr.js +0 -8
- package/dist/src/index.d.ts +40 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -0
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +2 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +4 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +9 -0
- package/dist/src/modules/v4/campaign/campaign.service.js +4 -2
- package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +7 -7
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +21 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +10 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +13 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +25 -0
- package/dist/src/modules/v4/reward/reward.model.d.ts +4 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +14 -0
- package/dist/src/modules/v4/router.d.ts +40 -0
- package/dist/src/modules/v4/token/token.controller.d.ts +9 -0
- package/dist/src/modules/v4/token/token.model.d.ts +3 -0
- package/dist/src/modules/v4/token/token.model.js +3 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +4 -0
- package/dist/src/modules/v4/token/token.service.d.ts +13 -0
- package/dist/src/modules/v4/token/token.service.js +1 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +4 -0
- package/dist/src/utils/parseDistributionType.d.ts +1 -0
- package/dist/src/utils/parseDistributionType.js +16 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1,9 +1,11 @@
|
|
1
1
|
import { TokenService } from "@/modules/v4/token/token.service";
|
2
2
|
import { log } from "@/utils/logger";
|
3
|
+
import { parseDistributionType } from "@/utils/parseDistributionType";
|
3
4
|
import { Pricer } from "@/utils/pricer";
|
5
|
+
import { DistributionType } from "@db/api";
|
4
6
|
import { AragornEscrowInterface, BN2Number, ChainInteractionService, ERC20Interface, YEAR, } from "@sdk";
|
5
7
|
import { ERC721SubCampaignType } from "libs/sdk/src/types/merkl/campaignTypes/erc721";
|
6
|
-
import { getFixedApr
|
8
|
+
import { getFixedApr } from "../utils/getFixedApr";
|
7
9
|
export class ERC721DynamicData {
|
8
10
|
async build(chainId, campaigns) {
|
9
11
|
const pricer = await Pricer.load();
|
@@ -69,7 +71,7 @@ export class ERC721DynamicData {
|
|
69
71
|
if (rewardToken.isPoint) {
|
70
72
|
apr = apr / 365 / 100;
|
71
73
|
}
|
72
|
-
else if (
|
74
|
+
else if (parseDistributionType(campaign.campaignParameters) !== DistributionType.DUTCH_AUCTION) {
|
73
75
|
apr = getFixedApr(campaign, priceRewardToken, priceTargetToken);
|
74
76
|
}
|
75
77
|
dynamicData.push({
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { TokenService } from "@/modules/v4/token/token.service";
|
2
2
|
import { log } from "@/utils/logger";
|
3
|
+
import { parseDistributionType } from "@/utils/parseDistributionType";
|
3
4
|
import { Pricer } from "@/utils/pricer";
|
5
|
+
import { DistributionType } from "@db/api";
|
4
6
|
import { BN2Number, ChainInteractionService, CloberBookManagerInterface, CloberPoolInterface, ERC20Interface, ERC6909Interface, YEAR, } from "@sdk";
|
5
|
-
import { getFixedApr
|
7
|
+
import { getFixedApr } from "../utils/getFixedApr";
|
6
8
|
export class ERCMultiTokenDynamicData {
|
7
9
|
async build(chainId, campaigns) {
|
8
10
|
const pricer = await Pricer.load();
|
@@ -143,7 +145,7 @@ export class ERCMultiTokenDynamicData {
|
|
143
145
|
if (rewardToken.isPoint) {
|
144
146
|
apr = apr / 365 / 100;
|
145
147
|
}
|
146
|
-
else if (
|
148
|
+
else if (parseDistributionType(campaign.campaignParameters) !== DistributionType.DUTCH_AUCTION) {
|
147
149
|
apr = getFixedApr(campaign, priceRewardToken, priceTargetToken);
|
148
150
|
}
|
149
151
|
dynamicData.push({
|
@@ -8,9 +8,11 @@ import { ComputedValueService } from "@/modules/v4/computedValue/computedValue.s
|
|
8
8
|
import { TokenRepository } from "@/modules/v4/token/token.repository";
|
9
9
|
import { TokenService } from "@/modules/v4/token/token.service";
|
10
10
|
import { log } from "@/utils/logger";
|
11
|
+
import { parseDistributionType } from "@/utils/parseDistributionType";
|
11
12
|
import { Pricer } from "@/utils/pricer";
|
13
|
+
import { DistributionType } from "@db/api";
|
12
14
|
import { BN2Number, BalancerPoolInterface, BalancerV3StablePoolInterface, ChainId, ChainInteractionService, ERC20Interface, EnzymeInterface, FactoryInterface, LayerBankERC20Interface, MetamorphoInterface, YEAR, getEnv, } from "@sdk";
|
13
|
-
import { getFixedApr
|
15
|
+
import { getFixedApr } from "../utils/getFixedApr";
|
14
16
|
export class Erc20DynamicData {
|
15
17
|
async build(chainId, campaigns) {
|
16
18
|
const pricer = await Pricer.load();
|
@@ -155,7 +157,7 @@ export class Erc20DynamicData {
|
|
155
157
|
if (rewardToken.isPoint) {
|
156
158
|
apr = apr / 365 / 100;
|
157
159
|
}
|
158
|
-
else if (
|
160
|
+
else if (parseDistributionType(campaign.campaignParameters) !== DistributionType.DUTCH_AUCTION) {
|
159
161
|
apr = getFixedApr(campaign, priceRewardToken, priceTargetToken);
|
160
162
|
}
|
161
163
|
dynamicData.push({
|
@@ -5,5 +5,4 @@ export type BaseFixAPRConfig = {
|
|
5
5
|
rewardTokenPricing: boolean;
|
6
6
|
};
|
7
7
|
export type FixedAprCampaignType = Campaign.ERC20_FIX_APR | Campaign.HYPERDRIVELOGFIXPROCESSOR | Campaign.ERC6909FIXAPR | Campaign.ERC1155FIXAPR | Campaign.ERC721FIXAPR;
|
8
|
-
export declare function hasFixedAprConfig<T>(params: T): params is T & BaseFixAPRConfig;
|
9
8
|
export declare function getFixedApr(campaignParameters: CampaignParameters<FixedAprCampaignType>, priceRewardToken: number, priceTargetToken: number): number;
|
@@ -1,11 +1,3 @@
|
|
1
|
-
// Type guard to check if campaign parameters have fixed APR config
|
2
|
-
export function hasFixedAprConfig(params) {
|
3
|
-
return (typeof params === "object" &&
|
4
|
-
params !== null &&
|
5
|
-
"targetTokenPricing" in params &&
|
6
|
-
"rewardTokenPricing" in params &&
|
7
|
-
"apr" in params);
|
8
|
-
}
|
9
1
|
// TODO: Enhance APR display for non-dollar denominations when front-end is ready.
|
10
2
|
// This should handle cases where one or both token price are unavailable, showing the APR as a direct ratio
|
11
3
|
// (e.g., X reward tokens per Y target tokens) instead of dollar values.
|
package/dist/src/index.d.ts
CHANGED
@@ -297,6 +297,7 @@ declare const app: Elysia<"", false, {
|
|
297
297
|
verified: boolean;
|
298
298
|
isTest: boolean;
|
299
299
|
isPoint: boolean;
|
300
|
+
isPreTGE: boolean;
|
300
301
|
isNative: boolean;
|
301
302
|
} & {
|
302
303
|
price?: number | null | undefined;
|
@@ -361,6 +362,7 @@ declare const app: Elysia<"", false, {
|
|
361
362
|
verified: boolean;
|
362
363
|
isTest: boolean;
|
363
364
|
isPoint: boolean;
|
365
|
+
isPreTGE: boolean;
|
364
366
|
isNative: boolean;
|
365
367
|
} & {
|
366
368
|
price?: number | null | undefined;
|
@@ -451,6 +453,7 @@ declare const app: Elysia<"", false, {
|
|
451
453
|
verified: boolean;
|
452
454
|
isTest: boolean;
|
453
455
|
isPoint: boolean;
|
456
|
+
isPreTGE: boolean;
|
454
457
|
isNative: boolean;
|
455
458
|
price: number | null;
|
456
459
|
};
|
@@ -478,6 +481,7 @@ declare const app: Elysia<"", false, {
|
|
478
481
|
verified: boolean;
|
479
482
|
isTest: boolean;
|
480
483
|
isPoint: boolean;
|
484
|
+
isPreTGE: boolean;
|
481
485
|
isNative: boolean;
|
482
486
|
} & {
|
483
487
|
price?: number | null | undefined;
|
@@ -546,6 +550,7 @@ declare const app: Elysia<"", false, {
|
|
546
550
|
verified: boolean;
|
547
551
|
isTest: boolean;
|
548
552
|
isPoint: boolean;
|
553
|
+
isPreTGE: boolean;
|
549
554
|
isNative: boolean;
|
550
555
|
} & {
|
551
556
|
price?: number | null | undefined;
|
@@ -678,6 +683,8 @@ declare const app: Elysia<"", false, {
|
|
678
683
|
decimals: number;
|
679
684
|
verified: boolean;
|
680
685
|
isTest: boolean;
|
686
|
+
isPoint: boolean;
|
687
|
+
isPreTGE: boolean;
|
681
688
|
};
|
682
689
|
value: number;
|
683
690
|
campaignId: string;
|
@@ -700,6 +707,8 @@ declare const app: Elysia<"", false, {
|
|
700
707
|
decimals: number;
|
701
708
|
verified: boolean;
|
702
709
|
isTest: boolean;
|
710
|
+
isPoint: boolean;
|
711
|
+
isPreTGE: boolean;
|
703
712
|
}[];
|
704
713
|
tags: string[];
|
705
714
|
identifier: string;
|
@@ -811,6 +820,8 @@ declare const app: Elysia<"", false, {
|
|
811
820
|
decimals: number;
|
812
821
|
verified: boolean;
|
813
822
|
isTest: boolean;
|
823
|
+
isPoint: boolean;
|
824
|
+
isPreTGE: boolean;
|
814
825
|
};
|
815
826
|
value: number;
|
816
827
|
campaignId: string;
|
@@ -833,6 +844,8 @@ declare const app: Elysia<"", false, {
|
|
833
844
|
decimals: number;
|
834
845
|
verified: boolean;
|
835
846
|
isTest: boolean;
|
847
|
+
isPoint: boolean;
|
848
|
+
isPreTGE: boolean;
|
836
849
|
}[];
|
837
850
|
tags: string[];
|
838
851
|
identifier: string;
|
@@ -896,6 +909,8 @@ declare const app: Elysia<"", false, {
|
|
896
909
|
decimals: number;
|
897
910
|
verified: boolean;
|
898
911
|
isTest: boolean;
|
912
|
+
isPoint: boolean;
|
913
|
+
isPreTGE: boolean;
|
899
914
|
};
|
900
915
|
}[];
|
901
916
|
}[];
|
@@ -978,6 +993,8 @@ declare const app: Elysia<"", false, {
|
|
978
993
|
decimals: number;
|
979
994
|
verified: boolean;
|
980
995
|
isTest: boolean;
|
996
|
+
isPoint: boolean;
|
997
|
+
isPreTGE: boolean;
|
981
998
|
};
|
982
999
|
value: number;
|
983
1000
|
campaignId: string;
|
@@ -1000,6 +1017,8 @@ declare const app: Elysia<"", false, {
|
|
1000
1017
|
decimals: number;
|
1001
1018
|
verified: boolean;
|
1002
1019
|
isTest: boolean;
|
1020
|
+
isPoint: boolean;
|
1021
|
+
isPreTGE: boolean;
|
1003
1022
|
}[];
|
1004
1023
|
tags: string[];
|
1005
1024
|
identifier: string;
|
@@ -1063,6 +1082,8 @@ declare const app: Elysia<"", false, {
|
|
1063
1082
|
decimals: number;
|
1064
1083
|
verified: boolean;
|
1065
1084
|
isTest: boolean;
|
1085
|
+
isPoint: boolean;
|
1086
|
+
isPreTGE: boolean;
|
1066
1087
|
};
|
1067
1088
|
}[];
|
1068
1089
|
};
|
@@ -1274,6 +1295,7 @@ declare const app: Elysia<"", false, {
|
|
1274
1295
|
verified: boolean;
|
1275
1296
|
isTest: boolean;
|
1276
1297
|
isPoint: boolean;
|
1298
|
+
isPreTGE: boolean;
|
1277
1299
|
isNative: boolean;
|
1278
1300
|
} & {
|
1279
1301
|
price?: number | null | undefined;
|
@@ -1444,6 +1466,7 @@ declare const app: Elysia<"", false, {
|
|
1444
1466
|
verified: boolean;
|
1445
1467
|
isTest: boolean;
|
1446
1468
|
isPoint: boolean;
|
1469
|
+
isPreTGE: boolean;
|
1447
1470
|
isNative: boolean;
|
1448
1471
|
} & {
|
1449
1472
|
price?: number | null | undefined;
|
@@ -1530,6 +1553,7 @@ declare const app: Elysia<"", false, {
|
|
1530
1553
|
verified: boolean;
|
1531
1554
|
isTest: boolean;
|
1532
1555
|
isPoint: boolean;
|
1556
|
+
isPreTGE: boolean;
|
1533
1557
|
isNative: boolean;
|
1534
1558
|
} & {
|
1535
1559
|
price?: number | null | undefined;
|
@@ -1717,6 +1741,7 @@ declare const app: Elysia<"", false, {
|
|
1717
1741
|
verified: boolean;
|
1718
1742
|
isTest: boolean;
|
1719
1743
|
isPoint: boolean;
|
1744
|
+
isPreTGE: boolean;
|
1720
1745
|
isNative: boolean;
|
1721
1746
|
} & {
|
1722
1747
|
price?: number | null | undefined;
|
@@ -2113,6 +2138,7 @@ declare const app: Elysia<"", false, {
|
|
2113
2138
|
verified: boolean;
|
2114
2139
|
isTest: boolean;
|
2115
2140
|
isPoint: boolean;
|
2141
|
+
isPreTGE: boolean;
|
2116
2142
|
isNative: boolean;
|
2117
2143
|
} & {
|
2118
2144
|
price?: number | null | undefined;
|
@@ -2176,6 +2202,7 @@ declare const app: Elysia<"", false, {
|
|
2176
2202
|
verified: boolean;
|
2177
2203
|
isTest: boolean;
|
2178
2204
|
isPoint: boolean;
|
2205
|
+
isPreTGE: boolean;
|
2179
2206
|
isNative: boolean;
|
2180
2207
|
} & {
|
2181
2208
|
price?: number | null | undefined;
|
@@ -2447,6 +2474,7 @@ declare const app: Elysia<"", false, {
|
|
2447
2474
|
verified: boolean;
|
2448
2475
|
isTest: boolean;
|
2449
2476
|
isPoint: boolean;
|
2477
|
+
isPreTGE: boolean;
|
2450
2478
|
isNative: boolean;
|
2451
2479
|
price?: number | null | undefined;
|
2452
2480
|
} | undefined;
|
@@ -2480,6 +2508,7 @@ declare const app: Elysia<"", false, {
|
|
2480
2508
|
verified: boolean;
|
2481
2509
|
isTest: boolean;
|
2482
2510
|
isPoint: boolean;
|
2511
|
+
isPreTGE: boolean;
|
2483
2512
|
isNative: boolean;
|
2484
2513
|
price?: number | null | undefined;
|
2485
2514
|
} | undefined;
|
@@ -2513,6 +2542,7 @@ declare const app: Elysia<"", false, {
|
|
2513
2542
|
verified: boolean;
|
2514
2543
|
isTest: boolean;
|
2515
2544
|
isPoint: boolean;
|
2545
|
+
isPreTGE: boolean;
|
2516
2546
|
isNative: boolean;
|
2517
2547
|
price: number | null;
|
2518
2548
|
}[];
|
@@ -2545,6 +2575,7 @@ declare const app: Elysia<"", false, {
|
|
2545
2575
|
verified: boolean;
|
2546
2576
|
isTest: boolean;
|
2547
2577
|
isPoint: boolean;
|
2578
|
+
isPreTGE: boolean;
|
2548
2579
|
isNative: boolean;
|
2549
2580
|
} & {
|
2550
2581
|
price?: number | null | undefined;
|
@@ -2588,6 +2619,7 @@ declare const app: Elysia<"", false, {
|
|
2588
2619
|
verified: boolean;
|
2589
2620
|
isTest: boolean;
|
2590
2621
|
isPoint: boolean;
|
2622
|
+
isPreTGE: boolean;
|
2591
2623
|
isNative: boolean;
|
2592
2624
|
} & {
|
2593
2625
|
price?: number | null | undefined;
|
@@ -2650,6 +2682,7 @@ declare const app: Elysia<"", false, {
|
|
2650
2682
|
verified: boolean;
|
2651
2683
|
isTest: boolean;
|
2652
2684
|
isPoint: boolean;
|
2685
|
+
isPreTGE: boolean;
|
2653
2686
|
isNative: boolean;
|
2654
2687
|
price: number | null;
|
2655
2688
|
};
|
@@ -2666,6 +2699,7 @@ declare const app: Elysia<"", false, {
|
|
2666
2699
|
verified?: boolean | undefined;
|
2667
2700
|
isTest?: boolean | undefined;
|
2668
2701
|
isPoint?: boolean | undefined;
|
2702
|
+
isPreTGE?: boolean | undefined;
|
2669
2703
|
};
|
2670
2704
|
params: {
|
2671
2705
|
id: string;
|
@@ -2687,6 +2721,7 @@ declare const app: Elysia<"", false, {
|
|
2687
2721
|
verified: boolean;
|
2688
2722
|
isTest: boolean;
|
2689
2723
|
isPoint: boolean;
|
2724
|
+
isPreTGE: boolean;
|
2690
2725
|
isNative: boolean;
|
2691
2726
|
price: number | null;
|
2692
2727
|
};
|
@@ -2750,6 +2785,7 @@ declare const app: Elysia<"", false, {
|
|
2750
2785
|
verified: boolean;
|
2751
2786
|
isTest: boolean;
|
2752
2787
|
isPoint: boolean;
|
2788
|
+
isPreTGE: boolean;
|
2753
2789
|
isNative: boolean;
|
2754
2790
|
price: number | null;
|
2755
2791
|
};
|
@@ -3686,6 +3722,7 @@ declare const app: Elysia<"", false, {
|
|
3686
3722
|
verified: boolean;
|
3687
3723
|
isTest: boolean;
|
3688
3724
|
isPoint: boolean;
|
3725
|
+
isPreTGE: boolean;
|
3689
3726
|
isNative: boolean;
|
3690
3727
|
price: number | null;
|
3691
3728
|
};
|
@@ -3709,6 +3746,7 @@ declare const app: Elysia<"", false, {
|
|
3709
3746
|
verified: boolean;
|
3710
3747
|
isTest: boolean;
|
3711
3748
|
isPoint: boolean;
|
3749
|
+
isPreTGE: boolean;
|
3712
3750
|
isNative: boolean;
|
3713
3751
|
price: number | null;
|
3714
3752
|
}[];
|
@@ -3807,6 +3845,7 @@ declare const app: Elysia<"", false, {
|
|
3807
3845
|
verified: boolean;
|
3808
3846
|
isTest: boolean;
|
3809
3847
|
isPoint: boolean;
|
3848
|
+
isPreTGE: boolean;
|
3810
3849
|
isNative: boolean;
|
3811
3850
|
price: number | null;
|
3812
3851
|
};
|
@@ -3830,6 +3869,7 @@ declare const app: Elysia<"", false, {
|
|
3830
3869
|
verified: boolean;
|
3831
3870
|
isTest: boolean;
|
3832
3871
|
isPoint: boolean;
|
3872
|
+
isPreTGE: boolean;
|
3833
3873
|
isNative: boolean;
|
3834
3874
|
price: number | null;
|
3835
3875
|
}[];
|
@@ -73,6 +73,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
73
73
|
verified: boolean;
|
74
74
|
isTest: boolean;
|
75
75
|
isPoint: boolean;
|
76
|
+
isPreTGE: boolean;
|
76
77
|
isNative: boolean;
|
77
78
|
} & {
|
78
79
|
price?: number | null | undefined;
|
@@ -243,6 +244,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
243
244
|
verified: boolean;
|
244
245
|
isTest: boolean;
|
245
246
|
isPoint: boolean;
|
247
|
+
isPreTGE: boolean;
|
246
248
|
isNative: boolean;
|
247
249
|
} & {
|
248
250
|
price?: number | null | undefined;
|
@@ -329,6 +331,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
329
331
|
verified: boolean;
|
330
332
|
isTest: boolean;
|
331
333
|
isPoint: boolean;
|
334
|
+
isPreTGE: boolean;
|
332
335
|
isNative: boolean;
|
333
336
|
} & {
|
334
337
|
price?: number | null | undefined;
|
@@ -516,6 +519,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
516
519
|
verified: boolean;
|
517
520
|
isTest: boolean;
|
518
521
|
isPoint: boolean;
|
522
|
+
isPreTGE: boolean;
|
519
523
|
isNative: boolean;
|
520
524
|
} & {
|
521
525
|
price?: number | null | undefined;
|
@@ -63,6 +63,8 @@ export declare const CampaignResourceDto: import("@sinclair/typebox").TObject<{
|
|
63
63
|
icon: import("@sinclair/typebox").TString;
|
64
64
|
verified: import("@sinclair/typebox").TBoolean;
|
65
65
|
isTest: import("@sinclair/typebox").TBoolean;
|
66
|
+
isPoint: import("@sinclair/typebox").TBoolean;
|
67
|
+
isPreTGE: import("@sinclair/typebox").TBoolean;
|
66
68
|
price: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>>;
|
67
69
|
symbol: import("@sinclair/typebox").TString;
|
68
70
|
}>;
|
@@ -411,6 +411,7 @@ export declare abstract class CampaignRepository {
|
|
411
411
|
verified: boolean;
|
412
412
|
isTest: boolean;
|
413
413
|
isPoint: boolean;
|
414
|
+
isPreTGE: boolean;
|
414
415
|
isNative: boolean;
|
415
416
|
price: number | null;
|
416
417
|
};
|
@@ -536,6 +537,7 @@ export declare abstract class CampaignRepository {
|
|
536
537
|
verified: boolean;
|
537
538
|
isTest: boolean;
|
538
539
|
isPoint: boolean;
|
540
|
+
isPreTGE: boolean;
|
539
541
|
isNative: boolean;
|
540
542
|
price: number | null;
|
541
543
|
};
|
@@ -593,6 +595,7 @@ export declare abstract class CampaignRepository {
|
|
593
595
|
verified: boolean;
|
594
596
|
isTest: boolean;
|
595
597
|
isPoint: boolean;
|
598
|
+
isPreTGE: boolean;
|
596
599
|
isNative: boolean;
|
597
600
|
price: number | null;
|
598
601
|
};
|
@@ -677,6 +680,7 @@ export declare abstract class CampaignRepository {
|
|
677
680
|
verified: boolean;
|
678
681
|
isTest: boolean;
|
679
682
|
isPoint: boolean;
|
683
|
+
isPreTGE: boolean;
|
680
684
|
isNative: boolean;
|
681
685
|
price: number | null;
|
682
686
|
};
|
@@ -103,6 +103,7 @@ export declare abstract class CampaignService {
|
|
103
103
|
verified: boolean;
|
104
104
|
isTest: boolean;
|
105
105
|
isPoint: boolean;
|
106
|
+
isPreTGE: boolean;
|
106
107
|
isNative: boolean;
|
107
108
|
price: number | null;
|
108
109
|
};
|
@@ -183,6 +184,7 @@ export declare abstract class CampaignService {
|
|
183
184
|
verified: boolean;
|
184
185
|
isTest: boolean;
|
185
186
|
isPoint: boolean;
|
187
|
+
isPreTGE: boolean;
|
186
188
|
isNative: boolean;
|
187
189
|
} & {
|
188
190
|
price?: number | null | undefined;
|
@@ -247,6 +249,7 @@ export declare abstract class CampaignService {
|
|
247
249
|
verified: boolean;
|
248
250
|
isTest: boolean;
|
249
251
|
isPoint: boolean;
|
252
|
+
isPreTGE: boolean;
|
250
253
|
isNative: boolean;
|
251
254
|
} & {
|
252
255
|
price?: number | null | undefined;
|
@@ -320,6 +323,7 @@ export declare abstract class CampaignService {
|
|
320
323
|
verified: boolean;
|
321
324
|
isTest: boolean;
|
322
325
|
isPoint: boolean;
|
326
|
+
isPreTGE: boolean;
|
323
327
|
isNative: boolean;
|
324
328
|
} & {
|
325
329
|
price?: number | null | undefined;
|
@@ -394,6 +398,7 @@ export declare abstract class CampaignService {
|
|
394
398
|
verified: boolean;
|
395
399
|
isTest: boolean;
|
396
400
|
isPoint: boolean;
|
401
|
+
isPreTGE: boolean;
|
397
402
|
isNative: boolean;
|
398
403
|
} & {
|
399
404
|
price?: number | null | undefined;
|
@@ -468,6 +473,7 @@ export declare abstract class CampaignService {
|
|
468
473
|
verified: boolean;
|
469
474
|
isTest: boolean;
|
470
475
|
isPoint: boolean;
|
476
|
+
isPreTGE: boolean;
|
471
477
|
isNative: boolean;
|
472
478
|
} & {
|
473
479
|
price?: number | null | undefined;
|
@@ -554,6 +560,7 @@ export declare abstract class CampaignService {
|
|
554
560
|
verified: boolean;
|
555
561
|
isTest: boolean;
|
556
562
|
isPoint: boolean;
|
563
|
+
isPreTGE: boolean;
|
557
564
|
isNative: boolean;
|
558
565
|
price: number | null;
|
559
566
|
};
|
@@ -611,6 +618,7 @@ export declare abstract class CampaignService {
|
|
611
618
|
verified: boolean;
|
612
619
|
isTest: boolean;
|
613
620
|
isPoint: boolean;
|
621
|
+
isPreTGE: boolean;
|
614
622
|
isNative: boolean;
|
615
623
|
price: number | null;
|
616
624
|
};
|
@@ -749,6 +757,7 @@ export declare abstract class CampaignService {
|
|
749
757
|
verified: boolean;
|
750
758
|
isTest: boolean;
|
751
759
|
isPoint: boolean;
|
760
|
+
isPreTGE: boolean;
|
752
761
|
isNative: boolean;
|
753
762
|
} & {
|
754
763
|
price?: number | null | undefined;
|
@@ -4,6 +4,7 @@ import { StatusService } from "@/modules/v4/status/status.service";
|
|
4
4
|
import { TokenService } from "@/modules/v4/token/token.service";
|
5
5
|
import { CannotParseOpportunity, InvalidParameter } from "@/utils/error";
|
6
6
|
import { log } from "@/utils/logger";
|
7
|
+
import { parseDistributionType } from "@/utils/parseDistributionType";
|
7
8
|
import { Campaign as CampaignType, NETWORK_LABELS, } from "@sdk";
|
8
9
|
import { utils } from "ethers";
|
9
10
|
import moment from "moment";
|
@@ -42,6 +43,7 @@ export class CampaignService {
|
|
42
43
|
throw new Error(`unable to fetch data for token ${body.rewardTokenAddress}`);
|
43
44
|
}
|
44
45
|
const chain = await ChainService.findUniqueOrThrow(body.chainId);
|
46
|
+
const params = JSON.parse(body.params);
|
45
47
|
const campaign = {
|
46
48
|
distributionChainId: body.chainId,
|
47
49
|
computeChainId: body.computeChainId,
|
@@ -50,12 +52,12 @@ export class CampaignService {
|
|
50
52
|
type: campaignType,
|
51
53
|
subType: body.subType ?? null,
|
52
54
|
rewardToken,
|
53
|
-
params
|
55
|
+
params,
|
54
56
|
endTimestamp: Number(body.endTimestamp),
|
55
57
|
startTimestamp: Number(body.startTimestamp),
|
58
|
+
distributionType: parseDistributionType(params),
|
56
59
|
amount: body.amount,
|
57
60
|
creatorAddress: body.creator,
|
58
|
-
distributionType: "DUTCH_AUCTION",
|
59
61
|
createdAt: new Date().toISOString(),
|
60
62
|
chain,
|
61
63
|
};
|
@@ -184,6 +184,7 @@ export declare const CampaignTestController: Elysia<"/campaigns", false, {
|
|
184
184
|
verified: boolean;
|
185
185
|
isTest: boolean;
|
186
186
|
isPoint: boolean;
|
187
|
+
isPreTGE: boolean;
|
187
188
|
isNative: boolean;
|
188
189
|
} & {
|
189
190
|
price?: number | null | undefined;
|
@@ -247,6 +248,7 @@ export declare const CampaignTestController: Elysia<"/campaigns", false, {
|
|
247
248
|
verified: boolean;
|
248
249
|
isTest: boolean;
|
249
250
|
isPoint: boolean;
|
251
|
+
isPreTGE: boolean;
|
250
252
|
isNative: boolean;
|
251
253
|
} & {
|
252
254
|
price?: number | null | undefined;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { dynamicDataBuilderFactory } from "@/engine/deprecated/dynamicData/factory";
|
2
|
-
import { hasFixedAprConfig } from "@/engine/deprecated/dynamicData/utils/getFixedApr";
|
3
2
|
import { campaignTVLBuilderFactory } from "@/engine/tvl/factory";
|
4
3
|
import { HttpError } from "@/errors";
|
5
4
|
import { InvalidParameter } from "@/errors/InvalidParameter.error";
|
@@ -9,7 +8,8 @@ import { RewardService } from "@/modules/v4/reward/reward.service";
|
|
9
8
|
import { TvlService } from "@/modules/v4/tvl/tvl.service";
|
10
9
|
import bigintToString from "@/utils/bigintToString";
|
11
10
|
import { log } from "@/utils/logger";
|
12
|
-
import {
|
11
|
+
import { parseDistributionType } from "@/utils/parseDistributionType";
|
12
|
+
import { AprType, DistributionType } from "@db/api";
|
13
13
|
import { Campaign as CampaignType, DAY, NETWORK_LABELS, bigIntToNumber, } from "@sdk";
|
14
14
|
import moment from "moment";
|
15
15
|
import { AprService } from "../apr";
|
@@ -95,17 +95,17 @@ export class DynamicDataService {
|
|
95
95
|
}
|
96
96
|
let campaignDailyValue = await TokenService.getValueByTokenId(TokenService.hashId({ address: rewardTokenAddress, chainId: record.campaign.chainId }), dailyAmount);
|
97
97
|
// Fixed APR campaigns
|
98
|
-
|
98
|
+
const distributionType = parseDistributionType(campaignParameters);
|
99
|
+
if (distributionType !== DistributionType.DUTCH_AUCTION) {
|
99
100
|
log.local(`[${NETWORK_LABELS[chainId]}][${CampaignType[type]}] calculating fixed APR for ${record.campaign.campaignId}`);
|
100
|
-
const {
|
101
|
+
const { apr: fixedApr } = campaignParameters;
|
101
102
|
const targetApr = Number(fixedApr);
|
102
|
-
if (
|
103
|
+
if (distributionType === DistributionType.FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE) {
|
103
104
|
// Case 1: Fixed $ amount of reward per $ of liquidity
|
104
105
|
campaignDailyValue = targetApr * tvl.total;
|
105
106
|
dailyAmount = BigInt((campaignDailyValue / (rewardToken.price ?? 1)) * 10 ** rewardToken.decimals);
|
106
107
|
}
|
107
|
-
if (
|
108
|
-
// Case 2: Fixed # amount of reward per $ of liquidity
|
108
|
+
if (distributionType === DistributionType.FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE) {
|
109
109
|
// Return 0 if reward token price is invalid
|
110
110
|
// targetApr represents a yearly # amount of reward per $ of liquidity
|
111
111
|
dailyAmount =
|