@gearbox-protocol/sdk 0.0.34 → 0.0.37

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.
@@ -26,6 +26,7 @@ export declare const SUSHISWAP_MAINNET = "0xd9e1cE17f2641f24aE83637ab66a2cca9C37
26
26
  export declare const SUSHISWAP_KOVAN = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506";
27
27
  export declare const CONVEX_BOOSTER_KOVAN_ADDRESS = "0x78A9261965F048b9FF055699569be4400EEC7005";
28
28
  export declare const CONVEX_3CRV_KOVAN_POOL_ADDRESS = "0x90D9E8ecc406cd7363C08fAdb4ac0f3994b4cA71";
29
+ export declare const CONVEX_STECRV_POOL_ADDRESS = "0x0A760466E1B4621579a82a39CB56Dda2F4E70f03";
29
30
  export declare const CONVEX_STECRV_KOVAN_POOL_ADDRESS = "0x0f64e188BFF97e09C71FF85f30509f5596D420dD";
30
31
  export declare const CONVEX_BOOSTER_ADDRESS = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31";
31
32
  export declare const CONVEX_3POOL_REWARD_POOL_ADDRESS = "0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8";
@@ -6,7 +6,7 @@
6
6
  */
7
7
  var _a;
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.knownContracts = exports.AdapterInterface = exports.LIDO_STETH_ADDRESS = exports.CONVEX_CLAIM_ZAP_ADDRESS = exports.CONVEX_FRAX3CRV_REWARD_POOL_ADDRESS = exports.CONVEX_3POOL_REWARD_POOL_ADDRESS = exports.CONVEX_BOOSTER_ADDRESS = exports.CONVEX_STECRV_KOVAN_POOL_ADDRESS = exports.CONVEX_3CRV_KOVAN_POOL_ADDRESS = exports.CONVEX_BOOSTER_KOVAN_ADDRESS = exports.SUSHISWAP_KOVAN = exports.SUSHISWAP_MAINNET = exports.YEARN_3POOL_KOVAN_MOCK = exports.YEARN_WBTC_KOVAN_MOCK = exports.YEARN_WETH_KOVAN_MOCK = exports.YEARN_USDC_KOVAN_MOCK = exports.YEARN_DAI_KOVAN_MOCK = exports.YEARN_CURVE_STETH_ADDRESS = exports.YEARN_CURVE_FRAX_ADDRESS = exports.YEARN_WBTC_ADDRESS = exports.YEARN_WETH_ADDRESS = exports.YEARN_USDC_ADDRESS = exports.YEARN_DAI_ADDRESS = exports.CURVE_SUSD_KOVAN_MOCK = exports.CURVE_STE_CRV_KOVAN_MOCK = exports.CURVE_3POOL_KOVAN_MOCK = exports.CURVE_GUSD_ADDRESS = exports.CURVE_SUSD_ADDRESS = exports.CURVE_LUSD_ADDRESS = exports.CURVE_FRAX_ADDRESS = exports.CURVE_STETH_GATEWAY_ADDRESS = exports.CURVE_STETH_ADDRESS = exports.CURVE_3POOL_ADDRESS = exports.UNISWAP_V3_QUOTER = exports.UNISWAP_V3_ROUTER = exports.UNISWAP_V2_ROUTER = void 0;
9
+ exports.knownContracts = exports.AdapterInterface = exports.LIDO_STETH_ADDRESS = exports.CONVEX_CLAIM_ZAP_ADDRESS = exports.CONVEX_FRAX3CRV_REWARD_POOL_ADDRESS = exports.CONVEX_3POOL_REWARD_POOL_ADDRESS = exports.CONVEX_BOOSTER_ADDRESS = exports.CONVEX_STECRV_KOVAN_POOL_ADDRESS = exports.CONVEX_STECRV_POOL_ADDRESS = exports.CONVEX_3CRV_KOVAN_POOL_ADDRESS = exports.CONVEX_BOOSTER_KOVAN_ADDRESS = exports.SUSHISWAP_KOVAN = exports.SUSHISWAP_MAINNET = exports.YEARN_3POOL_KOVAN_MOCK = exports.YEARN_WBTC_KOVAN_MOCK = exports.YEARN_WETH_KOVAN_MOCK = exports.YEARN_USDC_KOVAN_MOCK = exports.YEARN_DAI_KOVAN_MOCK = exports.YEARN_CURVE_STETH_ADDRESS = exports.YEARN_CURVE_FRAX_ADDRESS = exports.YEARN_WBTC_ADDRESS = exports.YEARN_WETH_ADDRESS = exports.YEARN_USDC_ADDRESS = exports.YEARN_DAI_ADDRESS = exports.CURVE_SUSD_KOVAN_MOCK = exports.CURVE_STE_CRV_KOVAN_MOCK = exports.CURVE_3POOL_KOVAN_MOCK = exports.CURVE_GUSD_ADDRESS = exports.CURVE_SUSD_ADDRESS = exports.CURVE_LUSD_ADDRESS = exports.CURVE_FRAX_ADDRESS = exports.CURVE_STETH_GATEWAY_ADDRESS = exports.CURVE_STETH_ADDRESS = exports.CURVE_3POOL_ADDRESS = exports.UNISWAP_V3_QUOTER = exports.UNISWAP_V3_ROUTER = exports.UNISWAP_V2_ROUTER = void 0;
10
10
  var token_1 = require("./token");
11
11
  exports.UNISWAP_V2_ROUTER = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D";
12
12
  exports.UNISWAP_V3_ROUTER = "0xE592427A0AEce92De3Edee1F18E0157C05861564";
@@ -37,6 +37,7 @@ exports.SUSHISWAP_MAINNET = "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F";
37
37
  exports.SUSHISWAP_KOVAN = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506";
38
38
  exports.CONVEX_BOOSTER_KOVAN_ADDRESS = "0x78A9261965F048b9FF055699569be4400EEC7005";
39
39
  exports.CONVEX_3CRV_KOVAN_POOL_ADDRESS = "0x90D9E8ecc406cd7363C08fAdb4ac0f3994b4cA71";
40
+ exports.CONVEX_STECRV_POOL_ADDRESS = "0x0A760466E1B4621579a82a39CB56Dda2F4E70f03";
40
41
  exports.CONVEX_STECRV_KOVAN_POOL_ADDRESS = "0x0f64e188BFF97e09C71FF85f30509f5596D420dD";
41
42
  exports.CONVEX_BOOSTER_ADDRESS = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31";
42
43
  exports.CONVEX_3POOL_REWARD_POOL_ADDRESS = "0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8";
@@ -0,0 +1,5 @@
1
+ import { BytesLike } from "ethers";
2
+ export interface MultiCall {
3
+ targetContract: string;
4
+ callData: BytesLike;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import { BigNumber } from "ethers";
2
+ import { CreditManagerData } from "./creditManager";
3
+ import { MultiCall } from "./multicall";
4
+ import { SupportedTokens } from "./token";
5
+ export interface Path {
6
+ calls: Array<MultiCall>;
7
+ balances: Record<SupportedTokens, BigNumber>;
8
+ gasUsed: number;
9
+ pool: SupportedTokens;
10
+ creditManager: CreditManagerData;
11
+ getBestPath(): Promise<Path>;
12
+ }
13
+ export interface PathAsset {
14
+ getBestPath(p: Path): Promise<Path>;
15
+ }
16
+ export declare class ConnectorPathAsset implements PathAsset {
17
+ getBestPath(p: Path): Promise<Path>;
18
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectorPathAsset = void 0;
4
+ var ConnectorPathAsset = /** @class */ (function () {
5
+ function ConnectorPathAsset() {
6
+ }
7
+ ConnectorPathAsset.prototype.getBestPath = function (p) {
8
+ console.log(p);
9
+ // How to unwrap
10
+ // set balance of current token to 0
11
+ // add balnace what we get
12
+ // add call
13
+ // create new Paths
14
+ // return maxValuable(new Paths.getBestPath())
15
+ throw new Error("Method not implemented.");
16
+ };
17
+ return ConnectorPathAsset;
18
+ }());
19
+ exports.ConnectorPathAsset = ConnectorPathAsset;
@@ -257,6 +257,9 @@ exports.priceFeedsByNetwork = {
257
257
  type: oracles_1.OracleType.CHAINLINK_ORACLE,
258
258
  address: "0x4e844125952d32acdf339be976c98e22f6f318db",
259
259
  kovan: "0x6204148EF888786A2988E7b09c8e0A67e32cb387"
260
+ },
261
+ priceFeedUSD: {
262
+ type: oracles_1.OracleType.ZERO_ORACLE
260
263
  }
261
264
  // ADD ETH-> DAI Oracle!
262
265
  },
@@ -19,9 +19,23 @@ export declare const priority: {
19
19
  7: number;
20
20
  6: number;
21
21
  };
22
- export interface TokenDataI {
23
- type: TokenType;
24
- }
22
+ export declare type TokenDataI = {
23
+ type: TokenType.CONNECTOR;
24
+ } | {
25
+ type: TokenType.NORMAL_TOKEN;
26
+ } | {
27
+ type: TokenType.CURVE_LP;
28
+ } | {
29
+ type: TokenType.YEARN_VAULT;
30
+ } | {
31
+ type: TokenType.META_CURVE_LP;
32
+ } | {
33
+ type: TokenType.YEARN_VAULT_OF_CURVE_LP;
34
+ } | {
35
+ type: TokenType.CONVEX_PHANTOM;
36
+ } | {
37
+ type: TokenType.YEARN_VAULT_OF_META_CURVE_LP;
38
+ };
25
39
  export declare type SupportedTokens = "1INCH" | "AAVE" | "COMP" | "CRV" | "DAI" | "DPI" | "FEI" | "LINK" | "SNX" | "SUSHI" | "UNI" | "USDC" | "USDT" | "WBTC" | "WETH" | "YFI" | "STETH" | "FTM" | "CVX" | "FRAX" | "FXS" | "LDO" | "SPELL" | "LUSD" | "sUSD" | "GUSD" | "LUNA" | "LQTY" | "yvDAI" | "yvUSDC" | "yvWETH" | "yvWBTC" | "3Crv" | "steCRV" | "FRAX3CRV" | "LUSD3CRV" | "crvPlain3andSUSD" | "gusd3CRV" | "cvx3Crv" | "cvxsteCRV" | "cvxFRAX3CRV" | "cvxcrvPlain3andSUSD" | "cvxgusd3CRV" | "yvCurve_stETH" | "yvCurve_FRAX";
26
40
  export declare const supportedTokens: Record<SupportedTokens, TokenDataI>;
27
41
  export declare const tokenDataByNetwork: Record<NetworkType, Record<SupportedTokens, string>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "0.0.34",
3
+ "version": "0.0.37",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -52,6 +52,9 @@ export const CONVEX_BOOSTER_KOVAN_ADDRESS =
52
52
  export const CONVEX_3CRV_KOVAN_POOL_ADDRESS =
53
53
  "0x90D9E8ecc406cd7363C08fAdb4ac0f3994b4cA71";
54
54
 
55
+ export const CONVEX_STECRV_POOL_ADDRESS =
56
+ "0x0A760466E1B4621579a82a39CB56Dda2F4E70f03";
57
+
55
58
  export const CONVEX_STECRV_KOVAN_POOL_ADDRESS =
56
59
  "0x0f64e188BFF97e09C71FF85f30509f5596D420dD";
57
60
 
@@ -0,0 +1,6 @@
1
+ import { BytesLike } from "ethers";
2
+
3
+ export interface MultiCall {
4
+ targetContract: string;
5
+ callData: BytesLike;
6
+ }
@@ -0,0 +1,41 @@
1
+ import { BigNumber } from "ethers";
2
+ import { CreditManagerData } from "./creditManager";
3
+ import { MultiCall } from "./multicall";
4
+ import { SupportedTokens } from "./token";
5
+
6
+ export interface Path {
7
+ calls: Array<MultiCall>;
8
+ balances: Record<SupportedTokens, BigNumber>;
9
+ // usedTokens: Array<SupportedTokens>;
10
+ gasUsed: number;
11
+ pool: SupportedTokens;
12
+ creditManager: CreditManagerData;
13
+
14
+ getBestPath(): Promise<Path>;
15
+ // Get balances and keep non-zero only
16
+ // Find token with highest priority
17
+ // Get token type of this token
18
+ // switch (type) {
19
+ // case TokenType.YearnValut:
20
+ // const assetPathClass = new YearnVaultPathAsset(tokenData);
21
+ // return assetPathClass.getBestPath(this);
22
+ // ...
23
+ //}
24
+ }
25
+
26
+ export interface PathAsset {
27
+ getBestPath(p: Path): Promise<Path>;
28
+ }
29
+
30
+ export class ConnectorPathAsset implements PathAsset {
31
+ getBestPath(p: Path): Promise<Path> {
32
+ console.log(p);
33
+ // How to unwrap
34
+ // set balance of current token to 0
35
+ // add balnace what we get
36
+ // add call
37
+ // create new Paths
38
+ // return maxValuable(new Paths.getBestPath())
39
+ throw new Error("Method not implemented.");
40
+ }
41
+ }
@@ -278,6 +278,9 @@ export const priceFeedsByNetwork: Record<SupportedTokens, TokenPriceFeedData> =
278
278
  type: OracleType.CHAINLINK_ORACLE,
279
279
  address: "0x4e844125952d32acdf339be976c98e22f6f318db",
280
280
  kovan: "0x6204148EF888786A2988E7b09c8e0A67e32cb387"
281
+ },
282
+ priceFeedUSD: {
283
+ type: OracleType.ZERO_ORACLE
281
284
  }
282
285
 
283
286
  // ADD ETH-> DAI Oracle!
package/src/core/token.ts CHANGED
@@ -22,9 +22,31 @@ export const priority = {
22
22
  [TokenType.YEARN_VAULT_OF_META_CURVE_LP]: 5
23
23
  };
24
24
 
25
- export interface TokenDataI {
26
- type: TokenType;
27
- }
25
+ export type TokenDataI =
26
+ | {
27
+ type: TokenType.CONNECTOR;
28
+ }
29
+ | {
30
+ type: TokenType.NORMAL_TOKEN;
31
+ }
32
+ | {
33
+ type: TokenType.CURVE_LP;
34
+ }
35
+ | {
36
+ type: TokenType.YEARN_VAULT;
37
+ }
38
+ | {
39
+ type: TokenType.META_CURVE_LP;
40
+ }
41
+ | {
42
+ type: TokenType.YEARN_VAULT_OF_CURVE_LP;
43
+ }
44
+ | {
45
+ type: TokenType.CONVEX_PHANTOM;
46
+ }
47
+ | {
48
+ type: TokenType.YEARN_VAULT_OF_META_CURVE_LP;
49
+ };
28
50
 
29
51
  export type SupportedTokens =
30
52
  | "1INCH"