@gearbox-protocol/sdk 14.12.0-next.65 → 14.12.0-next.67
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/dist/cjs/common-utils/index.js +2 -2
- package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.js +3 -3
- package/dist/cjs/common-utils/utils/assets-math.js +7 -7
- package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +2 -2
- package/dist/cjs/common-utils/utils/creditAccount/debt.js +2 -2
- package/dist/cjs/common-utils/utils/creditAccount/quota-utils.js +5 -5
- package/dist/cjs/common-utils/utils/index.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +5 -5
- package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +2 -2
- package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.js +4 -4
- package/dist/cjs/dev/index.js +2 -1
- package/dist/cjs/dev/kycUtils.js +1 -1
- package/dist/cjs/dev/midasUtils.js +104 -0
- package/dist/cjs/model/history.js +28 -0
- package/dist/cjs/model/history.schema.js +84 -0
- package/dist/cjs/model/index.js +64 -0
- package/dist/cjs/model/liquidations.js +23 -0
- package/dist/cjs/model/liquidations.schema.js +91 -0
- package/dist/cjs/model/opportunities.js +55 -0
- package/dist/cjs/model/opportunities.schema.js +220 -0
- package/dist/cjs/model/package.json +1 -0
- package/dist/cjs/model/positions.js +1 -0
- package/dist/cjs/model/primitives.js +1 -0
- package/dist/cjs/model/primitives.schema.js +85 -0
- package/dist/cjs/new-sdk/AbstractNamespace.js +158 -0
- package/dist/cjs/new-sdk/GearboxSDK.js +122 -0
- package/dist/cjs/new-sdk/index.js +11 -0
- package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +122 -0
- package/dist/cjs/new-sdk/opportunities/index.js +4 -0
- package/dist/cjs/new-sdk/opportunities/types.js +1 -0
- package/dist/cjs/new-sdk/package.json +1 -0
- package/dist/cjs/new-sdk/types.js +22 -0
- package/dist/cjs/new-sdk/utils/history.js +1 -0
- package/dist/cjs/new-sdk/utils/index.js +2 -0
- package/dist/cjs/offchain/GearboxAPI.js +33 -0
- package/dist/cjs/offchain/index.js +8 -0
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +97 -0
- package/dist/cjs/offchain/opportunities/index.js +4 -0
- package/dist/cjs/offchain/package.json +1 -0
- package/dist/cjs/offchain/types.js +1 -0
- package/dist/cjs/preview/preview/buildDelayedPreview.js +5 -5
- package/dist/cjs/rewards/rewards/api.js +2 -2
- package/dist/cjs/rewards/rewards/extra-apy.js +2 -2
- package/dist/cjs/sdk/MultichainSDK.js +18 -2
- package/dist/cjs/sdk/OnchainSDK.js +8 -1
- package/dist/cjs/sdk/accounts/index.js +2 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +150 -106
- package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
- package/dist/cjs/sdk/accounts/liquidations/constants.js +13 -0
- package/dist/cjs/sdk/accounts/liquidations/index.js +2 -0
- package/dist/cjs/sdk/base/MultichainConstruct.js +80 -0
- package/dist/cjs/sdk/base/TokensMeta.js +51 -0
- package/dist/cjs/sdk/base/index.js +2 -0
- package/dist/cjs/sdk/chain/chains.js +76 -0
- package/dist/cjs/sdk/chain/index.js +4 -0
- package/dist/cjs/sdk/core/errors.js +13 -0
- package/dist/cjs/sdk/core/index.js +2 -1
- package/dist/cjs/sdk/index.js +25 -1
- package/dist/cjs/sdk/market/MarketConfiguratorContract.js +14 -0
- package/dist/cjs/sdk/market/MarketSuite.js +163 -0
- package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +26 -0
- package/dist/cjs/sdk/market/credit/CreditSuite.js +102 -0
- package/dist/cjs/sdk/market/math.js +104 -0
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
- package/dist/cjs/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
- package/dist/cjs/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
- package/dist/cjs/sdk/market/pool/PoolSuite.js +28 -0
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +27 -0
- package/dist/cjs/sdk/market/pool/math.js +44 -0
- package/dist/cjs/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
- package/dist/cjs/sdk/opportunities/MultichainOpportunitiesService.js +60 -0
- package/dist/cjs/sdk/opportunities/OpportunitiesService.js +103 -0
- package/dist/cjs/sdk/opportunities/index.js +12 -0
- package/dist/cjs/sdk/types/multichain.js +1 -0
- package/dist/cjs/{common-utils → sdk}/utils/bigint-math.js +11 -11
- package/dist/cjs/sdk/utils/index.js +3 -0
- package/dist/cjs/sdk/utils/zod.js +12 -0
- package/dist/esm/common-utils/index.js +1 -1
- package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.js +1 -1
- package/dist/esm/common-utils/utils/assets-math.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/debt.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/quota-utils.js +1 -1
- package/dist/esm/common-utils/utils/index.js +1 -1
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +1 -1
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +1 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.js +1 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +1 -1
- package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.js +1 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/index.js +3 -3
- package/dist/esm/dev/kycUtils.js +1 -1
- package/dist/esm/dev/midasUtils.js +105 -2
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/history.js +26 -0
- package/dist/esm/model/history.schema.js +76 -0
- package/dist/esm/model/index.js +9 -0
- package/dist/esm/model/liquidations.js +22 -0
- package/dist/esm/model/liquidations.schema.js +83 -0
- package/dist/esm/model/opportunities.js +51 -0
- package/dist/esm/model/opportunities.schema.js +198 -0
- package/dist/esm/model/package.json +1 -0
- package/dist/esm/model/positions.js +1 -0
- package/dist/esm/model/primitives.js +1 -0
- package/dist/esm/model/primitives.schema.js +75 -0
- package/dist/esm/new-sdk/AbstractNamespace.js +157 -0
- package/dist/esm/new-sdk/GearboxSDK.js +121 -0
- package/dist/esm/new-sdk/index.js +7 -0
- package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +121 -0
- package/dist/esm/new-sdk/opportunities/index.js +3 -0
- package/dist/esm/new-sdk/opportunities/types.js +1 -0
- package/dist/esm/new-sdk/package.json +1 -0
- package/dist/esm/new-sdk/types.js +21 -0
- package/dist/esm/new-sdk/utils/history.js +1 -0
- package/dist/esm/new-sdk/utils/index.js +2 -0
- package/dist/esm/offchain/GearboxAPI.js +32 -0
- package/dist/esm/offchain/index.js +5 -0
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +95 -0
- package/dist/esm/offchain/opportunities/index.js +2 -0
- package/dist/esm/offchain/package.json +1 -0
- package/dist/esm/offchain/types.js +1 -0
- package/dist/esm/preview/preview/buildDelayedPreview.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/rewards/rewards/api.js +1 -1
- package/dist/esm/rewards/rewards/extra-apy.js +1 -1
- package/dist/esm/sdk/MultichainSDK.js +18 -2
- package/dist/esm/sdk/OnchainSDK.js +8 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/sdk/accounts/index.js +2 -2
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +153 -109
- package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
- package/dist/esm/sdk/accounts/liquidations/constants.js +12 -1
- package/dist/esm/sdk/accounts/liquidations/index.js +2 -2
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/sdk/base/MultichainConstruct.js +79 -0
- package/dist/esm/sdk/base/TokensMeta.js +53 -2
- package/dist/esm/sdk/base/index.js +2 -1
- package/dist/esm/sdk/chain/chains.js +74 -2
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/chain/index.js +2 -2
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/core/errors.js +13 -1
- package/dist/esm/sdk/core/index.js +2 -2
- package/dist/esm/sdk/index.js +11 -5
- package/dist/esm/sdk/market/MarketConfiguratorContract.js +14 -0
- package/dist/esm/sdk/market/MarketSuite.js +163 -0
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +26 -0
- package/dist/esm/sdk/market/credit/CreditSuite.js +102 -0
- package/dist/esm/sdk/market/math.js +98 -0
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
- package/dist/esm/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
- package/dist/esm/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
- package/dist/esm/sdk/market/pool/PoolSuite.js +28 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +28 -1
- package/dist/esm/sdk/market/pool/math.js +41 -0
- package/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/opportunities/MultichainOpportunitiesService.js +59 -0
- package/dist/esm/sdk/opportunities/OpportunitiesService.js +102 -0
- package/dist/esm/sdk/opportunities/index.js +4 -0
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/types/multichain.js +1 -0
- package/dist/esm/{common-utils → sdk}/utils/bigint-math.js +11 -11
- package/dist/esm/sdk/utils/index.js +3 -2
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/sdk/utils/zod.js +13 -2
- package/dist/types/common-utils/index.d.ts +1 -1
- package/dist/types/common-utils/utils/index.d.ts +1 -1
- package/dist/types/dev/index.d.ts +2 -2
- package/dist/types/dev/midasUtils.d.ts +31 -2
- package/dist/types/model/history.d.ts +105 -0
- package/dist/types/model/history.schema.d.ts +66 -0
- package/dist/types/model/index.d.ts +9 -0
- package/dist/types/model/liquidations.d.ts +230 -0
- package/dist/types/model/liquidations.schema.d.ts +292 -0
- package/dist/types/model/opportunities.d.ts +543 -0
- package/dist/types/model/opportunities.schema.d.ts +1066 -0
- package/dist/types/model/positions.d.ts +11 -0
- package/dist/types/model/primitives.d.ts +193 -0
- package/dist/types/model/primitives.schema.d.ts +81 -0
- package/dist/types/new-sdk/AbstractNamespace.d.ts +119 -0
- package/dist/types/new-sdk/GearboxSDK.d.ts +78 -0
- package/dist/types/new-sdk/index.d.ts +9 -0
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +69 -0
- package/dist/types/new-sdk/opportunities/index.d.ts +3 -0
- package/dist/types/new-sdk/opportunities/types.d.ts +66 -0
- package/dist/types/new-sdk/types.d.ts +149 -0
- package/dist/types/new-sdk/utils/history.d.ts +44 -0
- package/dist/types/new-sdk/utils/index.d.ts +2 -0
- package/dist/types/offchain/GearboxAPI.d.ts +31 -0
- package/dist/types/offchain/index.d.ts +5 -0
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +69 -0
- package/dist/types/offchain/opportunities/index.d.ts +2 -0
- package/dist/types/offchain/types.d.ts +50 -0
- package/dist/types/sdk/MultichainSDK.d.ts +15 -2
- package/dist/types/sdk/OnchainSDK.d.ts +9 -3
- package/dist/types/sdk/accounts/index.d.ts +3 -3
- package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +24 -16
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +26 -20
- package/dist/types/sdk/accounts/liquidations/constants.d.ts +12 -1
- package/dist/types/sdk/accounts/liquidations/index.d.ts +3 -3
- package/dist/types/sdk/accounts/liquidations/types.d.ts +34 -309
- package/dist/types/sdk/base/MultichainConstruct.d.ts +57 -0
- package/dist/types/sdk/base/TokensMeta.d.ts +26 -0
- package/dist/types/sdk/base/index.d.ts +2 -1
- package/dist/types/sdk/chain/chains.d.ts +68 -1
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/core/errors.d.ts +10 -1
- package/dist/types/sdk/core/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +15 -8
- package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +9 -0
- package/dist/types/sdk/market/MarketSuite.d.ts +109 -1
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +14 -0
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +47 -0
- package/dist/types/sdk/market/credit/types.d.ts +22 -0
- package/dist/types/sdk/market/index.d.ts +2 -2
- package/dist/types/sdk/market/math.d.ts +74 -0
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +23 -0
- package/dist/types/sdk/market/oracle/types.d.ts +46 -0
- package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +12 -0
- package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +22 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +23 -0
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +18 -0
- package/dist/types/sdk/market/pool/math.d.ts +57 -0
- package/dist/types/sdk/market/pool/types.d.ts +23 -0
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +6 -0
- package/dist/types/sdk/market/pricefeeds/types.d.ts +10 -0
- package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +40 -0
- package/dist/types/sdk/opportunities/OpportunitiesService.d.ts +47 -0
- package/dist/types/sdk/opportunities/index.d.ts +4 -0
- package/dist/types/sdk/types/index.d.ts +2 -1
- package/dist/types/sdk/types/multichain.d.ts +65 -0
- package/dist/types/sdk/types/state.d.ts +1 -1
- package/dist/types/sdk/types/transactions.d.ts +3 -0
- package/dist/types/{common-utils → sdk}/utils/bigint-math.d.ts +7 -11
- package/dist/types/sdk/utils/index.d.ts +3 -2
- package/dist/types/sdk/utils/zod.d.ts +6 -2
- package/package.json +16 -1
- package/dist/cjs/sdk/accounts/liquidations/helpers.js +0 -201
- package/dist/esm/sdk/accounts/liquidations/helpers.js +0 -192
- package/dist/types/sdk/accounts/liquidations/helpers.d.ts +0 -140
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ILogger, LogFn } from "./types/logger.js";
|
|
2
|
+
import { Curator, GearboxChain, NetworkType, SUPPORTED_NETWORKS, SunsetStrategy, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork } from "./chain/chains.js";
|
|
3
|
+
import { MultichainNetworkMeta, MultichainNetworkProps, MultichainNetworksProps, MultichainResult, WithMultichain } from "./types/multichain.js";
|
|
2
4
|
import { ClaimableWithdrawal, CurrentWithdrawals, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, PendingWithdrawal, RedemptionLog, RequestableWithdrawal, WithdrawableAsset, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, toWithdrawalStatus } from "./accounts/withdrawal-compressor/types.js";
|
|
3
|
-
import { Curator, GearboxChain, NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getChain, getCuratorName, getNetworkType, isPublicNetwork, isSupportedNetwork } from "./chain/chains.js";
|
|
4
5
|
import { detectNetwork } from "./chain/detectNetwork.js";
|
|
5
6
|
import "./chain/index.js";
|
|
6
7
|
import { SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulationError, SimulationErrorType, simulateCall } from "./utils/viem/simulateCall.js";
|
|
@@ -9,6 +10,7 @@ import { AddressSet } from "./utils/AddressSet.js";
|
|
|
9
10
|
import { AdapterData, AssertAssignable, Asset, BaseParams, BaseState, ConnectedBotData, CreditAccountData, CreditAccountDataPayload, CreditConfiguratorState, CreditFacadeState, CreditManagerDebtParams, CreditManagerState, CreditSuiteState, GaugeData, IBaseContract, MarketData, MarketFilter, ParsedCall, ParsedCallArgs, ParsedCallV2, PoolState, PriceFeedAnswer, PriceFeedMapEntry, PriceFeedTreeNode, PriceOracleData, QuotaKeeperState, QuotaState, RateKeeperState, RelaxedBaseParams, RewardInfo, TokenInfo, Unarray, VotingContractStatus } from "./base/types.js";
|
|
10
11
|
import { AssetsMap } from "./utils/AssetsMap.js";
|
|
11
12
|
import { functionArgsToMap, functionArgsToRecord, getFunctionSignature } from "./utils/abi-decode.js";
|
|
13
|
+
import { BigIntMath } from "./utils/bigint-math.js";
|
|
12
14
|
import { bytes32ToString } from "./utils/bytes32ToString.js";
|
|
13
15
|
import { childLogger } from "./utils/childLogger.js";
|
|
14
16
|
import { createRawTx } from "./utils/createRawTx.js";
|
|
@@ -99,7 +101,7 @@ import { GaugeContract, GaugeParams } from "./market/pool/GaugeContract.js";
|
|
|
99
101
|
import { LinearInterestRateModelContract } from "./market/pool/LinearInterestRateModelContract.js";
|
|
100
102
|
import { PoolSuite } from "./market/pool/PoolSuite.js";
|
|
101
103
|
import { PoolV310Contract } from "./market/pool/PoolV310Contract.js";
|
|
102
|
-
import { MarketSuite } from "./market/MarketSuite.js";
|
|
104
|
+
import { MarketSuite, StrategyRef, StrategyTotalsLookup } from "./market/MarketSuite.js";
|
|
103
105
|
import { CreditSuite } from "./market/credit/CreditSuite.js";
|
|
104
106
|
import { ZapperData } from "./market/types.js";
|
|
105
107
|
import { IZapperContract, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem } from "./market/zapper/types.js";
|
|
@@ -110,6 +112,10 @@ import { IERC20ZapperContract } from "./market/zapper/IERC20ZapperContract.js";
|
|
|
110
112
|
import { IETHZapperContract } from "./market/zapper/IETHZapperContract.js";
|
|
111
113
|
import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./market/MarketRegister.js";
|
|
112
114
|
import "./market/index.js";
|
|
115
|
+
import { additionalBorrowApyBps, borrowApyBps, maxLeverage, rayToBps, usdToNumber, utilizationBps } from "./market/math.js";
|
|
116
|
+
import { MultichainOpportunitiesService } from "./opportunities/MultichainOpportunitiesService.js";
|
|
117
|
+
import { OpportunitiesService } from "./opportunities/OpportunitiesService.js";
|
|
118
|
+
import "./opportunities/index.js";
|
|
113
119
|
import { ContractMethod, IPriceUpdateTx, MultiCall, RawTx } from "./types/transactions.js";
|
|
114
120
|
import { AddLiquidityProps, DepositMetadata, IPoolsService, MarketType, PoolServiceCall, PoolServiceCallResult, RemoveLiquidityProps, WithdrawalMetadata } from "./pools/types.js";
|
|
115
121
|
import { PoolService } from "./pools/PoolService.js";
|
|
@@ -124,7 +130,7 @@ import { Methods, PartialRecord, SupportedValue, TypedObjectUtils } from "./util
|
|
|
124
130
|
import { RetryOptions, retry } from "./utils/retry.js";
|
|
125
131
|
import { toAddress } from "./utils/toAddress.js";
|
|
126
132
|
import { PickSomeRequired } from "./utils/type-utils.js";
|
|
127
|
-
import { ZodAddress } from "./utils/zod.js";
|
|
133
|
+
import { ZodAddress, ZodHex } from "./utils/zod.js";
|
|
128
134
|
import "./utils/index.js";
|
|
129
135
|
import { LPMonopolizedPoolMeta, PHANTOM_TOKEN_CONTRACT_TYPES, PhantomTokenContractType, PhantomTokenMeta, RWADefaultTokenMeta, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWATokenMeta, RWAUnderlyingContractType, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, SimpleTokenMeta, TokenMetaData } from "./base/token-types.js";
|
|
130
136
|
import { FormatBNOptions, TokensMeta } from "./base/TokensMeta.js";
|
|
@@ -133,21 +139,22 @@ import { Construct, ConstructOptions } from "./base/Construct.js";
|
|
|
133
139
|
import { AddressProviderAddresses, AddressProviderState, IAddressProviderContract } from "./core/types.js";
|
|
134
140
|
import { AddressProviderV310Contract } from "./core/AddressProviderV310Contract.js";
|
|
135
141
|
import { createAddressProvider, hydrateAddressProvider } from "./core/createAddressProvider.js";
|
|
136
|
-
import { SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
|
|
142
|
+
import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
|
|
137
143
|
import "./core/index.js";
|
|
138
144
|
import { GearboxState, MultichainState } from "./types/state.js";
|
|
139
145
|
import "./types/index.js";
|
|
140
146
|
import { BaseContract, BaseContractArgs, ContractParseError, ContractParseErrorOptions } from "./base/BaseContract.js";
|
|
141
147
|
import { MissingSerializedParamsError } from "./base/errors.js";
|
|
148
|
+
import { ChainConfig, MultichainAttachOptions, MultichainHydrateOptions, MultichainSDK, MultichainSDKOptions, MultichainSyncStateOptions } from "./MultichainSDK.js";
|
|
149
|
+
import { ChainQueryProps, MultichainConstruct } from "./base/MultichainConstruct.js";
|
|
142
150
|
import { PlaceholderContract } from "./base/PlaceholderContract.js";
|
|
143
151
|
import { SDKConstruct } from "./base/SDKConstruct.js";
|
|
144
152
|
import "./base/index.js";
|
|
145
153
|
import { CreditAccountServiceOptions, CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.js";
|
|
146
|
-
import { LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./accounts/liquidations/constants.js";
|
|
147
|
-
import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase,
|
|
154
|
+
import { DUST_THRESHOLD, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./accounts/liquidations/constants.js";
|
|
155
|
+
import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, LoadRWALiquidatorsProps, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, RWALiquidatorInfo } from "./accounts/liquidations/types.js";
|
|
148
156
|
import { LiquidationsService } from "./accounts/liquidations/LiquidationsService.js";
|
|
149
|
-
import { ChainConfig, MultichainAttachOptions, MultichainHydrateOptions, MultichainSDK, MultichainSDKOptions, MultichainSyncStateOptions } from "./MultichainSDK.js";
|
|
150
157
|
import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
|
|
151
158
|
import "./accounts/index.js";
|
|
152
159
|
import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
153
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountToCheck, AdapterData, AddCollateralProps, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, ChainConfig, ChainContractsRegister, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, ClosePathBalances, CompositePriceFeedContract, ConnectedBotData, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountData, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountServiceOptions, CreditAccountTokensSlice, CreditAccountsServiceV310, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, Curator, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DefaultPartialLiquidationParams, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteSwapProps, ExternalPriceFeedContract, type FetchPythPayloadsOptions, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidatorWithdrawalsProps, GetLiquidatorWithdrawalsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, ILiquidationsService, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, InstantReceivedAsset, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, LEVERAGE_DECIMALS, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidatableAccount, LiquidationApproval, LiquidationDetails, LiquidationsService, LiquidatorWithdrawal, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MultichainAttachOptions, MultichainHydrateOptions, MultichainLiquidationsService, MultichainNetworkProps, MultichainNetworksProps, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnDemandPriceUpdates, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, ReceivedAsset, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StartDelayedWithdrawalProps, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpdateQuotasProps, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, WithMultichain, WithdrawCollateralProps, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, numberWithCommas, onchainSDKOptionsSchema, percentFmt, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, watchBlocksAsync };
|
|
160
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountToCheck, AdapterData, AddCollateralProps, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, ClosePathBalances, CompositePriceFeedContract, ConnectedBotData, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountData, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountServiceOptions, CreditAccountTokensSlice, CreditAccountsServiceV310, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, Curator, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DefaultPartialLiquidationParams, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteSwapProps, ExternalPriceFeedContract, type FetchPythPayloadsOptions, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationsService, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MultichainAttachOptions, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkMeta, type MultichainNetworkProps, type MultichainNetworksProps, MultichainOpportunitiesService, type MultichainResult, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnDemandPriceUpdates, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StartDelayedWithdrawalProps, StrategyRef, StrategyTotalsLookup, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpdateQuotasProps, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithMultichain, WithdrawCollateralProps, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodHex, additionalBorrowApyBps, assetsMap, attachOptionsSchema, borrowApyBps, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, maxLeverage, numberWithCommas, onchainSDKOptionsSchema, percentFmt, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, utilizationBps, watchBlocksAsync };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Curator } from "../../model/primitives.js";
|
|
1
2
|
import { PeripheryContract } from "../constants/periphery.js";
|
|
2
3
|
import "../constants/index.js";
|
|
4
|
+
import "../../model/index.js";
|
|
3
5
|
import { ConstructOptions } from "../base/Construct.js";
|
|
4
6
|
import { BaseContract } from "../base/BaseContract.js";
|
|
5
7
|
import "../base/index.js";
|
|
@@ -1534,6 +1536,13 @@ declare class MarketConfiguratorContract extends BaseContract<abi> {
|
|
|
1534
1536
|
#private;
|
|
1535
1537
|
constructor(options: ConstructOptions, address: Address);
|
|
1536
1538
|
loadCuratorName(): Promise<void>;
|
|
1539
|
+
/**
|
|
1540
|
+
* The entity operating this configurator, as the shared read model describes
|
|
1541
|
+
* it. The curated per-chain table wins over the name the contract reports,
|
|
1542
|
+
* because the two sources must agree across services and only the table is
|
|
1543
|
+
* shared with the backend.
|
|
1544
|
+
*/
|
|
1545
|
+
get curator(): Curator;
|
|
1537
1546
|
static getPeripheryContractBatch(configurators: MarketConfiguratorContract[], client: MarketConfiguratorContract["client"], contract: PeripheryContract, blockNumber?: bigint): Promise<({
|
|
1538
1547
|
error?: undefined;
|
|
1539
1548
|
result: readonly `0x${string}`[];
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Amount, Curator, Token } from "../../model/primitives.js";
|
|
1
2
|
import { MarketData } from "../base/types.js";
|
|
3
|
+
import { Opportunity, OpportunityFilter, PoolOpportunity, PoolOpportunityDetail, PriceFeedSummary, QuotaAsset, StrategyOpportunityDetail } from "../../model/opportunities.js";
|
|
4
|
+
import "../../model/index.js";
|
|
2
5
|
import { IRWAFactory } from "./rwa/types.js";
|
|
3
6
|
import { MarketStateHuman } from "../types/state-human.js";
|
|
4
7
|
import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
@@ -16,6 +19,22 @@ import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
|
16
19
|
import "../base/index.js";
|
|
17
20
|
import { Address } from "viem";
|
|
18
21
|
//#region src/sdk/market/MarketSuite.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* One `(credit suite, target collateral)` pair that qualifies as a leveraged
|
|
24
|
+
* position.
|
|
25
|
+
*/
|
|
26
|
+
interface StrategyRef {
|
|
27
|
+
suite: CreditSuite;
|
|
28
|
+
collateral: Address;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the summed worth of the credit accounts backing one strategy.
|
|
32
|
+
*
|
|
33
|
+
* Passed into the market rather than computed by it: establishing it takes a
|
|
34
|
+
* credit-account query that spans every market of a chain, so doing it per
|
|
35
|
+
* market would turn one query into many.
|
|
36
|
+
*/
|
|
37
|
+
type StrategyTotalsLookup = (creditManager: Address, collateral: Address) => Amount | undefined;
|
|
19
38
|
/**
|
|
20
39
|
* Aggregates all SDK wrappers that make up one Gearbox market.
|
|
21
40
|
*
|
|
@@ -85,6 +104,95 @@ declare class MarketSuite extends SDKConstruct {
|
|
|
85
104
|
* this market. Defined only for RWA markets.
|
|
86
105
|
*/
|
|
87
106
|
get rwaFactory(): IRWAFactory | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* {@inheritDoc IPoolContract.unwrappedUnderlying}
|
|
109
|
+
*/
|
|
110
|
+
get unwrappedUnderlying(): Address;
|
|
111
|
+
/**
|
|
112
|
+
* The market's underlying as the shared read model describes it.
|
|
113
|
+
*
|
|
114
|
+
* For an RWA market this is the token the underlying wraps rather than the
|
|
115
|
+
* wrapper itself, because only that token means anything to a reader. The
|
|
116
|
+
* wrapper converts one-for-one, so amounts denominated in it stay exact.
|
|
117
|
+
*/
|
|
118
|
+
get underlyingToken(): Token;
|
|
119
|
+
/**
|
|
120
|
+
* {@inheritDoc MarketConfiguratorContract.curator}
|
|
121
|
+
*/
|
|
122
|
+
get curator(): Curator;
|
|
123
|
+
/**
|
|
124
|
+
* Every `(credit suite, collateral)` pair of this market that qualifies as a
|
|
125
|
+
* leveraged position.
|
|
126
|
+
*/
|
|
127
|
+
get strategies(): StrategyRef[];
|
|
128
|
+
/**
|
|
129
|
+
* Tokens a position can actually be built on in this market, deduplicated
|
|
130
|
+
* across its credit suites.
|
|
131
|
+
*/
|
|
132
|
+
get collateralTokens(): Token[];
|
|
133
|
+
/**
|
|
134
|
+
* Whether at least one of {@link collateralTokens} is a real-world-asset
|
|
135
|
+
* token. Read from a hardcoded per-chain list rather than from the chain.
|
|
136
|
+
*/
|
|
137
|
+
get rwa(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Whether this market's pool is being wound down and should no longer be
|
|
140
|
+
* entered. Read from a hardcoded per-chain list.
|
|
141
|
+
*/
|
|
142
|
+
get sunset(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Quota configuration of every token the market quotes: how much of it the
|
|
145
|
+
* market accepts in total, and what holding it costs.
|
|
146
|
+
*/
|
|
147
|
+
quotaAssets(): QuotaAsset[];
|
|
148
|
+
/**
|
|
149
|
+
* Prices and feeds of a collateral token and the market's underlying.
|
|
150
|
+
*
|
|
151
|
+
* Pricing goes through the wrapper for an RWA market, since that is what the
|
|
152
|
+
* market's oracle knows.
|
|
153
|
+
*
|
|
154
|
+
* @param collateral - Collateral token to price.
|
|
155
|
+
*/
|
|
156
|
+
priceFeedSummary(collateral: Address): PriceFeedSummary;
|
|
157
|
+
/**
|
|
158
|
+
* Every opportunity this market offers: its pool, plus one row per
|
|
159
|
+
* `(credit manager, target collateral)` pair.
|
|
160
|
+
*
|
|
161
|
+
* @param totals - Resolves the summed worth of the credit accounts backing a
|
|
162
|
+
* strategy, which only a credit-account query can establish.
|
|
163
|
+
* @param filter - Optional narrowing. A filter naming a kind skips building
|
|
164
|
+
* the other kind entirely; every built row is then checked in full by
|
|
165
|
+
* {@link matchesOpportunityFilter}, so there is one definition of what each
|
|
166
|
+
* criterion means.
|
|
167
|
+
*/
|
|
168
|
+
opportunities(totals: StrategyTotalsLookup, filter?: OpportunityFilter): Opportunity[];
|
|
169
|
+
/**
|
|
170
|
+
* Passive lending into this market's pool, as the shared read model
|
|
171
|
+
* describes it.
|
|
172
|
+
*/
|
|
173
|
+
poolOpportunity(): PoolOpportunity;
|
|
174
|
+
/**
|
|
175
|
+
* {@link poolOpportunity} plus the data only its detail screen needs.
|
|
176
|
+
*/
|
|
177
|
+
poolOpportunityDetail(): PoolOpportunityDetail;
|
|
178
|
+
/**
|
|
179
|
+
* Resolves a strategy of this market by its two halves.
|
|
180
|
+
*
|
|
181
|
+
* @param creditManager - Credit manager the position is opened in.
|
|
182
|
+
* @param collateral - Target collateral of the position.
|
|
183
|
+
* @throws If this market has no such credit manager, or if that manager does
|
|
184
|
+
* not accept the collateral as a strategy.
|
|
185
|
+
*/
|
|
186
|
+
mustFindStrategy(creditManager: Address, collateral: Address): StrategyRef;
|
|
187
|
+
/**
|
|
188
|
+
* Detailed view of one leveraged position of this market.
|
|
189
|
+
*
|
|
190
|
+
* @param creditManager - Credit manager the position is opened in.
|
|
191
|
+
* @param collateral - Target collateral of the position.
|
|
192
|
+
* @param totalSupply - Summed worth of the credit accounts backing it.
|
|
193
|
+
* @throws If this market has no such strategy, see {@link mustFindStrategy}.
|
|
194
|
+
*/
|
|
195
|
+
strategyOpportunityDetail(creditManager: Address, collateral: Address, totalSupply?: Amount): StrategyOpportunityDetail;
|
|
88
196
|
/**
|
|
89
197
|
* Whether any child contract wrapper has observed events that require a
|
|
90
198
|
* market resync.
|
|
@@ -105,4 +213,4 @@ declare class MarketSuite extends SDKConstruct {
|
|
|
105
213
|
stateHuman(raw?: boolean): MarketStateHuman;
|
|
106
214
|
}
|
|
107
215
|
//#endregion
|
|
108
|
-
export { MarketSuite };
|
|
216
|
+
export { MarketSuite, StrategyRef, StrategyTotalsLookup };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { iCreditManagerV310Abi } from "../../../abi/310/generated.js";
|
|
2
|
+
import { Bps, Leverage } from "../../../model/primitives.js";
|
|
2
3
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
3
4
|
import { CreditManagerState, CreditSuiteState } from "../../base/types.js";
|
|
4
5
|
import { IAdapterContract } from "../adapters/types.js";
|
|
5
6
|
import "../adapters/index.js";
|
|
7
|
+
import "../../../model/index.js";
|
|
6
8
|
import { CreditManagerStateHuman } from "../../types/state-human.js";
|
|
7
9
|
import { ICreditManagerContract } from "./types.js";
|
|
8
10
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
@@ -999,6 +1001,18 @@ declare class CreditManagerV310Contract extends BaseContract<abi> implements ICr
|
|
|
999
1001
|
constructor(sdk: OnchainSDK, { creditManager, adapters }: CreditSuiteState);
|
|
1000
1002
|
stateHuman(raw?: boolean): CreditManagerStateHuman;
|
|
1001
1003
|
get collateralTokens(): Address[];
|
|
1004
|
+
/**
|
|
1005
|
+
* {@inheritDoc ICreditManagerContract.leverageableCollaterals}
|
|
1006
|
+
*/
|
|
1007
|
+
get leverageableCollaterals(): Address[];
|
|
1008
|
+
/**
|
|
1009
|
+
* {@inheritDoc ICreditManagerContract.maxLeverage}
|
|
1010
|
+
*/
|
|
1011
|
+
maxLeverage(collateral: Address): Leverage;
|
|
1012
|
+
/**
|
|
1013
|
+
* {@inheritDoc ICreditManagerContract.liquidationPremium}
|
|
1014
|
+
*/
|
|
1015
|
+
get liquidationPremium(): Bps;
|
|
1002
1016
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
|
|
1003
1017
|
}
|
|
1004
1018
|
//#endregion
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Amount, Timestamp } from "../../../model/primitives.js";
|
|
1
2
|
import { CreditSuiteState } from "../../base/types.js";
|
|
3
|
+
import { StrategyOpportunity, StrategyOpportunityDetail } from "../../../model/opportunities.js";
|
|
4
|
+
import "../../../model/index.js";
|
|
2
5
|
import { IRouterContract } from "../../router/types.js";
|
|
3
6
|
import "../../router/index.js";
|
|
4
7
|
import { CreditSuiteStateHuman } from "../../types/state-human.js";
|
|
@@ -86,6 +89,50 @@ declare class CreditSuite extends SDKConstruct {
|
|
|
86
89
|
* expired.
|
|
87
90
|
*/
|
|
88
91
|
get isExpired(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Moment the facade expires, after which positions can no longer be opened
|
|
94
|
+
* and open ones become liquidatable, or `null` when it is not expirable.
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* The facade stores `0` for a non-expirable suite, which as a timestamp
|
|
98
|
+
* would read as 1970 rather than as "never".
|
|
99
|
+
*/
|
|
100
|
+
get expirationDate(): Timestamp | null;
|
|
101
|
+
/**
|
|
102
|
+
* Whether this suite can be used right now. A paused pool blocks borrowing,
|
|
103
|
+
* so the suite is unusable even when its own facade is live.
|
|
104
|
+
*/
|
|
105
|
+
get isPaused(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Collateral tokens a leveraged position can be built around in this suite:
|
|
108
|
+
* the ones the credit manager can lever up, narrowed to those the market
|
|
109
|
+
* still accepts quota for.
|
|
110
|
+
*/
|
|
111
|
+
get strategyCollaterals(): Address[];
|
|
112
|
+
/**
|
|
113
|
+
* Largest debt a single new position can take on right now: the tightest of
|
|
114
|
+
* this manager's remaining debt limit, the pool's free liquidity and the
|
|
115
|
+
* facade's per-account maximum.
|
|
116
|
+
*/
|
|
117
|
+
get maxBorrowAmount(): bigint;
|
|
118
|
+
/**
|
|
119
|
+
* Describes a leveraged position built on one collateral token as the shared
|
|
120
|
+
* read model does.
|
|
121
|
+
*
|
|
122
|
+
* @param collateral - Target collateral of the position.
|
|
123
|
+
* @param totalSupply - Summed worth of the credit accounts backing it, which
|
|
124
|
+
* only a credit-account query can establish. Defaults to zero, so a caller
|
|
125
|
+
* that does not care about size can omit it.
|
|
126
|
+
* @throws If the credit manager does not value the collateral.
|
|
127
|
+
*/
|
|
128
|
+
strategyOpportunity(collateral: Address, totalSupply_?: Amount): StrategyOpportunity;
|
|
129
|
+
/**
|
|
130
|
+
* {@link strategyOpportunity} plus the data only its detail screen needs.
|
|
131
|
+
*
|
|
132
|
+
* @param collateral - Target collateral of the position.
|
|
133
|
+
* @param totalSupply - Summed worth of the credit accounts backing it.
|
|
134
|
+
*/
|
|
135
|
+
strategyOpportunityDetail(collateral: Address, totalSupply?: Amount): StrategyOpportunityDetail;
|
|
89
136
|
/**
|
|
90
137
|
* Whether the facade, manager, or configurator has observed logs that require
|
|
91
138
|
* a credit-suite resync.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Bps, Leverage } from "../../../model/primitives.js";
|
|
1
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
3
|
import { IBaseContract } from "../../base/types.js";
|
|
3
4
|
import { IAdapterContract } from "../adapters/types.js";
|
|
4
5
|
import "../adapters/index.js";
|
|
6
|
+
import "../../../model/index.js";
|
|
5
7
|
import { CreditConfiguratorStateHuman, CreditFacadeStateHuman, CreditManagerStateHuman } from "../../types/state-human.js";
|
|
6
8
|
import { PriceUpdate } from "../pricefeeds/types.js";
|
|
7
9
|
import "../pricefeeds/index.js";
|
|
@@ -78,6 +80,26 @@ interface ICreditManagerContract extends IBaseContract {
|
|
|
78
80
|
* List of collateral tokens
|
|
79
81
|
*/
|
|
80
82
|
collateralTokens: Address[];
|
|
83
|
+
/**
|
|
84
|
+
* Collateral tokens a leveraged position can be built around: the underlying
|
|
85
|
+
* is excluded, because borrowing an asset against itself is not a position,
|
|
86
|
+
* and so is anything whose liquidation threshold is `0` or at least `100%`,
|
|
87
|
+
* which would mean unbounded leverage.
|
|
88
|
+
*/
|
|
89
|
+
readonly leverageableCollaterals: Address[];
|
|
90
|
+
/**
|
|
91
|
+
* Percentage of liquidated account value in bps paid to the liquidator
|
|
92
|
+
* (i.e. `100% - liquidationDiscount`).
|
|
93
|
+
*/
|
|
94
|
+
readonly liquidationPremium: Bps;
|
|
95
|
+
/**
|
|
96
|
+
* Highest leverage a collateral's liquidation threshold allows,
|
|
97
|
+
* `1 / (1 - lt)`.
|
|
98
|
+
*
|
|
99
|
+
* @param collateral - Collateral token address.
|
|
100
|
+
* @throws If the credit manager does not value the token.
|
|
101
|
+
*/
|
|
102
|
+
maxLeverage: (collateral: Address) => Leverage;
|
|
81
103
|
stateHuman: (raw?: boolean) => CreditManagerStateHuman;
|
|
82
104
|
}
|
|
83
105
|
/**
|
|
@@ -53,7 +53,7 @@ import { LinearInterestRateModelContract } from "./pool/LinearInterestRateModelC
|
|
|
53
53
|
import { PoolSuite } from "./pool/PoolSuite.js";
|
|
54
54
|
import { PoolV310Contract } from "./pool/PoolV310Contract.js";
|
|
55
55
|
import "./pool/index.js";
|
|
56
|
-
import { MarketSuite } from "./MarketSuite.js";
|
|
56
|
+
import { MarketSuite, StrategyRef, StrategyTotalsLookup } from "./MarketSuite.js";
|
|
57
57
|
import { CreditSuite } from "./credit/CreditSuite.js";
|
|
58
58
|
import "./credit/index.js";
|
|
59
59
|
import { ZapperData } from "./types.js";
|
|
@@ -65,4 +65,4 @@ import { IERC20ZapperContract } from "./zapper/IERC20ZapperContract.js";
|
|
|
65
65
|
import { IETHZapperContract } from "./zapper/IETHZapperContract.js";
|
|
66
66
|
import "./zapper/index.js";
|
|
67
67
|
import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./MarketRegister.js";
|
|
68
|
-
export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DStokenData, Erc4626PriceFeedContract, ExternalPriceFeedContract, type FetchPythPayloadsOptions, type FetchRedstonePayloadsOptions, GaugeContract, GaugeParams, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InterestRateModelType, LatestUpdate, LinearInterestRateModelContract, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, OnDemandPriceUpdates, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, type TimestampedCalldata, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, createAdapter, createPriceOracle, createZapper, fetchPythPayloads, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isRWAFactory, isUpdatablePriceFeed };
|
|
68
|
+
export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DStokenData, Erc4626PriceFeedContract, ExternalPriceFeedContract, type FetchPythPayloadsOptions, type FetchRedstonePayloadsOptions, GaugeContract, GaugeParams, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InterestRateModelType, LatestUpdate, LinearInterestRateModelContract, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, OnDemandPriceUpdates, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyRef, StrategyTotalsLookup, type TimestampedCalldata, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, createAdapter, createPriceOracle, createZapper, fetchPythPayloads, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isRWAFactory, isUpdatablePriceFeed };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Bps, Leverage } from "../../model/primitives.js";
|
|
2
|
+
import "../../model/index.js";
|
|
3
|
+
//#region src/sdk/market/math.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Converts a ray-scaled rate (`10 ** 27` = 100%) to basis points, truncating
|
|
6
|
+
* towards zero.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* rayToBps(50_000_000_000_000_000_000_000_000n) // 500, i.e. 5%
|
|
11
|
+
* ```
|
|
12
|
+
**/
|
|
13
|
+
declare function rayToBps(ray: bigint): Bps;
|
|
14
|
+
/**
|
|
15
|
+
* Converts a USD value in the oracle's 8-decimal fixed point to a float.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* usdToNumber(150_050_000_000n) // 1500.5
|
|
20
|
+
* ```
|
|
21
|
+
**/
|
|
22
|
+
declare function usdToNumber(usd: bigint): number;
|
|
23
|
+
/**
|
|
24
|
+
* Share of capital currently borrowed, in basis points. Returns `0` when there
|
|
25
|
+
* is nothing to borrow from, and never exceeds 100%.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* utilizationBps(750n, 1000n) // 7500, i.e. 75%
|
|
30
|
+
* ```
|
|
31
|
+
**/
|
|
32
|
+
declare function utilizationBps(borrowed: bigint, total: bigint): Bps;
|
|
33
|
+
/**
|
|
34
|
+
* Annual cost of debt for a credit manager, in basis points: the pool's base
|
|
35
|
+
* rate plus the protocol's cut of the accrued interest.
|
|
36
|
+
*
|
|
37
|
+
* @param baseInterestRate - Pool base rate in ray.
|
|
38
|
+
* @param feeInterest - Credit manager interest fee in basis points.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* // 5% base rate, 50% interest fee
|
|
43
|
+
* borrowApyBps(50_000_000_000_000_000_000_000_000n, 5000) // 750, i.e. 7.5%
|
|
44
|
+
* ```
|
|
45
|
+
**/
|
|
46
|
+
declare function borrowApyBps(baseInterestRate: bigint, feeInterest: number): Bps;
|
|
47
|
+
/**
|
|
48
|
+
* Highest leverage a liquidation threshold allows: `1 / (1 - lt)`.
|
|
49
|
+
*
|
|
50
|
+
* A threshold of 100% or more would allow unbounded leverage; such tokens are
|
|
51
|
+
* not strategies and are filtered out before this is called, so the guard here
|
|
52
|
+
* only exists to keep the function total.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* maxLeverage(9000) // 10
|
|
57
|
+
* maxLeverage(8000) // 5
|
|
58
|
+
* ```
|
|
59
|
+
**/
|
|
60
|
+
declare function maxLeverage(liquidationThreshold: Bps): Leverage;
|
|
61
|
+
/**
|
|
62
|
+
* Annual quota cost scaled to the debt a maximally leveraged position carries,
|
|
63
|
+
* in basis points. Every unit of own capital carries `maxLeverage - 1` units of
|
|
64
|
+
* debt, and the quota is paid on the whole quoted position.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* // 2.5% quota rate at 5x leverage
|
|
69
|
+
* additionalBorrowApyBps(250, 5) // 1000, i.e. 10%
|
|
70
|
+
* ```
|
|
71
|
+
**/
|
|
72
|
+
declare function additionalBorrowApyBps(quotaRate: Bps, leverage: Leverage): Bps;
|
|
73
|
+
//#endregion
|
|
74
|
+
export { additionalBorrowApyBps, borrowApyBps, maxLeverage, rayToBps, usdToNumber, utilizationBps };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { Amount, TokenAmount } from "../../../model/primitives.js";
|
|
1
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
3
|
import { PriceOracleData } from "../../base/types.js";
|
|
4
|
+
import { PriceFeedData, PriceFeedSummary } from "../../../model/opportunities.js";
|
|
5
|
+
import "../../../model/index.js";
|
|
3
6
|
import { DelegatedMulticall } from "../../utils/viem/executeDelegatedMulticalls.js";
|
|
4
7
|
import "../../utils/viem/index.js";
|
|
5
8
|
import { PriceOracleStateHuman } from "../../types/state-human.js";
|
|
@@ -78,6 +81,26 @@ declare abstract class PriceOracleBaseContract<abi extends Abi | readonly unknow
|
|
|
78
81
|
* {@inheritDoc IPriceOracleContract.convertFromUSD}
|
|
79
82
|
**/
|
|
80
83
|
convertFromUSD(to: Address, amount: bigint, reserve?: boolean): bigint;
|
|
84
|
+
/**
|
|
85
|
+
* {@inheritDoc IPriceOracleContract.safeUsdValue}
|
|
86
|
+
**/
|
|
87
|
+
safeUsdValue(token: Address, amount: bigint): number | null;
|
|
88
|
+
/**
|
|
89
|
+
* {@inheritDoc IPriceOracleContract.toAmount}
|
|
90
|
+
**/
|
|
91
|
+
toAmount: (token: Address, value: bigint) => Amount;
|
|
92
|
+
/**
|
|
93
|
+
* {@inheritDoc IPriceOracleContract.toTokenAmount}
|
|
94
|
+
**/
|
|
95
|
+
toTokenAmount: (token: Address, value: bigint) => TokenAmount;
|
|
96
|
+
/**
|
|
97
|
+
* {@inheritDoc IPriceOracleContract.priceFeedData}
|
|
98
|
+
**/
|
|
99
|
+
priceFeedData(token: Address): PriceFeedData;
|
|
100
|
+
/**
|
|
101
|
+
* {@inheritDoc IPriceOracleContract.priceFeedSummary}
|
|
102
|
+
**/
|
|
103
|
+
priceFeedSummary(underlying: Address, collateral: Address): PriceFeedSummary;
|
|
81
104
|
/**
|
|
82
105
|
* {@inheritDoc IPriceOracleContract.priceFeeds}
|
|
83
106
|
**/
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { Amount, TokenAmount } from "../../../model/primitives.js";
|
|
1
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
3
|
import { IBaseContract } from "../../base/types.js";
|
|
4
|
+
import { PriceFeedData, PriceFeedSummary } from "../../../model/opportunities.js";
|
|
5
|
+
import "../../../model/index.js";
|
|
3
6
|
import { DelegatedMulticall } from "../../utils/viem/executeDelegatedMulticalls.js";
|
|
4
7
|
import "../../utils/viem/index.js";
|
|
5
8
|
import { PriceOracleStateHuman } from "../../types/state-human.js";
|
|
@@ -122,6 +125,49 @@ interface IPriceOracleContract extends IBaseContract {
|
|
|
122
125
|
* @param reserve - Use reserve feeds instead of main.
|
|
123
126
|
**/
|
|
124
127
|
convertFromUSD: (to: Address, amount: bigint, reserve?: boolean) => bigint;
|
|
128
|
+
/**
|
|
129
|
+
* USD value of a token amount as the read model expresses it: plain dollars
|
|
130
|
+
* rather than {@link convertToUSD}'s 8-decimal fixed point, and `null`
|
|
131
|
+
* instead of a throw when the token cannot be priced.
|
|
132
|
+
*
|
|
133
|
+
* A dead or not-yet-updated feed must degrade one field, not fail a whole
|
|
134
|
+
* list, which is why {@link Amount.valueUsd} is nullable.
|
|
135
|
+
*
|
|
136
|
+
* @param token - Token address.
|
|
137
|
+
* @param amount - Amount in token decimals.
|
|
138
|
+
**/
|
|
139
|
+
safeUsdValue: (token: Address, amount: bigint) => number | null;
|
|
140
|
+
/**
|
|
141
|
+
* Pairs a token amount with its USD value, using {@link safeUsdValue}.
|
|
142
|
+
* Syntactic sugar for high-level sdk.
|
|
143
|
+
* @param token - Token address.
|
|
144
|
+
* @param value - Amount in token decimals.
|
|
145
|
+
**/
|
|
146
|
+
toAmount: (token: Address, value: bigint) => Amount;
|
|
147
|
+
/**
|
|
148
|
+
* Like {@link toAmount}, but also names the token, for the fields where the
|
|
149
|
+
* owning group does not.
|
|
150
|
+
* Syntactic sugar for high-level sdk.
|
|
151
|
+
* @param token - Token address.
|
|
152
|
+
* @param value - Amount in token decimals.
|
|
153
|
+
* @throws If the token is not in the registry.
|
|
154
|
+
**/
|
|
155
|
+
toTokenAmount: (token: Address, value: bigint) => TokenAmount;
|
|
156
|
+
/**
|
|
157
|
+
* Describes a token's main price feed and everything it reads from.
|
|
158
|
+
* Reserve feeds are not included.
|
|
159
|
+
* @param token - Token address.
|
|
160
|
+
* @throws If the token has no main feed in this oracle.
|
|
161
|
+
**/
|
|
162
|
+
priceFeedData: (token: Address) => PriceFeedData;
|
|
163
|
+
/**
|
|
164
|
+
* Prices and feeds of a collateral token against an underlying, i.e.
|
|
165
|
+
* everything a liquidation-price chart needs.
|
|
166
|
+
* @param underlying - Token the collateral is priced against.
|
|
167
|
+
* @param collateral - Token being priced.
|
|
168
|
+
* @throws If either token has no main feed in this oracle.
|
|
169
|
+
**/
|
|
170
|
+
priceFeedSummary: (underlying: Address, collateral: Address) => PriceFeedSummary;
|
|
125
171
|
/**
|
|
126
172
|
* Unlike {@link convert}, this method will update the price feeds before converting,
|
|
127
173
|
* and conversion will be peformed onchain using main price feeds
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { BaseState } from "../../base/types.js";
|
|
2
|
+
import { RateCurve } from "../../../model/opportunities.js";
|
|
3
|
+
import "../../../model/index.js";
|
|
2
4
|
import { LinearInterestRateModelStateHuman } from "../../types/state-human.js";
|
|
3
5
|
import { IInterestRateModelContract } from "./types.js";
|
|
6
|
+
import { RateModelParams } from "./math.js";
|
|
4
7
|
import { ConstructOptions } from "../../base/Construct.js";
|
|
5
8
|
import "../../types/index.js";
|
|
6
9
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
@@ -127,6 +130,15 @@ declare class LinearInterestRateModelContract extends BaseContract<abi> implemen
|
|
|
127
130
|
readonly Rslope3: number;
|
|
128
131
|
readonly isBorrowingMoreU2Forbidden: boolean;
|
|
129
132
|
constructor(options: ConstructOptions, params: BaseState);
|
|
133
|
+
/**
|
|
134
|
+
* The model's own parameters, gathered for the rate math.
|
|
135
|
+
*/
|
|
136
|
+
get params(): RateModelParams;
|
|
137
|
+
/**
|
|
138
|
+
* The model evaluated into chart-ready points, so that no consumer has to
|
|
139
|
+
* reimplement it.
|
|
140
|
+
*/
|
|
141
|
+
rateCurve(): RateCurve;
|
|
130
142
|
stateHuman(raw?: boolean): LinearInterestRateModelStateHuman;
|
|
131
143
|
}
|
|
132
144
|
//#endregion
|