@gearbox-protocol/sdk 1.2.10 → 1.3.2

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 (72) hide show
  1. package/lib/core/creditAccount.js +1 -0
  2. package/lib/core/creditManager.js +10 -8
  3. package/lib/index.d.ts +0 -1
  4. package/lib/index.js +0 -1
  5. package/lib/oracles/oracles.d.ts +6 -6
  6. package/lib/oracles/oracles.js +3 -3
  7. package/lib/oracles/priceFeeds.js +20 -20
  8. package/lib/strategies/yearn.js +4 -6
  9. package/lib/tokens/convex.d.ts +1 -1
  10. package/lib/tokens/convex.js +6 -6
  11. package/lib/tokens/curveLP.d.ts +2 -2
  12. package/lib/tokens/curveLP.js +6 -6
  13. package/lib/tokens/normal.d.ts +1 -1
  14. package/lib/tokens/normal.js +4 -4
  15. package/lib/tokens/tokenType.d.ts +9 -10
  16. package/lib/tokens/tokenType.js +9 -10
  17. package/lib/tokens/yearn.d.ts +3 -3
  18. package/lib/tokens/yearn.js +6 -6
  19. package/lib/types/contracts/interfaces/V1/{IPriceOracle.sol/IPriceOracleV2.d.ts → IPriceOracle.d.ts} +4 -4
  20. package/lib/types/contracts/interfaces/V1/{IPriceOracle.sol/IPriceOracleV2.js → IPriceOracle.js} +0 -0
  21. package/lib/types/contracts/interfaces/V1/index.d.ts +1 -2
  22. package/lib/types/contracts/pathfinder/interfaces/IDepositor.sol/IDepositorOptions.d.ts +31 -8
  23. package/lib/types/contracts/pathfinder/interfaces/IPathFinder.d.ts +36 -7
  24. package/lib/types/contracts/test/index.d.ts +2 -0
  25. package/lib/types/contracts/test/suites/index.d.ts +2 -0
  26. package/lib/types/contracts/{interfaces/V1/IPriceOracle.sol → test/suites}/index.js +0 -0
  27. package/lib/types/contracts/test/suites/mainnet/IPriceFeedsRegistry.d.ts +42 -0
  28. package/lib/types/contracts/test/suites/mainnet/IPriceFeedsRegistry.js +2 -0
  29. package/lib/types/contracts/test/suites/mainnet/ITokenTestSuite.d.ts +58 -0
  30. package/lib/types/contracts/test/suites/mainnet/ITokenTestSuite.js +2 -0
  31. package/lib/types/contracts/test/suites/mainnet/index.d.ts +2 -0
  32. package/lib/types/contracts/test/suites/mainnet/index.js +2 -0
  33. package/lib/types/factories/contracts/interfaces/V1/{IPriceOracle.sol/IPriceOracleV2__factory.d.ts → IPriceOracle__factory.d.ts} +4 -4
  34. package/lib/types/factories/contracts/interfaces/V1/{IPriceOracle.sol/IPriceOracleV2__factory.js → IPriceOracle__factory.js} +8 -8
  35. package/lib/types/factories/contracts/interfaces/V1/index.d.ts +1 -1
  36. package/lib/types/factories/contracts/interfaces/V1/index.js +3 -25
  37. package/lib/types/factories/contracts/pathfinder/interfaces/IDepositor.sol/IDepositorOptions__factory.js +235 -0
  38. package/lib/types/factories/contracts/pathfinder/interfaces/IPathFinder__factory.js +45 -28
  39. package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.d.ts +1 -1
  40. package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.js +1 -1
  41. package/lib/types/factories/contracts/test/index.d.ts +1 -0
  42. package/lib/types/factories/contracts/test/index.js +2 -1
  43. package/lib/types/factories/contracts/test/suites/index.d.ts +1 -0
  44. package/lib/types/factories/contracts/test/suites/index.js +30 -0
  45. package/lib/types/factories/contracts/test/suites/mainnet/IPriceFeedsRegistry__factory.d.ts +32 -0
  46. package/lib/types/factories/contracts/test/suites/mainnet/IPriceFeedsRegistry__factory.js +52 -0
  47. package/lib/types/factories/contracts/test/suites/mainnet/ITokenTestSuite__factory.d.ts +32 -0
  48. package/lib/types/factories/contracts/test/suites/mainnet/ITokenTestSuite__factory.js +90 -0
  49. package/lib/types/factories/contracts/test/suites/mainnet/index.d.ts +2 -0
  50. package/lib/types/factories/contracts/test/suites/mainnet/index.js +10 -0
  51. package/lib/types/index.d.ts +6 -0
  52. package/lib/types/index.js +7 -1
  53. package/lib/utils/extracter.d.ts +1 -1
  54. package/lib/utils/loading.js +1 -1
  55. package/package.json +1 -1
  56. package/lib/pathfinder/contracts.d.ts +0 -3
  57. package/lib/pathfinder/contracts.js +0 -15
  58. package/lib/pathfinder/convexLP.d.ts +0 -4
  59. package/lib/pathfinder/convexLP.js +0 -77
  60. package/lib/pathfinder/curveLP.d.ts +0 -9
  61. package/lib/pathfinder/curveLP.js +0 -95
  62. package/lib/pathfinder/path.d.ts +0 -34
  63. package/lib/pathfinder/path.js +0 -178
  64. package/lib/pathfinder/priority.d.ts +0 -2
  65. package/lib/pathfinder/priority.js +0 -17
  66. package/lib/pathfinder/trade.d.ts +0 -34
  67. package/lib/pathfinder/trade.js +0 -62
  68. package/lib/pathfinder/yVault.d.ts +0 -10
  69. package/lib/pathfinder/yVault.js +0 -100
  70. package/lib/types/contracts/interfaces/V1/IPriceOracle.sol/index.d.ts +0 -1
  71. package/lib/types/factories/contracts/interfaces/V1/IPriceOracle.sol/index.d.ts +0 -1
  72. package/lib/types/factories/contracts/interfaces/V1/IPriceOracle.sol/index.js +0 -8
@@ -1,10 +0,0 @@
1
- import { CurveLPToken } from "../tokens/curveLP";
2
- import { NormalToken } from "../tokens/normal";
3
- import { YearnLPToken } from "../tokens/yearn";
4
- import type { LPWithdrawPathFinder, Path } from "./path";
5
- export declare class YearnVaultPathFinder implements LPWithdrawPathFinder {
6
- _vault: YearnLPToken;
7
- token: NormalToken | CurveLPToken;
8
- constructor(vault: YearnLPToken);
9
- findWithdrawPaths(path: Path): Promise<Array<Path>>;
10
- }
@@ -1,100 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
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
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.YearnVaultPathFinder = void 0;
40
- var ethers_1 = require("ethers");
41
- var token_1 = require("../tokens/token");
42
- var yearn_1 = require("../tokens/yearn");
43
- var types_1 = require("../types");
44
- var mappers_1 = require("../utils/mappers");
45
- var multicall_1 = require("../utils/multicall");
46
- var YearnVaultPathFinder = /** @class */ (function () {
47
- function YearnVaultPathFinder(vault) {
48
- this._vault = vault;
49
- var currentTokenData = yearn_1.yearnTokens[vault];
50
- // Yearn Vault only has one lp action
51
- this.token = currentTokenData.underlying;
52
- }
53
- // eslint-disable-next-line class-methods-use-this
54
- YearnVaultPathFinder.prototype.findWithdrawPaths = function (path) {
55
- return __awaiter(this, void 0, void 0, function () {
56
- var p, vaultBalances, vaultList, multicallData, prices, i, vault, vb, tokenAddress, adapterAddress, callData;
57
- return __generator(this, function (_a) {
58
- switch (_a.label) {
59
- case 0:
60
- p = Object.assign(Object.create(Object.getPrototypeOf(path)), path);
61
- vaultBalances = (0, mappers_1.objectEntries)(yearn_1.yearnTokens).reduce(function (acc, _a) {
62
- var yVault = _a[0], tokenData = _a[1];
63
- var typedVault = yVault;
64
- var currentBalance = p.popBalance(typedVault);
65
- if (currentBalance.gt(1)) {
66
- acc[typedVault] = {
67
- token: tokenData.underlying,
68
- balance: currentBalance,
69
- };
70
- }
71
- return acc;
72
- }, {});
73
- vaultList = Object.keys(vaultBalances);
74
- multicallData = vaultList
75
- .map(function (t) { return token_1.tokenDataByNetwork[p.networkType][t]; })
76
- .map(function (addr) { return ({
77
- address: addr,
78
- interface: types_1.IYVault__factory.createInterface(),
79
- method: "pricePerShare()",
80
- }); });
81
- return [4 /*yield*/, (0, multicall_1.multicall)(multicallData, p.provider)];
82
- case 1:
83
- prices = _a.sent();
84
- for (i = 0; i < vaultList.length; i += 1) {
85
- vault = vaultList[i];
86
- vb = vaultBalances[vault];
87
- p.balances[vb.token] = (p.balances[vb.token] || ethers_1.BigNumber.from(0)).add(ethers_1.BigNumber.from((vb === null || vb === void 0 ? void 0 : vb.balance) || 0).mul(prices[i]));
88
- tokenAddress = token_1.tokenDataByNetwork[p.networkType][vault];
89
- adapterAddress = p.creditManager.adapters[tokenAddress];
90
- callData = types_1.IYVault__factory.createInterface().encodeFunctionData("withdraw()");
91
- p.calls.push({ target: adapterAddress, callData: callData });
92
- }
93
- return [2 /*return*/, p.withdrawTokens()];
94
- }
95
- });
96
- });
97
- };
98
- return YearnVaultPathFinder;
99
- }());
100
- exports.YearnVaultPathFinder = YearnVaultPathFinder;
@@ -1 +0,0 @@
1
- export type { IPriceOracleV2 } from "./IPriceOracleV2";
@@ -1 +0,0 @@
1
- export { IPriceOracleV2__factory } from "./IPriceOracleV2__factory";
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IPriceOracleV2__factory = void 0;
4
- /* Autogenerated file. Do not edit manually. */
5
- /* tslint:disable */
6
- /* eslint-disable */
7
- var IPriceOracleV2__factory_1 = require("./IPriceOracleV2__factory");
8
- Object.defineProperty(exports, "IPriceOracleV2__factory", { enumerable: true, get: function () { return IPriceOracleV2__factory_1.IPriceOracleV2__factory; } });