@gearbox-protocol/sdk 17.2.0-next.1 → 17.2.0-next.3
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 +5 -0
- package/dist/cjs/model/opportunities.schema.js +2 -1
- package/dist/cjs/onchain/accounts/intents/leverage-band.js +1 -1
- package/dist/cjs/onchain/accounts/intents/maxBorrow.js +8 -6
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +5 -3
- package/dist/cjs/onchain/chain/chains.js +1 -2
- package/dist/cjs/onchain/index.js +2 -0
- package/dist/cjs/onchain/market/MarketSuite.js +11 -4
- package/dist/cjs/onchain/market/credit/CreditSuite.js +24 -177
- package/dist/cjs/onchain/market/credit/CreditSuiteStrategy.js +179 -0
- package/dist/cjs/onchain/market/credit/index.js +2 -0
- package/dist/cjs/onchain/market/index.js +2 -0
- package/dist/cjs/onchain/opportunities/OpportunitiesService.js +7 -9
- package/dist/cjs/sdk/prepare/PrepareApi.js +1 -1
- package/dist/esm/model/charts.js +5 -0
- package/dist/esm/model/opportunities.schema.js +2 -1
- package/dist/esm/onchain/accounts/intents/leverage-band.js +1 -1
- package/dist/esm/onchain/accounts/intents/maxBorrow.js +8 -6
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +5 -3
- package/dist/esm/onchain/chain/chains.js +1 -2
- package/dist/esm/onchain/index.js +2 -1
- package/dist/esm/onchain/market/MarketSuite.js +11 -4
- package/dist/esm/onchain/market/credit/CreditSuite.js +26 -179
- package/dist/esm/onchain/market/credit/CreditSuiteStrategy.js +178 -0
- package/dist/esm/onchain/market/credit/index.js +2 -1
- package/dist/esm/onchain/market/index.js +2 -1
- package/dist/esm/onchain/opportunities/OpportunitiesService.js +7 -9
- package/dist/esm/sdk/prepare/PrepareApi.js +1 -1
- package/dist/types/model/charts.d.ts +5 -2
- package/dist/types/model/charts.schema.d.ts +8 -0
- package/dist/types/model/opportunities.d.ts +4 -0
- package/dist/types/model/opportunities.schema.d.ts +19 -0
- package/dist/types/model/positions.schema.d.ts +9 -0
- package/dist/types/onchain/accounts/intents/maxBorrow.d.ts +5 -5
- package/dist/types/onchain/index.d.ts +2 -1
- package/dist/types/onchain/market/MarketSuite.d.ts +6 -0
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +17 -70
- package/dist/types/onchain/market/credit/CreditSuiteStrategy.d.ts +78 -0
- package/dist/types/onchain/market/credit/index.d.ts +2 -1
- package/dist/types/onchain/market/credit/types.d.ts +3 -1
- package/dist/types/onchain/market/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { isSunsetStrategy } from "../../chain/chains.js";
|
|
2
|
+
import { calcBorrowApy, calcQuotaRate } from "../math.js";
|
|
3
|
+
import { strategyName } from "../strategyName.js";
|
|
4
|
+
import { isAddressEqual } from "viem";
|
|
5
|
+
//#region src/onchain/market/credit/CreditSuiteStrategy.ts
|
|
6
|
+
/**
|
|
7
|
+
* Amount of underlying seeded into each pool at market creation to protect
|
|
8
|
+
* from inflation attacks, in raw token units. A strategy whose
|
|
9
|
+
* {@link CreditSuiteStrategy.maxBorrowAmount} is at or below this is treated
|
|
10
|
+
* as having nothing left to lend.
|
|
11
|
+
**/
|
|
12
|
+
const MIN_STRATEGY_BORROW_AMOUNT = 100000n;
|
|
13
|
+
/**
|
|
14
|
+
* The leveraged strategy a credit suite runs: one target collateral bought
|
|
15
|
+
* with underlying borrowed from the pool.
|
|
16
|
+
*
|
|
17
|
+
* A view over live suite state, see {@link CreditSuite.strategy}.
|
|
18
|
+
*/
|
|
19
|
+
var CreditSuiteStrategy = class {
|
|
20
|
+
/**
|
|
21
|
+
* Credit suite this strategy borrows through.
|
|
22
|
+
*/
|
|
23
|
+
suite;
|
|
24
|
+
/**
|
|
25
|
+
* Collateral token a position in this strategy is built to hold.
|
|
26
|
+
*/
|
|
27
|
+
targetCollateral;
|
|
28
|
+
constructor(suite, targetCollateral) {
|
|
29
|
+
this.suite = suite;
|
|
30
|
+
this.targetCollateral = targetCollateral;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* {@link targetCollateral} as the shared read model describes it.
|
|
34
|
+
*/
|
|
35
|
+
get token() {
|
|
36
|
+
return this.suite.sdk.tokensMeta.mustGetToken(this.targetCollateral);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Display name of this strategy, e.g. `"wstETH / WETH"`.
|
|
40
|
+
*/
|
|
41
|
+
get name() {
|
|
42
|
+
return strategyName(this.token, this.suite.underlyingToken);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Tokens a user can transfer from their wallet when opening a position in
|
|
46
|
+
* this strategy:
|
|
47
|
+
*
|
|
48
|
+
* 1. unwrapped underlying (USDC, never dcUSDC)
|
|
49
|
+
* 2. target collateral
|
|
50
|
+
* 3. remaining CM collaterals in manager order, excluding phantom tokens
|
|
51
|
+
* and tokens without price
|
|
52
|
+
*/
|
|
53
|
+
get allowedDepositTokens() {
|
|
54
|
+
const { market, creditManager, sdk } = this.suite;
|
|
55
|
+
const { tokensMeta } = sdk;
|
|
56
|
+
const { targetCollateral } = this;
|
|
57
|
+
const { mainPrices, reservePrices } = market.priceOracle;
|
|
58
|
+
const rest = creditManager.collateralTokens.filter((token) => {
|
|
59
|
+
const contractType = tokensMeta.mustGet(token).contractType;
|
|
60
|
+
return !market.isUnderlyingLike(token) && !isAddressEqual(token, targetCollateral) && !contractType?.startsWith("PHANTOM_TOKEN::") && (!!mainPrices.get(token)?.price || !!reservePrices.get(token)?.price);
|
|
61
|
+
});
|
|
62
|
+
return [
|
|
63
|
+
market.unwrappedUnderlying,
|
|
64
|
+
targetCollateral,
|
|
65
|
+
...rest
|
|
66
|
+
].map((token) => tokensMeta.mustGetToken(token));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Largest debt one new position can take right now, and which limit set
|
|
70
|
+
* that number.
|
|
71
|
+
*
|
|
72
|
+
* `amount` is `0` whenever no position can be opened right now,
|
|
73
|
+
* and `limit` explains why.
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
maxBorrowAmount() {
|
|
77
|
+
const { suite } = this;
|
|
78
|
+
const lends = suite.maxBorrowAmount();
|
|
79
|
+
if (lends.limit === "debtPerBlockLimit") return lends;
|
|
80
|
+
let value = lends.amount.value;
|
|
81
|
+
let limit = lends.limit;
|
|
82
|
+
const quota = suite.market.pool.pqk.quotaAvailable(this.targetCollateral);
|
|
83
|
+
if (quota < value) {
|
|
84
|
+
value = quota;
|
|
85
|
+
limit = "quotaAvailable";
|
|
86
|
+
}
|
|
87
|
+
if (value < suite.creditFacade.minDebt) return {
|
|
88
|
+
amount: suite.market.toUnderlyingAmount(0n),
|
|
89
|
+
limit: "minDebt"
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
amount: suite.market.toUnderlyingAmount(value),
|
|
93
|
+
limit
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Whether this strategy is offered as an opportunity right now: it lends
|
|
98
|
+
* more than the pool's seed amount, and its target can be opened today.
|
|
99
|
+
*/
|
|
100
|
+
get isListed() {
|
|
101
|
+
return this.maxBorrowAmount().amount.value > MIN_STRATEGY_BORROW_AMOUNT && this.suite.isStrategyCollateral(this.targetCollateral, true);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Describes this strategy as the shared read model does. Whether it is
|
|
105
|
+
* listed at all is {@link isListed}.
|
|
106
|
+
*/
|
|
107
|
+
opportunity() {
|
|
108
|
+
const { suite, targetCollateral } = this;
|
|
109
|
+
const { market, creditManager: cm } = suite;
|
|
110
|
+
const { pool } = market.pool;
|
|
111
|
+
const oracle = market.priceOracle;
|
|
112
|
+
const debtParams = pool.creditManagerDebtParams.get(cm.address);
|
|
113
|
+
const borrowed = debtParams?.borrowed ?? 0n;
|
|
114
|
+
return {
|
|
115
|
+
kind: "strategy",
|
|
116
|
+
chainId: suite.chainId,
|
|
117
|
+
creditManager: cm.address,
|
|
118
|
+
targetCollateral: this.token,
|
|
119
|
+
name: this.name,
|
|
120
|
+
curator: market.curator,
|
|
121
|
+
underlyingToken: suite.underlyingToken,
|
|
122
|
+
totalBorrowed: oracle.toAmount(pool.underlying, borrowed),
|
|
123
|
+
allowedDepositTokens: this.allowedDepositTokens,
|
|
124
|
+
paused: suite.isPaused,
|
|
125
|
+
rwa: market.rwa,
|
|
126
|
+
sunset: market.sunset || isSunsetStrategy(cm.address, suite.sdk.networkType),
|
|
127
|
+
liquidationThreshold: cm.liquidationThresholds.mustGet(targetCollateral),
|
|
128
|
+
liquidationPremium: cm.liquidationPremium,
|
|
129
|
+
liquidationFee: cm.feeLiquidation,
|
|
130
|
+
expirationDate: suite.expirationDate,
|
|
131
|
+
borrowApy: calcBorrowApy(pool.baseInterestRate, cm.feeInterest),
|
|
132
|
+
quotaRate: calcQuotaRate(market.pool.pqk.quotaRate(targetCollateral), cm.feeInterest),
|
|
133
|
+
availableLiquidity: oracle.toAmount(pool.underlying, pool.availableLiquidity),
|
|
134
|
+
minDebt: oracle.toAmount(pool.underlying, suite.creditFacade.minDebt),
|
|
135
|
+
totalDebtLimit: oracle.toAmount(pool.underlying, debtParams?.limit ?? 0n),
|
|
136
|
+
maxBorrowAmount: oracle.toAmount(pool.underlying, this.maxBorrowAmount().amount.value),
|
|
137
|
+
maxLeverage: cm.maxLeverage(targetCollateral)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* {@link opportunity} plus the data only its detail screen needs.
|
|
142
|
+
*/
|
|
143
|
+
opportunityDetail() {
|
|
144
|
+
const { market } = this.suite;
|
|
145
|
+
return {
|
|
146
|
+
...this.opportunity(),
|
|
147
|
+
rateCurve: market.pool.rateCurve,
|
|
148
|
+
priceFeeds: market.priceFeedSummary(this.targetCollateral)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The KYC gate of this strategy; `null` when there is none.
|
|
153
|
+
* Wallet-independent.
|
|
154
|
+
*/
|
|
155
|
+
async kycRequirement() {
|
|
156
|
+
const nft = await this.suite.degenNFT();
|
|
157
|
+
if (!nft) return null;
|
|
158
|
+
const tokens = await nft.getTokens();
|
|
159
|
+
const token = tokens.find((t) => isAddressEqual(t, this.targetCollateral)) ?? tokens[0];
|
|
160
|
+
return {
|
|
161
|
+
protocol: nft.protocol,
|
|
162
|
+
token: token ? this.suite.sdk.tokensMeta.getToken(token) : void 0,
|
|
163
|
+
registrationLink: nft.registrationLink
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Whether `wallet` may open this strategy today; `true` when there is no
|
|
168
|
+
* KYC gate.
|
|
169
|
+
*/
|
|
170
|
+
async isEligible(wallet) {
|
|
171
|
+
const nft = await this.suite.degenNFT();
|
|
172
|
+
if (!nft) return true;
|
|
173
|
+
const requirements = await nft.getOpenAccountRequirements(wallet, { tokenOutAddress: this.targetCollateral });
|
|
174
|
+
return nft.isRegistered(requirements);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
//#endregion
|
|
178
|
+
export { CreditSuiteStrategy };
|
|
@@ -2,8 +2,9 @@ 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 { CreditSuiteStrategy } from "./CreditSuiteStrategy.js";
|
|
5
6
|
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./collateralUtils.js";
|
|
6
7
|
import { CreditSuite } from "./CreditSuite.js";
|
|
7
8
|
import { expectedBalanceDeltas } from "./expectedBalanceDeltas.js";
|
|
8
9
|
import "./types.js";
|
|
9
|
-
export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, pickStrategyTargetCollateral };
|
|
10
|
+
export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, pickStrategyTargetCollateral };
|
|
@@ -93,6 +93,7 @@ import { DEGEN_NFT_MIDAS, PHANTOM_TOKEN_MIDAS_REDEMPTION, RWA_LIQUIDATOR_MIDAS }
|
|
|
93
93
|
import { MidasDegenNFT } from "./rwa/midas/MidasDegenNFT.js";
|
|
94
94
|
import { DEGEN_NFT_SECURITIZE, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, RWA_LIQUIDATOR_SECURITIZE } from "./rwa/securitize/constants.js";
|
|
95
95
|
import { strategyName } from "./strategyName.js";
|
|
96
|
+
import { CreditSuiteStrategy } from "./credit/CreditSuiteStrategy.js";
|
|
96
97
|
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./credit/collateralUtils.js";
|
|
97
98
|
import { CreditSuite } from "./credit/CreditSuite.js";
|
|
98
99
|
import { expectedBalanceDeltas } from "./credit/expectedBalanceDeltas.js";
|
|
@@ -148,4 +149,4 @@ import { RWARegistry, RWA_COMPRESSOR_ADDRESS } from "./rwa/RWARegistry.js";
|
|
|
148
149
|
import { isRWAFactory } from "./rwa/types.js";
|
|
149
150
|
import "./rwa/index.js";
|
|
150
151
|
import "./types.js";
|
|
151
|
-
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConstantPriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, 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, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, 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, updatableDependencies, usdToNumber };
|
|
152
|
+
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConstantPriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, 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, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, 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, updatableDependencies, usdToNumber };
|
|
@@ -42,12 +42,11 @@ var OpportunitiesService = class extends SDKConstruct {
|
|
|
42
42
|
* strategy.
|
|
43
43
|
**/
|
|
44
44
|
async getStrategy(key) {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const kyc = await suite.kycRequirement(detail.targetCollateral.address);
|
|
45
|
+
const strategy = this.sdk.marketRegister.findCreditManager(key.creditManager).strategy;
|
|
46
|
+
if (!strategy?.isListed) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
|
|
47
|
+
const kyc = await strategy.kycRequirement();
|
|
49
48
|
return {
|
|
50
|
-
...
|
|
49
|
+
...strategy.opportunityDetail(),
|
|
51
50
|
kyc
|
|
52
51
|
};
|
|
53
52
|
}
|
|
@@ -59,10 +58,9 @@ var OpportunitiesService = class extends SDKConstruct {
|
|
|
59
58
|
* strategy.
|
|
60
59
|
**/
|
|
61
60
|
async isEligibleForStrategy(key, wallet) {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return suite.isEligibleForStrategy(wallet, opportunity.targetCollateral.address);
|
|
61
|
+
const strategy = this.sdk.marketRegister.findCreditManager(key.creditManager).strategy;
|
|
62
|
+
if (!strategy?.isListed) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
|
|
63
|
+
return strategy.isEligible(wallet);
|
|
66
64
|
}
|
|
67
65
|
};
|
|
68
66
|
//#endregion
|
|
@@ -230,7 +230,7 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
230
230
|
const sdk = await this.#chain(strategy.chainId);
|
|
231
231
|
const at = stateBlock(sdk);
|
|
232
232
|
Object.assign(state, marketOf(sdk, strategy.creditManager));
|
|
233
|
-
const targetToken = params.targetToken ?? sdk.marketRegister.findCreditManager(strategy.creditManager).
|
|
233
|
+
const targetToken = params.targetToken ?? sdk.marketRegister.findCreditManager(strategy.creditManager).strategy?.targetCollateral;
|
|
234
234
|
if (!targetToken) return refused(noStrategyTargetCollateral(strategy.creditManager), state);
|
|
235
235
|
const reused = await reusable(sdk, strategy, params.creditAccount);
|
|
236
236
|
if (reused && "error" in reused) return refused(reused.error, state);
|
|
@@ -21,8 +21,10 @@ declare const CHART_RANGES: readonly ["1d", "1w", "1m", "1y", "max"];
|
|
|
21
21
|
type ChartRange = (typeof CHART_RANGES)[number];
|
|
22
22
|
/**
|
|
23
23
|
* Every metric a pool opportunity can chart.
|
|
24
|
+
*
|
|
25
|
+
* `rewardsApyAvg7d` is the trailing seven-day average yield from rewards.
|
|
24
26
|
**/
|
|
25
|
-
declare const POOL_OPPORTUNITY_CHART_METRICS: readonly ["depositApy", "depositApyAvg7d", "dieselRate", "supplied", "borrowed", "utilization"];
|
|
27
|
+
declare const POOL_OPPORTUNITY_CHART_METRICS: readonly ["depositApy", "depositApyAvg7d", "rewardsApyAvg7d", "dieselRate", "supplied", "borrowed", "utilization"];
|
|
26
28
|
/**
|
|
27
29
|
* Metric a pool opportunity can chart. Derived from the runtime list that also
|
|
28
30
|
* builds the backend's route enum, so the two cannot drift.
|
|
@@ -34,7 +36,7 @@ type PoolOpportunityChartMetric = (typeof POOL_OPPORTUNITY_CHART_METRICS)[number
|
|
|
34
36
|
* `collateralPrice` is the collateral/underlying series a liquidation-price
|
|
35
37
|
* chart draws; the two USD series are the same prices quoted in dollars.
|
|
36
38
|
**/
|
|
37
|
-
declare const STRATEGY_OPPORTUNITY_CHART_METRICS: readonly ["borrowApy", "borrowApyAvg7d", "quotaRate", "liquidationThreshold", "collateralApy", "tvl", "collateralPrice", "collateralUsdPrice", "underlyingUsdPrice"];
|
|
39
|
+
declare const STRATEGY_OPPORTUNITY_CHART_METRICS: readonly ["borrowApy", "borrowApyAvg7d", "rewardsApyAvg7d", "quotaRate", "liquidationThreshold", "collateralApy", "tvl", "collateralPrice", "collateralUsdPrice", "underlyingUsdPrice"];
|
|
38
40
|
/**
|
|
39
41
|
* Metric a strategy opportunity can chart, derived from
|
|
40
42
|
* {@link STRATEGY_OPPORTUNITY_CHART_METRICS}.
|
|
@@ -177,6 +179,7 @@ type ChartUnit =
|
|
|
177
179
|
declare const CHART_METRIC_UNITS: {
|
|
178
180
|
readonly depositApy: "bps";
|
|
179
181
|
readonly depositApyAvg7d: "bps";
|
|
182
|
+
readonly rewardsApyAvg7d: "bps";
|
|
180
183
|
readonly borrowApy: "bps";
|
|
181
184
|
readonly borrowApyAvg7d: "bps";
|
|
182
185
|
readonly quotaRate: "bps";
|
|
@@ -28,6 +28,7 @@ declare const poolOpportunityChartMetricSchema: z.ZodEnum<{
|
|
|
28
28
|
depositApy: "depositApy";
|
|
29
29
|
depositApyAvg7d: "depositApyAvg7d";
|
|
30
30
|
dieselRate: "dieselRate";
|
|
31
|
+
rewardsApyAvg7d: "rewardsApyAvg7d";
|
|
31
32
|
supplied: "supplied";
|
|
32
33
|
utilization: "utilization";
|
|
33
34
|
}>;
|
|
@@ -42,6 +43,7 @@ declare const strategyOpportunityChartMetricSchema: z.ZodEnum<{
|
|
|
42
43
|
collateralUsdPrice: "collateralUsdPrice";
|
|
43
44
|
liquidationThreshold: "liquidationThreshold";
|
|
44
45
|
quotaRate: "quotaRate";
|
|
46
|
+
rewardsApyAvg7d: "rewardsApyAvg7d";
|
|
45
47
|
tvl: "tvl";
|
|
46
48
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
47
49
|
}>;
|
|
@@ -81,6 +83,7 @@ declare const chartMetricSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
|
81
83
|
depositApy: "depositApy";
|
|
82
84
|
depositApyAvg7d: "depositApyAvg7d";
|
|
83
85
|
dieselRate: "dieselRate";
|
|
86
|
+
rewardsApyAvg7d: "rewardsApyAvg7d";
|
|
84
87
|
supplied: "supplied";
|
|
85
88
|
utilization: "utilization";
|
|
86
89
|
}>, z.ZodEnum<{
|
|
@@ -91,6 +94,7 @@ declare const chartMetricSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
|
91
94
|
collateralUsdPrice: "collateralUsdPrice";
|
|
92
95
|
liquidationThreshold: "liquidationThreshold";
|
|
93
96
|
quotaRate: "quotaRate";
|
|
97
|
+
rewardsApyAvg7d: "rewardsApyAvg7d";
|
|
94
98
|
tvl: "tvl";
|
|
95
99
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
96
100
|
}>, z.ZodEnum<{
|
|
@@ -119,6 +123,7 @@ declare const chartQuerySchema: z.ZodObject<{
|
|
|
119
123
|
depositApy: "depositApy";
|
|
120
124
|
depositApyAvg7d: "depositApyAvg7d";
|
|
121
125
|
dieselRate: "dieselRate";
|
|
126
|
+
rewardsApyAvg7d: "rewardsApyAvg7d";
|
|
122
127
|
supplied: "supplied";
|
|
123
128
|
utilization: "utilization";
|
|
124
129
|
}>, z.ZodEnum<{
|
|
@@ -129,6 +134,7 @@ declare const chartQuerySchema: z.ZodObject<{
|
|
|
129
134
|
collateralUsdPrice: "collateralUsdPrice";
|
|
130
135
|
liquidationThreshold: "liquidationThreshold";
|
|
131
136
|
quotaRate: "quotaRate";
|
|
137
|
+
rewardsApyAvg7d: "rewardsApyAvg7d";
|
|
132
138
|
tvl: "tvl";
|
|
133
139
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
134
140
|
}>, z.ZodEnum<{
|
|
@@ -194,6 +200,7 @@ declare const chartQueryCodec: z.ZodCodec<z.ZodObject<{
|
|
|
194
200
|
depositApy: "depositApy";
|
|
195
201
|
depositApyAvg7d: "depositApyAvg7d";
|
|
196
202
|
dieselRate: "dieselRate";
|
|
203
|
+
rewardsApyAvg7d: "rewardsApyAvg7d";
|
|
197
204
|
supplied: "supplied";
|
|
198
205
|
utilization: "utilization";
|
|
199
206
|
}>, z.ZodEnum<{
|
|
@@ -204,6 +211,7 @@ declare const chartQueryCodec: z.ZodCodec<z.ZodObject<{
|
|
|
204
211
|
collateralUsdPrice: "collateralUsdPrice";
|
|
205
212
|
liquidationThreshold: "liquidationThreshold";
|
|
206
213
|
quotaRate: "quotaRate";
|
|
214
|
+
rewardsApyAvg7d: "rewardsApyAvg7d";
|
|
207
215
|
tvl: "tvl";
|
|
208
216
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
209
217
|
}>, z.ZodEnum<{
|
|
@@ -31,6 +31,7 @@ declare const tokenRewardsSchema: z.ZodObject<{
|
|
|
31
31
|
}, z.core.$strip>;
|
|
32
32
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
33
33
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
35
|
}, z.core.$strip>;
|
|
35
36
|
/**
|
|
36
37
|
* {@link PointRewards}
|
|
@@ -58,6 +59,7 @@ declare const rewardsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
58
59
|
}, z.core.$strip>;
|
|
59
60
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
60
61
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
63
|
}, z.core.$strip>, z.ZodObject<{
|
|
62
64
|
kind: z.ZodLiteral<"point">;
|
|
63
65
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -84,6 +86,7 @@ declare const apyBreakdownSchema: z.ZodObject<{
|
|
|
84
86
|
}, z.core.$strip>;
|
|
85
87
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
86
88
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
90
|
}, z.core.$strip>, z.ZodObject<{
|
|
88
91
|
kind: z.ZodLiteral<"point">;
|
|
89
92
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -242,6 +245,7 @@ declare const poolOpportunitySchema: z.ZodObject<{
|
|
|
242
245
|
}, z.core.$strip>;
|
|
243
246
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
244
247
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
245
249
|
}, z.core.$strip>, z.ZodObject<{
|
|
246
250
|
kind: z.ZodLiteral<"point">;
|
|
247
251
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -266,6 +270,7 @@ declare const poolOpportunitySchema: z.ZodObject<{
|
|
|
266
270
|
}, z.core.$strip>;
|
|
267
271
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
268
272
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
269
274
|
}, z.core.$strip>, z.ZodObject<{
|
|
270
275
|
kind: z.ZodLiteral<"point">;
|
|
271
276
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -379,6 +384,7 @@ declare const strategyOpportunitySchema: z.ZodObject<{
|
|
|
379
384
|
}, z.core.$strip>;
|
|
380
385
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
381
386
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
387
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
382
388
|
}, z.core.$strip>, z.ZodObject<{
|
|
383
389
|
kind: z.ZodLiteral<"point">;
|
|
384
390
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -403,6 +409,7 @@ declare const strategyOpportunitySchema: z.ZodObject<{
|
|
|
403
409
|
}, z.core.$strip>;
|
|
404
410
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
405
411
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
412
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
406
413
|
}, z.core.$strip>, z.ZodObject<{
|
|
407
414
|
kind: z.ZodLiteral<"point">;
|
|
408
415
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -514,6 +521,7 @@ declare const opportunitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
514
521
|
}, z.core.$strip>;
|
|
515
522
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
516
523
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
524
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
517
525
|
}, z.core.$strip>, z.ZodObject<{
|
|
518
526
|
kind: z.ZodLiteral<"point">;
|
|
519
527
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -538,6 +546,7 @@ declare const opportunitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
538
546
|
}, z.core.$strip>;
|
|
539
547
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
540
548
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
549
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
541
550
|
}, z.core.$strip>, z.ZodObject<{
|
|
542
551
|
kind: z.ZodLiteral<"point">;
|
|
543
552
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -647,6 +656,7 @@ declare const opportunitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
647
656
|
}, z.core.$strip>;
|
|
648
657
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
649
658
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
659
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
650
660
|
}, z.core.$strip>, z.ZodObject<{
|
|
651
661
|
kind: z.ZodLiteral<"point">;
|
|
652
662
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -671,6 +681,7 @@ declare const opportunitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
671
681
|
}, z.core.$strip>;
|
|
672
682
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
673
683
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
684
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
674
685
|
}, z.core.$strip>, z.ZodObject<{
|
|
675
686
|
kind: z.ZodLiteral<"point">;
|
|
676
687
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -889,6 +900,7 @@ declare const poolOpportunityDetailSchema: z.ZodObject<{
|
|
|
889
900
|
}, z.core.$strip>;
|
|
890
901
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
891
902
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
903
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
892
904
|
}, z.core.$strip>, z.ZodObject<{
|
|
893
905
|
kind: z.ZodLiteral<"point">;
|
|
894
906
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -913,6 +925,7 @@ declare const poolOpportunityDetailSchema: z.ZodObject<{
|
|
|
913
925
|
}, z.core.$strip>;
|
|
914
926
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
915
927
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
928
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
916
929
|
}, z.core.$strip>, z.ZodObject<{
|
|
917
930
|
kind: z.ZodLiteral<"point">;
|
|
918
931
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -1034,6 +1047,7 @@ declare const strategyOpportunityDetailSchema: z.ZodObject<{
|
|
|
1034
1047
|
}, z.core.$strip>;
|
|
1035
1048
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
1036
1049
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
1050
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1037
1051
|
}, z.core.$strip>, z.ZodObject<{
|
|
1038
1052
|
kind: z.ZodLiteral<"point">;
|
|
1039
1053
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -1058,6 +1072,7 @@ declare const strategyOpportunityDetailSchema: z.ZodObject<{
|
|
|
1058
1072
|
}, z.core.$strip>;
|
|
1059
1073
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
1060
1074
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
1075
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1061
1076
|
}, z.core.$strip>, z.ZodObject<{
|
|
1062
1077
|
kind: z.ZodLiteral<"point">;
|
|
1063
1078
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -1209,6 +1224,7 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1209
1224
|
}, z.core.$strip>;
|
|
1210
1225
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
1211
1226
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
1227
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1212
1228
|
}, z.core.$strip>, z.ZodObject<{
|
|
1213
1229
|
kind: z.ZodLiteral<"point">;
|
|
1214
1230
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -1233,6 +1249,7 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1233
1249
|
}, z.core.$strip>;
|
|
1234
1250
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
1235
1251
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
1252
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1236
1253
|
}, z.core.$strip>, z.ZodObject<{
|
|
1237
1254
|
kind: z.ZodLiteral<"point">;
|
|
1238
1255
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -1350,6 +1367,7 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1350
1367
|
}, z.core.$strip>;
|
|
1351
1368
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
1352
1369
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
1370
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1353
1371
|
}, z.core.$strip>, z.ZodObject<{
|
|
1354
1372
|
kind: z.ZodLiteral<"point">;
|
|
1355
1373
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -1374,6 +1392,7 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1374
1392
|
}, z.core.$strip>;
|
|
1375
1393
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
1376
1394
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
1395
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1377
1396
|
}, z.core.$strip>, z.ZodObject<{
|
|
1378
1397
|
kind: z.ZodLiteral<"point">;
|
|
1379
1398
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -207,6 +207,7 @@ declare const poolPositionSchema: z.ZodObject<{
|
|
|
207
207
|
}, z.core.$strip>;
|
|
208
208
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
209
209
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
210
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
210
211
|
}, z.core.$strip>, z.ZodObject<{
|
|
211
212
|
kind: z.ZodLiteral<"point">;
|
|
212
213
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -231,6 +232,7 @@ declare const poolPositionSchema: z.ZodObject<{
|
|
|
231
232
|
}, z.core.$strip>;
|
|
232
233
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
233
234
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
235
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
234
236
|
}, z.core.$strip>, z.ZodObject<{
|
|
235
237
|
kind: z.ZodLiteral<"point">;
|
|
236
238
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -365,6 +367,7 @@ declare const strategyPositionSchema: z.ZodObject<{
|
|
|
365
367
|
}, z.core.$strip>;
|
|
366
368
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
367
369
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
370
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
368
371
|
}, z.core.$strip>, z.ZodObject<{
|
|
369
372
|
kind: z.ZodLiteral<"point">;
|
|
370
373
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -389,6 +392,7 @@ declare const strategyPositionSchema: z.ZodObject<{
|
|
|
389
392
|
}, z.core.$strip>;
|
|
390
393
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
391
394
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
395
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
392
396
|
}, z.core.$strip>, z.ZodObject<{
|
|
393
397
|
kind: z.ZodLiteral<"point">;
|
|
394
398
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -591,6 +595,7 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
591
595
|
}, z.core.$strip>;
|
|
592
596
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
593
597
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
598
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
594
599
|
}, z.core.$strip>, z.ZodObject<{
|
|
595
600
|
kind: z.ZodLiteral<"point">;
|
|
596
601
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -615,6 +620,7 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
615
620
|
}, z.core.$strip>;
|
|
616
621
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
617
622
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
623
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
618
624
|
}, z.core.$strip>, z.ZodObject<{
|
|
619
625
|
kind: z.ZodLiteral<"point">;
|
|
620
626
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -712,6 +718,7 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
712
718
|
}, z.core.$strip>;
|
|
713
719
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
714
720
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
721
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
715
722
|
}, z.core.$strip>, z.ZodObject<{
|
|
716
723
|
kind: z.ZodLiteral<"point">;
|
|
717
724
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -736,6 +743,7 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
736
743
|
}, z.core.$strip>;
|
|
737
744
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
738
745
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
746
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
739
747
|
}, z.core.$strip>, z.ZodObject<{
|
|
740
748
|
kind: z.ZodLiteral<"point">;
|
|
741
749
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -1011,6 +1019,7 @@ declare const positionsTotalsSchema: z.ZodObject<{
|
|
|
1011
1019
|
}, z.core.$strip>;
|
|
1012
1020
|
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
1013
1021
|
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
1022
|
+
links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1014
1023
|
}, z.core.$strip>, z.ZodObject<{
|
|
1015
1024
|
kind: z.ZodLiteral<"point">;
|
|
1016
1025
|
points: z.ZodArray<z.ZodObject<{
|
|
@@ -29,9 +29,9 @@ interface MaxBorrowProps {
|
|
|
29
29
|
* Collateral is valued the way the transaction will be judged — at safe
|
|
30
30
|
* prices, under its liquidation threshold, capped by the quota the borrow
|
|
31
31
|
* buys for it, all of which is {@link collateralValuation}'s business. The ceiling
|
|
32
|
-
* is then held to what the market will actually lend
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* is then held to what the market will actually lend,
|
|
33
|
+
* {@link CreditSuite.maxBorrowAmount}: the pool's free liquidity, the
|
|
34
|
+
* manager's own allowance and the facade's `maxDebt`, whichever binds first.
|
|
35
35
|
*
|
|
36
36
|
* The facade's `minDebt` is not applied to the collateral's own ceiling. It
|
|
37
37
|
* is a floor, and a ceiling answered as `0n` because the collateral is too
|
|
@@ -40,8 +40,8 @@ interface MaxBorrowProps {
|
|
|
40
40
|
* that carries something therefore answers with it, whether or not the market
|
|
41
41
|
* would lend that little; a loan under the floor is refused by `borrow`
|
|
42
42
|
* itself, with `debtOutOfRange` naming both ends. A market whose own capacity
|
|
43
|
-
* is under `minDebt` is different:
|
|
44
|
-
*
|
|
43
|
+
* is under `minDebt` is different: the answer is `0n`, because no loan of any
|
|
44
|
+
* size exists there.
|
|
45
45
|
*
|
|
46
46
|
* Nothing is fetched or simulated — the account does not exist yet and every
|
|
47
47
|
* input is loaded market state, so a form can call this on each keystroke.
|