@gearbox-protocol/sdk 0.0.67 → 0.0.70

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 (66) hide show
  1. package/lib/contracts/adapters.d.ts +15 -0
  2. package/lib/contracts/adapters.js +19 -0
  3. package/lib/contracts/contracts.d.ts +60 -0
  4. package/lib/contracts/contracts.js +242 -0
  5. package/lib/contracts/contractsRegister.d.ts +2 -0
  6. package/lib/contracts/contractsRegister.js +58 -0
  7. package/lib/contracts/protocols.d.ts +13 -0
  8. package/lib/contracts/protocols.js +39 -0
  9. package/lib/core/events.js +1 -1
  10. package/lib/core/tradeTypes.d.ts +1 -1
  11. package/lib/core/transactions.js +1 -1
  12. package/lib/index.d.ts +8 -9
  13. package/lib/index.js +10 -10
  14. package/lib/oracles/oracles.d.ts +38 -0
  15. package/lib/oracles/oracles.js +12 -0
  16. package/lib/oracles/priceFeeds.d.ts +3 -0
  17. package/lib/oracles/priceFeeds.js +492 -0
  18. package/lib/pathfinder/convexLP.d.ts +1 -1
  19. package/lib/pathfinder/convexLP.js +2 -20
  20. package/lib/pathfinder/curveLP.d.ts +2 -2
  21. package/lib/pathfinder/curveLP.js +8 -27
  22. package/lib/pathfinder/path.d.ts +2 -8
  23. package/lib/pathfinder/path.js +27 -34
  24. package/lib/pathfinder/trade.d.ts +35 -0
  25. package/lib/pathfinder/trade.js +62 -0
  26. package/lib/pathfinder/tradeTypes.d.ts +83 -0
  27. package/lib/pathfinder/tradeTypes.js +26 -0
  28. package/lib/pathfinder/yVault.d.ts +1 -1
  29. package/lib/pathfinder/yVault.js +4 -23
  30. package/lib/tokens/convex.d.ts +2 -2
  31. package/lib/tokens/convex.js +1 -1
  32. package/lib/tokens/curveLP.d.ts +1 -1
  33. package/lib/tokens/curveLP.js +1 -1
  34. package/lib/tokens/gear.d.ts +1 -1
  35. package/lib/tokens/normal.d.ts +1 -1
  36. package/lib/tokens/normal.js +1 -1
  37. package/lib/tokens/token.d.ts +1 -1
  38. package/lib/tokens/token.js +10 -10
  39. package/lib/tokens/yearn.d.ts +2 -2
  40. package/lib/tokens/yearn.js +3 -3
  41. package/package.json +1 -1
  42. package/src/{core → contracts}/adapters.ts +0 -0
  43. package/src/{core → contracts}/contracts.ts +9 -9
  44. package/src/{core → contracts}/contractsRegister.ts +0 -0
  45. package/src/{core → contracts}/protocols.ts +0 -0
  46. package/src/core/events.ts +932 -915
  47. package/src/core/transactions.ts +360 -352
  48. package/src/index.ts +8 -9
  49. package/src/{core → oracles}/oracles.ts +0 -0
  50. package/src/oracles/priceFeeds.ts +528 -0
  51. package/src/pathfinder/convexLP.ts +1 -1
  52. package/src/pathfinder/curveLP.ts +3 -4
  53. package/src/pathfinder/path.ts +23 -53
  54. package/src/pathfinder/trade.ts +83 -0
  55. package/src/{core → pathfinder}/tradeTypes.ts +6 -6
  56. package/src/pathfinder/yVault.ts +1 -2
  57. package/src/tokens/convex.ts +2 -2
  58. package/src/tokens/curveLP.ts +1 -1
  59. package/src/tokens/gear.ts +1 -1
  60. package/src/tokens/normal.ts +1 -1
  61. package/src/tokens/token.ts +22 -12
  62. package/src/tokens/yearn.ts +4 -4
  63. package/src/core/creditCard.ts +0 -15
  64. package/src/core/priceFeeds.ts +0 -528
  65. package/src/core/swap.ts +0 -4
  66. package/src/core/trade.ts +0 -83
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -36,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
47
  }
37
48
  };
38
49
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.LPWithdrawPathFinder = exports.Path = void 0;
50
+ exports.Path = void 0;
40
51
  var ethers_1 = require("ethers");
41
52
  var token_1 = require("../tokens/token");
42
53
  var types_1 = require("../types");
@@ -80,14 +91,27 @@ var Path = /** @class */ (function () {
80
91
  };
81
92
  Path.findBestPath = function (creditAccount, creditManager, provider) {
82
93
  return __awaiter(this, void 0, void 0, function () {
83
- var networkType, initialPath, lpPaths, pathFinder;
94
+ var networkType, balances, initialPath, lpPaths, pathFinder;
84
95
  return __generator(this, function (_a) {
85
96
  switch (_a.label) {
86
97
  case 0: return [4 /*yield*/, (0, network_1.detectNetwork)(provider)];
87
98
  case 1:
88
99
  networkType = _a.sent();
100
+ balances = Object.entries(creditAccount.balances)
101
+ .map(function (_a) {
102
+ var address = _a[0], balance = _a[1];
103
+ return ({
104
+ token: token_1.tokenSymbolByAddress[address.toLowerCase()],
105
+ balance: balance
106
+ });
107
+ })
108
+ .filter(function (t) { return t.balance.gt(1); })
109
+ .reduce(function (obj, curValue) {
110
+ var _a;
111
+ return (__assign(__assign({}, obj), (_a = {}, _a[curValue.token] = curValue.balance, _a)));
112
+ }, {});
89
113
  initialPath = new Path({
90
- balances: {},
114
+ balances: balances,
91
115
  creditAccount: creditAccount,
92
116
  creditManager: creditManager,
93
117
  networkType: networkType,
@@ -156,34 +180,3 @@ var Path = /** @class */ (function () {
156
180
  return Path;
157
181
  }());
158
182
  exports.Path = Path;
159
- var LPWithdrawPathFinder = /** @class */ (function () {
160
- function LPWithdrawPathFinder() {
161
- }
162
- LPWithdrawPathFinder.prototype.getUniswapV2SwapData = function (adapterAddress, currentTokenAddress, currentBalance, nextTokenAddress, p) {
163
- return __awaiter(this, void 0, void 0, function () {
164
- var deadline, uniswapV2Adapter, path, amountsOut, amountOut, gasLimit, call;
165
- return __generator(this, function (_a) {
166
- switch (_a.label) {
167
- case 0:
168
- deadline = Math.floor(Date.now() / 1000) + 1200;
169
- uniswapV2Adapter = types_1.UniswapV2Adapter__factory.connect(adapterAddress, p.provider);
170
- path = [currentTokenAddress, nextTokenAddress];
171
- return [4 /*yield*/, uniswapV2Adapter.getAmountsOut(currentBalance, path)];
172
- case 1:
173
- amountsOut = _a.sent();
174
- amountOut = amountsOut[amountsOut.length - 1];
175
- return [4 /*yield*/, uniswapV2Adapter.estimateGas.swapExactTokensForTokens(currentBalance, amountOut, path, p.creditAccount.addr, deadline)];
176
- case 2:
177
- gasLimit = _a.sent();
178
- call = {
179
- targetContract: adapterAddress,
180
- callData: types_1.UniswapV2Adapter__factory.createInterface().encodeFunctionData("swapExactTokensForTokens", [currentBalance, amountOut, path, p.creditAccount.addr, deadline])
181
- };
182
- return [2 /*return*/, { callData: call, amountOut: amountOut, gasLimit: gasLimit }];
183
- }
184
- });
185
- });
186
- };
187
- return LPWithdrawPathFinder;
188
- }());
189
- exports.LPWithdrawPathFinder = LPWithdrawPathFinder;
@@ -0,0 +1,35 @@
1
+ import { BigNumber } from "ethers";
2
+ import { BytesLike } from "@ethersproject/bytes";
3
+ import { SwapType } from "./tradeTypes";
4
+ export interface CloseTradePath {
5
+ path: Array<string>;
6
+ amountOutMin: BigNumber;
7
+ }
8
+ export declare class TradePath {
9
+ readonly swapType: SwapType;
10
+ readonly amount: BigNumber;
11
+ readonly rate: BigNumber;
12
+ readonly path: Array<string>;
13
+ readonly expectedAmount: BigNumber;
14
+ readonly pathUniV3: BytesLike | undefined;
15
+ readonly i: number | undefined;
16
+ readonly j: number | undefined;
17
+ readonly operationName: string | undefined;
18
+ constructor(params: {
19
+ swapType: SwapType;
20
+ amount: BigNumber;
21
+ path: Array<string>;
22
+ expectedAmount: BigNumber;
23
+ pathUniV3?: BytesLike;
24
+ i?: number;
25
+ j?: number;
26
+ operationName?: string;
27
+ });
28
+ getExpectedAmountWithSlippage(slippage: number): BigNumber;
29
+ getAmountInMax(slippage: number): BigNumber;
30
+ getAmountOutMin(slippage: number): BigNumber;
31
+ get from(): string;
32
+ get to(): string;
33
+ getFromAmount(slippage: number): BigNumber;
34
+ getToAmount(slippage: number): BigNumber;
35
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TradePath = void 0;
4
+ var constants_1 = require("../core/constants");
5
+ var tradeTypes_1 = require("./tradeTypes");
6
+ var TradePath = /** @class */ (function () {
7
+ function TradePath(params) {
8
+ this.swapType = params.swapType;
9
+ this.amount = params.amount;
10
+ this.path = params.path;
11
+ this.expectedAmount = params.expectedAmount;
12
+ this.pathUniV3 = params.pathUniV3;
13
+ this.rate =
14
+ params.swapType !== tradeTypes_1.SwapType.ExactInput
15
+ ? params.expectedAmount.mul(constants_1.WAD).div(params.amount)
16
+ : constants_1.WAD.mul(params.amount).div(params.expectedAmount);
17
+ this.i = params.i;
18
+ this.j = params.j;
19
+ this.operationName = params.operationName;
20
+ }
21
+ TradePath.prototype.getExpectedAmountWithSlippage = function (slippage) {
22
+ return this.swapType === tradeTypes_1.SwapType.ExactInput
23
+ ? this.getAmountOutMin(slippage)
24
+ : this.getAmountInMax(slippage);
25
+ };
26
+ TradePath.prototype.getAmountInMax = function (slippage) {
27
+ return this.expectedAmount
28
+ .mul(constants_1.PERCENTAGE_FACTOR + slippage)
29
+ .div(constants_1.PERCENTAGE_FACTOR);
30
+ };
31
+ TradePath.prototype.getAmountOutMin = function (slippage) {
32
+ return this.expectedAmount
33
+ .mul(constants_1.PERCENTAGE_FACTOR)
34
+ .div(constants_1.PERCENTAGE_FACTOR + slippage);
35
+ };
36
+ Object.defineProperty(TradePath.prototype, "from", {
37
+ get: function () {
38
+ return this.path[0];
39
+ },
40
+ enumerable: false,
41
+ configurable: true
42
+ });
43
+ Object.defineProperty(TradePath.prototype, "to", {
44
+ get: function () {
45
+ return this.path[this.path.length - 1];
46
+ },
47
+ enumerable: false,
48
+ configurable: true
49
+ });
50
+ TradePath.prototype.getFromAmount = function (slippage) {
51
+ return this.swapType === tradeTypes_1.SwapType.ExactInput
52
+ ? this.amount
53
+ : this.getExpectedAmountWithSlippage(slippage);
54
+ };
55
+ TradePath.prototype.getToAmount = function (slippage) {
56
+ return this.swapType === tradeTypes_1.SwapType.ExactOutput
57
+ ? this.amount
58
+ : this.getExpectedAmountWithSlippage(slippage);
59
+ };
60
+ return TradePath;
61
+ }());
62
+ exports.TradePath = TradePath;
@@ -0,0 +1,83 @@
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
+ };
80
+ export declare enum SwapType {
81
+ ExactInput = 1,
82
+ ExactOutput = 2
83
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwapType = 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 = {}));
22
+ var SwapType;
23
+ (function (SwapType) {
24
+ SwapType[SwapType["ExactInput"] = 1] = "ExactInput";
25
+ SwapType[SwapType["ExactOutput"] = 2] = "ExactOutput";
26
+ })(SwapType = exports.SwapType || (exports.SwapType = {}));
@@ -2,7 +2,7 @@ import { Path, LPWithdrawPathFinder } from "./path";
2
2
  import { YearnLPToken } from "../tokens/yearn";
3
3
  import { NormalToken } from "../tokens/normal";
4
4
  import { CurveLPToken } from "../tokens/curveLP";
5
- export declare class YearnVaultPathFinder extends LPWithdrawPathFinder {
5
+ export declare class YearnVaultPathFinder implements LPWithdrawPathFinder {
6
6
  _vault: YearnLPToken;
7
7
  token: NormalToken | CurveLPToken;
8
8
  constructor(vault: YearnLPToken);
@@ -1,19 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -54,19 +39,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
54
39
  exports.YearnVaultPathFinder = void 0;
55
40
  var ethers_1 = require("ethers");
56
41
  var types_1 = require("../types");
57
- var path_1 = require("./path");
58
42
  var yearn_1 = require("../tokens/yearn");
59
43
  var token_1 = require("../tokens/token");
60
44
  var multicall_1 = require("../utils/multicall");
61
- var YearnVaultPathFinder = /** @class */ (function (_super) {
62
- __extends(YearnVaultPathFinder, _super);
45
+ var YearnVaultPathFinder = /** @class */ (function () {
63
46
  function YearnVaultPathFinder(vault) {
64
- var _this = _super.call(this) || this;
65
- _this._vault = vault;
47
+ this._vault = vault;
66
48
  var currentTokenData = yearn_1.yearnTokens[vault];
67
49
  // Yearn Vault only has one lp action
68
- _this.token = currentTokenData.underlying;
69
- return _this;
50
+ this.token = currentTokenData.underlying;
70
51
  }
71
52
  YearnVaultPathFinder.prototype.findWithdrawPaths = function (p) {
72
53
  return __awaiter(this, void 0, void 0, function () {
@@ -112,5 +93,5 @@ var YearnVaultPathFinder = /** @class */ (function (_super) {
112
93
  });
113
94
  };
114
95
  return YearnVaultPathFinder;
115
- }(path_1.LPWithdrawPathFinder));
96
+ }());
116
97
  exports.YearnVaultPathFinder = YearnVaultPathFinder;
@@ -1,6 +1,6 @@
1
- import { TradeAction } from "../core/tradeTypes";
1
+ import { TradeAction } from "../pathfinder/tradeTypes";
2
2
  import { TokenBase } from "./token";
3
- import { ConvexPoolContract } from "../core/contracts";
3
+ import { ConvexPoolContract } from "../contracts/contracts";
4
4
  import { CurveLPToken } from "./curveLP";
5
5
  import { TokenType } from "./tokenType";
6
6
  export declare type ConvexLPToken = "cvx3Crv" | "cvxsteCRV" | "cvxFRAX3CRV" | "cvxcrvPlain3andSUSD" | "cvxgusd3CRV";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convexTokens = void 0;
4
- var tradeTypes_1 = require("../core/tradeTypes");
4
+ var tradeTypes_1 = require("../pathfinder/tradeTypes");
5
5
  var tokenType_1 = require("./tokenType");
6
6
  exports.convexTokens = {
7
7
  // CONVEX LP TOKENS
@@ -1,4 +1,4 @@
1
- import { TradeAction } from "../core/tradeTypes";
1
+ import { TradeAction } from "../pathfinder/tradeTypes";
2
2
  import { SupportedToken, TokenBase } from "./token";
3
3
  import { PartialRecord } from "../utils/types";
4
4
  import { BigNumber } from "ethers";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.curveTokens = exports.Curve3CrvUnderlyingTokenIndex = void 0;
4
- var tradeTypes_1 = require("../core/tradeTypes");
4
+ var tradeTypes_1 = require("../pathfinder/tradeTypes");
5
5
  var ethers_1 = require("ethers");
6
6
  var tokenType_1 = require("./tokenType");
7
7
  exports.Curve3CrvUnderlyingTokenIndex = {
@@ -1,5 +1,5 @@
1
1
  import { TokenBase } from "./token";
2
- import { TradeAction } from "../core/tradeTypes";
2
+ import { TradeAction } from "../pathfinder/tradeTypes";
3
3
  import { TokenType } from "./tokenType";
4
4
  export declare type DieselTokenTypes = "dDAI" | "dUSDC" | "dWBTC" | "dWETH";
5
5
  export declare type GearboxToken = "GEAR";
@@ -1,4 +1,4 @@
1
- import { TradeAction } from "../core/tradeTypes";
1
+ import { TradeAction } from "../pathfinder/tradeTypes";
2
2
  import { TokenBase } from "./token";
3
3
  import { TokenType } from "./tokenType";
4
4
  export declare type NormalToken = "1INCH" | "AAVE" | "COMP" | "CRV" | "DPI" | "FEI" | "LINK" | "SNX" | "SUSHI" | "UNI" | "USDT" | "USDC" | "DAI" | "WETH" | "WBTC" | "YFI" | "STETH" | "FTM" | "CVX" | "FRAX" | "FXS" | "LDO" | "SPELL" | "LUSD" | "sUSD" | "GUSD" | "LUNA" | "LQTY";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalTokens = void 0;
4
- var tradeTypes_1 = require("../core/tradeTypes");
4
+ var tradeTypes_1 = require("../pathfinder/tradeTypes");
5
5
  var tokenType_1 = require("./tokenType");
6
6
  exports.normalTokens = {
7
7
  "1INCH": {
@@ -13,4 +13,4 @@ export interface TokenBase {
13
13
  export declare type TokenDataI = NormalTokenData | CurveLPTokenData | MetaCurveLPTokenData | YearnVaultTokenData | YearnVaultOfCurveLPTokenData | YearnVaultOfMetaCurveLPTokenData | ConvexLPTokenData | ConvexPhantomTokenData | DieselTokenData | GearboxTokenData;
14
14
  export declare const supportedTokens: Record<SupportedToken, TokenDataI>;
15
15
  export declare const tokenDataByNetwork: Record<NetworkType, Record<SupportedToken, string>>;
16
- export declare const tokenDataByAddress: Record<string, SupportedToken>;
16
+ export declare const tokenSymbolByAddress: Record<string, SupportedToken>;
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.tokenDataByAddress = exports.tokenDataByNetwork = exports.supportedTokens = void 0;
14
+ exports.tokenSymbolByAddress = exports.tokenDataByNetwork = exports.supportedTokens = void 0;
15
15
  var mappers_1 = require("../utils/mappers");
16
16
  var normal_1 = require("./normal");
17
17
  var curveLP_1 = require("./curveLP");
@@ -78,7 +78,7 @@ exports.tokenDataByNetwork = {
78
78
  stkcvxgusd3CRV: "0xc8124E539fD1F9E5E2F561f14aAAc5899681E274",
79
79
  // YEARN- CURVE TOKENS
80
80
  yvCurve_stETH: "0xdCD90C7f6324cfa40d7169ef80b12031770B4325",
81
- yvCURVE_FRAX_POOL: "0xB4AdA607B9d6b2c9Ee07A275e9616B84AC560139",
81
+ yvCurve_FRAX: "0xB4AdA607B9d6b2c9Ee07A275e9616B84AC560139",
82
82
  //GEARBOX
83
83
  dDAI: "0x6CFaF95457d7688022FC53e7AbE052ef8DFBbdBA",
84
84
  dUSDC: "0xc411dB5f5Eb3f7d552F9B8454B2D74097ccdE6E3",
@@ -126,12 +126,12 @@ exports.tokenDataByNetwork = {
126
126
  yvWETH: "0xB8f3CC38753db078b86e31647bE0A752cfd30A4b",
127
127
  yvWBTC: "0x66359b29F7b142A3C7158e2F809aCD4407A6Ae75",
128
128
  // CURVE LP TOKENS
129
- "3Crv": "0x8eA3677599d5199c2c93c468fD2Fa6F102d3605b",
130
- steCRV: "0x6636910D55D34505c08d53932Da526FB18D3869C",
131
- FRAX3CRV: "0x76508F5398E50EFEC53d5Afd4B506990B43AdBFB",
132
- LUSD3CRV: "0x04366d7ee3210B9eAd6f36696220d697b7885ED7",
133
- crvPlain3andSUSD: "0x540f5ea2A0601e27368661CB231AE04c23A14C24",
134
- gusd3CRV: "0x428A500D8209fef5a1b5a0A35C9412b71F03aAdA",
129
+ "3Crv": "0x810356F5BD94FC7dE0c64962832cCd1f33b0564c",
130
+ steCRV: "0x2Ea568b3F09eC2Aeae31Eb445914BBd3fe994148",
131
+ FRAX3CRV: "0x830b6fCfA4a14A925Da83f62Ea17a9BdD9065910",
132
+ LUSD3CRV: "0x633b91050B87d9A45dd35A9350E2Aa2934F21c97",
133
+ crvPlain3andSUSD: "0x0852f498ca620d97f666fcB528C6104C1A0FC021 ",
134
+ gusd3CRV: "0xdc0b0d8E546b372f66d8BEC70a084663934B64f0",
135
135
  // CONVEX LP TOKENS
136
136
  cvx3Crv: "",
137
137
  cvxsteCRV: "",
@@ -146,7 +146,7 @@ exports.tokenDataByNetwork = {
146
146
  stkcvxgusd3CRV: "",
147
147
  // YEARN- CURVE TOKENS
148
148
  yvCurve_stETH: "",
149
- yvCURVE_FRAX_POOL: "",
149
+ yvCurve_FRAX: "",
150
150
  //GEARBOX
151
151
  dDAI: "0x6CFaF95457d7688022FC53e7AbE052ef8DFBbdBA",
152
152
  dUSDC: "0xc411dB5f5Eb3f7d552F9B8454B2D74097ccdE6E3",
@@ -155,7 +155,7 @@ exports.tokenDataByNetwork = {
155
155
  GEAR: "0xBa3335588D9403515223F109EdC4eB7269a9Ab5D"
156
156
  }
157
157
  };
158
- exports.tokenDataByAddress = (0, mappers_1.objectEntries)(exports.tokenDataByNetwork).reduce(function (sum, _a) {
158
+ exports.tokenSymbolByAddress = (0, mappers_1.objectEntries)(exports.tokenDataByNetwork).reduce(function (sum, _a) {
159
159
  var _ = _a[0], tokens = _a[1];
160
160
  return __assign(__assign({}, sum), (0, mappers_1.keyToLowercase)((0, mappers_1.swapKeyValue)(tokens)));
161
161
  }, {});
@@ -1,9 +1,9 @@
1
- import { TradeAction } from "../core/tradeTypes";
1
+ import { TradeAction } from "../pathfinder/tradeTypes";
2
2
  import { TokenBase } from "./token";
3
3
  import { CurveLPToken } from "./curveLP";
4
4
  import { NormalToken } from "./normal";
5
5
  import { TokenType } from "./tokenType";
6
- export declare type YearnLPToken = "yvDAI" | "yvUSDC" | "yvWETH" | "yvWBTC" | "yvCurve_stETH" | "yvCURVE_FRAX_POOL";
6
+ export declare type YearnLPToken = "yvDAI" | "yvUSDC" | "yvWETH" | "yvWBTC" | "yvCurve_stETH" | "yvCurve_FRAX";
7
7
  export declare type YearnVaultTokenData = {
8
8
  symbol: YearnLPToken;
9
9
  type: TokenType.YEARN_VAULT;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yearnTokens = void 0;
4
- var tradeTypes_1 = require("../core/tradeTypes");
4
+ var tradeTypes_1 = require("../pathfinder/tradeTypes");
5
5
  var tokenType_1 = require("./tokenType");
6
6
  exports.yearnTokens = {
7
7
  // YEARN TOKENS
@@ -76,10 +76,10 @@ exports.yearnTokens = {
76
76
  }
77
77
  ]
78
78
  },
79
- yvCURVE_FRAX_POOL: {
79
+ yvCurve_FRAX: {
80
80
  name: "yvCurve-FRAX",
81
81
  decimals: 18,
82
- symbol: "yvCURVE_FRAX_POOL",
82
+ symbol: "yvCurve_FRAX",
83
83
  type: tokenType_1.TokenType.YEARN_VAULT_OF_META_CURVE_LP,
84
84
  underlying: "FRAX3CRV",
85
85
  lpActions: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "0.0.67",
3
+ "version": "0.0.70",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
File without changes
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import {keyToLowercase, objectEntries, swapKeyValue} from "../utils/mappers";
7
7
  import {AdapterInterface} from "./adapters";
8
- import {NetworkType} from "./constants";
8
+ import {NetworkType} from "../core/constants";
9
9
  import {Protocols} from "./protocols";
10
10
  import {tokenDataByNetwork} from "../tokens/token";
11
11
  import {ConvexStakedPhantomToken} from "../tokens/convex";
@@ -69,7 +69,7 @@ export const contractsByNetwork: Record<NetworkType,
69
69
  YEARN_USDC_VAULT: tokenDataByNetwork.Mainnet.yvUSDC,
70
70
  YEARN_WETH_VAULT: tokenDataByNetwork.Mainnet.yvWETH,
71
71
  YEARN_WBTC_VAULT: tokenDataByNetwork.Mainnet.yvWBTC,
72
- YEARN_CURVE_FRAX_VAULT: tokenDataByNetwork.Mainnet.yvCURVE_FRAX_POOL,
72
+ YEARN_CURVE_FRAX_VAULT: tokenDataByNetwork.Mainnet.yvCurve_FRAX,
73
73
  YEARN_CURVE_STETH_VAULT: tokenDataByNetwork.Mainnet.yvCurve_stETH,
74
74
 
75
75
  // CONVEX
@@ -92,20 +92,20 @@ export const contractsByNetwork: Record<NetworkType,
92
92
  SUSHISWAP_ROUTER: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
93
93
 
94
94
  // CURVE
95
- CURVE_3CRV_POOL: "0x5544FDA32B8F64262295DD0720A4D36BEB3F438c",
96
- CURVE_STETH_GATEWAY: "0xa5F7C2D7A1125ae47818A7371F9c48553305b077",
95
+ CURVE_3CRV_POOL: "0x48364De693fdE2D4AB0A6D5EAB9c5e5f79D77e47",
96
+ CURVE_STETH_GATEWAY: "0x464C874c54Bf8d48e1CcbA20636837E5EfBBA4B0",
97
97
  CURVE_FRAX_POOL: tokenDataByNetwork.Kovan.FRAX3CRV,
98
98
  CURVE_LUSD_POOL: tokenDataByNetwork.Kovan.LUSD3CRV,
99
- CURVE_SUSD_POOL: "0xf4fD22A7c99D389e4ddBb8185B59F9D6eF6775c0", // SEPARATE TOKEN
100
- CURVE_SUSD_DEPOSIT: "0x0558CBb362fbDff28c913D91d0ec11315Ff69b4A",
101
- CURVE_GUSD_POOL: "0xeB9D96059bd466EBbd0E5EeBdD596566f31EbB7B",
99
+ CURVE_SUSD_POOL: "0x446973eC709A3e2ce2845988E9BF737Fb1eF4aDD", // SEPARATE TOKEN
100
+ CURVE_SUSD_DEPOSIT: "0x614Dca6b90DC22Ca3A0f2d8Fb44f7B3FA2664E97",
101
+ CURVE_GUSD_POOL: "0x03Cc4B5a6f271B50F2b8244AA9C4995b5608Fae2",
102
102
 
103
103
  // YEARN
104
104
  YEARN_DAI_VAULT: tokenDataByNetwork.Kovan.yvDAI,
105
105
  YEARN_USDC_VAULT: tokenDataByNetwork.Kovan.yvUSDC,
106
106
  YEARN_WETH_VAULT: tokenDataByNetwork.Kovan.yvWETH,
107
107
  YEARN_WBTC_VAULT: tokenDataByNetwork.Kovan.yvWBTC,
108
- YEARN_CURVE_FRAX_VAULT: tokenDataByNetwork.Kovan.yvCURVE_FRAX_POOL,
108
+ YEARN_CURVE_FRAX_VAULT: tokenDataByNetwork.Kovan.yvCurve_FRAX,
109
109
  YEARN_CURVE_STETH_VAULT: tokenDataByNetwork.Kovan.yvCurve_stETH,
110
110
 
111
111
  // CONVEX
@@ -227,7 +227,7 @@ export const contractParams: Record<SupportedContract, ContractParams> = {
227
227
  type: AdapterInterface.CURVE_V1_STECRV_POOL,
228
228
  pool: {
229
229
  Mainnet: "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022",
230
- Kovan: "0x39311C60F6EC014b2c954aD469CE61946A3Ee460"
230
+ Kovan: "0x485B855a1B5e05e31e635344aF345C426CA5ae3F"
231
231
  },
232
232
  lpToken: "steCRV"
233
233
  },
File without changes
File without changes