@gearbox-protocol/sdk 1.20.22 → 1.20.23
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/README.md +4 -0
- package/lib/apy/convexAPY.d.ts +2 -2
- package/lib/apy/curveAPY.d.ts +2 -2
- package/lib/apy/curveAPY.js +4 -2
- package/lib/apy/index.d.ts +3 -3
- package/lib/apy/lidoAPY.js +1 -1
- package/lib/apy/yearnAPY.d.ts +1 -1
- package/lib/apy/yearnAPY.js +1 -1
- package/lib/contracts/adapters.d.ts +2 -1
- package/lib/contracts/adapters.js +1 -0
- package/lib/contracts/contracts.d.ts +21 -17
- package/lib/contracts/contracts.js +27 -8
- package/lib/contracts/contractsRegister.d.ts +1 -1
- package/lib/contracts/protocols.d.ts +2 -1
- package/lib/contracts/protocols.js +5 -0
- package/lib/core/assets.d.ts +1 -1
- package/lib/core/chains.d.ts +1 -1
- package/lib/core/chains.js +1 -1
- package/lib/core/creditSession.d.ts +5 -5
- package/lib/core/errors.d.ts +1 -1
- package/lib/core/eventOrTx.d.ts +4 -4
- package/lib/core/events.d.ts +2 -2
- package/lib/core/history.d.ts +2 -2
- package/lib/core/pool/data.js +1 -1
- package/lib/core/pool/operation.d.ts +1 -1
- package/lib/core/rewardClaimer.js +1 -1
- package/lib/core/rewardConvex.js +1 -1
- package/lib/core/strategy.d.ts +1 -1
- package/lib/core/trade.d.ts +1 -1
- package/lib/core/trade.js +1 -1
- package/lib/core/transactions.d.ts +1 -1
- package/lib/core/wcOperation/index.d.ts +2 -2
- package/lib/core/wcOperation/operations.d.ts +5 -5
- package/lib/oracles/oracles.d.ts +13 -2
- package/lib/oracles/oracles.js +5 -0
- package/lib/oracles/priceFeeds.js +56 -0
- package/lib/pathfinder/pathOptions.d.ts +1 -1
- package/lib/pathfinder/pathfinder.js +1 -1
- package/lib/pathfinder/tradeTypes.d.ts +13 -2
- package/lib/pathfinder/tradeTypes.js +2 -0
- package/lib/payload/creditAccount.d.ts +2 -2
- package/lib/payload/creditManager.d.ts +1 -1
- package/lib/payload/pool.d.ts +1 -1
- package/lib/tokens/balancer.d.ts +22 -0
- package/lib/tokens/balancer.js +53 -0
- package/lib/tokens/convex.d.ts +5 -5
- package/lib/tokens/convex.js +42 -0
- package/lib/tokens/curveLP.d.ts +4 -4
- package/lib/tokens/curveLP.js +23 -0
- package/lib/tokens/decimals.js +7 -0
- package/lib/tokens/gear.d.ts +4 -4
- package/lib/tokens/normal.d.ts +2 -2
- package/lib/tokens/normal.js +35 -0
- package/lib/tokens/token.d.ts +5 -4
- package/lib/tokens/token.js +18 -1
- package/lib/tokens/tokenData.d.ts +1 -1
- package/lib/tokens/tokenType.d.ts +2 -1
- package/lib/tokens/tokenType.js +1 -0
- package/lib/tokens/yearn.d.ts +4 -4
- package/lib/types/@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.d.ts +4 -4
- package/lib/types/@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACL.d.ts +8 -8
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol/IACLEvents.d.ts +8 -8
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactory.d.ts +10 -10
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAccountFactory.sol/IAccountFactoryEvents.d.ts +10 -10
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProvider.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAddressProvider.sol/IAddressProviderEvents.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributor.d.ts +6 -6
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributorEvents.d.ts +6 -6
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegister.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IContractsRegister.sol/IContractsRegisterEvents.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfigurator.d.ts +38 -38
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditConfigurator.sol/ICreditConfiguratorEvents.d.ts +38 -38
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacade.d.ts +28 -28
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents.d.ts +26 -26
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExtended.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2Events.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDataCompressor.sol/IDataCompressor.d.ts +10 -10
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributor.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDegenDistributor.sol/IDegenDistributorEvents.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFT.d.ts +12 -12
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDegenNFT.sol/IDegenNFTEvents.d.ts +6 -6
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IDieselToken.sol/IDieselToken.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeed.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ILPPriceFeed.sol/ILPPriceFeedEvents.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPhantomERC20.d.ts +4 -4
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolService.d.ts +20 -20
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPoolService.sol/IPoolServiceEvents.d.ts +20 -20
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Events.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IPriceOracle.sol/IPriceOracleV2Ext.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditFilter.d.ts +16 -16
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/V1/ICreditManager.d.ts +20 -20
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/adapters/IUniversalAdapter.sol/IUniversalAdapter.d.ts +2 -2
- package/lib/types/@gearbox-protocol/core-v2/contracts/pool/PoolService.d.ts +24 -24
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/convex/IConvexToken.d.ts +4 -4
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETH.d.ts +4 -4
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IstETH.sol/IstETHGetters.d.ts +4 -4
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETH.d.ts +4 -4
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/lido/IwstETH.sol/IwstETHGetters.d.ts +4 -4
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/integrations/yearn/IYVault.d.ts +4 -4
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1Adapter.d.ts +2 -2
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/interfaces/lido/ILidoV1Adapter.sol/ILidoV1AdapterEvents.d.ts +2 -2
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/interfaces/yearn/IYearnV2Adapter.d.ts +4 -4
- package/lib/types/@gearbox-protocol/integrations-v2/contracts/test/mocks/integrations/LidoMock.sol/ILidoMockEvents.d.ts +2 -2
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver.d.ts +10 -10
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositor.d.ts +8 -8
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/IDepositor.sol/IDepositorOptions.d.ts +8 -8
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorker.d.ts +8 -8
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/ILPWorker.sol/ILPWorkerOptions.d.ts +8 -8
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/IPathResolver.d.ts +8 -8
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/IRouter.d.ts +16 -16
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/ISwapAggregator.d.ts +12 -12
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/ISwapper.d.ts +6 -6
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawer.d.ts +8 -8
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/IWithdrawer.sol/IWithdrawerOptions.d.ts +10 -10
- package/lib/types/@gearbox-protocol/router/contracts/interfaces/IWrapper.d.ts +6 -6
- package/lib/types/@openzeppelin/contracts/token/ERC20/IERC20.d.ts +4 -4
- package/lib/types/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.d.ts +4 -4
- package/lib/types/@openzeppelin/contracts/token/ERC721/IERC721.d.ts +6 -6
- package/lib/types/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.d.ts +6 -6
- package/lib/types/common.d.ts +4 -4
- package/lib/types/contracts/ITokenDistributor.sol/ITokenDistributor.d.ts +8 -8
- package/lib/types/contracts/ITokenDistributor.sol/ITokenDistributorEvents.d.ts +8 -8
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/pool/PoolService__factory.d.ts +1 -1
- package/lib/types/factories/contracts/support/MultiCall.sol/Multicall2__factory.d.ts +1 -1
- package/lib/utils/mappers.d.ts +1 -1
- package/lib/utils/multicall.js +1 -1
- package/lib/utils/repeater.js +1 -1
- package/lib/utils/types.d.ts +5 -5
- package/lib/watchers/creditAccountWatcher.d.ts +1 -1
- package/lib/watchers/creditAccountWatcher.js +1 -1
- package/lib/watchers/creditManagerWatcher.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,3 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gearbox core types SDK
|
|
4
4
|
Contains core datastructures which are used across multiple gearbox services
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Important information for contributors
|
|
8
|
+
As a contributor to the Gearbox Protocol GitHub repository, your pull requests indicate acceptance of our Gearbox Contribution Agreement. This agreement outlines that you assign the Intellectual Property Rights of your contributions to the Gearbox Foundation. This helps safeguard the Gearbox protocol and ensure the accumulation of its intellectual property. Contributions become part of the repository and may be used for various purposes, including commercial. As recognition for your expertise and work, you receive the opportunity to participate in the protocol's development and the potential to see your work integrated within it. The full Gearbox Contribution Agreement is accessible within the [repository](/ContributionAgreement) for comprehensive understanding. [Let's innovate together!]
|
package/lib/apy/convexAPY.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { CurveLPToken } from "../tokens/curveLP";
|
|
|
5
5
|
import { SupportedToken } from "../tokens/token";
|
|
6
6
|
import { MCall } from "../utils/multicall";
|
|
7
7
|
import { CurveAPYResult } from "./curveAPY";
|
|
8
|
-
|
|
8
|
+
type GetTokenPriceCallback = (tokenAddress: string, currency?: string) => BigNumber;
|
|
9
9
|
export interface GetConvexAPYBulkProps {
|
|
10
10
|
getTokenPrice: GetTokenPriceCallback;
|
|
11
11
|
curveAPY: CurveAPYResult;
|
|
@@ -13,7 +13,7 @@ export interface GetConvexAPYBulkProps {
|
|
|
13
13
|
response: Array<BigNumber>;
|
|
14
14
|
}
|
|
15
15
|
export declare function getConvexAPYBulk({ generated, response, getTokenPrice, curveAPY, }: GetConvexAPYBulkProps): BigNumber[];
|
|
16
|
-
|
|
16
|
+
type GetConvexAPYBulkCallsReturns = ReturnType<typeof getConvexAPYBulkCalls>;
|
|
17
17
|
export interface GetConvexAPYBulkCallsProps {
|
|
18
18
|
pools: Array<ConvexPoolContract>;
|
|
19
19
|
networkType: NetworkType;
|
package/lib/apy/curveAPY.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
2
|
import { CurveLPToken } from "../tokens/curveLP";
|
|
3
3
|
import { GearboxToken } from "../tokens/gear";
|
|
4
|
-
|
|
4
|
+
type CurveAPYTokens = CurveLPToken | GearboxToken;
|
|
5
5
|
interface CurveAPY {
|
|
6
6
|
base: BigNumber;
|
|
7
7
|
crv: BigNumber;
|
|
8
8
|
gauge: Array<[string, BigNumber]>;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type CurveAPYResult = Record<CurveAPYTokens, CurveAPY>;
|
|
11
11
|
export declare function getCurveAPY(): Promise<CurveAPYResult>;
|
|
12
12
|
export {};
|
package/lib/apy/curveAPY.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -62,7 +62,8 @@ var APY_DICTIONARY = {
|
|
|
62
62
|
crvPlain3andSUSD: "15",
|
|
63
63
|
steCRV: "14",
|
|
64
64
|
crvFRAX: "44",
|
|
65
|
-
GEAR: "factory-crypto-192",
|
|
65
|
+
GEAR: "factory-crypto-192",
|
|
66
|
+
OHMFRAXBP: "factory-crypto-158", // 0xfc1e8bf3e81383ef07be24c3fd146745719de48d
|
|
66
67
|
};
|
|
67
68
|
var CRV_APY_RESPONSE_DECIMALS = 100;
|
|
68
69
|
var ZERO = {
|
|
@@ -130,6 +131,7 @@ function getCurveAPY() {
|
|
|
130
131
|
crvPlain3andSUSD: ZERO,
|
|
131
132
|
steCRV: ZERO,
|
|
132
133
|
GEAR: ZERO,
|
|
134
|
+
OHMFRAXBP: ZERO,
|
|
133
135
|
}];
|
|
134
136
|
case 3: return [2 /*return*/];
|
|
135
137
|
}
|
package/lib/apy/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LPTokens, SupportedToken } from "../tokens/token";
|
|
2
|
-
export
|
|
2
|
+
export type AdditionalTokenWithAPY = Extract<SupportedToken, "STETH">;
|
|
3
3
|
export declare const additionalTokensWIthAPY: Record<AdditionalTokenWithAPY, true>;
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type TokensWithAPY = LPTokens | Extract<SupportedToken, "STETH">;
|
|
5
|
+
export type LpTokensAPY = Record<TokensWithAPY, number>;
|
|
6
6
|
export declare const isTokenWithAPY: (t: unknown) => t is TokensWithAPY;
|
|
7
7
|
export * from "./convexAPY";
|
|
8
8
|
export * from "./curveAPY";
|
package/lib/apy/lidoAPY.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
package/lib/apy/yearnAPY.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
2
|
import { YearnLPToken } from "../tokens/yearn";
|
|
3
|
-
export
|
|
3
|
+
export type YearnAPYResult = Record<YearnLPToken, BigNumber>;
|
|
4
4
|
export declare function getYearnAPY(): Promise<YearnAPYResult>;
|
package/lib/apy/yearnAPY.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -19,4 +19,5 @@ var AdapterInterface;
|
|
|
19
19
|
AdapterInterface[AdapterInterface["LIDO_V1"] = 13] = "LIDO_V1";
|
|
20
20
|
AdapterInterface[AdapterInterface["UNIVERSAL"] = 14] = "UNIVERSAL";
|
|
21
21
|
AdapterInterface[AdapterInterface["LIDO_WSTETH_V1"] = 15] = "LIDO_WSTETH_V1";
|
|
22
|
+
AdapterInterface[AdapterInterface["BALANCER_VAULT"] = 16] = "BALANCER_VAULT";
|
|
22
23
|
})(AdapterInterface = exports.AdapterInterface || (exports.AdapterInterface = {}));
|
|
@@ -5,26 +5,26 @@ import { NormalToken } from "../tokens/normal";
|
|
|
5
5
|
import type { YearnLPToken } from "../tokens/yearn";
|
|
6
6
|
import { AdapterInterface } from "./adapters";
|
|
7
7
|
import { Protocols } from "./protocols";
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
8
|
+
export type UniswapV2Contract = "UNISWAP_V2_ROUTER" | "SUSHISWAP_ROUTER";
|
|
9
|
+
export type CurvePoolContract = "CURVE_3CRV_POOL" | "CURVE_FRAX_USDC_POOL" | "CURVE_STETH_GATEWAY" | "CURVE_FRAX_POOL" | "CURVE_LUSD_POOL" | "CURVE_GUSD_POOL" | "CURVE_SUSD_POOL" | "CURVE_SUSD_DEPOSIT" | "CURVE_OHM_FRAXBP";
|
|
10
|
+
export type YearnVaultContract = "YEARN_DAI_VAULT" | "YEARN_USDC_VAULT" | "YEARN_WETH_VAULT" | "YEARN_WBTC_VAULT" | "YEARN_CURVE_FRAX_VAULT" | "YEARN_CURVE_STETH_VAULT";
|
|
11
|
+
export type ConvexPoolContract = "CONVEX_3CRV_POOL" | "CONVEX_FRAX_USDC_POOL" | "CONVEX_GUSD_POOL" | "CONVEX_SUSD_POOL" | "CONVEX_STECRV_POOL" | "CONVEX_FRAX3CRV_POOL" | "CONVEX_LUSD3CRV_POOL" | "CONVEX_OHMFRAXBP_POOL";
|
|
12
|
+
export type SupportedContract = UniswapV2Contract | "UNISWAP_V3_ROUTER" | CurvePoolContract | "CURVE_GEAR_POOL" | YearnVaultContract | "CONVEX_BOOSTER" | ConvexPoolContract | "CONVEX_CLAIM_ZAP" | "LIDO_STETH_GATEWAY" | "LIDO_WSTETH" | "BALANCER_VAULT";
|
|
13
13
|
export declare const contractsByNetwork: Record<NetworkType, Record<SupportedContract, string>>;
|
|
14
14
|
export declare const UNISWAP_V3_QUOTER = "0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6";
|
|
15
15
|
export interface BaseContractParams {
|
|
16
16
|
name: string;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
type UniswapV2Params = {
|
|
19
19
|
protocol: Protocols.Uniswap | Protocols.Sushiswap;
|
|
20
20
|
type: AdapterInterface.UNISWAP_V2_ROUTER;
|
|
21
21
|
} & BaseContractParams;
|
|
22
|
-
|
|
22
|
+
type UniswapV3Params = {
|
|
23
23
|
protocol: Protocols.Uniswap;
|
|
24
24
|
type: AdapterInterface.UNISWAP_V3_ROUTER;
|
|
25
25
|
quoter: string;
|
|
26
26
|
} & BaseContractParams;
|
|
27
|
-
export
|
|
27
|
+
export type CurveParams = {
|
|
28
28
|
protocol: Protocols.Curve;
|
|
29
29
|
type: AdapterInterface.CURVE_V1_2ASSETS | AdapterInterface.CURVE_V1_3ASSETS | AdapterInterface.CURVE_V1_4ASSETS | AdapterInterface.CURVE_V1_WRAPPER;
|
|
30
30
|
lpToken: CurveLPToken;
|
|
@@ -32,26 +32,26 @@ export declare type CurveParams = {
|
|
|
32
32
|
underlyings?: Array<NormalToken>;
|
|
33
33
|
wrapper?: CurvePoolContract;
|
|
34
34
|
} & BaseContractParams;
|
|
35
|
-
export
|
|
35
|
+
export type CurveSteCRVPoolParams = {
|
|
36
36
|
protocol: Protocols.Curve;
|
|
37
37
|
type: AdapterInterface.CURVE_V1_STECRV_POOL;
|
|
38
38
|
pool: Record<NetworkType, string>;
|
|
39
39
|
tokens: ["WETH", "STETH"];
|
|
40
40
|
lpToken: "steCRV";
|
|
41
41
|
} & BaseContractParams;
|
|
42
|
-
export
|
|
42
|
+
export type CurveGEARPoolParams = {
|
|
43
43
|
protocol: Protocols.Curve;
|
|
44
44
|
type: AdapterInterface.CURVE_V1_2ASSETS;
|
|
45
45
|
pool: Record<NetworkType, string>;
|
|
46
46
|
tokens: ["GEAR", "WETH"];
|
|
47
47
|
lpToken: "GEAR";
|
|
48
48
|
} & BaseContractParams;
|
|
49
|
-
export
|
|
49
|
+
export type YearnParams = {
|
|
50
50
|
protocol: Protocols.Yearn;
|
|
51
51
|
type: AdapterInterface.YEARN_V2;
|
|
52
52
|
shareToken: YearnLPToken;
|
|
53
53
|
} & BaseContractParams;
|
|
54
|
-
|
|
54
|
+
type ConvexParams = {
|
|
55
55
|
protocol: Protocols.Convex;
|
|
56
56
|
type: AdapterInterface.CONVEX_V1_BOOSTER | AdapterInterface.CONVEX_V1_CLAIM_ZAP;
|
|
57
57
|
} & BaseContractParams;
|
|
@@ -59,27 +59,31 @@ interface ConvexExtraPoolParams {
|
|
|
59
59
|
rewardToken: NormalToken;
|
|
60
60
|
poolAddress: Record<NetworkType, string>;
|
|
61
61
|
}
|
|
62
|
-
export
|
|
62
|
+
export type ConvexPoolParams = {
|
|
63
63
|
protocol: Protocols.Convex;
|
|
64
64
|
type: AdapterInterface.CONVEX_V1_BASE_REWARD_POOL;
|
|
65
65
|
stakedToken: ConvexStakedPhantomToken;
|
|
66
66
|
extraRewards: Array<ConvexExtraPoolParams>;
|
|
67
67
|
} & BaseContractParams;
|
|
68
|
-
export
|
|
68
|
+
export type LidoParams = {
|
|
69
69
|
protocol: Protocols.Lido;
|
|
70
70
|
type: AdapterInterface.LIDO_V1;
|
|
71
71
|
oracle: Record<NetworkType, string>;
|
|
72
72
|
lpToken: "steCRV";
|
|
73
73
|
} & BaseContractParams;
|
|
74
|
-
export
|
|
74
|
+
export type LidoWsthETHParams = {
|
|
75
75
|
protocol: Protocols.Lido;
|
|
76
76
|
type: AdapterInterface.LIDO_WSTETH_V1;
|
|
77
77
|
} & BaseContractParams;
|
|
78
|
-
export
|
|
78
|
+
export type UniversalParams = {
|
|
79
79
|
protocol: Protocols.Gearbox;
|
|
80
80
|
type: AdapterInterface.UNIVERSAL;
|
|
81
81
|
} & BaseContractParams;
|
|
82
|
-
export
|
|
82
|
+
export type BalancerParams = {
|
|
83
|
+
protocol: Protocols.Balancer;
|
|
84
|
+
type: AdapterInterface.BALANCER_VAULT;
|
|
85
|
+
} & BaseContractParams;
|
|
86
|
+
export type ContractParams = UniswapV2Params | UniswapV3Params | CurveParams | CurveSteCRVPoolParams | CurveGEARPoolParams | YearnParams | ConvexParams | ConvexPoolParams | LidoParams | LidoWsthETHParams | UniversalParams | BalancerParams;
|
|
83
87
|
export declare const contractParams: Record<SupportedContract, ContractParams>;
|
|
84
88
|
export declare const contractsByAddress: Record<string, SupportedContract>;
|
|
85
89
|
export declare const isSupportedContract: (t: unknown) => t is SupportedContract;
|
|
@@ -31,6 +31,7 @@ exports.contractsByNetwork = {
|
|
|
31
31
|
CURVE_SUSD_DEPOSIT: "0xFCBa3E75865d2d561BE8D220616520c171F12851",
|
|
32
32
|
CURVE_GUSD_POOL: "0x4f062658EaAF2C1ccf8C8e36D6824CDf41167956",
|
|
33
33
|
CURVE_GEAR_POOL: "0x0e9b5b092cad6f1c5e6bc7f89ffe1abb5c95f1c2",
|
|
34
|
+
CURVE_OHM_FRAXBP: "0xFc1e8bf3E81383Ef07Be24c3FD146745719DE48D",
|
|
34
35
|
// YEARN
|
|
35
36
|
YEARN_DAI_VAULT: token_1.tokenDataByNetwork.Mainnet.yvDAI,
|
|
36
37
|
YEARN_USDC_VAULT: token_1.tokenDataByNetwork.Mainnet.yvUSDC,
|
|
@@ -48,11 +49,12 @@ exports.contractsByNetwork = {
|
|
|
48
49
|
CONVEX_FRAX3CRV_POOL: "0xB900EF131301B307dB5eFcbed9DBb50A3e209B2e",
|
|
49
50
|
CONVEX_LUSD3CRV_POOL: "0x2ad92A7aE036a038ff02B96c88de868ddf3f8190",
|
|
50
51
|
CONVEX_CLAIM_ZAP: "0x92Cf9E5e4D1Dfbf7dA0d2BB3e884a68416a65070",
|
|
52
|
+
CONVEX_OHMFRAXBP_POOL: "0x27A8c58e3DE84280826d615D80ddb33930383fE9",
|
|
51
53
|
// LIDO
|
|
52
54
|
LIDO_STETH_GATEWAY: "0x6f4b4aB5142787c05b7aB9A9692A0f46b997C29D",
|
|
53
55
|
LIDO_WSTETH: token_1.tokenDataByNetwork.Mainnet.wstETH,
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
+
// BALANCER
|
|
57
|
+
BALANCER_VAULT: "0xba12222222228d8ba445958a75a0704d566bf2c8",
|
|
56
58
|
},
|
|
57
59
|
//
|
|
58
60
|
//
|
|
@@ -77,6 +79,7 @@ exports.contractsByNetwork = {
|
|
|
77
79
|
CURVE_SUSD_DEPOSIT: "0x9782f1fF1AEFb387F01cae72F668F13E8061d9Dd",
|
|
78
80
|
CURVE_GUSD_POOL: "0x8C954d89C2fB2c96F0195738b8c5538B34D5344E",
|
|
79
81
|
CURVE_GEAR_POOL: "deploy me",
|
|
82
|
+
CURVE_OHM_FRAXBP: "deploy me",
|
|
80
83
|
// YEARN
|
|
81
84
|
YEARN_DAI_VAULT: token_1.tokenDataByNetwork.Goerli.yvDAI,
|
|
82
85
|
YEARN_USDC_VAULT: token_1.tokenDataByNetwork.Goerli.yvUSDC,
|
|
@@ -94,11 +97,12 @@ exports.contractsByNetwork = {
|
|
|
94
97
|
CONVEX_LUSD3CRV_POOL: "0x8550134faa6Cb42a7668f3D9098EBa59FA959b40",
|
|
95
98
|
CONVEX_GUSD_POOL: "0xa8eD353f56BB2e1063B8a011F0491a1703998De4",
|
|
96
99
|
CONVEX_CLAIM_ZAP: "0x74C7Bb6493C5EcfDb49E3ED5Ee4B60012b724b4b",
|
|
100
|
+
CONVEX_OHMFRAXBP_POOL: "deploy me",
|
|
97
101
|
// LIDO
|
|
98
102
|
LIDO_STETH_GATEWAY: "0x9290E44f5f819b7de0Fb88b10641f9F08a999BF7",
|
|
99
103
|
LIDO_WSTETH: token_1.tokenDataByNetwork.Goerli.wstETH,
|
|
100
|
-
//
|
|
101
|
-
|
|
104
|
+
// BALANCER
|
|
105
|
+
BALANCER_VAULT: "deploy me",
|
|
102
106
|
},
|
|
103
107
|
};
|
|
104
108
|
exports.UNISWAP_V3_QUOTER = "0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6";
|
|
@@ -194,6 +198,14 @@ exports.contractParams = {
|
|
|
194
198
|
tokens: ["GUSD", "3Crv"],
|
|
195
199
|
underlyings: ["GUSD", "DAI", "USDC", "USDT"],
|
|
196
200
|
},
|
|
201
|
+
CURVE_OHM_FRAXBP: {
|
|
202
|
+
name: "Curve OHM_FRAXBP",
|
|
203
|
+
protocol: protocols_1.Protocols.Curve,
|
|
204
|
+
type: adapters_1.AdapterInterface.CURVE_V1_2ASSETS,
|
|
205
|
+
lpToken: "OHMFRAXBP",
|
|
206
|
+
tokens: ["OHM", "crvFRAX"],
|
|
207
|
+
underlyings: ["OHM", "FRAX", "USDC"],
|
|
208
|
+
},
|
|
197
209
|
YEARN_DAI_VAULT: {
|
|
198
210
|
name: "Yearn DAI",
|
|
199
211
|
protocol: protocols_1.Protocols.Yearn,
|
|
@@ -321,6 +333,13 @@ exports.contractParams = {
|
|
|
321
333
|
},
|
|
322
334
|
],
|
|
323
335
|
},
|
|
336
|
+
CONVEX_OHMFRAXBP_POOL: {
|
|
337
|
+
name: "Convex OHMFRAXBP",
|
|
338
|
+
protocol: protocols_1.Protocols.Convex,
|
|
339
|
+
type: adapters_1.AdapterInterface.CONVEX_V1_BASE_REWARD_POOL,
|
|
340
|
+
stakedToken: "stkcvxOHMFRAXBP",
|
|
341
|
+
extraRewards: [],
|
|
342
|
+
},
|
|
324
343
|
LIDO_STETH_GATEWAY: {
|
|
325
344
|
name: "Lido STETH",
|
|
326
345
|
protocol: protocols_1.Protocols.Lido,
|
|
@@ -336,10 +355,10 @@ exports.contractParams = {
|
|
|
336
355
|
protocol: protocols_1.Protocols.Lido,
|
|
337
356
|
type: adapters_1.AdapterInterface.LIDO_WSTETH_V1,
|
|
338
357
|
},
|
|
339
|
-
|
|
340
|
-
name: "
|
|
341
|
-
protocol: protocols_1.Protocols.
|
|
342
|
-
type: adapters_1.AdapterInterface.
|
|
358
|
+
BALANCER_VAULT: {
|
|
359
|
+
name: "Balancer Vault",
|
|
360
|
+
protocol: protocols_1.Protocols.Balancer,
|
|
361
|
+
type: adapters_1.AdapterInterface.BALANCER_VAULT,
|
|
343
362
|
},
|
|
344
363
|
};
|
|
345
364
|
exports.contractsByAddress = (0, mappers_1.objectEntries)(exports.contractsByNetwork).reduce(function (acc, _a) {
|
|
@@ -11,6 +11,6 @@ export declare const CREDIT_MANAGER_USDC_V2_GOERLI: string;
|
|
|
11
11
|
export declare const CREDIT_MANAGER_WETH_V2_GOERLI: string;
|
|
12
12
|
export declare const CREDIT_MANAGER_WSTETH_V2_GOERLI: string;
|
|
13
13
|
export declare const CREDIT_MANAGER_WBTC_V2_GOERLI: string;
|
|
14
|
-
export
|
|
14
|
+
export type CreditManagersV2 = typeof CREDIT_MANAGER_DAI_V2_MAINNET | typeof CREDIT_MANAGER_USDC_V2_MAINNET | typeof CREDIT_MANAGER_WETH_V2_MAINNET | typeof CREDIT_MANAGER_WSTETH_V2_MAINNET | typeof CREDIT_MANAGER_WBTC_V2_MAINNET | typeof CREDIT_MANAGER_DAI_V2_GOERLI | typeof CREDIT_MANAGER_USDC_V2_GOERLI | typeof CREDIT_MANAGER_WETH_V2_GOERLI | typeof CREDIT_MANAGER_WSTETH_V2_GOERLI | typeof CREDIT_MANAGER_WBTC_V2_GOERLI | typeof CREDIT_MANAGER_FRAX_V2_MAINNET;
|
|
15
15
|
export declare const deployedContracts: Record<string, string>;
|
|
16
16
|
export declare function getContractName(address: string): string;
|
|
@@ -11,6 +11,7 @@ var Protocols;
|
|
|
11
11
|
Protocols[Protocols["Convex"] = 4] = "Convex";
|
|
12
12
|
Protocols[Protocols["Lido"] = 5] = "Lido";
|
|
13
13
|
Protocols[Protocols["Gearbox"] = 6] = "Gearbox";
|
|
14
|
+
Protocols[Protocols["Balancer"] = 7] = "Balancer";
|
|
14
15
|
})(Protocols = exports.Protocols || (exports.Protocols = {}));
|
|
15
16
|
exports.protocolData = (_a = {},
|
|
16
17
|
_a[Protocols.Uniswap] = {
|
|
@@ -41,4 +42,8 @@ exports.protocolData = (_a = {},
|
|
|
41
42
|
name: "Gearbox",
|
|
42
43
|
icon: "",
|
|
43
44
|
},
|
|
45
|
+
_a[Protocols.Balancer] = {
|
|
46
|
+
name: "Balancer",
|
|
47
|
+
icon: "",
|
|
48
|
+
},
|
|
44
49
|
_a);
|
package/lib/core/assets.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface NextAssetProps<T extends Asset> {
|
|
|
17
17
|
tokensList: Record<string, TokenData>;
|
|
18
18
|
prices?: Record<string, BigNumber>;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export type WrapResult<T> = [Array<T>, BigNumber, BigNumber];
|
|
21
21
|
export declare class AssetUtils {
|
|
22
22
|
static nextAsset<T extends Asset>({ allowedTokens, selectedAssets, balances, tokensList, prices, }: NextAssetProps<T>): string | undefined;
|
|
23
23
|
static getBalances(allowedTokens: Array<string>, externalBalances: Record<string, BigNumber>): Record<string, BigNumber>;
|
package/lib/core/chains.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const CHAINS: {
|
|
|
17
17
|
readonly Polygon: 137;
|
|
18
18
|
readonly Arbiturum: 42161;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type NetworkType = "Mainnet" | "Goerli";
|
|
21
21
|
export declare const getNetworkType: (chainId: number, localAs?: NetworkType) => NetworkType;
|
|
22
22
|
export declare const isSupportedNetwork: (chainId: number | undefined) => chainId is number;
|
|
23
23
|
export declare function detectNetwork(provider: ethers.providers.Provider): Promise<NetworkType>;
|
package/lib/core/chains.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
2
|
import { CreditSessionFilteredPayload, CreditSessionPayload, CreditSessionsAggregatedStatsPayload, UserCreditSessionsAggregatedStatsPayload } from "../payload/creditSession";
|
|
3
3
|
import { AssetWithView } from "./assets";
|
|
4
|
-
export
|
|
4
|
+
export type CreditSessionStatus = "active" | "closed" | "repaid" | "liquidated" | "liquidateExpired" | "liquidatePaused";
|
|
5
5
|
export declare const CREDIT_SESSION_STATUS_BY_ID: Record<number, CreditSessionStatus>;
|
|
6
6
|
export declare const CREDIT_SESSION_ID_BY_STATUS: Record<CreditSessionStatus, number>;
|
|
7
7
|
export declare class CreditSession {
|
|
@@ -65,14 +65,14 @@ export declare class CreditSessionFiltered {
|
|
|
65
65
|
readonly balances: Array<AssetWithView>;
|
|
66
66
|
constructor(payload: CreditSessionFilteredPayload);
|
|
67
67
|
}
|
|
68
|
-
export
|
|
69
|
-
export
|
|
68
|
+
export type CreditSessionSortFields = "type" | "tvl" | "hf" | "debt" | "pnl" | "leverage" | "tfIndex";
|
|
69
|
+
export type CreditSessionSortType = "asc" | "desc";
|
|
70
70
|
export interface UserCreditSessions extends Omit<UserCreditSessionsAggregatedStatsPayload, "accounts" | "totalValue10kBasis"> {
|
|
71
71
|
totalValueChange: number;
|
|
72
72
|
accounts: Array<CreditSession>;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
export
|
|
74
|
+
type AggregatedOmit = "healthFactor10kBasis" | "leverage10kBasis" | "activeAccounts10kBasis" | "openedAccounts10kBasis" | "healthFactor" | "healthFactorOld";
|
|
75
|
+
export type CreditSessionsAggregatedStats = Omit<CreditSessionsAggregatedStatsPayload, AggregatedOmit> & {
|
|
76
76
|
healthFactorChange: number;
|
|
77
77
|
leverageChange: number;
|
|
78
78
|
activeAccountsChange: number;
|
package/lib/core/errors.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface MetamaskError {
|
|
|
4
4
|
message: string;
|
|
5
5
|
data: string;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type OpenAccountErrorTypes = "insufficientPoolLiquidity" | "leverageGreaterMax" | "wrongLeverage" | "amountGreaterMax" | "amountLessMin";
|
|
8
8
|
export declare class OpenAccountError extends Error {
|
|
9
9
|
message: OpenAccountErrorTypes;
|
|
10
10
|
payload: {
|
package/lib/core/eventOrTx.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { TxSerialized } from "./transactions";
|
|
|
3
3
|
export interface Display {
|
|
4
4
|
toString: (tokenData: Record<string, TokenData>) => string;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export type TxStatus = "pending" | "success" | "reverted";
|
|
7
7
|
export interface EventOrTxProps {
|
|
8
8
|
block: number;
|
|
9
9
|
txHash: string;
|
|
@@ -21,15 +21,15 @@ export declare abstract class EventOrTx implements Display {
|
|
|
21
21
|
compare(item: EventOrTx): number;
|
|
22
22
|
abstract toString(): string;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type EVMEventProps = Omit<EventOrTxProps, "txStatus"> & {
|
|
25
25
|
logId?: number;
|
|
26
26
|
};
|
|
27
27
|
export declare abstract class EVMEvent extends EventOrTx {
|
|
28
28
|
logId?: number;
|
|
29
29
|
constructor(opts: EVMEventProps);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
export
|
|
31
|
+
type OptionalFields = "block" | "txStatus";
|
|
32
|
+
export type EVMTxProps = Omit<EventOrTxProps, OptionalFields> & Partial<Pick<EventOrTxProps, OptionalFields>>;
|
|
33
33
|
export declare abstract class EVMTx extends EventOrTx {
|
|
34
34
|
constructor({ txHash, block, txStatus, timestamp, }: EVMTxProps);
|
|
35
35
|
abstract serialize(): TxSerialized;
|
package/lib/core/events.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export declare class EventCMNewParameters extends EVMEvent {
|
|
|
141
141
|
constructor(opts: CMNewParametersProps);
|
|
142
142
|
toString(): string;
|
|
143
143
|
}
|
|
144
|
-
export
|
|
144
|
+
export type TokenAllowanceType = "NewToken" | "LTUpdated" | "Allowed";
|
|
145
145
|
interface TokenAllowedProps extends EVMEventProps {
|
|
146
146
|
creditManager: string;
|
|
147
147
|
token: string;
|
|
@@ -168,7 +168,7 @@ export declare class EventTokenForbidden extends EVMEvent {
|
|
|
168
168
|
constructor(opts: TokenForbiddenProps);
|
|
169
169
|
toString(): string;
|
|
170
170
|
}
|
|
171
|
-
export
|
|
171
|
+
export type EventContractAllowedStatus = "Connected" | "AdapterUpdate";
|
|
172
172
|
interface ContractAllowedProps extends EVMEventProps {
|
|
173
173
|
creditManager: string;
|
|
174
174
|
protocol: string;
|
package/lib/core/history.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ export interface BasicEvent {
|
|
|
4
4
|
txHash: string;
|
|
5
5
|
timestamp: number;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type BasicSwapEvent = BasicEvent & {
|
|
8
8
|
from: string;
|
|
9
9
|
fromAmount: BigNumber;
|
|
10
10
|
to: string;
|
|
11
11
|
toAmount: BigNumber;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type HistoryEvent = (BasicEvent & {
|
|
14
14
|
action: "OpenCreditAccount";
|
|
15
15
|
initialFunds: BigNumber;
|
|
16
16
|
leverage: number;
|
package/lib/core/pool/data.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -19,7 +19,7 @@ export declare abstract class AbstractPoolOperation {
|
|
|
19
19
|
constructor(opts: BasePoolOperation);
|
|
20
20
|
abstract toString(token: TokenData): string;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type PoolOperationResponse = BasePoolOperation & {
|
|
23
23
|
event: string;
|
|
24
24
|
};
|
|
25
25
|
export declare class PoolOperation extends AbstractPoolOperation {
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
package/lib/core/rewardConvex.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
package/lib/core/strategy.d.ts
CHANGED
|
@@ -34,5 +34,5 @@ export declare class Strategy {
|
|
|
34
34
|
protected inBaseAssets(depositCollateral: string): boolean;
|
|
35
35
|
protected inLeveragableAssets(depositCollateral: string): boolean;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
type PartialCM = Pick<CreditManagerData, "liquidationThresholds" | "address">;
|
|
38
38
|
export {};
|
package/lib/core/trade.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface TradeProps extends BaseTradeInterface {
|
|
|
17
17
|
tradePath: PathFinderResult;
|
|
18
18
|
creditFacade: string;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export type TradeOperations = "farmWithdraw" | "farmDeposit" | "swap" | "unknownOperation";
|
|
21
21
|
export declare class Trade implements BaseTradeInterface {
|
|
22
22
|
protected helper: BaseAdapter;
|
|
23
23
|
protected tradePath: PathFinderResult;
|
package/lib/core/trade.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -121,7 +121,7 @@ export declare class TxClaimReward extends EVMTx {
|
|
|
121
121
|
toString(): string;
|
|
122
122
|
serialize(): TxSerialized;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
type TxClaimNFTProps = EVMTxProps;
|
|
125
125
|
export declare class TxClaimNFT extends EVMTx {
|
|
126
126
|
constructor(opts: TxClaimNFTProps);
|
|
127
127
|
toString(): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ApproveWCOperation, FailedWCOperation, LpWCOperation, SwapWCOperation } from "./operations";
|
|
2
2
|
export * from "./operations";
|
|
3
3
|
export * from "./types";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type AllWCOperations = FailedWCOperation | ApproveWCOperation | SwapWCOperation | LpWCOperation;
|
|
5
|
+
export type SupportedWCOperations = ApproveWCOperation | SwapWCOperation | LpWCOperation;
|
|
6
6
|
export declare class WcOperationCreator {
|
|
7
7
|
static newSwapOperation: typeof SwapWCOperation.create;
|
|
8
8
|
static newLPOperation: typeof LpWCOperation.create;
|
|
@@ -2,7 +2,7 @@ import { BigNumber } from "ethers";
|
|
|
2
2
|
import { CreditManagerData } from "../creditManager";
|
|
3
3
|
import { BaseWcOperation, BaseWcOperationProps, SupportedWcOperation, SupportedWcOperationProps } from "./abstractOperations";
|
|
4
4
|
import { RawTransaction } from "./types";
|
|
5
|
-
export
|
|
5
|
+
export type FailedWCOperationType = "unsupported" | "bad_request" | "unsupported_tokens";
|
|
6
6
|
interface FailedWCOperationProps extends BaseWcOperationProps {
|
|
7
7
|
message: string;
|
|
8
8
|
kind: FailedWCOperationType;
|
|
@@ -13,7 +13,7 @@ export declare class FailedWCOperation extends BaseWcOperation {
|
|
|
13
13
|
constructor({ raw, kind, message }: FailedWCOperationProps);
|
|
14
14
|
static create(props: FailedWCOperationProps): FailedWCOperation;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
type ApproveWCOperationType = "approve";
|
|
17
17
|
interface ApproveWcOperationProps extends SupportedWcOperationProps {
|
|
18
18
|
kind: ApproveWCOperationType;
|
|
19
19
|
to: string;
|
|
@@ -32,7 +32,7 @@ export declare class ApproveWCOperation extends SupportedWcOperation {
|
|
|
32
32
|
constructor(props: ApproveWcOperationProps);
|
|
33
33
|
static create({ to: token, args, raw, creditManager, }: CreateApproveWCOperation): FailedWCOperation | ApproveWCOperation;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
type SwapWCOperationType = "swap";
|
|
36
36
|
interface SwapWCOperationProps extends SupportedWcOperationProps {
|
|
37
37
|
kind: SwapWCOperationType;
|
|
38
38
|
from: string;
|
|
@@ -58,8 +58,8 @@ export declare class SwapWCOperation extends SupportedWcOperation {
|
|
|
58
58
|
constructor(props: SwapWCOperationProps);
|
|
59
59
|
static create(params: CreateSwapWCOperationProps): SwapWCOperation;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
type LpWCOperationType = "lp";
|
|
62
|
+
type LpType = "withdraw" | "deposit";
|
|
63
63
|
interface LpWCOperationProps extends SupportedWcOperationProps {
|
|
64
64
|
kind: LpWCOperationType;
|
|
65
65
|
from: string;
|