@gearbox-protocol/sdk 3.0.0-next.5 → 3.0.0-next.7

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.
Files changed (80) hide show
  1. package/contracts/IAirdropDistributor.sol +55 -0
  2. package/contracts/IDegenDistributor.sol +28 -0
  3. package/contracts/IOffchainOracle.sol +17 -0
  4. package/contracts/IWETHGateway.sol +33 -0
  5. package/contracts/IwstETHGateway.sol +24 -0
  6. package/contracts/index.sol +2 -0
  7. package/lib/config.d.ts +0 -1
  8. package/lib/config.js +1 -2
  9. package/lib/core/creditManager.d.ts +11 -6
  10. package/lib/core/creditManager.js +47 -24
  11. package/lib/core/pool/data.d.ts +3 -2
  12. package/lib/core/pool/data.js +4 -1
  13. package/lib/parsers/txParser.d.ts +3 -3
  14. package/lib/pathfinder/core.d.ts +4 -4
  15. package/lib/pathfinder/pathfinder.js +3 -2
  16. package/lib/types/IAirdropDistributor.sol/IAirdropDistributor.d.ts +124 -0
  17. package/lib/types/IAirdropDistributor.sol/IAirdropDistributor.js +2 -0
  18. package/lib/types/IAirdropDistributor.sol/IAirdropDistributorEvents.d.ts +73 -0
  19. package/lib/types/IAirdropDistributor.sol/IAirdropDistributorEvents.js +2 -0
  20. package/lib/types/IAirdropDistributor.sol/index.d.ts +2 -0
  21. package/lib/types/IAirdropDistributor.sol/index.js +2 -0
  22. package/lib/types/IDegenDistributor.sol/IDegenDistributor.d.ts +96 -0
  23. package/lib/types/IDegenDistributor.sol/IDegenDistributor.js +2 -0
  24. package/lib/types/IDegenDistributor.sol/IDegenDistributorEvents.d.ts +53 -0
  25. package/lib/types/IDegenDistributor.sol/IDegenDistributorEvents.js +2 -0
  26. package/lib/types/IDegenDistributor.sol/index.d.ts +2 -0
  27. package/lib/types/IDegenDistributor.sol/index.js +2 -0
  28. package/lib/types/IOffchainOracle.d.ts +58 -0
  29. package/lib/types/IOffchainOracle.js +2 -0
  30. package/lib/types/IWETHGateway.d.ts +90 -0
  31. package/lib/types/IWETHGateway.js +2 -0
  32. package/lib/types/IwstETHGateway.sol/IwstETHGateWay.d.ts +70 -0
  33. package/lib/types/IwstETHGateway.sol/IwstETHGateWay.js +2 -0
  34. package/lib/types/IwstETHGateway.sol/index.d.ts +1 -0
  35. package/lib/types/IwstETHGateway.sol/index.js +2 -0
  36. package/lib/types/factories/AaveV2_WrappedAToken.sol/WrappedAToken__factory.d.ts +1 -1
  37. package/lib/types/factories/AaveV2_WrappedAToken.sol/WrappedAToken__factory.js +1 -1
  38. package/lib/types/factories/AddressProvider__factory.d.ts +1 -1
  39. package/lib/types/factories/AddressProvider__factory.js +1 -1
  40. package/lib/types/factories/Balances.sol/BalanceOps__factory.d.ts +1 -1
  41. package/lib/types/factories/Balances.sol/BalanceOps__factory.js +1 -1
  42. package/lib/types/factories/Claimable__factory.d.ts +1 -1
  43. package/lib/types/factories/Claimable__factory.js +1 -1
  44. package/lib/types/factories/ERC20__factory.d.ts +1 -1
  45. package/lib/types/factories/ERC20__factory.js +1 -1
  46. package/lib/types/factories/Errors__factory.d.ts +1 -1
  47. package/lib/types/factories/Errors__factory.js +1 -1
  48. package/lib/types/factories/IAirdropDistributor.sol/IAirdropDistributorEvents__factory.d.ts +63 -0
  49. package/lib/types/factories/IAirdropDistributor.sol/IAirdropDistributorEvents__factory.js +88 -0
  50. package/lib/types/factories/IAirdropDistributor.sol/IAirdropDistributor__factory.d.ts +119 -0
  51. package/lib/types/factories/IAirdropDistributor.sol/IAirdropDistributor__factory.js +161 -0
  52. package/lib/types/factories/IAirdropDistributor.sol/index.d.ts +2 -0
  53. package/lib/types/factories/IAirdropDistributor.sol/index.js +10 -0
  54. package/lib/types/factories/IDegenDistributor.sol/IDegenDistributorEvents__factory.d.ts +38 -0
  55. package/lib/types/factories/IDegenDistributor.sol/IDegenDistributorEvents__factory.js +57 -0
  56. package/lib/types/factories/IDegenDistributor.sol/IDegenDistributor__factory.d.ts +84 -0
  57. package/lib/types/factories/IDegenDistributor.sol/IDegenDistributor__factory.js +117 -0
  58. package/lib/types/factories/IDegenDistributor.sol/index.d.ts +2 -0
  59. package/lib/types/factories/IDegenDistributor.sol/index.js +10 -0
  60. package/lib/types/factories/IOffchainOracle__factory.d.ts +48 -0
  61. package/lib/types/factories/IOffchainOracle__factory.js +72 -0
  62. package/lib/types/factories/IWETHGateway__factory.d.ts +58 -0
  63. package/lib/types/factories/IWETHGateway__factory.js +83 -0
  64. package/lib/types/factories/IwstETHGateway.sol/IwstETHGateWay__factory.d.ts +48 -0
  65. package/lib/types/factories/IwstETHGateway.sol/IwstETHGateWay__factory.js +71 -0
  66. package/lib/types/factories/IwstETHGateway.sol/index.d.ts +1 -0
  67. package/lib/types/factories/IwstETHGateway.sol/index.js +8 -0
  68. package/lib/types/factories/SafeERC20__factory.d.ts +1 -1
  69. package/lib/types/factories/SafeERC20__factory.js +1 -1
  70. package/lib/types/factories/WATokenZapper__factory.d.ts +1 -1
  71. package/lib/types/factories/WATokenZapper__factory.js +1 -1
  72. package/lib/types/factories/WETHZapper__factory.d.ts +1 -1
  73. package/lib/types/factories/WETHZapper__factory.js +1 -1
  74. package/lib/types/factories/WstETHZapper__factory.d.ts +1 -1
  75. package/lib/types/factories/WstETHZapper__factory.js +1 -1
  76. package/lib/types/factories/index.d.ts +5 -0
  77. package/lib/types/factories/index.js +9 -2
  78. package/lib/types/index.d.ts +31 -12
  79. package/lib/types/index.js +32 -20
  80. package/package.json +2 -2
@@ -0,0 +1,55 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.5.0;
3
+
4
+ import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5
+
6
+ struct DistributionData {
7
+ address account;
8
+ uint8 campaignId;
9
+ uint256 amount;
10
+ }
11
+
12
+ struct ClaimedData {
13
+ address account;
14
+ uint256 amount;
15
+ }
16
+
17
+ interface IAirdropDistributorEvents {
18
+ /// @dev Emits when a user claims tokens
19
+ event Claimed(
20
+ address indexed account,
21
+ uint256 amount,
22
+ bool indexed historic
23
+ );
24
+
25
+ /// @dev Emits when the owner replaces the merkle root
26
+ event RootUpdated(bytes32 oldRoot, bytes32 indexed newRoot);
27
+
28
+ /// @dev Emitted from a special function after updating the root to index allocations
29
+ event TokenAllocated(
30
+ address indexed account,
31
+ uint8 indexed campaignId,
32
+ uint256 amount
33
+ );
34
+ }
35
+
36
+ interface IAirdropDistributor is IAirdropDistributorEvents {
37
+ /// @dev Returns the token distributed by this contract.
38
+ function token() external view returns (IERC20);
39
+
40
+ /// @dev Returns the current merkle root containing total claimable balances
41
+ function merkleRoot() external view returns (bytes32);
42
+
43
+ /// @dev Returns the total amount of token claimed by the user
44
+ function claimed(address user) external view returns (uint256);
45
+
46
+ // Claim the given amount of the token to the given address. Reverts if the inputs are invalid.
47
+ /// @dev Claims the given amount of the token for the account. Reverts if the inputs are not a leaf in the tree
48
+ /// or the total claimed amount for the account is more than the leaf amount.
49
+ function claim(
50
+ uint256 index,
51
+ address account,
52
+ uint256 totalAmount,
53
+ bytes32[] calldata merkleProof
54
+ ) external;
55
+ }
@@ -0,0 +1,28 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.5.0;
3
+
4
+ interface IDegenDistributorEvents {
5
+ /// @dev Emits when a user claims tokens
6
+ event Claimed(address indexed account, uint256 amount);
7
+
8
+ /// @dev Emits when the owner replaces the merkle root
9
+ event RootUpdated(bytes32 oldRoot, bytes32 indexed newRoot);
10
+ }
11
+
12
+ interface IDegenDistributor is IDegenDistributorEvents {
13
+ // Returns the merkle root of the merkle tree containing account balances available to claim.
14
+ function merkleRoot() external view returns (bytes32);
15
+
16
+ /// @dev Returns the total amount of token claimed by the user
17
+ function claimed(address user) external view returns (uint256);
18
+
19
+ // Claim the given amount of the token to the given address. Reverts if the inputs are invalid.
20
+ /// @dev Claims the remaining unclaimed amount of the token for the account. Reverts if the inputs are not a leaf in the tree
21
+ /// or the total claimed amount for the account is more than the leaf amount.
22
+ function claim(
23
+ uint256 index,
24
+ address account,
25
+ uint256 totalAmount,
26
+ bytes32[] calldata merkleProof
27
+ ) external;
28
+ }
@@ -0,0 +1,17 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ // Gearbox Protocol. Generalized leverage for DeFi protocols
3
+ // (c) Gearbox Holdings, 2021
4
+ pragma solidity ^0.8.10;
5
+
6
+ interface IOffchainOracle {
7
+ function getRate(
8
+ address srcToken,
9
+ address dstToken,
10
+ bool useWrappers
11
+ ) external view returns (uint256 weightedRate);
12
+
13
+ function getRateToEth(address srcToken, bool useSrcWrappers)
14
+ external
15
+ view
16
+ returns (uint256 weightedRate);
17
+ }
@@ -0,0 +1,33 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Gearbox Protocol. Generalized leverage for DeFi protocols
3
+ // (c) Gearbox Holdings, 2022
4
+ pragma solidity ^0.8.10;
5
+
6
+ interface IWETHGateway {
7
+ /// @dev Converts ETH to WETH and add liqudity to the pool
8
+ /// @param pool Address of PoolService contract to add liquidity to. This pool must have WETH as an underlying.
9
+ /// @param onBehalfOf The address that will receive the diesel token.
10
+ /// @param referralCode Code used to log the transaction facilitator, for potential rewards. 0 if non-applicable.
11
+ function addLiquidityETH(
12
+ address pool,
13
+ address onBehalfOf,
14
+ uint16 referralCode
15
+ ) external payable;
16
+
17
+ /// @dev Removes liquidity from the pool and converts WETH to ETH
18
+ /// - burns lp's diesel (LP) tokens
19
+ /// - unwraps WETH to ETH and sends to the LP
20
+ /// @param pool Address of PoolService contract to withdraw liquidity from. This pool must have WETH as an underlying.
21
+ /// @param amount Amount of Diesel tokens to send.
22
+ /// @param to Address to transfer ETH to.
23
+ function removeLiquidityETH(
24
+ address pool,
25
+ uint256 amount,
26
+ address payable to
27
+ ) external;
28
+
29
+ /// @dev Converts WETH to ETH, and sends to the passed address
30
+ /// @param to Address to send ETH to
31
+ /// @param amount Amount of WETH to unwrap
32
+ function unwrapWETH(address to, uint256 amount) external;
33
+ }
@@ -0,0 +1,24 @@
1
+ // SPDX-License-Identifier: UNLICENSED
2
+ pragma solidity ^0.8.10;
3
+
4
+ interface IwstETHGateWay {
5
+ error NonRegisterPoolException();
6
+
7
+ /**
8
+ * @dev Adds stETH liquidity to wstETH pool
9
+ * - transfers the underlying to the pool
10
+ * - mints Diesel (LP) tokens to onBehalfOf
11
+ * @param amount Amount of tokens to be deposited
12
+ * @param onBehalfOf The address that will receive the dToken
13
+ * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
14
+ * 0 if the action is executed directly by the user, without a facilitator.
15
+ */
16
+ function addLiquidity(uint256 amount, address onBehalfOf, uint256 referralCode) external;
17
+
18
+ /// @dev Removes liquidity from pool
19
+ /// - burns LP's Diesel (LP) tokens
20
+ /// - returns the equivalent amount of underlying to 'to'
21
+ /// @param amount Amount of Diesel tokens to burn
22
+ /// @param to Address to transfer the underlying to
23
+ function removeLiquidity(uint256 amount, address to) external returns (uint256 amountGet);
24
+ }
@@ -44,3 +44,5 @@ import {ICurveV1_3AssetsAdapter} from
44
44
 
45
45
  import {ICurveV1_4AssetsAdapter} from
46
46
  "@gearbox-protocol/integrations-v3/contracts/interfaces/curve/ICurveV1_4AssetsAdapter.sol";
47
+
48
+ import {IOffchainOracle} from "./IOffchainOracle.sol";
package/lib/config.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export declare const STATIC_TOKEN = "https://static.gearbox.fi/tokens/";
2
- export declare const MULTICALL_ADDRESS = "0x5ba1e12693dc8f9c48aad8770482f4739beed696";
package/lib/config.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MULTICALL_ADDRESS = exports.STATIC_TOKEN = void 0;
3
+ exports.STATIC_TOKEN = void 0;
4
4
  exports.STATIC_TOKEN = "https://static.gearbox.fi/tokens/";
5
- exports.MULTICALL_ADDRESS = "0x5ba1e12693dc8f9c48aad8770482f4739beed696";
@@ -28,14 +28,19 @@ export declare class CreditManagerData {
28
28
  readonly supportedTokens: Record<string, true>;
29
29
  readonly adapters: Record<string, string>;
30
30
  readonly liquidationThresholds: Record<string, bigint>;
31
- readonly quotas: Array<QuotaInfo>;
31
+ readonly quotas: Record<string, QuotaInfo>;
32
32
  readonly interestModel: LinearModel;
33
33
  constructor(payload: CreditManagerDataPayload);
34
- encodeAddCollateral(accountAddress: string, tokenAddress: string, amount: bigint): MultiCall;
35
- encodeIncreaseDebt(amount: bigint): MultiCall;
36
- encodeDecreaseDebt(amount: bigint): MultiCall;
37
- encodeEnableToken(token: string): MultiCall;
38
- encodeDisableToken(token: string): MultiCall;
34
+ encodeAddCollateralV2(account: string, tokenAddress: string, amount: bigint): MultiCall;
35
+ encodeAddCollateralV3(tokenAddress: string, amount: bigint): MultiCall;
36
+ encodeIncreaseDebtV2(amount: bigint): MultiCall;
37
+ encodeIncreaseDebtV3(amount: bigint): MultiCall;
38
+ encodeDecreaseDebtV2(amount: bigint): MultiCall;
39
+ encodeDecreaseDebtV3(amount: bigint): MultiCall;
40
+ encodeEnableTokenV2(token: string): MultiCall;
41
+ encodeEnableTokenV3(token: string): MultiCall;
42
+ encodeDisableTokenV2(token: string): MultiCall;
43
+ encodeDisableTokenV3(token: string): MultiCall;
39
44
  static withdrawAllAndUnwrap_Convex(address: string, claim: boolean): MultiCall;
40
45
  get id(): string;
41
46
  }
@@ -74,14 +74,17 @@ class CreditManagerData {
74
74
  acc[address.toLowerCase()] = (0, sdk_gov_1.toBigInt)(threshold);
75
75
  return acc;
76
76
  }, {});
77
- this.quotas = payload.quotas.map(q => ({
78
- token: q.token.toLowerCase(),
79
- rate: q.rate,
80
- quotaIncreaseFee: q.quotaIncreaseFee,
81
- totalQuoted: (0, sdk_gov_1.toBigInt)(q.totalQuoted),
82
- limit: (0, sdk_gov_1.toBigInt)(q.limit),
83
- isActive: q.isActive,
84
- }));
77
+ this.quotas = Object.fromEntries(payload.quotas.map(q => [
78
+ q.token.toLowerCase(),
79
+ {
80
+ token: q.token.toLowerCase(),
81
+ rate: q.rate,
82
+ quotaIncreaseFee: q.quotaIncreaseFee,
83
+ totalQuoted: (0, sdk_gov_1.toBigInt)(q.totalQuoted),
84
+ limit: (0, sdk_gov_1.toBigInt)(q.limit),
85
+ isActive: q.isActive,
86
+ },
87
+ ]));
85
88
  this.interestModel = {
86
89
  interestModel: payload.lirm.interestModel.toLowerCase(),
87
90
  U_1: payload.lirm.U_1,
@@ -101,46 +104,66 @@ class CreditManagerData {
101
104
  })));
102
105
  }
103
106
  }
104
- encodeAddCollateral(accountAddress, tokenAddress, amount) {
105
- if (this.version === 1)
106
- throw new Error("Multicall is eligible only for version 2");
107
+ encodeAddCollateralV2(account, tokenAddress, amount) {
108
+ return {
109
+ target: this.creditFacade,
110
+ callData: types_1.ICreditFacadeV2Extended__factory.createInterface().encodeFunctionData("addCollateral", [account, tokenAddress, amount]),
111
+ };
112
+ }
113
+ encodeAddCollateralV3(tokenAddress, amount) {
107
114
  return {
108
115
  target: this.creditFacade,
109
- callData: types_1.ICreditFacadeV2Extended__factory.createInterface().encodeFunctionData("addCollateral", [accountAddress, tokenAddress, amount]),
116
+ callData: types_1.ICreditFacadeV3Multicall__factory.createInterface().encodeFunctionData("addCollateral", [tokenAddress, amount]),
110
117
  };
111
118
  }
112
- encodeIncreaseDebt(amount) {
113
- if (this.version === 1)
114
- throw new Error("Multicall is eligible only for version 2");
119
+ encodeIncreaseDebtV2(amount) {
115
120
  return {
116
121
  target: this.creditFacade,
117
122
  callData: types_1.ICreditFacadeV2Extended__factory.createInterface().encodeFunctionData("increaseDebt", [amount]),
118
123
  };
119
124
  }
120
- encodeDecreaseDebt(amount) {
121
- if (this.version === 1)
122
- throw new Error("Multicall is eligible only for version 2");
125
+ encodeIncreaseDebtV3(amount) {
126
+ return {
127
+ target: this.creditFacade,
128
+ callData: types_1.ICreditFacadeV3Multicall__factory.createInterface().encodeFunctionData("increaseDebt", [amount]),
129
+ };
130
+ }
131
+ encodeDecreaseDebtV2(amount) {
123
132
  return {
124
133
  target: this.creditFacade,
125
134
  callData: types_1.ICreditFacadeV2Extended__factory.createInterface().encodeFunctionData("decreaseDebt", [amount]),
126
135
  };
127
136
  }
128
- encodeEnableToken(token) {
129
- if (this.version === 1)
130
- throw new Error("Multicall is eligible only for version 2");
137
+ encodeDecreaseDebtV3(amount) {
138
+ return {
139
+ target: this.creditFacade,
140
+ callData: types_1.ICreditFacadeV3Multicall__factory.createInterface().encodeFunctionData("decreaseDebt", [amount]),
141
+ };
142
+ }
143
+ encodeEnableTokenV2(token) {
131
144
  return {
132
145
  target: this.creditFacade,
133
146
  callData: types_1.ICreditFacadeV2Extended__factory.createInterface().encodeFunctionData("enableToken", [token]),
134
147
  };
135
148
  }
136
- encodeDisableToken(token) {
137
- if (this.version === 1)
138
- throw new Error("Multicall is eligible only for version 2");
149
+ encodeEnableTokenV3(token) {
150
+ return {
151
+ target: this.creditFacade,
152
+ callData: types_1.ICreditFacadeV3Multicall__factory.createInterface().encodeFunctionData("enableToken", [token]),
153
+ };
154
+ }
155
+ encodeDisableTokenV2(token) {
139
156
  return {
140
157
  target: this.creditFacade,
141
158
  callData: types_1.ICreditFacadeV2Extended__factory.createInterface().encodeFunctionData("disableToken", [token]),
142
159
  };
143
160
  }
161
+ encodeDisableTokenV3(token) {
162
+ return {
163
+ target: this.creditFacade,
164
+ callData: types_1.ICreditFacadeV3Multicall__factory.createInterface().encodeFunctionData("disableToken", [token]),
165
+ };
166
+ }
144
167
  static withdrawAllAndUnwrap_Convex(address, claim) {
145
168
  return {
146
169
  target: address,
@@ -1,7 +1,7 @@
1
1
  import { providers, Signer } from "ethers";
2
2
  import { CreditManagerDebtParams, QuotaInfo } from "../../payload/creditManager";
3
3
  import { ChartsPoolDataPayload, LinearModel, PoolDataPayload, UserPoolPayload } from "../../payload/pool";
4
- import { IPoolService } from "../../types";
4
+ import { IPoolService, IPoolV3 } from "../../types";
5
5
  export declare class PoolData {
6
6
  readonly address: string;
7
7
  readonly underlyingToken: string;
@@ -28,7 +28,8 @@ export declare class PoolData {
28
28
  readonly withdrawFee: number;
29
29
  readonly cumulativeIndex_RAY: bigint;
30
30
  constructor(payload: PoolDataPayload);
31
- getContractETH(signer: Signer): IPoolService;
31
+ getPoolContractV2(signer: Signer): IPoolService;
32
+ getPoolContractV3(signer: Signer): IPoolV3;
32
33
  calculateBorrowRate({ provider, expectedLiquidity, availableLiquidity, }: CalculateBorrowRateProps): Promise<import("ethers").BigNumber>;
33
34
  }
34
35
  interface CalculateBorrowRateProps {
@@ -80,9 +80,12 @@ class PoolData {
80
80
  this.withdrawFee =
81
81
  Number((0, sdk_gov_1.toBigInt)(payload.withdrawFee)) / Number(sdk_gov_1.PERCENTAGE_DECIMALS);
82
82
  }
83
- getContractETH(signer) {
83
+ getPoolContractV2(signer) {
84
84
  return types_1.IPoolService__factory.connect(this.address, signer);
85
85
  }
86
+ getPoolContractV3(signer) {
87
+ return types_1.IPoolV3__factory.connect(this.address, signer);
88
+ }
86
89
  async calculateBorrowRate({ provider, expectedLiquidity, availableLiquidity, }) {
87
90
  const model = types_1.IInterestRateModel__factory.connect(this.interestModel.interestModel, provider);
88
91
  return model.calcBorrowRate(expectedLiquidity, availableLiquidity);
@@ -1,5 +1,5 @@
1
1
  import { NetworkType, SupportedContract, SupportedToken } from "@gearbox-protocol/sdk-gov";
2
- import { MultiCallStructOutput } from "../types/IRouter";
2
+ import { MultiCall } from "../pathfinder/core";
3
3
  import { AbstractParser } from "./abstractParser";
4
4
  import { IParser } from "./iParser";
5
5
  export interface AdapterForParser {
@@ -19,8 +19,8 @@ export declare class TxParser {
19
19
  args: any;
20
20
  };
21
21
  static getParseData(address: string): ParseData;
22
- static parseMultiCall(calls: Array<MultiCallStructOutput>): Array<string>;
23
- static parseToObjectMultiCall(calls: Array<MultiCallStructOutput>): {
22
+ static parseMultiCall(calls: Array<MultiCall>): Array<string>;
23
+ static parseToObjectMultiCall(calls: Array<MultiCall>): {
24
24
  address: string;
25
25
  functionFragment: import("ethers/lib/utils").FunctionFragment;
26
26
  args: any;
@@ -1,12 +1,12 @@
1
+ import { ExcludeArrayProps } from "@gearbox-protocol/sdk-gov";
2
+ import { MultiCallStructOutput, SwapTaskStructOutput } from "../types/IRouter";
1
3
  export declare enum SwapOperation {
2
4
  EXACT_INPUT = 0,
3
5
  EXACT_INPUT_ALL = 1,
4
6
  EXACT_OUTPUT = 2
5
7
  }
6
- export interface MultiCall {
7
- target: string;
8
- callData: string;
9
- }
8
+ export type MultiCall = ExcludeArrayProps<MultiCallStructOutput>;
9
+ export type SwapTask = ExcludeArrayProps<SwapTaskStructOutput>;
10
10
  export interface PathFinderResult {
11
11
  amount: bigint;
12
12
  calls: Array<MultiCall>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PathFinder = void 0;
4
4
  const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
5
+ const ethers_1 = require("ethers");
5
6
  const types_1 = require("../types");
6
7
  const pathOptions_1 = require("./pathOptions");
7
8
  const MAX_GAS_PER_ROUTE = 200e6;
@@ -32,8 +33,8 @@ class PathFinder {
32
33
  tokenOut: sdk_gov_1.tokenDataByNetwork[this.network][tokenOut] ||
33
34
  tokenOut,
34
35
  connectors,
35
- amount: amount,
36
- slippage,
36
+ amount: ethers_1.BigNumber.from(amount),
37
+ slippage: ethers_1.BigNumber.from(slippage),
37
38
  externalSlippage: false,
38
39
  };
39
40
  const results = await this.pathFinder.callStatic.findAllSwaps(swapTask, {
@@ -0,0 +1,124 @@
1
+ import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers";
2
+ import type { FunctionFragment, Result, EventFragment } from "@ethersproject/abi";
3
+ import type { Listener, Provider } from "@ethersproject/providers";
4
+ import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "../common";
5
+ export interface IAirdropDistributorInterface extends utils.Interface {
6
+ functions: {
7
+ "claim(uint256,address,uint256,bytes32[])": FunctionFragment;
8
+ "claimed(address)": FunctionFragment;
9
+ "merkleRoot()": FunctionFragment;
10
+ "token()": FunctionFragment;
11
+ };
12
+ getFunction(nameOrSignatureOrTopic: "claim" | "claimed" | "merkleRoot" | "token"): FunctionFragment;
13
+ encodeFunctionData(functionFragment: "claim", values: [
14
+ PromiseOrValue<BigNumberish>,
15
+ PromiseOrValue<string>,
16
+ PromiseOrValue<BigNumberish>,
17
+ PromiseOrValue<BytesLike>[]
18
+ ]): string;
19
+ encodeFunctionData(functionFragment: "claimed", values: [PromiseOrValue<string>]): string;
20
+ encodeFunctionData(functionFragment: "merkleRoot", values?: undefined): string;
21
+ encodeFunctionData(functionFragment: "token", values?: undefined): string;
22
+ decodeFunctionResult(functionFragment: "claim", data: BytesLike): Result;
23
+ decodeFunctionResult(functionFragment: "claimed", data: BytesLike): Result;
24
+ decodeFunctionResult(functionFragment: "merkleRoot", data: BytesLike): Result;
25
+ decodeFunctionResult(functionFragment: "token", data: BytesLike): Result;
26
+ events: {
27
+ "Claimed(address,uint256,bool)": EventFragment;
28
+ "RootUpdated(bytes32,bytes32)": EventFragment;
29
+ "TokenAllocated(address,uint8,uint256)": EventFragment;
30
+ };
31
+ getEvent(nameOrSignatureOrTopic: "Claimed"): EventFragment;
32
+ getEvent(nameOrSignatureOrTopic: "RootUpdated"): EventFragment;
33
+ getEvent(nameOrSignatureOrTopic: "TokenAllocated"): EventFragment;
34
+ }
35
+ export interface ClaimedEventObject {
36
+ account: string;
37
+ amount: BigNumber;
38
+ historic: boolean;
39
+ }
40
+ export type ClaimedEvent = TypedEvent<[
41
+ string,
42
+ BigNumber,
43
+ boolean
44
+ ], ClaimedEventObject>;
45
+ export type ClaimedEventFilter = TypedEventFilter<ClaimedEvent>;
46
+ export interface RootUpdatedEventObject {
47
+ oldRoot: string;
48
+ newRoot: string;
49
+ }
50
+ export type RootUpdatedEvent = TypedEvent<[
51
+ string,
52
+ string
53
+ ], RootUpdatedEventObject>;
54
+ export type RootUpdatedEventFilter = TypedEventFilter<RootUpdatedEvent>;
55
+ export interface TokenAllocatedEventObject {
56
+ account: string;
57
+ campaignId: number;
58
+ amount: BigNumber;
59
+ }
60
+ export type TokenAllocatedEvent = TypedEvent<[
61
+ string,
62
+ number,
63
+ BigNumber
64
+ ], TokenAllocatedEventObject>;
65
+ export type TokenAllocatedEventFilter = TypedEventFilter<TokenAllocatedEvent>;
66
+ export interface IAirdropDistributor extends BaseContract {
67
+ connect(signerOrProvider: Signer | Provider | string): this;
68
+ attach(addressOrName: string): this;
69
+ deployed(): Promise<this>;
70
+ interface: IAirdropDistributorInterface;
71
+ queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
72
+ listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
73
+ listeners(eventName?: string): Array<Listener>;
74
+ removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
75
+ removeAllListeners(eventName?: string): this;
76
+ off: OnEvent<this>;
77
+ on: OnEvent<this>;
78
+ once: OnEvent<this>;
79
+ removeListener: OnEvent<this>;
80
+ functions: {
81
+ claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: Overrides & {
82
+ from?: PromiseOrValue<string>;
83
+ }): Promise<ContractTransaction>;
84
+ claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber]>;
85
+ merkleRoot(overrides?: CallOverrides): Promise<[string]>;
86
+ token(overrides?: CallOverrides): Promise<[string]>;
87
+ };
88
+ claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: Overrides & {
89
+ from?: PromiseOrValue<string>;
90
+ }): Promise<ContractTransaction>;
91
+ claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
92
+ merkleRoot(overrides?: CallOverrides): Promise<string>;
93
+ token(overrides?: CallOverrides): Promise<string>;
94
+ callStatic: {
95
+ claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<void>;
96
+ claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
97
+ merkleRoot(overrides?: CallOverrides): Promise<string>;
98
+ token(overrides?: CallOverrides): Promise<string>;
99
+ };
100
+ filters: {
101
+ "Claimed(address,uint256,bool)"(account?: PromiseOrValue<string> | null, amount?: null, historic?: PromiseOrValue<boolean> | null): ClaimedEventFilter;
102
+ Claimed(account?: PromiseOrValue<string> | null, amount?: null, historic?: PromiseOrValue<boolean> | null): ClaimedEventFilter;
103
+ "RootUpdated(bytes32,bytes32)"(oldRoot?: null, newRoot?: PromiseOrValue<BytesLike> | null): RootUpdatedEventFilter;
104
+ RootUpdated(oldRoot?: null, newRoot?: PromiseOrValue<BytesLike> | null): RootUpdatedEventFilter;
105
+ "TokenAllocated(address,uint8,uint256)"(account?: PromiseOrValue<string> | null, campaignId?: PromiseOrValue<BigNumberish> | null, amount?: null): TokenAllocatedEventFilter;
106
+ TokenAllocated(account?: PromiseOrValue<string> | null, campaignId?: PromiseOrValue<BigNumberish> | null, amount?: null): TokenAllocatedEventFilter;
107
+ };
108
+ estimateGas: {
109
+ claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: Overrides & {
110
+ from?: PromiseOrValue<string>;
111
+ }): Promise<BigNumber>;
112
+ claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
113
+ merkleRoot(overrides?: CallOverrides): Promise<BigNumber>;
114
+ token(overrides?: CallOverrides): Promise<BigNumber>;
115
+ };
116
+ populateTransaction: {
117
+ claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: Overrides & {
118
+ from?: PromiseOrValue<string>;
119
+ }): Promise<PopulatedTransaction>;
120
+ claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
121
+ merkleRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
122
+ token(overrides?: CallOverrides): Promise<PopulatedTransaction>;
123
+ };
124
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,73 @@
1
+ import type { BaseContract, BigNumber, BigNumberish, BytesLike, Signer, utils } from "ethers";
2
+ import type { EventFragment } from "@ethersproject/abi";
3
+ import type { Listener, Provider } from "@ethersproject/providers";
4
+ import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "../common";
5
+ export interface IAirdropDistributorEventsInterface extends utils.Interface {
6
+ functions: {};
7
+ events: {
8
+ "Claimed(address,uint256,bool)": EventFragment;
9
+ "RootUpdated(bytes32,bytes32)": EventFragment;
10
+ "TokenAllocated(address,uint8,uint256)": EventFragment;
11
+ };
12
+ getEvent(nameOrSignatureOrTopic: "Claimed"): EventFragment;
13
+ getEvent(nameOrSignatureOrTopic: "RootUpdated"): EventFragment;
14
+ getEvent(nameOrSignatureOrTopic: "TokenAllocated"): EventFragment;
15
+ }
16
+ export interface ClaimedEventObject {
17
+ account: string;
18
+ amount: BigNumber;
19
+ historic: boolean;
20
+ }
21
+ export type ClaimedEvent = TypedEvent<[
22
+ string,
23
+ BigNumber,
24
+ boolean
25
+ ], ClaimedEventObject>;
26
+ export type ClaimedEventFilter = TypedEventFilter<ClaimedEvent>;
27
+ export interface RootUpdatedEventObject {
28
+ oldRoot: string;
29
+ newRoot: string;
30
+ }
31
+ export type RootUpdatedEvent = TypedEvent<[
32
+ string,
33
+ string
34
+ ], RootUpdatedEventObject>;
35
+ export type RootUpdatedEventFilter = TypedEventFilter<RootUpdatedEvent>;
36
+ export interface TokenAllocatedEventObject {
37
+ account: string;
38
+ campaignId: number;
39
+ amount: BigNumber;
40
+ }
41
+ export type TokenAllocatedEvent = TypedEvent<[
42
+ string,
43
+ number,
44
+ BigNumber
45
+ ], TokenAllocatedEventObject>;
46
+ export type TokenAllocatedEventFilter = TypedEventFilter<TokenAllocatedEvent>;
47
+ export interface IAirdropDistributorEvents extends BaseContract {
48
+ connect(signerOrProvider: Signer | Provider | string): this;
49
+ attach(addressOrName: string): this;
50
+ deployed(): Promise<this>;
51
+ interface: IAirdropDistributorEventsInterface;
52
+ queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
53
+ listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
54
+ listeners(eventName?: string): Array<Listener>;
55
+ removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
56
+ removeAllListeners(eventName?: string): this;
57
+ off: OnEvent<this>;
58
+ on: OnEvent<this>;
59
+ once: OnEvent<this>;
60
+ removeListener: OnEvent<this>;
61
+ functions: {};
62
+ callStatic: {};
63
+ filters: {
64
+ "Claimed(address,uint256,bool)"(account?: PromiseOrValue<string> | null, amount?: null, historic?: PromiseOrValue<boolean> | null): ClaimedEventFilter;
65
+ Claimed(account?: PromiseOrValue<string> | null, amount?: null, historic?: PromiseOrValue<boolean> | null): ClaimedEventFilter;
66
+ "RootUpdated(bytes32,bytes32)"(oldRoot?: null, newRoot?: PromiseOrValue<BytesLike> | null): RootUpdatedEventFilter;
67
+ RootUpdated(oldRoot?: null, newRoot?: PromiseOrValue<BytesLike> | null): RootUpdatedEventFilter;
68
+ "TokenAllocated(address,uint8,uint256)"(account?: PromiseOrValue<string> | null, campaignId?: PromiseOrValue<BigNumberish> | null, amount?: null): TokenAllocatedEventFilter;
69
+ TokenAllocated(account?: PromiseOrValue<string> | null, campaignId?: PromiseOrValue<BigNumberish> | null, amount?: null): TokenAllocatedEventFilter;
70
+ };
71
+ estimateGas: {};
72
+ populateTransaction: {};
73
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export type { IAirdropDistributor } from "./IAirdropDistributor";
2
+ export type { IAirdropDistributorEvents } from "./IAirdropDistributorEvents";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });