@merkl/api 0.20.51 → 0.20.53

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.
Files changed (45) hide show
  1. package/dist/src/backgroundJobs/index.js +5 -3
  2. package/dist/src/eden/index.d.ts +1169 -976
  3. package/dist/src/engine/dynamicData/factory.js +6 -0
  4. package/dist/src/engine/dynamicData/implementations/Erc20.d.ts +2 -2
  5. package/dist/src/engine/dynamicData/implementations/Erc20.js +16 -2
  6. package/dist/src/engine/dynamicData/implementations/UniswapV4.js +1 -1
  7. package/dist/src/engine/erc20SubTypeProcessors/helpers/tokenType.d.ts +2 -1
  8. package/dist/src/engine/erc20SubTypeProcessors/helpers/tokenType.js +5 -0
  9. package/dist/src/engine/erc20SubTypeProcessors/implementations/processorMapping.js +1 -0
  10. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound1.js +2 -0
  11. package/dist/src/engine/opportunityMetadata/factory.js +6 -0
  12. package/dist/src/engine/opportunityMetadata/implementations/Erc20.js +1 -1
  13. package/dist/src/index.d.ts +246 -185
  14. package/dist/src/jobs/update-uniswap-v4-pools.js +3 -2
  15. package/dist/src/modules/v4/accounting/accounting.repository.js +72 -18
  16. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +0 -169
  17. package/dist/src/modules/v4/campaign/campaign.controller.js +1 -65
  18. package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +193 -0
  19. package/dist/src/modules/v4/campaign/campaign.test.controller.js +71 -0
  20. package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +67 -2
  21. package/dist/src/modules/v4/programPayload/programPayload.repository.js +67 -0
  22. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +1 -1
  23. package/dist/src/modules/v4/protocol/protocol.controller.js +2 -2
  24. package/dist/src/modules/v4/protocol/protocol.repository.d.ts +1 -9
  25. package/dist/src/modules/v4/protocol/protocol.repository.js +1 -4
  26. package/dist/src/modules/v4/protocol/protocol.service.d.ts +1 -2
  27. package/dist/src/modules/v4/protocol/protocol.service.js +2 -6
  28. package/dist/src/modules/v4/router.d.ts +246 -185
  29. package/dist/src/modules/v4/router.js +2 -0
  30. package/dist/src/modules/v4/uniswap/uniswap.controller.d.ts +72 -15
  31. package/dist/src/modules/v4/uniswap/uniswap.controller.js +49 -6
  32. package/dist/src/modules/v4/uniswap/uniswap.model.d.ts +35 -16
  33. package/dist/src/modules/v4/uniswap/uniswap.model.js +22 -8
  34. package/dist/src/modules/v4/uniswap/uniswap.repository.d.ts +2 -2
  35. package/dist/src/modules/v4/uniswap/uniswap.repository.js +2 -2
  36. package/dist/src/modules/v4/uniswap/uniswap.service.d.ts +4 -19
  37. package/dist/src/modules/v4/uniswap/uniswap.service.js +20 -80
  38. package/dist/src/routes/v3/uniswapv4.js +5 -5
  39. package/dist/src/utils/decodeCalls.js +10 -1
  40. package/dist/src/utils/encodeCalls.js +3 -0
  41. package/dist/src/utils/generateCardName.js +5 -0
  42. package/dist/tsconfig.package.tsbuildinfo +1 -1
  43. package/package.json +14 -14
  44. package/dist/src/engine/dynamicData/utils/getUniswapV4Pools.d.ts +0 -10
  45. package/dist/src/engine/dynamicData/utils/getUniswapV4Pools.js +0 -188
@@ -1,6 +1,32 @@
1
1
  import type { apiDbClient } from "@db";
2
2
  import type { Prisma } from "@db/api";
3
- import type { MerklChainId, UniswapV4PoolType } from "@sdk";
3
+ import { type MerklChainId, type UniswapV4PoolType } from "@sdk";
4
+ export declare const UniV4ChainIdArray: MerklChainId[];
5
+ export declare enum LoggedEntityType {
6
+ EULER = "EULER_VAULT",
7
+ UNISWAP_V4 = "UNISWAP_V4"
8
+ }
9
+ export type UniV4ChainId = (typeof UniV4ChainIdArray)[number];
10
+ export type UniswapV4PoolsReturnType = {
11
+ [chainId in MerklChainId]?: {
12
+ [poolId: string]: UniswapV4PoolType;
13
+ };
14
+ };
15
+ export type LoggedCreateBody = Prisma.Args<typeof apiDbClient.logged, "createMany">["data"];
16
+ export declare const UniswapV4PoolDto: import("@sinclair/typebox").TObject<{
17
+ chainId: import("@sinclair/typebox").TNumber;
18
+ currency0: import("@sinclair/typebox").TString;
19
+ currency1: import("@sinclair/typebox").TString;
20
+ decimalsCurrency0: import("@sinclair/typebox").TNumber;
21
+ decimalsCurrency1: import("@sinclair/typebox").TNumber;
22
+ hooks: import("@sinclair/typebox").TString;
23
+ fetchedAtBlock: import("@sinclair/typebox").TNumber;
24
+ lpFee: import("@sinclair/typebox").TNumber;
25
+ poolId: import("@sinclair/typebox").TString;
26
+ symbolCurrency0: import("@sinclair/typebox").TString;
27
+ symbolCurrency1: import("@sinclair/typebox").TString;
28
+ tickSpacing: import("@sinclair/typebox").TNumber;
29
+ }>;
4
30
  export declare const Bytes32Dto: import("@sinclair/typebox").TObject<{
5
31
  poolId: import("@sinclair/typebox").TRegExp;
6
32
  }>;
@@ -10,24 +36,17 @@ export declare const RewardsPerV3PositionDto: import("@sinclair/typebox").TObjec
10
36
  positionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
37
  }>;
12
38
  export declare const UniswapV4PoolsDto: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
13
- poolKey: import("@sinclair/typebox").TObject<{
14
- currency0: import("@sinclair/typebox").TString;
15
- currency1: import("@sinclair/typebox").TString;
16
- fee: import("@sinclair/typebox").TNumber;
17
- tickSpacing: import("@sinclair/typebox").TNumber;
18
- hooks: import("@sinclair/typebox").TString;
19
- }>;
20
- poolId: import("@sinclair/typebox").TString;
39
+ chainId: import("@sinclair/typebox").TNumber;
40
+ currency0: import("@sinclair/typebox").TString;
41
+ currency1: import("@sinclair/typebox").TString;
21
42
  decimalsCurrency0: import("@sinclair/typebox").TNumber;
22
43
  decimalsCurrency1: import("@sinclair/typebox").TNumber;
44
+ hooks: import("@sinclair/typebox").TString;
45
+ fetchedAtBlock: import("@sinclair/typebox").TNumber;
46
+ lpFee: import("@sinclair/typebox").TNumber;
47
+ poolId: import("@sinclair/typebox").TString;
23
48
  symbolCurrency0: import("@sinclair/typebox").TString;
24
49
  symbolCurrency1: import("@sinclair/typebox").TString;
50
+ tickSpacing: import("@sinclair/typebox").TNumber;
25
51
  }>>;
26
- export type UniswapV4PoolsReturnType = {
27
- [chainId in MerklChainId]?: {
28
- [poolId: string]: UniswapV4PoolType;
29
- };
30
- };
31
- export type UniswapV4PoolsEntity = typeof UniswapV4PoolsDto.static;
32
- export type LoggedCreateBody = Prisma.Args<typeof apiDbClient.logged, "createMany">["data"];
33
52
  export type RewardsPerPositionModel = typeof RewardsPerV3PositionDto.static;
@@ -1,18 +1,32 @@
1
+ import { UniswapV4Addresses } from "@sdk";
1
2
  import { t } from "elysia";
2
- const UniswapV4PoolKeyDto = t.Object({
3
+ export const UniV4ChainIdArray = Object.keys(UniswapV4Addresses).map((x) => Number(x));
4
+ export var LoggedEntityType;
5
+ (function (LoggedEntityType) {
6
+ LoggedEntityType["EULER"] = "EULER_VAULT";
7
+ LoggedEntityType["UNISWAP_V4"] = "UNISWAP_V4";
8
+ })(LoggedEntityType || (LoggedEntityType = {}));
9
+ // DTOs
10
+ // const UniswapV4PoolKeyDto = t.Object({
11
+ // currency0: t.String(),
12
+ // currency1: t.String(),
13
+ // fee: t.Numeric(),
14
+ // tickSpacing: t.Numeric(),
15
+ // hooks: t.String(),
16
+ // });
17
+ export const UniswapV4PoolDto = t.Object({
18
+ chainId: t.Numeric(), // Assuming MerklChainId is a numeric type
3
19
  currency0: t.String(),
4
20
  currency1: t.String(),
5
- fee: t.Numeric(),
6
- tickSpacing: t.Numeric(),
7
- hooks: t.String(),
8
- });
9
- const UniswapV4PoolDto = t.Object({
10
- poolKey: UniswapV4PoolKeyDto,
11
- poolId: t.String(),
12
21
  decimalsCurrency0: t.Numeric(),
13
22
  decimalsCurrency1: t.Numeric(),
23
+ hooks: t.String(),
24
+ fetchedAtBlock: t.Numeric(),
25
+ lpFee: t.Numeric(),
26
+ poolId: t.String(),
14
27
  symbolCurrency0: t.String(),
15
28
  symbolCurrency1: t.String(),
29
+ tickSpacing: t.Numeric(),
16
30
  });
17
31
  export const Bytes32Dto = t.Object({
18
32
  poolId: t.RegExp(/^0x[a-fA-F0-9]{64}$/, {
@@ -1,6 +1,6 @@
1
- import type { LoggedCreateBody } from "./uniswap.model";
1
+ import type { LoggedCreateBody, UniV4ChainId } from "./uniswap.model";
2
2
  export declare abstract class UniswapRepository {
3
- static getStoredPools(): Promise<{
3
+ static getStoredUniswapV4Pools(chainId?: UniV4ChainId): Promise<{
4
4
  id: string;
5
5
  type: import("@db/api").$Enums.LoggedEntityType;
6
6
  address: string | null;
@@ -1,9 +1,9 @@
1
1
  import { apiDbClient } from "@db";
2
2
  import { LoggedEntityType } from "@db/api";
3
3
  export class UniswapRepository {
4
- static async getStoredPools() {
4
+ static async getStoredUniswapV4Pools(chainId) {
5
5
  return await apiDbClient.logged.findMany({
6
- where: { type: LoggedEntityType.UNISWAP_V4 },
6
+ where: { type: LoggedEntityType.UNISWAP_V4, ...(!!chainId && { chainId: chainId }) },
7
7
  });
8
8
  }
9
9
  static async createMany(data) {
@@ -1,23 +1,8 @@
1
1
  import { type MerklChainId } from "@sdk";
2
- import type { RewardsPerPositionModel, UniswapV4PoolsReturnType } from "./uniswap.model";
3
- export declare const PoolManagerInterface: any;
2
+ import { type RewardsPerPositionModel, type UniV4ChainId, type UniswapV4PoolsReturnType } from "./uniswap.model";
4
3
  export declare abstract class UniswapService {
5
4
  static findV3RewardsPerPosition(query: RewardsPerPositionModel): Promise<Record<string, Record<string, any[]>>>;
6
- static getPoolsByChain(chainId: MerklChainId): Promise<{
7
- [x: string]: {
8
- poolId: string;
9
- poolKey: {
10
- hooks: string;
11
- fee: number;
12
- tickSpacing: number;
13
- currency0: string;
14
- currency1: string;
15
- };
16
- decimalsCurrency0: number;
17
- decimalsCurrency1: number;
18
- symbolCurrency0: string;
19
- symbolCurrency1: string;
20
- };
21
- }>;
22
- static getPools(): Promise<UniswapV4PoolsReturnType>;
5
+ static getUniswapV4Pools(chainId?: UniV4ChainId): Promise<UniswapV4PoolsReturnType>;
6
+ /** @deprecated */
7
+ static getUniswapV4PoolsForChain(chainId: MerklChainId): Promise<UniswapV4PoolsReturnType>;
23
8
  }
@@ -1,18 +1,15 @@
1
1
  import { safeFetchLogs } from "@/engine/dynamicData/utils/fetchLogs";
2
- import { batchMulticallCallWithRetry } from "@/utils/generic";
3
2
  import { log } from "@/utils/logger";
4
3
  import { providers } from "@/utils/providers";
5
- import { LoggedEntityType } from "@db/api";
6
- import { ChainInteractionService, ERC20Interface, NETWORK_LABELS, NULL_ADDRESS, UniswapV4Addresses, UniswapV4PoolManagerInterface, UniswapV4PoolManager__factory, getContractCreationBlock, } from "@sdk";
7
- import { utils } from "ethers";
4
+ import { ChainInteractionService, ERC20Interface, NETWORK_LABELS, NULL_ADDRESS, UniswapV4Addresses, UniswapV4PoolManagerInterface, getContractCreationBlock, } from "@sdk";
8
5
  import { getAddress } from "viem";
9
6
  import { BlacklistService } from "../blacklist";
10
7
  import { ChainService } from "../chain/chain.service";
11
8
  import { MerklRootService } from "../merklRoot";
12
9
  import { OpportunityService } from "../opportunity";
13
10
  import { RewardService } from "../reward";
11
+ import { LoggedEntityType, UniV4ChainIdArray, } from "./uniswap.model";
14
12
  import { UniswapRepository } from "./uniswap.repository";
15
- export const PoolManagerInterface = UniswapV4PoolManager__factory.createInterface();
16
13
  export class UniswapService {
17
14
  static async findV3RewardsPerPosition(query) {
18
15
  /** Check if the user is blacklisted */
@@ -52,83 +49,24 @@ export class UniswapService {
52
49
  }
53
50
  return res;
54
51
  }
55
- static async getPoolsByChain(chainId) {
56
- const lastBlock = await providers[chainId].getBlockNumber();
57
- const logs = await safeFetchLogs(chainId, [PoolManagerInterface.getEventTopic("Initialize")], ["0xE8E23e97Fa135823143d6b9Cba9c699040D51F70"], 0, lastBlock);
58
- const poolData = [];
59
- const calls = [];
60
- for (const log of logs) {
61
- const poolId = utils.defaultAbiCoder.decode(["bytes32"], log.topics[1])[0];
62
- const currency0 = utils.defaultAbiCoder.decode(["address"], log.topics[2])[0];
63
- const currency1 = utils.defaultAbiCoder.decode(["address"], log.topics[3])[0];
64
- const [_indexedPoolId, _indexedCurrency0, _indexedCurrency1, fee, tickSpacing, hooks, sqrtPriceX98, tick] = PoolManagerInterface.decodeEventLog("Initialize", log.data, log.topics);
65
- poolData.push({
66
- poolId,
67
- poolKey: {
68
- currency0,
69
- currency1,
70
- fee,
71
- tickSpacing,
72
- hooks,
73
- },
74
- });
75
- calls.push({
76
- allowFailure: true,
77
- callData: ERC20Interface.encodeFunctionData("symbol"),
78
- target: currency0,
79
- }, {
80
- allowFailure: true,
81
- callData: ERC20Interface.encodeFunctionData("decimals"),
82
- target: currency0,
83
- }, {
84
- allowFailure: true,
85
- callData: ERC20Interface.encodeFunctionData("symbol"),
86
- target: currency1,
87
- }, {
88
- allowFailure: true,
89
- callData: ERC20Interface.encodeFunctionData("decimals"),
90
- target: currency1,
91
- });
52
+ static async getUniswapV4Pools(chainId) {
53
+ let chainIdArray;
54
+ if (!!chainId) {
55
+ chainIdArray = [chainId];
92
56
  }
93
- const result = await batchMulticallCallWithRetry(chainId, { calls });
94
- const res = {};
95
- for (const [index, pool] of poolData.entries()) {
96
- let symbolCurrency0 = "";
97
- let decimalsCurrency0 = 0;
98
- let symbolCurrency1 = "";
99
- let decimalsCurrency1 = 0;
100
- try {
101
- symbolCurrency0 = ERC20Interface.decodeFunctionResult("symbol", result[index * 4].returnData)[0];
102
- }
103
- catch { }
104
- try {
105
- decimalsCurrency0 = ERC20Interface.decodeFunctionResult("decimals", result[index * 4 + 1].returnData)[0];
106
- }
107
- catch { }
108
- try {
109
- symbolCurrency1 = ERC20Interface.decodeFunctionResult("symbol", result[index * 4 + 2].returnData)[0];
110
- }
111
- catch { }
112
- try {
113
- decimalsCurrency1 = ERC20Interface.decodeFunctionResult("decimals", result[index * 4 + 3].returnData)[0];
114
- }
115
- catch { }
116
- res[pool.poolId] = { ...pool, symbolCurrency0, decimalsCurrency0, symbolCurrency1, decimalsCurrency1 };
57
+ else {
58
+ chainIdArray = UniV4ChainIdArray;
117
59
  }
118
- return res;
119
- }
120
- static async getPools() {
121
- const UNIV4_CHAINIDS = Object.keys(UniswapV4Addresses).map((x) => Number(x));
122
60
  const pools = {};
123
- // 0_ Fetch all euler vaults from database
124
- const storedPools = await UniswapRepository.getStoredPools();
125
- const res = await Promise.all(UNIV4_CHAINIDS.map(async (chainId) => {
61
+ // 0_ Fetch all univ4 pools from API database
62
+ const storedPools = await UniswapRepository.getStoredUniswapV4Pools(chainId);
63
+ const res = await Promise.all(chainIdArray.map(async (chainId) => {
126
64
  chainId = chainId;
127
65
  const perChainIdRes = {};
128
66
  const poolManagerAddress = UniswapV4Addresses[chainId]?.PoolManager ?? NULL_ADDRESS;
129
67
  const jsonRPCprovider = providers[chainId];
130
68
  try {
131
- // 1_ Get latest euler vaults from chain
69
+ // 1_ Get latest uniswapV4 pools for `chainId`
132
70
  const storedPoolsPerChain = storedPools.filter(pool => pool.chainId === chainId);
133
71
  log.info(`found ${storedPoolsPerChain.length} already stored pools on ${NETWORK_LABELS[chainId]}`);
134
72
  let fromBlock;
@@ -140,12 +78,10 @@ export class UniswapService {
140
78
  }
141
79
  const toBlock = await jsonRPCprovider.getBlockNumber();
142
80
  const logs = await safeFetchLogs(chainId, // TODO: rm type enforcing
143
- [UniswapV4PoolManagerInterface.getEventTopic("Initialize")], [poolManagerAddress], fromBlock, toBlock
144
- // fromBlock + 10_000
145
- );
81
+ [UniswapV4PoolManagerInterface.getEventTopic("Initialize")], [poolManagerAddress], fromBlock, toBlock);
146
82
  const decodedPools = await Promise.all(logs.map(async (log) => {
147
83
  const [id, currency0, currency1, fee, tickSpacing, hooks] = UniswapV4PoolManagerInterface.decodeEventLog("Initialize", log.data, log.topics);
148
- // Respect typing
84
+ // Match typing
149
85
  return {
150
86
  poolId: id,
151
87
  chainId: chainId,
@@ -247,13 +183,13 @@ export class UniswapService {
247
183
  }
248
184
  return perChainIdRes;
249
185
  }));
250
- UNIV4_CHAINIDS.forEach((chainId, i) => {
186
+ chainIdArray.forEach((chainId, i) => {
251
187
  if (!!res[i])
252
188
  pools[chainId] = res[i];
253
189
  });
254
190
  // Update the API database
255
191
  const tableData = Object.values(pools).flatMap(pools => Object.values(pools));
256
- for (const chainId of UNIV4_CHAINIDS) {
192
+ for (const chainId of chainIdArray) {
257
193
  if (tableData.filter(p => p.chainId === chainId).length > 0) {
258
194
  try {
259
195
  await UniswapRepository.createMany(tableData
@@ -288,4 +224,8 @@ export class UniswapService {
288
224
  log.info("👋 exiting getUniswapV4Pools");
289
225
  return pools;
290
226
  }
227
+ /** @deprecated */
228
+ static async getUniswapV4PoolsForChain(chainId) {
229
+ return await UniswapService.getUniswapV4Pools(chainId);
230
+ }
291
231
  }
@@ -1,16 +1,16 @@
1
1
  import { Redis } from "@/cache";
2
- import { UniV4ChainIdArray, getUniswapV4Pools } from "@/engine/dynamicData/utils/getUniswapV4Pools";
3
2
  import { ChainUniqueDto } from "@/modules/v4/chain/chain.model";
4
- import { Bytes32Dto } from "@/modules/v4/uniswap/uniswap.model";
3
+ import { Bytes32Dto, UniV4ChainIdArray } from "@/modules/v4/uniswap/uniswap.model";
4
+ import { UniswapService } from "@/modules/v4/uniswap/uniswap.service";
5
5
  import { UnsupportedNetwork } from "@/utils/error";
6
6
  export default (app) => app.group("/uniswapv4", router => router
7
7
  .get("/", async () => {
8
- return await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools);
8
+ return await Redis.getOrSet("UniswapV4Pools", UniswapService.getUniswapV4Pools);
9
9
  }, {
10
10
  tags: ["uniswapv4"],
11
11
  })
12
12
  .get("/:chainId", async ({ params }) => {
13
- return (await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools, params.chainId))[params.chainId];
13
+ return (await Redis.getOrSet("UniswapV4Pools", UniswapService.getUniswapV4Pools, params.chainId))[params.chainId];
14
14
  }, {
15
15
  params: ChainUniqueDto,
16
16
  beforeHandle: ({ params }) => {
@@ -20,7 +20,7 @@ export default (app) => app.group("/uniswapv4", router => router
20
20
  tags: ["uniswapv4"],
21
21
  })
22
22
  .get("/pool/:poolId", async ({ params }) => {
23
- return Object.values((await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools)))
23
+ return Object.values((await Redis.getOrSet("UniswapV4Pools", UniswapService.getUniswapV4Pools)))
24
24
  .flatMap(x => (x ? Object.values(x) : []))
25
25
  .filter(p => p.poolId === params.poolId);
26
26
  }, {
@@ -1,5 +1,6 @@
1
1
  import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
2
2
  import { AaveInterface, AccountantWithRateProvidersInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerV3StablePoolInterface, BalancerVaultInterface, BeefyInterface, BunniV2HubInterface, BunniV2TokenInterface, CPMMGammaPoolMainInterface, CompoundInterface, CurveInterface, CurveLPTokenInterface, CurveStableSwapNGInterface, DefutureVaultInterface, ERC20Interface, ERC4626Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, HourglassERC20TBTInterface, HourglassVedaLockDepositorV2Interface, IonicInterface, LPManagerHelperInterface, LPManagerInterface, LayerBankERC20Interface, LayerBankInterface, LendleInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, PendleYTInterface, RadiantInterface, RfxInterface, RswEthStrategyInterface, SpectraYTInterface, SturdyInterface, SymetricAmbientStrategyInterface, SyncSwapClassicPoolInterface, TorosInterface, UniswapV2PoolInterface, UniswapV3PoolInterface, VePufferInterface, ZFStableLPINterface, ZFStableSwapThreePoolInterface, } from "@sdk";
3
+ import { BigNumber } from "ethers";
3
4
  export function decodeCall(calls, index, key, type) {
4
5
  const returnData = calls[index];
5
6
  return decodeReturnValue(returnData, key, type);
@@ -135,6 +136,8 @@ export function decodeReturnValue(returnData, key, type) {
135
136
  return EulerInterface.decodeFunctionResult("asset", returnData)[0];
136
137
  case tokenType.hourglass:
137
138
  return HourglassVedaLockDepositorV2Interface.decodeFunctionResult("getUnderlying", returnData)[0];
139
+ case tokenType.curve_gauge:
140
+ return BalancerGaugeInterface.decodeFunctionResult("lp_token", returnData)[0];
138
141
  default:
139
142
  throw new Error(`Need tokenType for this key ${key}, or type ${type} not matched`);
140
143
  }
@@ -166,6 +169,7 @@ export function decodeReturnValue(returnData, key, type) {
166
169
  case "lp_price":
167
170
  switch (type) {
168
171
  case tokenType.curve:
172
+ case tokenType.curve_gauge:
169
173
  return CurveInterface.decodeFunctionResult("lp_price", returnData)[0];
170
174
  case tokenType.curve_2:
171
175
  case tokenType.maha:
@@ -233,7 +237,12 @@ export function decodeReturnValue(returnData, key, type) {
233
237
  BalancerVaultInterface.decodeFunctionResult("getPoolTokens", returnData)[1],
234
238
  ];
235
239
  case "convertToAssets":
236
- return FluidInterface.decodeFunctionResult("convertToAssets", returnData)[0];
240
+ switch (type) {
241
+ case tokenType.curve_gauge:
242
+ return BigNumber.from("1000000000000000000");
243
+ default:
244
+ return FluidInterface.decodeFunctionResult("convertToAssets", returnData)[0];
245
+ }
237
246
  case "tokenPrice":
238
247
  return TorosInterface.decodeFunctionResult("tokenPrice", returnData)[0];
239
248
  case "readTokens0":
@@ -23,6 +23,7 @@ export function createCall(target, key, type, metaData) {
23
23
  case "lp_price":
24
24
  switch (type) {
25
25
  case tokenType.curve:
26
+ case tokenType.curve_gauge:
26
27
  return { allowFailure: true, callData: CurveInterface.encodeFunctionData("lp_price"), target };
27
28
  case tokenType.curve_2:
28
29
  case tokenType.maha:
@@ -114,6 +115,8 @@ export function createCall(target, key, type, metaData) {
114
115
  callData: EulerInterface.encodeFunctionData("asset"),
115
116
  target,
116
117
  };
118
+ case tokenType.curve_gauge:
119
+ return { allowFailure: true, callData: BalancerGaugeInterface.encodeFunctionData("lp_token"), target };
117
120
  case tokenType.fraxlend:
118
121
  case tokenType.sturdy_aggregator:
119
122
  case tokenType.sturdy_silo:
@@ -134,6 +134,11 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
134
134
  return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}-${typeInfo.symbolToken2}`;
135
135
  case tokenType.maha:
136
136
  return `Stake ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} LP on ${capitalize(typeInfo.protocol)}`;
137
+ case tokenType.curve_gauge:
138
+ if (!!typeInfo.symbolToken2) {
139
+ return `Stake ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}-${typeInfo.symbolToken2} LP on ${capitalize(typeInfo.protocol)}`;
140
+ }
141
+ return `Stake ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} LP on ${capitalize(typeInfo.protocol)}`;
137
142
  case tokenType.tempest:
138
143
  case tokenType.tempestStaking:
139
144
  return `Deposit into ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} vault on ${capitalize(typeInfo.protocol)}`;