@gearbox-protocol/sdk 0.0.98 → 0.0.101

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 (86) hide show
  1. package/lib/apy/convexAPY.d.ts +8 -0
  2. package/lib/apy/convexAPY.js +202 -0
  3. package/lib/apy/lidoAPY.d.ts +4 -0
  4. package/lib/apy/lidoAPY.js +97 -0
  5. package/lib/config.d.ts +1 -0
  6. package/lib/config.js +2 -1
  7. package/lib/contracts/contracts.d.ts +6 -1
  8. package/lib/contracts/contracts.js +52 -14
  9. package/lib/contracts/contractsRegister.js +3 -3
  10. package/lib/core/constants.d.ts +4 -0
  11. package/lib/core/constants.js +8 -4
  12. package/lib/core/creditAccount.d.ts +2 -0
  13. package/lib/core/creditAccount.js +31 -30
  14. package/lib/core/creditManager.d.ts +13 -2
  15. package/lib/core/creditManager.js +79 -29
  16. package/lib/core/errors.d.ts +10 -0
  17. package/lib/core/errors.js +16 -1
  18. package/lib/core/events.js +9 -9
  19. package/lib/core/multicall.d.ts +1 -1
  20. package/lib/core/pool.d.ts +1 -1
  21. package/lib/core/pool.js +7 -5
  22. package/lib/core/price.d.ts +4 -0
  23. package/lib/core/price.js +12 -0
  24. package/lib/core/strategy.d.ts +34 -0
  25. package/lib/core/strategy.js +57 -0
  26. package/lib/index.d.ts +7 -1
  27. package/lib/index.js +8 -3
  28. package/lib/pathfinder/path.js +1 -1
  29. package/lib/pathfinder/yVault.js +7 -4
  30. package/lib/payload/creditAccount.d.ts +4 -26
  31. package/lib/payload/creditManager.d.ts +12 -24
  32. package/lib/payload/pool.d.ts +2 -17
  33. package/lib/payload/pool.js +0 -1
  34. package/lib/tokens/token.js +4 -4
  35. package/lib/utils/formatter.d.ts +1 -0
  36. package/lib/utils/formatter.js +6 -1
  37. package/lib/utils/mappers.d.ts +2 -1
  38. package/lib/utils/mappers.js +13 -5
  39. package/lib/utils/multicall.js +4 -3
  40. package/lib/utils/types.d.ts +1 -0
  41. package/package.json +1 -1
  42. package/src/apy/convexAPY.ts +249 -0
  43. package/src/apy/lidoAPY.ts +81 -0
  44. package/src/config.ts +2 -1
  45. package/src/contracts/contracts.ts +69 -16
  46. package/src/contracts/contractsRegister.ts +3 -3
  47. package/src/core/constants.ts +7 -3
  48. package/src/core/creditAccount.ts +39 -33
  49. package/src/core/creditManager.ts +230 -148
  50. package/src/core/errors.ts +24 -0
  51. package/src/core/events.ts +921 -915
  52. package/src/core/multicall.ts +1 -1
  53. package/src/core/pool.ts +56 -51
  54. package/src/core/price.ts +16 -0
  55. package/src/core/strategy.ts +123 -0
  56. package/src/index.ts +8 -1
  57. package/src/pathfinder/path.ts +154 -154
  58. package/src/pathfinder/yVault.ts +57 -56
  59. package/src/payload/creditAccount.ts +4 -26
  60. package/src/payload/creditManager.ts +13 -25
  61. package/src/payload/pool.ts +2 -19
  62. package/src/tokens/token.ts +10 -5
  63. package/src/utils/formatter.ts +5 -1
  64. package/src/utils/mappers.ts +12 -5
  65. package/src/utils/multicall.ts +4 -9
  66. package/src/utils/types.ts +6 -2
  67. package/lib/core/adapters.d.ts +0 -15
  68. package/lib/core/adapters.js +0 -19
  69. package/lib/core/contracts.d.ts +0 -67
  70. package/lib/core/contracts.js +0 -254
  71. package/lib/core/contractsRegister.d.ts +0 -2
  72. package/lib/core/contractsRegister.js +0 -58
  73. package/lib/core/creditCard.d.ts +0 -13
  74. package/lib/core/creditCard.js +0 -2
  75. package/lib/core/oracles.d.ts +0 -38
  76. package/lib/core/oracles.js +0 -12
  77. package/lib/core/priceFeeds.d.ts +0 -3
  78. package/lib/core/priceFeeds.js +0 -492
  79. package/lib/core/protocols.d.ts +0 -13
  80. package/lib/core/protocols.js +0 -39
  81. package/lib/core/swap.d.ts +0 -4
  82. package/lib/core/swap.js +0 -8
  83. package/lib/core/trade.d.ts +0 -35
  84. package/lib/core/trade.js +0 -62
  85. package/lib/core/tradeTypes.d.ts +0 -79
  86. package/lib/core/tradeTypes.js +0 -21
@@ -1,74 +1,75 @@
1
- import {BigNumber} from "ethers";
2
- import {IYVault__factory} from "../types";
3
- import {Path, LPWithdrawPathFinder} from "./path";
4
- import {YearnLPToken, yearnTokens} from "../tokens/yearn";
5
- import {NormalToken} from "../tokens/normal";
6
- import {CurveLPToken} from "../tokens/curveLP";
7
- import {SupportedToken, tokenDataByNetwork} from "../tokens/token";
8
- import {PartialRecord} from "../utils/types";
9
- import {MCall, multicall} from "../utils/multicall";
10
- import {IYVaultInterface} from "../types/contracts/integrations/yearn/IYVault";
1
+ import { BigNumber } from "ethers";
2
+ import { IYVault__factory } from "../types";
3
+ import { Path, LPWithdrawPathFinder } from "./path";
4
+ import { YearnLPToken, yearnTokens } from "../tokens/yearn";
5
+ import { NormalToken } from "../tokens/normal";
6
+ import { CurveLPToken } from "../tokens/curveLP";
7
+ import { SupportedToken, tokenDataByNetwork } from "../tokens/token";
8
+ import { PartialRecord } from "../utils/types";
9
+ import { MCall, multicall } from "../utils/multicall";
10
+ import { IYVaultInterface } from "../types/contracts/integrations/yearn/IYVault";
11
11
 
12
12
  interface WithdrawBalance {
13
- token: SupportedToken;
14
- balance: BigNumber;
13
+ token: SupportedToken;
14
+ balance: BigNumber;
15
15
  }
16
16
 
17
17
  export class YearnVaultPathFinder implements LPWithdrawPathFinder {
18
- _vault: YearnLPToken;
19
- token: NormalToken | CurveLPToken;
18
+ _vault: YearnLPToken;
19
+ token: NormalToken | CurveLPToken;
20
20
 
21
- constructor(vault: YearnLPToken) {
22
- this._vault = vault;
21
+ constructor(vault: YearnLPToken) {
22
+ this._vault = vault;
23
23
 
24
- const currentTokenData = yearnTokens[vault];
24
+ const currentTokenData = yearnTokens[vault];
25
25
 
26
- // Yearn Vault only has one lp action
27
- this.token = currentTokenData.underlying;
28
- }
29
-
30
- async findWithdrawPaths(p: Path): Promise<Array<Path>> {
31
- let vaultBalances: PartialRecord<SupportedToken, WithdrawBalance> = {};
26
+ // Yearn Vault only has one lp action
27
+ this.token = currentTokenData.underlying;
28
+ }
32
29
 
33
- for (let [yVault, tokenData] of Object.entries(yearnTokens)) {
34
- const currentBalance = p.popBalance(yVault as YearnLPToken);
35
- if (currentBalance.gt(1)) {
36
- vaultBalances[yVault as YearnLPToken] = {
37
- token: tokenData.underlying,
38
- balance: currentBalance
39
- };
40
- }
41
- }
30
+ async findWithdrawPaths(p: Path): Promise<Array<Path>> {
31
+ let vaultBalances: PartialRecord<SupportedToken, WithdrawBalance> = {};
42
32
 
43
- const vaultList = Object.keys(vaultBalances) as Array<SupportedToken>;
33
+ for (let [yVault, tokenData] of Object.entries(yearnTokens)) {
34
+ const currentBalance = p.popBalance(yVault as YearnLPToken);
35
+ if (currentBalance.gt(1)) {
36
+ vaultBalances[yVault as YearnLPToken] = {
37
+ token: tokenData.underlying,
38
+ balance: currentBalance
39
+ };
40
+ }
41
+ }
44
42
 
45
- // Yearn Vault only has one lp action
46
- const multicallData: Array<MCall<IYVaultInterface>> = vaultList
47
- .map(t => tokenDataByNetwork[p.networkType][t as SupportedToken])
48
- .map(addr => ({
49
- address: addr,
50
- interface: IYVault__factory.createInterface(),
51
- method: "pricePerShare()"
52
- }));
43
+ const vaultList = Object.keys(vaultBalances) as Array<SupportedToken>;
53
44
 
54
- const prices = await multicall<Array<BigNumber>>(multicallData, p.provider);
45
+ // Yearn Vault only has one lp action
46
+ const multicallData: Array<MCall<IYVaultInterface>> = vaultList
47
+ .map(t => tokenDataByNetwork[p.networkType][t as SupportedToken])
48
+ .map(addr => ({
49
+ address: addr,
50
+ interface: IYVault__factory.createInterface(),
51
+ method: "pricePerShare()"
52
+ }));
55
53
 
56
- for (let i = 0; i < vaultList.length; i++) {
57
- const vault = vaultList[i];
58
- const vb = vaultBalances[vault];
54
+ const prices = await multicall<Array<BigNumber>>(multicallData, p.provider);
59
55
 
60
- p.balances[vb!.token] = (p.balances[vb!.token] || BigNumber.from(0)).add(
61
- BigNumber.from(vb?.balance || 0).mul(prices[i])
62
- );
56
+ for (let i = 0; i < vaultList.length; i++) {
57
+ const vault = vaultList[i];
58
+ const vb = vaultBalances[vault];
63
59
 
64
- p.calls.push({
65
- targetContract:
66
- p.creditManager.adapters[tokenDataByNetwork[p.networkType][vault]],
67
- callData:
68
- IYVault__factory.createInterface().encodeFunctionData("withdraw()")
69
- });
70
- }
60
+ p.balances[vb!.token] = (p.balances[vb!.token] || BigNumber.from(0)).add(
61
+ BigNumber.from(vb?.balance || 0).mul(prices[i])
62
+ );
71
63
 
72
- return await p.withdrawTokens();
64
+ // !!!!!!!!!
65
+ // p.calls.push({
66
+ // targetContract:
67
+ // p.creditManager.adapters[tokenDataByNetwork[p.networkType][vault]],
68
+ // callData:
69
+ // IYVault__factory.createInterface().encodeFunctionData("withdraw()")
70
+ // });
73
71
  }
72
+
73
+ return await p.withdrawTokens();
74
+ }
74
75
  }
@@ -1,29 +1,7 @@
1
- import {BigNumberish} from "ethers";
1
+ import { CreditAccountDataStructOutput } from "../types/contracts/core/DataCompressor";
2
2
 
3
- export interface TokenBalancePayload {
4
- token: string;
5
- balance: BigNumberish;
6
- isAllowed: boolean;
7
- }
3
+ export type TokenBalancePayload = CreditAccountDataStructOutput["balances"];
8
4
 
9
- export interface CreditAccountDataPayload {
10
- addr: string;
11
- borrower: string;
12
- inUse: boolean;
13
- creditManager: string;
14
- underlyingToken: string;
15
- borrowedAmountPlusInterest: BigNumberish;
16
- totalValue: BigNumberish;
17
- healthFactor: BigNumberish;
18
- borrowRate: BigNumberish;
19
- balances?: Array<TokenBalancePayload>;
20
- }
5
+ export type CreditAccountDataPayload = CreditAccountDataStructOutput;
21
6
 
22
- export interface CreditAccountDataExtendedPayload extends CreditAccountDataPayload {
23
- repayAmount: BigNumberish;
24
- liquidationAmount: BigNumberish;
25
- canBeClosed?: boolean;
26
- borrowedAmount: BigNumberish;
27
- cumulativeIndexAtOpen: BigNumberish;
28
- since: BigNumberish;
29
- }
7
+ export type CreditAccountDataExtendedPayload = CreditAccountDataStructOutput;
@@ -1,36 +1,24 @@
1
- import { BigNumberish } from "ethers";
1
+ import { BigNumberish, BigNumber } from "ethers";
2
+ import { CreditManagerDataStructOutput } from "../types/contracts/interfaces/IDataCompressor.sol/IDataCompressor";
2
3
 
3
4
  export interface AdapterPayload {
4
5
  allowedContract: string;
5
- adapter: string
6
+ adapter: string;
6
7
  }
7
8
 
8
- export interface CreditManagerDataPayload {
9
- addr: string;
10
- hasAccount?: boolean;
11
- underlyingToken?: string;
12
- isWETH?: boolean;
13
- canBorrow?: boolean;
14
- borrowRate?: BigNumberish;
15
- minAmount?: BigNumberish;
16
- maxAmount?: BigNumberish;
17
- maxLeverageFactor?: BigNumberish;
18
- availableLiquidity?: BigNumberish;
19
- allowedTokens?: Array<string>;
20
- adapters?: Array<AdapterPayload>;
21
- }
9
+ export type CreditManagerDataPayload = CreditManagerDataStructOutput;
22
10
 
23
- export interface CreditManagerStatPayload {
11
+ export interface CreditManagerStatPayload extends CreditManagerDataPayload {
24
12
  addr: string;
25
13
  underlyingToken?: string;
26
- isWETH?: boolean;
27
- canBorrow?: boolean;
28
- borrowRate?: BigNumberish;
29
- minAmount?: BigNumberish;
30
- maxAmount?: BigNumberish;
31
- maxLeverageFactor?: BigNumberish;
32
- availableLiquidity?: BigNumberish;
33
- allowedTokens?: Array<string>;
14
+ isWETH: boolean;
15
+ canBorrow: boolean;
16
+ borrowRate: BigNumber;
17
+ minAmount: BigNumber;
18
+ maxAmount: BigNumber;
19
+ maxLeverageFactor: BigNumber;
20
+ availableLiquidity: BigNumber;
21
+ allowedTokens: Array<string>;
34
22
  allowedContracts?: Array<string>;
35
23
  uniqueUsers: number;
36
24
  openedAccountsCount?: number;
@@ -1,20 +1,3 @@
1
- import {BigNumberish} from "ethers";
1
+ import { PoolDataStructOutput } from "../types/contracts/interfaces/IDataCompressor.sol/IDataCompressor";
2
2
 
3
- export interface PoolDataPayload {
4
- addr: string;
5
- underlyingToken: string;
6
- dieselToken: string;
7
- isWETH: boolean;
8
- expectedLiquidity: BigNumberish;
9
- expectedLiquidityLimit?: BigNumberish;
10
- availableLiquidity: BigNumberish;
11
- totalBorrowed: BigNumberish;
12
- depositAPY_RAY: BigNumberish;
13
- borrowAPY_RAY: BigNumberish;
14
- dieselRate_RAY: BigNumberish;
15
- withdrawFee: BigNumberish;
16
- timestampLU?: BigNumberish;
17
- cumulativeIndex_RAY?: BigNumberish
18
- }
19
-
20
- //
3
+ export type PoolDataPayload = PoolDataStructOutput;
@@ -1,4 +1,9 @@
1
- import { keyToLowercase, objectEntries, swapKeyValue } from "../utils/mappers";
1
+ import {
2
+ keyToLowercase,
3
+ objectEntries,
4
+ swapKeyValue,
5
+ filterEmptyKeys
6
+ } from "../utils/mappers";
2
7
  import { NetworkType } from "../core/constants";
3
8
  import { NormalToken, NormalTokenData, normalTokens } from "./normal";
4
9
  import {
@@ -201,13 +206,13 @@ export const tokenDataByNetwork: Record<
201
206
  cvxsteCRV: "0xb22c2015327cfbeD480eF45B6382d4bC963a4595",
202
207
  cvxcrvPlain3andSUSD: "0xBBeAdEA3C648cF4026d0422EAF2463050202700b",
203
208
  cvxFRAX3CRV: "0xBC523005975D86de9226785DD83e4f8d2A87fA73",
204
- cvxLUSD3CRV: "0xF1128521595A6CAee02af9DBdb15857954cC2cA0",
209
+ cvxLUSD3CRV: "0xF90d9a96985a80e6c2cA9952cd2C6Db5B720408F",
205
210
  cvxgusd3CRV: "0xa3aDFDf18d166e26bF1Bc0ee63D26d0d1064b056",
206
211
 
207
212
  // CONVEX PHANTOM TOKEN ADDRESSES
208
213
  stkcvx3Crv: "0xf4FC4Aa052346fEa87f1e864f10de0f7383e9502",
209
214
  stkcvxFRAX3CRV: "0xd726f9684245065B120E1ac18de389f6b05351Ba",
210
- stkcvxLUSD3CRV: "",
215
+ stkcvxLUSD3CRV: "0x5c355c46413B45Cc58aB61AcaF5BB72E7c2d1465",
211
216
  stkcvxgusd3CRV: "0x9A74e8106f6c28b21b1B6a0F985cf1227BE05F04",
212
217
  stkcvxsteCRV: "0xd8bAbB7EfBF7F931a69B209f71b27421F8b18516",
213
218
  stkcvxcrvPlain3andSUSD: "0x6b45Cab756B41a7204973b71362ef5F73E67F6DA",
@@ -224,6 +229,6 @@ export const tokenDataByNetwork: Record<
224
229
 
225
230
  export const tokenSymbolByAddress = objectEntries(tokenDataByNetwork).reduce<
226
231
  Record<string, SupportedToken>
227
- >((sum, [_, tokens]) => {
228
- return { ...sum, ...keyToLowercase(swapKeyValue(tokens)) };
232
+ >((acc, [_, tokens]) => {
233
+ return { ...acc, ...filterEmptyKeys(keyToLowercase(swapKeyValue(tokens))) };
229
234
  }, {});
@@ -1,5 +1,5 @@
1
1
  import { BigNumber, BigNumberish } from "ethers";
2
- import { PERCENTAGE_FACTOR, RAY } from "../core/constants";
2
+ import { PERCENTAGE_FACTOR, RAY, LEVERAGE_DECIMALS } from "../core/constants";
3
3
  import Decimal from "decimal.js-light";
4
4
 
5
5
  export function rayToNumber(num: BigNumberish): number {
@@ -136,3 +136,7 @@ export function formatDate(date: Date): string {
136
136
  export function formatHf(healthFactor: number): string {
137
137
  return (healthFactor / 10000).toFixed(2);
138
138
  }
139
+
140
+ export function formatLeverage(leverage: number, decimals: number = 2) {
141
+ return (leverage / LEVERAGE_DECIMALS).toFixed(decimals);
142
+ }
@@ -7,17 +7,24 @@ const objectEntries = <K extends SupportedValue, T>(
7
7
  const swapKeyValue = <K extends SupportedValue, T extends SupportedValue>(
8
8
  o: Record<K, T>
9
9
  ): Record<T, K> =>
10
- objectEntries(o).reduce((sum, [key, value]) => {
11
- return { ...sum, [value]: key };
10
+ objectEntries(o).reduce((acc, [key, value]) => {
11
+ return { ...acc, [value]: key };
12
12
  }, {} as Record<T, K>);
13
13
 
14
14
  const keyToLowercase = <K extends SupportedValue, T extends SupportedValue>(
15
15
  o: Record<K, T>
16
16
  ): Record<K, T> =>
17
- objectEntries(o).reduce((sum, [key, value]) => {
17
+ objectEntries(o).reduce((acc, [key, value]) => {
18
18
  const keyTransformed = typeof key === "string" ? key.toLowerCase() : key;
19
- return { ...sum, [keyTransformed]: value };
19
+ return { ...acc, [keyTransformed]: value };
20
+ }, {} as Record<K, T>);
21
+
22
+ const filterEmptyKeys = <K extends SupportedValue, T extends SupportedValue>(
23
+ o: Record<K, T>
24
+ ): Record<K, T> =>
25
+ objectEntries(o).reduce((acc, [key, value]) => {
26
+ return !!key ? { ...acc, [key]: value } : acc;
20
27
  }, {} as Record<K, T>);
21
28
 
22
29
  export type { SupportedValue };
23
- export { objectEntries, swapKeyValue, keyToLowercase };
30
+ export { objectEntries, swapKeyValue, keyToLowercase, filterEmptyKeys };
@@ -1,4 +1,5 @@
1
1
  import { ethers } from "ethers";
2
+ import { MULTICALL_ADDRESS } from "../config";
2
3
  import { Multicall2, Multicall2__factory } from "../types";
3
4
 
4
5
  export interface CallData<T extends ethers.utils.Interface> {
@@ -17,10 +18,7 @@ export async function multicall<R extends Array<any>>(
17
18
  calls: Array<MCall<any>>,
18
19
  p: ethers.providers.Provider
19
20
  ): Promise<R> {
20
- const multiCallContract = Multicall2__factory.connect(
21
- "0x5ba1e12693dc8f9c48aad8770482f4739beed696",
22
- p
23
- );
21
+ const multiCallContract = Multicall2__factory.connect(MULTICALL_ADDRESS, p);
24
22
 
25
23
  const { returnData } = await multiCallContract.callStatic.aggregate(
26
24
  calls.map(c => ({
@@ -33,7 +31,7 @@ export async function multicall<R extends Array<any>>(
33
31
  .map((d, num) =>
34
32
  calls[num].interface.decodeFunctionResult(calls[num].method as string, d)
35
33
  )
36
- .map(r => r[0]) as R;
34
+ .map(r => (Array.isArray(r) && r.length <= 1 ? r[0] : r)) as R;
37
35
  }
38
36
 
39
37
  export class MultiCallContract<T extends ethers.utils.Interface> {
@@ -49,10 +47,7 @@ export class MultiCallContract<T extends ethers.utils.Interface> {
49
47
  this._address = address;
50
48
  this._interface = intrerface;
51
49
 
52
- this._multiCall = Multicall2__factory.connect(
53
- "0x5ba1e12693dc8f9c48aad8770482f4739beed696",
54
- provider
55
- );
50
+ this._multiCall = Multicall2__factory.connect(MULTICALL_ADDRESS, provider);
56
51
  }
57
52
 
58
53
  async call<R extends Array<any>>(data: Array<CallData<T>>): Promise<R> {
@@ -1,3 +1,7 @@
1
1
  export type PartialRecord<K extends keyof any, T> = {
2
- [P in K]?: T;
3
- };
2
+ [P in K]?: T;
3
+ };
4
+
5
+ export type AwaitedRes<T extends (...args: any) => any> = Awaited<
6
+ ReturnType<T>
7
+ >;
@@ -1,15 +0,0 @@
1
- export declare enum AdapterInterface {
2
- NO_SWAP = 0,
3
- UNISWAP_V2_ROUTER = 1,
4
- UNISWAP_V3_ROUTER = 2,
5
- CURVE_V1_2ASSETS = 3,
6
- CURVE_V1_3ASSETS = 4,
7
- CURVE_V1_4ASSETS = 5,
8
- CURVE_V1_WRAPPER = 6,
9
- CURVE_V1_STECRV_POOL = 7,
10
- YEARN_V2 = 8,
11
- CONVEX_V1_BASE_REWARD_POOL = 9,
12
- CONVEX_V1_BOOSTER = 10,
13
- CONVEX_V1_CLAIM_ZAP = 11,
14
- LIDO_V1 = 12
15
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdapterInterface = void 0;
4
- var AdapterInterface;
5
- (function (AdapterInterface) {
6
- AdapterInterface[AdapterInterface["NO_SWAP"] = 0] = "NO_SWAP";
7
- AdapterInterface[AdapterInterface["UNISWAP_V2_ROUTER"] = 1] = "UNISWAP_V2_ROUTER";
8
- AdapterInterface[AdapterInterface["UNISWAP_V3_ROUTER"] = 2] = "UNISWAP_V3_ROUTER";
9
- AdapterInterface[AdapterInterface["CURVE_V1_2ASSETS"] = 3] = "CURVE_V1_2ASSETS";
10
- AdapterInterface[AdapterInterface["CURVE_V1_3ASSETS"] = 4] = "CURVE_V1_3ASSETS";
11
- AdapterInterface[AdapterInterface["CURVE_V1_4ASSETS"] = 5] = "CURVE_V1_4ASSETS";
12
- AdapterInterface[AdapterInterface["CURVE_V1_WRAPPER"] = 6] = "CURVE_V1_WRAPPER";
13
- AdapterInterface[AdapterInterface["CURVE_V1_STECRV_POOL"] = 7] = "CURVE_V1_STECRV_POOL";
14
- AdapterInterface[AdapterInterface["YEARN_V2"] = 8] = "YEARN_V2";
15
- AdapterInterface[AdapterInterface["CONVEX_V1_BASE_REWARD_POOL"] = 9] = "CONVEX_V1_BASE_REWARD_POOL";
16
- AdapterInterface[AdapterInterface["CONVEX_V1_BOOSTER"] = 10] = "CONVEX_V1_BOOSTER";
17
- AdapterInterface[AdapterInterface["CONVEX_V1_CLAIM_ZAP"] = 11] = "CONVEX_V1_CLAIM_ZAP";
18
- AdapterInterface[AdapterInterface["LIDO_V1"] = 12] = "LIDO_V1"; // 11 - 2048
19
- })(AdapterInterface = exports.AdapterInterface || (exports.AdapterInterface = {}));
@@ -1,67 +0,0 @@
1
- import { AdapterInterface } from "./adapters";
2
- import { NetworkType } from "./constants";
3
- import { Protocols } from "./protocols";
4
- import { ConvexStakedPhantomToken } from "../tokens/convex";
5
- import { CurveLPToken } from "../tokens/curveLP";
6
- import { NormalToken } from "../tokens/normal";
7
- export declare type UniswapV2Contract = "UNISWAP_V2_ROUTER" | "SUSHISWAP_ROUTER";
8
- export declare type CurvePoolContract = "CURVE_3CRV_POOL" | "CURVE_STETH_GATEWAY" | "CURVE_FRAX_POOL" | "CURVE_LUSD_POOL" | "CURVE_GUSD_POOL" | "CURVE_SUSD_POOL" | "CURVE_SUSD_DEPOSIT";
9
- export declare type YearnVaultContract = "YEARN_DAI_VAULT" | "YEARN_USDC_VAULT" | "YEARN_WETH_VAULT" | "YEARN_WBTC_VAULT" | "YEARN_CURVE_FRAX_VAULT" | "YEARN_CURVE_STETH_VAULT";
10
- export declare type ConvexPoolContract = "CONVEX_3CRV_POOL" | "CONVEX_GUSD_POOL" | "CONVEX_SUSD_POOL" | "CONVEX_STECRV_POOL" | "CONVEX_FRAX3CRV_POOL";
11
- export declare type SupportedContract = UniswapV2Contract | "UNISWAP_V3_ROUTER" | CurvePoolContract | YearnVaultContract | "CONVEX_BOOSTER" | ConvexPoolContract | "CONVEX_CLAIM_ZAP" | "LIDO_STETH_GATEWAY";
12
- export declare const contractsByNetwork: Record<NetworkType, Record<SupportedContract, string>>;
13
- export declare const UNISWAP_V3_QUOTER = "0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6";
14
- export interface BaseContractParams {
15
- name: string;
16
- }
17
- declare type UniswapV2Params = {
18
- protocol: Protocols.Uniswap | Protocols.Sushiswap;
19
- type: AdapterInterface.UNISWAP_V2_ROUTER;
20
- } & BaseContractParams;
21
- declare type UniswapV3Params = {
22
- protocol: Protocols.Uniswap;
23
- type: AdapterInterface.UNISWAP_V3_ROUTER;
24
- quoter: string;
25
- } & BaseContractParams;
26
- export declare type CurveParams = {
27
- protocol: Protocols.Curve;
28
- type: AdapterInterface.CURVE_V1_2ASSETS | AdapterInterface.CURVE_V1_3ASSETS | AdapterInterface.CURVE_V1_4ASSETS | AdapterInterface.CURVE_V1_WRAPPER;
29
- lpToken: CurveLPToken;
30
- tokens: Array<NormalToken | CurveLPToken>;
31
- wrapper?: CurvePoolContract;
32
- } & BaseContractParams;
33
- export declare type CurveSteCRVPoolParams = {
34
- protocol: Protocols.Curve;
35
- type: AdapterInterface.CURVE_V1_STECRV_POOL;
36
- pool: Record<NetworkType, string>;
37
- lpToken: "steCRV";
38
- } & BaseContractParams;
39
- export declare type CurveDepositParams = {
40
- protocol: Protocols.Curve;
41
- type: AdapterInterface.CURVE_V1_DEPOSIT;
42
- pool: Record<NetworkType, string>;
43
- lpToken: CurveLPToken;
44
- nCoins: number;
45
- } & BaseContractParams;
46
- declare type YearnParams = {
47
- protocol: Protocols.Yearn;
48
- type: AdapterInterface.YEARN_V2;
49
- } & BaseContractParams;
50
- declare type ConvexParams = {
51
- protocol: Protocols.Convex;
52
- type: AdapterInterface.CONVEX_V1_BOOSTER | AdapterInterface.CONVEX_V1_CLAIM_ZAP;
53
- } & BaseContractParams;
54
- declare type ConvexPoolParams = {
55
- protocol: Protocols.Convex;
56
- type: AdapterInterface.CONVEX_V1_BASE_REWARD_POOL;
57
- stakedToken: ConvexStakedPhantomToken;
58
- } & BaseContractParams;
59
- export declare type LidoParams = {
60
- protocol: Protocols.Lido;
61
- type: AdapterInterface.LIDO_V1;
62
- lpToken: "steCRV";
63
- } & BaseContractParams;
64
- export declare type ContractParams = UniswapV2Params | UniswapV3Params | CurveParams | CurveSteCRVPoolParams | CurveDepositParams | YearnParams | ConvexParams | ConvexPoolParams | LidoParams;
65
- export declare const contractParams: Record<SupportedContract, ContractParams>;
66
- export declare const contractsByAddress: Record<string, SupportedContract>;
67
- export {};