@gearbox-protocol/sdk 1.8.8 → 1.8.10
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/contracts/contractsRegister.js +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -3
- package/lib/pathfinder/pathOptions.d.ts +4 -0
- package/lib/pathfinder/pathOptions.js +68 -11
- package/lib/pathfinder/pathOptions.spec.js +53 -0
- package/lib/types/contracts/integrations/lido/IwstETHGateway.sol/IwstETHGateWay.d.ts +66 -0
- package/lib/types/contracts/integrations/lido/IwstETHGateway.sol/IwstETHGateWay.js +2 -0
- package/lib/types/contracts/integrations/lido/IwstETHGateway.sol/index.d.ts +1 -0
- package/lib/types/contracts/integrations/lido/IwstETHGateway.sol/index.js +2 -0
- package/lib/types/contracts/integrations/lido/index.d.ts +2 -0
- package/lib/types/contracts/interfaces/adapters/lido/IwstETHV1Adapter.d.ts +9 -1
- package/lib/types/contracts/pathfinder/interfaces/IPathFinder.d.ts +0 -11
- package/lib/types/contracts/pathfinder/interfaces/IWrapper.d.ts +152 -0
- package/lib/types/contracts/pathfinder/interfaces/IWrapper.js +2 -0
- package/lib/types/contracts/pathfinder/interfaces/index.d.ts +1 -0
- package/lib/types/contracts/test/suites/live/ITokenTestSuite.d.ts +1 -49
- package/lib/types/factories/contracts/integrations/lido/IwstETHGateway.sol/IwstETHGateWay__factory.d.ts +28 -0
- package/lib/types/factories/contracts/integrations/lido/IwstETHGateway.sol/IwstETHGateWay__factory.js +74 -0
- package/lib/types/factories/contracts/integrations/lido/IwstETHGateway.sol/index.d.ts +1 -0
- package/lib/types/factories/contracts/integrations/lido/IwstETHGateway.sol/index.js +8 -0
- package/lib/types/factories/contracts/integrations/lido/index.d.ts +1 -0
- package/lib/types/factories/contracts/integrations/lido/index.js +2 -1
- package/lib/types/factories/contracts/interfaces/adapters/lido/IwstETHV1Adapter__factory.js +13 -0
- package/lib/types/factories/contracts/pathfinder/interfaces/IPathFinder__factory.js +0 -13
- package/lib/types/factories/contracts/pathfinder/interfaces/IWrapper__factory.d.ts +61 -0
- package/lib/types/factories/contracts/pathfinder/interfaces/IWrapper__factory.js +296 -0
- package/lib/types/factories/contracts/pathfinder/interfaces/index.d.ts +1 -0
- package/lib/types/factories/contracts/pathfinder/interfaces/index.js +3 -1
- package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.d.ts +1 -1
- package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.js +1 -1
- package/lib/types/factories/contracts/test/suites/live/ITokenTestSuite__factory.js +0 -69
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.js +7 -3
- package/package.json +1 -1
|
@@ -38,6 +38,7 @@ exports.deployedContracts = {
|
|
|
38
38
|
"0xF0A7BE2EB39bBbd55fc5597F93E01f62A790e587": "USDC",
|
|
39
39
|
"0x560F2aa70003af4A69Bc79bB3c40955d396305aE": "WETH",
|
|
40
40
|
"0x9f07160C42d5d8325E3Aa50e0075Ef3A8E4DcA9B": "WBTC",
|
|
41
|
+
"0xd720fe603eb3d954a8586433e78f02e248eae4c0": "wstETH",
|
|
41
42
|
};
|
|
42
43
|
var contractNames = Object.entries(contracts_1.contractsByAddress).reduce(function (acc, _a) {
|
|
43
44
|
var _b;
|
package/lib/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export * from "./utils/math";
|
|
|
32
32
|
export * from "./utils/validate";
|
|
33
33
|
export * from "./apy";
|
|
34
34
|
export { AdapterInterface } from "./contracts/adapters";
|
|
35
|
-
export
|
|
35
|
+
export * from "./contracts/contractsRegister";
|
|
36
36
|
export * from "./core/history";
|
|
37
37
|
export * from "./parsers/txParser";
|
|
38
38
|
export * from "./pathfinder/core";
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.callRepeater = exports.swapKeyValue = exports.objectEntries = exports.keyToLowercase = exports.getUnderlyingToken = exports.getPoolTokens = exports.TokenType = exports.
|
|
17
|
+
exports.callRepeater = exports.swapKeyValue = exports.objectEntries = exports.keyToLowercase = exports.getUnderlyingToken = exports.getPoolTokens = exports.TokenType = exports.AdapterInterface = void 0;
|
|
18
18
|
__exportStar(require("./contracts/contracts"), exports);
|
|
19
19
|
__exportStar(require("./contracts/protocols"), exports);
|
|
20
20
|
__exportStar(require("./core/adapter"), exports);
|
|
@@ -51,8 +51,7 @@ __exportStar(require("./utils/validate"), exports);
|
|
|
51
51
|
__exportStar(require("./apy"), exports);
|
|
52
52
|
var adapters_1 = require("./contracts/adapters");
|
|
53
53
|
Object.defineProperty(exports, "AdapterInterface", { enumerable: true, get: function () { return adapters_1.AdapterInterface; } });
|
|
54
|
-
|
|
55
|
-
Object.defineProperty(exports, "getContractName", { enumerable: true, get: function () { return contractsRegister_1.getContractName; } });
|
|
54
|
+
__exportStar(require("./contracts/contractsRegister"), exports);
|
|
56
55
|
__exportStar(require("./core/history"), exports);
|
|
57
56
|
__exportStar(require("./parsers/txParser"), exports);
|
|
58
57
|
__exportStar(require("./pathfinder/core"), exports);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BigNumberish } from "ethers";
|
|
2
|
+
import { NetworkType } from "../core/constants";
|
|
3
|
+
import { CurveLPToken } from "../tokens/curveLP";
|
|
2
4
|
export interface PathOption {
|
|
3
5
|
target: string;
|
|
4
6
|
option: number;
|
|
@@ -7,5 +9,7 @@ export interface PathOption {
|
|
|
7
9
|
export declare type PathOptionSerie = Array<PathOption>;
|
|
8
10
|
export declare class PathOptionFactory {
|
|
9
11
|
static generatePathOptions(balances: Record<string, BigNumberish>, loopsInTx: number): Array<PathOptionSerie>;
|
|
12
|
+
static getCurvePools(balances: Record<string, BigNumberish>): Array<CurveLPToken>;
|
|
10
13
|
static next(path: PathOptionSerie): PathOptionSerie;
|
|
14
|
+
static detectNetwork(underlying: string): NetworkType;
|
|
11
15
|
}
|
|
@@ -23,25 +23,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.PathOptionFactory = void 0;
|
|
24
24
|
var ethers_1 = require("ethers");
|
|
25
25
|
var contracts_1 = require("../contracts/contracts");
|
|
26
|
+
var convex_1 = require("../tokens/convex");
|
|
26
27
|
var curveLP_1 = require("../tokens/curveLP");
|
|
27
28
|
var token_1 = require("../tokens/token");
|
|
29
|
+
var yearn_1 = require("../tokens/yearn");
|
|
28
30
|
var PathOptionFactory = /** @class */ (function () {
|
|
29
31
|
function PathOptionFactory() {
|
|
30
32
|
}
|
|
31
33
|
PathOptionFactory.generatePathOptions = function (balances, loopsInTx) {
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
var token = _a[0], balance = _a[1];
|
|
36
|
-
return ethers_1.BigNumber.from(balance).gt(1) &&
|
|
37
|
-
curveSymbols.includes(token_1.tokenSymbolByAddress[token.toLowerCase()]);
|
|
38
|
-
})
|
|
39
|
-
.map(function (_a) {
|
|
40
|
-
var target = _a[0];
|
|
34
|
+
var curvePools = PathOptionFactory.getCurvePools(balances);
|
|
35
|
+
var network = PathOptionFactory.detectNetwork(Object.keys(balances)[0]);
|
|
36
|
+
var initPO = curvePools.map(function (symbol) {
|
|
41
37
|
return {
|
|
42
|
-
target:
|
|
38
|
+
target: token_1.tokenDataByNetwork[network][symbol],
|
|
43
39
|
option: 0,
|
|
44
|
-
totalOptions: contracts_1.contractParams[curveLP_1.curveTokens[
|
|
40
|
+
totalOptions: contracts_1.contractParams[curveLP_1.curveTokens[symbol].pool]
|
|
41
|
+
.tokens.length,
|
|
45
42
|
};
|
|
46
43
|
});
|
|
47
44
|
var totalLoops = initPO.reduce(function (acc, item) { return acc * item.totalOptions; }, 1);
|
|
@@ -57,6 +54,61 @@ var PathOptionFactory = /** @class */ (function () {
|
|
|
57
54
|
}
|
|
58
55
|
return result;
|
|
59
56
|
};
|
|
57
|
+
PathOptionFactory.getCurvePools = function (balances) {
|
|
58
|
+
var curveSymbols = Object.keys(curveLP_1.curveTokens);
|
|
59
|
+
var curvePools = Object.entries(balances)
|
|
60
|
+
.filter(function (_a) {
|
|
61
|
+
var balance = _a[1];
|
|
62
|
+
return ethers_1.BigNumber.from(balance).gt(1);
|
|
63
|
+
})
|
|
64
|
+
.map(function (_a) {
|
|
65
|
+
var token = _a[0];
|
|
66
|
+
return token_1.tokenSymbolByAddress[token.toLowerCase()];
|
|
67
|
+
})
|
|
68
|
+
.filter(function (symbol) { return curveSymbols.includes(symbol); });
|
|
69
|
+
var yearnCurveTokens = Object.entries(yearn_1.yearnTokens)
|
|
70
|
+
.filter(function (_a) {
|
|
71
|
+
var data = _a[1];
|
|
72
|
+
return curveSymbols.includes(data.underlying);
|
|
73
|
+
})
|
|
74
|
+
.map(function (_a) {
|
|
75
|
+
var token = _a[0];
|
|
76
|
+
return token;
|
|
77
|
+
});
|
|
78
|
+
var curvePoolsFromYearn = Object.entries(balances)
|
|
79
|
+
.filter(function (_a) {
|
|
80
|
+
var balance = _a[1];
|
|
81
|
+
return ethers_1.BigNumber.from(balance).gt(1);
|
|
82
|
+
})
|
|
83
|
+
.map(function (_a) {
|
|
84
|
+
var token = _a[0];
|
|
85
|
+
return token_1.tokenSymbolByAddress[token.toLowerCase()];
|
|
86
|
+
})
|
|
87
|
+
.filter(function (symbol) { return yearnCurveTokens.includes(symbol); })
|
|
88
|
+
.map(function (symbol) { return yearn_1.yearnTokens[symbol].underlying; });
|
|
89
|
+
var convexCurveTokens = Object.entries(convex_1.convexTokens)
|
|
90
|
+
.filter(function (_a) {
|
|
91
|
+
var data = _a[1];
|
|
92
|
+
return curveSymbols.includes(data.underlying);
|
|
93
|
+
})
|
|
94
|
+
.map(function (_a) {
|
|
95
|
+
var token = _a[0];
|
|
96
|
+
return token;
|
|
97
|
+
});
|
|
98
|
+
var curvePoolsFromConvex = Object.entries(balances)
|
|
99
|
+
.filter(function (_a) {
|
|
100
|
+
var balance = _a[1];
|
|
101
|
+
return ethers_1.BigNumber.from(balance).gt(1);
|
|
102
|
+
})
|
|
103
|
+
.map(function (_a) {
|
|
104
|
+
var token = _a[0];
|
|
105
|
+
return token_1.tokenSymbolByAddress[token.toLowerCase()];
|
|
106
|
+
})
|
|
107
|
+
.filter(function (symbol) { return convexCurveTokens.includes(symbol); })
|
|
108
|
+
.map(function (symbol) { return convex_1.convexTokens[symbol].underlying; });
|
|
109
|
+
var curveSet = new Set(__spreadArray(__spreadArray(__spreadArray([], curvePools, true), curvePoolsFromYearn, true), curvePoolsFromConvex, true));
|
|
110
|
+
return Array.from(curveSet.values());
|
|
111
|
+
};
|
|
60
112
|
PathOptionFactory.next = function (path) {
|
|
61
113
|
var newPath = __spreadArray([], path, true);
|
|
62
114
|
for (var i = path.length - 1; i >= 0; i--) {
|
|
@@ -69,6 +121,11 @@ var PathOptionFactory = /** @class */ (function () {
|
|
|
69
121
|
}
|
|
70
122
|
throw new Error("Path options overflow");
|
|
71
123
|
};
|
|
124
|
+
PathOptionFactory.detectNetwork = function (underlying) {
|
|
125
|
+
return token_1.tokenDataByNetwork.Mainnet[token_1.tokenSymbolByAddress[underlying.toLowerCase()]].toLowerCase() === underlying.toLowerCase()
|
|
126
|
+
? "Mainnet"
|
|
127
|
+
: "Goerli";
|
|
128
|
+
};
|
|
72
129
|
return PathOptionFactory;
|
|
73
130
|
}());
|
|
74
131
|
exports.PathOptionFactory = PathOptionFactory;
|
|
@@ -87,4 +87,57 @@ describe("PathOptionFactory test", function () {
|
|
|
87
87
|
(0, chai_1.expect)(expected).to.be.eql(result[i]);
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
+
it(" getCurvePools works correctly", function () {
|
|
91
|
+
var _a, _b, _c, _d, _e;
|
|
92
|
+
var balances = (_a = {},
|
|
93
|
+
_a[token_1.tokenDataByNetwork.Mainnet["1INCH"]] = 100,
|
|
94
|
+
_a[token_1.tokenDataByNetwork.Mainnet["3Crv"]] = 200,
|
|
95
|
+
_a[token_1.tokenDataByNetwork.Mainnet.USDC] = 200,
|
|
96
|
+
_a[token_1.tokenDataByNetwork.Mainnet.FRAX3CRV] = 200,
|
|
97
|
+
_a[token_1.tokenDataByNetwork.Mainnet.LUSD3CRV] = 200,
|
|
98
|
+
_a);
|
|
99
|
+
var expectedCurvePools = [
|
|
100
|
+
"3Crv",
|
|
101
|
+
"FRAX3CRV",
|
|
102
|
+
"LUSD3CRV",
|
|
103
|
+
];
|
|
104
|
+
(0, chai_1.expect)(pathOptions_1.PathOptionFactory.getCurvePools(balances)).to.be.eql(expectedCurvePools);
|
|
105
|
+
balances = (_b = {},
|
|
106
|
+
_b[token_1.tokenDataByNetwork.Mainnet["1INCH"]] = 100,
|
|
107
|
+
_b[token_1.tokenDataByNetwork.Mainnet["3Crv"]] = 200,
|
|
108
|
+
_b[token_1.tokenDataByNetwork.Mainnet.USDC] = 200,
|
|
109
|
+
_b[token_1.tokenDataByNetwork.Mainnet.yvCurve_FRAX] = 200,
|
|
110
|
+
_b[token_1.tokenDataByNetwork.Mainnet.yvCurve_stETH] = 200,
|
|
111
|
+
_b);
|
|
112
|
+
expectedCurvePools = ["3Crv", "FRAX3CRV", "steCRV"];
|
|
113
|
+
(0, chai_1.expect)(pathOptions_1.PathOptionFactory.getCurvePools(balances)).to.be.eql(expectedCurvePools);
|
|
114
|
+
balances = (_c = {},
|
|
115
|
+
_c[token_1.tokenDataByNetwork.Mainnet["1INCH"]] = 100,
|
|
116
|
+
_c[token_1.tokenDataByNetwork.Mainnet.USDC] = 200,
|
|
117
|
+
_c[token_1.tokenDataByNetwork.Mainnet.cvx3Crv] = 200,
|
|
118
|
+
_c[token_1.tokenDataByNetwork.Mainnet.cvxFRAX3CRV] = 200,
|
|
119
|
+
_c);
|
|
120
|
+
expectedCurvePools = ["3Crv", "FRAX3CRV"];
|
|
121
|
+
(0, chai_1.expect)(pathOptions_1.PathOptionFactory.getCurvePools(balances)).to.be.eql(expectedCurvePools);
|
|
122
|
+
balances = (_d = {},
|
|
123
|
+
_d[token_1.tokenDataByNetwork.Mainnet.wstETH] = 100,
|
|
124
|
+
_d[token_1.tokenDataByNetwork.Mainnet.USDC] = 200,
|
|
125
|
+
_d[token_1.tokenDataByNetwork.Mainnet.stkcvx3Crv] = 200,
|
|
126
|
+
_d[token_1.tokenDataByNetwork.Mainnet.stkcvxFRAX3CRV] = 200,
|
|
127
|
+
_d);
|
|
128
|
+
expectedCurvePools = ["3Crv", "FRAX3CRV"];
|
|
129
|
+
(0, chai_1.expect)(pathOptions_1.PathOptionFactory.getCurvePools(balances)).to.be.eql(expectedCurvePools);
|
|
130
|
+
balances = (_e = {},
|
|
131
|
+
_e[token_1.tokenDataByNetwork.Mainnet["3Crv"]] = 100,
|
|
132
|
+
_e[token_1.tokenDataByNetwork.Mainnet.USDC] = 200,
|
|
133
|
+
_e[token_1.tokenDataByNetwork.Mainnet.stkcvx3Crv] = 200,
|
|
134
|
+
_e[token_1.tokenDataByNetwork.Mainnet.cvx3Crv] = 200,
|
|
135
|
+
_e[token_1.tokenDataByNetwork.Mainnet.yvCurve_stETH] = 200,
|
|
136
|
+
_e);
|
|
137
|
+
expectedCurvePools = ["3Crv", "steCRV"];
|
|
138
|
+
(0, chai_1.expect)(pathOptions_1.PathOptionFactory.getCurvePools(balances)).to.be.eql(expectedCurvePools);
|
|
139
|
+
});
|
|
140
|
+
it("detectNetwork works correctly", function () {
|
|
141
|
+
(0, chai_1.expect)(pathOptions_1.PathOptionFactory.detectNetwork(token_1.tokenDataByNetwork.Mainnet["1INCH"])).to.be.eq("Mainnet");
|
|
142
|
+
});
|
|
90
143
|
});
|
|
@@ -0,0 +1,66 @@
|
|
|
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 } from "../../../../common";
|
|
5
|
+
export interface IwstETHGateWayInterface extends utils.Interface {
|
|
6
|
+
functions: {
|
|
7
|
+
"addLiquidity(uint256,address,uint256)": FunctionFragment;
|
|
8
|
+
"removeLiquidity(uint256,address)": FunctionFragment;
|
|
9
|
+
};
|
|
10
|
+
getFunction(nameOrSignatureOrTopic: "addLiquidity" | "removeLiquidity"): FunctionFragment;
|
|
11
|
+
encodeFunctionData(functionFragment: "addLiquidity", values: [BigNumberish, string, BigNumberish]): string;
|
|
12
|
+
encodeFunctionData(functionFragment: "removeLiquidity", values: [BigNumberish, string]): string;
|
|
13
|
+
decodeFunctionResult(functionFragment: "addLiquidity", data: BytesLike): Result;
|
|
14
|
+
decodeFunctionResult(functionFragment: "removeLiquidity", data: BytesLike): Result;
|
|
15
|
+
events: {};
|
|
16
|
+
}
|
|
17
|
+
export interface IwstETHGateWay extends BaseContract {
|
|
18
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
19
|
+
attach(addressOrName: string): this;
|
|
20
|
+
deployed(): Promise<this>;
|
|
21
|
+
interface: IwstETHGateWayInterface;
|
|
22
|
+
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
|
|
23
|
+
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
|
|
24
|
+
listeners(eventName?: string): Array<Listener>;
|
|
25
|
+
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
|
|
26
|
+
removeAllListeners(eventName?: string): this;
|
|
27
|
+
off: OnEvent<this>;
|
|
28
|
+
on: OnEvent<this>;
|
|
29
|
+
once: OnEvent<this>;
|
|
30
|
+
removeListener: OnEvent<this>;
|
|
31
|
+
functions: {
|
|
32
|
+
addLiquidity(amount: BigNumberish, onBehalfOf: string, referralCode: BigNumberish, overrides?: Overrides & {
|
|
33
|
+
from?: string | Promise<string>;
|
|
34
|
+
}): Promise<ContractTransaction>;
|
|
35
|
+
removeLiquidity(amount: BigNumberish, to: string, overrides?: Overrides & {
|
|
36
|
+
from?: string | Promise<string>;
|
|
37
|
+
}): Promise<ContractTransaction>;
|
|
38
|
+
};
|
|
39
|
+
addLiquidity(amount: BigNumberish, onBehalfOf: string, referralCode: BigNumberish, overrides?: Overrides & {
|
|
40
|
+
from?: string | Promise<string>;
|
|
41
|
+
}): Promise<ContractTransaction>;
|
|
42
|
+
removeLiquidity(amount: BigNumberish, to: string, overrides?: Overrides & {
|
|
43
|
+
from?: string | Promise<string>;
|
|
44
|
+
}): Promise<ContractTransaction>;
|
|
45
|
+
callStatic: {
|
|
46
|
+
addLiquidity(amount: BigNumberish, onBehalfOf: string, referralCode: BigNumberish, overrides?: CallOverrides): Promise<void>;
|
|
47
|
+
removeLiquidity(amount: BigNumberish, to: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
48
|
+
};
|
|
49
|
+
filters: {};
|
|
50
|
+
estimateGas: {
|
|
51
|
+
addLiquidity(amount: BigNumberish, onBehalfOf: string, referralCode: BigNumberish, overrides?: Overrides & {
|
|
52
|
+
from?: string | Promise<string>;
|
|
53
|
+
}): Promise<BigNumber>;
|
|
54
|
+
removeLiquidity(amount: BigNumberish, to: string, overrides?: Overrides & {
|
|
55
|
+
from?: string | Promise<string>;
|
|
56
|
+
}): Promise<BigNumber>;
|
|
57
|
+
};
|
|
58
|
+
populateTransaction: {
|
|
59
|
+
addLiquidity(amount: BigNumberish, onBehalfOf: string, referralCode: BigNumberish, overrides?: Overrides & {
|
|
60
|
+
from?: string | Promise<string>;
|
|
61
|
+
}): Promise<PopulatedTransaction>;
|
|
62
|
+
removeLiquidity(amount: BigNumberish, to: string, overrides?: Overrides & {
|
|
63
|
+
from?: string | Promise<string>;
|
|
64
|
+
}): Promise<PopulatedTransaction>;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { IwstETHGateWay } from "./IwstETHGateWay";
|
|
@@ -2,4 +2,6 @@ import type * as istEthSol from "./IstETH.sol";
|
|
|
2
2
|
export type { istEthSol };
|
|
3
3
|
import type * as iwstEthSol from "./IwstETH.sol";
|
|
4
4
|
export type { iwstEthSol };
|
|
5
|
+
import type * as iwstEthGatewaySol from "./IwstETHGateway.sol";
|
|
6
|
+
export type { iwstEthGatewaySol };
|
|
5
7
|
export type { ILidoOracle } from "./ILidoOracle";
|
|
@@ -14,6 +14,7 @@ export interface IwstETHV1AdapterInterface extends utils.Interface {
|
|
|
14
14
|
"getStETHByWstETH(uint256)": FunctionFragment;
|
|
15
15
|
"getWstETHByStETH(uint256)": FunctionFragment;
|
|
16
16
|
"name()": FunctionFragment;
|
|
17
|
+
"stETH()": FunctionFragment;
|
|
17
18
|
"stEthPerToken()": FunctionFragment;
|
|
18
19
|
"symbol()": FunctionFragment;
|
|
19
20
|
"targetContract()": FunctionFragment;
|
|
@@ -24,7 +25,7 @@ export interface IwstETHV1AdapterInterface extends utils.Interface {
|
|
|
24
25
|
"wrap(uint256)": FunctionFragment;
|
|
25
26
|
"wrapAll()": FunctionFragment;
|
|
26
27
|
};
|
|
27
|
-
getFunction(nameOrSignatureOrTopic: "_gearboxAdapterType" | "_gearboxAdapterVersion" | "allowance" | "balanceOf" | "creditFacade" | "creditManager" | "decimals" | "getStETHByWstETH" | "getWstETHByStETH" | "name" | "stEthPerToken" | "symbol" | "targetContract" | "tokensPerStEth" | "totalSupply" | "unwrap" | "unwrapAll" | "wrap" | "wrapAll"): FunctionFragment;
|
|
28
|
+
getFunction(nameOrSignatureOrTopic: "_gearboxAdapterType" | "_gearboxAdapterVersion" | "allowance" | "balanceOf" | "creditFacade" | "creditManager" | "decimals" | "getStETHByWstETH" | "getWstETHByStETH" | "name" | "stETH" | "stEthPerToken" | "symbol" | "targetContract" | "tokensPerStEth" | "totalSupply" | "unwrap" | "unwrapAll" | "wrap" | "wrapAll"): FunctionFragment;
|
|
28
29
|
encodeFunctionData(functionFragment: "_gearboxAdapterType", values?: undefined): string;
|
|
29
30
|
encodeFunctionData(functionFragment: "_gearboxAdapterVersion", values?: undefined): string;
|
|
30
31
|
encodeFunctionData(functionFragment: "allowance", values: [string, string]): string;
|
|
@@ -35,6 +36,7 @@ export interface IwstETHV1AdapterInterface extends utils.Interface {
|
|
|
35
36
|
encodeFunctionData(functionFragment: "getStETHByWstETH", values: [BigNumberish]): string;
|
|
36
37
|
encodeFunctionData(functionFragment: "getWstETHByStETH", values: [BigNumberish]): string;
|
|
37
38
|
encodeFunctionData(functionFragment: "name", values?: undefined): string;
|
|
39
|
+
encodeFunctionData(functionFragment: "stETH", values?: undefined): string;
|
|
38
40
|
encodeFunctionData(functionFragment: "stEthPerToken", values?: undefined): string;
|
|
39
41
|
encodeFunctionData(functionFragment: "symbol", values?: undefined): string;
|
|
40
42
|
encodeFunctionData(functionFragment: "targetContract", values?: undefined): string;
|
|
@@ -54,6 +56,7 @@ export interface IwstETHV1AdapterInterface extends utils.Interface {
|
|
|
54
56
|
decodeFunctionResult(functionFragment: "getStETHByWstETH", data: BytesLike): Result;
|
|
55
57
|
decodeFunctionResult(functionFragment: "getWstETHByStETH", data: BytesLike): Result;
|
|
56
58
|
decodeFunctionResult(functionFragment: "name", data: BytesLike): Result;
|
|
59
|
+
decodeFunctionResult(functionFragment: "stETH", data: BytesLike): Result;
|
|
57
60
|
decodeFunctionResult(functionFragment: "stEthPerToken", data: BytesLike): Result;
|
|
58
61
|
decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result;
|
|
59
62
|
decodeFunctionResult(functionFragment: "targetContract", data: BytesLike): Result;
|
|
@@ -90,6 +93,7 @@ export interface IwstETHV1Adapter extends BaseContract {
|
|
|
90
93
|
getStETHByWstETH(_wstETHAmount: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
91
94
|
getWstETHByStETH(_stETHAmount: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
92
95
|
name(overrides?: CallOverrides): Promise<[string]>;
|
|
96
|
+
stETH(overrides?: CallOverrides): Promise<[string]>;
|
|
93
97
|
stEthPerToken(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
94
98
|
symbol(overrides?: CallOverrides): Promise<[string]>;
|
|
95
99
|
targetContract(overrides?: CallOverrides): Promise<[string]>;
|
|
@@ -118,6 +122,7 @@ export interface IwstETHV1Adapter extends BaseContract {
|
|
|
118
122
|
getStETHByWstETH(_wstETHAmount: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
|
119
123
|
getWstETHByStETH(_stETHAmount: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
|
120
124
|
name(overrides?: CallOverrides): Promise<string>;
|
|
125
|
+
stETH(overrides?: CallOverrides): Promise<string>;
|
|
121
126
|
stEthPerToken(overrides?: CallOverrides): Promise<BigNumber>;
|
|
122
127
|
symbol(overrides?: CallOverrides): Promise<string>;
|
|
123
128
|
targetContract(overrides?: CallOverrides): Promise<string>;
|
|
@@ -146,6 +151,7 @@ export interface IwstETHV1Adapter extends BaseContract {
|
|
|
146
151
|
getStETHByWstETH(_wstETHAmount: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
|
147
152
|
getWstETHByStETH(_stETHAmount: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
|
148
153
|
name(overrides?: CallOverrides): Promise<string>;
|
|
154
|
+
stETH(overrides?: CallOverrides): Promise<string>;
|
|
149
155
|
stEthPerToken(overrides?: CallOverrides): Promise<BigNumber>;
|
|
150
156
|
symbol(overrides?: CallOverrides): Promise<string>;
|
|
151
157
|
targetContract(overrides?: CallOverrides): Promise<string>;
|
|
@@ -168,6 +174,7 @@ export interface IwstETHV1Adapter extends BaseContract {
|
|
|
168
174
|
getStETHByWstETH(_wstETHAmount: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
|
169
175
|
getWstETHByStETH(_stETHAmount: BigNumberish, overrides?: CallOverrides): Promise<BigNumber>;
|
|
170
176
|
name(overrides?: CallOverrides): Promise<BigNumber>;
|
|
177
|
+
stETH(overrides?: CallOverrides): Promise<BigNumber>;
|
|
171
178
|
stEthPerToken(overrides?: CallOverrides): Promise<BigNumber>;
|
|
172
179
|
symbol(overrides?: CallOverrides): Promise<BigNumber>;
|
|
173
180
|
targetContract(overrides?: CallOverrides): Promise<BigNumber>;
|
|
@@ -197,6 +204,7 @@ export interface IwstETHV1Adapter extends BaseContract {
|
|
|
197
204
|
getStETHByWstETH(_wstETHAmount: BigNumberish, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
198
205
|
getWstETHByStETH(_stETHAmount: BigNumberish, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
199
206
|
name(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
207
|
+
stETH(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
200
208
|
stEthPerToken(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
201
209
|
symbol(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
202
210
|
targetContract(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
@@ -111,12 +111,10 @@ export interface IPathFinderInterface extends utils.Interface {
|
|
|
111
111
|
decodeFunctionResult(functionFragment: "version", data: BytesLike): Result;
|
|
112
112
|
events: {
|
|
113
113
|
"PathFinderComponentUpdate(uint8,address)": EventFragment;
|
|
114
|
-
"ResolverComponentUpdateFailed(address)": EventFragment;
|
|
115
114
|
"ResolverUpdate(uint8,uint8,uint8)": EventFragment;
|
|
116
115
|
"TokenTypeUpdate(address,uint8)": EventFragment;
|
|
117
116
|
};
|
|
118
117
|
getEvent(nameOrSignatureOrTopic: "PathFinderComponentUpdate"): EventFragment;
|
|
119
|
-
getEvent(nameOrSignatureOrTopic: "ResolverComponentUpdateFailed"): EventFragment;
|
|
120
118
|
getEvent(nameOrSignatureOrTopic: "ResolverUpdate"): EventFragment;
|
|
121
119
|
getEvent(nameOrSignatureOrTopic: "TokenTypeUpdate"): EventFragment;
|
|
122
120
|
}
|
|
@@ -129,13 +127,6 @@ export declare type PathFinderComponentUpdateEvent = TypedEvent<[
|
|
|
129
127
|
string
|
|
130
128
|
], PathFinderComponentUpdateEventObject>;
|
|
131
129
|
export declare type PathFinderComponentUpdateEventFilter = TypedEventFilter<PathFinderComponentUpdateEvent>;
|
|
132
|
-
export interface ResolverComponentUpdateFailedEventObject {
|
|
133
|
-
arg0: string;
|
|
134
|
-
}
|
|
135
|
-
export declare type ResolverComponentUpdateFailedEvent = TypedEvent<[
|
|
136
|
-
string
|
|
137
|
-
], ResolverComponentUpdateFailedEventObject>;
|
|
138
|
-
export declare type ResolverComponentUpdateFailedEventFilter = TypedEventFilter<ResolverComponentUpdateFailedEvent>;
|
|
139
130
|
export interface ResolverUpdateEventObject {
|
|
140
131
|
arg0: number;
|
|
141
132
|
arg1: number;
|
|
@@ -228,8 +219,6 @@ export interface IPathFinder extends BaseContract {
|
|
|
228
219
|
filters: {
|
|
229
220
|
"PathFinderComponentUpdate(uint8,address)"(arg0?: BigNumberish | null, arg1?: string | null): PathFinderComponentUpdateEventFilter;
|
|
230
221
|
PathFinderComponentUpdate(arg0?: BigNumberish | null, arg1?: string | null): PathFinderComponentUpdateEventFilter;
|
|
231
|
-
"ResolverComponentUpdateFailed(address)"(arg0?: null): ResolverComponentUpdateFailedEventFilter;
|
|
232
|
-
ResolverComponentUpdateFailed(arg0?: null): ResolverComponentUpdateFailedEventFilter;
|
|
233
222
|
"ResolverUpdate(uint8,uint8,uint8)"(arg0?: BigNumberish | null, arg1?: BigNumberish | null, arg2?: BigNumberish | null): ResolverUpdateEventFilter;
|
|
234
223
|
ResolverUpdate(arg0?: BigNumberish | null, arg1?: BigNumberish | null, arg2?: BigNumberish | null): ResolverUpdateEventFilter;
|
|
235
224
|
"TokenTypeUpdate(address,uint8)"(arg0?: string | null, arg1?: BigNumberish | null): TokenTypeUpdateEventFilter;
|
|
@@ -0,0 +1,152 @@
|
|
|
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 } from "../../../common";
|
|
5
|
+
export declare type SwapTaskStruct = {
|
|
6
|
+
swapOperation: BigNumberish;
|
|
7
|
+
creditAccount: string;
|
|
8
|
+
tokenIn: string;
|
|
9
|
+
tokenOut: string;
|
|
10
|
+
connectors: string[];
|
|
11
|
+
amount: BigNumberish;
|
|
12
|
+
slippage: BigNumberish;
|
|
13
|
+
externalSlippage: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare type SwapTaskStructOutput = [
|
|
16
|
+
number,
|
|
17
|
+
string,
|
|
18
|
+
string,
|
|
19
|
+
string,
|
|
20
|
+
string[],
|
|
21
|
+
BigNumber,
|
|
22
|
+
BigNumber,
|
|
23
|
+
boolean
|
|
24
|
+
] & {
|
|
25
|
+
swapOperation: number;
|
|
26
|
+
creditAccount: string;
|
|
27
|
+
tokenIn: string;
|
|
28
|
+
tokenOut: string;
|
|
29
|
+
connectors: string[];
|
|
30
|
+
amount: BigNumber;
|
|
31
|
+
slippage: BigNumber;
|
|
32
|
+
externalSlippage: boolean;
|
|
33
|
+
};
|
|
34
|
+
export declare type MultiCallStruct = {
|
|
35
|
+
target: string;
|
|
36
|
+
callData: BytesLike;
|
|
37
|
+
};
|
|
38
|
+
export declare type MultiCallStructOutput = [string, string] & {
|
|
39
|
+
target: string;
|
|
40
|
+
callData: string;
|
|
41
|
+
};
|
|
42
|
+
export declare type SwapQuoteStruct = {
|
|
43
|
+
multiCall: MultiCallStruct;
|
|
44
|
+
amount: BigNumberish;
|
|
45
|
+
found: boolean;
|
|
46
|
+
gasUsage: BigNumberish;
|
|
47
|
+
};
|
|
48
|
+
export declare type SwapQuoteStructOutput = [
|
|
49
|
+
MultiCallStructOutput,
|
|
50
|
+
BigNumber,
|
|
51
|
+
boolean,
|
|
52
|
+
BigNumber
|
|
53
|
+
] & {
|
|
54
|
+
multiCall: MultiCallStructOutput;
|
|
55
|
+
amount: BigNumber;
|
|
56
|
+
found: boolean;
|
|
57
|
+
gasUsage: BigNumber;
|
|
58
|
+
};
|
|
59
|
+
export interface IWrapperInterface extends utils.Interface {
|
|
60
|
+
functions: {
|
|
61
|
+
"getComponentId()": FunctionFragment;
|
|
62
|
+
"unwrap((uint8,address,address,address,address[],uint256,uint256,bool),address)": FunctionFragment;
|
|
63
|
+
"unwrapsTo(address,address)": FunctionFragment;
|
|
64
|
+
"version()": FunctionFragment;
|
|
65
|
+
"wrap((uint8,address,address,address,address[],uint256,uint256,bool),address)": FunctionFragment;
|
|
66
|
+
"wrapsTo(address,address)": FunctionFragment;
|
|
67
|
+
};
|
|
68
|
+
getFunction(nameOrSignatureOrTopic: "getComponentId" | "unwrap" | "unwrapsTo" | "version" | "wrap" | "wrapsTo"): FunctionFragment;
|
|
69
|
+
encodeFunctionData(functionFragment: "getComponentId", values?: undefined): string;
|
|
70
|
+
encodeFunctionData(functionFragment: "unwrap", values: [SwapTaskStruct, string]): string;
|
|
71
|
+
encodeFunctionData(functionFragment: "unwrapsTo", values: [string, string]): string;
|
|
72
|
+
encodeFunctionData(functionFragment: "version", values?: undefined): string;
|
|
73
|
+
encodeFunctionData(functionFragment: "wrap", values: [SwapTaskStruct, string]): string;
|
|
74
|
+
encodeFunctionData(functionFragment: "wrapsTo", values: [string, string]): string;
|
|
75
|
+
decodeFunctionResult(functionFragment: "getComponentId", data: BytesLike): Result;
|
|
76
|
+
decodeFunctionResult(functionFragment: "unwrap", data: BytesLike): Result;
|
|
77
|
+
decodeFunctionResult(functionFragment: "unwrapsTo", data: BytesLike): Result;
|
|
78
|
+
decodeFunctionResult(functionFragment: "version", data: BytesLike): Result;
|
|
79
|
+
decodeFunctionResult(functionFragment: "wrap", data: BytesLike): Result;
|
|
80
|
+
decodeFunctionResult(functionFragment: "wrapsTo", data: BytesLike): Result;
|
|
81
|
+
events: {};
|
|
82
|
+
}
|
|
83
|
+
export interface IWrapper extends BaseContract {
|
|
84
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
85
|
+
attach(addressOrName: string): this;
|
|
86
|
+
deployed(): Promise<this>;
|
|
87
|
+
interface: IWrapperInterface;
|
|
88
|
+
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
|
|
89
|
+
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
|
|
90
|
+
listeners(eventName?: string): Array<Listener>;
|
|
91
|
+
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
|
|
92
|
+
removeAllListeners(eventName?: string): this;
|
|
93
|
+
off: OnEvent<this>;
|
|
94
|
+
on: OnEvent<this>;
|
|
95
|
+
once: OnEvent<this>;
|
|
96
|
+
removeListener: OnEvent<this>;
|
|
97
|
+
functions: {
|
|
98
|
+
getComponentId(overrides?: CallOverrides): Promise<[number]>;
|
|
99
|
+
unwrap(swapTask: SwapTaskStruct, adapter: string, overrides?: Overrides & {
|
|
100
|
+
from?: string | Promise<string>;
|
|
101
|
+
}): Promise<ContractTransaction>;
|
|
102
|
+
unwrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<[string]>;
|
|
103
|
+
version(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
104
|
+
wrap(swapTask: SwapTaskStruct, adapter: string, overrides?: Overrides & {
|
|
105
|
+
from?: string | Promise<string>;
|
|
106
|
+
}): Promise<ContractTransaction>;
|
|
107
|
+
wrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<[string]>;
|
|
108
|
+
};
|
|
109
|
+
getComponentId(overrides?: CallOverrides): Promise<number>;
|
|
110
|
+
unwrap(swapTask: SwapTaskStruct, adapter: string, overrides?: Overrides & {
|
|
111
|
+
from?: string | Promise<string>;
|
|
112
|
+
}): Promise<ContractTransaction>;
|
|
113
|
+
unwrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<string>;
|
|
114
|
+
version(overrides?: CallOverrides): Promise<BigNumber>;
|
|
115
|
+
wrap(swapTask: SwapTaskStruct, adapter: string, overrides?: Overrides & {
|
|
116
|
+
from?: string | Promise<string>;
|
|
117
|
+
}): Promise<ContractTransaction>;
|
|
118
|
+
wrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<string>;
|
|
119
|
+
callStatic: {
|
|
120
|
+
getComponentId(overrides?: CallOverrides): Promise<number>;
|
|
121
|
+
unwrap(swapTask: SwapTaskStruct, adapter: string, overrides?: CallOverrides): Promise<SwapQuoteStructOutput>;
|
|
122
|
+
unwrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<string>;
|
|
123
|
+
version(overrides?: CallOverrides): Promise<BigNumber>;
|
|
124
|
+
wrap(swapTask: SwapTaskStruct, adapter: string, overrides?: CallOverrides): Promise<SwapQuoteStructOutput>;
|
|
125
|
+
wrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<string>;
|
|
126
|
+
};
|
|
127
|
+
filters: {};
|
|
128
|
+
estimateGas: {
|
|
129
|
+
getComponentId(overrides?: CallOverrides): Promise<BigNumber>;
|
|
130
|
+
unwrap(swapTask: SwapTaskStruct, adapter: string, overrides?: Overrides & {
|
|
131
|
+
from?: string | Promise<string>;
|
|
132
|
+
}): Promise<BigNumber>;
|
|
133
|
+
unwrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
134
|
+
version(overrides?: CallOverrides): Promise<BigNumber>;
|
|
135
|
+
wrap(swapTask: SwapTaskStruct, adapter: string, overrides?: Overrides & {
|
|
136
|
+
from?: string | Promise<string>;
|
|
137
|
+
}): Promise<BigNumber>;
|
|
138
|
+
wrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
139
|
+
};
|
|
140
|
+
populateTransaction: {
|
|
141
|
+
getComponentId(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
142
|
+
unwrap(swapTask: SwapTaskStruct, adapter: string, overrides?: Overrides & {
|
|
143
|
+
from?: string | Promise<string>;
|
|
144
|
+
}): Promise<PopulatedTransaction>;
|
|
145
|
+
unwrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
146
|
+
version(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
147
|
+
wrap(swapTask: SwapTaskStruct, adapter: string, overrides?: Overrides & {
|
|
148
|
+
from?: string | Promise<string>;
|
|
149
|
+
}): Promise<PopulatedTransaction>;
|
|
150
|
+
wrapsTo(token: string, adapter: string, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
@@ -11,3 +11,4 @@ export type { IPathFinderComponent } from "./IPathFinderComponent";
|
|
|
11
11
|
export type { IPathResolver } from "./IPathResolver";
|
|
12
12
|
export type { ISwapAggregator } from "./ISwapAggregator";
|
|
13
13
|
export type { ISwapper } from "./ISwapper";
|
|
14
|
+
export type { IWrapper } from "./IWrapper";
|