@gearbox-protocol/sdk 16.0.0-next.17 → 16.0.0-next.19
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 +3 -21
- package/dist/cjs/common-utils/test-utils/index.js +4 -3
- package/dist/cjs/common-utils/utils/index.js +3 -22
- package/dist/cjs/common-utils/utils/strategies/index.js +3 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +5 -5
- package/dist/cjs/common-utils/utils/strategies/strategy-info/credit-manager-issues.js +135 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +12 -23
- package/dist/cjs/common-utils/utils/strategies/strategy-info/index.js +3 -0
- package/dist/cjs/onchain/accounts/index.js +2 -3
- package/dist/cjs/onchain/accounts/intents/guards.js +55 -50
- package/dist/cjs/onchain/accounts/intents/index.js +24 -16
- package/dist/cjs/onchain/accounts/intents/leverage-band.js +2 -2
- package/dist/cjs/onchain/accounts/intents/math.js +15 -22
- package/dist/cjs/onchain/accounts/intents/open-strategy.js +5 -5
- package/dist/cjs/onchain/accounts/intents/plan.js +27 -41
- package/dist/cjs/onchain/accounts/intents/realize.js +14 -21
- package/dist/cjs/onchain/accounts/intents/tail.js +2 -2
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +2 -1
- package/dist/cjs/onchain/accounts/intents/view.js +1 -0
- package/dist/cjs/onchain/constants/index.js +1 -0
- package/dist/cjs/onchain/constants/math.js +11 -0
- package/dist/cjs/onchain/index.js +32 -3
- package/dist/cjs/onchain/market/credit/CreditManagerV310Contract.js +2 -2
- package/dist/cjs/onchain/market/math.js +23 -11
- package/dist/cjs/onchain/validation/checks.js +250 -0
- package/dist/cjs/onchain/validation/index.js +29 -0
- package/dist/cjs/onchain/{accounts/intents → validation}/refusal.js +12 -1
- package/dist/cjs/onchain/validation/token.js +29 -0
- package/dist/cjs/preview/index.js +10 -0
- package/dist/cjs/preview/preview/buildDelayedPreview.js +1 -0
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +1 -0
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +1 -0
- package/dist/cjs/preview/validate/checkOperation.js +173 -0
- package/dist/cjs/preview/validate/checkSimulation.js +52 -0
- package/dist/cjs/preview/validate/index.js +6 -0
- package/dist/cjs/sdk/index.js +4 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +23 -17
- package/dist/cjs/sdk/prepare/index.js +4 -0
- package/dist/cjs/sdk/prepare/types.js +4 -0
- package/dist/esm/common-utils/index.js +2 -11
- package/dist/esm/common-utils/test-utils/index.js +4 -3
- package/dist/esm/common-utils/utils/index.js +2 -12
- package/dist/esm/common-utils/utils/strategies/index.js +2 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +5 -5
- package/dist/esm/common-utils/utils/strategies/strategy-info/credit-manager-issues.js +133 -0
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +12 -23
- package/dist/esm/common-utils/utils/strategies/strategy-info/index.js +2 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/index.js +2 -2
- package/dist/esm/onchain/accounts/intents/guards.js +55 -50
- package/dist/esm/onchain/accounts/intents/index.js +23 -14
- package/dist/esm/onchain/accounts/intents/leverage-band.js +2 -2
- package/dist/esm/onchain/accounts/intents/math.js +14 -21
- package/dist/esm/onchain/accounts/intents/open-strategy.js +4 -4
- package/dist/esm/onchain/accounts/intents/plan.js +15 -29
- package/dist/esm/onchain/accounts/intents/realize.js +12 -19
- package/dist/esm/onchain/accounts/intents/tail.js +1 -1
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +2 -1
- package/dist/esm/onchain/accounts/intents/view.js +1 -0
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/chain/detectNetwork.js +1 -1
- package/dist/esm/onchain/constants/index.js +2 -2
- package/dist/esm/onchain/constants/math.js +11 -1
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/index.js +7 -3
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditManagerV310Contract.js +2 -2
- package/dist/esm/onchain/market/math.js +23 -11
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/pools/PoolService.js +1 -1
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/onchain/validation/checks.js +230 -0
- package/dist/esm/onchain/validation/index.js +4 -0
- package/dist/esm/onchain/{accounts/intents → validation}/refusal.js +12 -2
- package/dist/esm/onchain/validation/token.js +27 -0
- package/dist/esm/preview/index.js +5 -1
- package/dist/esm/preview/preview/buildDelayedPreview.js +1 -0
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +1 -0
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +1 -0
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/preview/validate/checkOperation.js +171 -0
- package/dist/esm/preview/validate/checkSimulation.js +51 -0
- package/dist/esm/preview/validate/index.js +3 -0
- package/dist/esm/sdk/index.js +2 -1
- package/dist/esm/sdk/prepare/PrepareApi.js +21 -15
- package/dist/esm/sdk/prepare/index.js +2 -1
- package/dist/esm/sdk/prepare/types.js +2 -1
- package/dist/types/common-utils/index.d.ts +2 -12
- package/dist/types/common-utils/utils/index.d.ts +2 -13
- package/dist/types/common-utils/utils/strategies/index.d.ts +2 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/credit-manager-issues.d.ts +34 -0
- package/dist/types/common-utils/utils/strategies/strategy-info/index.d.ts +2 -1
- package/dist/types/model/previews.d.ts +22 -0
- package/dist/types/onchain/accounts/index.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/guards.d.ts +8 -4
- package/dist/types/onchain/accounts/intents/index.d.ts +20 -10
- package/dist/types/onchain/accounts/intents/leverage-band.d.ts +7 -2
- package/dist/types/onchain/accounts/intents/math.d.ts +2 -1
- package/dist/types/onchain/accounts/intents/plan.d.ts +3 -0
- package/dist/types/onchain/accounts/intents/types.d.ts +7 -1
- package/dist/types/onchain/constants/index.d.ts +2 -2
- package/dist/types/onchain/constants/math.d.ts +9 -1
- package/dist/types/onchain/index.d.ts +7 -3
- package/dist/types/onchain/market/credit/CreditManagerV310Contract.d.ts +1 -1
- package/dist/types/onchain/market/credit/types.d.ts +4 -3
- package/dist/types/onchain/market/math.d.ts +20 -9
- package/dist/types/onchain/validation/checks.d.ts +167 -0
- package/dist/types/onchain/validation/index.d.ts +4 -0
- package/dist/types/onchain/{accounts/intents → validation}/refusal.d.ts +100 -31
- package/dist/types/onchain/validation/token.d.ts +17 -0
- package/dist/types/preview/index.d.ts +5 -1
- package/dist/types/preview/validate/checkOperation.d.ts +46 -0
- package/dist/types/preview/validate/checkSimulation.d.ts +34 -0
- package/dist/types/preview/validate/index.d.ts +3 -0
- package/dist/types/sdk/index.d.ts +2 -2
- package/dist/types/sdk/prepare/PrepareApi.d.ts +3 -3
- package/dist/types/sdk/prepare/index.d.ts +2 -2
- package/dist/types/sdk/prepare/types.d.ts +8 -4
- package/package.json +1 -1
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.spec.js +0 -267
- package/dist/cjs/common-utils/utils/validation/index.js +0 -23
- package/dist/cjs/common-utils/utils/validation/is-zero-balance.js +0 -7
- package/dist/cjs/common-utils/utils/validation/validate-balance.js +0 -22
- package/dist/cjs/common-utils/utils/validation/validate-balance.spec.js +0 -54
- package/dist/cjs/common-utils/utils/validation/validate-balances.js +0 -17
- package/dist/cjs/common-utils/utils/validation/validate-balances.spec.js +0 -45
- package/dist/cjs/common-utils/utils/validation/validate-credit-manager.js +0 -8
- package/dist/cjs/common-utils/utils/validation/validate-credit-manager.spec.js +0 -36
- package/dist/cjs/common-utils/utils/validation/validate-hf.js +0 -10
- package/dist/cjs/common-utils/utils/validation/validate-hf.spec.js +0 -26
- package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-quota-status.js +0 -14
- package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-quota-status.spec.js +0 -29
- package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.js +0 -37
- package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.spec.js +0 -98
- package/dist/cjs/common-utils/utils/validation/validate-open-account.js +0 -18
- package/dist/cjs/common-utils/utils/validation/validate-open-account.spec.js +0 -56
- package/dist/cjs/common-utils/utils/validation/validate-quota.js +0 -23
- package/dist/cjs/common-utils/utils/validation/validate-quota.spec.js +0 -88
- package/dist/cjs/common-utils/utils/validation/validate-token-to-obtain.js +0 -18
- package/dist/cjs/common-utils/utils/validation/validate-token-to-obtain.spec.js +0 -36
- package/dist/cjs/common-utils/utils/validation/validation-types.js +0 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.spec.js +0 -264
- package/dist/esm/common-utils/utils/validation/index.js +0 -12
- package/dist/esm/common-utils/utils/validation/is-zero-balance.js +0 -6
- package/dist/esm/common-utils/utils/validation/validate-balance.js +0 -21
- package/dist/esm/common-utils/utils/validation/validate-balance.spec.js +0 -54
- package/dist/esm/common-utils/utils/validation/validate-balances.js +0 -16
- package/dist/esm/common-utils/utils/validation/validate-balances.spec.js +0 -45
- package/dist/esm/common-utils/utils/validation/validate-credit-manager.js +0 -7
- package/dist/esm/common-utils/utils/validation/validate-credit-manager.spec.js +0 -36
- package/dist/esm/common-utils/utils/validation/validate-hf.js +0 -8
- package/dist/esm/common-utils/utils/validation/validate-hf.spec.js +0 -26
- package/dist/esm/common-utils/utils/validation/validate-open-account-pool-quota-status.js +0 -13
- package/dist/esm/common-utils/utils/validation/validate-open-account-pool-quota-status.spec.js +0 -29
- package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.js +0 -36
- package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.spec.js +0 -98
- package/dist/esm/common-utils/utils/validation/validate-open-account.js +0 -17
- package/dist/esm/common-utils/utils/validation/validate-open-account.spec.js +0 -56
- package/dist/esm/common-utils/utils/validation/validate-quota.js +0 -22
- package/dist/esm/common-utils/utils/validation/validate-quota.spec.js +0 -88
- package/dist/esm/common-utils/utils/validation/validate-token-to-obtain.js +0 -17
- package/dist/esm/common-utils/utils/validation/validate-token-to-obtain.spec.js +0 -36
- package/dist/esm/common-utils/utils/validation/validation-types.js +0 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/index.d.ts +0 -12
- package/dist/types/common-utils/utils/validation/is-zero-balance.d.ts +0 -4
- package/dist/types/common-utils/utils/validation/validate-balance.d.ts +0 -25
- package/dist/types/common-utils/utils/validation/validate-balance.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validate-balances.d.ts +0 -13
- package/dist/types/common-utils/utils/validation/validate-balances.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validate-credit-manager.d.ts +0 -13
- package/dist/types/common-utils/utils/validation/validate-credit-manager.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validate-hf.d.ts +0 -12
- package/dist/types/common-utils/utils/validation/validate-hf.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validate-open-account-pool-quota-status.d.ts +0 -10
- package/dist/types/common-utils/utils/validation/validate-open-account-pool-quota-status.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validate-open-account-pool-status.d.ts +0 -26
- package/dist/types/common-utils/utils/validation/validate-open-account-pool-status.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validate-open-account.d.ts +0 -25
- package/dist/types/common-utils/utils/validation/validate-open-account.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validate-quota.d.ts +0 -24
- package/dist/types/common-utils/utils/validation/validate-quota.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validate-token-to-obtain.d.ts +0 -17
- package/dist/types/common-utils/utils/validation/validate-token-to-obtain.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/validation/validation-types.d.ts +0 -10
|
@@ -26,7 +26,7 @@ import { EtherscanURLParam, etherscanApiUrl, etherscanUrl } from "./utils/ethers
|
|
|
26
26
|
import { 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, NO_VERSION } from "./constants/address-provider.js";
|
|
27
27
|
import { ADDRESS_0X0, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED } from "./constants/addresses.js";
|
|
28
28
|
import { BotPermissions, botPermissionsToString } from "./constants/bot-permissions.js";
|
|
29
|
-
import { DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, PRICE_DECIMALS_POW, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, WAD, WAD_DECIMALS_POW, halfRAY } from "./constants/math.js";
|
|
29
|
+
import { DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, PRICE_DECIMALS_POW, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, WAD, WAD_DECIMALS_POW, halfRAY, isZeroBalance } from "./constants/math.js";
|
|
30
30
|
import { BLOCKS_PER_WEEK_BY_NETWORK, RAMP_DURATION_BY_NETWORK } from "./constants/networks.js";
|
|
31
31
|
import { PERIPHERY_CONTRACTS, PeripheryContract } from "./constants/periphery.js";
|
|
32
32
|
import { VERSION_RANGE_310, VersionRange, isV310, isVersionRange } from "./constants/versions.js";
|
|
@@ -251,9 +251,10 @@ import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBo
|
|
|
251
251
|
import { AccountBotsService } from "./accounts/bots/AccountBotsService.js";
|
|
252
252
|
import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
|
|
253
253
|
import { CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.js";
|
|
254
|
+
import { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "./validation/refusal.js";
|
|
255
|
+
import { borrowable } from "./accounts/intents/guards.js";
|
|
254
256
|
import { LeverageBand } from "./accounts/intents/leverage-band.js";
|
|
255
257
|
import { AccountCalculatorOperation } from "./accounts/intents/operations.js";
|
|
256
|
-
import { IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewRefusal, refuse } from "./accounts/intents/refusal.js";
|
|
257
258
|
import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./accounts/intents/types.js";
|
|
258
259
|
import { OpenStrategyPreview, OpenStrategyProps } from "./accounts/intents/open-strategy.js";
|
|
259
260
|
import { fetchCreditAccountSlice, toCreditAccountSlice } from "./accounts/intents/utils/credit-account-slice.js";
|
|
@@ -264,4 +265,7 @@ import { LiquidationsService } from "./accounts/liquidations/LiquidationsService
|
|
|
264
265
|
import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
|
|
265
266
|
import "./accounts/index.js";
|
|
266
267
|
import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
267
|
-
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, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, 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, CurrentWithdrawals, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetReward, 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, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, type LeverageBand, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OperationState, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, 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, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, type PreviewErrorDetails, type PreviewErrorReason, type PreviewRefusal, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaKeeperState, QuotaMode, 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, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteRefusals, 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, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StakingRewardsAdapterContract, type StartIntent, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, type WithdrawAssetIntent, WithdrawCollateral, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, refuse, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
268
|
+
import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError } from "./validation/checks.js";
|
|
269
|
+
import { toToken, toTokenAmount } from "./validation/token.js";
|
|
270
|
+
import "./validation/index.js";
|
|
271
|
+
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, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, BorrowLimitBinding, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, 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, CurrentWithdrawals, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetReward, 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, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, type LeverageBand, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OperationState, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, 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, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaKeeperState, QuotaMode, 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, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteRefusals, 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, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StakingRewardsAdapterContract, type StartIntent, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, type WithdrawAssetIntent, WithdrawCollateral, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, borrowable, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isMalformedPreviewError, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, raise, rayToBps, rayToNumber, refuse, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
@@ -1004,7 +1004,7 @@ declare class CreditManagerV310Contract extends BaseContract<abi> implements ICr
|
|
|
1004
1004
|
/**
|
|
1005
1005
|
* {@inheritDoc ICreditManagerContract.maxLeverage}
|
|
1006
1006
|
*/
|
|
1007
|
-
maxLeverage(collateral: Address): Leverage;
|
|
1007
|
+
maxLeverage(collateral: Address, targetHF?: Bps): Leverage;
|
|
1008
1008
|
/**
|
|
1009
1009
|
* {@inheritDoc ICreditManagerContract.liquidationPremium}
|
|
1010
1010
|
*/
|
|
@@ -133,13 +133,14 @@ interface ICreditManagerContract extends IBaseContract {
|
|
|
133
133
|
*/
|
|
134
134
|
readonly liquidationPremium: Bps;
|
|
135
135
|
/**
|
|
136
|
-
* Highest total-value leverage a collateral's liquidation threshold allows
|
|
137
|
-
* `(1 − 0.05) / (1 − lt)`.
|
|
136
|
+
* Highest total-value leverage a collateral's liquidation threshold allows.
|
|
138
137
|
*
|
|
139
138
|
* @param collateral - Collateral token address.
|
|
139
|
+
* @param targetHF - Health factor the maxed position should leave, in basis
|
|
140
|
+
* points. Omitted keeps the flat buffer.
|
|
140
141
|
* @throws If the credit manager does not value the token.
|
|
141
142
|
*/
|
|
142
|
-
maxLeverage: (collateral: Address) => Leverage;
|
|
143
|
+
maxLeverage: (collateral: Address, targetHF?: Bps) => Leverage;
|
|
143
144
|
stateHuman: (raw?: boolean) => CreditManagerStateHuman;
|
|
144
145
|
}
|
|
145
146
|
/**
|
|
@@ -132,21 +132,32 @@ declare function calcNetStrategyApy(opportunity: StrategyRateInputs, totalCollat
|
|
|
132
132
|
**/
|
|
133
133
|
declare const MAX_LEVERAGE_BUFFER_BPS = 500;
|
|
134
134
|
/**
|
|
135
|
-
* Highest total-value leverage a liquidation threshold allows, floored
|
|
136
|
-
*
|
|
137
|
-
* `liquidationThreshold × totalValue`, leaving
|
|
138
|
-
* equity per unit of exposure;
|
|
139
|
-
*
|
|
135
|
+
* Highest total-value leverage a liquidation threshold allows, floored.
|
|
136
|
+
*
|
|
137
|
+
* At HF = 1, debt is `liquidationThreshold × totalValue`, leaving
|
|
138
|
+
* `1 − liquidationThreshold` of equity per unit of exposure; a maxed position
|
|
139
|
+
* has to stay some way off that boundary. Given a `targetHF`, that distance is
|
|
140
|
+
* solved for — `HF = liquidationThreshold × L / (L − 1)` inverts to
|
|
141
|
+
* `L = targetHF / (targetHF − liquidationThreshold)`.
|
|
142
|
+
*
|
|
143
|
+
* Without one it falls back on a flat {@link MAX_LEVERAGE_BUFFER_BPS}, which
|
|
144
|
+
* under-buffers as the threshold rises — at 95% it allows 19x, or HF ≈ 1.0028.
|
|
145
|
+
* That branch is scaffolding, kept so this parameter moves no number before
|
|
146
|
+
* the callers name a target, and goes away with the constant.
|
|
147
|
+
*
|
|
148
|
+
* @param targetHF - Health factor the maxed position should leave, in basis
|
|
149
|
+
* points. Omitted keeps the legacy buffer.
|
|
140
150
|
*
|
|
141
151
|
* @example
|
|
142
152
|
* ```ts
|
|
143
153
|
* // liquidationThreshold: 9000 bps = 90%
|
|
144
|
-
* calcMaxLeverage(9000)
|
|
154
|
+
* calcMaxLeverage(9000) // floor((1 − 0.05) / (1 − 0.9)) = 9x
|
|
155
|
+
* calcMaxLeverage(9000, 10100) // floor(1.01 / (1.01 − 0.9)) = 9x
|
|
145
156
|
* ```
|
|
146
|
-
* @throws If `liquidationThreshold` is 100% or more,
|
|
147
|
-
* leverage
|
|
157
|
+
* @throws If `liquidationThreshold` is 100% or more, or reaches a named
|
|
158
|
+
* `targetHF` — either way no leverage clears the bar.
|
|
148
159
|
**/
|
|
149
|
-
declare function calcMaxLeverage(liquidationThreshold: Bps): Leverage;
|
|
160
|
+
declare function calcMaxLeverage(liquidationThreshold: Bps, targetHF?: Bps): Leverage;
|
|
150
161
|
/**
|
|
151
162
|
* Converts a credit account's health factor from the 18-decimal fixed point the
|
|
152
163
|
* contracts store to basis points.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Bps, Token, TokenAmount } from "../../model/primitives.js";
|
|
2
|
+
import "../../model/index.js";
|
|
3
|
+
import { BorrowLimitBinding, PreviewIssue } from "./refusal.js";
|
|
4
|
+
import { Address } from "viem";
|
|
5
|
+
//#region src/onchain/validation/checks.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Every verdict the protocol can pass on an operation, as values.
|
|
8
|
+
*
|
|
9
|
+
* Each check is handed the numbers it compares — never a suite, a market or an
|
|
10
|
+
* SDK — so the engine, `checkOperation` and the strategy lists share one
|
|
11
|
+
* implementation.
|
|
12
|
+
*
|
|
13
|
+
* Ladders stay with the caller because they differ deliberately: the engine
|
|
14
|
+
* reports the tightest ceiling it found, the account-opening path the first one
|
|
15
|
+
* exceeded in its own order.
|
|
16
|
+
*/
|
|
17
|
+
/** A factor at or below this is refused; kept for the callers that size on it. */
|
|
18
|
+
declare const MIN_HF_LIMITED = 10100n;
|
|
19
|
+
/** The same bar as a `required` argument — the lowest factor that passes. */
|
|
20
|
+
declare const MIN_HEALTH_FACTOR_FORM = 10101;
|
|
21
|
+
/** The bar the facade itself enforces: an account may end exactly at 1.0. */
|
|
22
|
+
declare const MIN_HEALTH_FACTOR_FACADE = 10000;
|
|
23
|
+
/**
|
|
24
|
+
* The safe-price bar a form holds an account to. A step above the facade's,
|
|
25
|
+
* because a factor of exactly 1.0 at safe prices is already a refusal.
|
|
26
|
+
*/
|
|
27
|
+
declare const MIN_SAFE_HEALTH_FACTOR_FORM = 10001;
|
|
28
|
+
/** A refusal names what a limit was measured in, never what it is worth. */
|
|
29
|
+
declare function amountOf(token: Token, value: bigint): TokenAmount;
|
|
30
|
+
/** The credit manager takes no multicall while it is paused. */
|
|
31
|
+
declare function checkCreditManagerPaused(args: {
|
|
32
|
+
isPaused: boolean;
|
|
33
|
+
creditManager: Address;
|
|
34
|
+
}): PreviewIssue | null;
|
|
35
|
+
/** Past its expiration date the facade takes no more multicalls. */
|
|
36
|
+
declare function checkMarketExpired(args: {
|
|
37
|
+
isExpired: boolean;
|
|
38
|
+
creditManager: Address;
|
|
39
|
+
/** Unix seconds, as the facade reports it. */
|
|
40
|
+
expirationDate: number;
|
|
41
|
+
}): PreviewIssue | null;
|
|
42
|
+
/** A paused pool neither takes deposits nor pays out. */
|
|
43
|
+
declare function checkPoolPaused(args: {
|
|
44
|
+
isPaused: boolean;
|
|
45
|
+
pool: Address;
|
|
46
|
+
}): PreviewIssue | null;
|
|
47
|
+
/**
|
|
48
|
+
* A pool winding down still pays out, so only what puts money in is refused.
|
|
49
|
+
*/
|
|
50
|
+
declare function checkPoolSunset(args: {
|
|
51
|
+
isSunset: boolean;
|
|
52
|
+
isDeposit: boolean;
|
|
53
|
+
pool: Address;
|
|
54
|
+
}): PreviewIssue | null;
|
|
55
|
+
/**
|
|
56
|
+
* What the pool will hand over, against what is asked for.
|
|
57
|
+
*
|
|
58
|
+
* `binding` and `available` are the caller's answer to "which ceiling stands in
|
|
59
|
+
* the way", not this check's: see the ladder note above. `solutionAmount` is
|
|
60
|
+
* the largest position still openable, left out when none is.
|
|
61
|
+
*/
|
|
62
|
+
declare function checkBorrowLimit(args: {
|
|
63
|
+
requested: bigint;
|
|
64
|
+
available: bigint;
|
|
65
|
+
binding: BorrowLimitBinding;
|
|
66
|
+
underlying: Token;
|
|
67
|
+
solutionAmount?: bigint;
|
|
68
|
+
}): PreviewIssue | null;
|
|
69
|
+
/**
|
|
70
|
+
* What the pool can pay out, against what is being taken out.
|
|
71
|
+
*
|
|
72
|
+
* The operator is not `checkBorrowLimit`'s: a pool holding exactly the amount
|
|
73
|
+
* asked for still cannot serve it, so equality is already a refusal. That is
|
|
74
|
+
* the rule the legacy withdrawal validator enforced and it is preserved to the
|
|
75
|
+
* unit.
|
|
76
|
+
*/
|
|
77
|
+
declare function checkPoolPayout(args: {
|
|
78
|
+
requested: bigint;
|
|
79
|
+
available: bigint;
|
|
80
|
+
underlying: Token;
|
|
81
|
+
}): PreviewIssue | null;
|
|
82
|
+
/**
|
|
83
|
+
* A debt the facade would revert on.
|
|
84
|
+
*
|
|
85
|
+
* `allowZero` is the one place the two callers genuinely disagree: an account
|
|
86
|
+
* being adjusted may end owing nothing, while one being opened may not — so the
|
|
87
|
+
* exemption is stated rather than assumed.
|
|
88
|
+
*/
|
|
89
|
+
declare function checkDebtInBand(args: {
|
|
90
|
+
debt: bigint;
|
|
91
|
+
minDebt: bigint;
|
|
92
|
+
maxDebt: bigint;
|
|
93
|
+
underlying: Token;
|
|
94
|
+
allowZero: boolean;
|
|
95
|
+
}): PreviewIssue | null;
|
|
96
|
+
/** Leverage below 1x is not a position, it is a withdrawal. */
|
|
97
|
+
declare function checkLeverageAtLeastOne(args: {
|
|
98
|
+
leverage: bigint;
|
|
99
|
+
min: bigint;
|
|
100
|
+
}): PreviewIssue | null;
|
|
101
|
+
/**
|
|
102
|
+
* The account against its debt, at whichever bar the caller holds it to.
|
|
103
|
+
*
|
|
104
|
+
* An unread factor counts as failing: a check that cannot see the number is not
|
|
105
|
+
* evidence that the number is fine.
|
|
106
|
+
*/
|
|
107
|
+
declare function checkCollateralised(args: {
|
|
108
|
+
healthFactor: Bps | undefined;
|
|
109
|
+
/** The lowest acceptable factor — a factor equal to it passes. */
|
|
110
|
+
required: Bps;
|
|
111
|
+
safePrices: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* The factor the account stands at now. Given, an operation that raises it
|
|
114
|
+
* passes even from under the bar: an account already below is rescued by
|
|
115
|
+
* exactly the top-ups a flat bar would refuse.
|
|
116
|
+
*/
|
|
117
|
+
improvesFrom?: Bps;
|
|
118
|
+
}): PreviewIssue | null;
|
|
119
|
+
/** A token the market will not let the account hold. */
|
|
120
|
+
declare function checkForbiddenToken(args: {
|
|
121
|
+
token: Token;
|
|
122
|
+
isForbidden: boolean;
|
|
123
|
+
}): PreviewIssue | null;
|
|
124
|
+
/**
|
|
125
|
+
* The room the keeper still has for a token's quota, in the underlying.
|
|
126
|
+
*
|
|
127
|
+
* `requested` is absent for a token the market opened no quota for at all —
|
|
128
|
+
* nothing was weighed against a limit, the token simply counts as no collateral.
|
|
129
|
+
*/
|
|
130
|
+
declare function checkQuotaLimit(args: {
|
|
131
|
+
token: Token;
|
|
132
|
+
requested: bigint | undefined;
|
|
133
|
+
available: bigint;
|
|
134
|
+
underlying: Token;
|
|
135
|
+
}): PreviewIssue | null;
|
|
136
|
+
/** How many quoted tokens the facade enables at once. */
|
|
137
|
+
declare function checkQuotaCount(args: {
|
|
138
|
+
count: number;
|
|
139
|
+
max: number;
|
|
140
|
+
}): PreviewIssue | null;
|
|
141
|
+
/** What the operation is funded from, against what is there. */
|
|
142
|
+
declare function checkFunding(args: {
|
|
143
|
+
token: Token;
|
|
144
|
+
required: bigint;
|
|
145
|
+
held: bigint;
|
|
146
|
+
}): PreviewIssue | null;
|
|
147
|
+
/**
|
|
148
|
+
* The SDK could not replay the transaction.
|
|
149
|
+
*
|
|
150
|
+
* Only the 1xxx class lands here. A 2xxx error says the transaction is fine and
|
|
151
|
+
* the SDK could not fully evaluate it, which is a caveat on the numbers rather
|
|
152
|
+
* than a reason to refuse — it stays on the preview for the caller to surface.
|
|
153
|
+
*/
|
|
154
|
+
declare function checkPreviewError(error: {
|
|
155
|
+
code: number;
|
|
156
|
+
message: string;
|
|
157
|
+
} | undefined): PreviewIssue | null;
|
|
158
|
+
/**
|
|
159
|
+
* The class boundary the preview error codes are written against: 1xxx means
|
|
160
|
+
* the transaction itself is malformed, 2xxx that only the evaluation was
|
|
161
|
+
* incomplete. A range, so a future 1007 classifies itself.
|
|
162
|
+
*/
|
|
163
|
+
declare function isMalformedPreviewError(error: {
|
|
164
|
+
code: number;
|
|
165
|
+
}): boolean;
|
|
166
|
+
//#endregion
|
|
167
|
+
export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "./refusal.js";
|
|
2
|
+
import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError } from "./checks.js";
|
|
3
|
+
import { toToken, toTokenAmount } from "./token.js";
|
|
4
|
+
export { BorrowLimitBinding, IntentPreviewError, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError, raise, refuse, toToken, toTokenAmount };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { Bps } from "
|
|
2
|
-
import "
|
|
3
|
-
import { Asset } from "../../base/types.js";
|
|
4
|
-
import "../../index.js";
|
|
1
|
+
import { Bps, Token, TokenAmount } from "../../model/primitives.js";
|
|
2
|
+
import "../../model/index.js";
|
|
5
3
|
import { Address } from "viem";
|
|
6
|
-
//#region src/onchain/
|
|
4
|
+
//#region src/onchain/validation/refusal.d.ts
|
|
7
5
|
/**
|
|
8
6
|
* Why a preview could not be produced.
|
|
9
7
|
*
|
|
@@ -57,21 +55,33 @@ type PreviewErrorReason =
|
|
|
57
55
|
* The account would end the transaction owing more than its collateral is
|
|
58
56
|
* worth under liquidation thresholds, which the facade refuses to allow.
|
|
59
57
|
*/
|
|
60
|
-
"insufficientCollateral"
|
|
58
|
+
"insufficientCollateral" |
|
|
59
|
+
/** The pool is winding down: it still pays out, but takes no more deposits. */
|
|
60
|
+
"poolSunset" |
|
|
61
|
+
/**
|
|
62
|
+
* The account would end up with more quoted tokens than the facade enables
|
|
63
|
+
* at once. A count, not an amount — unlike `quotaLimitReached`.
|
|
64
|
+
*/
|
|
65
|
+
"quotaCountExceeded" |
|
|
66
|
+
/**
|
|
67
|
+
* The transaction could not be replayed: it is malformed, and every field
|
|
68
|
+
* derived from replayed balances is guesswork.
|
|
69
|
+
*/
|
|
70
|
+
"malformedTransaction";
|
|
61
71
|
/**
|
|
62
72
|
* The numbers behind each refusal, so a caller reads the limit that was missed
|
|
63
73
|
* instead of re-deriving it.
|
|
64
74
|
*
|
|
65
|
-
* Anything with a token and an amount is
|
|
66
|
-
* token. `undefined` marks a reason raised from several places, only some of
|
|
75
|
+
* Anything with a token and an amount is a {@link TokenAmount}; ratios carry
|
|
76
|
+
* no token. `undefined` marks a reason raised from several places, only some of
|
|
67
77
|
* which hold the numbers.
|
|
68
78
|
*/
|
|
69
79
|
interface PreviewErrorDetails {
|
|
70
80
|
/** All three in the market's underlying. */
|
|
71
81
|
debtOutOfRange: {
|
|
72
|
-
requested:
|
|
73
|
-
minDebt:
|
|
74
|
-
maxDebt:
|
|
82
|
+
requested: TokenAmount;
|
|
83
|
+
minDebt: TokenAmount;
|
|
84
|
+
maxDebt: TokenAmount;
|
|
75
85
|
};
|
|
76
86
|
/**
|
|
77
87
|
* Scaled by `LEVERAGE_DECIMALS` (`100n` = 1x), as the intent states it — not
|
|
@@ -84,44 +94,57 @@ interface PreviewErrorDetails {
|
|
|
84
94
|
} | undefined;
|
|
85
95
|
/** `undefined` where the request never got as far as naming an amount. */
|
|
86
96
|
insufficientSourceBalance: {
|
|
87
|
-
required:
|
|
88
|
-
held:
|
|
97
|
+
required: TokenAmount;
|
|
98
|
+
held: TokenAmount;
|
|
89
99
|
} | undefined;
|
|
90
100
|
unsupportedCollateralToken: {
|
|
91
|
-
token:
|
|
101
|
+
token: Token;
|
|
92
102
|
};
|
|
93
103
|
/**
|
|
94
104
|
* `to` is absent where the market named no output for `from`. The whole
|
|
95
105
|
* detail is absent only when the pathfinder reverted rather than answered.
|
|
96
106
|
*/
|
|
97
107
|
unsupportedTokenPair: {
|
|
98
|
-
from:
|
|
99
|
-
to:
|
|
108
|
+
from: Token;
|
|
109
|
+
to: Token | undefined;
|
|
100
110
|
} | undefined;
|
|
101
111
|
noDelayedRoute: {
|
|
102
|
-
token:
|
|
112
|
+
token: Token;
|
|
103
113
|
} | undefined;
|
|
104
114
|
multipleDelayedWithdrawals: {
|
|
105
|
-
token:
|
|
115
|
+
token: Token;
|
|
106
116
|
venues: number;
|
|
107
117
|
};
|
|
108
118
|
/** The phantom token standing for the redemption already in flight. */
|
|
109
119
|
withdrawalInProgress: {
|
|
110
|
-
inFlight:
|
|
120
|
+
inFlight: TokenAmount;
|
|
111
121
|
};
|
|
112
122
|
noRecordedIntent: undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Which contract is paused. A credit account operation names the manager, an
|
|
125
|
+
* LP operation the pool — the two are never both present.
|
|
126
|
+
*/
|
|
113
127
|
marketPaused: {
|
|
114
128
|
creditManager: Address;
|
|
129
|
+
} | {
|
|
130
|
+
pool: Address;
|
|
115
131
|
};
|
|
116
132
|
/** `expirationDate` is unix seconds, as the facade reports it. */
|
|
117
133
|
marketExpired: {
|
|
118
134
|
creditManager: Address;
|
|
119
135
|
expirationDate: number;
|
|
120
136
|
};
|
|
121
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Both in the market's underlying. `binding` names which of the four ceilings
|
|
139
|
+
* ran out first, so a caller can say what would fix it — waiting for lenders
|
|
140
|
+
* and asking governance are opposite answers. `solutionAmount` is the largest
|
|
141
|
+
* position still openable, absent when even the minimum debt does not fit.
|
|
142
|
+
*/
|
|
122
143
|
insufficientPoolLiquidity: {
|
|
123
|
-
requested:
|
|
124
|
-
available:
|
|
144
|
+
requested: TokenAmount;
|
|
145
|
+
available: TokenAmount;
|
|
146
|
+
binding: BorrowLimitBinding;
|
|
147
|
+
solutionAmount?: TokenAmount;
|
|
125
148
|
};
|
|
126
149
|
/**
|
|
127
150
|
* `token` is the one whose quota is asked for; the amounts are in the
|
|
@@ -130,16 +153,18 @@ interface PreviewErrorDetails {
|
|
|
130
153
|
* against a limit.
|
|
131
154
|
*/
|
|
132
155
|
quotaLimitReached: {
|
|
133
|
-
token:
|
|
134
|
-
requested:
|
|
135
|
-
available:
|
|
156
|
+
token: Token;
|
|
157
|
+
requested: TokenAmount | undefined;
|
|
158
|
+
available: TokenAmount;
|
|
136
159
|
};
|
|
137
160
|
forbiddenToken: {
|
|
138
|
-
token:
|
|
161
|
+
token: Token;
|
|
139
162
|
};
|
|
140
163
|
/**
|
|
141
|
-
* `required` is the
|
|
142
|
-
*
|
|
164
|
+
* `required` is the bar the factor was weighed against — the facade's own
|
|
165
|
+
* `1.0` for a check that asks whether the transaction lands, a form's higher
|
|
166
|
+
* bar for one that asks whether it is wise. `healthFactor` is the factor
|
|
167
|
+
* compared, which for a call that hands funds over is the safe-price one;
|
|
143
168
|
* `safePrices` says which, since a preview always reports main prices.
|
|
144
169
|
*/
|
|
145
170
|
insufficientCollateral: {
|
|
@@ -147,18 +172,54 @@ interface PreviewErrorDetails {
|
|
|
147
172
|
required: Bps;
|
|
148
173
|
safePrices: boolean;
|
|
149
174
|
};
|
|
175
|
+
poolSunset: {
|
|
176
|
+
pool: Address;
|
|
177
|
+
};
|
|
178
|
+
/** How many quoted tokens the account would end with, against the cap. */
|
|
179
|
+
quotaCountExceeded: {
|
|
180
|
+
count: number;
|
|
181
|
+
max: number;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* The SDK's own preview error code (the `ERROR_*` 1xxx constants) and its
|
|
185
|
+
* human-readable detail.
|
|
186
|
+
*/
|
|
187
|
+
malformedTransaction: {
|
|
188
|
+
code: number;
|
|
189
|
+
message: string;
|
|
190
|
+
};
|
|
150
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Which ceiling ran out when a borrow could not be served.
|
|
194
|
+
*
|
|
195
|
+
* The names are the expressions, not the legacy labels, because the two do not
|
|
196
|
+
* line up: the legacy `insufficientDebtLimit` was the manager's own headroom
|
|
197
|
+
* (`managerDebtAvailable`), `insufficientPoolDebtLimit` was `poolDebtLimit`,
|
|
198
|
+
* and `insufficientPoolLiquidity` was what the manager could still draw
|
|
199
|
+
* (`poolAvailableLiquidity`).
|
|
200
|
+
*
|
|
201
|
+
* `borrowable()` weighs only three of these — the pool's free liquidity, the
|
|
202
|
+
* manager's remaining allowance and the facade's per-block cap. `poolDebtLimit`
|
|
203
|
+
* is read by the account-opening path alone, which is why it is not among them.
|
|
204
|
+
*/
|
|
205
|
+
type BorrowLimitBinding = "poolAvailableLiquidity" | "poolDebtLimit" | "managerDebtAvailable" | "facadePerBlockCap";
|
|
151
206
|
/**
|
|
152
207
|
* The failure half every simulation shares.
|
|
153
208
|
*
|
|
154
209
|
* Distributed over the reasons rather than written as `{ reason; detail }`, so
|
|
155
210
|
* that narrowing on `reason` narrows `detail` with it.
|
|
156
211
|
*/
|
|
157
|
-
type
|
|
158
|
-
ok: false;
|
|
212
|
+
type PreviewIssue = { [R in PreviewErrorReason]: {
|
|
159
213
|
reason: R;
|
|
160
214
|
detail: PreviewErrorDetails[R];
|
|
161
215
|
}; }[PreviewErrorReason];
|
|
216
|
+
/**
|
|
217
|
+
* The failure half every simulation shares: an issue, plus the `ok: false`
|
|
218
|
+
* that tells it apart from a preview.
|
|
219
|
+
*/
|
|
220
|
+
type PreviewRefusal = {
|
|
221
|
+
ok: false;
|
|
222
|
+
} & PreviewIssue;
|
|
162
223
|
/** Builds the refusal a caller sees. */
|
|
163
224
|
declare function refuse<R extends PreviewErrorReason>(reason: R, detail: PreviewErrorDetails[R]): PreviewRefusal;
|
|
164
225
|
/**
|
|
@@ -171,5 +232,13 @@ declare class IntentPreviewError<R extends PreviewErrorReason = PreviewErrorReas
|
|
|
171
232
|
readonly detail: PreviewErrorDetails[R];
|
|
172
233
|
constructor(reason: R, detail: PreviewErrorDetails[R], message?: string);
|
|
173
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Throws the issue a check found, with the sentence the engine logs for it.
|
|
237
|
+
*
|
|
238
|
+
* Returns normally when there is nothing to raise, so it cannot narrow a type
|
|
239
|
+
* the way a bare `throw` does — a site that guards a value for the code below
|
|
240
|
+
* it keeps throwing directly.
|
|
241
|
+
*/
|
|
242
|
+
declare function raise(issue: PreviewIssue | null, message: string): void;
|
|
174
243
|
//#endregion
|
|
175
|
-
export { IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewRefusal, refuse };
|
|
244
|
+
export { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Token, TokenAmount } from "../../model/primitives.js";
|
|
2
|
+
import "../../model/index.js";
|
|
3
|
+
import { OnchainSDK } from "../OnchainSDK.js";
|
|
4
|
+
import { Address } from "viem";
|
|
5
|
+
//#region src/onchain/validation/token.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The token behind an address, for the refusal details that inline one.
|
|
8
|
+
*
|
|
9
|
+
* A token the registry does not know falls back to its own shortened address
|
|
10
|
+
* as a symbol and `decimals: 0` — an unknown token has no scale, and guessing
|
|
11
|
+
* 18 would silently misformat every amount denominated in it.
|
|
12
|
+
*/
|
|
13
|
+
declare function toToken(sdk: OnchainSDK, address: Address): Token;
|
|
14
|
+
/** {@link toToken} plus an amount denominated in it. */
|
|
15
|
+
declare function toTokenAmount(sdk: OnchainSDK, address: Address, value: bigint): TokenAmount;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { toToken, toTokenAmount };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UnsupportedZapperFunctionError } from "../onchain/market/zapper/errors.js";
|
|
2
|
+
import { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "../onchain/validation/refusal.js";
|
|
2
3
|
import { AdapterOperation, AdapterOperationBase, TokenTransfer, TraceAdapterExt } from "./parse/types-adapters.js";
|
|
3
4
|
import { AddCollateralOp, CloseCreditAccountOperation, CompareBalancesOp, CreditAccountOperation, DecreaseDebtOp, DirectTokenTransferOperation, FacadeOperationMetadata, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, StoreExpectedBalancesOp, UpdateQuotaOp, WithdrawCollateralOp } from "./parse/types-facades.js";
|
|
4
5
|
import { PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation } from "./parse/types-pools.js";
|
|
@@ -37,4 +38,7 @@ import { previewOperation } from "./preview/previewOperation.js";
|
|
|
37
38
|
import { ReplayState, makeReplayState, replayInnerOperations } from "./preview/replayInnerOperations.js";
|
|
38
39
|
import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./preview/replayMulticall.js";
|
|
39
40
|
import "./preview/index.js";
|
|
40
|
-
|
|
41
|
+
import { CheckOperationOptions, checkOperation, collateralIssuesOf } from "./validate/checkOperation.js";
|
|
42
|
+
import { checkSimulation } from "./validate/checkSimulation.js";
|
|
43
|
+
import "./validate/index.js";
|
|
44
|
+
export { AdapterOperation, AdapterOperationBase, AddCollateralOp, AllowanceDetail, AllowancePrerequisite, AllowanceResult, BalanceDetail, BalancePrerequisite, BalanceResult, BorrowLimitBinding, CheckOperationOptions, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, ConvertFn, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ExtractTransfersResult, FacadeCallType, FacadeOperationMetadata, FacadeParsedCall, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, IntentPreviewError, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, Prerequisite, PrerequisiteContext, PrerequisiteError, PrerequisiteKind, PrerequisiteOutcome, PrerequisiteResult, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewOperationInput, PreviewOperationOptions, PreviewRefusal, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, StoreExpectedBalancesOp, TokenTransfer, TraceAdapterExt, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, UpdateQuotaOp, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, buildDelayedPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssuesOf, detectDelayedClaim, detectDelayedOperation, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustCreditAccount, previewCloseOrRepayCreditAccount, previewOperation, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
|