@merkl/api 0.20.46 → 0.20.48
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 +44 -1
- package/dist/database/api/.generated/drizzle/schema.js +3 -2
- package/dist/database/api/.generated/drizzle/schema.ts +3 -2
- package/dist/database/api/.generated/edge.js +7 -7
- package/dist/database/api/.generated/index-browser.js +9 -1
- package/dist/database/api/.generated/index.d.ts +97 -5
- package/dist/database/api/.generated/index.js +7 -7
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +13 -13
- package/dist/database/api/.generated/wasm.js +9 -1
- package/dist/src/eden/index.d.ts +351 -15
- package/dist/src/engine/dynamicData/implementations/Clamm.js +30 -31
- package/dist/src/index.d.ts +87 -3
- package/dist/src/jobs/update-dynamic-data.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +3 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +5 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +9 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +4 -4
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +80 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +16 -3
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +26 -4
- package/dist/src/modules/v4/opportunity/opportunity.model.js +8 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +16 -40
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +72 -181
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +44 -25
- package/dist/src/modules/v4/opportunity/opportunity.service.js +15 -33
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +9 -3
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +1 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +1 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +7 -0
- package/dist/src/modules/v4/router.d.ts +87 -3
- package/dist/src/modules/v4/token/token.controller.d.ts +0 -3
- package/dist/src/modules/v4/token/token.model.d.ts +0 -3
- package/dist/src/modules/v4/token/token.model.js +0 -1
- package/dist/src/modules/v4/token/token.service.js +5 -5
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -295,11 +295,11 @@ export class ClammDynamicData {
|
|
295
295
|
const symbolToken1 = d.campaignParameters.symbolToken1;
|
296
296
|
const prevI = i;
|
297
297
|
try {
|
298
|
-
poolTotalLiquidity =
|
298
|
+
poolTotalLiquidity = BigNumber.from(poolInterface.decodeFunctionResult(Liquidity[AMMAlgorithmMapping[pool.amm]], result[i++].returnData)[DecodeLiquidity[AMMAlgorithmMapping[pool.amm]]]);
|
299
299
|
sqrtPrice = poolInterface
|
300
300
|
.decodeFunctionResult(PoolState[AMMAlgorithmMapping[pool.amm]], result[i++].returnData)[SqrtPrice[AMMAlgorithmMapping[pool.amm]]].toString();
|
301
|
-
poolBalanceToken0 =
|
302
|
-
poolBalanceToken1 =
|
301
|
+
poolBalanceToken0 = BigNumber.from(ERC20Interface.decodeFunctionResult("balanceOf", result[i++].returnData)[0]);
|
302
|
+
poolBalanceToken1 = BigNumber.from(ERC20Interface.decodeFunctionResult("balanceOf", result[i++].returnData)[0]);
|
303
303
|
}
|
304
304
|
catch (e) {
|
305
305
|
log.warn(`merklDynamic data - failed to decode state of pool ${pool.address} on ${NETWORK_LABELS[chainId]}`);
|
@@ -565,9 +565,9 @@ export class ClammDynamicData {
|
|
565
565
|
const propToken0 = (BN2Number(c.campaignParameters.weightToken0, 4) / totalWeight) * 100;
|
566
566
|
const propToken1 = (BN2Number(c.campaignParameters.weightToken1, 4) / totalWeight) * 100;
|
567
567
|
let distributionMeanAPR = 0;
|
568
|
-
let blacklistedBalance0 = 0;
|
569
|
-
let blacklistedBalance1 = 0;
|
570
|
-
let blacklistedLiquidity = 0;
|
568
|
+
let blacklistedBalance0 = BigNumber.from(0);
|
569
|
+
let blacklistedBalance1 = BigNumber.from(0);
|
570
|
+
let blacklistedLiquidity = BigNumber.from(0);
|
571
571
|
/**
|
572
572
|
* @dev In case there is a super amm handling some other amm lp positions,
|
573
573
|
* we only need to check the positions associated to this super amm subgraph
|
@@ -620,12 +620,12 @@ export class ClammDynamicData {
|
|
620
620
|
catch {
|
621
621
|
log.warn(`merklDynamic data - failed to handle whitelisted positions of pool ${pool.address} on ${NETWORK_LABELS[chainId]} - ${pos.owner} ${pos.tickLower} ${pos.tickUpper} ${pos.liquidity}`);
|
622
622
|
}
|
623
|
-
blacklistedBalance0
|
624
|
-
blacklistedBalance1
|
623
|
+
blacklistedBalance0 = blacklistedBalance0.sub(amount0);
|
624
|
+
blacklistedBalance1 = blacklistedBalance0.sub(amount1);
|
625
625
|
if (c.campaignParameters.isOutOfRangeIncentivized
|
626
626
|
? BN2Number(amount0, decimalsToken0) > 0 || BN2Number(amount1, decimalsToken1) > 0
|
627
627
|
: BN2Number(amount0, decimalsToken0) > 0 && BN2Number(amount1, decimalsToken1) > 0)
|
628
|
-
blacklistedLiquidity
|
628
|
+
blacklistedLiquidity = blacklistedLiquidity.sub(pos.liquidity);
|
629
629
|
}
|
630
630
|
// Handling the case of a ALM of priority 2 being whitelisted
|
631
631
|
else if (pos.pool.id === pool.address.toLowerCase() &&
|
@@ -647,33 +647,30 @@ export class ClammDynamicData {
|
|
647
647
|
catch {
|
648
648
|
log.warn(`merklDynamic data - failed to handle whitelisted positions of pool ${pool.address} on ${NETWORK_LABELS[chainId]} - ${pos.owner} ${pos.tickLower} ${pos.tickUpper} ${pos.liquidity}`);
|
649
649
|
}
|
650
|
-
blacklistedBalance0
|
651
|
-
|
652
|
-
blacklistedBalance1 -=
|
653
|
-
(BN2Number(amount1, decimalsToken1) * childALM.almBalance1) / almHolding.almBalance1;
|
650
|
+
blacklistedBalance0 = blacklistedBalance0.sub((BN2Number(amount0, decimalsToken0) * childALM.almBalance0) / almHolding.almBalance1);
|
651
|
+
blacklistedBalance1 = blacklistedBalance1.sub(BigNumber.from((BN2Number(amount1, decimalsToken1) * childALM.almBalance1) / almHolding.almBalance1));
|
654
652
|
if (c.campaignParameters.isOutOfRangeIncentivized
|
655
653
|
? BN2Number(amount0, decimalsToken0) > 0 || BN2Number(amount1, decimalsToken1) > 0
|
656
654
|
: BN2Number(amount0, decimalsToken0) > 0 && BN2Number(amount1, decimalsToken1) > 0)
|
657
|
-
blacklistedLiquidity
|
658
|
-
(BN2Number(pos.liquidity) * childALM.almTotalLiquidity) / almHolding.almTotalLiquidity;
|
655
|
+
blacklistedLiquidity = blacklistedLiquidity.sub(BigNumber.from((BN2Number(pos.liquidity) * childALM.almTotalLiquidity) / almHolding.almTotalLiquidity));
|
659
656
|
}
|
660
657
|
}
|
661
658
|
}
|
662
659
|
});
|
663
660
|
}
|
664
661
|
else if (c.campaignParameters.blacklist.length > 0) {
|
665
|
-
blacklistedBalance0 = 0;
|
666
|
-
blacklistedBalance1 = 0;
|
667
|
-
blacklistedLiquidity = 0;
|
662
|
+
blacklistedBalance0 = BigNumber.from(0);
|
663
|
+
blacklistedBalance1 = BigNumber.from(0);
|
664
|
+
blacklistedLiquidity = BigNumber.from(0);
|
668
665
|
for (const blacklistedAddress of c.campaignParameters.blacklist) {
|
669
666
|
const blackAddressPositions = positions?.[amm]?.filter(pos => pos.pool.id === pool.address.toLowerCase() && pos.owner === blacklistedAddress.toLowerCase());
|
670
667
|
if (!!blackAddressPositions) {
|
671
668
|
for (const position of blackAddressPositions) {
|
672
669
|
const [amount0, amount1] = getAmountsForLiquidity(sqrtPrice, Number.parseInt(position.tickLower), Number.parseInt(position.tickUpper), BigNumber.from(position.liquidity));
|
673
|
-
blacklistedBalance0
|
674
|
-
blacklistedBalance1
|
670
|
+
blacklistedBalance0 = blacklistedBalance0.add(amount0);
|
671
|
+
blacklistedBalance1 = blacklistedBalance1.add(amount1);
|
675
672
|
if (BN2Number(amount0, decimalsToken0) > 0 && BN2Number(amount1, decimalsToken1) > 0)
|
676
|
-
blacklistedLiquidity
|
673
|
+
blacklistedLiquidity = blacklistedLiquidity.add(position.liquidity);
|
677
674
|
}
|
678
675
|
}
|
679
676
|
}
|
@@ -713,9 +710,9 @@ export class ClammDynamicData {
|
|
713
710
|
/**
|
714
711
|
* General APR (@notice potentially with a boost)
|
715
712
|
*/
|
716
|
-
const poolBalanceToken0WithoutBlacklist = Math.max(poolBalanceToken0
|
717
|
-
const poolBalanceToken1WithoutBlacklist = Math.max(poolBalanceToken1
|
718
|
-
const poolLiquidityWithoutBlacklist = Math.max(poolTotalLiquidity
|
713
|
+
const poolBalanceToken0WithoutBlacklist = Math.max(BN2Number(poolBalanceToken0.sub(blacklistedBalance0), decimalsToken0), 0.00001);
|
714
|
+
const poolBalanceToken1WithoutBlacklist = Math.max(BN2Number(poolBalanceToken1.sub(blacklistedBalance1), decimalsToken1), 0.00001);
|
715
|
+
const poolLiquidityWithoutBlacklist = Math.max(BN2Number(poolTotalLiquidity.sub(blacklistedLiquidity)), 0);
|
719
716
|
const tvl = isStrykeCampaign(amm)
|
720
717
|
? (await axios.get(`https://api.stryke.xyz/clamm/stats/tvl/${pool.address}?chainId=${chainId}`))
|
721
718
|
.data
|
@@ -875,6 +872,8 @@ export class ClammDynamicData {
|
|
875
872
|
]);
|
876
873
|
const rewardToken = rewardTokens[0];
|
877
874
|
distributionMeanAPR = rewardToken.isPoint ? distributionMeanAPR / 365 / 100 : distributionMeanAPR;
|
875
|
+
const poolBalanceToken0Number = BN2Number(poolBalanceToken0, decimalsToken0);
|
876
|
+
const poolBalanceToken1Number = BN2Number(poolBalanceToken1, decimalsToken1);
|
878
877
|
dynamicData.push({
|
879
878
|
...campaign,
|
880
879
|
amm: pool.amm,
|
@@ -884,15 +883,15 @@ export class ClammDynamicData {
|
|
884
883
|
apr: distributionMeanAPR,
|
885
884
|
aprs,
|
886
885
|
aprBreakdowns,
|
887
|
-
blacklistedBalance0,
|
888
|
-
blacklistedBalance1,
|
889
|
-
blacklistedLiquidity,
|
886
|
+
blacklistedBalance0: BN2Number(blacklistedBalance0, decimalsToken0),
|
887
|
+
blacklistedBalance1: BN2Number(blacklistedBalance1, decimalsToken1),
|
888
|
+
blacklistedLiquidity: BN2Number(blacklistedLiquidity),
|
890
889
|
forwarders: distributionForwarders,
|
891
890
|
isLive,
|
892
891
|
isMock: c.campaignParameters.symbolRewardToken === "aglaMerkl",
|
893
|
-
poolBalanceToken0,
|
894
|
-
poolBalanceToken1,
|
895
|
-
poolTotalLiquidity,
|
892
|
+
poolBalanceToken0: poolBalanceToken0Number,
|
893
|
+
poolBalanceToken1: poolBalanceToken1Number,
|
894
|
+
poolTotalLiquidity: BN2Number(poolTotalLiquidity),
|
896
895
|
symbolToken0,
|
897
896
|
symbolToken1,
|
898
897
|
tick: getTickAtSqrtRatio(JSBI.BigInt(sqrtPrice)),
|
@@ -900,7 +899,7 @@ export class ClammDynamicData {
|
|
900
899
|
tvl: isStrykeCampaign(pool.amm)
|
901
900
|
? (await axios.get(`https://api.stryke.xyz/clamm/stats/tvl/${pool.address}?chainId=${chainId}`))
|
902
901
|
.data
|
903
|
-
:
|
902
|
+
: poolBalanceToken0Number * priceToken0 + poolBalanceToken1Number * priceToken1,
|
904
903
|
});
|
905
904
|
}
|
906
905
|
}
|
package/dist/src/index.d.ts
CHANGED
@@ -191,6 +191,7 @@ declare const app: Elysia<"", false, {
|
|
191
191
|
tags: string[];
|
192
192
|
identifier: string;
|
193
193
|
action: import("@db/api").$Enums.OpportunityAction;
|
194
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
194
195
|
chainId: number;
|
195
196
|
depositUrl: string | null;
|
196
197
|
explorerAddress: string | null;
|
@@ -203,6 +204,83 @@ declare const app: Elysia<"", false, {
|
|
203
204
|
};
|
204
205
|
};
|
205
206
|
};
|
207
|
+
} & {
|
208
|
+
opportunities: {
|
209
|
+
":id": {
|
210
|
+
override: {
|
211
|
+
patch: {
|
212
|
+
body: {
|
213
|
+
name?: string | undefined;
|
214
|
+
action?: "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "SWAP" | "INVALID" | undefined;
|
215
|
+
depositUrl?: string | undefined;
|
216
|
+
explorerAddress?: string | undefined;
|
217
|
+
};
|
218
|
+
params: {
|
219
|
+
id: string;
|
220
|
+
};
|
221
|
+
query: unknown;
|
222
|
+
headers: {
|
223
|
+
authorization: string;
|
224
|
+
};
|
225
|
+
response: {
|
226
|
+
200: {
|
227
|
+
id: string;
|
228
|
+
name: string;
|
229
|
+
type: string;
|
230
|
+
status: import("@db/api").$Enums.Status;
|
231
|
+
tags: string[];
|
232
|
+
identifier: string;
|
233
|
+
action: import("@db/api").$Enums.OpportunityAction;
|
234
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
235
|
+
chainId: number;
|
236
|
+
depositUrl: string | null;
|
237
|
+
explorerAddress: string | null;
|
238
|
+
mainProtocolId: string | null;
|
239
|
+
tvl: number;
|
240
|
+
apr: number;
|
241
|
+
dailyRewards: number;
|
242
|
+
};
|
243
|
+
};
|
244
|
+
};
|
245
|
+
};
|
246
|
+
};
|
247
|
+
};
|
248
|
+
} & {
|
249
|
+
opportunities: {
|
250
|
+
":id": {
|
251
|
+
override: {
|
252
|
+
delete: {
|
253
|
+
body: ("name" | "action" | "depositUrl" | "explorerAddress")[];
|
254
|
+
params: {
|
255
|
+
id: string;
|
256
|
+
};
|
257
|
+
query: unknown;
|
258
|
+
headers: {
|
259
|
+
authorization: string;
|
260
|
+
};
|
261
|
+
response: {
|
262
|
+
200: {
|
263
|
+
id: string;
|
264
|
+
name: string;
|
265
|
+
type: string;
|
266
|
+
status: import("@db/api").$Enums.Status;
|
267
|
+
tags: string[];
|
268
|
+
identifier: string;
|
269
|
+
action: import("@db/api").$Enums.OpportunityAction;
|
270
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
271
|
+
chainId: number;
|
272
|
+
depositUrl: string | null;
|
273
|
+
explorerAddress: string | null;
|
274
|
+
mainProtocolId: string | null;
|
275
|
+
tvl: number;
|
276
|
+
apr: number;
|
277
|
+
dailyRewards: number;
|
278
|
+
};
|
279
|
+
};
|
280
|
+
};
|
281
|
+
};
|
282
|
+
};
|
283
|
+
};
|
206
284
|
} & {
|
207
285
|
opportunities: {
|
208
286
|
":id": {
|
@@ -383,6 +461,7 @@ declare const app: Elysia<"", false, {
|
|
383
461
|
tags: string[];
|
384
462
|
identifier: string;
|
385
463
|
action: import("@db/api").$Enums.OpportunityAction;
|
464
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
386
465
|
chainId: number;
|
387
466
|
depositUrl: string | null;
|
388
467
|
explorerAddress: string | null;
|
@@ -1094,6 +1173,7 @@ declare const app: Elysia<"", false, {
|
|
1094
1173
|
tags: string[];
|
1095
1174
|
identifier: string;
|
1096
1175
|
action: import("@db/api").$Enums.OpportunityAction;
|
1176
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
1097
1177
|
chainId: number;
|
1098
1178
|
depositUrl: string | null;
|
1099
1179
|
explorerAddress: string | null;
|
@@ -1425,6 +1505,7 @@ declare const app: Elysia<"", false, {
|
|
1425
1505
|
tags: string[];
|
1426
1506
|
identifier: string;
|
1427
1507
|
action: import("@db/api").$Enums.OpportunityAction;
|
1508
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
1428
1509
|
chainId: number;
|
1429
1510
|
depositUrl: string | null;
|
1430
1511
|
explorerAddress: string | null;
|
@@ -1508,6 +1589,7 @@ declare const app: Elysia<"", false, {
|
|
1508
1589
|
tags: string[];
|
1509
1590
|
identifier: string;
|
1510
1591
|
action: import("@db/api").$Enums.OpportunityAction;
|
1592
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
1511
1593
|
chainId: number;
|
1512
1594
|
depositUrl: string | null;
|
1513
1595
|
explorerAddress: string | null;
|
@@ -1692,6 +1774,7 @@ declare const app: Elysia<"", false, {
|
|
1692
1774
|
tags: string[];
|
1693
1775
|
identifier: string;
|
1694
1776
|
action: import("@db/api").$Enums.OpportunityAction;
|
1777
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
1695
1778
|
chainId: number;
|
1696
1779
|
depositUrl: string | null;
|
1697
1780
|
explorerAddress: string | null;
|
@@ -2343,9 +2426,6 @@ declare const app: Elysia<"", false, {
|
|
2343
2426
|
plain_text: string;
|
2344
2427
|
}[];
|
2345
2428
|
};
|
2346
|
-
Verified: {
|
2347
|
-
checkbox: boolean;
|
2348
|
-
};
|
2349
2429
|
"CoinGecko API ID (Recommended)": {
|
2350
2430
|
rich_text: {
|
2351
2431
|
plain_text: string;
|
@@ -3376,6 +3456,7 @@ declare const app: Elysia<"", false, {
|
|
3376
3456
|
tags: string[];
|
3377
3457
|
identifier: string;
|
3378
3458
|
action: import("@db/api").$Enums.OpportunityAction;
|
3459
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
3379
3460
|
chainId: number;
|
3380
3461
|
depositUrl: string | null;
|
3381
3462
|
explorerAddress: string | null;
|
@@ -3494,6 +3575,7 @@ declare const app: Elysia<"", false, {
|
|
3494
3575
|
tags: string[];
|
3495
3576
|
identifier: string;
|
3496
3577
|
action: import("@db/api").$Enums.OpportunityAction;
|
3578
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
3497
3579
|
chainId: number;
|
3498
3580
|
depositUrl: string | null;
|
3499
3581
|
explorerAddress: string | null;
|
@@ -3954,6 +4036,8 @@ declare const app: Elysia<"", false, {
|
|
3954
4036
|
decimals?: number | undefined;
|
3955
4037
|
chainId: number;
|
3956
4038
|
tokenAddress: string;
|
4039
|
+
rewardTokenAddress: string;
|
4040
|
+
symbolRewardToken: string;
|
3957
4041
|
};
|
3958
4042
|
headers: {
|
3959
4043
|
authorization: string;
|
@@ -49,7 +49,7 @@ const main = async (chainId) => {
|
|
49
49
|
if (status === "PAST" && (opportunity.apr !== 0 || opportunity.dailyRewards !== 0))
|
50
50
|
await OpportunityService.update(opportunity.id, { status, apr: 0, dailyRewards: 0 });
|
51
51
|
if (opportunity.status !== status)
|
52
|
-
await OpportunityService.
|
52
|
+
await OpportunityService.update(opportunity.id, { status });
|
53
53
|
}
|
54
54
|
// 3. Update the status of the opportunities associated to future campaigns
|
55
55
|
const futureOpportunityIds = (await CampaignService.getFutureCampaigns({ computeChainId: chainId })).map(c => c.Opportunity.id);
|
@@ -328,6 +328,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
328
328
|
tags: string[];
|
329
329
|
identifier: string;
|
330
330
|
action: import("@db/api").$Enums.OpportunityAction;
|
331
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
331
332
|
chainId: number;
|
332
333
|
depositUrl: string | null;
|
333
334
|
explorerAddress: string | null;
|
@@ -411,6 +412,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
411
412
|
tags: string[];
|
412
413
|
identifier: string;
|
413
414
|
action: import("@db/api").$Enums.OpportunityAction;
|
415
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
414
416
|
chainId: number;
|
415
417
|
depositUrl: string | null;
|
416
418
|
explorerAddress: string | null;
|
@@ -595,6 +597,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
595
597
|
tags: string[];
|
596
598
|
identifier: string;
|
597
599
|
action: import("@db/api").$Enums.OpportunityAction;
|
600
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
598
601
|
chainId: number;
|
599
602
|
depositUrl: string | null;
|
600
603
|
explorerAddress: string | null;
|
@@ -310,6 +310,7 @@ export declare abstract class CampaignRepository {
|
|
310
310
|
tags: string[];
|
311
311
|
identifier: string;
|
312
312
|
action: import("@db/api").$Enums.OpportunityAction;
|
313
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
313
314
|
chainId: number;
|
314
315
|
depositUrl: string | null;
|
315
316
|
explorerAddress: string | null;
|
@@ -355,6 +356,7 @@ export declare abstract class CampaignRepository {
|
|
355
356
|
tags: string[];
|
356
357
|
identifier: string;
|
357
358
|
action: import("@db/api").$Enums.OpportunityAction;
|
359
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
358
360
|
chainId: number;
|
359
361
|
depositUrl: string | null;
|
360
362
|
explorerAddress: string | null;
|
@@ -416,6 +418,7 @@ export declare abstract class CampaignRepository {
|
|
416
418
|
tags: string[];
|
417
419
|
identifier: string;
|
418
420
|
action: import("@db/api").$Enums.OpportunityAction;
|
421
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
419
422
|
chainId: number;
|
420
423
|
depositUrl: string | null;
|
421
424
|
explorerAddress: string | null;
|
@@ -595,6 +598,7 @@ export declare abstract class CampaignRepository {
|
|
595
598
|
tags: string[];
|
596
599
|
identifier: string;
|
597
600
|
action: import("@db/api").$Enums.OpportunityAction;
|
601
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
598
602
|
chainId: number;
|
599
603
|
depositUrl: string | null;
|
600
604
|
explorerAddress: string | null;
|
@@ -676,6 +680,7 @@ export declare abstract class CampaignRepository {
|
|
676
680
|
tags: string[];
|
677
681
|
identifier: string;
|
678
682
|
action: import("@db/api").$Enums.OpportunityAction;
|
683
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
679
684
|
chainId: number;
|
680
685
|
depositUrl: string | null;
|
681
686
|
explorerAddress: string | null;
|
@@ -17,6 +17,7 @@ export declare abstract class CampaignService {
|
|
17
17
|
tags: string[];
|
18
18
|
identifier: string;
|
19
19
|
action: import("@db/api").$Enums.OpportunityAction;
|
20
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
20
21
|
chainId: number;
|
21
22
|
depositUrl: string | null;
|
22
23
|
explorerAddress: string | null;
|
@@ -54,6 +55,7 @@ export declare abstract class CampaignService {
|
|
54
55
|
tags: string[];
|
55
56
|
identifier: string;
|
56
57
|
action: import("@db/api").$Enums.OpportunityAction;
|
58
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
57
59
|
chainId: number;
|
58
60
|
depositUrl: string | null;
|
59
61
|
explorerAddress: string | null;
|
@@ -107,6 +109,7 @@ export declare abstract class CampaignService {
|
|
107
109
|
tags: string[];
|
108
110
|
identifier: string;
|
109
111
|
action: import("@db/api").$Enums.OpportunityAction;
|
112
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
110
113
|
chainId: number;
|
111
114
|
depositUrl: string | null;
|
112
115
|
explorerAddress: string | null;
|
@@ -240,6 +243,7 @@ export declare abstract class CampaignService {
|
|
240
243
|
tags: string[];
|
241
244
|
identifier: string;
|
242
245
|
action: import("@db/api").$Enums.OpportunityAction;
|
246
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
243
247
|
chainId: number;
|
244
248
|
depositUrl: string | null;
|
245
249
|
explorerAddress: string | null;
|
@@ -310,6 +314,7 @@ export declare abstract class CampaignService {
|
|
310
314
|
tags: string[];
|
311
315
|
identifier: string;
|
312
316
|
action: import("@db/api").$Enums.OpportunityAction;
|
317
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
313
318
|
chainId: number;
|
314
319
|
depositUrl: string | null;
|
315
320
|
explorerAddress: string | null;
|
@@ -381,6 +386,7 @@ export declare abstract class CampaignService {
|
|
381
386
|
tags: string[];
|
382
387
|
identifier: string;
|
383
388
|
action: import("@db/api").$Enums.OpportunityAction;
|
389
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
384
390
|
chainId: number;
|
385
391
|
depositUrl: string | null;
|
386
392
|
explorerAddress: string | null;
|
@@ -452,6 +458,7 @@ export declare abstract class CampaignService {
|
|
452
458
|
tags: string[];
|
453
459
|
identifier: string;
|
454
460
|
action: import("@db/api").$Enums.OpportunityAction;
|
461
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
455
462
|
chainId: number;
|
456
463
|
depositUrl: string | null;
|
457
464
|
explorerAddress: string | null;
|
@@ -570,6 +577,7 @@ export declare abstract class CampaignService {
|
|
570
577
|
tags: string[];
|
571
578
|
identifier: string;
|
572
579
|
action: import("@db/api").$Enums.OpportunityAction;
|
580
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
573
581
|
chainId: number;
|
574
582
|
depositUrl: string | null;
|
575
583
|
explorerAddress: string | null;
|
@@ -721,6 +729,7 @@ export declare abstract class CampaignService {
|
|
721
729
|
tags: string[];
|
722
730
|
identifier: string;
|
723
731
|
action: import("@db/api").$Enums.OpportunityAction;
|
732
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
724
733
|
chainId: number;
|
725
734
|
depositUrl: string | null;
|
726
735
|
explorerAddress: string | null;
|
@@ -21,6 +21,8 @@ export declare const DynamicDataController: Elysia<"/dynamic-data", false, {
|
|
21
21
|
decimals?: number | undefined;
|
22
22
|
chainId: number;
|
23
23
|
tokenAddress: string;
|
24
|
+
rewardTokenAddress: string;
|
25
|
+
symbolRewardToken: string;
|
24
26
|
};
|
25
27
|
headers: {
|
26
28
|
authorization: string;
|
@@ -9,7 +9,7 @@ export const DynamicDataController = new Elysia({
|
|
9
9
|
detail: { tags: ["DynamicData"], hide: true },
|
10
10
|
})
|
11
11
|
// ─── Get type Info By Token Address ───────────────────────────────────────
|
12
|
-
.get("/", async ({ query }) => await DynamicDataService.queryERC20DynamicData(query.chainId, query.tokenAddress, query.decimals), {
|
12
|
+
.get("/", async ({ query }) => await DynamicDataService.queryERC20DynamicData(query.chainId, query.tokenAddress, query.rewardTokenAddress, query.symbolRewardToken, query.decimals), {
|
13
13
|
query: DynamicDataSourceIdentifier,
|
14
14
|
headers: AuthorizationHeadersDto,
|
15
15
|
beforeHandle: async ({ query, headers }) => {
|
@@ -2,6 +2,8 @@ import type { SinglePayloadInputDto } from "@/modules/v4/programPayload/programP
|
|
2
2
|
export declare const DynamicDataSourceIdentifier: import("@sinclair/typebox").TObject<{
|
3
3
|
chainId: import("@sinclair/typebox").TNumber;
|
4
4
|
tokenAddress: import("@sinclair/typebox").TString;
|
5
|
+
rewardTokenAddress: import("@sinclair/typebox").TString;
|
6
|
+
symbolRewardToken: import("@sinclair/typebox").TString;
|
5
7
|
decimals: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
6
8
|
}>;
|
7
9
|
export declare const DynamicDataExtendedDto: import("@sinclair/typebox").TObject<{
|
@@ -3,6 +3,8 @@ import { t } from "elysia";
|
|
3
3
|
export const DynamicDataSourceIdentifier = t.Object({
|
4
4
|
chainId: t.Numeric(),
|
5
5
|
tokenAddress: t.String(),
|
6
|
+
rewardTokenAddress: t.String(),
|
7
|
+
symbolRewardToken: t.String(),
|
6
8
|
decimals: t.Optional(t.Numeric()),
|
7
9
|
});
|
8
10
|
export const DynamicDataExtendedDto = t.Object({
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Campaign, type CampaignDynamicData, type CampaignParameters, type ChainId } from "@sdk";
|
2
2
|
import { Campaign as CampaignEnum } from "@sdk";
|
3
3
|
export declare class DynamicDataService {
|
4
|
-
static queryERC20DynamicData(chainId: ChainId, tokenAddress: string, decimals?: number): Promise<{
|
4
|
+
static queryERC20DynamicData(chainId: ChainId, tokenAddress: string, rewardTokenAddress: string, symbolRewardToken: string, decimals?: number): Promise<{
|
5
5
|
tvl: number;
|
6
6
|
totalSupply: number;
|
7
7
|
cardName: string;
|
@@ -10,7 +10,7 @@ import { OpportunityRepository } from "../opportunity/opportunity.repository";
|
|
10
10
|
import { RewardService } from "../reward";
|
11
11
|
import { TvlService } from "../tvl";
|
12
12
|
export class DynamicDataService {
|
13
|
-
static async queryERC20DynamicData(chainId, tokenAddress, decimals = 18) {
|
13
|
+
static async queryERC20DynamicData(chainId, tokenAddress, rewardTokenAddress, symbolRewardToken, decimals = 18) {
|
14
14
|
const campaigns = [
|
15
15
|
{
|
16
16
|
campaignId: tokenAddress,
|
@@ -22,7 +22,7 @@ export class DynamicDataService {
|
|
22
22
|
endTimestamp: 1672531199, // Example end timestamp
|
23
23
|
index: 0,
|
24
24
|
mainParameter: "0xexamplemainparameter",
|
25
|
-
rewardToken:
|
25
|
+
rewardToken: rewardTokenAddress,
|
26
26
|
startTimestamp: 1672444800, // Example start timestamp
|
27
27
|
lastEligibilityRatio: 1,
|
28
28
|
campaignParameters: {
|
@@ -34,7 +34,7 @@ export class DynamicDataService {
|
|
34
34
|
forwarders: [],
|
35
35
|
hooks: [],
|
36
36
|
shouldIgnore: false,
|
37
|
-
symbolRewardToken:
|
37
|
+
symbolRewardToken: symbolRewardToken,
|
38
38
|
symbolTargetToken: "EXT",
|
39
39
|
targetToken: tokenAddress,
|
40
40
|
},
|
@@ -104,7 +104,7 @@ export class DynamicDataService {
|
|
104
104
|
});
|
105
105
|
try {
|
106
106
|
if (!dryRun)
|
107
|
-
await OpportunityRepository.
|
107
|
+
await OpportunityRepository.updateDynamicData(opportunityId, apr, tvl, dailyRewards);
|
108
108
|
}
|
109
109
|
catch (err) {
|
110
110
|
throw new HttpError("Failed to update dynamic data", 500, {
|
@@ -46,6 +46,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
46
46
|
tags: string[];
|
47
47
|
identifier: string;
|
48
48
|
action: import("@db/api").$Enums.OpportunityAction;
|
49
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
49
50
|
chainId: number;
|
50
51
|
depositUrl: string | null;
|
51
52
|
explorerAddress: string | null;
|
@@ -58,6 +59,83 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
58
59
|
};
|
59
60
|
};
|
60
61
|
};
|
62
|
+
} & {
|
63
|
+
opportunities: {
|
64
|
+
":id": {
|
65
|
+
override: {
|
66
|
+
patch: {
|
67
|
+
body: {
|
68
|
+
name?: string | undefined;
|
69
|
+
action?: "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "SWAP" | "INVALID" | undefined;
|
70
|
+
depositUrl?: string | undefined;
|
71
|
+
explorerAddress?: string | undefined;
|
72
|
+
};
|
73
|
+
params: {
|
74
|
+
id: string;
|
75
|
+
};
|
76
|
+
query: unknown;
|
77
|
+
headers: {
|
78
|
+
authorization: string;
|
79
|
+
};
|
80
|
+
response: {
|
81
|
+
200: {
|
82
|
+
id: string;
|
83
|
+
name: string;
|
84
|
+
type: string;
|
85
|
+
status: import("@db/api").$Enums.Status;
|
86
|
+
tags: string[];
|
87
|
+
identifier: string;
|
88
|
+
action: import("@db/api").$Enums.OpportunityAction;
|
89
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
90
|
+
chainId: number;
|
91
|
+
depositUrl: string | null;
|
92
|
+
explorerAddress: string | null;
|
93
|
+
mainProtocolId: string | null;
|
94
|
+
tvl: number;
|
95
|
+
apr: number;
|
96
|
+
dailyRewards: number;
|
97
|
+
};
|
98
|
+
};
|
99
|
+
};
|
100
|
+
};
|
101
|
+
};
|
102
|
+
};
|
103
|
+
} & {
|
104
|
+
opportunities: {
|
105
|
+
":id": {
|
106
|
+
override: {
|
107
|
+
delete: {
|
108
|
+
body: ("name" | "action" | "depositUrl" | "explorerAddress")[];
|
109
|
+
params: {
|
110
|
+
id: string;
|
111
|
+
};
|
112
|
+
query: unknown;
|
113
|
+
headers: {
|
114
|
+
authorization: string;
|
115
|
+
};
|
116
|
+
response: {
|
117
|
+
200: {
|
118
|
+
id: string;
|
119
|
+
name: string;
|
120
|
+
type: string;
|
121
|
+
status: import("@db/api").$Enums.Status;
|
122
|
+
tags: string[];
|
123
|
+
identifier: string;
|
124
|
+
action: import("@db/api").$Enums.OpportunityAction;
|
125
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
126
|
+
chainId: number;
|
127
|
+
depositUrl: string | null;
|
128
|
+
explorerAddress: string | null;
|
129
|
+
mainProtocolId: string | null;
|
130
|
+
tvl: number;
|
131
|
+
apr: number;
|
132
|
+
dailyRewards: number;
|
133
|
+
};
|
134
|
+
};
|
135
|
+
};
|
136
|
+
};
|
137
|
+
};
|
138
|
+
};
|
61
139
|
} & {
|
62
140
|
opportunities: {
|
63
141
|
":id": {
|
@@ -238,6 +316,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
238
316
|
tags: string[];
|
239
317
|
identifier: string;
|
240
318
|
action: import("@db/api").$Enums.OpportunityAction;
|
319
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
241
320
|
chainId: number;
|
242
321
|
depositUrl: string | null;
|
243
322
|
explorerAddress: string | null;
|
@@ -949,6 +1028,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
949
1028
|
tags: string[];
|
950
1029
|
identifier: string;
|
951
1030
|
action: import("@db/api").$Enums.OpportunityAction;
|
1031
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
952
1032
|
chainId: number;
|
953
1033
|
depositUrl: string | null;
|
954
1034
|
explorerAddress: string | null;
|