@gearbox-protocol/sdk 15.1.0-next.23 → 15.1.0-next.25
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/model/charts.js +20 -34
- package/dist/cjs/model/opportunities.schema.js +17 -17
- package/dist/cjs/sdk/OnchainSDK.js +16 -0
- package/dist/cjs/sdk/accounts/intents/utils/pick-token.js +2 -2
- package/dist/cjs/sdk/base/TokensMeta.js +33 -1
- package/dist/cjs/sdk/base/index.js +1 -0
- package/dist/cjs/sdk/base/token-types.js +13 -0
- package/dist/cjs/sdk/chain/chains.js +9 -12
- package/dist/cjs/sdk/chain/index.js +0 -1
- package/dist/cjs/sdk/index.js +5 -3
- package/dist/cjs/sdk/market/MarketSuite.js +11 -5
- package/dist/cjs/sdk/market/credit/CreditSuite.js +11 -9
- package/dist/cjs/sdk/market/credit/collateralUtils.js +2 -14
- package/dist/cjs/sdk/market/credit/index.js +0 -1
- package/dist/cjs/sdk/market/index.js +4 -2
- package/dist/cjs/sdk/market/math.js +71 -17
- package/dist/cjs/sdk/market/strategyName.js +4 -6
- package/dist/cjs/sdk/positions/PositionsService.js +1 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/charts.js +20 -34
- package/dist/esm/model/opportunities.schema.js +17 -17
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/OnchainSDK.js +16 -0
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/sdk/accounts/intents/utils/pick-token.js +1 -1
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -1
- 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/TokensMeta.js +36 -4
- package/dist/esm/sdk/base/index.js +2 -2
- package/dist/esm/sdk/base/token-types.js +13 -1
- package/dist/esm/sdk/chain/chains.js +10 -12
- 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/index.js +5 -5
- package/dist/esm/sdk/market/MarketSuite.js +11 -5
- package/dist/esm/sdk/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/sdk/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditSuite.js +12 -10
- package/dist/esm/sdk/market/credit/collateralUtils.js +2 -13
- package/dist/esm/sdk/market/credit/index.js +2 -2
- package/dist/esm/sdk/market/index.js +3 -3
- package/dist/esm/sdk/market/math.js +68 -17
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/sdk/market/strategyName.js +4 -6
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/positions/PositionsService.js +1 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/model/charts.d.ts +16 -23
- package/dist/types/model/charts.schema.d.ts +24 -52
- package/dist/types/model/opportunities.d.ts +27 -29
- package/dist/types/model/opportunities.schema.d.ts +113 -242
- package/dist/types/model/primitives.d.ts +4 -0
- package/dist/types/new-sdk/opportunities/types.d.ts +1 -1
- package/dist/types/new-sdk/positions/types.d.ts +1 -1
- package/dist/types/sdk/base/TokensMeta.d.ts +31 -2
- package/dist/types/sdk/base/index.d.ts +3 -3
- package/dist/types/sdk/base/token-types.d.ts +14 -1
- package/dist/types/sdk/chain/chains.d.ts +3 -11
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +6 -6
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +1 -5
- package/dist/types/sdk/market/credit/collateralUtils.d.ts +1 -7
- package/dist/types/sdk/market/credit/index.d.ts +2 -2
- package/dist/types/sdk/market/index.d.ts +3 -3
- package/dist/types/sdk/market/math.d.ts +64 -13
- package/dist/types/sdk/market/strategyName.d.ts +3 -5
- package/package.json +1 -1
package/dist/esm/sdk/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { BigIntMath } from "./utils/bigint-math.js";
|
|
|
7
7
|
import { bytes32ToString } from "./utils/bytes32ToString.js";
|
|
8
8
|
import { childLogger } from "./utils/childLogger.js";
|
|
9
9
|
import { createRawTx } from "./utils/createRawTx.js";
|
|
10
|
-
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType,
|
|
10
|
+
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds } from "./chain/chains.js";
|
|
11
11
|
import { detectNetwork } from "./chain/detectNetwork.js";
|
|
12
12
|
import "./chain/index.js";
|
|
13
13
|
import { etherscanApiUrl, etherscanUrl } from "./utils/etherscan.js";
|
|
@@ -38,7 +38,7 @@ import { BaseContract, ContractParseError } from "./base/BaseContract.js";
|
|
|
38
38
|
import { MissingSerializedParamsError } from "./base/errors.js";
|
|
39
39
|
import { MultichainConstruct } from "./base/MultichainConstruct.js";
|
|
40
40
|
import { SDKConstruct } from "./base/SDKConstruct.js";
|
|
41
|
-
import { PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND } from "./base/token-types.js";
|
|
41
|
+
import { NON_STRATEGY_PHANTOM_TOKEN_TYPES, PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND } from "./base/token-types.js";
|
|
42
42
|
import { VotingContractStatus } from "./base/types.js";
|
|
43
43
|
import "./base/index.js";
|
|
44
44
|
import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
|
|
@@ -131,10 +131,10 @@ import { createAdapter } from "./market/adapters/createAdapter.js";
|
|
|
131
131
|
import { CreditConfiguratorV310Contract } from "./market/credit/CreditConfiguratorV310Contract.js";
|
|
132
132
|
import { CreditFacadeV310BaseContract, creditFacadeV310Abi as abi } from "./market/credit/CreditFacadeV310BaseContract.js";
|
|
133
133
|
import { CreditFacadeV310Contract } from "./market/credit/CreditFacadeV310Contract.js";
|
|
134
|
-
import { MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS,
|
|
134
|
+
import { DEFAULT_QUOTA_BUFFER_BPS, MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./market/math.js";
|
|
135
135
|
import { CreditManagerV310Contract } from "./market/credit/CreditManagerV310Contract.js";
|
|
136
136
|
import { strategyName } from "./market/strategyName.js";
|
|
137
|
-
import {
|
|
137
|
+
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./market/credit/collateralUtils.js";
|
|
138
138
|
import { CreditSuite } from "./market/credit/CreditSuite.js";
|
|
139
139
|
import { expectedBalanceDeltas } from "./market/credit/expectedBalanceDeltas.js";
|
|
140
140
|
import { simulateMulticall } from "./utils/viem/simulateMulticall.js";
|
|
@@ -238,4 +238,4 @@ import { OnchainSDK, STATE_VERSION } from "./OnchainSDK.js";
|
|
|
238
238
|
import { MultichainSDK } from "./MultichainSDK.js";
|
|
239
239
|
import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
240
240
|
import "./types/index.js";
|
|
241
|
-
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, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, IntentPreviewError, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, 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, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString,
|
|
241
|
+
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, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, IntentPreviewError, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, 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, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, 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, 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 };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
2
2
|
import { isRWAToken, isSunsetPool } from "../chain/chains.js";
|
|
3
|
+
import { PERCENTAGE_FACTOR } from "../constants/math.js";
|
|
3
4
|
import "../utils/index.js";
|
|
4
5
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
5
6
|
import "../base/index.js";
|
|
@@ -164,11 +165,16 @@ var MarketSuite = class extends SDKConstruct {
|
|
|
164
165
|
quotaAssets() {
|
|
165
166
|
const oracle = this.priceOracle;
|
|
166
167
|
const { underlying } = this;
|
|
167
|
-
|
|
168
|
+
const quotas = this.pool.pqk.quotas.entries();
|
|
169
|
+
const sumUsed = quotas.reduce((sum, [, quota]) => sum + quota.totalQuoted, 0n);
|
|
170
|
+
const { totalBorrowed } = this.pool.pool;
|
|
171
|
+
return quotas.map(([token, quota]) => ({
|
|
168
172
|
token: this.tokensMeta.mustGetToken(token),
|
|
169
173
|
quotaRate: quota.rate,
|
|
170
174
|
limit: oracle.toAmount(underlying, quota.limit),
|
|
171
|
-
used: oracle.toAmount(underlying, quota.totalQuoted)
|
|
175
|
+
used: oracle.toAmount(underlying, quota.totalQuoted),
|
|
176
|
+
allocationShare: sumUsed === 0n ? 0 : Number(quota.totalQuoted * PERCENTAGE_FACTOR / sumUsed),
|
|
177
|
+
allocatedDebt: oracle.toAmount(underlying, sumUsed === 0n ? 0n : totalBorrowed * quota.totalQuoted / sumUsed)
|
|
172
178
|
}));
|
|
173
179
|
}
|
|
174
180
|
/**
|
|
@@ -223,7 +229,8 @@ var MarketSuite = class extends SDKConstruct {
|
|
|
223
229
|
collateralTokens: this.collateralTokens,
|
|
224
230
|
paused: pool.isPaused,
|
|
225
231
|
rwa: this.rwa,
|
|
226
|
-
sunset: this.sunset
|
|
232
|
+
sunset: this.sunset,
|
|
233
|
+
quotaAssets: this.quotaAssets()
|
|
227
234
|
};
|
|
228
235
|
}
|
|
229
236
|
/**
|
|
@@ -232,8 +239,7 @@ var MarketSuite = class extends SDKConstruct {
|
|
|
232
239
|
poolOpportunityDetail() {
|
|
233
240
|
return {
|
|
234
241
|
...this.poolOpportunity(),
|
|
235
|
-
rateCurve: this.pool.rateCurve
|
|
236
|
-
quotaAssets: this.quotaAssets()
|
|
242
|
+
rateCurve: this.pool.rateCurve
|
|
237
243
|
};
|
|
238
244
|
}
|
|
239
245
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
2
1
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
2
|
+
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
3
3
|
//#region src/sdk/market/adapters/contracts/AccountMigratorAdapterContract.ts
|
|
4
4
|
const abi = accountMigratorAbi;
|
|
5
5
|
const protocolAbi = accountMigratorAbi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
2
1
|
import { MissingSerializedParamsError } from "../../../base/errors.js";
|
|
3
2
|
import "../../../base/index.js";
|
|
3
|
+
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
4
4
|
import { iERC4626Abi } from "../abi/targetContractAbi.js";
|
|
5
5
|
import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
|
|
6
6
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
4
3
|
import "../../base/index.js";
|
|
4
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
5
5
|
//#region src/sdk/market/credit/CreditFacadeV310BaseContract.ts
|
|
6
6
|
const abi = [
|
|
7
7
|
...iCreditFacadeV310Abi,
|
|
@@ -6,7 +6,7 @@ import "../../constants/index.js";
|
|
|
6
6
|
import "../../utils/index.js";
|
|
7
7
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
8
8
|
import "../../base/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import { calcBorrowApy, calcQuotaRate, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount } from "../math.js";
|
|
10
10
|
import { strategyName } from "../strategyName.js";
|
|
11
11
|
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./collateralUtils.js";
|
|
12
12
|
import createCreditConfigurator from "./createCreditConfigurator.js";
|
|
@@ -14,6 +14,12 @@ import createCreditFacade from "./createCreditFacade.js";
|
|
|
14
14
|
import createCreditManager from "./createCreditManager.js";
|
|
15
15
|
//#region src/sdk/market/credit/CreditSuite.ts
|
|
16
16
|
/**
|
|
17
|
+
* Amount of underlying seeded into each pool at market creation to protect
|
|
18
|
+
* from inflation attacks, in raw token units. A suite whose remaining borrow
|
|
19
|
+
* capacity is at or below this is treated as having nothing left to lend.
|
|
20
|
+
**/
|
|
21
|
+
const MIN_STRATEGY_BORROW_AMOUNT = 100000n;
|
|
22
|
+
/**
|
|
17
23
|
* SDK aggregate for one credit-manager branch inside a market.
|
|
18
24
|
*
|
|
19
25
|
* @remarks
|
|
@@ -173,13 +179,9 @@ var CreditSuite = class extends SDKConstruct {
|
|
|
173
179
|
/**
|
|
174
180
|
* Collateral tokens a leveraged position can be built around in this suite,
|
|
175
181
|
* see {@link isStrategyCollateral} for the per-token criteria.
|
|
176
|
-
*
|
|
177
|
-
* A suite where no debt can be drawn at all ({@link maxBorrowAmount} is `0`,
|
|
178
|
-
* e.g. its debt limit is exhausted or zeroed out) offers no strategies,
|
|
179
|
-
* whatever its collaterals are.
|
|
180
182
|
*/
|
|
181
183
|
get strategyCollaterals() {
|
|
182
|
-
if (this.maxBorrowAmount
|
|
184
|
+
if (this.maxBorrowAmount <= MIN_STRATEGY_BORROW_AMOUNT) return [];
|
|
183
185
|
return this.creditManager.collateralTokens.filter((token) => isStrategyCollateral(this.#strategyCollateralProps(token), true));
|
|
184
186
|
}
|
|
185
187
|
/**
|
|
@@ -218,15 +220,15 @@ var CreditSuite = class extends SDKConstruct {
|
|
|
218
220
|
get strategyName() {
|
|
219
221
|
const collateral = this.strategyTargetCollateral;
|
|
220
222
|
if (!collateral) return;
|
|
221
|
-
return strategyName(this.tokensMeta.mustGetToken(collateral), this.market.underlyingToken
|
|
223
|
+
return strategyName(this.tokensMeta.mustGetToken(collateral), this.market.underlyingToken);
|
|
222
224
|
}
|
|
223
225
|
/**
|
|
224
226
|
* Describes this suite's leveraged strategy as the shared read model does,
|
|
225
227
|
* or `undefined` when {@link strategyTargetCollateral} cannot be resolved or
|
|
226
|
-
* {@link maxBorrowAmount} is
|
|
228
|
+
* {@link maxBorrowAmount} is at or below {@link MIN_STRATEGY_BORROW_AMOUNT}.
|
|
227
229
|
*/
|
|
228
230
|
strategyOpportunity() {
|
|
229
|
-
if (this.maxBorrowAmount
|
|
231
|
+
if (this.maxBorrowAmount <= MIN_STRATEGY_BORROW_AMOUNT) return;
|
|
230
232
|
const collateral = this.strategyTargetCollateral;
|
|
231
233
|
if (!collateral) return;
|
|
232
234
|
const { market, creditManager: cm } = this;
|
|
@@ -254,7 +256,7 @@ var CreditSuite = class extends SDKConstruct {
|
|
|
254
256
|
liquidationFee: cm.feeLiquidation,
|
|
255
257
|
expirationDate: this.expirationDate,
|
|
256
258
|
borrowApy: calcBorrowApy(pool.baseInterestRate, cm.feeInterest),
|
|
257
|
-
|
|
259
|
+
quotaRate: calcQuotaRate(market.pool.pqk.quotaRate(collateral), cm.feeInterest),
|
|
258
260
|
availableLiquidity: oracle.toAmount(pool.underlying, pool.availableLiquidity),
|
|
259
261
|
minDebt: oracle.toAmount(pool.underlying, this.creditFacade.minDebt),
|
|
260
262
|
totalDebtLimit: oracle.toAmount(pool.underlying, debtParams?.limit ?? 0n),
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import "../../constants/math.js";
|
|
2
2
|
import "../../constants/index.js";
|
|
3
|
+
import { NON_STRATEGY_PHANTOM_TOKEN_TYPES } from "../../base/token-types.js";
|
|
3
4
|
import { isAddressEqual } from "viem";
|
|
4
5
|
//#region src/sdk/market/credit/collateralUtils.ts
|
|
5
|
-
/**
|
|
6
|
-
* Withdrawal and redemption phantom tokens that can never be acquired as a
|
|
7
|
-
* strategy target. Other `PHANTOM_TOKEN::*` types (Convex, Infrared, staking
|
|
8
|
-
* rewards) can.
|
|
9
|
-
*/
|
|
10
|
-
const NON_STRATEGY_PHANTOM_TOKEN_TYPES = [
|
|
11
|
-
"PHANTOM_TOKEN::INFINIFI_UNWIND",
|
|
12
|
-
"PHANTOM_TOKEN::MELLOW_WITHDRAWAL",
|
|
13
|
-
"PHANTOM_TOKEN::MIDAS_REDEMPTION",
|
|
14
|
-
"PHANTOM_TOKEN::SECURITIZE_RD",
|
|
15
|
-
"PHANTOM_TOKEN::UPSHIFT_WITHDRAW"
|
|
16
|
-
];
|
|
17
6
|
const NON_STRATEGY_PHANTOM_TOKEN_TYPE_SET = new Set(NON_STRATEGY_PHANTOM_TOKEN_TYPES);
|
|
18
7
|
const RWA_UNDERLYING_PREFIX = "RWA_UNDERLYING::";
|
|
19
8
|
/**
|
|
@@ -90,4 +79,4 @@ function dominantCollateral(account, market) {
|
|
|
90
79
|
return dominant;
|
|
91
80
|
}
|
|
92
81
|
//#endregion
|
|
93
|
-
export {
|
|
82
|
+
export { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral };
|
|
@@ -2,8 +2,8 @@ import { CreditConfiguratorV310Contract } from "./CreditConfiguratorV310Contract
|
|
|
2
2
|
import { CreditFacadeV310BaseContract, creditFacadeV310Abi as abi } from "./CreditFacadeV310BaseContract.js";
|
|
3
3
|
import { CreditFacadeV310Contract } from "./CreditFacadeV310Contract.js";
|
|
4
4
|
import { CreditManagerV310Contract } from "./CreditManagerV310Contract.js";
|
|
5
|
-
import {
|
|
5
|
+
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./collateralUtils.js";
|
|
6
6
|
import { CreditSuite } from "./CreditSuite.js";
|
|
7
7
|
import { expectedBalanceDeltas } from "./expectedBalanceDeltas.js";
|
|
8
8
|
import "./types.js";
|
|
9
|
-
export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite,
|
|
9
|
+
export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, pickStrategyTargetCollateral };
|
|
@@ -87,10 +87,10 @@ import "./adapters/index.js";
|
|
|
87
87
|
import { CreditConfiguratorV310Contract } from "./credit/CreditConfiguratorV310Contract.js";
|
|
88
88
|
import { CreditFacadeV310BaseContract, creditFacadeV310Abi as abi } from "./credit/CreditFacadeV310BaseContract.js";
|
|
89
89
|
import { CreditFacadeV310Contract } from "./credit/CreditFacadeV310Contract.js";
|
|
90
|
-
import { MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS,
|
|
90
|
+
import { DEFAULT_QUOTA_BUFFER_BPS, MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./math.js";
|
|
91
91
|
import { CreditManagerV310Contract } from "./credit/CreditManagerV310Contract.js";
|
|
92
92
|
import { strategyName } from "./strategyName.js";
|
|
93
|
-
import {
|
|
93
|
+
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./credit/collateralUtils.js";
|
|
94
94
|
import { CreditSuite } from "./credit/CreditSuite.js";
|
|
95
95
|
import { expectedBalanceDeltas } from "./credit/expectedBalanceDeltas.js";
|
|
96
96
|
import "./credit/index.js";
|
|
@@ -144,4 +144,4 @@ import { RWARegistry } from "./rwa/RWARegistry.js";
|
|
|
144
144
|
import { RWA_FACTORY_TYPES, isRWAFactory } from "./rwa/types.js";
|
|
145
145
|
import "./rwa/index.js";
|
|
146
146
|
import "./types.js";
|
|
147
|
-
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract,
|
|
147
|
+
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, classifyCurveOperation, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fetchRedstonePayloads, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, usdToNumber };
|
|
@@ -74,6 +74,70 @@ function calcBorrowApy(baseInterestRate, feeInterest) {
|
|
|
74
74
|
return rayToBps(baseInterestRate * (PERCENTAGE_FACTOR + BigInt(feeInterest)) / PERCENTAGE_FACTOR);
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
+
* Annual quota cost of a collateral, in basis points:
|
|
78
|
+
* `quotaRate × (1 + feeInterest)` — the quoted rate plus the protocol's cut of
|
|
79
|
+
* the accrued quota interest, matching {@link calcBorrowApy}.
|
|
80
|
+
*
|
|
81
|
+
* @param quotaRate - Pool quota keeper rate in basis points, without the fee.
|
|
82
|
+
* @param feeInterest - Credit manager interest fee in basis points.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* // quotaRate: 200 bps = 2%, feeInterest: 2500 bps = 25%
|
|
87
|
+
* calcQuotaRate(200, 2500) // 2% × 1.25 = 250 bps = 2.5%
|
|
88
|
+
* ```
|
|
89
|
+
**/
|
|
90
|
+
function calcQuotaRate(quotaRate, feeInterest) {
|
|
91
|
+
return Math.round(quotaRate * (FULL + feeInterest) / FULL);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Extra quota, as a fraction of equity, that an aggressive position quotes
|
|
95
|
+
* above the debt it actually owes. Matches {@link MAX_LEVERAGE_BUFFER_BPS}.
|
|
96
|
+
**/
|
|
97
|
+
const DEFAULT_QUOTA_BUFFER_BPS = 500;
|
|
98
|
+
/**
|
|
99
|
+
* Quoted amount per unit of equity at the given leverage and quota mode.
|
|
100
|
+
* Dimensionless: `1` means the quota equals the user's equity.
|
|
101
|
+
**/
|
|
102
|
+
function calcQuotaMultiplier(leverage, lt, quotaMode = "safe") {
|
|
103
|
+
switch (quotaMode) {
|
|
104
|
+
case "min": return leverage - 1;
|
|
105
|
+
case "safe": return leverage * lt / FULL;
|
|
106
|
+
case "aggressive": return (1 + 500 / FULL) * (leverage - 1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Annual cost of credit on the user's equity, in basis points, at a given
|
|
111
|
+
* leverage and quota mode: base interest on the borrowed part plus quota
|
|
112
|
+
* interest on the quoted amount. Both rates already include the protocol's
|
|
113
|
+
* interest fee.
|
|
114
|
+
*
|
|
115
|
+
* @param opportunity - Borrow APY, quota rate, and liquidation threshold.
|
|
116
|
+
* @param leverage - Total-value leverage, same scale as {@link Leverage}.
|
|
117
|
+
* @param mode - How much quota the position quotes, see {@link QuotaMode}.
|
|
118
|
+
**/
|
|
119
|
+
function calcEffectiveBorrowApy(opportunity, leverage, mode = "safe") {
|
|
120
|
+
const { borrowApy, quotaRate, liquidationThreshold } = opportunity;
|
|
121
|
+
return Math.round(borrowApy * (leverage - 1) + quotaRate * calcQuotaMultiplier(leverage, liquidationThreshold, mode));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Net yield of a strategy on the user's equity, in basis points, at a given
|
|
125
|
+
* leverage and quota mode:
|
|
126
|
+
* `leverage × totalCollateralApy − effectiveBorrowApy`. Collateral yield is
|
|
127
|
+
* on the whole position; borrow and quota interest are those of
|
|
128
|
+
* {@link calcEffectiveBorrowApy}.
|
|
129
|
+
*
|
|
130
|
+
* @param opportunity - Borrow APY, quota rate, and liquidation threshold.
|
|
131
|
+
* @param totalCollateralApy - Collateral yield the caller chose, typically
|
|
132
|
+
* `totalApy` of {@link StrategyOpportunity.collateralApy} or
|
|
133
|
+
* {@link StrategyOpportunity.collateralApyAvg7D}.
|
|
134
|
+
* @param leverage - Total-value leverage, same scale as {@link Leverage}.
|
|
135
|
+
* @param mode - How much quota the position quotes, see {@link QuotaMode}.
|
|
136
|
+
**/
|
|
137
|
+
function calcNetStrategyApy(opportunity, totalCollateralApy, leverage, mode = "safe") {
|
|
138
|
+
return Math.round(leverage * totalCollateralApy - calcEffectiveBorrowApy(opportunity, leverage, mode));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
77
141
|
* 5% safety margin subtracted from 100% in {@link calcMaxLeverage}, so a
|
|
78
142
|
* maxed position opens with HF slightly above 1.
|
|
79
143
|
**/
|
|
@@ -90,9 +154,11 @@ const MAX_LEVERAGE_BUFFER_BPS = 500;
|
|
|
90
154
|
* // liquidationThreshold: 9000 bps = 90%
|
|
91
155
|
* calcMaxLeverage(9000) // (1 − 0.05) / (1 − 0.9) = 9.5x total exposure
|
|
92
156
|
* ```
|
|
157
|
+
* @throws If `liquidationThreshold` is 100% or more, which would make
|
|
158
|
+
* leverage unbounded.
|
|
93
159
|
**/
|
|
94
160
|
function calcMaxLeverage(liquidationThreshold) {
|
|
95
|
-
if (liquidationThreshold >= FULL)
|
|
161
|
+
if (liquidationThreshold >= FULL) throw new Error("cannot compute max leverage: liquidation threshold is 100% or more");
|
|
96
162
|
const leverage = (FULL - 500) / (FULL - liquidationThreshold);
|
|
97
163
|
return Math.max(leverage, 1);
|
|
98
164
|
}
|
|
@@ -134,21 +200,6 @@ function calcPositionLeverage(totalValue, totalDebt) {
|
|
|
134
200
|
return Number(totalValue) / Number(equity);
|
|
135
201
|
}
|
|
136
202
|
/**
|
|
137
|
-
* Annual quota cost on equity, in basis points:
|
|
138
|
-
* `quotaRate × (1 + feeInterest) × leverage`. Quota accrues on the whole
|
|
139
|
-
* quoted position, and the DAO takes `feeInterest` of it as with base interest.
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* ```ts
|
|
143
|
-
* // quotaRate: 200 bps = 2%, feeInterest: 2500 bps = 25%, leverage: 9.5x
|
|
144
|
-
* calcAdditionalBorrowApy(200, 2500, 9.5) // 2% × 1.25 × 9.5 = 2375 bps = 23.75%
|
|
145
|
-
* ```
|
|
146
|
-
**/
|
|
147
|
-
function calcAdditionalBorrowApy(quotaRate, feeInterest, leverage) {
|
|
148
|
-
if (!Number.isFinite(leverage) || leverage <= 0) return 0;
|
|
149
|
-
return Math.round(quotaRate * (1 + feeInterest / FULL) * leverage);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
203
|
* {@link PERCENTAGE_FACTOR} less a 0.1% safety buffer.
|
|
153
204
|
*
|
|
154
205
|
* Partial liquidation amounts are computed off prices that can drift between
|
|
@@ -204,4 +255,4 @@ function optimalHFForPartialLiquidation(borrowRate) {
|
|
|
204
255
|
return PERCENTAGE_FACTOR + (borrowRate < 100n ? borrowRate : 100n);
|
|
205
256
|
}
|
|
206
257
|
//#endregion
|
|
207
|
-
export { MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS,
|
|
258
|
+
export { DEFAULT_QUOTA_BUFFER_BPS, MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
4
3
|
import { RAY } from "../../constants/math.js";
|
|
@@ -7,6 +6,7 @@ import { formatBN, formatBNvalue, percentFmt } from "../../utils/formatter.js";
|
|
|
7
6
|
import "../../utils/index.js";
|
|
8
7
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
9
8
|
import "../../base/index.js";
|
|
9
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
10
10
|
import { calcUtilization } from "../math.js";
|
|
11
11
|
//#region src/sdk/market/pool/PoolV310Contract.ts
|
|
12
12
|
const abi = [...iPoolV310Abi, ...iPausableAbi];
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { getTokenPrettyName } from "../chain/chains.js";
|
|
2
1
|
//#region src/sdk/market/strategyName.ts
|
|
3
2
|
/**
|
|
4
3
|
* Display name of a leveraged strategy: the target collateral over the
|
|
5
4
|
* borrowed underlying, e.g. `"wstETH / WETH"`.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Uses each token's display {@link Token.symbol}, which may already be a
|
|
7
|
+
* curated pretty name or a `"source -> target"` redemption rewrite.
|
|
9
8
|
*
|
|
10
9
|
* @param target - Collateral the position is built around.
|
|
11
10
|
* @param underlying - Token the position borrows.
|
|
12
|
-
* @param network - Chain id or network type label of the market.
|
|
13
11
|
**/
|
|
14
|
-
function strategyName(target, underlying
|
|
15
|
-
return `${
|
|
12
|
+
function strategyName(target, underlying) {
|
|
13
|
+
return `${target.symbol} / ${underlying.symbol}`;
|
|
16
14
|
}
|
|
17
15
|
//#endregion
|
|
18
16
|
export { strategyName };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
1
|
import { ZapperContract } from "./ZapperContract.js";
|
|
2
|
+
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
3
3
|
//#region src/sdk/market/zapper/IETHZapperContract.ts
|
|
4
4
|
const abi = iethZapperAbi;
|
|
5
5
|
var IETHZapperContract = class extends ZapperContract {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
3
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
4
4
|
import { UnsupportedZapperFunctionError } from "./errors.js";
|
|
5
5
|
//#region src/sdk/market/zapper/ZapperContract.ts
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
1
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
2
|
+
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
3
3
|
import "../constants/addresses.js";
|
|
4
4
|
import { PERCENTAGE_FACTOR, RAY } from "../constants/math.js";
|
|
5
5
|
import "../constants/index.js";
|
|
@@ -176,7 +176,7 @@ var PositionsService = class extends SDKConstruct {
|
|
|
176
176
|
chainId: this.sdk.chainId,
|
|
177
177
|
creditManager: ca.creditManager,
|
|
178
178
|
creditAccount: ca.creditAccount,
|
|
179
|
-
name: target ? strategyName(this.sdk.tokensMeta.mustGetToken(target), token
|
|
179
|
+
name: target ? strategyName(this.sdk.tokensMeta.mustGetToken(target), token) : token.symbol,
|
|
180
180
|
targetCollateral: target ? this.sdk.tokensMeta.mustGetToken(target) : null,
|
|
181
181
|
leverage: calcPositionLeverage(totalValue, totalDebtValue),
|
|
182
182
|
borrowApy: calcBorrowApy(pool.baseInterestRate, suite.creditManager.feeInterest),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { errorAbis } from "../../../abi/errors.js";
|
|
2
|
-
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
3
2
|
import { generateCastTraceCall } from "./cast.js";
|
|
3
|
+
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
4
4
|
import { simulateMulticall } from "./simulateMulticall.js";
|
|
5
5
|
import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
|
|
6
6
|
import { getAction, parseAccount } from "viem/utils";
|
|
@@ -22,7 +22,7 @@ type ChartRange = (typeof CHART_RANGES)[number];
|
|
|
22
22
|
/**
|
|
23
23
|
* Every metric a pool opportunity can chart.
|
|
24
24
|
**/
|
|
25
|
-
declare const POOL_OPPORTUNITY_CHART_METRICS: readonly ["depositApy", "
|
|
25
|
+
declare const POOL_OPPORTUNITY_CHART_METRICS: readonly ["depositApy", "depositApyAvg7d", "dieselRate", "supplied", "borrowed"];
|
|
26
26
|
/**
|
|
27
27
|
* Metric a pool opportunity can chart. Derived from the runtime list that also
|
|
28
28
|
* builds the backend's route enum, so the two cannot drift.
|
|
@@ -34,7 +34,7 @@ type PoolOpportunityChartMetric = (typeof POOL_OPPORTUNITY_CHART_METRICS)[number
|
|
|
34
34
|
* `collateralPrice` is the collateral/underlying series a liquidation-price
|
|
35
35
|
* chart draws; the two USD series are the same prices quoted in dollars.
|
|
36
36
|
**/
|
|
37
|
-
declare const STRATEGY_OPPORTUNITY_CHART_METRICS: readonly ["
|
|
37
|
+
declare const STRATEGY_OPPORTUNITY_CHART_METRICS: readonly ["borrowApy", "borrowApyAvg7d", "quotaRate", "liquidationThreshold", "collateralApy", "tvl", "collateralPrice", "collateralUsdPrice", "underlyingUsdPrice"];
|
|
38
38
|
/**
|
|
39
39
|
* Metric a strategy opportunity can chart, derived from
|
|
40
40
|
* {@link STRATEGY_OPPORTUNITY_CHART_METRICS}.
|
|
@@ -44,13 +44,12 @@ type StrategyOpportunityChartMetric = (typeof STRATEGY_OPPORTUNITY_CHART_METRICS
|
|
|
44
44
|
* Every metric a pool position can chart.
|
|
45
45
|
*
|
|
46
46
|
* Nothing to do with {@link POOL_OPPORTUNITY_CHART_METRICS}: an opportunity charts what the
|
|
47
|
-
* pool did, a position charts what one wallet's deposit did in it. `mwr`
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* only zooms the visible slice and its first point is rarely zero.
|
|
47
|
+
* pool did, a position charts what one wallet's deposit did in it. `mwr` is the
|
|
48
|
+
* money-weighted return since the position opened, so it is sensitive to when
|
|
49
|
+
* deposits and withdrawals landed. It is anchored at inception, so a narrow
|
|
50
|
+
* `range` only zooms the visible slice and its first point is rarely zero.
|
|
52
51
|
**/
|
|
53
|
-
declare const POOL_POSITION_CHART_METRICS: readonly ["
|
|
52
|
+
declare const POOL_POSITION_CHART_METRICS: readonly ["apy", "pnl", "mwr"];
|
|
54
53
|
/**
|
|
55
54
|
* Metric a pool position can chart, derived from
|
|
56
55
|
* {@link POOL_POSITION_CHART_METRICS}.
|
|
@@ -59,12 +58,11 @@ type PoolPositionChartMetric = (typeof POOL_POSITION_CHART_METRICS)[number];
|
|
|
59
58
|
/**
|
|
60
59
|
* Every metric a strategy position can chart.
|
|
61
60
|
*
|
|
62
|
-
* `
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* different ages.
|
|
61
|
+
* `netApy7d` is the trailing seven-day net yield, so it tracks the position's
|
|
62
|
+
* recent pace rather than its lifetime return and is comparable across
|
|
63
|
+
* positions of different ages.
|
|
66
64
|
**/
|
|
67
|
-
declare const STRATEGY_POSITION_CHART_METRICS: readonly ["
|
|
65
|
+
declare const STRATEGY_POSITION_CHART_METRICS: readonly ["totalValueUnderlying", "debt", "healthFactor", "borrowApy", "borrowApyAvg7d", "pnl", "mwr", "netApy7d"];
|
|
68
66
|
/**
|
|
69
67
|
* Metric a strategy position can chart, derived from
|
|
70
68
|
* {@link STRATEGY_POSITION_CHART_METRICS}.
|
|
@@ -161,31 +159,26 @@ type ChartUnit =
|
|
|
161
159
|
**/
|
|
162
160
|
declare const CHART_METRIC_UNITS: {
|
|
163
161
|
readonly depositApy: "bps";
|
|
162
|
+
readonly depositApyAvg7d: "bps";
|
|
164
163
|
readonly borrowApy: "bps";
|
|
165
|
-
readonly
|
|
164
|
+
readonly borrowApyAvg7d: "bps";
|
|
165
|
+
readonly quotaRate: "bps";
|
|
166
|
+
readonly liquidationThreshold: "bps";
|
|
166
167
|
readonly collateralApy: "bps";
|
|
167
168
|
readonly supplied: "token";
|
|
168
169
|
readonly borrowed: "token";
|
|
169
|
-
readonly availableLiquidity: "token";
|
|
170
170
|
readonly tvl: "token";
|
|
171
171
|
readonly dieselRate: "ratio";
|
|
172
172
|
readonly collateralPrice: "ratio";
|
|
173
173
|
readonly collateralUsdPrice: "usd";
|
|
174
174
|
readonly underlyingUsdPrice: "usd";
|
|
175
|
-
readonly value: "token";
|
|
176
175
|
readonly apy: "bps";
|
|
177
176
|
readonly pnl: "token";
|
|
178
177
|
readonly mwr: "bps";
|
|
179
|
-
readonly twr: "bps";
|
|
180
|
-
readonly underlyingPrice: "usd";
|
|
181
|
-
readonly totalValueUsd: "usd";
|
|
182
178
|
readonly totalValueUnderlying: "token";
|
|
183
179
|
readonly debt: "token";
|
|
184
180
|
readonly healthFactor: "bps";
|
|
185
|
-
readonly
|
|
186
|
-
readonly twrApy: "bps";
|
|
187
|
-
readonly trailingApy7d: "bps";
|
|
188
|
-
readonly trailingApy30d: "bps";
|
|
181
|
+
readonly netApy7d: "bps";
|
|
189
182
|
};
|
|
190
183
|
/**
|
|
191
184
|
* A unit together with what it is denominated in.
|