@gearbox-protocol/sdk 1.20.21 → 1.20.23

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 (137) hide show
  1. package/README.md +4 -0
  2. package/lib/apy/convexAPY.d.ts +2 -2
  3. package/lib/apy/curveAPY.d.ts +2 -2
  4. package/lib/apy/curveAPY.js +4 -2
  5. package/lib/apy/index.d.ts +3 -3
  6. package/lib/apy/lidoAPY.js +1 -1
  7. package/lib/apy/yearnAPY.d.ts +1 -1
  8. package/lib/apy/yearnAPY.js +1 -1
  9. package/lib/contracts/adapters.d.ts +2 -1
  10. package/lib/contracts/adapters.js +1 -0
  11. package/lib/contracts/contracts.d.ts +21 -17
  12. package/lib/contracts/contracts.js +27 -8
  13. package/lib/contracts/contractsRegister.d.ts +1 -1
  14. package/lib/contracts/protocols.d.ts +2 -1
  15. package/lib/contracts/protocols.js +5 -0
  16. package/lib/core/assets.d.ts +1 -1
  17. package/lib/core/chains.d.ts +1 -1
  18. package/lib/core/chains.js +1 -1
  19. package/lib/core/creditSession.d.ts +6 -5
  20. package/lib/core/creditSession.js +1 -0
  21. package/lib/core/errors.d.ts +1 -1
  22. package/lib/core/eventOrTx.d.ts +4 -4
  23. package/lib/core/events.d.ts +2 -2
  24. package/lib/core/history.d.ts +2 -2
  25. package/lib/core/pool/data.js +1 -1
  26. package/lib/core/pool/operation.d.ts +1 -1
  27. package/lib/core/rewardClaimer.js +1 -1
  28. package/lib/core/rewardConvex.js +1 -1
  29. package/lib/core/strategy.d.ts +1 -1
  30. package/lib/core/trade.d.ts +1 -1
  31. package/lib/core/trade.js +1 -1
  32. package/lib/core/transactions.d.ts +1 -1
  33. package/lib/core/wcOperation/index.d.ts +2 -2
  34. package/lib/core/wcOperation/operations.d.ts +5 -5
  35. package/lib/oracles/oracles.d.ts +13 -2
  36. package/lib/oracles/oracles.js +5 -0
  37. package/lib/oracles/priceFeeds.js +56 -0
  38. package/lib/pathfinder/pathOptions.d.ts +1 -1
  39. package/lib/pathfinder/pathfinder.js +1 -1
  40. package/lib/pathfinder/tradeTypes.d.ts +13 -2
  41. package/lib/pathfinder/tradeTypes.js +2 -0
  42. package/lib/payload/creditAccount.d.ts +2 -2
  43. package/lib/payload/creditManager.d.ts +1 -1
  44. package/lib/payload/creditSession.d.ts +1 -0
  45. package/lib/payload/pool.d.ts +1 -1
  46. package/lib/tokens/balancer.d.ts +22 -0
  47. package/lib/tokens/balancer.js +53 -0
  48. package/lib/tokens/convex.d.ts +5 -5
  49. package/lib/tokens/convex.js +42 -0
  50. package/lib/tokens/curveLP.d.ts +4 -4
  51. package/lib/tokens/curveLP.js +23 -0
  52. package/lib/tokens/decimals.js +7 -0
  53. package/lib/tokens/gear.d.ts +4 -4
  54. package/lib/tokens/normal.d.ts +2 -2
  55. package/lib/tokens/normal.js +35 -0
  56. package/lib/tokens/token.d.ts +5 -4
  57. package/lib/tokens/token.js +18 -1
  58. package/lib/tokens/tokenData.d.ts +1 -1
  59. package/lib/tokens/tokenType.d.ts +2 -1
  60. package/lib/tokens/tokenType.js +1 -0
  61. package/lib/tokens/yearn.d.ts +4 -4
  62. package/lib/types/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.d.ts +4 -4
  63. package/lib/types/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.d.ts +4 -4
  64. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACL.d.ts +8 -8
  65. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACLEvents.d.ts +8 -8
  66. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactory.d.ts +10 -10
  67. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactoryEvents.d.ts +10 -10
  68. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProvider.d.ts +2 -2
  69. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProviderEvents.d.ts +2 -2
  70. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributor.d.ts +6 -6
  71. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributorEvents.d.ts +6 -6
  72. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegister.d.ts +4 -4
  73. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegisterEvents.d.ts +4 -4
  74. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfigurator.d.ts +38 -38
  75. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfiguratorEvents.d.ts +38 -38
  76. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacade.d.ts +28 -28
  77. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents.d.ts +26 -26
  78. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExtended.d.ts +2 -2
  79. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2.d.ts +4 -4
  80. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2Events.d.ts +4 -4
  81. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressor.d.ts +10 -10
  82. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributor.d.ts +4 -4
  83. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributorEvents.d.ts +4 -4
  84. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFT.d.ts +12 -12
  85. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFTEvents.d.ts +6 -6
  86. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDieselToken.sol/IDieselToken.d.ts +4 -4
  87. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeed.d.ts +2 -2
  88. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeedEvents.d.ts +2 -2
  89. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPhantomERC20.d.ts +4 -4
  90. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolService.d.ts +20 -20
  91. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolServiceEvents.d.ts +20 -20
  92. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2.d.ts +2 -2
  93. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Events.d.ts +2 -2
  94. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Ext.d.ts +2 -2
  95. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditFilter.d.ts +16 -16
  96. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditManager.d.ts +20 -20
  97. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IUniversalAdapter.sol/IUniversalAdapter.d.ts +2 -2
  98. package/lib/types/@gearbox-protocol/core-v2/contracts/pool/PoolService.d.ts +24 -24
  99. package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IConvexToken.d.ts +4 -4
  100. package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETH.d.ts +4 -4
  101. package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETHGetters.d.ts +4 -4
  102. package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETH.d.ts +4 -4
  103. package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETHGetters.d.ts +4 -4
  104. package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/yearn/IYVault.d.ts +4 -4
  105. package/lib/types/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1Adapter.d.ts +2 -2
  106. package/lib/types/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1AdapterEvents.d.ts +2 -2
  107. package/lib/types/@gearbox-protocol/integrations-v2/contracts/interfaces/yearn/IYearnV2Adapter.d.ts +4 -4
  108. package/lib/types/@gearbox-protocol/integrations-v2/contracts/test/mocks/integrations/LidoMock.sol/ILidoMockEvents.d.ts +2 -2
  109. package/lib/types/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver.d.ts +10 -10
  110. package/lib/types/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositor.d.ts +8 -8
  111. package/lib/types/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositorOptions.d.ts +8 -8
  112. package/lib/types/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorker.d.ts +8 -8
  113. package/lib/types/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorkerOptions.d.ts +8 -8
  114. package/lib/types/@gearbox-protocol/router/contracts/interfaces/IPathResolver.d.ts +8 -8
  115. package/lib/types/@gearbox-protocol/router/contracts/interfaces/IRouter.d.ts +16 -16
  116. package/lib/types/@gearbox-protocol/router/contracts/interfaces/ISwapAggregator.d.ts +12 -12
  117. package/lib/types/@gearbox-protocol/router/contracts/interfaces/ISwapper.d.ts +6 -6
  118. package/lib/types/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawer.d.ts +8 -8
  119. package/lib/types/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawerOptions.d.ts +10 -10
  120. package/lib/types/@gearbox-protocol/router/contracts/interfaces/IWrapper.d.ts +6 -6
  121. package/lib/types/@openzeppelin/contracts/token/ERC20/IERC20.d.ts +4 -4
  122. package/lib/types/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.d.ts +4 -4
  123. package/lib/types/@openzeppelin/contracts/token/ERC721/IERC721.d.ts +6 -6
  124. package/lib/types/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.d.ts +6 -6
  125. package/lib/types/common.d.ts +4 -4
  126. package/lib/types/contracts/ITokenDistributor.sol/ITokenDistributor.d.ts +8 -8
  127. package/lib/types/contracts/ITokenDistributor.sol/ITokenDistributorEvents.d.ts +8 -8
  128. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/pool/PoolService__factory.d.ts +1 -1
  129. package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.d.ts +1 -1
  130. package/lib/utils/mappers.d.ts +1 -1
  131. package/lib/utils/multicall.js +1 -1
  132. package/lib/utils/repeater.js +1 -1
  133. package/lib/utils/types.d.ts +5 -5
  134. package/lib/watchers/creditAccountWatcher.d.ts +1 -1
  135. package/lib/watchers/creditAccountWatcher.js +1 -1
  136. package/lib/watchers/creditManagerWatcher.js +1 -1
  137. package/package.json +1 -1
@@ -2,7 +2,7 @@ import { BigNumber } from "ethers";
2
2
  import { CreditManagerData } from "../creditManager";
3
3
  import { BaseWcOperation, BaseWcOperationProps, SupportedWcOperation, SupportedWcOperationProps } from "./abstractOperations";
4
4
  import { RawTransaction } from "./types";
5
- export declare type FailedWCOperationType = "unsupported" | "bad_request" | "unsupported_tokens";
5
+ export type FailedWCOperationType = "unsupported" | "bad_request" | "unsupported_tokens";
6
6
  interface FailedWCOperationProps extends BaseWcOperationProps {
7
7
  message: string;
8
8
  kind: FailedWCOperationType;
@@ -13,7 +13,7 @@ export declare class FailedWCOperation extends BaseWcOperation {
13
13
  constructor({ raw, kind, message }: FailedWCOperationProps);
14
14
  static create(props: FailedWCOperationProps): FailedWCOperation;
15
15
  }
16
- declare type ApproveWCOperationType = "approve";
16
+ type ApproveWCOperationType = "approve";
17
17
  interface ApproveWcOperationProps extends SupportedWcOperationProps {
18
18
  kind: ApproveWCOperationType;
19
19
  to: string;
@@ -32,7 +32,7 @@ export declare class ApproveWCOperation extends SupportedWcOperation {
32
32
  constructor(props: ApproveWcOperationProps);
33
33
  static create({ to: token, args, raw, creditManager, }: CreateApproveWCOperation): FailedWCOperation | ApproveWCOperation;
34
34
  }
35
- declare type SwapWCOperationType = "swap";
35
+ type SwapWCOperationType = "swap";
36
36
  interface SwapWCOperationProps extends SupportedWcOperationProps {
37
37
  kind: SwapWCOperationType;
38
38
  from: string;
@@ -58,8 +58,8 @@ export declare class SwapWCOperation extends SupportedWcOperation {
58
58
  constructor(props: SwapWCOperationProps);
59
59
  static create(params: CreateSwapWCOperationProps): SwapWCOperation;
60
60
  }
61
- declare type LpWCOperationType = "lp";
62
- declare type LpType = "withdraw" | "deposit";
61
+ type LpWCOperationType = "lp";
62
+ type LpType = "withdraw" | "deposit";
63
63
  interface LpWCOperationProps extends SupportedWcOperationProps {
64
64
  kind: LpWCOperationType;
65
65
  from: string;
@@ -14,9 +14,14 @@ export declare enum OracleType {
14
14
  LIKE_CURVE_LP_TOKEN_ORACLE = 5,
15
15
  WSTETH_ORACLE = 6,
16
16
  BOUNDED_ORACLE = 7,
17
- COMPOSITE_ORACLE = 8
17
+ COMPOSITE_ORACLE = 8,
18
+ AAVE_ORACLE = 9,
19
+ COMPOUND_ORACLE = 10,
20
+ CURVE_CRYPTO_ORACLE = 11,
21
+ BALANCER_STABLE_LP_ORACLE = 12,
22
+ BALANCER_WEIGHTED_LP_ORACLE = 13
18
23
  }
19
- export declare type PriceFeedData = {
24
+ export type PriceFeedData = {
20
25
  type: OracleType.CHAINLINK_ORACLE;
21
26
  address: Record<NetworkType, string>;
22
27
  } | {
@@ -44,6 +49,12 @@ export declare type PriceFeedData = {
44
49
  type: OracleType.COMPOSITE_ORACLE;
45
50
  targetToBasePriceFeed: Record<NetworkType, string>;
46
51
  baseToUsdPriceFeed: Record<NetworkType, string>;
52
+ } | {
53
+ type: OracleType.CURVE_CRYPTO_ORACLE;
54
+ assets: Array<SupportedToken>;
55
+ } | {
56
+ type: OracleType.BALANCER_WEIGHTED_LP_ORACLE;
57
+ assets: Array<SupportedToken>;
47
58
  };
48
59
  export interface TokenPriceFeedData {
49
60
  priceFeedETH?: PriceFeedData;
@@ -12,4 +12,9 @@ var OracleType;
12
12
  OracleType[OracleType["WSTETH_ORACLE"] = 6] = "WSTETH_ORACLE";
13
13
  OracleType[OracleType["BOUNDED_ORACLE"] = 7] = "BOUNDED_ORACLE";
14
14
  OracleType[OracleType["COMPOSITE_ORACLE"] = 8] = "COMPOSITE_ORACLE";
15
+ OracleType[OracleType["AAVE_ORACLE"] = 9] = "AAVE_ORACLE";
16
+ OracleType[OracleType["COMPOUND_ORACLE"] = 10] = "COMPOUND_ORACLE";
17
+ OracleType[OracleType["CURVE_CRYPTO_ORACLE"] = 11] = "CURVE_CRYPTO_ORACLE";
18
+ OracleType[OracleType["BALANCER_STABLE_LP_ORACLE"] = 12] = "BALANCER_STABLE_LP_ORACLE";
19
+ OracleType[OracleType["BALANCER_WEIGHTED_LP_ORACLE"] = 13] = "BALANCER_WEIGHTED_LP_ORACLE";
15
20
  })(OracleType = exports.OracleType || (exports.OracleType = {}));
@@ -473,6 +473,12 @@ exports.priceFeedsByNetwork = {
473
473
  curveSymbol: "gusd3CRV",
474
474
  },
475
475
  },
476
+ cvxOHMFRAXBP: {
477
+ priceFeedUSD: {
478
+ type: oracles_1.OracleType.LIKE_CURVE_LP_TOKEN_ORACLE,
479
+ curveSymbol: "OHMFRAXBP",
480
+ },
481
+ },
476
482
  // CVX tokens
477
483
  stkcvx3Crv: {
478
484
  priceFeedUSD: {
@@ -516,6 +522,12 @@ exports.priceFeedsByNetwork = {
516
522
  curveSymbol: "gusd3CRV",
517
523
  },
518
524
  },
525
+ stkcvxOHMFRAXBP: {
526
+ priceFeedUSD: {
527
+ type: oracles_1.OracleType.LIKE_CURVE_LP_TOKEN_ORACLE,
528
+ curveSymbol: "OHMFRAXBP",
529
+ },
530
+ },
519
531
  // GEARBOX
520
532
  dDAI: {
521
533
  priceFeedETH: {
@@ -587,4 +599,48 @@ exports.priceFeedsByNetwork = {
587
599
  address: { Mainnet: "", Goerli: "" },
588
600
  },
589
601
  },
602
+ OHM: {
603
+ priceFeedETH: {
604
+ type: oracles_1.OracleType.CHAINLINK_ORACLE,
605
+ address: {
606
+ Mainnet: "0x9a72298ae3886221820b1c878d12d872087d3a23",
607
+ Goerli: "deploy me",
608
+ },
609
+ },
610
+ priceFeedUSD: {
611
+ type: oracles_1.OracleType.COMPOSITE_ORACLE,
612
+ targetToBasePriceFeed: {
613
+ Mainnet: "0x9a72298ae3886221820b1c878d12d872087d3a23",
614
+ Goerli: "deploy me",
615
+ },
616
+ baseToUsdPriceFeed: {
617
+ Mainnet: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
618
+ Goerli: "0x491741d9F426130d1bC27Aee82f8b4Bd4E6E5f5D",
619
+ },
620
+ },
621
+ },
622
+ OHMFRAXBP: {
623
+ priceFeedUSD: {
624
+ type: oracles_1.OracleType.CURVE_CRYPTO_ORACLE,
625
+ assets: ["OHM", "crvFRAX"],
626
+ },
627
+ },
628
+ "50OHM_50DAI": {
629
+ priceFeedUSD: {
630
+ type: oracles_1.OracleType.BALANCER_WEIGHTED_LP_ORACLE,
631
+ assets: ["OHM", "DAI"],
632
+ },
633
+ },
634
+ "50OHM_50WETH": {
635
+ priceFeedUSD: {
636
+ type: oracles_1.OracleType.BALANCER_WEIGHTED_LP_ORACLE,
637
+ assets: ["OHM", "WETH"],
638
+ },
639
+ },
640
+ OHM_wstETH: {
641
+ priceFeedUSD: {
642
+ type: oracles_1.OracleType.BALANCER_WEIGHTED_LP_ORACLE,
643
+ assets: ["OHM", "wstETH"],
644
+ },
645
+ },
590
646
  };
@@ -6,7 +6,7 @@ export interface PathOption {
6
6
  option: number;
7
7
  totalOptions: number;
8
8
  }
9
- export declare type PathOptionSerie = Array<PathOption>;
9
+ export type PathOptionSerie = Array<PathOption>;
10
10
  export declare class PathOptionFactory {
11
11
  static generatePathOptions(balances: Record<string, BigNumberish>, loopsInTx: number): Array<PathOptionSerie>;
12
12
  static getCurvePools(balances: Record<string, BigNumberish>): Array<CurveLPToken>;
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -1,4 +1,5 @@
1
1
  import type { ConvexPoolContract, CurvePoolContract, UniswapV2Contract, YearnVaultContract } from "../contracts/contracts";
2
+ import { BalancerLPToken } from "../tokens/balancer";
2
3
  import type { ConvexLPToken, ConvexStakedPhantomToken } from "../tokens/convex";
3
4
  import type { CurveLPToken } from "../tokens/curveLP";
4
5
  import type { NormalToken } from "../tokens/normal";
@@ -18,9 +19,11 @@ export declare enum TradeType {
18
19
  ConvexDepositLPAndStake = 11,
19
20
  ConvexWithdrawLP = 12,
20
21
  ConvexWithdraw = 13,
21
- ConvexWithdrawAndUnwrap = 14
22
+ ConvexWithdrawAndUnwrap = 14,
23
+ BalancerJoin = 15,
24
+ BalancerExit = 16
22
25
  }
23
- export declare type TradeAction = {
26
+ export type TradeAction = {
24
27
  type: TradeType.UniswapV2Swap;
25
28
  contract: UniswapV2Contract;
26
29
  tokenOut?: NormalToken;
@@ -76,4 +79,12 @@ export declare type TradeAction = {
76
79
  type: TradeType.ConvexWithdrawAndUnwrap;
77
80
  contract: ConvexPoolContract;
78
81
  tokenOut: CurveLPToken;
82
+ } | {
83
+ type: TradeType.BalancerJoin;
84
+ contract: "BALANCER_VAULT";
85
+ tokenOut: BalancerLPToken;
86
+ } | {
87
+ type: TradeType.BalancerExit;
88
+ contract: "BALANCER_VAULT";
89
+ tokenOut: Array<NormalToken | BalancerLPToken>;
79
90
  };
@@ -18,4 +18,6 @@ var TradeType;
18
18
  TradeType[TradeType["ConvexWithdrawLP"] = 12] = "ConvexWithdrawLP";
19
19
  TradeType[TradeType["ConvexWithdraw"] = 13] = "ConvexWithdraw";
20
20
  TradeType[TradeType["ConvexWithdrawAndUnwrap"] = 14] = "ConvexWithdrawAndUnwrap";
21
+ TradeType[TradeType["BalancerJoin"] = 15] = "BalancerJoin";
22
+ TradeType[TradeType["BalancerExit"] = 16] = "BalancerExit";
21
23
  })(TradeType = exports.TradeType || (exports.TradeType = {}));
@@ -1,4 +1,4 @@
1
1
  import { CreditAccountDataStruct, CreditAccountDataStructOutput } from "../types/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressor";
2
2
  import { ExcludeArrayProps } from "../utils/types";
3
- export declare type TokenBalancePayload = CreditAccountDataStruct["balances"];
4
- export declare type CreditAccountDataPayload = ExcludeArrayProps<CreditAccountDataStructOutput>;
3
+ export type TokenBalancePayload = CreditAccountDataStruct["balances"];
4
+ export type CreditAccountDataPayload = ExcludeArrayProps<CreditAccountDataStructOutput>;
@@ -5,7 +5,7 @@ export interface AdapterPayload {
5
5
  allowedContract: string;
6
6
  adapter: string;
7
7
  }
8
- export declare type CreditManagerDataPayload = ExcludeArrayProps<CreditManagerDataStructOutput>;
8
+ export type CreditManagerDataPayload = ExcludeArrayProps<CreditManagerDataStructOutput>;
9
9
  export interface ChartsCreditManagerPayload {
10
10
  addr: string;
11
11
  underlyingToken: string;
@@ -21,6 +21,7 @@ export interface CreditSessionPayload {
21
21
  underlyingToken: string;
22
22
  borrowAPY_RAY: BigNumberish;
23
23
  borrowAPY7DAverage: number;
24
+ entryPrice: number;
24
25
  healthFactor: BigNumberish;
25
26
  leverage: number;
26
27
  tfIndex: number;
@@ -1,7 +1,7 @@
1
1
  import { BigNumberish } from "ethers";
2
2
  import { PoolDataStruct } from "../types/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressor";
3
3
  import { ExcludeArrayProps } from "../utils/types";
4
- export declare type PoolDataPayload = ExcludeArrayProps<PoolDataStruct>;
4
+ export type PoolDataPayload = ExcludeArrayProps<PoolDataStruct>;
5
5
  export interface ChartsPoolDataPayload {
6
6
  addr: string;
7
7
  dieselToken: string;
@@ -0,0 +1,22 @@
1
+ import { TradeType } from "../pathfinder/tradeTypes";
2
+ import { NormalToken } from "./normal";
3
+ import type { TokenBase } from "./token";
4
+ import { TokenType } from "./tokenType";
5
+ export type BalancerLPToken = "50OHM_50DAI" | "50OHM_50WETH" | "OHM_wstETH";
6
+ export type BalancerLpTokenData = {
7
+ symbol: BalancerLPToken;
8
+ type: TokenType.BALANCER_LP_TOKEN;
9
+ underlying: Array<NormalToken | BalancerLPToken>;
10
+ lpActions: Array<{
11
+ type: TradeType.BalancerJoin;
12
+ contract: "BALANCER_VAULT";
13
+ tokenOut: BalancerLPToken;
14
+ } | {
15
+ type: TradeType.BalancerExit;
16
+ contract: "BALANCER_VAULT";
17
+ tokenOut: Array<NormalToken | BalancerLPToken>;
18
+ }>;
19
+ poolId: string;
20
+ } & TokenBase;
21
+ export declare const balancerLpTokens: Record<BalancerLPToken, BalancerLpTokenData>;
22
+ export declare const isBalancerLPToken: (t: unknown) => t is BalancerLPToken;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBalancerLPToken = exports.balancerLpTokens = void 0;
4
+ var tradeTypes_1 = require("../pathfinder/tradeTypes");
5
+ var tokenType_1 = require("./tokenType");
6
+ exports.balancerLpTokens = {
7
+ "50OHM_50DAI": {
8
+ name: "Balancer 50OHM_50DAI",
9
+ symbol: "50OHM_50DAI",
10
+ type: tokenType_1.TokenType.BALANCER_LP_TOKEN,
11
+ underlying: ["OHM", "DAI"],
12
+ poolId: "0x76fcf0e8c7ff37a47a799fa2cd4c13cde0d981c90002000000000000000003d2",
13
+ lpActions: [
14
+ {
15
+ type: tradeTypes_1.TradeType.BalancerExit,
16
+ contract: "BALANCER_VAULT",
17
+ tokenOut: ["OHM", "DAI"],
18
+ },
19
+ ],
20
+ },
21
+ "50OHM_50WETH": {
22
+ name: "Balancer 50OHM_50WETH",
23
+ symbol: "50OHM_50WETH",
24
+ type: tokenType_1.TokenType.BALANCER_LP_TOKEN,
25
+ underlying: ["OHM", "WETH"],
26
+ poolId: "0xd1ec5e215e8148d76f4460e4097fd3d5ae0a35580002000000000000000003d3",
27
+ lpActions: [
28
+ {
29
+ type: tradeTypes_1.TradeType.BalancerExit,
30
+ contract: "BALANCER_VAULT",
31
+ tokenOut: ["OHM", "WETH"],
32
+ },
33
+ ],
34
+ },
35
+ OHM_wstETH: {
36
+ name: "Balancer OHM_wstETH",
37
+ symbol: "OHM_wstETH",
38
+ type: tokenType_1.TokenType.BALANCER_LP_TOKEN,
39
+ underlying: ["OHM", "wstETH"],
40
+ poolId: "0xd4f79ca0ac83192693bce4699d0c10c66aa6cf0f00020000000000000000047e",
41
+ lpActions: [
42
+ {
43
+ type: tradeTypes_1.TradeType.BalancerExit,
44
+ contract: "BALANCER_VAULT",
45
+ tokenOut: ["OHM", "wstETH"],
46
+ },
47
+ ],
48
+ },
49
+ };
50
+ var isBalancerLPToken = function (t) {
51
+ return typeof t === "string" && !!exports.balancerLpTokens[t];
52
+ };
53
+ exports.isBalancerLPToken = isBalancerLPToken;
@@ -3,20 +3,20 @@ import { TradeAction } from "../pathfinder/tradeTypes";
3
3
  import type { CurveLPToken } from "./curveLP";
4
4
  import type { SupportedToken, TokenBase } from "./token";
5
5
  import { TokenType } from "./tokenType";
6
- export declare type ConvexLPToken = "cvx3Crv" | "cvxcrvFRAX" | "cvxsteCRV" | "cvxFRAX3CRV" | "cvxLUSD3CRV" | "cvxcrvPlain3andSUSD" | "cvxgusd3CRV";
7
- export declare type ConvexStakedPhantomToken = "stkcvx3Crv" | "stkcvxcrvFRAX" | "stkcvxsteCRV" | "stkcvxFRAX3CRV" | "stkcvxLUSD3CRV" | "stkcvxcrvPlain3andSUSD" | "stkcvxgusd3CRV";
8
- declare type BaseConvexToken = {
6
+ export type ConvexLPToken = "cvx3Crv" | "cvxcrvFRAX" | "cvxsteCRV" | "cvxFRAX3CRV" | "cvxLUSD3CRV" | "cvxcrvPlain3andSUSD" | "cvxgusd3CRV" | "cvxOHMFRAXBP";
7
+ export type ConvexStakedPhantomToken = "stkcvx3Crv" | "stkcvxcrvFRAX" | "stkcvxsteCRV" | "stkcvxFRAX3CRV" | "stkcvxLUSD3CRV" | "stkcvxcrvPlain3andSUSD" | "stkcvxgusd3CRV" | "stkcvxOHMFRAXBP";
8
+ type BaseConvexToken = {
9
9
  pool: ConvexPoolContract;
10
10
  pid: number;
11
11
  underlying: CurveLPToken;
12
12
  lpActions: Array<TradeAction>;
13
13
  } & TokenBase;
14
- export declare type ConvexLPTokenData = {
14
+ export type ConvexLPTokenData = {
15
15
  symbol: ConvexLPToken;
16
16
  type: TokenType.CONVEX_LP_TOKEN;
17
17
  stakedToken: ConvexStakedPhantomToken;
18
18
  } & BaseConvexToken;
19
- export declare type ConvexPhantomTokenData = {
19
+ export type ConvexPhantomTokenData = {
20
20
  symbol: ConvexStakedPhantomToken;
21
21
  type: TokenType.CONVEX_STAKED_TOKEN;
22
22
  lpToken: ConvexLPToken;
@@ -162,6 +162,27 @@ var convexLpTokens = {
162
162
  },
163
163
  ],
164
164
  },
165
+ cvxOHMFRAXBP: {
166
+ name: "Convex cvxOHMFRAXBP",
167
+ symbol: "cvxOHMFRAXBP",
168
+ type: tokenType_1.TokenType.CONVEX_LP_TOKEN,
169
+ pool: "CONVEX_OHMFRAXBP_POOL",
170
+ pid: 138,
171
+ underlying: "OHMFRAXBP",
172
+ stakedToken: "stkcvxOHMFRAXBP",
173
+ lpActions: [
174
+ {
175
+ type: tradeTypes_1.TradeType.ConvexWithdrawLP,
176
+ contract: "CONVEX_BOOSTER",
177
+ tokenOut: "OHMFRAXBP",
178
+ },
179
+ {
180
+ type: tradeTypes_1.TradeType.ConvexStake,
181
+ contract: "CONVEX_OHMFRAXBP_POOL",
182
+ tokenOut: "stkcvxOHMFRAXBP",
183
+ },
184
+ ],
185
+ },
165
186
  };
166
187
  var convexStakedPhantomTokens = {
167
188
  stkcvx3Crv: {
@@ -311,6 +332,27 @@ var convexStakedPhantomTokens = {
311
332
  },
312
333
  ],
313
334
  },
335
+ stkcvxOHMFRAXBP: {
336
+ name: "Convex stkcvxOHMFRAXBP",
337
+ symbol: "stkcvxOHMFRAXBP",
338
+ type: tokenType_1.TokenType.CONVEX_STAKED_TOKEN,
339
+ pool: "CONVEX_OHMFRAXBP_POOL",
340
+ pid: 138,
341
+ underlying: "OHMFRAXBP",
342
+ lpToken: "cvxOHMFRAXBP",
343
+ lpActions: [
344
+ {
345
+ type: tradeTypes_1.TradeType.ConvexWithdraw,
346
+ contract: "CONVEX_OHMFRAXBP_POOL",
347
+ tokenOut: "cvxOHMFRAXBP",
348
+ },
349
+ {
350
+ type: tradeTypes_1.TradeType.ConvexWithdrawAndUnwrap,
351
+ contract: "CONVEX_OHMFRAXBP_POOL",
352
+ tokenOut: "OHMFRAXBP",
353
+ },
354
+ ],
355
+ },
314
356
  };
315
357
  exports.convexTokens = __assign(__assign({}, convexLpTokens), convexStakedPhantomTokens);
316
358
  var isConvexToken = function (t) {
@@ -4,9 +4,9 @@ import { TradeAction } from "../pathfinder/tradeTypes";
4
4
  import { PartialRecord } from "../utils/types";
5
5
  import type { SupportedToken, TokenBase } from "./token";
6
6
  import { TokenType } from "./tokenType";
7
- export declare type CurveMetaTokens = "FRAX3CRV" | "LUSD3CRV" | "gusd3CRV";
8
- export declare type CurveLPToken = "3Crv" | "steCRV" | "crvPlain3andSUSD" | "crvFRAX" | CurveMetaTokens;
9
- export declare type CurveLPTokenData = {
7
+ export type CurveMetaTokens = "FRAX3CRV" | "LUSD3CRV" | "gusd3CRV";
8
+ export type CurveLPToken = "3Crv" | "steCRV" | "crvPlain3andSUSD" | "crvFRAX" | "OHMFRAXBP" | CurveMetaTokens;
9
+ export type CurveLPTokenData = {
10
10
  symbol: CurveLPToken;
11
11
  type: TokenType.CURVE_LP_TOKEN;
12
12
  swapActions?: Array<TradeAction>;
@@ -14,7 +14,7 @@ export declare type CurveLPTokenData = {
14
14
  pool: CurvePoolContract;
15
15
  wrapper?: CurvePoolContract;
16
16
  } & TokenBase;
17
- export declare type MetaCurveLPTokenData = {
17
+ export type MetaCurveLPTokenData = {
18
18
  symbol: CurveLPToken;
19
19
  type: TokenType.CURVE_LP_TOKEN;
20
20
  lpActions: Array<TradeAction>;
@@ -173,6 +173,29 @@ exports.curveTokens = __assign({
173
173
  tokenOut: "stkcvxcrvPlain3andSUSD",
174
174
  },
175
175
  ],
176
+ }, OHMFRAXBP: {
177
+ name: "Curve.fi Factory Crypto Pool: OHM/FRAXBP",
178
+ symbol: "OHMFRAXBP",
179
+ type: tokenType_1.TokenType.CURVE_LP_TOKEN,
180
+ pool: "CURVE_OHM_FRAXBP",
181
+ wrapper: "CURVE_OHM_FRAXBP",
182
+ lpActions: [
183
+ {
184
+ type: tradeTypes_1.TradeType.CurveWithdrawLP,
185
+ contract: "CURVE_OHM_FRAXBP",
186
+ tokenOut: ["OHM", "FRAX", "USDC"],
187
+ },
188
+ {
189
+ type: tradeTypes_1.TradeType.ConvexDepositLP,
190
+ contract: "CONVEX_BOOSTER",
191
+ tokenOut: "cvxOHMFRAXBP",
192
+ },
193
+ {
194
+ type: tradeTypes_1.TradeType.ConvexDepositLPAndStake,
195
+ contract: "CONVEX_BOOSTER",
196
+ tokenOut: "stkcvxOHMFRAXBP",
197
+ },
198
+ ],
176
199
  } }, exports.curveMetaTokens);
177
200
  var isCurveLPToken = function (t) {
178
201
  return typeof t === "string" && !!exports.curveTokens[t];
@@ -27,8 +27,10 @@ exports.decimals = {
27
27
  sUSD: 18,
28
28
  GUSD: 2,
29
29
  LQTY: 18,
30
+ OHM: 9,
30
31
  "3Crv": 18,
31
32
  crvFRAX: 18,
33
+ OHMFRAXBP: 18,
32
34
  steCRV: 18,
33
35
  crvPlain3andSUSD: 18,
34
36
  FRAX3CRV: 18,
@@ -41,6 +43,7 @@ exports.decimals = {
41
43
  cvxLUSD3CRV: 18,
42
44
  cvxcrvPlain3andSUSD: 18,
43
45
  cvxgusd3CRV: 18,
46
+ cvxOHMFRAXBP: 18,
44
47
  stkcvx3Crv: 18,
45
48
  stkcvxcrvFRAX: 18,
46
49
  stkcvxsteCRV: 18,
@@ -48,6 +51,7 @@ exports.decimals = {
48
51
  stkcvxLUSD3CRV: 18,
49
52
  stkcvxcrvPlain3andSUSD: 18,
50
53
  stkcvxgusd3CRV: 18,
54
+ stkcvxOHMFRAXBP: 18,
51
55
  yvDAI: 18,
52
56
  yvUSDC: 6,
53
57
  yvWETH: 18,
@@ -61,4 +65,7 @@ exports.decimals = {
61
65
  dFRAX: 18,
62
66
  dwstETH: 18,
63
67
  GEAR: 18,
68
+ "50OHM_50DAI": 18,
69
+ "50OHM_50WETH": 18,
70
+ OHM_wstETH: 18,
64
71
  };
@@ -1,13 +1,13 @@
1
1
  import type { TradeAction } from "../pathfinder/tradeTypes";
2
2
  import type { TokenBase } from "./token";
3
3
  import { TokenType } from "./tokenType";
4
- export declare type DieselTokenTypes = "dDAI" | "dUSDC" | "dWBTC" | "dWETH" | "dwstETH" | "dFRAX";
5
- export declare type GearboxToken = "GEAR";
6
- export declare type DieselTokenData = {
4
+ export type DieselTokenTypes = "dDAI" | "dUSDC" | "dWBTC" | "dWETH" | "dwstETH" | "dFRAX";
5
+ export type GearboxToken = "GEAR";
6
+ export type DieselTokenData = {
7
7
  symbol: DieselTokenTypes;
8
8
  type: TokenType.DIESEL_LP_TOKEN;
9
9
  } & TokenBase;
10
- export declare type GearboxTokenData = {
10
+ export type GearboxTokenData = {
11
11
  symbol: GearboxToken;
12
12
  swapActions?: Array<TradeAction>;
13
13
  type: TokenType.GEAR_TOKEN;
@@ -1,8 +1,8 @@
1
1
  import { TradeAction } from "../pathfinder/tradeTypes";
2
2
  import type { TokenBase } from "./token";
3
3
  import { TokenType } from "./tokenType";
4
- export declare type NormalToken = "1INCH" | "AAVE" | "COMP" | "CRV" | "DPI" | "FEI" | "LINK" | "SNX" | "UNI" | "USDT" | "USDC" | "DAI" | "WETH" | "WBTC" | "YFI" | "STETH" | "wstETH" | "CVX" | "FRAX" | "FXS" | "LDO" | "LUSD" | "sUSD" | "GUSD" | "LQTY";
5
- export declare type NormalTokenData = {
4
+ export type NormalToken = "1INCH" | "AAVE" | "COMP" | "CRV" | "DPI" | "FEI" | "LINK" | "SNX" | "UNI" | "USDT" | "USDC" | "DAI" | "WETH" | "WBTC" | "YFI" | "STETH" | "wstETH" | "CVX" | "FRAX" | "FXS" | "LDO" | "LUSD" | "sUSD" | "GUSD" | "LQTY" | "OHM";
5
+ export type NormalTokenData = {
6
6
  symbol: NormalToken;
7
7
  type: TokenType.NORMAL_TOKEN;
8
8
  swapActions: Array<TradeAction>;
@@ -364,6 +364,11 @@ exports.normalTokens = {
364
364
  contract: "CURVE_STETH_GATEWAY",
365
365
  tokenOut: "steCRV",
366
366
  },
367
+ {
368
+ type: tradeTypes_1.TradeType.BalancerJoin,
369
+ contract: "BALANCER_VAULT",
370
+ tokenOut: "50OHM_50WETH",
371
+ },
367
372
  ],
368
373
  },
369
374
  YFI: {
@@ -440,6 +445,13 @@ exports.normalTokens = {
440
445
  tokenOut: ["WETH"],
441
446
  },
442
447
  ],
448
+ lpActions: [
449
+ {
450
+ type: tradeTypes_1.TradeType.BalancerJoin,
451
+ contract: "BALANCER_VAULT",
452
+ tokenOut: "OHM_wstETH",
453
+ },
454
+ ],
443
455
  },
444
456
  CVX: {
445
457
  name: "CVX",
@@ -641,6 +653,29 @@ exports.normalTokens = {
641
653
  },
642
654
  ],
643
655
  },
656
+ OHM: {
657
+ name: "OHM",
658
+ symbol: "OHM",
659
+ type: tokenType_1.TokenType.NORMAL_TOKEN,
660
+ swapActions: [],
661
+ lpActions: [
662
+ {
663
+ type: tradeTypes_1.TradeType.BalancerJoin,
664
+ contract: "BALANCER_VAULT",
665
+ tokenOut: "50OHM_50DAI",
666
+ },
667
+ {
668
+ type: tradeTypes_1.TradeType.BalancerJoin,
669
+ contract: "BALANCER_VAULT",
670
+ tokenOut: "50OHM_50WETH",
671
+ },
672
+ {
673
+ type: tradeTypes_1.TradeType.BalancerJoin,
674
+ contract: "BALANCER_VAULT",
675
+ tokenOut: "OHM_wstETH",
676
+ },
677
+ ],
678
+ },
644
679
  };
645
680
  var isNormalToken = function (t) {
646
681
  return typeof t === "string" && !!exports.normalTokens[t];
@@ -1,17 +1,18 @@
1
1
  import { NetworkType } from "../core/chains";
2
+ import { BalancerLPToken, BalancerLpTokenData } from "./balancer";
2
3
  import { ConvexLPToken, ConvexLPTokenData, ConvexPhantomTokenData, ConvexStakedPhantomToken } from "./convex";
3
4
  import { CurveLPToken, CurveLPTokenData, MetaCurveLPTokenData } from "./curveLP";
4
5
  import { DieselTokenData, DieselTokenTypes, GearboxToken, GearboxTokenData } from "./gear";
5
6
  import { NormalToken, NormalTokenData } from "./normal";
6
7
  import { YearnLPToken, YearnVaultOfCurveLPTokenData, YearnVaultOfMetaCurveLPTokenData, YearnVaultTokenData } from "./yearn";
7
- export declare type LPTokens = YearnLPToken | CurveLPToken | ConvexLPToken | ConvexStakedPhantomToken;
8
- export declare type SupportedToken = NormalToken | LPTokens | DieselTokenTypes | GearboxToken;
8
+ export type LPTokens = YearnLPToken | CurveLPToken | ConvexLPToken | ConvexStakedPhantomToken | BalancerLPToken;
9
+ export type SupportedToken = NormalToken | LPTokens | DieselTokenTypes | GearboxToken;
9
10
  export interface TokenBase {
10
11
  name: string;
11
12
  symbol: string;
12
13
  }
13
- export declare type LPTokenDataI = CurveLPTokenData | MetaCurveLPTokenData | YearnVaultTokenData | YearnVaultOfCurveLPTokenData | YearnVaultOfMetaCurveLPTokenData | ConvexLPTokenData | ConvexPhantomTokenData;
14
- export declare type TokenDataI = NormalTokenData | LPTokenDataI | DieselTokenData | GearboxTokenData;
14
+ export type LPTokenDataI = CurveLPTokenData | MetaCurveLPTokenData | YearnVaultTokenData | YearnVaultOfCurveLPTokenData | YearnVaultOfMetaCurveLPTokenData | ConvexLPTokenData | ConvexPhantomTokenData | BalancerLpTokenData;
15
+ export type TokenDataI = NormalTokenData | LPTokenDataI | DieselTokenData | GearboxTokenData;
15
16
  export declare const lpTokens: Record<LPTokens, LPTokenDataI>;
16
17
  export declare const supportedTokens: Record<SupportedToken, TokenDataI>;
17
18
  export declare const tokenDataByNetwork: Record<NetworkType, Record<SupportedToken, string>>;