@gearbox-protocol/sdk 16.0.0-next.37 → 16.0.0-next.39
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/liquidations.schema.js +1 -0
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +15 -1
- package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -2
- package/dist/cjs/onchain/index.js +0 -3
- package/dist/cjs/onchain/market/credit/CreditSuite.js +68 -3
- package/dist/cjs/onchain/market/credit/index.js +0 -3
- package/dist/cjs/onchain/market/index.js +0 -3
- package/dist/cjs/onchain/positions/PositionsService.js +4 -8
- package/dist/cjs/preview/preview/buildDelayedStrategyPositionOperationPreview.js +7 -2
- package/dist/cjs/preview/preview/previewAdjustStrategyPosition.js +3 -0
- package/dist/cjs/preview/preview/previewExitOrRepayStrategyPosition.js +8 -3
- package/dist/cjs/preview/preview/previewOperation.js +4 -3
- package/dist/cjs/preview/preview/previewPoolPositionOperation.js +1 -0
- package/dist/esm/model/liquidations.schema.js +2 -1
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +15 -1
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -2
- package/dist/esm/onchain/index.js +1 -2
- package/dist/esm/onchain/market/credit/CreditSuite.js +69 -4
- package/dist/esm/onchain/market/credit/index.js +1 -2
- package/dist/esm/onchain/market/index.js +1 -2
- package/dist/esm/onchain/positions/PositionsService.js +4 -8
- package/dist/esm/preview/preview/buildDelayedStrategyPositionOperationPreview.js +7 -2
- package/dist/esm/preview/preview/previewAdjustStrategyPosition.js +3 -0
- package/dist/esm/preview/preview/previewExitOrRepayStrategyPosition.js +8 -3
- package/dist/esm/preview/preview/previewOperation.js +4 -3
- package/dist/esm/preview/preview/previewPoolPositionOperation.js +1 -0
- package/dist/types/model/liquidations.schema.d.ts +18 -0
- package/dist/types/model/previews.d.ts +38 -2
- package/dist/types/onchain/index.d.ts +1 -2
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +48 -1
- package/dist/types/onchain/market/credit/index.d.ts +1 -2
- package/dist/types/onchain/market/index.d.ts +1 -2
- package/package.json +1 -1
- package/dist/cjs/onchain/market/credit/creditOperationMarket.js +0 -36
- package/dist/esm/onchain/market/credit/creditOperationMarket.js +0 -34
- package/dist/types/onchain/market/credit/creditOperationMarket.d.ts +0 -27
|
@@ -139,7 +139,6 @@ import "./pool/index.js";
|
|
|
139
139
|
import { MarketSuite } from "./MarketSuite.js";
|
|
140
140
|
import { CreditSuite } from "./credit/CreditSuite.js";
|
|
141
141
|
import { StrategyCollateralProps, dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./credit/collateralUtils.js";
|
|
142
|
-
import { creditOperationMarket, totalLiquidationDiscount } from "./credit/creditOperationMarket.js";
|
|
143
142
|
import { ExpectedBalanceDeltasProps, ExpectedOutput, expectedBalanceDeltas } from "./credit/expectedBalanceDeltas.js";
|
|
144
143
|
import "./credit/index.js";
|
|
145
144
|
import { CompressorZapperData, ZapperData } from "./types.js";
|
|
@@ -153,4 +152,4 @@ import "./zapper/index.js";
|
|
|
153
152
|
import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./MarketRegister.js";
|
|
154
153
|
import { DEFAULT_QUOTA_BUFFER_BPS, MAX_LEVERAGE_BUFFER_BPS, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, QuotaMode, StrategyRateInputs, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./math.js";
|
|
155
154
|
import { strategyName } from "./strategyName.js";
|
|
156
|
-
export { AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterContractStateHuman, AdapterContractType, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BasicSwapCall, BoundedPriceFeedContract, CamelotPool, CamelotV3AdapterContract, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DStokenData, DaiUsdsAdapterContract, DelayedWithdrawalClaim, DelayedWithdrawalRequest, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FluidDexAdapterContract, GaugeContract, GaugeParams, GetInvestorOptions, GetOpenAccountRequirementsProps, GetReward, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InterestRateModelType, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LatestUpdate, LegacyAdapterOperation, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationFees, MAX_LEVERAGE_BUFFER_BPS, MakerDeposit, MakerRedeem, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PrepareUpdateQuotasProps, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaMode, QuotaSlice, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StakingRewardsAdapterContract, StrategyCollateralProps, StrategyRateInputs, Swap, type TimestampedCalldata, TokenAmount, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VaultDeposit, VelodromeV2RouterAdapterContract, VersionedAbi, WithdrawCollateral, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper,
|
|
155
|
+
export { AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterContractStateHuman, AdapterContractType, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BasicSwapCall, BoundedPriceFeedContract, CamelotPool, CamelotV3AdapterContract, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DStokenData, DaiUsdsAdapterContract, DelayedWithdrawalClaim, DelayedWithdrawalRequest, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FluidDexAdapterContract, GaugeContract, GaugeParams, GetInvestorOptions, GetOpenAccountRequirementsProps, GetReward, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InterestRateModelType, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LatestUpdate, LegacyAdapterOperation, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationFees, MAX_LEVERAGE_BUFFER_BPS, MakerDeposit, MakerRedeem, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PrepareUpdateQuotasProps, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaMode, QuotaSlice, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StakingRewardsAdapterContract, StrategyCollateralProps, StrategyRateInputs, Swap, type TimestampedCalldata, TokenAmount, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VaultDeposit, VelodromeV2RouterAdapterContract, VersionedAbi, WithdrawCollateral, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, 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 };
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_onchain_constants_math = require("../../constants/math.js");
|
|
3
|
-
//#region src/onchain/market/credit/creditOperationMarket.ts
|
|
4
|
-
/**
|
|
5
|
-
* What a liquidation takes off an account, in basis points: the premium the
|
|
6
|
-
* liquidator keeps plus the protocol's own fee, with the suite's expiration
|
|
7
|
-
* already resolved.
|
|
8
|
-
*
|
|
9
|
-
* Not {@link LiquidationFees.liquidationDiscount}, which is the complement of
|
|
10
|
-
* the premium alone (`100% - liquidationPremium`) and says what share of the
|
|
11
|
-
* seized collateral repays the debt.
|
|
12
|
-
**/
|
|
13
|
-
function totalLiquidationDiscount(suite) {
|
|
14
|
-
const { feeLiquidation, liquidationDiscount } = suite.liquidationFees();
|
|
15
|
-
return Number(require_onchain_constants_math.PERCENTAGE_FACTOR) - liquidationDiscount + feeLiquidation;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The market half of every credit operation result, read off the suite that
|
|
19
|
-
* serves it: a preview, a projection, the open-strategy walk and a
|
|
20
|
-
* liquidatable-account row all spread it, so the four fields are filled in one
|
|
21
|
-
* place and cannot drift apart between the halves of the SDK.
|
|
22
|
-
*
|
|
23
|
-
* The curator comes from the same getter {@link CreditSuite.strategyOpportunity}
|
|
24
|
-
* reads, so a result and the opportunity beside it name one entity.
|
|
25
|
-
**/
|
|
26
|
-
function creditOperationMarket(suite) {
|
|
27
|
-
return {
|
|
28
|
-
creditManager: suite.creditManager.address,
|
|
29
|
-
name: suite.name,
|
|
30
|
-
curator: suite.market.curator,
|
|
31
|
-
liquidationDiscount: totalLiquidationDiscount(suite)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
exports.creditOperationMarket = creditOperationMarket;
|
|
36
|
-
exports.totalLiquidationDiscount = totalLiquidationDiscount;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { PERCENTAGE_FACTOR } from "../../constants/math.js";
|
|
2
|
-
//#region src/onchain/market/credit/creditOperationMarket.ts
|
|
3
|
-
/**
|
|
4
|
-
* What a liquidation takes off an account, in basis points: the premium the
|
|
5
|
-
* liquidator keeps plus the protocol's own fee, with the suite's expiration
|
|
6
|
-
* already resolved.
|
|
7
|
-
*
|
|
8
|
-
* Not {@link LiquidationFees.liquidationDiscount}, which is the complement of
|
|
9
|
-
* the premium alone (`100% - liquidationPremium`) and says what share of the
|
|
10
|
-
* seized collateral repays the debt.
|
|
11
|
-
**/
|
|
12
|
-
function totalLiquidationDiscount(suite) {
|
|
13
|
-
const { feeLiquidation, liquidationDiscount } = suite.liquidationFees();
|
|
14
|
-
return Number(PERCENTAGE_FACTOR) - liquidationDiscount + feeLiquidation;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* The market half of every credit operation result, read off the suite that
|
|
18
|
-
* serves it: a preview, a projection, the open-strategy walk and a
|
|
19
|
-
* liquidatable-account row all spread it, so the four fields are filled in one
|
|
20
|
-
* place and cannot drift apart between the halves of the SDK.
|
|
21
|
-
*
|
|
22
|
-
* The curator comes from the same getter {@link CreditSuite.strategyOpportunity}
|
|
23
|
-
* reads, so a result and the opportunity beside it name one entity.
|
|
24
|
-
**/
|
|
25
|
-
function creditOperationMarket(suite) {
|
|
26
|
-
return {
|
|
27
|
-
creditManager: suite.creditManager.address,
|
|
28
|
-
name: suite.name,
|
|
29
|
-
curator: suite.market.curator,
|
|
30
|
-
liquidationDiscount: totalLiquidationDiscount(suite)
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { creditOperationMarket, totalLiquidationDiscount };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Bps } from "../../../model/primitives.js";
|
|
2
|
-
import { CreditOperationMarket } from "../../../model/previews.js";
|
|
3
|
-
import "../../../model/index.js";
|
|
4
|
-
import { CreditSuite } from "./CreditSuite.js";
|
|
5
|
-
//#region src/onchain/market/credit/creditOperationMarket.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* What a liquidation takes off an account, in basis points: the premium the
|
|
8
|
-
* liquidator keeps plus the protocol's own fee, with the suite's expiration
|
|
9
|
-
* already resolved.
|
|
10
|
-
*
|
|
11
|
-
* Not {@link LiquidationFees.liquidationDiscount}, which is the complement of
|
|
12
|
-
* the premium alone (`100% - liquidationPremium`) and says what share of the
|
|
13
|
-
* seized collateral repays the debt.
|
|
14
|
-
**/
|
|
15
|
-
declare function totalLiquidationDiscount(suite: CreditSuite): Bps;
|
|
16
|
-
/**
|
|
17
|
-
* The market half of every credit operation result, read off the suite that
|
|
18
|
-
* serves it: a preview, a projection, the open-strategy walk and a
|
|
19
|
-
* liquidatable-account row all spread it, so the four fields are filled in one
|
|
20
|
-
* place and cannot drift apart between the halves of the SDK.
|
|
21
|
-
*
|
|
22
|
-
* The curator comes from the same getter {@link CreditSuite.strategyOpportunity}
|
|
23
|
-
* reads, so a result and the opportunity beside it name one entity.
|
|
24
|
-
**/
|
|
25
|
-
declare function creditOperationMarket(suite: CreditSuite): CreditOperationMarket;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { creditOperationMarket, totalLiquidationDiscount };
|