@gearbox-protocol/sdk 0.0.55 → 0.0.58
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.
- package/lib/core/adapters.d.ts +6 -5
- package/lib/core/adapters.js +6 -5
- package/lib/core/contracts.d.ts +9 -2
- package/lib/core/contracts.js +14 -1
- package/lib/core/pathfinder.d.ts +35 -5
- package/lib/core/pathfinder.js +547 -67
- package/lib/core/token.d.ts +5 -0
- package/lib/core/token.js +8 -1
- package/lib/core/tradeTypes.d.ts +2 -0
- package/lib/pathfinder/connectorPathAsset.d.ts +7 -0
- package/lib/pathfinder/connectorPathAsset.js +144 -0
- package/lib/pathfinder/convexLPTokenPathAsset.d.ts +5 -0
- package/lib/pathfinder/convexLPTokenPathAsset.js +77 -0
- package/lib/pathfinder/curveLPPathAsset.d.ts +5 -0
- package/lib/pathfinder/curveLPPathAsset.js +72 -0
- package/lib/pathfinder/metaCurveLPPathAsset.d.ts +5 -0
- package/lib/pathfinder/metaCurveLPPathAsset.js +72 -0
- package/lib/pathfinder/normalTokenPathAsset.d.ts +5 -0
- package/lib/pathfinder/normalTokenPathAsset.js +136 -0
- package/lib/pathfinder/path.d.ts +41 -0
- package/lib/pathfinder/path.js +302 -0
- package/lib/pathfinder/pathfinder.d.ts +28 -0
- package/lib/pathfinder/pathfinder.js +519 -0
- package/lib/pathfinder/yearnVaultOfCurveLPPathAsset.d.ts +5 -0
- package/lib/pathfinder/yearnVaultOfCurveLPPathAsset.js +87 -0
- package/lib/pathfinder/yearnVaultOfMetaCurveLPPathAsset.d.ts +5 -0
- package/lib/pathfinder/yearnVaultOfMetaCurveLPPathAsset.js +87 -0
- package/lib/pathfinder/yearnVaultPathAsset.d.ts +5 -0
- package/lib/pathfinder/yearnVaultPathAsset.js +87 -0
- package/lib/utils/types.d.ts +3 -0
- package/lib/utils/types.js +2 -0
- package/package.json +1 -1
- package/src/core/adapters.ts +6 -5
- package/src/core/contracts.ts +24 -1
- package/src/core/token.ts +12 -0
- package/src/core/tradeTypes.ts +2 -0
- package/src/pathfinder/connectorPathAsset.ts +69 -0
- package/src/pathfinder/convexLPTokenPathAsset.ts +33 -0
- package/src/pathfinder/curveLPPathAsset.ts +10 -0
- package/src/pathfinder/metaCurveLPPathAsset.ts +12 -0
- package/src/pathfinder/normalTokenPathAsset.ts +68 -0
- package/src/pathfinder/path.ts +259 -0
- package/src/pathfinder/yearnVaultOfCurveLPPathAsset.ts +22 -0
- package/src/pathfinder/yearnVaultOfMetaCurveLPPathAsset.ts +22 -0
- package/src/pathfinder/yearnVaultPathAsset.ts +27 -0
- package/src/utils/types.ts +3 -0
- package/src/core/pathfinder.ts +0 -115
package/lib/core/adapters.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ export declare enum AdapterInterface {
|
|
|
6
6
|
CURVE_V1_3ASSETS = 4,
|
|
7
7
|
CURVE_V1_4ASSETS = 5,
|
|
8
8
|
CURVE_V1_STECRV_POOL = 6,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
CURVE_V1_DEPOSIT = 7,
|
|
10
|
+
YEARN_V2 = 8,
|
|
11
|
+
CONVEX_V1_BASE_REWARD_POOL = 9,
|
|
12
|
+
CONVEX_V1_BOOSTER = 10,
|
|
13
|
+
CONVEX_V1_CLAIM_ZAP = 11,
|
|
14
|
+
LIDO_V1 = 12
|
|
14
15
|
}
|
package/lib/core/adapters.js
CHANGED
|
@@ -10,9 +10,10 @@ var AdapterInterface;
|
|
|
10
10
|
AdapterInterface[AdapterInterface["CURVE_V1_3ASSETS"] = 4] = "CURVE_V1_3ASSETS";
|
|
11
11
|
AdapterInterface[AdapterInterface["CURVE_V1_4ASSETS"] = 5] = "CURVE_V1_4ASSETS";
|
|
12
12
|
AdapterInterface[AdapterInterface["CURVE_V1_STECRV_POOL"] = 6] = "CURVE_V1_STECRV_POOL";
|
|
13
|
-
AdapterInterface[AdapterInterface["
|
|
14
|
-
AdapterInterface[AdapterInterface["
|
|
15
|
-
AdapterInterface[AdapterInterface["
|
|
16
|
-
AdapterInterface[AdapterInterface["
|
|
17
|
-
AdapterInterface[AdapterInterface["
|
|
13
|
+
AdapterInterface[AdapterInterface["CURVE_V1_DEPOSIT"] = 7] = "CURVE_V1_DEPOSIT";
|
|
14
|
+
AdapterInterface[AdapterInterface["YEARN_V2"] = 8] = "YEARN_V2";
|
|
15
|
+
AdapterInterface[AdapterInterface["CONVEX_V1_BASE_REWARD_POOL"] = 9] = "CONVEX_V1_BASE_REWARD_POOL";
|
|
16
|
+
AdapterInterface[AdapterInterface["CONVEX_V1_BOOSTER"] = 10] = "CONVEX_V1_BOOSTER";
|
|
17
|
+
AdapterInterface[AdapterInterface["CONVEX_V1_CLAIM_ZAP"] = 11] = "CONVEX_V1_CLAIM_ZAP";
|
|
18
|
+
AdapterInterface[AdapterInterface["LIDO_V1"] = 12] = "LIDO_V1"; // 12 - 4096
|
|
18
19
|
})(AdapterInterface = exports.AdapterInterface || (exports.AdapterInterface = {}));
|
package/lib/core/contracts.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { NetworkType } from "./constants";
|
|
|
3
3
|
import { Protocols } from "./protocols";
|
|
4
4
|
import { CurveLPToken, NormalToken, ConvexStakedPhantomToken } from "./token";
|
|
5
5
|
export declare type UniswapV2Contract = "UNISWAP_V2_ROUTER" | "SUSHISWAP_ROUTER";
|
|
6
|
-
export declare type CurvePoolContract = "CURVE_3CRV_POOL" | "CURVE_STETH_GATEWAY" | "CURVE_FRAX_POOL" | "CURVE_LUSD_POOL" | "CURVE_GUSD_POOL" | "CURVE_SUSD_POOL";
|
|
6
|
+
export declare type CurvePoolContract = "CURVE_3CRV_POOL" | "CURVE_STETH_GATEWAY" | "CURVE_FRAX_POOL" | "CURVE_LUSD_POOL" | "CURVE_GUSD_POOL" | "CURVE_SUSD_DEPOSIT" | "CURVE_SUSD_POOL";
|
|
7
7
|
export declare type YearnVaultContract = "YEARN_DAI_VAULT" | "YEARN_USDC_VAULT" | "YEARN_WETH_VAULT" | "YEARN_WBTC_VAULT" | "YEARN_CURVE_FRAX_VAULT" | "YEARN_CURVE_STETH_VAULT";
|
|
8
8
|
export declare type ConvexPoolContract = "CONVEX_3CRV_POOL" | "CONVEX_GUSD_POOL" | "CONVEX_SUSD_POOL" | "CONVEX_STECRV_POOL" | "CONVEX_FRAX3CRV_POOL";
|
|
9
9
|
export declare type SupportedContract = UniswapV2Contract | "UNISWAP_V3_ROUTER" | CurvePoolContract | YearnVaultContract | "CONVEX_BOOSTER" | ConvexPoolContract | "CONVEX_CLAIM_ZAP" | "LIDO_STETH_GATEWAY";
|
|
@@ -33,6 +33,13 @@ export declare type CurveSteCRVPoolParams = {
|
|
|
33
33
|
pool: Record<NetworkType, string>;
|
|
34
34
|
lpToken: "steCRV";
|
|
35
35
|
} & BaseContractParams;
|
|
36
|
+
export declare type CurveDepositParams = {
|
|
37
|
+
protocol: Protocols.Curve;
|
|
38
|
+
type: AdapterInterface.CURVE_V1_DEPOSIT;
|
|
39
|
+
pool: Record<NetworkType, string>;
|
|
40
|
+
lpToken: CurveLPToken;
|
|
41
|
+
nCoins: number;
|
|
42
|
+
} & BaseContractParams;
|
|
36
43
|
declare type YearnParams = {
|
|
37
44
|
protocol: Protocols.Yearn;
|
|
38
45
|
type: AdapterInterface.YEARN_V2;
|
|
@@ -52,7 +59,7 @@ export declare type LidoParams = {
|
|
|
52
59
|
contract: Record<NetworkType, string>;
|
|
53
60
|
lpToken: "steCRV";
|
|
54
61
|
} & BaseContractParams;
|
|
55
|
-
export declare type ContractParams = UniswapV2Params | UniswapV3Params | CurveParams | CurveSteCRVPoolParams | YearnParams | ConvexParams | ConvexPoolParams | LidoParams;
|
|
62
|
+
export declare type ContractParams = UniswapV2Params | UniswapV3Params | CurveParams | CurveSteCRVPoolParams | CurveDepositParams | YearnParams | ConvexParams | ConvexPoolParams | LidoParams;
|
|
56
63
|
export declare const contractParams: Record<SupportedContract, ContractParams>;
|
|
57
64
|
export declare const contractsByAddress: Record<string, SupportedContract>;
|
|
58
65
|
export {};
|
package/lib/core/contracts.js
CHANGED
|
@@ -32,6 +32,7 @@ exports.contractsByNetwork = {
|
|
|
32
32
|
CURVE_FRAX_POOL: token_1.tokenDataByNetwork.Mainnet.FRAX3CRV,
|
|
33
33
|
CURVE_LUSD_POOL: token_1.tokenDataByNetwork.Mainnet.LUSD3CRV,
|
|
34
34
|
CURVE_SUSD_POOL: "0xA5407eAE9Ba41422680e2e00537571bcC53efBfD",
|
|
35
|
+
CURVE_SUSD_DEPOSIT: "0xFCBa3E75865d2d561BE8D220616520c171F12851",
|
|
35
36
|
CURVE_GUSD_POOL: "0x4f062658EaAF2C1ccf8C8e36D6824CDf41167956",
|
|
36
37
|
// YEARN
|
|
37
38
|
YEARN_DAI_VAULT: token_1.tokenDataByNetwork.Mainnet.yvDAI,
|
|
@@ -61,6 +62,7 @@ exports.contractsByNetwork = {
|
|
|
61
62
|
CURVE_FRAX_POOL: "",
|
|
62
63
|
CURVE_LUSD_POOL: token_1.tokenDataByNetwork.Kovan.LUSD3CRV,
|
|
63
64
|
CURVE_SUSD_POOL: "0x032f1cE00865F3499C0052ceBA5F2348842416DB",
|
|
65
|
+
CURVE_SUSD_DEPOSIT: "",
|
|
64
66
|
CURVE_GUSD_POOL: "",
|
|
65
67
|
// YEARN
|
|
66
68
|
YEARN_DAI_VAULT: token_1.tokenDataByNetwork.Kovan.yvDAI,
|
|
@@ -137,12 +139,23 @@ exports.contractParams = {
|
|
|
137
139
|
lpToken: "crvPlain3andSUSD",
|
|
138
140
|
tokens: ["DAI", "USDC", "USDT", "sUSD"]
|
|
139
141
|
},
|
|
142
|
+
CURVE_SUSD_DEPOSIT: {
|
|
143
|
+
name: "Curve SUSD Deposit",
|
|
144
|
+
protocol: protocols_1.Protocols.Curve,
|
|
145
|
+
type: adapters_1.AdapterInterface.CURVE_V1_DEPOSIT,
|
|
146
|
+
lpToken: "crvPlain3andSUSD",
|
|
147
|
+
pool: {
|
|
148
|
+
Mainnet: "0x22eE18aca7F3Ee920D01F25dA85840D12d98E8Ca",
|
|
149
|
+
Kovan: ""
|
|
150
|
+
},
|
|
151
|
+
nCoins: 4
|
|
152
|
+
},
|
|
140
153
|
CURVE_GUSD_POOL: {
|
|
141
154
|
name: "Curve GUSD",
|
|
142
155
|
protocol: protocols_1.Protocols.Curve,
|
|
143
156
|
type: adapters_1.AdapterInterface.CURVE_V1_2ASSETS,
|
|
144
157
|
lpToken: "gusd3CRV",
|
|
145
|
-
tokens: ["3Crv", "
|
|
158
|
+
tokens: ["3Crv", "GUSD"]
|
|
146
159
|
},
|
|
147
160
|
YEARN_DAI_VAULT: {
|
|
148
161
|
name: "Yearn DAI",
|
package/lib/core/pathfinder.d.ts
CHANGED
|
@@ -1,24 +1,54 @@
|
|
|
1
|
-
import { BigNumber } from "ethers";
|
|
1
|
+
import { BigNumber, ethers } from "ethers";
|
|
2
2
|
import { CreditManagerData } from "./creditManager";
|
|
3
3
|
import { MultiCall } from "./multicall";
|
|
4
4
|
import { SupportedToken } from "./token";
|
|
5
|
+
import { NetworkType } from "./constants";
|
|
6
|
+
import { CreditAccountData } from "./creditAccount";
|
|
5
7
|
export declare class Path {
|
|
6
8
|
readonly calls: Array<MultiCall>;
|
|
7
9
|
readonly balances: Record<SupportedToken, BigNumber>;
|
|
8
|
-
protected _gasUsed: number;
|
|
9
10
|
readonly pool: SupportedToken;
|
|
10
11
|
readonly creditManager: CreditManagerData;
|
|
12
|
+
readonly creditAccount: CreditAccountData;
|
|
13
|
+
readonly networkType: NetworkType;
|
|
14
|
+
readonly provider: ethers.providers.Provider;
|
|
15
|
+
readonly totalGasLimit: BigNumber;
|
|
11
16
|
constructor(opts: {
|
|
12
|
-
gasUsed: number;
|
|
13
17
|
balances: Record<SupportedToken, BigNumber>;
|
|
14
18
|
pool: SupportedToken;
|
|
15
19
|
creditManager: CreditManagerData;
|
|
20
|
+
creditAccount: CreditAccountData;
|
|
21
|
+
networkType: NetworkType;
|
|
22
|
+
provider: ethers.providers.Provider;
|
|
23
|
+
totalGasLimit: BigNumber;
|
|
16
24
|
});
|
|
17
25
|
getBestPath(): Promise<Path>;
|
|
18
26
|
}
|
|
19
27
|
export interface PathAsset {
|
|
20
|
-
getBestPath(p: Path): Promise<Path>;
|
|
28
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
21
29
|
}
|
|
22
30
|
export declare class ConnectorPathAsset implements PathAsset {
|
|
23
|
-
getBestPath(p: Path): Promise<Path>;
|
|
31
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
32
|
+
getMaxPoolAmount(currentToken: SupportedToken, currentBalance: BigNumber, p: Path): Promise<[BigNumber, BigNumber]>;
|
|
33
|
+
}
|
|
34
|
+
export declare class YearnVaultPathAsset implements PathAsset {
|
|
35
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
36
|
+
}
|
|
37
|
+
export declare class ConvexLPTokenPathAsset implements PathAsset {
|
|
38
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
39
|
+
}
|
|
40
|
+
export declare class CurveLPPathAsset implements PathAsset {
|
|
41
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
42
|
+
}
|
|
43
|
+
export declare class MetaCurveLPPathAsset implements PathAsset {
|
|
44
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
45
|
+
}
|
|
46
|
+
export declare class NormalTokenPathAsset implements PathAsset {
|
|
47
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
48
|
+
}
|
|
49
|
+
export declare class YearnVaultOfCurveLPPathAsset implements PathAsset {
|
|
50
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
51
|
+
}
|
|
52
|
+
export declare class YearnVaultOfMetaCurveLPPathAsset implements PathAsset {
|
|
53
|
+
getBestPath(currentToken: SupportedToken, p: Path): Promise<Path>;
|
|
24
54
|
}
|