@gearbox-protocol/sdk 0.0.100 → 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 +51 -13
  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 +2 -2
  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 +68 -15
  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 +8 -3
  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,79 +0,0 @@
1
- import { ConvexPoolContract, CurvePoolContract, UniswapV2Contract, YearnVaultContract } from "../contracts/contracts";
2
- import { NormalToken } from "../tokens/normal";
3
- import { CurveLPToken } from "../tokens/curveLP";
4
- import { YearnLPToken } from "../tokens/yearn";
5
- import { ConvexLPToken, ConvexStakedPhantomToken } from "../tokens/convex";
6
- export declare enum TradeType {
7
- UniswapV2Swap = 0,
8
- UniswapV3Swap = 1,
9
- CurveExchange = 2,
10
- CurveExchangeUnderlying = 3,
11
- CurveDepositLP = 4,
12
- CurveWithdrawLP = 5,
13
- YearnDeposit = 6,
14
- YearnWithdraw = 7,
15
- LidoStake = 8,
16
- ConvexDepositLP = 9,
17
- ConvexStake = 10,
18
- ConvexDepositLPAndStake = 11,
19
- ConvexWithdrawLP = 12,
20
- ConvexWithdraw = 13,
21
- ConvexWithdrawAndUnwrap = 14
22
- }
23
- export declare type TradeAction = {
24
- type: TradeType.UniswapV2Swap;
25
- contract: UniswapV2Contract;
26
- tokenOut?: NormalToken;
27
- } | {
28
- type: TradeType.UniswapV3Swap;
29
- contract: "UNISWAP_V3_ROUTER";
30
- tokenOut?: NormalToken;
31
- } | {
32
- type: TradeType.CurveExchange;
33
- contract: CurvePoolContract;
34
- tokenOut: Array<NormalToken | CurveLPToken>;
35
- } | {
36
- type: TradeType.CurveDepositLP;
37
- contract: CurvePoolContract;
38
- tokenOut: CurveLPToken;
39
- } | {
40
- type: TradeType.CurveWithdrawLP;
41
- contract: CurvePoolContract;
42
- tokenOut: Array<CurveLPToken | NormalToken>;
43
- } | {
44
- type: TradeType.YearnDeposit;
45
- contract: YearnVaultContract;
46
- tokenOut: YearnLPToken;
47
- } | {
48
- type: TradeType.YearnWithdraw;
49
- contract: YearnVaultContract;
50
- tokenOut: NormalToken | CurveLPToken;
51
- } | {
52
- type: TradeType.LidoStake;
53
- contract: "LIDO_STETH_GATEWAY";
54
- tokenOut: NormalToken;
55
- } | {
56
- type: TradeType.ConvexDepositLP;
57
- contract: "CONVEX_BOOSTER";
58
- tokenOut: ConvexLPToken;
59
- } | {
60
- type: TradeType.ConvexStake;
61
- contract: ConvexPoolContract;
62
- tokenOut: ConvexStakedPhantomToken;
63
- } | {
64
- type: TradeType.ConvexDepositLPAndStake;
65
- contract: "CONVEX_BOOSTER";
66
- tokenOut: ConvexStakedPhantomToken;
67
- } | {
68
- type: TradeType.ConvexWithdrawLP;
69
- contract: "CONVEX_BOOSTER";
70
- tokenOut: CurveLPToken;
71
- } | {
72
- type: TradeType.ConvexWithdraw;
73
- contract: ConvexPoolContract;
74
- tokenOut: ConvexLPToken;
75
- } | {
76
- type: TradeType.ConvexWithdrawAndUnwrap;
77
- contract: ConvexPoolContract;
78
- tokenOut: CurveLPToken;
79
- };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TradeType = void 0;
4
- var TradeType;
5
- (function (TradeType) {
6
- TradeType[TradeType["UniswapV2Swap"] = 0] = "UniswapV2Swap";
7
- TradeType[TradeType["UniswapV3Swap"] = 1] = "UniswapV3Swap";
8
- TradeType[TradeType["CurveExchange"] = 2] = "CurveExchange";
9
- TradeType[TradeType["CurveExchangeUnderlying"] = 3] = "CurveExchangeUnderlying";
10
- TradeType[TradeType["CurveDepositLP"] = 4] = "CurveDepositLP";
11
- TradeType[TradeType["CurveWithdrawLP"] = 5] = "CurveWithdrawLP";
12
- TradeType[TradeType["YearnDeposit"] = 6] = "YearnDeposit";
13
- TradeType[TradeType["YearnWithdraw"] = 7] = "YearnWithdraw";
14
- TradeType[TradeType["LidoStake"] = 8] = "LidoStake";
15
- TradeType[TradeType["ConvexDepositLP"] = 9] = "ConvexDepositLP";
16
- TradeType[TradeType["ConvexStake"] = 10] = "ConvexStake";
17
- TradeType[TradeType["ConvexDepositLPAndStake"] = 11] = "ConvexDepositLPAndStake";
18
- TradeType[TradeType["ConvexWithdrawLP"] = 12] = "ConvexWithdrawLP";
19
- TradeType[TradeType["ConvexWithdraw"] = 13] = "ConvexWithdraw";
20
- TradeType[TradeType["ConvexWithdrawAndUnwrap"] = 14] = "ConvexWithdrawAndUnwrap";
21
- })(TradeType = exports.TradeType || (exports.TradeType = {}));