@gearbox-protocol/sdk 1.5.2 → 1.5.5
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.
|
@@ -23,7 +23,7 @@ exports.contractsByNetwork = {
|
|
|
23
23
|
SUSHISWAP_ROUTER: "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F",
|
|
24
24
|
// CURVE
|
|
25
25
|
CURVE_3CRV_POOL: "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
|
|
26
|
-
CURVE_STETH_GATEWAY: "
|
|
26
|
+
CURVE_STETH_GATEWAY: "0xC9c612799C8c5F52a25d57ce24881A854d376E14",
|
|
27
27
|
CURVE_FRAX_POOL: token_1.tokenDataByNetwork.Mainnet.FRAX3CRV,
|
|
28
28
|
CURVE_LUSD_POOL: token_1.tokenDataByNetwork.Mainnet.LUSD3CRV,
|
|
29
29
|
CURVE_SUSD_POOL: "0xA5407eAE9Ba41422680e2e00537571bcC53efBfD",
|
package/lib/oracles/oracles.d.ts
CHANGED
|
@@ -378,56 +378,32 @@ exports.priceFeedsByNetwork = {
|
|
|
378
378
|
priceFeedETH: {
|
|
379
379
|
type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
|
|
380
380
|
token: "DAI",
|
|
381
|
-
address: {
|
|
382
|
-
Mainnet: "",
|
|
383
|
-
Goerli: "TODO: DEPLOY ME",
|
|
384
|
-
},
|
|
385
381
|
},
|
|
386
382
|
priceFeedUSD: {
|
|
387
383
|
type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
|
|
388
384
|
token: "DAI",
|
|
389
|
-
address: {
|
|
390
|
-
Mainnet: "",
|
|
391
|
-
Goerli: "TODO: DEPLOY ME",
|
|
392
|
-
},
|
|
393
385
|
},
|
|
394
386
|
},
|
|
395
387
|
yvUSDC: {
|
|
396
388
|
priceFeedETH: {
|
|
397
389
|
type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
|
|
398
390
|
token: "USDC",
|
|
399
|
-
address: {
|
|
400
|
-
Mainnet: "",
|
|
401
|
-
Goerli: "TODO: DEPLOY ME",
|
|
402
|
-
},
|
|
403
391
|
},
|
|
404
392
|
priceFeedUSD: {
|
|
405
393
|
type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
|
|
406
394
|
token: "USDC",
|
|
407
|
-
address: {
|
|
408
|
-
Mainnet: "",
|
|
409
|
-
Goerli: "TODO: DEPLOY ME",
|
|
410
|
-
},
|
|
411
395
|
},
|
|
412
396
|
},
|
|
413
397
|
yvWETH: {
|
|
414
398
|
priceFeedUSD: {
|
|
415
399
|
type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
|
|
416
400
|
token: "WETH",
|
|
417
|
-
address: {
|
|
418
|
-
Mainnet: "",
|
|
419
|
-
Goerli: "TODO: DEPLOY ME",
|
|
420
|
-
},
|
|
421
401
|
},
|
|
422
402
|
},
|
|
423
403
|
yvWBTC: {
|
|
424
404
|
priceFeedUSD: {
|
|
425
405
|
type: oracles_1.OracleType.YEARN_TOKEN_ORACLE,
|
|
426
406
|
token: "WBTC",
|
|
427
|
-
address: {
|
|
428
|
-
Mainnet: "",
|
|
429
|
-
Goerli: "TODO: DEPLOY ME",
|
|
430
|
-
},
|
|
431
407
|
},
|
|
432
408
|
},
|
|
433
409
|
// CURVE LP TOKENS
|
package/lib/parsers/txParser.js
CHANGED
|
@@ -43,12 +43,13 @@ var TxParser = /** @class */ (function () {
|
|
|
43
43
|
this.parsers[creditFacade.toLowerCase()] = new creditFacadeParser_1.CreditFacadeParser(underlying);
|
|
44
44
|
};
|
|
45
45
|
TxParser.addParser = function (address, contract, adapterType, isContract) {
|
|
46
|
+
var addressLC = address.toLowerCase();
|
|
46
47
|
switch (adapters_1.AdapterInterface[adapterType]) {
|
|
47
48
|
case "UNISWAP_V2_ROUTER":
|
|
48
|
-
TxParser.parsers[
|
|
49
|
+
TxParser.parsers[addressLC] = new uniV2AdapterParser_1.UniswapV2AdapterParser(contract, isContract);
|
|
49
50
|
break;
|
|
50
51
|
case "UNISWAP_V3_ROUTER":
|
|
51
|
-
TxParser.parsers[
|
|
52
|
+
TxParser.parsers[addressLC] = new uniV3AdapterParser_1.UniswapV3AdapterParser(contract, isContract);
|
|
52
53
|
break;
|
|
53
54
|
case "CURVE_V1_EXCHANGE_ONLY":
|
|
54
55
|
case "CURVE_V1_2ASSETS":
|
|
@@ -56,21 +57,21 @@ var TxParser = /** @class */ (function () {
|
|
|
56
57
|
case "CURVE_V1_4ASSETS":
|
|
57
58
|
case "CURVE_V1_STECRV_POOL":
|
|
58
59
|
case "CURVE_V1_WRAPPER":
|
|
59
|
-
TxParser.parsers[
|
|
60
|
+
TxParser.parsers[addressLC] = new curveAdapterParser_1.CurveAdapterParser(contract, isContract);
|
|
60
61
|
break;
|
|
61
62
|
case "YEARN_V2":
|
|
62
|
-
TxParser.parsers[
|
|
63
|
+
TxParser.parsers[addressLC] = new yearnV2AdapterParser_1.YearnV2AdapterParser(contract, isContract);
|
|
63
64
|
break;
|
|
64
65
|
case "CONVEX_V1_BASE_REWARD_POOL":
|
|
65
|
-
TxParser.parsers[
|
|
66
|
+
TxParser.parsers[addressLC] = new convexBaseRewardPoolAdapterParser_1.ConvexBaseRewardPoolAdapterParser(contract, isContract);
|
|
66
67
|
break;
|
|
67
68
|
case "CONVEX_V1_BOOSTER":
|
|
68
|
-
TxParser.parsers[
|
|
69
|
+
TxParser.parsers[addressLC] = new convexBoosterAdapterParser_1.ConvexBoosterAdapterParser(contract, isContract);
|
|
69
70
|
break;
|
|
70
71
|
case "CONVEX_V1_CLAIM_ZAP":
|
|
71
72
|
break;
|
|
72
73
|
case "LIDO_V1":
|
|
73
|
-
TxParser.parsers[
|
|
74
|
+
TxParser.parsers[addressLC] = new lidoAdapterParser_1.LidoAdapterParser(contract, isContract);
|
|
74
75
|
break;
|
|
75
76
|
}
|
|
76
77
|
};
|
|
@@ -17,6 +17,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.UniswapV3AdapterParser = void 0;
|
|
19
19
|
var types_1 = require("../types");
|
|
20
|
+
var formatter_1 = require("../utils/formatter");
|
|
20
21
|
var abstractParser_1 = require("./abstractParser");
|
|
21
22
|
var UniswapV3AdapterParser = /** @class */ (function (_super) {
|
|
22
23
|
__extends(UniswapV3AdapterParser, _super);
|
|
@@ -38,22 +39,33 @@ var UniswapV3AdapterParser = /** @class */ (function (_super) {
|
|
|
38
39
|
var amountOutMinimumStr = this.formatBN(amountOutMinimum, tokenOut);
|
|
39
40
|
return "".concat(functionName, "(amountIn: ").concat(amountInStr, ", amountOutMinimum: ").concat(amountOutMinimumStr, ", path: ").concat(tokenInSym, " ==(fee: ").concat(fee, ")==> ").concat(tokenOutSym, ")");
|
|
40
41
|
}
|
|
42
|
+
case "exactAllInputSingle": {
|
|
43
|
+
var _c = this.decodeFunctionData(functionFragment, calldata).params, tokenIn = _c.tokenIn, tokenOut = _c.tokenOut, fee = _c.fee, rateMinRAY = _c.rateMinRAY;
|
|
44
|
+
var tokenInSym = this.tokenSymbol(tokenIn);
|
|
45
|
+
var tokenOutSym = this.tokenSymbol(tokenOut);
|
|
46
|
+
return "".concat(functionName, "(rate: ").concat((0, formatter_1.formatBN)(rateMinRAY, 27), ", path: ").concat(tokenInSym, " ==(fee: ").concat(fee, ")==> ").concat(tokenOutSym, ")");
|
|
47
|
+
}
|
|
41
48
|
case "exactInput": {
|
|
42
|
-
var
|
|
49
|
+
var _d = this.decodeFunctionData(functionFragment, calldata).params, amountIn = _d.amountIn, amountOutMinimum = _d.amountOutMinimum, path = _d.path;
|
|
43
50
|
var pathStr = this.trackInputPath(path);
|
|
44
51
|
var amountInStr = this.formatBN(amountIn, this.tokenSymbol("0x".concat(path.replace("0x", "").slice(0, 40))));
|
|
45
52
|
var amountOutMinimumStr = this.formatBN(amountOutMinimum, this.tokenSymbol("0x".concat(path.slice(-40, path.length))));
|
|
46
53
|
return "".concat(functionName, "(amountIn: ").concat(amountInStr, ", amountOutMinimum: ").concat(amountOutMinimumStr, ", path: ").concat(pathStr);
|
|
47
54
|
}
|
|
55
|
+
case "exactAllInput": {
|
|
56
|
+
var _e = this.decodeFunctionData(functionFragment, calldata).params, rateMinRAY = _e.rateMinRAY, path = _e.path;
|
|
57
|
+
var pathStr = this.trackInputPath(path);
|
|
58
|
+
return "".concat(functionName, "(rate: ").concat((0, formatter_1.formatBN)(rateMinRAY, 27), ", path: ").concat(pathStr);
|
|
59
|
+
}
|
|
48
60
|
case "exactOutput": {
|
|
49
|
-
var
|
|
61
|
+
var _f = this.decodeFunctionData(functionFragment, calldata).params, amountInMaximum = _f.amountInMaximum, amountOut = _f.amountOut, path = _f.path;
|
|
50
62
|
var pathStr = this.trackOutputPath(path);
|
|
51
63
|
var amountInMaximumStr = this.formatBN(amountInMaximum, this.tokenSymbol("0x".concat(path.slice(-40, path.length))));
|
|
52
64
|
var amountOutStr = this.formatBN(amountOut, this.tokenSymbol("0x".concat(path.replace("0x", "").slice(0, 40))));
|
|
53
65
|
return "".concat(functionName, "(amountInMaximum: ").concat(amountInMaximumStr, ", amountOut: ").concat(amountOutStr, ", path: ").concat(pathStr);
|
|
54
66
|
}
|
|
55
67
|
case "exactOutputSingle": {
|
|
56
|
-
var
|
|
68
|
+
var _g = this.decodeFunctionData(functionFragment, calldata)[0], tokenIn = _g[0], tokenOut = _g[1], fee = _g[2], amountOut = _g[5], amountInMaximum = _g[6];
|
|
57
69
|
var tokenInSym = this.tokenSymbol(tokenIn);
|
|
58
70
|
var tokenOutSym = this.tokenSymbol(tokenOut);
|
|
59
71
|
var amountInMaximumStr = this.formatBN(amountInMaximum, tokenInSym);
|
|
@@ -37,6 +37,17 @@ describe("UniswapV3AdapterParser test", function () {
|
|
|
37
37
|
},
|
|
38
38
|
]));
|
|
39
39
|
(0, chai_1.expect)(parsed).to.be.eq("UniswapV3Adapter[UNISWAP_V3_ROUTER].exactInputSingle(amountIn: 1.29M [1299000000000000000000000], amountOutMinimum: 10.20K [10200000000000000000000], path: 1INCH ==(fee: 3000)==> 3Crv)", "Incorrect parse swapExactTokensForTokens");
|
|
40
|
+
parsed = parser.parse(ifc.encodeFunctionData("exactAllInputSingle", [
|
|
41
|
+
{
|
|
42
|
+
tokenIn: token_1.tokenDataByNetwork.Goerli["1INCH"],
|
|
43
|
+
tokenOut: token_1.tokenDataByNetwork.Goerli["3Crv"],
|
|
44
|
+
fee: 3000,
|
|
45
|
+
deadline: 12300,
|
|
46
|
+
rateMinRAY: constants_1.RAY.mul(1200),
|
|
47
|
+
sqrtPriceLimitX96: 0,
|
|
48
|
+
},
|
|
49
|
+
]));
|
|
50
|
+
(0, chai_1.expect)(parsed).to.be.eq("UniswapV3Adapter[UNISWAP_V3_ROUTER].exactAllInputSingle(rate: 1.20K, path: 1INCH ==(fee: 3000)==> 3Crv)", "Incorrect parse swapExactTokensForTokens");
|
|
40
51
|
parsed = parser.parse(ifc.encodeFunctionData("exactInput", [
|
|
41
52
|
{
|
|
42
53
|
path: pathToUniV3Path([
|
|
@@ -51,6 +62,18 @@ describe("UniswapV3AdapterParser test", function () {
|
|
|
51
62
|
},
|
|
52
63
|
]));
|
|
53
64
|
(0, chai_1.expect)(parsed).to.be.eq("UniswapV3Adapter[UNISWAP_V3_ROUTER].exactInput(amountIn: 12.39K [12399000000000000000000], amountOutMinimum: 122.00 [122000000], path: AAVE ==(fee: 3000)==> LINK ==(fee: 3000)==> USDC", "Incorrect parse swapExactTokensForTokens");
|
|
65
|
+
parsed = parser.parse(ifc.encodeFunctionData("exactAllInput", [
|
|
66
|
+
{
|
|
67
|
+
path: pathToUniV3Path([
|
|
68
|
+
token_1.tokenDataByNetwork.Mainnet.AAVE,
|
|
69
|
+
token_1.tokenDataByNetwork.Mainnet.LINK,
|
|
70
|
+
token_1.tokenDataByNetwork.Mainnet.USDC,
|
|
71
|
+
]),
|
|
72
|
+
rateMinRAY: constants_1.RAY.mul(1200),
|
|
73
|
+
deadline: 1232131,
|
|
74
|
+
},
|
|
75
|
+
]));
|
|
76
|
+
(0, chai_1.expect)(parsed).to.be.eq("UniswapV3Adapter[UNISWAP_V3_ROUTER].exactAllInput(rate: 1.20K, path: AAVE ==(fee: 3000)==> LINK ==(fee: 3000)==> USDC", "Incorrect parse swapExactTokensForTokens");
|
|
54
77
|
parsed = parser.parse(ifc.encodeFunctionData("exactOutputSingle", [
|
|
55
78
|
{
|
|
56
79
|
tokenIn: token_1.tokenDataByNetwork.Goerli["1INCH"],
|