@gearbox-protocol/sdk 1.15.11 → 1.15.12
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/pathfinder/pathfinder.js +14 -6
- package/package.json +1 -1
|
@@ -42,8 +42,8 @@ var constants_1 = require("../core/constants");
|
|
|
42
42
|
var token_1 = require("../tokens/token");
|
|
43
43
|
var types_1 = require("../types");
|
|
44
44
|
var pathOptions_1 = require("./pathOptions");
|
|
45
|
-
var MAX_GAS_PER_ROUTE =
|
|
46
|
-
var GAS_PER_BLOCK =
|
|
45
|
+
var MAX_GAS_PER_ROUTE = 200e6;
|
|
46
|
+
var GAS_PER_BLOCK = 400e6;
|
|
47
47
|
var PathFinder = /** @class */ (function () {
|
|
48
48
|
function PathFinder(address, provider, network, connectors) {
|
|
49
49
|
if (network === void 0) { network = "Mainnet"; }
|
|
@@ -69,7 +69,9 @@ var PathFinder = /** @class */ (function () {
|
|
|
69
69
|
slippage: slippage,
|
|
70
70
|
externalSlippage: false,
|
|
71
71
|
};
|
|
72
|
-
return [4 /*yield*/, this.pathFinder.callStatic.findAllSwaps(swapTask
|
|
72
|
+
return [4 /*yield*/, this.pathFinder.callStatic.findAllSwaps(swapTask, {
|
|
73
|
+
gasLimit: GAS_PER_BLOCK,
|
|
74
|
+
})];
|
|
73
75
|
case 1:
|
|
74
76
|
results = _a.sent();
|
|
75
77
|
unique = {};
|
|
@@ -94,7 +96,9 @@ var PathFinder = /** @class */ (function () {
|
|
|
94
96
|
switch (_a.label) {
|
|
95
97
|
case 0:
|
|
96
98
|
tokenInAddr = token_1.tokenDataByNetwork[this.network][tokenIn] || tokenIn;
|
|
97
|
-
return [4 /*yield*/, this.pathFinder.callStatic.findOneTokenPath(tokenInAddr, amount, token_1.tokenDataByNetwork[this.network][tokenOut] || tokenOut, creditAccount.addr, this._connectors, slippage
|
|
99
|
+
return [4 /*yield*/, this.pathFinder.callStatic.findOneTokenPath(tokenInAddr, amount, token_1.tokenDataByNetwork[this.network][tokenOut] || tokenOut, creditAccount.addr, this._connectors, slippage, {
|
|
100
|
+
gasLimit: GAS_PER_BLOCK,
|
|
101
|
+
})];
|
|
98
102
|
case 1:
|
|
99
103
|
result = _a.sent();
|
|
100
104
|
return [2 /*return*/, {
|
|
@@ -134,7 +138,9 @@ var PathFinder = /** @class */ (function () {
|
|
|
134
138
|
token: token,
|
|
135
139
|
balance: expectedBalancesAddr[token] || 0,
|
|
136
140
|
}); });
|
|
137
|
-
return [4 /*yield*/, this.pathFinder.callStatic.findOpenStrategyPath(cm.address, balances, targetAddr, this._connectors, slippage
|
|
141
|
+
return [4 /*yield*/, this.pathFinder.callStatic.findOpenStrategyPath(cm.address, balances, targetAddr, this._connectors, slippage, {
|
|
142
|
+
gasLimit: GAS_PER_BLOCK,
|
|
143
|
+
})];
|
|
138
144
|
case 1:
|
|
139
145
|
result = _a.sent();
|
|
140
146
|
balancesAfter = result[0].reduce(function (acc, b) {
|
|
@@ -168,7 +174,9 @@ var PathFinder = /** @class */ (function () {
|
|
|
168
174
|
loopsPerTx = Math.floor(GAS_PER_BLOCK / MAX_GAS_PER_ROUTE);
|
|
169
175
|
pathOptions = pathOptions_1.PathOptionFactory.generatePathOptions(creditAccount.allBalances, loopsPerTx);
|
|
170
176
|
requests = pathOptions.map(function (po) {
|
|
171
|
-
return _this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, _this._connectors, slippage, po, loopsPerTx, false
|
|
177
|
+
return _this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, _this._connectors, slippage, po, loopsPerTx, false, {
|
|
178
|
+
gasLimit: GAS_PER_BLOCK,
|
|
179
|
+
});
|
|
172
180
|
});
|
|
173
181
|
return [4 /*yield*/, Promise.all(requests)];
|
|
174
182
|
case 1:
|