@gearbox-protocol/sdk 3.0.0-next.55 → 3.0.0-next.57
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/contracts/index.sol +5 -0
- package/lib/core/creditAccount.d.ts +1 -2
- package/lib/core/creditAccount.js +0 -7
- package/lib/core/creditManager.d.ts +1 -0
- package/lib/core/creditManager.js +7 -1
- package/lib/core/trade.d.ts +9 -8
- package/lib/core/trade.js +25 -22
- package/lib/core/transactions.d.ts +16 -1
- package/lib/core/transactions.js +27 -1
- package/lib/parsers/convexBaseRewardPoolAdapterParser.js +10 -8
- package/lib/parsers/convexBaseRewardPoolAdapterParser.spec.js +9 -6
- package/lib/parsers/convexBoosterAdapterParser.js +6 -6
- package/lib/parsers/convexBoosterAdapterParser.spec.js +4 -4
- package/lib/parsers/curveAdapterParser.js +10 -10
- package/lib/parsers/curveAdapterParser.spec.js +6 -2
- package/lib/parsers/lidoAdapterParser.js +3 -2
- package/lib/parsers/lidoAdapterParser.spec.js +2 -2
- package/lib/parsers/uniV2AdapterParser.js +4 -3
- package/lib/parsers/uniV2AdapterParser.spec.js +3 -2
- package/lib/parsers/uniV3AdapterParser.js +8 -6
- package/lib/parsers/uniV3AdapterParser.spec.js +3 -2
- package/lib/parsers/wstETHAdapterParser.js +6 -4
- package/lib/parsers/wstETHAdapterParser.spec.js +4 -4
- package/lib/parsers/yearnAdapterParser.spec.js +4 -4
- package/lib/parsers/yearnV2AdapterParser.js +13 -3
- package/lib/pathfinder/core.d.ts +8 -9
- package/lib/pathfinder/pathfinder.d.ts +37 -10
- package/lib/pathfinder/pathfinder.js +45 -33
- package/lib/pathfinder/pathfinder.spec.js +4 -2
- package/lib/payload/creditAccount.d.ts +1 -2
- package/lib/types/IAaveV2_LendingPoolAdapter.d.ts +171 -0
- package/lib/types/IAaveV2_WrappedATokenAdapter.d.ts +290 -0
- package/lib/types/IBalancerV2Vault.sol/IBalancerV2Vault.d.ts +308 -0
- package/lib/types/IBalancerV2Vault.sol/IBalancerV2VaultGetters.d.ts +112 -0
- package/lib/types/IBalancerV2Vault.sol/index.d.ts +2 -0
- package/lib/types/IBalancerV2Vault.sol/index.js +2 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter.d.ts +466 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter.js +2 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents.d.ts +43 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents.js +2 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions.d.ts +27 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions.js +2 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/index.d.ts +3 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/index.js +2 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter.d.ts +216 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter.js +2 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions.d.ts +27 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions.js +2 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/index.d.ts +2 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/index.js +2 -0
- package/lib/types/IConvexV1BaseRewardPoolAdapter.d.ts +30 -30
- package/lib/types/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter.d.ts +21 -17
- package/lib/types/ICreditFacadeV3.sol/ICreditFacadeV3.d.ts +45 -85
- package/lib/types/ICreditFacadeV3.sol/ICreditFacadeV3Events.d.ts +24 -26
- package/lib/types/ICreditFacadeV3Multicall.d.ts +32 -40
- package/lib/types/ICreditManagerV3.sol/ICreditManagerV3.d.ts +99 -71
- package/lib/types/ICurveV1Adapter.d.ts +41 -105
- package/lib/types/ICurveV1_2AssetsAdapter.d.ts +41 -105
- package/lib/types/ICurveV1_3AssetsAdapter.d.ts +41 -105
- package/lib/types/ICurveV1_4AssetsAdapter.d.ts +41 -105
- package/lib/types/IDataCompressorV2_10.d.ts +1 -27
- package/lib/types/IDataCompressorV3_00.d.ts +1 -27
- package/lib/types/IERC4626Adapter.d.ts +238 -0
- package/lib/types/IERC4626Adapter.js +2 -0
- package/lib/types/ILidoV1Adapter.d.ts +9 -9
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3.d.ts +39 -14
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3Events.d.ts +5 -3
- package/lib/types/IUniswapV2Adapter.sol/IUniswapV2Adapter.d.ts +10 -9
- package/lib/types/IUniswapV3Adapter.sol/IUniswapV3Adapter.d.ts +27 -21
- package/lib/types/IYearnV2Adapter.d.ts +22 -22
- package/lib/types/IwstETHV1Adapter.d.ts +17 -17
- package/lib/types/factories/IAaveV2_LendingPoolAdapter__factory.d.ts +158 -0
- package/lib/types/factories/IAaveV2_LendingPoolAdapter__factory.js +215 -0
- package/lib/types/factories/IAaveV2_WrappedATokenAdapter__factory.d.ts +252 -0
- package/lib/types/factories/IAaveV2_WrappedATokenAdapter__factory.js +341 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2VaultGetters__factory.d.ts +78 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2VaultGetters__factory.js +111 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2Vault__factory.d.ts +360 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2Vault__factory.js +475 -0
- package/lib/types/factories/IBalancerV2Vault.sol/index.d.ts +2 -0
- package/lib/types/factories/IBalancerV2Vault.sol/index.js +10 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents__factory.d.ts +23 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents__factory.js +38 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions__factory.d.ts +12 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions__factory.js +24 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter__factory.d.ts +514 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter__factory.js +675 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/index.d.ts +3 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/index.js +12 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter__factory.d.ts +196 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter__factory.js +267 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions__factory.d.ts +16 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions__factory.js +30 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/index.d.ts +2 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/index.js +10 -0
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.d.ts +18 -6
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.js +22 -6
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter__factory.d.ts +10 -2
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter__factory.js +12 -2
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3Events__factory.d.ts +13 -18
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3Events__factory.js +14 -20
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3__factory.d.ts +13 -70
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3__factory.js +14 -86
- package/lib/types/factories/ICreditFacadeV3Multicall__factory.d.ts +22 -24
- package/lib/types/factories/ICreditFacadeV3Multicall__factory.js +28 -31
- package/lib/types/factories/ICreditManagerV3.sol/ICreditManagerV3__factory.d.ts +153 -135
- package/lib/types/factories/ICreditManagerV3.sol/ICreditManagerV3__factory.js +191 -168
- package/lib/types/factories/ICurveV1Adapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1Adapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_2AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_2AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_3AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_3AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_4AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_4AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/IDataCompressorV2_10__factory.d.ts +0 -42
- package/lib/types/factories/IDataCompressorV2_10__factory.js +0 -54
- package/lib/types/factories/IDataCompressorV3_00__factory.d.ts +0 -84
- package/lib/types/factories/IDataCompressorV3_00__factory.js +0 -108
- package/lib/types/factories/IERC4626Adapter__factory.d.ts +220 -0
- package/lib/types/factories/IERC4626Adapter__factory.js +297 -0
- package/lib/types/factories/ILidoV1Adapter__factory.d.ts +6 -2
- package/lib/types/factories/ILidoV1Adapter__factory.js +8 -2
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3Events__factory.d.ts +5 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3Events__factory.js +6 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3__factory.d.ts +45 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3__factory.js +59 -0
- package/lib/types/factories/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.d.ts +5 -1
- package/lib/types/factories/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.js +6 -1
- package/lib/types/factories/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.d.ts +12 -4
- package/lib/types/factories/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.js +14 -4
- package/lib/types/factories/IYearnV2Adapter__factory.d.ts +21 -13
- package/lib/types/factories/IYearnV2Adapter__factory.js +27 -15
- package/lib/types/factories/IwstETHV1Adapter__factory.d.ts +12 -4
- package/lib/types/factories/IwstETHV1Adapter__factory.js +16 -4
- package/lib/types/factories/index.d.ts +7 -2
- package/lib/types/factories/index.js +12 -5
- package/lib/types/factories/{IRouter__factory.d.ts → interfaces/IRouter__factory.d.ts} +61 -6
- package/lib/types/factories/{IRouter__factory.js → interfaces/IRouter__factory.js} +77 -6
- package/lib/types/factories/interfaces/index.d.ts +1 -0
- package/lib/types/factories/interfaces/index.js +8 -0
- package/lib/types/index.d.ts +39 -17
- package/lib/types/index.js +39 -23
- package/lib/types/{IRouter.d.ts → interfaces/IRouter.d.ts} +37 -34
- package/lib/types/interfaces/IRouter.js +2 -0
- package/lib/types/interfaces/index.d.ts +1 -0
- package/lib/types/interfaces/index.js +2 -0
- package/package.json +6 -6
- package/lib/types/IWithdrawalManagerV3.sol/IWithdrawalManagerV3.d.ts +0 -370
- package/lib/types/IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events.d.ts +0 -133
- package/lib/types/IWithdrawalManagerV3.sol/index.d.ts +0 -2
- package/lib/types/factories/IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events__factory.d.ts +0 -143
- package/lib/types/factories/IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events__factory.js +0 -188
- package/lib/types/factories/IWithdrawalManagerV3.sol/IWithdrawalManagerV3__factory.d.ts +0 -366
- package/lib/types/factories/IWithdrawalManagerV3.sol/IWithdrawalManagerV3__factory.js +0 -479
- package/lib/types/factories/IWithdrawalManagerV3.sol/index.d.ts +0 -2
- package/lib/types/factories/IWithdrawalManagerV3.sol/index.js +0 -10
- /package/lib/types/{IRouter.js → IAaveV2_LendingPoolAdapter.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3.js → IAaveV2_WrappedATokenAdapter.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events.js → IBalancerV2Vault.sol/IBalancerV2Vault.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol/index.js → IBalancerV2Vault.sol/IBalancerV2VaultGetters.js} +0 -0
|
@@ -8,8 +8,8 @@ describe("YearnV2AdapterParser test", () => {
|
|
|
8
8
|
it("deposit / withdraw functions works well", () => {
|
|
9
9
|
let parser = new yearnV2AdapterParser_1.YearnV2AdapterParser("YEARN_CURVE_STETH_VAULT", false);
|
|
10
10
|
const ifc = types_1.IYearnV2Adapter__factory.createInterface();
|
|
11
|
-
let parsed = parser.parse(ifc.encodeFunctionData("
|
|
12
|
-
(0, chai_1.expect)(parsed).to.be.eq("YearnV2Adapter[YEARN_CURVE_STETH_VAULT].
|
|
11
|
+
let parsed = parser.parse(ifc.encodeFunctionData("depositDiff", [sdk_gov_1.WAD * 19000n]));
|
|
12
|
+
(0, chai_1.expect)(parsed).to.be.eq("YearnV2Adapter[YEARN_CURVE_STETH_VAULT].depositDiff(leftoverAmount: 19.00K [19000000000000000000000])", "Incorrect parse depositDiff");
|
|
13
13
|
parsed = parser.parse(ifc.encodeFunctionData("deposit(uint256)", [sdk_gov_1.WAD * 19000n]));
|
|
14
14
|
(0, chai_1.expect)(parsed).to.be.eq("YearnV2Adapter[YEARN_CURVE_STETH_VAULT].deposit(amount: 19.00K [19000000000000000000000])", "Incorrect parse deposit(amount)");
|
|
15
15
|
parsed = parser.parse(ifc.encodeFunctionData("deposit(uint256,address)", [
|
|
@@ -17,8 +17,8 @@ describe("YearnV2AdapterParser test", () => {
|
|
|
17
17
|
sdk_gov_1.DUMB_ADDRESS,
|
|
18
18
|
]));
|
|
19
19
|
(0, chai_1.expect)(parsed).to.be.eq(`YearnV2Adapter[YEARN_CURVE_STETH_VAULT].deposit(amount: 19.00K [19000000000000000000000], address: ${sdk_gov_1.DUMB_ADDRESS})`, "Incorrect parse deposit(amount,address)");
|
|
20
|
-
parsed = parser.parse(ifc.encodeFunctionData("
|
|
21
|
-
(0, chai_1.expect)(parsed).to.be.eq("YearnV2Adapter[YEARN_CURVE_STETH_VAULT].
|
|
20
|
+
parsed = parser.parse(ifc.encodeFunctionData("withdrawDiff", [sdk_gov_1.WAD * 19000n]));
|
|
21
|
+
(0, chai_1.expect)(parsed).to.be.eq("YearnV2Adapter[YEARN_CURVE_STETH_VAULT].withdrawDiff(leftoverAmount: 19.00K [19000000000000000000000])", "Incorrect parse withdrawDiff");
|
|
22
22
|
parsed = parser.parse(ifc.encodeFunctionData("withdraw(uint256)", [sdk_gov_1.WAD * 19000n]));
|
|
23
23
|
(0, chai_1.expect)(parsed).to.be.eq("YearnV2Adapter[YEARN_CURVE_STETH_VAULT].withdraw(amount: 19.00K [19000000000000000000000])", "Incorrect parse withdraw(amount)");
|
|
24
24
|
parsed = parser.parse(ifc.encodeFunctionData("withdraw(uint256,address)", [
|
|
@@ -7,7 +7,7 @@ const abstractParser_1 = require("./abstractParser");
|
|
|
7
7
|
class YearnV2AdapterParser extends abstractParser_1.AbstractParser {
|
|
8
8
|
constructor(contract, isContract) {
|
|
9
9
|
super(contract);
|
|
10
|
-
this.ifc = types_1.
|
|
10
|
+
this.ifc = types_1.IYearnV2Adapter__factory.createInterface();
|
|
11
11
|
if (!isContract)
|
|
12
12
|
this.adapterName = "YearnV2Adapter";
|
|
13
13
|
}
|
|
@@ -16,8 +16,6 @@ class YearnV2AdapterParser extends abstractParser_1.AbstractParser {
|
|
|
16
16
|
switch (functionFragment.name) {
|
|
17
17
|
case "deposit":
|
|
18
18
|
case "withdraw":
|
|
19
|
-
case "deposit(uint256)":
|
|
20
|
-
case "withdraw(uint256)":
|
|
21
19
|
case "withdraw(uint256,address,uint256)": {
|
|
22
20
|
const [amount, address, maxLoss] = this.decodeFunctionData(functionFragment, calldata);
|
|
23
21
|
const yvSym = this.tokenSymbol(sdk_gov_1.contractsByNetwork.Mainnet[this.contract]);
|
|
@@ -28,6 +26,18 @@ class YearnV2AdapterParser extends abstractParser_1.AbstractParser {
|
|
|
28
26
|
const maxLossStr = maxLoss ? `, maxLoss: ${maxLoss}` : "";
|
|
29
27
|
return `${functionName}(${amountStr}${addressStr}${maxLossStr})`;
|
|
30
28
|
}
|
|
29
|
+
case "depositDiff": {
|
|
30
|
+
const [leftoverAmount] = this.decodeFunctionData(functionFragment, calldata);
|
|
31
|
+
const yvSym = this.tokenSymbol(sdk_gov_1.contractsByNetwork.Mainnet[this.contract]);
|
|
32
|
+
const leftoverAmountStr = this.formatBN(leftoverAmount, yvSym);
|
|
33
|
+
return `${functionName}(leftoverAmount: ${leftoverAmountStr})`;
|
|
34
|
+
}
|
|
35
|
+
case "withdrawDiff": {
|
|
36
|
+
const [leftoverAmount] = this.decodeFunctionData(functionFragment, calldata);
|
|
37
|
+
const yvSym = this.tokenSymbol(sdk_gov_1.contractsByNetwork.Mainnet[this.contract]);
|
|
38
|
+
const leftoverAmountStr = this.formatBN(leftoverAmount, yvSym);
|
|
39
|
+
return `${functionName}(leftoverAmount: ${leftoverAmountStr})`;
|
|
40
|
+
}
|
|
31
41
|
case "pricePerShare": {
|
|
32
42
|
return `${functionName}()`;
|
|
33
43
|
}
|
package/lib/pathfinder/core.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { ExcludeArrayProps } from "@gearbox-protocol/sdk-gov";
|
|
2
|
-
import { MultiCallStructOutput,
|
|
2
|
+
import { MultiCallStructOutput, RouterResultStructOutput, SwapTaskStruct } from "../types/interfaces/IRouter";
|
|
3
|
+
import { BigintifyProps } from "../utils/types";
|
|
3
4
|
export declare enum SwapOperation {
|
|
4
5
|
EXACT_INPUT = 0,
|
|
5
6
|
EXACT_INPUT_ALL = 1,
|
|
6
7
|
EXACT_OUTPUT = 2
|
|
7
8
|
}
|
|
8
9
|
export type MultiCall = ExcludeArrayProps<MultiCallStructOutput>;
|
|
9
|
-
export type SwapTask = ExcludeArrayProps<
|
|
10
|
-
export
|
|
11
|
-
amount: bigint;
|
|
10
|
+
export type SwapTask = ExcludeArrayProps<SwapTaskStruct>;
|
|
11
|
+
export type PathFinderResult = Omit<BigintifyProps<ExcludeArrayProps<RouterResultStructOutput>>, "calls"> & {
|
|
12
12
|
calls: Array<MultiCall>;
|
|
13
|
-
}
|
|
14
|
-
export interface PathFinderOpenStrategyResult {
|
|
13
|
+
};
|
|
14
|
+
export interface PathFinderOpenStrategyResult extends PathFinderResult {
|
|
15
15
|
balances: Record<string, bigint>;
|
|
16
|
-
|
|
16
|
+
minBalances: Record<string, bigint>;
|
|
17
17
|
}
|
|
18
|
-
export interface PathFinderCloseResult {
|
|
18
|
+
export interface PathFinderCloseResult extends PathFinderResult {
|
|
19
19
|
underlyingBalance: bigint;
|
|
20
|
-
calls: Array<MultiCall>;
|
|
21
20
|
}
|
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
import { NetworkType, SupportedToken } from "@gearbox-protocol/sdk-gov";
|
|
2
|
-
import {
|
|
2
|
+
import { providers, Signer } from "ethers";
|
|
3
3
|
import { CreditAccountData } from "../core/creditAccount";
|
|
4
4
|
import { CreditManagerData } from "../core/creditManager";
|
|
5
5
|
import { IRouter } from "../types";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { PathFinderCloseResult, PathFinderOpenStrategyResult, PathFinderResult, SwapOperation } from "./core";
|
|
7
|
+
interface FindAllSwapsProps {
|
|
8
|
+
creditAccount: CreditAccountData;
|
|
9
|
+
swapOperation: SwapOperation;
|
|
10
|
+
tokenIn: string;
|
|
11
|
+
tokenOut: string;
|
|
8
12
|
amount: bigint;
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
leftoverAmount: bigint;
|
|
14
|
+
slippage: number;
|
|
15
|
+
}
|
|
16
|
+
interface FindOneTokenPathProps {
|
|
17
|
+
creditAccount: CreditAccountData;
|
|
18
|
+
tokenIn: string;
|
|
19
|
+
tokenOut: string;
|
|
20
|
+
amount: bigint;
|
|
21
|
+
slippage: number;
|
|
22
|
+
}
|
|
23
|
+
interface FindBestClosePathProps {
|
|
24
|
+
creditAccount: CreditAccountData;
|
|
25
|
+
creditManager: CreditManagerData;
|
|
26
|
+
expectedBalances: Record<string, bigint>;
|
|
27
|
+
leftoverBalances: Record<string, bigint>;
|
|
28
|
+
slippage: number;
|
|
29
|
+
noConcurrency?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface FindOpenStrategyPathProps {
|
|
32
|
+
creditManager: CreditManagerData;
|
|
33
|
+
expectedBalances: Record<string, bigint>;
|
|
34
|
+
leftoverBalances: Record<string, bigint>;
|
|
35
|
+
target: string;
|
|
36
|
+
slippage: number;
|
|
11
37
|
}
|
|
12
38
|
export declare class PathFinder {
|
|
13
39
|
pathFinder: IRouter;
|
|
@@ -15,8 +41,8 @@ export declare class PathFinder {
|
|
|
15
41
|
static connectors: Array<SupportedToken>;
|
|
16
42
|
protected readonly _connectors: Array<string>;
|
|
17
43
|
constructor(address: string, provider: Signer | providers.Provider, network?: NetworkType, connectors?: SupportedToken[]);
|
|
18
|
-
findAllSwaps(creditAccount
|
|
19
|
-
findOneTokenPath(creditAccount
|
|
44
|
+
findAllSwaps({ creditAccount, swapOperation, tokenIn, tokenOut, amount, leftoverAmount, slippage, }: FindAllSwapsProps): Promise<Array<PathFinderResult>>;
|
|
45
|
+
findOneTokenPath({ creditAccount, tokenIn, tokenOut, amount, slippage, }: FindOneTokenPathProps): Promise<PathFinderResult>;
|
|
20
46
|
/**
|
|
21
47
|
* @dev Finds the best path for opening credit account and converting all NORMAL tokens and LP token in the way to TARGET
|
|
22
48
|
* @param cm CreditManagerData which represents credit manager you want to use to open credit account
|
|
@@ -28,7 +54,7 @@ export declare class PathFinder {
|
|
|
28
54
|
* @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
29
55
|
* @returns PathFinderOpenStrategyResult which
|
|
30
56
|
*/
|
|
31
|
-
findOpenStrategyPath(
|
|
57
|
+
findOpenStrategyPath({ creditManager: cm, expectedBalances, leftoverBalances, target, slippage, }: FindOpenStrategyPathProps): Promise<PathFinderOpenStrategyResult>;
|
|
32
58
|
/**
|
|
33
59
|
* @dev Finds the path to swap / withdraw all assets from CreditAccount into underlying asset
|
|
34
60
|
* Can bu used for closing credit account and for liquidations as well.
|
|
@@ -38,8 +64,9 @@ export declare class PathFinder {
|
|
|
38
64
|
* - underlyingBalance - total balance of underlying token
|
|
39
65
|
* - calls - list of calls which should be done to swap & unwrap everything to underlying token
|
|
40
66
|
*/
|
|
41
|
-
findBestClosePath(creditAccount:
|
|
42
|
-
static compare(r1:
|
|
67
|
+
findBestClosePath({ creditAccount, creditManager: cm, expectedBalances, leftoverBalances, slippage, noConcurrency, }: FindBestClosePathProps): Promise<PathFinderCloseResult>;
|
|
68
|
+
static compare(r1: PathFinderResult, r2: PathFinderResult, gasPriceRAY: bigint): PathFinderResult;
|
|
43
69
|
getAvailableConnectors(availableList: Record<string, bigint> | Record<string, true>): string[];
|
|
44
70
|
static getAvailableConnectors(availableList: Record<string, bigint> | Record<string, true>, connectors: string[]): string[];
|
|
45
71
|
}
|
|
72
|
+
export {};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PathFinder = void 0;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
|
-
const ethers_1 = require("ethers");
|
|
6
5
|
const types_1 = require("../types");
|
|
7
6
|
const pathOptions_1 = require("./pathOptions");
|
|
8
7
|
const MAX_GAS_PER_ROUTE = 200e6;
|
|
@@ -24,42 +23,43 @@ class PathFinder {
|
|
|
24
23
|
.map(c => sdk_gov_1.tokenDataByNetwork[this.network][c]?.toLowerCase())
|
|
25
24
|
.filter(t => !!t);
|
|
26
25
|
}
|
|
27
|
-
async findAllSwaps(creditAccount, swapOperation, tokenIn, tokenOut, amount, slippage) {
|
|
26
|
+
async findAllSwaps({ creditAccount, swapOperation, tokenIn, tokenOut, amount, leftoverAmount, slippage, }) {
|
|
28
27
|
const connectors = this.getAvailableConnectors(creditAccount.balances);
|
|
29
28
|
const swapTask = {
|
|
30
29
|
swapOperation: swapOperation,
|
|
31
30
|
creditAccount: creditAccount.addr,
|
|
32
|
-
tokenIn
|
|
33
|
-
tokenOut
|
|
34
|
-
tokenOut,
|
|
31
|
+
tokenIn,
|
|
32
|
+
tokenOut,
|
|
35
33
|
connectors,
|
|
36
|
-
amount
|
|
37
|
-
|
|
38
|
-
externalSlippage: false,
|
|
34
|
+
amount,
|
|
35
|
+
leftoverAmount,
|
|
39
36
|
};
|
|
40
|
-
const results = await this.pathFinder.callStatic.findAllSwaps(swapTask, {
|
|
37
|
+
const results = await this.pathFinder.callStatic.findAllSwaps(swapTask, slippage, {
|
|
41
38
|
gasLimit: GAS_PER_BLOCK,
|
|
42
39
|
});
|
|
43
40
|
const unique = {};
|
|
44
41
|
results.forEach(r => {
|
|
45
|
-
const key = `${r.
|
|
42
|
+
const key = `${r.minAmount.toHexString()}${r.calls
|
|
46
43
|
.map(c => `${c.target.toLowerCase()}${c.callData}`)
|
|
47
44
|
.join("-")}`;
|
|
48
45
|
unique[key] = {
|
|
49
46
|
amount: (0, sdk_gov_1.toBigInt)(r.amount),
|
|
47
|
+
minAmount: (0, sdk_gov_1.toBigInt)(r.minAmount),
|
|
48
|
+
gasUsage: (0, sdk_gov_1.toBigInt)(r.gasUsage),
|
|
50
49
|
calls: r.calls,
|
|
51
50
|
};
|
|
52
51
|
});
|
|
53
52
|
return Object.values(unique);
|
|
54
53
|
}
|
|
55
|
-
async findOneTokenPath(creditAccount, tokenIn, tokenOut, amount, slippage) {
|
|
56
|
-
const tokenInAddr = sdk_gov_1.tokenDataByNetwork[this.network][tokenIn] || tokenIn;
|
|
54
|
+
async findOneTokenPath({ creditAccount, tokenIn, tokenOut, amount, slippage, }) {
|
|
57
55
|
const connectors = this.getAvailableConnectors(creditAccount.balances);
|
|
58
|
-
const result = await this.pathFinder.callStatic.findOneTokenPath(
|
|
56
|
+
const result = await this.pathFinder.callStatic.findOneTokenPath(tokenIn, amount, tokenOut, creditAccount.addr, connectors, slippage, {
|
|
59
57
|
gasLimit: GAS_PER_BLOCK,
|
|
60
58
|
});
|
|
61
59
|
return {
|
|
62
60
|
amount: (0, sdk_gov_1.toBigInt)(result.amount),
|
|
61
|
+
minAmount: (0, sdk_gov_1.toBigInt)(result.minAmount),
|
|
62
|
+
gasUsage: (0, sdk_gov_1.toBigInt)(result.gasUsage),
|
|
63
63
|
calls: result.calls,
|
|
64
64
|
};
|
|
65
65
|
}
|
|
@@ -74,28 +74,30 @@ class PathFinder {
|
|
|
74
74
|
* @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
75
75
|
* @returns PathFinderOpenStrategyResult which
|
|
76
76
|
*/
|
|
77
|
-
async findOpenStrategyPath(cm, expectedBalances, target, slippage) {
|
|
78
|
-
const
|
|
79
|
-
const expectedBalancesAddr = Object.entries(expectedBalances).reduce((acc, [token, balance]) => {
|
|
80
|
-
const tokenAddr = sdk_gov_1.tokenDataByNetwork[this.network][token] || token;
|
|
81
|
-
acc[tokenAddr.toLowerCase()] = balance;
|
|
82
|
-
return acc;
|
|
83
|
-
}, {});
|
|
84
|
-
const balances = cm.collateralTokens.map(token => ({
|
|
77
|
+
async findOpenStrategyPath({ creditManager: cm, expectedBalances, leftoverBalances, target, slippage, }) {
|
|
78
|
+
const expected = cm.collateralTokens.map(token => ({
|
|
85
79
|
token,
|
|
86
|
-
balance:
|
|
80
|
+
balance: expectedBalances[token] || 0,
|
|
81
|
+
}));
|
|
82
|
+
const leftover = cm.collateralTokens.map(token => ({
|
|
83
|
+
token,
|
|
84
|
+
balance: leftoverBalances[token] || 1,
|
|
87
85
|
}));
|
|
88
86
|
const connectors = this.getAvailableConnectors(cm.supportedTokens);
|
|
89
|
-
const result = await this.pathFinder.callStatic.findOpenStrategyPath(cm.address,
|
|
87
|
+
const [outBalances, result] = await this.pathFinder.callStatic.findOpenStrategyPath(cm.address, expected, leftover, target, connectors, slippage, {
|
|
90
88
|
gasLimit: GAS_PER_BLOCK,
|
|
91
89
|
});
|
|
92
|
-
const balancesAfter =
|
|
90
|
+
const balancesAfter = outBalances.reduce((acc, b) => {
|
|
93
91
|
acc[b.token.toLowerCase()] = (0, sdk_gov_1.toBigInt)(b.balance);
|
|
94
92
|
return acc;
|
|
95
93
|
}, {});
|
|
96
94
|
return {
|
|
97
|
-
balances: balancesAfter,
|
|
98
|
-
|
|
95
|
+
balances: { ...balancesAfter, [target]: (0, sdk_gov_1.toBigInt)(result.amount) },
|
|
96
|
+
minBalances: { ...balancesAfter, [target]: (0, sdk_gov_1.toBigInt)(result.minAmount) },
|
|
97
|
+
calls: result.calls,
|
|
98
|
+
minAmount: (0, sdk_gov_1.toBigInt)(result.minAmount),
|
|
99
|
+
amount: (0, sdk_gov_1.toBigInt)(result.amount),
|
|
100
|
+
gasUsage: (0, sdk_gov_1.toBigInt)(result.gasUsage),
|
|
99
101
|
};
|
|
100
102
|
}
|
|
101
103
|
/**
|
|
@@ -107,20 +109,28 @@ class PathFinder {
|
|
|
107
109
|
* - underlyingBalance - total balance of underlying token
|
|
108
110
|
* - calls - list of calls which should be done to swap & unwrap everything to underlying token
|
|
109
111
|
*/
|
|
110
|
-
async findBestClosePath(creditAccount, slippage,
|
|
112
|
+
async findBestClosePath({ creditAccount, creditManager: cm, expectedBalances, leftoverBalances, slippage, noConcurrency = false, }) {
|
|
111
113
|
const loopsPerTx = Math.floor(GAS_PER_BLOCK / MAX_GAS_PER_ROUTE);
|
|
112
114
|
const pathOptions = pathOptions_1.PathOptionFactory.generatePathOptions(creditAccount.allBalances, loopsPerTx);
|
|
115
|
+
const expected = cm.collateralTokens.map(token => ({
|
|
116
|
+
token,
|
|
117
|
+
balance: expectedBalances[token] || 0,
|
|
118
|
+
}));
|
|
119
|
+
const leftover = cm.collateralTokens.map(token => ({
|
|
120
|
+
token,
|
|
121
|
+
balance: leftoverBalances[token] || 1,
|
|
122
|
+
}));
|
|
113
123
|
const connectors = this.getAvailableConnectors(creditAccount.balances);
|
|
114
124
|
let results = [];
|
|
115
|
-
if (
|
|
125
|
+
if (noConcurrency) {
|
|
116
126
|
for (const po of pathOptions) {
|
|
117
|
-
results.push(await this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, connectors, slippage, po, loopsPerTx, false, {
|
|
127
|
+
results.push(await this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, expected, leftover, connectors, slippage, po, loopsPerTx, false, {
|
|
118
128
|
gasLimit: GAS_PER_BLOCK,
|
|
119
129
|
}));
|
|
120
130
|
}
|
|
121
131
|
}
|
|
122
132
|
else {
|
|
123
|
-
const requests = pathOptions.map(po => this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, connectors, slippage, po, loopsPerTx, false, {
|
|
133
|
+
const requests = pathOptions.map(po => this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, expected, leftover, connectors, slippage, po, loopsPerTx, false, {
|
|
124
134
|
gasLimit: GAS_PER_BLOCK,
|
|
125
135
|
}));
|
|
126
136
|
results = await Promise.all(requests);
|
|
@@ -128,21 +138,23 @@ class PathFinder {
|
|
|
128
138
|
const bestResult = results.reduce((best, [pathFinderResult, gasPriceRAY]) => PathFinder.compare(best, {
|
|
129
139
|
calls: pathFinderResult.calls,
|
|
130
140
|
amount: (0, sdk_gov_1.toBigInt)(pathFinderResult.amount),
|
|
141
|
+
minAmount: (0, sdk_gov_1.toBigInt)(pathFinderResult.minAmount),
|
|
131
142
|
gasUsage: (0, sdk_gov_1.toBigInt)(pathFinderResult.gasUsage),
|
|
132
143
|
}, (0, sdk_gov_1.toBigInt)(gasPriceRAY)), {
|
|
133
144
|
amount: 0n,
|
|
145
|
+
minAmount: 0n,
|
|
134
146
|
gasUsage: 0n,
|
|
135
147
|
calls: [],
|
|
136
148
|
});
|
|
137
149
|
return {
|
|
138
|
-
|
|
150
|
+
...bestResult,
|
|
151
|
+
underlyingBalance: bestResult.minAmount +
|
|
139
152
|
creditAccount.allBalances[creditAccount.underlyingToken.toLowerCase()]
|
|
140
153
|
.balance,
|
|
141
|
-
calls: bestResult.calls,
|
|
142
154
|
};
|
|
143
155
|
}
|
|
144
156
|
static compare(r1, r2, gasPriceRAY) {
|
|
145
|
-
const comparator = ({
|
|
157
|
+
const comparator = ({ minAmount, gasUsage }, gasPrice) => minAmount - (gasUsage * gasPrice) / sdk_gov_1.RAY;
|
|
146
158
|
return comparator(r1, gasPriceRAY) > comparator(r2, gasPriceRAY) ? r1 : r2;
|
|
147
159
|
}
|
|
148
160
|
getAvailableConnectors(availableList) {
|
|
@@ -7,12 +7,14 @@ const pathfinder_1 = require("./pathfinder");
|
|
|
7
7
|
describe("PathFinder test", () => {
|
|
8
8
|
it("compare works correctly", () => {
|
|
9
9
|
const r1 = {
|
|
10
|
-
|
|
10
|
+
minAmount: 2000n,
|
|
11
|
+
amount: 20000n,
|
|
11
12
|
gasUsage: 1000n,
|
|
12
13
|
calls: [],
|
|
13
14
|
};
|
|
14
15
|
const r2 = {
|
|
15
|
-
|
|
16
|
+
minAmount: 3000n,
|
|
17
|
+
amount: 30000n,
|
|
16
18
|
gasUsage: 2000n,
|
|
17
19
|
calls: [],
|
|
18
20
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ExcludeArrayProps } from "@gearbox-protocol/sdk-gov";
|
|
2
|
-
import { CreditAccountDataStructOutput,
|
|
2
|
+
import { CreditAccountDataStructOutput, TokenBalanceStructOutput } from "../types/IDataCompressorV3_00";
|
|
3
3
|
import { BigintifyProps, PartialKeys } from "../utils/types";
|
|
4
4
|
export type CaTokenBalance = BigintifyProps<ExcludeArrayProps<TokenBalanceStructOutput>>;
|
|
5
|
-
export type ScheduledWithdrawal = BigintifyProps<ExcludeArrayProps<ScheduledWithdrawalStructOutput>>;
|
|
6
5
|
export type CreditAccountDataPayload = PartialKeys<ExcludeArrayProps<CreditAccountDataStructOutput>, "accruedInterest" | "accruedFees" | "healthFactor" | "totalValue">;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers";
|
|
2
|
+
import type { FunctionFragment, Result } from "@ethersproject/abi";
|
|
3
|
+
import type { Listener, Provider } from "@ethersproject/providers";
|
|
4
|
+
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "./common";
|
|
5
|
+
export interface IAaveV2_LendingPoolAdapterInterface extends utils.Interface {
|
|
6
|
+
functions: {
|
|
7
|
+
"_gearboxAdapterType()": FunctionFragment;
|
|
8
|
+
"_gearboxAdapterVersion()": FunctionFragment;
|
|
9
|
+
"addressProvider()": FunctionFragment;
|
|
10
|
+
"creditManager()": FunctionFragment;
|
|
11
|
+
"deposit(address,uint256,address,uint16)": FunctionFragment;
|
|
12
|
+
"depositDiff(address,uint256)": FunctionFragment;
|
|
13
|
+
"targetContract()": FunctionFragment;
|
|
14
|
+
"withdraw(address,uint256,address)": FunctionFragment;
|
|
15
|
+
"withdrawDiff(address,uint256)": FunctionFragment;
|
|
16
|
+
};
|
|
17
|
+
getFunction(nameOrSignatureOrTopic: "_gearboxAdapterType" | "_gearboxAdapterVersion" | "addressProvider" | "creditManager" | "deposit" | "depositDiff" | "targetContract" | "withdraw" | "withdrawDiff"): FunctionFragment;
|
|
18
|
+
encodeFunctionData(functionFragment: "_gearboxAdapterType", values?: undefined): string;
|
|
19
|
+
encodeFunctionData(functionFragment: "_gearboxAdapterVersion", values?: undefined): string;
|
|
20
|
+
encodeFunctionData(functionFragment: "addressProvider", values?: undefined): string;
|
|
21
|
+
encodeFunctionData(functionFragment: "creditManager", values?: undefined): string;
|
|
22
|
+
encodeFunctionData(functionFragment: "deposit", values: [
|
|
23
|
+
PromiseOrValue<string>,
|
|
24
|
+
PromiseOrValue<BigNumberish>,
|
|
25
|
+
PromiseOrValue<string>,
|
|
26
|
+
PromiseOrValue<BigNumberish>
|
|
27
|
+
]): string;
|
|
28
|
+
encodeFunctionData(functionFragment: "depositDiff", values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]): string;
|
|
29
|
+
encodeFunctionData(functionFragment: "targetContract", values?: undefined): string;
|
|
30
|
+
encodeFunctionData(functionFragment: "withdraw", values: [
|
|
31
|
+
PromiseOrValue<string>,
|
|
32
|
+
PromiseOrValue<BigNumberish>,
|
|
33
|
+
PromiseOrValue<string>
|
|
34
|
+
]): string;
|
|
35
|
+
encodeFunctionData(functionFragment: "withdrawDiff", values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]): string;
|
|
36
|
+
decodeFunctionResult(functionFragment: "_gearboxAdapterType", data: BytesLike): Result;
|
|
37
|
+
decodeFunctionResult(functionFragment: "_gearboxAdapterVersion", data: BytesLike): Result;
|
|
38
|
+
decodeFunctionResult(functionFragment: "addressProvider", data: BytesLike): Result;
|
|
39
|
+
decodeFunctionResult(functionFragment: "creditManager", data: BytesLike): Result;
|
|
40
|
+
decodeFunctionResult(functionFragment: "deposit", data: BytesLike): Result;
|
|
41
|
+
decodeFunctionResult(functionFragment: "depositDiff", data: BytesLike): Result;
|
|
42
|
+
decodeFunctionResult(functionFragment: "targetContract", data: BytesLike): Result;
|
|
43
|
+
decodeFunctionResult(functionFragment: "withdraw", data: BytesLike): Result;
|
|
44
|
+
decodeFunctionResult(functionFragment: "withdrawDiff", data: BytesLike): Result;
|
|
45
|
+
events: {};
|
|
46
|
+
}
|
|
47
|
+
export interface IAaveV2_LendingPoolAdapter extends BaseContract {
|
|
48
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
49
|
+
attach(addressOrName: string): this;
|
|
50
|
+
deployed(): Promise<this>;
|
|
51
|
+
interface: IAaveV2_LendingPoolAdapterInterface;
|
|
52
|
+
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
|
|
53
|
+
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
|
|
54
|
+
listeners(eventName?: string): Array<Listener>;
|
|
55
|
+
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
|
|
56
|
+
removeAllListeners(eventName?: string): this;
|
|
57
|
+
off: OnEvent<this>;
|
|
58
|
+
on: OnEvent<this>;
|
|
59
|
+
once: OnEvent<this>;
|
|
60
|
+
removeListener: OnEvent<this>;
|
|
61
|
+
functions: {
|
|
62
|
+
_gearboxAdapterType(overrides?: CallOverrides): Promise<[number]>;
|
|
63
|
+
_gearboxAdapterVersion(overrides?: CallOverrides): Promise<[number]>;
|
|
64
|
+
addressProvider(overrides?: CallOverrides): Promise<[string]>;
|
|
65
|
+
creditManager(overrides?: CallOverrides): Promise<[string]>;
|
|
66
|
+
deposit(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, arg3: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
67
|
+
from?: PromiseOrValue<string>;
|
|
68
|
+
}): Promise<ContractTransaction>;
|
|
69
|
+
depositDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
70
|
+
from?: PromiseOrValue<string>;
|
|
71
|
+
}): Promise<ContractTransaction>;
|
|
72
|
+
targetContract(overrides?: CallOverrides): Promise<[string]>;
|
|
73
|
+
withdraw(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, overrides?: Overrides & {
|
|
74
|
+
from?: PromiseOrValue<string>;
|
|
75
|
+
}): Promise<ContractTransaction>;
|
|
76
|
+
withdrawDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
77
|
+
from?: PromiseOrValue<string>;
|
|
78
|
+
}): Promise<ContractTransaction>;
|
|
79
|
+
};
|
|
80
|
+
_gearboxAdapterType(overrides?: CallOverrides): Promise<number>;
|
|
81
|
+
_gearboxAdapterVersion(overrides?: CallOverrides): Promise<number>;
|
|
82
|
+
addressProvider(overrides?: CallOverrides): Promise<string>;
|
|
83
|
+
creditManager(overrides?: CallOverrides): Promise<string>;
|
|
84
|
+
deposit(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, arg3: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
85
|
+
from?: PromiseOrValue<string>;
|
|
86
|
+
}): Promise<ContractTransaction>;
|
|
87
|
+
depositDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
88
|
+
from?: PromiseOrValue<string>;
|
|
89
|
+
}): Promise<ContractTransaction>;
|
|
90
|
+
targetContract(overrides?: CallOverrides): Promise<string>;
|
|
91
|
+
withdraw(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, overrides?: Overrides & {
|
|
92
|
+
from?: PromiseOrValue<string>;
|
|
93
|
+
}): Promise<ContractTransaction>;
|
|
94
|
+
withdrawDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
95
|
+
from?: PromiseOrValue<string>;
|
|
96
|
+
}): Promise<ContractTransaction>;
|
|
97
|
+
callStatic: {
|
|
98
|
+
_gearboxAdapterType(overrides?: CallOverrides): Promise<number>;
|
|
99
|
+
_gearboxAdapterVersion(overrides?: CallOverrides): Promise<number>;
|
|
100
|
+
addressProvider(overrides?: CallOverrides): Promise<string>;
|
|
101
|
+
creditManager(overrides?: CallOverrides): Promise<string>;
|
|
102
|
+
deposit(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, arg3: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[
|
|
103
|
+
BigNumber,
|
|
104
|
+
BigNumber
|
|
105
|
+
] & {
|
|
106
|
+
tokensToEnable: BigNumber;
|
|
107
|
+
tokensToDisable: BigNumber;
|
|
108
|
+
}>;
|
|
109
|
+
depositDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[
|
|
110
|
+
BigNumber,
|
|
111
|
+
BigNumber
|
|
112
|
+
] & {
|
|
113
|
+
tokensToEnable: BigNumber;
|
|
114
|
+
tokensToDisable: BigNumber;
|
|
115
|
+
}>;
|
|
116
|
+
targetContract(overrides?: CallOverrides): Promise<string>;
|
|
117
|
+
withdraw(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
|
|
118
|
+
BigNumber,
|
|
119
|
+
BigNumber
|
|
120
|
+
] & {
|
|
121
|
+
tokensToEnable: BigNumber;
|
|
122
|
+
tokensToDisable: BigNumber;
|
|
123
|
+
}>;
|
|
124
|
+
withdrawDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[
|
|
125
|
+
BigNumber,
|
|
126
|
+
BigNumber
|
|
127
|
+
] & {
|
|
128
|
+
tokensToEnable: BigNumber;
|
|
129
|
+
tokensToDisable: BigNumber;
|
|
130
|
+
}>;
|
|
131
|
+
};
|
|
132
|
+
filters: {};
|
|
133
|
+
estimateGas: {
|
|
134
|
+
_gearboxAdapterType(overrides?: CallOverrides): Promise<BigNumber>;
|
|
135
|
+
_gearboxAdapterVersion(overrides?: CallOverrides): Promise<BigNumber>;
|
|
136
|
+
addressProvider(overrides?: CallOverrides): Promise<BigNumber>;
|
|
137
|
+
creditManager(overrides?: CallOverrides): Promise<BigNumber>;
|
|
138
|
+
deposit(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, arg3: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
139
|
+
from?: PromiseOrValue<string>;
|
|
140
|
+
}): Promise<BigNumber>;
|
|
141
|
+
depositDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
142
|
+
from?: PromiseOrValue<string>;
|
|
143
|
+
}): Promise<BigNumber>;
|
|
144
|
+
targetContract(overrides?: CallOverrides): Promise<BigNumber>;
|
|
145
|
+
withdraw(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, overrides?: Overrides & {
|
|
146
|
+
from?: PromiseOrValue<string>;
|
|
147
|
+
}): Promise<BigNumber>;
|
|
148
|
+
withdrawDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
149
|
+
from?: PromiseOrValue<string>;
|
|
150
|
+
}): Promise<BigNumber>;
|
|
151
|
+
};
|
|
152
|
+
populateTransaction: {
|
|
153
|
+
_gearboxAdapterType(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
154
|
+
_gearboxAdapterVersion(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
155
|
+
addressProvider(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
156
|
+
creditManager(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
157
|
+
deposit(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, arg3: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
158
|
+
from?: PromiseOrValue<string>;
|
|
159
|
+
}): Promise<PopulatedTransaction>;
|
|
160
|
+
depositDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
161
|
+
from?: PromiseOrValue<string>;
|
|
162
|
+
}): Promise<PopulatedTransaction>;
|
|
163
|
+
targetContract(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
164
|
+
withdraw(asset: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, arg2: PromiseOrValue<string>, overrides?: Overrides & {
|
|
165
|
+
from?: PromiseOrValue<string>;
|
|
166
|
+
}): Promise<PopulatedTransaction>;
|
|
167
|
+
withdrawDiff(asset: PromiseOrValue<string>, leftoverAmount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
168
|
+
from?: PromiseOrValue<string>;
|
|
169
|
+
}): Promise<PopulatedTransaction>;
|
|
170
|
+
};
|
|
171
|
+
}
|