@gearbox-protocol/sdk 3.0.0-next.32 → 3.0.0-next.34

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.
@@ -45,4 +45,7 @@ import {ICurveV1_3AssetsAdapter} from
45
45
  import {ICurveV1_4AssetsAdapter} from
46
46
  "@gearbox-protocol/integrations-v3/contracts/interfaces/curve/ICurveV1_4AssetsAdapter.sol";
47
47
 
48
+ import {IRouter} from
49
+ "@gearbox-protocol/router-v3/contracts/interfaces/IRouter.sol";
50
+
48
51
  import {IOffchainOracle} from "./IOffchainOracle.sol";
@@ -41,8 +41,9 @@ class CreditFacadeParser extends abstractParser_1.AbstractParser {
41
41
  const [balances] = this.decodeFunctionData(functionFragment, calldata);
42
42
  const balancesStr = balances
43
43
  .map(b => {
44
+ const balance = "balance" in b ? b.balance : b.amount;
44
45
  const symbol = this.tokenSymbol(b.token);
45
- return `${symbol}: ${this.formatBN(b.balance, symbol)}`;
46
+ return `${symbol}: ${this.formatBN(balance, symbol)}`;
46
47
  })
47
48
  .join(", ");
48
49
  return `${functionName}(${balancesStr})`;
@@ -1,5 +1,5 @@
1
1
  import { ExcludeArrayProps } from "@gearbox-protocol/sdk-gov";
2
- import { MultiCallStructOutput, SwapTaskStructOutput } from "../types/IRouter";
2
+ import { MultiCallStructOutput, SwapTaskStructOutput } from "../types/interfaces/IRouter";
3
3
  export declare enum SwapOperation {
4
4
  EXACT_INPUT = 0,
5
5
  EXACT_INPUT_ALL = 1,
@@ -13,7 +13,7 @@ class PathFinder {
13
13
  static connectors = [
14
14
  "USDC",
15
15
  "WETH",
16
- "DAI",
16
+ "USDT",
17
17
  "FRAX",
18
18
  ];
19
19
  _connectors;
@@ -28,11 +28,13 @@ describe("PathFinder test", () => {
28
28
  [sdk_gov_1.tokenDataByNetwork.Mainnet.WETH.toLowerCase()]: true,
29
29
  [sdk_gov_1.tokenDataByNetwork.Mainnet.DAI.toLowerCase()]: true,
30
30
  [sdk_gov_1.tokenDataByNetwork.Mainnet.FRAX.toLowerCase()]: true,
31
+ [sdk_gov_1.tokenDataByNetwork.Mainnet.USDT.toLowerCase()]: true,
31
32
  };
32
33
  (0, chai_1.expect)(pf.getAvailableConnectors(allowedTokens)).to.be.deep.equal([
33
34
  sdk_gov_1.tokenDataByNetwork.Mainnet.USDC.toLowerCase(),
34
35
  sdk_gov_1.tokenDataByNetwork.Mainnet.WETH.toLowerCase(),
35
- sdk_gov_1.tokenDataByNetwork.Mainnet.DAI.toLowerCase(),
36
+ // tokenDataByNetwork.Mainnet.DAI.toLowerCase(),
37
+ sdk_gov_1.tokenDataByNetwork.Mainnet.USDT.toLowerCase(),
36
38
  sdk_gov_1.tokenDataByNetwork.Mainnet.FRAX.toLowerCase(),
37
39
  ]);
38
40
  });
@@ -0,0 +1,44 @@
1
+ import type { BaseContract, BigNumber, BytesLike, CallOverrides, 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 IGasPricerInterface extends utils.Interface {
6
+ functions: {
7
+ "getGasPriceTokenOutRAY(address)": FunctionFragment;
8
+ };
9
+ getFunction(nameOrSignatureOrTopic: "getGasPriceTokenOutRAY"): FunctionFragment;
10
+ encodeFunctionData(functionFragment: "getGasPriceTokenOutRAY", values: [PromiseOrValue<string>]): string;
11
+ decodeFunctionResult(functionFragment: "getGasPriceTokenOutRAY", data: BytesLike): Result;
12
+ events: {};
13
+ }
14
+ export interface IGasPricer extends BaseContract {
15
+ connect(signerOrProvider: Signer | Provider | string): this;
16
+ attach(addressOrName: string): this;
17
+ deployed(): Promise<this>;
18
+ interface: IGasPricerInterface;
19
+ queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
20
+ listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
21
+ listeners(eventName?: string): Array<Listener>;
22
+ removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
23
+ removeAllListeners(eventName?: string): this;
24
+ off: OnEvent<this>;
25
+ on: OnEvent<this>;
26
+ once: OnEvent<this>;
27
+ removeListener: OnEvent<this>;
28
+ functions: {
29
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber] & {
30
+ gasPrice: BigNumber;
31
+ }>;
32
+ };
33
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
34
+ callStatic: {
35
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
36
+ };
37
+ filters: {};
38
+ estimateGas: {
39
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
40
+ };
41
+ populateTransaction: {
42
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
43
+ };
44
+ }
@@ -0,0 +1,22 @@
1
+ import { Signer } from "ethers";
2
+ import type { Provider } from "@ethersproject/providers";
3
+ import type { IGasPricer, IGasPricerInterface } from "../IGasPricer";
4
+ export declare class IGasPricer__factory {
5
+ static readonly abi: readonly [{
6
+ readonly inputs: readonly [{
7
+ readonly internalType: "address";
8
+ readonly name: "token";
9
+ readonly type: "address";
10
+ }];
11
+ readonly name: "getGasPriceTokenOutRAY";
12
+ readonly outputs: readonly [{
13
+ readonly internalType: "uint256";
14
+ readonly name: "gasPrice";
15
+ readonly type: "uint256";
16
+ }];
17
+ readonly stateMutability: "view";
18
+ readonly type: "function";
19
+ }];
20
+ static createInterface(): IGasPricerInterface;
21
+ static connect(address: string, signerOrProvider: Signer | Provider): IGasPricer;
22
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /* Autogenerated file. Do not edit manually. */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IGasPricer__factory = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const _abi = [
9
+ {
10
+ inputs: [
11
+ {
12
+ internalType: "address",
13
+ name: "token",
14
+ type: "address",
15
+ },
16
+ ],
17
+ name: "getGasPriceTokenOutRAY",
18
+ outputs: [
19
+ {
20
+ internalType: "uint256",
21
+ name: "gasPrice",
22
+ type: "uint256",
23
+ },
24
+ ],
25
+ stateMutability: "view",
26
+ type: "function",
27
+ },
28
+ ];
29
+ class IGasPricer__factory {
30
+ static abi = _abi;
31
+ static createInterface() {
32
+ return new ethers_1.utils.Interface(_abi);
33
+ }
34
+ static connect(address, signerOrProvider) {
35
+ return new ethers_1.Contract(address, _abi, signerOrProvider);
36
+ }
37
+ }
38
+ exports.IGasPricer__factory = IGasPricer__factory;
@@ -22,6 +22,7 @@ export * as iWithdrawalManagerV3Sol from "./IWithdrawalManagerV3.sol";
22
22
  export * as istEthSol from "./IstETH.sol";
23
23
  export * as iwstEthSol from "./IwstETH.sol";
24
24
  export * as iwstEthGatewaySol from "./IwstETHGateway.sol";
25
+ export * as interfaces from "./interfaces";
25
26
  export { AddressProvider__factory } from "./AddressProvider__factory";
26
27
  export { Claimable__factory } from "./Claimable__factory";
27
28
  export { Errors__factory } from "./Errors__factory";
@@ -42,12 +43,12 @@ export { IERC20__factory } from "./IERC20__factory";
42
43
  export { IERC20Metadata__factory } from "./IERC20Metadata__factory";
43
44
  export { IERC20Permit__factory } from "./IERC20Permit__factory";
44
45
  export { IERC4626__factory } from "./IERC4626__factory";
46
+ export { IGasPricer__factory } from "./IGasPricer__factory";
45
47
  export { IInterestRateModel__factory } from "./IInterestRateModel__factory";
46
48
  export { ILidoV1Adapter__factory } from "./ILidoV1Adapter__factory";
47
49
  export { IOffchainOracle__factory } from "./IOffchainOracle__factory";
48
50
  export { IPermit2__factory } from "./IPermit2__factory";
49
51
  export { IPriceOracleBase__factory } from "./IPriceOracleBase__factory";
50
- export { IRouter__factory } from "./IRouter__factory";
51
52
  export { IVersion__factory } from "./IVersion__factory";
52
53
  export { IWERC20Zapper__factory } from "./IWERC20Zapper__factory";
53
54
  export { IWETH__factory } from "./IWETH__factory";
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.IRouter__factory = exports.IPriceOracleBase__factory = exports.IPermit2__factory = exports.IOffchainOracle__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IERC4626__factory = exports.IERC20Permit__factory = exports.IERC20Metadata__factory = exports.IERC20__factory = exports.IDataCompressorV3_00__factory = exports.IDataCompressorV2_10__factory = exports.IDaiLikePermit__factory = exports.ICurveV1_4AssetsAdapter__factory = exports.ICurveV1_3AssetsAdapter__factory = exports.ICurveV1_2AssetsAdapter__factory = exports.ICurveV1Adapter__factory = exports.ICurvePool__factory = exports.ICreditFacadeV3Multicall__factory = exports.IConvexV1BaseRewardPoolAdapter__factory = exports.IConvexToken__factory = exports.IBaseRewardPool__factory = exports.IAdapter__factory = exports.Errors__factory = exports.Claimable__factory = exports.AddressProvider__factory = exports.iwstEthGatewaySol = exports.iwstEthSol = exports.istEthSol = exports.iWithdrawalManagerV3Sol = exports.iUniswapV3AdapterSol = exports.iUniswapV3Sol = exports.iUniswapV2AdapterSol = exports.iPoolV3Sol = exports.iPoolServiceSol = exports.iDegenDistributorSol = exports.iCurvePool4Sol = exports.iCurvePool3Sol = exports.iCurvePool2Sol = exports.iCreditManagerV3Sol = exports.iCreditManagerV2Sol = exports.iCreditFacadeV3Sol = exports.iCreditFacadeV2Sol = exports.iCreditConfiguratorV3Sol = exports.iCreditConfiguratorV2Sol = exports.iConvexV1BoosterAdapterSol = exports.iAirdropDistributorSol = exports.iAddressProviderV3Sol = exports.iAddressProviderSol = exports.balancesSol = void 0;
27
- exports.SafeERC20__factory = exports.Ownable__factory = exports.IwstETHV1Adapter__factory = exports.IZapper__factory = exports.IYearnV2Adapter__factory = exports.IYVault__factory = exports.IWETHZapper__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IWERC20Zapper__factory = exports.IVersion__factory = void 0;
26
+ exports.IPermit2__factory = exports.IOffchainOracle__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IGasPricer__factory = exports.IERC4626__factory = exports.IERC20Permit__factory = exports.IERC20Metadata__factory = exports.IERC20__factory = exports.IDataCompressorV3_00__factory = exports.IDataCompressorV2_10__factory = exports.IDaiLikePermit__factory = exports.ICurveV1_4AssetsAdapter__factory = exports.ICurveV1_3AssetsAdapter__factory = exports.ICurveV1_2AssetsAdapter__factory = exports.ICurveV1Adapter__factory = exports.ICurvePool__factory = exports.ICreditFacadeV3Multicall__factory = exports.IConvexV1BaseRewardPoolAdapter__factory = exports.IConvexToken__factory = exports.IBaseRewardPool__factory = exports.IAdapter__factory = exports.Errors__factory = exports.Claimable__factory = exports.AddressProvider__factory = exports.interfaces = exports.iwstEthGatewaySol = exports.iwstEthSol = exports.istEthSol = exports.iWithdrawalManagerV3Sol = exports.iUniswapV3AdapterSol = exports.iUniswapV3Sol = exports.iUniswapV2AdapterSol = exports.iPoolV3Sol = exports.iPoolServiceSol = exports.iDegenDistributorSol = exports.iCurvePool4Sol = exports.iCurvePool3Sol = exports.iCurvePool2Sol = exports.iCreditManagerV3Sol = exports.iCreditManagerV2Sol = exports.iCreditFacadeV3Sol = exports.iCreditFacadeV2Sol = exports.iCreditConfiguratorV3Sol = exports.iCreditConfiguratorV2Sol = exports.iConvexV1BoosterAdapterSol = exports.iAirdropDistributorSol = exports.iAddressProviderV3Sol = exports.iAddressProviderSol = exports.balancesSol = void 0;
27
+ exports.SafeERC20__factory = exports.Ownable__factory = exports.IwstETHV1Adapter__factory = exports.IZapper__factory = exports.IYearnV2Adapter__factory = exports.IYVault__factory = exports.IWETHZapper__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IWERC20Zapper__factory = exports.IVersion__factory = exports.IPriceOracleBase__factory = void 0;
28
28
  /* Autogenerated file. Do not edit manually. */
29
29
  /* tslint:disable */
30
30
  /* eslint-disable */
@@ -52,6 +52,7 @@ exports.iWithdrawalManagerV3Sol = __importStar(require("./IWithdrawalManagerV3.s
52
52
  exports.istEthSol = __importStar(require("./IstETH.sol"));
53
53
  exports.iwstEthSol = __importStar(require("./IwstETH.sol"));
54
54
  exports.iwstEthGatewaySol = __importStar(require("./IwstETHGateway.sol"));
55
+ exports.interfaces = __importStar(require("./interfaces"));
55
56
  var AddressProvider__factory_1 = require("./AddressProvider__factory");
56
57
  Object.defineProperty(exports, "AddressProvider__factory", { enumerable: true, get: function () { return AddressProvider__factory_1.AddressProvider__factory; } });
57
58
  var Claimable__factory_1 = require("./Claimable__factory");
@@ -92,6 +93,8 @@ var IERC20Permit__factory_1 = require("./IERC20Permit__factory");
92
93
  Object.defineProperty(exports, "IERC20Permit__factory", { enumerable: true, get: function () { return IERC20Permit__factory_1.IERC20Permit__factory; } });
93
94
  var IERC4626__factory_1 = require("./IERC4626__factory");
94
95
  Object.defineProperty(exports, "IERC4626__factory", { enumerable: true, get: function () { return IERC4626__factory_1.IERC4626__factory; } });
96
+ var IGasPricer__factory_1 = require("./IGasPricer__factory");
97
+ Object.defineProperty(exports, "IGasPricer__factory", { enumerable: true, get: function () { return IGasPricer__factory_1.IGasPricer__factory; } });
95
98
  var IInterestRateModel__factory_1 = require("./IInterestRateModel__factory");
96
99
  Object.defineProperty(exports, "IInterestRateModel__factory", { enumerable: true, get: function () { return IInterestRateModel__factory_1.IInterestRateModel__factory; } });
97
100
  var ILidoV1Adapter__factory_1 = require("./ILidoV1Adapter__factory");
@@ -102,8 +105,6 @@ var IPermit2__factory_1 = require("./IPermit2__factory");
102
105
  Object.defineProperty(exports, "IPermit2__factory", { enumerable: true, get: function () { return IPermit2__factory_1.IPermit2__factory; } });
103
106
  var IPriceOracleBase__factory_1 = require("./IPriceOracleBase__factory");
104
107
  Object.defineProperty(exports, "IPriceOracleBase__factory", { enumerable: true, get: function () { return IPriceOracleBase__factory_1.IPriceOracleBase__factory; } });
105
- var IRouter__factory_1 = require("./IRouter__factory");
106
- Object.defineProperty(exports, "IRouter__factory", { enumerable: true, get: function () { return IRouter__factory_1.IRouter__factory; } });
107
108
  var IVersion__factory_1 = require("./IVersion__factory");
108
109
  Object.defineProperty(exports, "IVersion__factory", { enumerable: true, get: function () { return IVersion__factory_1.IVersion__factory; } });
109
110
  var IWERC20Zapper__factory_1 = require("./IWERC20Zapper__factory");
@@ -1,6 +1,6 @@
1
1
  import { Signer } from "ethers";
2
2
  import type { Provider } from "@ethersproject/providers";
3
- import type { IRouter, IRouterInterface } from "../IRouter";
3
+ import type { IRouter, IRouterInterface } from "../../interfaces/IRouter";
4
4
  export declare class IRouter__factory {
5
5
  static readonly abi: readonly [{
6
6
  readonly anonymous: false;
@@ -338,6 +338,20 @@ export declare class IRouter__factory {
338
338
  }];
339
339
  readonly stateMutability: "nonpayable";
340
340
  readonly type: "function";
341
+ }, {
342
+ readonly inputs: readonly [{
343
+ readonly internalType: "address";
344
+ readonly name: "token";
345
+ readonly type: "address";
346
+ }];
347
+ readonly name: "getGasPriceTokenOutRAY";
348
+ readonly outputs: readonly [{
349
+ readonly internalType: "uint256";
350
+ readonly name: "gasPrice";
351
+ readonly type: "uint256";
352
+ }];
353
+ readonly stateMutability: "view";
354
+ readonly type: "function";
341
355
  }, {
342
356
  readonly inputs: readonly [{
343
357
  readonly internalType: "address";
@@ -443,6 +443,25 @@ const _abi = [
443
443
  stateMutability: "nonpayable",
444
444
  type: "function",
445
445
  },
446
+ {
447
+ inputs: [
448
+ {
449
+ internalType: "address",
450
+ name: "token",
451
+ type: "address",
452
+ },
453
+ ],
454
+ name: "getGasPriceTokenOutRAY",
455
+ outputs: [
456
+ {
457
+ internalType: "uint256",
458
+ name: "gasPrice",
459
+ type: "uint256",
460
+ },
461
+ ],
462
+ stateMutability: "view",
463
+ type: "function",
464
+ },
446
465
  {
447
466
  inputs: [
448
467
  {
@@ -0,0 +1 @@
1
+ export { IRouter__factory } from "./IRouter__factory";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IRouter__factory = void 0;
4
+ /* Autogenerated file. Do not edit manually. */
5
+ /* tslint:disable */
6
+ /* eslint-disable */
7
+ var IRouter__factory_1 = require("./IRouter__factory");
8
+ Object.defineProperty(exports, "IRouter__factory", { enumerable: true, get: function () { return IRouter__factory_1.IRouter__factory; } });
@@ -46,6 +46,8 @@ import type * as iwstEthSol from "./IwstETH.sol";
46
46
  export type { iwstEthSol };
47
47
  import type * as iwstEthGatewaySol from "./IwstETHGateway.sol";
48
48
  export type { iwstEthGatewaySol };
49
+ import type * as interfaces from "./interfaces";
50
+ export type { interfaces };
49
51
  export type { AddressProvider } from "./AddressProvider";
50
52
  export type { Claimable } from "./Claimable";
51
53
  export type { Errors } from "./Errors";
@@ -66,12 +68,12 @@ export type { IERC20 } from "./IERC20";
66
68
  export type { IERC20Metadata } from "./IERC20Metadata";
67
69
  export type { IERC20Permit } from "./IERC20Permit";
68
70
  export type { IERC4626 } from "./IERC4626";
71
+ export type { IGasPricer } from "./IGasPricer";
69
72
  export type { IInterestRateModel } from "./IInterestRateModel";
70
73
  export type { ILidoV1Adapter } from "./ILidoV1Adapter";
71
74
  export type { IOffchainOracle } from "./IOffchainOracle";
72
75
  export type { IPermit2 } from "./IPermit2";
73
76
  export type { IPriceOracleBase } from "./IPriceOracleBase";
74
- export type { IRouter } from "./IRouter";
75
77
  export type { IVersion } from "./IVersion";
76
78
  export type { IWERC20Zapper } from "./IWERC20Zapper";
77
79
  export type { IWETH } from "./IWETH";
@@ -166,8 +168,11 @@ export { IERC20__factory } from "./factories/IERC20__factory";
166
168
  export { IERC20Metadata__factory } from "./factories/IERC20Metadata__factory";
167
169
  export { IERC20Permit__factory } from "./factories/IERC20Permit__factory";
168
170
  export { IERC4626__factory } from "./factories/IERC4626__factory";
171
+ export { IGasPricer__factory } from "./factories/IGasPricer__factory";
169
172
  export { IInterestRateModel__factory } from "./factories/IInterestRateModel__factory";
170
173
  export { ILidoV1Adapter__factory } from "./factories/ILidoV1Adapter__factory";
174
+ export type { IRouter } from "./interfaces/IRouter";
175
+ export { IRouter__factory } from "./factories/interfaces/IRouter__factory";
171
176
  export { IOffchainOracle__factory } from "./factories/IOffchainOracle__factory";
172
177
  export { IPermit2__factory } from "./factories/IPermit2__factory";
173
178
  export type { IPoolService } from "./IPoolService.sol/IPoolService";
@@ -179,7 +184,6 @@ export { IPoolV3__factory } from "./factories/IPoolV3.sol/IPoolV3__factory";
179
184
  export type { IPoolV3Events } from "./IPoolV3.sol/IPoolV3Events";
180
185
  export { IPoolV3Events__factory } from "./factories/IPoolV3.sol/IPoolV3Events__factory";
181
186
  export { IPriceOracleBase__factory } from "./factories/IPriceOracleBase__factory";
182
- export { IRouter__factory } from "./factories/IRouter__factory";
183
187
  export type { IstETH } from "./IstETH.sol/IstETH";
184
188
  export { IstETH__factory } from "./factories/IstETH.sol/IstETH__factory";
185
189
  export type { IstETHGetters } from "./IstETH.sol/IstETHGetters";
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.IERC20Metadata__factory = exports.IERC20__factory = exports.IDegenDistributorEvents__factory = exports.IDegenDistributor__factory = exports.IDataCompressorV3_00__factory = exports.IDataCompressorV2_10__factory = exports.IDaiLikePermit__factory = exports.ICurveV1Adapter__factory = exports.ICurveV1_4AssetsAdapter__factory = exports.ICurveV1_3AssetsAdapter__factory = exports.ICurveV1_2AssetsAdapter__factory = exports.ICurvePool__factory = exports.ICurvePool4Assets__factory = exports.ICurvePool3Assets__factory = exports.ICurvePool2Assets__factory = exports.ICreditManagerV3Events__factory = exports.ICreditManagerV3__factory = exports.ICreditManagerV2Exceptions__factory = exports.ICreditManagerV2Events__factory = exports.ICreditManagerV2__factory = exports.ICreditFacadeV3Multicall__factory = exports.ICreditFacadeV3Events__factory = exports.ICreditFacadeV3__factory = exports.ICreditFacadeV2V2__factory = exports.ICreditFacadeV2Extended__factory = exports.ICreditFacadeV2Exceptions__factory = exports.ICreditFacadeV2Events__factory = exports.ICreditFacadeV2__factory = exports.ICreditConfiguratorV3Events__factory = exports.ICreditConfiguratorV3__factory = exports.ICreditConfiguratorV2Exceptions__factory = exports.ICreditConfiguratorV2Events__factory = exports.ICreditConfiguratorV2__factory = exports.IConvexV1BoosterAdapterEvents__factory = exports.IConvexV1BoosterAdapter__factory = exports.IConvexV1BaseRewardPoolAdapter__factory = exports.IConvexToken__factory = exports.IBaseRewardPool__factory = exports.IAirdropDistributorEvents__factory = exports.IAirdropDistributor__factory = exports.IAddressProviderV3Events__factory = exports.IAddressProviderV3__factory = exports.IAddressProviderEvents__factory = exports.IAddressProvider__factory = exports.IAdapter__factory = exports.Errors__factory = exports.Claimable__factory = exports.BalanceOps__factory = exports.AddressProvider__factory = exports.factories = void 0;
27
- exports.SafeERC20__factory = exports.Ownable__factory = exports.IZapper__factory = exports.IYVault__factory = exports.IYearnV2Adapter__factory = exports.IwstETHV1Adapter__factory = exports.IwstETHGateWay__factory = exports.IwstETHGetters__factory = exports.IwstETH__factory = exports.IWithdrawalManagerV3Events__factory = exports.IWithdrawalManagerV3__factory = exports.IWETHZapper__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IWERC20Zapper__factory = exports.IVersion__factory = exports.IUniswapV3AdapterExceptions__factory = exports.IUniswapV3AdapterEvents__factory = exports.IUniswapV3Adapter__factory = exports.ISwapRouter__factory = exports.IUniswapV2AdapterExceptions__factory = exports.IUniswapV2AdapterEvents__factory = exports.IUniswapV2Adapter__factory = exports.IstETHGetters__factory = exports.IstETH__factory = exports.IRouter__factory = exports.IPriceOracleBase__factory = exports.IPoolV3Events__factory = exports.IPoolV3__factory = exports.IPoolServiceEvents__factory = exports.IPoolService__factory = exports.IPermit2__factory = exports.IOffchainOracle__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IERC4626__factory = exports.IERC20Permit__factory = void 0;
27
+ exports.SafeERC20__factory = exports.Ownable__factory = exports.IZapper__factory = exports.IYVault__factory = exports.IYearnV2Adapter__factory = exports.IwstETHV1Adapter__factory = exports.IwstETHGateWay__factory = exports.IwstETHGetters__factory = exports.IwstETH__factory = exports.IWithdrawalManagerV3Events__factory = exports.IWithdrawalManagerV3__factory = exports.IWETHZapper__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IWERC20Zapper__factory = exports.IVersion__factory = exports.IUniswapV3AdapterExceptions__factory = exports.IUniswapV3AdapterEvents__factory = exports.IUniswapV3Adapter__factory = exports.ISwapRouter__factory = exports.IUniswapV2AdapterExceptions__factory = exports.IUniswapV2AdapterEvents__factory = exports.IUniswapV2Adapter__factory = exports.IstETHGetters__factory = exports.IstETH__factory = exports.IPriceOracleBase__factory = exports.IPoolV3Events__factory = exports.IPoolV3__factory = exports.IPoolServiceEvents__factory = exports.IPoolService__factory = exports.IPermit2__factory = exports.IOffchainOracle__factory = exports.IRouter__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IGasPricer__factory = exports.IERC4626__factory = exports.IERC20Permit__factory = void 0;
28
28
  exports.factories = __importStar(require("./factories"));
29
29
  var AddressProvider__factory_1 = require("./factories/AddressProvider__factory");
30
30
  Object.defineProperty(exports, "AddressProvider__factory", { enumerable: true, get: function () { return AddressProvider__factory_1.AddressProvider__factory; } });
@@ -128,10 +128,14 @@ var IERC20Permit__factory_1 = require("./factories/IERC20Permit__factory");
128
128
  Object.defineProperty(exports, "IERC20Permit__factory", { enumerable: true, get: function () { return IERC20Permit__factory_1.IERC20Permit__factory; } });
129
129
  var IERC4626__factory_1 = require("./factories/IERC4626__factory");
130
130
  Object.defineProperty(exports, "IERC4626__factory", { enumerable: true, get: function () { return IERC4626__factory_1.IERC4626__factory; } });
131
+ var IGasPricer__factory_1 = require("./factories/IGasPricer__factory");
132
+ Object.defineProperty(exports, "IGasPricer__factory", { enumerable: true, get: function () { return IGasPricer__factory_1.IGasPricer__factory; } });
131
133
  var IInterestRateModel__factory_1 = require("./factories/IInterestRateModel__factory");
132
134
  Object.defineProperty(exports, "IInterestRateModel__factory", { enumerable: true, get: function () { return IInterestRateModel__factory_1.IInterestRateModel__factory; } });
133
135
  var ILidoV1Adapter__factory_1 = require("./factories/ILidoV1Adapter__factory");
134
136
  Object.defineProperty(exports, "ILidoV1Adapter__factory", { enumerable: true, get: function () { return ILidoV1Adapter__factory_1.ILidoV1Adapter__factory; } });
137
+ var IRouter__factory_1 = require("./factories/interfaces/IRouter__factory");
138
+ Object.defineProperty(exports, "IRouter__factory", { enumerable: true, get: function () { return IRouter__factory_1.IRouter__factory; } });
135
139
  var IOffchainOracle__factory_1 = require("./factories/IOffchainOracle__factory");
136
140
  Object.defineProperty(exports, "IOffchainOracle__factory", { enumerable: true, get: function () { return IOffchainOracle__factory_1.IOffchainOracle__factory; } });
137
141
  var IPermit2__factory_1 = require("./factories/IPermit2__factory");
@@ -146,8 +150,6 @@ var IPoolV3Events__factory_1 = require("./factories/IPoolV3.sol/IPoolV3Events__f
146
150
  Object.defineProperty(exports, "IPoolV3Events__factory", { enumerable: true, get: function () { return IPoolV3Events__factory_1.IPoolV3Events__factory; } });
147
151
  var IPriceOracleBase__factory_1 = require("./factories/IPriceOracleBase__factory");
148
152
  Object.defineProperty(exports, "IPriceOracleBase__factory", { enumerable: true, get: function () { return IPriceOracleBase__factory_1.IPriceOracleBase__factory; } });
149
- var IRouter__factory_1 = require("./factories/IRouter__factory");
150
- Object.defineProperty(exports, "IRouter__factory", { enumerable: true, get: function () { return IRouter__factory_1.IRouter__factory; } });
151
153
  var IstETH__factory_1 = require("./factories/IstETH.sol/IstETH__factory");
152
154
  Object.defineProperty(exports, "IstETH__factory", { enumerable: true, get: function () { return IstETH__factory_1.IstETH__factory; } });
153
155
  var IstETHGetters__factory_1 = require("./factories/IstETH.sol/IstETHGetters__factory");
@@ -1,7 +1,7 @@
1
1
  import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers";
2
2
  import type { FunctionFragment, Result, EventFragment } from "@ethersproject/abi";
3
3
  import type { Listener, Provider } from "@ethersproject/providers";
4
- import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "./common";
4
+ import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "../common";
5
5
  export type SwapTaskStruct = {
6
6
  swapOperation: PromiseOrValue<BigNumberish>;
7
7
  creditAccount: PromiseOrValue<string>;
@@ -78,11 +78,12 @@ export interface IRouterInterface extends utils.Interface {
78
78
  "findBestClosePath(address,address[],uint256,(address,uint8,uint8)[],uint256,bool)": FunctionFragment;
79
79
  "findOneTokenPath(address,uint256,address,address,address[],uint256)": FunctionFragment;
80
80
  "findOpenStrategyPath(address,(address,uint256)[],address,address[],uint256)": FunctionFragment;
81
+ "getGasPriceTokenOutRAY(address)": FunctionFragment;
81
82
  "isRouterConfigurator(address)": FunctionFragment;
82
83
  "tokenTypes(address)": FunctionFragment;
83
84
  "version()": FunctionFragment;
84
85
  };
85
- getFunction(nameOrSignatureOrTopic: "componentAddressById" | "findAllSwaps" | "findBestClosePath" | "findOneTokenPath" | "findOpenStrategyPath" | "isRouterConfigurator" | "tokenTypes" | "version"): FunctionFragment;
86
+ getFunction(nameOrSignatureOrTopic: "componentAddressById" | "findAllSwaps" | "findBestClosePath" | "findOneTokenPath" | "findOpenStrategyPath" | "getGasPriceTokenOutRAY" | "isRouterConfigurator" | "tokenTypes" | "version"): FunctionFragment;
86
87
  encodeFunctionData(functionFragment: "componentAddressById", values: [PromiseOrValue<BigNumberish>]): string;
87
88
  encodeFunctionData(functionFragment: "findAllSwaps", values: [SwapTaskStruct]): string;
88
89
  encodeFunctionData(functionFragment: "findBestClosePath", values: [
@@ -108,6 +109,7 @@ export interface IRouterInterface extends utils.Interface {
108
109
  PromiseOrValue<string>[],
109
110
  PromiseOrValue<BigNumberish>
110
111
  ]): string;
112
+ encodeFunctionData(functionFragment: "getGasPriceTokenOutRAY", values: [PromiseOrValue<string>]): string;
111
113
  encodeFunctionData(functionFragment: "isRouterConfigurator", values: [PromiseOrValue<string>]): string;
112
114
  encodeFunctionData(functionFragment: "tokenTypes", values: [PromiseOrValue<string>]): string;
113
115
  encodeFunctionData(functionFragment: "version", values?: undefined): string;
@@ -116,6 +118,7 @@ export interface IRouterInterface extends utils.Interface {
116
118
  decodeFunctionResult(functionFragment: "findBestClosePath", data: BytesLike): Result;
117
119
  decodeFunctionResult(functionFragment: "findOneTokenPath", data: BytesLike): Result;
118
120
  decodeFunctionResult(functionFragment: "findOpenStrategyPath", data: BytesLike): Result;
121
+ decodeFunctionResult(functionFragment: "getGasPriceTokenOutRAY", data: BytesLike): Result;
119
122
  decodeFunctionResult(functionFragment: "isRouterConfigurator", data: BytesLike): Result;
120
123
  decodeFunctionResult(functionFragment: "tokenTypes", data: BytesLike): Result;
121
124
  decodeFunctionResult(functionFragment: "version", data: BytesLike): Result;
@@ -185,6 +188,9 @@ export interface IRouter extends BaseContract {
185
188
  findOpenStrategyPath(creditManager: PromiseOrValue<string>, balances: BalanceStruct[], target: PromiseOrValue<string>, connectors: PromiseOrValue<string>[], slippage: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
186
189
  from?: PromiseOrValue<string>;
187
190
  }): Promise<ContractTransaction>;
191
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber] & {
192
+ gasPrice: BigNumber;
193
+ }>;
188
194
  isRouterConfigurator(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[boolean]>;
189
195
  tokenTypes(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[number]>;
190
196
  version(overrides?: CallOverrides): Promise<[BigNumber]>;
@@ -202,6 +208,7 @@ export interface IRouter extends BaseContract {
202
208
  findOpenStrategyPath(creditManager: PromiseOrValue<string>, balances: BalanceStruct[], target: PromiseOrValue<string>, connectors: PromiseOrValue<string>[], slippage: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
203
209
  from?: PromiseOrValue<string>;
204
210
  }): Promise<ContractTransaction>;
211
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
205
212
  isRouterConfigurator(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<boolean>;
206
213
  tokenTypes(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<number>;
207
214
  version(overrides?: CallOverrides): Promise<BigNumber>;
@@ -217,6 +224,7 @@ export interface IRouter extends BaseContract {
217
224
  }>;
218
225
  findOneTokenPath(tokenIn: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, tokenOut: PromiseOrValue<string>, creditAccount: PromiseOrValue<string>, connectors: PromiseOrValue<string>[], slippage: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<RouterResultStructOutput>;
219
226
  findOpenStrategyPath(creditManager: PromiseOrValue<string>, balances: BalanceStruct[], target: PromiseOrValue<string>, connectors: PromiseOrValue<string>[], slippage: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[BalanceStructOutput[], RouterResultStructOutput]>;
227
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
220
228
  isRouterConfigurator(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<boolean>;
221
229
  tokenTypes(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<number>;
222
230
  version(overrides?: CallOverrides): Promise<BigNumber>;
@@ -243,6 +251,7 @@ export interface IRouter extends BaseContract {
243
251
  findOpenStrategyPath(creditManager: PromiseOrValue<string>, balances: BalanceStruct[], target: PromiseOrValue<string>, connectors: PromiseOrValue<string>[], slippage: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
244
252
  from?: PromiseOrValue<string>;
245
253
  }): Promise<BigNumber>;
254
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
246
255
  isRouterConfigurator(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
247
256
  tokenTypes(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
248
257
  version(overrides?: CallOverrides): Promise<BigNumber>;
@@ -261,6 +270,7 @@ export interface IRouter extends BaseContract {
261
270
  findOpenStrategyPath(creditManager: PromiseOrValue<string>, balances: BalanceStruct[], target: PromiseOrValue<string>, connectors: PromiseOrValue<string>[], slippage: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
262
271
  from?: PromiseOrValue<string>;
263
272
  }): Promise<PopulatedTransaction>;
273
+ getGasPriceTokenOutRAY(token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
264
274
  isRouterConfigurator(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
265
275
  tokenTypes(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
266
276
  version(overrides?: CallOverrides): Promise<PopulatedTransaction>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { IRouter } from "./IRouter";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.32",
3
+ "version": "3.0.0-next.34",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -47,6 +47,7 @@
47
47
  "@gearbox-protocol/oracles-v3": "^1.7.6",
48
48
  "@gearbox-protocol/periphery-v3": "^1.3.4",
49
49
  "@gearbox-protocol/prettier-config": "^1.4.1",
50
+ "@gearbox-protocol/router-v3": "^1.3.0",
50
51
  "@openzeppelin/contracts": "^4.9.3",
51
52
  "@typechain/ethers-v5": "^10.1.0",
52
53
  "@types/chai": "^4.3.3",
@@ -1,100 +0,0 @@
1
- // SPDX-License-Identifier: GPL-2.0-or-later
2
- // Gearbox Protocol. Generalized leverage for DeFi protocols
3
- // (c) Gearbox Holdings, 2021
4
- pragma solidity ^0.8.10;
5
-
6
- import {Balance} from "@gearbox-protocol/core-v2/contracts/libraries/Balances.sol";
7
- import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol";
8
- import {MultiCall} from "@gearbox-protocol/core-v2/contracts/libraries/MultiCall.sol";
9
-
10
- struct PathOption {
11
- address target;
12
- uint8 option;
13
- uint8 totalOptions;
14
- }
15
-
16
- enum SwapOperation {
17
- EXACT_INPUT,
18
- EXACT_INPUT_ALL,
19
- EXACT_OUTPUT
20
- }
21
-
22
- struct SwapTask {
23
- SwapOperation swapOperation;
24
- address creditAccount;
25
- address tokenIn;
26
- address tokenOut;
27
- address[] connectors;
28
- uint256 amount;
29
- uint256 slippage;
30
- bool externalSlippage;
31
- }
32
-
33
- struct RouterResult {
34
- uint256 amount;
35
- uint256 gasUsage;
36
- MultiCall[] calls;
37
- }
38
-
39
- interface IRouter is IVersion {
40
- /// @dev Emits each time when routerComponent is set / updated
41
- event RouterComponentUpdate(uint8 indexed, address indexed);
42
-
43
- /// @dev Emits each time when resolver is set / updated
44
- event ResolverUpdate(uint8 indexed ttIn, uint8 indexed ttOut, uint8 indexed rc);
45
-
46
- event TokenTypeUpdate(address indexed tokenAddress, uint8 indexed tt);
47
-
48
- /// @dev Finds all available swaps for NORMAL tokens
49
- function findAllSwaps(SwapTask memory swapTask) external returns (RouterResult[] memory);
50
-
51
- /// @dev Finds best path to swap all Normal tokens and tokens "on the way" to target one and vice versa
52
- function findOneTokenPath(
53
- address tokenIn,
54
- uint256 amount,
55
- address tokenOut,
56
- address creditAccount,
57
- address[] calldata connectors,
58
- uint256 slippage
59
- ) external returns (RouterResult memory);
60
-
61
- /// @dev Finds the best swap to deposit (or swap) all provided tokens into target one
62
- /// Currently it takes ALL Normal tokens and all LP "on the way" tokens into target one.
63
- /// It some token is not "on the way" it would be skipped.
64
- /// @param creditManager Address of creditManager
65
- /// @param balances Expected balances on credit account
66
- /// @param target Address of target token
67
- /// @param connectors Addresses of "connectors" - internidiatery tokens which're used for swap operations
68
- /// @param slippage Slippage in PERCENTAGE_FORMAT
69
- function findOpenStrategyPath(
70
- address creditManager,
71
- Balance[] calldata balances,
72
- address target,
73
- address[] calldata connectors,
74
- uint256 slippage
75
- ) external returns (Balance[] memory, RouterResult memory);
76
-
77
- /// @dev Finds the best close path - withdraw all tokens and swap them into underlying one
78
- /// @param creditAccount Address of closing creditAccount
79
- /// @param connectors Addresses of "connectors" - internidiatery tokens which're used for swap operations
80
- /// @param slippage Slippage in PERCENTAGE_FORMAT
81
- /// @param pathOptions Starting point for iterating routes. More info in PathOption file
82
- /// @param iterations How many iterations algo should compute starting from PathOptions
83
- function findBestClosePath(
84
- address creditAccount,
85
- address[] memory connectors,
86
- uint256 slippage,
87
- PathOption[] memory pathOptions,
88
- uint256 iterations,
89
- bool force
90
- ) external returns (RouterResult memory result, uint256 gasPriceTargetRAY);
91
-
92
- /// @dev Returns TokenType for provided token
93
- function tokenTypes(address) external view returns (uint8);
94
-
95
- /// @dev Returns current address for RouterComponent. Used for self-discovery
96
- function componentAddressById(uint8) external view returns (address);
97
-
98
- /// @dev @return True if address is router configurator, otherwise false
99
- function isRouterConfigurator(address account) external view returns (bool);
100
- }
File without changes