@merkl/api 0.20.59 → 0.20.61

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.
@@ -649,8 +649,8 @@ export class ClammDynamicData {
649
649
  catch {
650
650
  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}`);
651
651
  }
652
- blacklistedBalance0 = blacklistedBalance0.sub(BigNumber.from(Math.floor((BN2Number(amount0, 0) * childALM.almBalance0) / almHolding.almBalance0)));
653
- blacklistedBalance1 = blacklistedBalance1.sub(BigNumber.from(Math.floor((BN2Number(amount1, 0) * childALM.almBalance1) / almHolding.almBalance1)));
652
+ blacklistedBalance0 = blacklistedBalance0.sub(BigInt(Math.floor((BN2Number(amount0, 0) * childALM.almBalance0) / almHolding.almBalance0)));
653
+ blacklistedBalance1 = blacklistedBalance1.sub(BigInt(Math.floor((BN2Number(amount1, 0) * childALM.almBalance1) / almHolding.almBalance1)));
654
654
  if (c.campaignParameters.isOutOfRangeIncentivized
655
655
  ? BN2Number(amount0, decimalsToken0) > 0 || BN2Number(amount1, decimalsToken1) > 0
656
656
  : BN2Number(amount0, decimalsToken0) > 0 && BN2Number(amount1, decimalsToken1) > 0) {
@@ -11,6 +11,7 @@ export class OpportunityRepository {
11
11
  static #transformQueryToPrismaFilters(query) {
12
12
  const { page: _page, items: _items, ...filters } = query;
13
13
  //TODO: abstract away query to not be strictly equal to controller
14
+ const now = moment().unix();
14
15
  const chainIds = query.chainId?.split(",").map(n => Number.parseInt(n));
15
16
  const actions = query.action?.split(",");
16
17
  const status = query.status?.split(",");
@@ -65,17 +66,40 @@ export class OpportunityRepository {
65
66
  : {
66
67
  AND: search?.map(keyword => ({
67
68
  OR: [
69
+ //IDs
68
70
  { id: { contains: keyword, mode: "insensitive" } },
69
71
  { name: { contains: keyword, mode: "insensitive" } },
70
72
  { identifier: { contains: keyword, mode: "insensitive" } },
71
73
  { explorerAddress: { contains: keyword, mode: "insensitive" } },
74
+ { Campaigns: { some: { campaignId: { contains: keyword, mode: "insensitive" } } } },
75
+ { Campaigns: { some: { id: { contains: keyword, mode: "insensitive" } } } },
76
+ //ERC20,CLAMM,...
72
77
  { type: { contains: keyword, mode: "insensitive" } },
78
+ //Protocol
73
79
  { MainProtocol: { name: { contains: keyword, mode: "insensitive" } } },
74
80
  { mainProtocolId: { contains: keyword, mode: "insensitive" } },
81
+ //Token
75
82
  { Tokens: { some: { name: { contains: keyword, mode: "insensitive" } } } },
76
83
  { Tokens: { some: { symbol: { contains: keyword, mode: "insensitive" } } } },
77
- { Campaigns: { some: { campaignId: { contains: keyword, mode: "insensitive" } } } },
78
- { Campaigns: { some: { id: { contains: keyword, mode: "insensitive" } } } },
84
+ { Tokens: { some: { address: { contains: keyword, mode: "insensitive" } } } },
85
+ //Match reward tokens only if campaign is live
86
+ {
87
+ Campaigns: {
88
+ some: {
89
+ endTimestamp: { gte: now },
90
+ RewardToken: {
91
+ OR: [
92
+ {
93
+ symbol: { contains: keyword, mode: "insensitive" },
94
+ },
95
+ {
96
+ address: { contains: keyword, mode: "insensitive" },
97
+ },
98
+ ],
99
+ },
100
+ },
101
+ },
102
+ },
79
103
  { Chain: { name: { contains: keyword, mode: "insensitive" } } },
80
104
  ],
81
105
  })),