@gearbox-protocol/sdk 17.13.0-next.2 → 17.13.0-next.4
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/errors/index.js +3 -0
- package/dist/cjs/model/errors/operation-errors.js +27 -0
- package/dist/cjs/model/index.js +3 -0
- package/dist/cjs/onchain/accounts/intents/index.js +1 -0
- package/dist/cjs/onchain/accounts/intents/operations.js +1 -1
- package/dist/cjs/onchain/accounts/intents/plan.js +21 -0
- package/dist/cjs/onchain/accounts/intents/realize.js +29 -7
- package/dist/cjs/onchain/accounts/intents/resolveQuotaUpdate.js +149 -0
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -0
- package/dist/cjs/onchain/accounts/intents/tests/update-quota.fixtures.js +102 -0
- package/dist/cjs/onchain/accounts/intents/utils/index.js +1 -0
- package/dist/cjs/onchain/accounts/intents/utils/quotas-for-update.js +28 -10
- package/dist/cjs/onchain/constants/index.js +1 -0
- package/dist/cjs/onchain/constants/math.js +6 -0
- package/dist/cjs/onchain/index.js +9 -0
- package/dist/cjs/onchain/positions/calcHealthFactor.js +1 -1
- package/dist/cjs/onchain/preview/preview/CreditAccountState.js +4 -2
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +2 -0
- package/dist/cjs/onchain/validation/bundles/checkQuotaUpdates.js +45 -0
- package/dist/cjs/onchain/validation/bundles/index.js +2 -0
- package/dist/cjs/onchain/validation/checks/checkMaxQuota.js +18 -0
- package/dist/cjs/onchain/validation/checks/checkQuotaActive.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkQuotaChange.js +18 -0
- package/dist/cjs/onchain/validation/checks/index.js +6 -0
- package/dist/cjs/onchain/validation/index.js +8 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +67 -0
- package/dist/esm/model/errors/index.js +2 -2
- package/dist/esm/model/errors/operation-errors.js +25 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/onchain/accounts/intents/index.js +2 -1
- package/dist/esm/onchain/accounts/intents/operations.js +1 -1
- package/dist/esm/onchain/accounts/intents/plan.js +22 -2
- package/dist/esm/onchain/accounts/intents/realize.js +29 -7
- package/dist/esm/onchain/accounts/intents/resolveQuotaUpdate.js +148 -0
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -0
- package/dist/esm/onchain/accounts/intents/tests/update-quota.fixtures.js +92 -0
- package/dist/esm/onchain/accounts/intents/utils/index.js +2 -2
- package/dist/esm/onchain/accounts/intents/utils/quotas-for-update.js +28 -11
- package/dist/esm/onchain/constants/index.js +2 -2
- package/dist/esm/onchain/constants/math.js +6 -1
- package/dist/esm/onchain/index.js +6 -2
- package/dist/esm/onchain/positions/calcHealthFactor.js +1 -1
- package/dist/esm/onchain/preview/preview/CreditAccountState.js +4 -2
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +2 -0
- package/dist/esm/onchain/validation/bundles/checkQuotaUpdates.js +44 -0
- package/dist/esm/onchain/validation/bundles/index.js +2 -1
- package/dist/esm/onchain/validation/checks/checkMaxQuota.js +17 -0
- package/dist/esm/onchain/validation/checks/checkQuotaActive.js +9 -0
- package/dist/esm/onchain/validation/checks/checkQuotaChange.js +17 -0
- package/dist/esm/onchain/validation/checks/index.js +4 -1
- package/dist/esm/onchain/validation/index.js +5 -1
- package/dist/esm/sdk/prepare/PrepareApi.js +67 -0
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +39 -1
- package/dist/types/model/index.d.ts +2 -2
- package/dist/types/onchain/accounts/index.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/index.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/operations.d.ts +9 -3
- package/dist/types/onchain/accounts/intents/plan.d.ts +19 -2
- package/dist/types/onchain/accounts/intents/resolveQuotaUpdate.d.ts +39 -0
- package/dist/types/onchain/accounts/intents/tests/update-quota.fixtures.d.ts +49 -0
- package/dist/types/onchain/accounts/intents/types.d.ts +19 -2
- package/dist/types/onchain/accounts/intents/utils/index.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/utils/quotas-for-update.d.ts +23 -5
- package/dist/types/onchain/constants/index.d.ts +2 -2
- package/dist/types/onchain/constants/math.d.ts +6 -1
- package/dist/types/onchain/index.d.ts +7 -3
- package/dist/types/onchain/preview/preview/CreditAccountState.d.ts +2 -1
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/checkQuotaUpdates.d.ts +16 -0
- package/dist/types/onchain/validation/bundles/index.d.ts +2 -1
- package/dist/types/onchain/validation/checks/checkMaxQuota.d.ts +16 -0
- package/dist/types/onchain/validation/checks/checkQuotaActive.d.ts +13 -0
- package/dist/types/onchain/validation/checks/checkQuotaChange.d.ts +17 -0
- package/dist/types/onchain/validation/checks/index.d.ts +4 -1
- package/dist/types/onchain/validation/index.d.ts +5 -1
- package/dist/types/onchain/validation/raise.d.ts +2 -2
- package/dist/types/sdk/execute/types.d.ts +1 -1
- package/dist/types/sdk/index.d.ts +2 -2
- package/dist/types/sdk/prepare/PrepareApi.d.ts +11 -3
- package/dist/types/sdk/prepare/index.d.ts +2 -2
- package/dist/types/sdk/prepare/types.d.ts +42 -3
- package/package.json +1 -1
|
@@ -12,9 +12,12 @@ import { checkForbiddenToken } from "./checks/checkForbiddenToken.js";
|
|
|
12
12
|
import { checkLeverage } from "./checks/checkLeverage.js";
|
|
13
13
|
import { checkLiquidatorEligible } from "./checks/checkLiquidatorEligible.js";
|
|
14
14
|
import { checkMarketExpired } from "./checks/checkMarketExpired.js";
|
|
15
|
+
import { checkMaxQuota } from "./checks/checkMaxQuota.js";
|
|
15
16
|
import { checkPoolLiquidity } from "./checks/checkPoolLiquidity.js";
|
|
16
17
|
import { checkPoolPaused } from "./checks/checkPoolPaused.js";
|
|
17
18
|
import { checkPoolSunset } from "./checks/checkPoolSunset.js";
|
|
19
|
+
import { checkQuotaActive } from "./checks/checkQuotaActive.js";
|
|
20
|
+
import { checkQuotaChange } from "./checks/checkQuotaChange.js";
|
|
18
21
|
import { checkQuotaCount } from "./checks/checkQuotaCount.js";
|
|
19
22
|
import { checkQuotaLimit } from "./checks/checkQuotaLimit.js";
|
|
20
23
|
import { checkReservePriceLimited } from "./checks/checkReservePriceLimited.js";
|
|
@@ -28,6 +31,7 @@ import { checkIncreaseDebt } from "./bundles/checkIncreaseDebt.js";
|
|
|
28
31
|
import { checkIncreaseQuota } from "./bundles/checkIncreaseQuota.js";
|
|
29
32
|
import { checkMarket } from "./bundles/checkMarket.js";
|
|
30
33
|
import { checkObtained } from "./bundles/checkObtained.js";
|
|
34
|
+
import { checkQuotaUpdates } from "./bundles/checkQuotaUpdates.js";
|
|
31
35
|
import { checkMidasAccountGreenlist } from "./bundles/checkMidasAccountGreenlist.js";
|
|
32
36
|
import { checkRWAOpenRequirements } from "./bundles/checkRWAOpenRequirements.js";
|
|
33
37
|
import { checkRWAOpening } from "./bundles/checkRWAOpening.js";
|
|
@@ -42,4 +46,4 @@ import { checkLiquidation } from "./checkLiquidation.js";
|
|
|
42
46
|
import { checkOperation } from "./checkOperation.js";
|
|
43
47
|
import { checkSimulation } from "./checkSimulation.js";
|
|
44
48
|
import { raise } from "./raise.js";
|
|
45
|
-
export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
|
|
49
|
+
export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMaxQuota, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { PERCENTAGE_FACTOR } from "../../onchain/constants/math.js";
|
|
1
2
|
import { hexEq } from "../../onchain/utils/hex.js";
|
|
2
3
|
import { MultichainConstruct } from "../../onchain/base/MultichainConstruct.js";
|
|
4
|
+
import "../../onchain/market/math.js";
|
|
3
5
|
import { creditAccountNotEmpty, creditAccountNotFound, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedTokenPair } from "../../model/errors/prepare-errors.js";
|
|
4
6
|
import { sdkErr, sdkOk } from "../../model/result.js";
|
|
5
7
|
import "../../model/index.js";
|
|
6
8
|
import { toToken } from "../../onchain/validation/helpers/token.js";
|
|
7
9
|
import { checkPoolOperation } from "../../onchain/validation/bundles/checkPoolOperation.js";
|
|
10
|
+
import { IntentPreviewError } from "../../onchain/validation/raise.js";
|
|
11
|
+
import { isPhantomToken } from "../../onchain/accounts/intents/utils/pick-token.js";
|
|
8
12
|
import { toCreditAccountSlice } from "../../onchain/accounts/intents/utils/credit-account-slice.js";
|
|
13
|
+
import { resolveQuotaUpdate } from "../../onchain/accounts/intents/resolveQuotaUpdate.js";
|
|
9
14
|
import { CreditAccountOperationsService } from "../../onchain/accounts/intents/index.js";
|
|
10
15
|
import "../../onchain/index.js";
|
|
11
16
|
import { withdrawableCollaterals } from "./withdrawable-collaterals.js";
|
|
@@ -371,6 +376,16 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
371
376
|
});
|
|
372
377
|
}
|
|
373
378
|
/**
|
|
379
|
+
* {@inheritDoc IOpportunitiesPrepare.updateQuota}
|
|
380
|
+
**/
|
|
381
|
+
async updateQuota(position, params) {
|
|
382
|
+
return this.#startIntent(position, params, {
|
|
383
|
+
type: "UPDATE_QUOTA",
|
|
384
|
+
token: params.token,
|
|
385
|
+
quota: params.quota
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
374
389
|
* {@inheritDoc IOpportunitiesPrepare.leverageBand}
|
|
375
390
|
**/
|
|
376
391
|
leverageBand(strategy, collateral, targetHF, position) {
|
|
@@ -483,6 +498,58 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
483
498
|
return refused(unexpectedFailure(e), state);
|
|
484
499
|
}
|
|
485
500
|
}
|
|
501
|
+
/** {@inheritDoc IOpportunitiesPrepare.getQuotaBufferState} */
|
|
502
|
+
getQuotaBufferState(position, extraQuotas = []) {
|
|
503
|
+
const sdk = [...this.sdk.chains.values()].find((chain) => chain.chainId === position.chainId);
|
|
504
|
+
if (!sdk) return void 0;
|
|
505
|
+
if (position.kind !== "strategy" || position.chainId !== sdk.chainId || !position.targetCollateral || position.error || position.totalDebt.value <= 0n) return void 0;
|
|
506
|
+
const target = position.targetCollateral;
|
|
507
|
+
if (isPhantomToken(sdk, target.address)) return void 0;
|
|
508
|
+
const suite = sdk.marketRegister.creditManagers.find((s) => s.creditManager.address.toLowerCase() === position.creditManager.toLowerCase());
|
|
509
|
+
if (!suite) return void 0;
|
|
510
|
+
const collateral = position.collaterals.find((c) => c.collateral.token.address.toLowerCase() === target.address.toLowerCase());
|
|
511
|
+
if (!collateral || collateral.collateral.value <= 0n || collateral.quota.value <= 0n) return void 0;
|
|
512
|
+
const lt = BigInt(suite.creditManager.liquidationThresholds.get(target.address) ?? 0);
|
|
513
|
+
if (lt <= 0n) return void 0;
|
|
514
|
+
const value = suite.market.priceOracle.safeConvert(target.address, suite.market.pool.underlying, collateral.collateral.value);
|
|
515
|
+
if (value.error) return void 0;
|
|
516
|
+
const tokens = position.collaterals.map((c) => ({
|
|
517
|
+
token: c.collateral.token.address,
|
|
518
|
+
balance: c.collateral.value,
|
|
519
|
+
quota: c.quota.value
|
|
520
|
+
}));
|
|
521
|
+
tokens.push(...extraQuotas.map(({ token, quota }) => ({
|
|
522
|
+
token,
|
|
523
|
+
quota,
|
|
524
|
+
balance: 0n
|
|
525
|
+
})));
|
|
526
|
+
try {
|
|
527
|
+
const { update } = resolveQuotaUpdate({
|
|
528
|
+
sdk,
|
|
529
|
+
creditAccount: {
|
|
530
|
+
creditManager: position.creditManager,
|
|
531
|
+
tokens
|
|
532
|
+
},
|
|
533
|
+
token: target.address,
|
|
534
|
+
quota: void 0,
|
|
535
|
+
quotaReserve: 500
|
|
536
|
+
});
|
|
537
|
+
const quotaIncrease = update.quotaIncrease.find((q) => q.token.toLowerCase() === target.address.toLowerCase())?.balance ?? 0n;
|
|
538
|
+
if (quotaIncrease <= 0n) return void 0;
|
|
539
|
+
return {
|
|
540
|
+
position: {
|
|
541
|
+
...position,
|
|
542
|
+
targetCollateral: target
|
|
543
|
+
},
|
|
544
|
+
baseQuota: value.value * lt / PERCENTAGE_FACTOR,
|
|
545
|
+
currentQuota: collateral.quota.value,
|
|
546
|
+
quotaIncrease
|
|
547
|
+
};
|
|
548
|
+
} catch (error) {
|
|
549
|
+
if (error instanceof IntentPreviewError) return void 0;
|
|
550
|
+
throw error;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
486
553
|
};
|
|
487
554
|
function service(sdk) {
|
|
488
555
|
return new CreditAccountOperationsService(sdk);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IGearboxError } from "./base.js";
|
|
2
2
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./liquidation-errors.js";
|
|
3
|
-
import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaInputLimits, QuotaLimitReachedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet } from "./operation-errors.js";
|
|
3
|
+
import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./operation-errors.js";
|
|
4
4
|
import { UnpriceableTokenError, unpriceableTokenError } from "./oracle-errors.js";
|
|
5
5
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./prepare-errors.js";
|
|
6
6
|
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./preview-errors.js";
|
|
7
|
-
export { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageLimits, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, OperationLimitOptions, PoolOperationPreviewError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaInputLimits, QuotaLimitReachedError, RWAOpenRequirementsError, ReservePriceLimitedError, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, accountNotMidasGreenlisted, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
7
|
+
export { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageLimits, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, OperationLimitOptions, PoolOperationPreviewError, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, accountNotMidasGreenlisted, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
@@ -242,6 +242,44 @@ interface QuotaCountExceededError extends IGearboxError {
|
|
|
242
242
|
}
|
|
243
243
|
/** {@inheritDoc QuotaCountExceededError} */
|
|
244
244
|
declare function quotaCountExceeded(count: number, max: number): QuotaCountExceededError;
|
|
245
|
+
/**
|
|
246
|
+
* The quota keeper charges no rate for this token, so its quota cannot be
|
|
247
|
+
* changed.
|
|
248
|
+
*
|
|
249
|
+
* @remarks Not solvable by changing this operation's parameters.
|
|
250
|
+
**/
|
|
251
|
+
interface QuotaInactiveError extends IGearboxError {
|
|
252
|
+
code: "quotaInactive";
|
|
253
|
+
token: Token;
|
|
254
|
+
}
|
|
255
|
+
/** {@inheritDoc QuotaInactiveError} */
|
|
256
|
+
declare function quotaInactive(token: Token): QuotaInactiveError;
|
|
257
|
+
/**
|
|
258
|
+
* The requested quota rounds to the one the account already has, so there is
|
|
259
|
+
* nothing to send.
|
|
260
|
+
**/
|
|
261
|
+
interface QuotaUnchangedError extends IGearboxError {
|
|
262
|
+
code: "quotaUnchanged";
|
|
263
|
+
token: Token;
|
|
264
|
+
/** Both in the market's underlying. */
|
|
265
|
+
current: TokenAmount;
|
|
266
|
+
requested: TokenAmount;
|
|
267
|
+
}
|
|
268
|
+
/** {@inheritDoc QuotaUnchangedError} */
|
|
269
|
+
declare function quotaUnchanged(args: Omit<QuotaUnchangedError, "code" | "message">): QuotaUnchangedError;
|
|
270
|
+
/**
|
|
271
|
+
* The requested quota exceeds the facade's per-token `maxQuota`
|
|
272
|
+
* (`maxQuotaMultiplier × maxDebt`).
|
|
273
|
+
**/
|
|
274
|
+
interface QuotaAboveMaxError extends IGearboxError {
|
|
275
|
+
code: "quotaAboveMax";
|
|
276
|
+
token: Token;
|
|
277
|
+
/** Both in the market's underlying. */
|
|
278
|
+
requested: TokenAmount;
|
|
279
|
+
maxQuota: TokenAmount;
|
|
280
|
+
}
|
|
281
|
+
/** {@inheritDoc QuotaAboveMaxError} */
|
|
282
|
+
declare function quotaAboveMax(args: Omit<QuotaAboveMaxError, "code" | "message">): QuotaAboveMaxError;
|
|
245
283
|
/**
|
|
246
284
|
* A balance is too small to fund the operation's step.
|
|
247
285
|
*
|
|
@@ -311,4 +349,4 @@ interface AccountNotMidasGreenlistedError extends IGearboxError {
|
|
|
311
349
|
/** {@inheritDoc AccountNotMidasGreenlistedError} */
|
|
312
350
|
declare function accountNotMidasGreenlisted(args: Omit<AccountNotMidasGreenlistedError, "code" | "message">): AccountNotMidasGreenlistedError;
|
|
313
351
|
//#endregion
|
|
314
|
-
export { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaInputLimits, QuotaLimitReachedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet };
|
|
352
|
+
export { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet };
|
|
@@ -6,7 +6,7 @@ import { DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseL
|
|
|
6
6
|
import { IGearboxError } from "./errors/base.js";
|
|
7
7
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./errors/liquidation-errors.js";
|
|
8
8
|
import { KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, MidasOpenAccountRequirements, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./rwa.js";
|
|
9
|
-
import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaInputLimits, QuotaLimitReachedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
9
|
+
import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
10
10
|
import { UnpriceableTokenError, unpriceableTokenError } from "./errors/oracle-errors.js";
|
|
11
11
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
|
|
12
12
|
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./errors/preview-errors.js";
|
|
@@ -34,4 +34,4 @@ import { MerklReward, PointsReward, Reward } from "./rewards.js";
|
|
|
34
34
|
import { kycRequirementSchema, rwaProtocolSchema } from "./rwa.schema.js";
|
|
35
35
|
import { PositionClaimableWithdrawal, PositionPendingWithdrawal, PositionWithdrawals, WithdrawalOutputAmount } from "./withdrawals.js";
|
|
36
36
|
import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
|
|
37
|
-
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountNotMidasGreenlistedError, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CollateralLimits, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageLimits, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MerklReward, MidasOpenAccountRequirements, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, Notice, NoticeKind, NoticeSubject, OpenStrategyPositionPreview, OperationLimitOptions, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsReward, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAsset, QuotaCountExceededError, QuotaInputLimits, QuotaLimitReachedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ReservePriceLimitedError, ResponseMetadata, Reward, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, accountNotMidasGreenlisted, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|
|
37
|
+
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountNotMidasGreenlistedError, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CollateralLimits, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageLimits, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MerklReward, MidasOpenAccountRequirements, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, Notice, NoticeKind, NoticeSubject, OpenStrategyPositionPreview, OperationLimitOptions, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsReward, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAboveMaxError, QuotaAsset, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ReservePriceLimitedError, ResponseMetadata, Reward, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, accountNotMidasGreenlisted, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAboveMax, quotaAssetSchema, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|
|
@@ -27,11 +27,11 @@ import "./bots/index.js";
|
|
|
27
27
|
import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
|
|
28
28
|
import { CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, DIRECT_TRANSFERS_QUOTA, MaxAmountForQuotaProps, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, maxAmountForQuota, roundUpQuota } from "./quota-utils.js";
|
|
29
29
|
import { AccountCalculatorOperation } from "./intents/operations.js";
|
|
30
|
-
import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./intents/types.js";
|
|
30
|
+
import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./intents/types.js";
|
|
31
31
|
import { BorrowProps, BorrowState } from "./intents/borrow.js";
|
|
32
32
|
import { LeverageBand } from "./intents/leverage-band.js";
|
|
33
33
|
import { OpenStrategyProps, OpenStrategyState } from "./intents/open-strategy.js";
|
|
34
34
|
import { fetchCreditAccountSlice, toCreditAccountSlice } from "./intents/utils/credit-account-slice.js";
|
|
35
35
|
import { isPhantomToken } from "./intents/utils/pick-token.js";
|
|
36
36
|
import { BorrowPreviewResult, CreditAccountOperationsService, EmptyAccountPreviewResult, OpenStrategyPreviewResult } from "./intents/index.js";
|
|
37
|
-
export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BorrowPreviewResult, type BorrowProps, type BorrowState, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EmptyAccountPreviewResult, EncodableCreditAccountOperation, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MaxAmountForQuotaProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, OpenStrategyPreviewResult, type OpenStrategyProps, type OpenStrategyState, type OperationState, OptimalPartialLiquidation, OptimalPartialLiquidationProps, PartialLiquidationParams, PartialLiquidationParamsProps, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RefusedIntent, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteErrors, SetBotProps, SetBotResult, type StartIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, isPhantomToken, maxAmountForQuota, optimalPartialLiquidation, partialLiquidationParams, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
37
|
+
export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BorrowPreviewResult, type BorrowProps, type BorrowState, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EmptyAccountPreviewResult, EncodableCreditAccountOperation, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MaxAmountForQuotaProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, OpenStrategyPreviewResult, type OpenStrategyProps, type OpenStrategyState, type OperationState, OptimalPartialLiquidation, OptimalPartialLiquidationProps, PartialLiquidationParams, PartialLiquidationParamsProps, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RefusedIntent, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteErrors, SetBotProps, SetBotResult, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, isPhantomToken, maxAmountForQuota, optimalPartialLiquidation, partialLiquidationParams, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
@@ -3,7 +3,7 @@ import "../../../model/index.js";
|
|
|
3
3
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
4
4
|
import { IntentValidationError } from "../../validation/raise.js";
|
|
5
5
|
import { AccountCalculatorOperation } from "./operations.js";
|
|
6
|
-
import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, StartIntentProps, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./types.js";
|
|
6
|
+
import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, StartIntentProps, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./types.js";
|
|
7
7
|
import { BorrowProps, BorrowState } from "./borrow.js";
|
|
8
8
|
import { LeverageBand, LeverageBandProps } from "./leverage-band.js";
|
|
9
9
|
import { MaxBorrowProps } from "./maxBorrow.js";
|
|
@@ -281,4 +281,4 @@ declare class CreditAccountOperationsService extends SDKConstruct {
|
|
|
281
281
|
borrowIntent(props: BorrowProps): Promise<BorrowPreviewResult>;
|
|
282
282
|
}
|
|
283
283
|
//#endregion
|
|
284
|
-
export { type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, BorrowPreviewResult, type BorrowProps, type BorrowState, type ClaimRemainder, CreditAccountOperationsService, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EmptyAccountPreviewResult, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type LeverageBand, OpenStrategyPreviewResult, type OpenStrategyProps, type OpenStrategyState, type OperationState, type PathLossRate, type RefusedIntent, type RepayStrategyIntent, type ResumableIntent, type RouteErrors, type StartIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, fetchCreditAccountSlice, isPhantomToken, toCreditAccountSlice };
|
|
284
|
+
export { type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, BorrowPreviewResult, type BorrowProps, type BorrowState, type ClaimRemainder, CreditAccountOperationsService, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EmptyAccountPreviewResult, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type LeverageBand, OpenStrategyPreviewResult, type OpenStrategyProps, type OpenStrategyState, type OperationState, type PathLossRate, type RefusedIntent, type RepayStrategyIntent, type ResumableIntent, type RouteErrors, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, fetchCreditAccountSlice, isPhantomToken, toCreditAccountSlice };
|
|
@@ -124,11 +124,17 @@ interface QuotaUpdateOperation {
|
|
|
124
124
|
calls: MultiCall[];
|
|
125
125
|
}
|
|
126
126
|
type QuotaUpdateState = ReturnType<typeof calcQuotaUpdate>;
|
|
127
|
-
|
|
127
|
+
interface QuotaUpdateOperationInput {
|
|
128
128
|
update: QuotaUpdateState;
|
|
129
129
|
creditAccount: CreditAccountSlice;
|
|
130
130
|
sdk: OnchainSDK;
|
|
131
|
-
|
|
131
|
+
/**
|
|
132
|
+
* The quota each token must end at or above, or the call reverts. Defaults
|
|
133
|
+
* to the change itself.
|
|
134
|
+
*/
|
|
135
|
+
minQuota?: Asset[];
|
|
136
|
+
}
|
|
137
|
+
declare function buildQuotaUpdateOperation(input: QuotaUpdateOperationInput): QuotaUpdateOperation;
|
|
132
138
|
interface WrapRwaCollateralOperation {
|
|
133
139
|
type: "wrapRwaCollateral";
|
|
134
140
|
/** Amount of RWA asset wrapped. */
|
|
@@ -214,4 +220,4 @@ declare function instantOutput(outputs: WithdrawalOutput[], token?: Address): {
|
|
|
214
220
|
amount: bigint;
|
|
215
221
|
} | undefined;
|
|
216
222
|
//#endregion
|
|
217
|
-
export { AccountCalculatorOperation, AddCollateralOperation, ClaimDelayedWithdrawalOperation, DecreaseDebtOperation, IncreaseDebtOperation, QuotaUpdateOperation, QuotaUpdateState, RwaLegInput, StartDelayedWithdrawalOperation, SwapOperation, UnwrapRwaCollateralOperation, WithdrawCollateralOperation, WrapRwaCollateralOperation, _EngineOpsAreEncodable, buildAddCollateralOperation, buildClaimDelayedWithdrawalOperation, buildCloseSwapOperation, buildDecreaseDebtOperation, buildIncreaseDebtOperation, buildQuotaUpdateOperation, buildStartDelayedWithdrawalOperation, buildSwapOperation, buildUnwrapRwaCollateralOperation, buildWithdrawCollateralOperation, buildWrapRwaCollateralOperation, instantOutput };
|
|
223
|
+
export { AccountCalculatorOperation, AddCollateralOperation, ClaimDelayedWithdrawalOperation, DecreaseDebtOperation, IncreaseDebtOperation, QuotaUpdateOperation, QuotaUpdateOperationInput, QuotaUpdateState, RwaLegInput, StartDelayedWithdrawalOperation, SwapOperation, UnwrapRwaCollateralOperation, WithdrawCollateralOperation, WrapRwaCollateralOperation, _EngineOpsAreEncodable, buildAddCollateralOperation, buildClaimDelayedWithdrawalOperation, buildCloseSwapOperation, buildDecreaseDebtOperation, buildIncreaseDebtOperation, buildQuotaUpdateOperation, buildStartDelayedWithdrawalOperation, buildSwapOperation, buildUnwrapRwaCollateralOperation, buildWithdrawCollateralOperation, buildWrapRwaCollateralOperation, instantOutput };
|
|
@@ -3,7 +3,7 @@ import { OperationLimitOptions } from "../../../model/errors/operation-errors.js
|
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { ClaimableWithdrawal } from "../withdrawal-compressor/types.js";
|
|
5
5
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
6
|
-
import { AddCollateralIntent, AdjustLeverageIntent, DepositStrategyIntent, RepayStrategyIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
|
|
6
|
+
import { AddCollateralIntent, AdjustLeverageIntent, DepositStrategyIntent, RepayStrategyIntent, UpdateQuotaIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
|
|
7
7
|
import { DebtLimits } from "./math.js";
|
|
8
8
|
import { Address } from "viem";
|
|
9
9
|
//#region src/onchain/accounts/intents/plan.d.ts
|
|
@@ -98,6 +98,16 @@ type Step = {
|
|
|
98
98
|
*/
|
|
99
99
|
{
|
|
100
100
|
kind: "clearQuotas";
|
|
101
|
+
} |
|
|
102
|
+
/**
|
|
103
|
+
* Sets one token's quota, and only that one: the walk's closing quota update
|
|
104
|
+
* is skipped. `quota` is the target in underlying units; `undefined` sizes
|
|
105
|
+
* it to the balance.
|
|
106
|
+
*/
|
|
107
|
+
{
|
|
108
|
+
kind: "updateQuota";
|
|
109
|
+
token: Address;
|
|
110
|
+
quota: bigint | undefined;
|
|
101
111
|
};
|
|
102
112
|
/** What a planner is allowed to know about the account. */
|
|
103
113
|
interface AccountView {
|
|
@@ -139,6 +149,13 @@ declare function planDeposit(intent: Omit<DepositStrategyIntent, "type">, view:
|
|
|
139
149
|
* rather than the amount quoted here.
|
|
140
150
|
*/
|
|
141
151
|
declare function planRepay(intent: Omit<RepayStrategyIntent, "type">, view: AccountView): Step[];
|
|
152
|
+
/**
|
|
153
|
+
* One token's quota changes; no balance moves and debt is untouched.
|
|
154
|
+
*
|
|
155
|
+
* Only a token the account holds can be quoted here, and only on an account
|
|
156
|
+
* that owes something: the facade refuses any quota change at zero debt.
|
|
157
|
+
*/
|
|
158
|
+
declare function planUpdateQuota(intent: Omit<UpdateQuotaIntent, "type">, view: AccountView): Step[];
|
|
142
159
|
/**
|
|
143
160
|
* Intent 2.1: `W` of value leaves, debt shrinks by `D0 · W / C0` so leverage
|
|
144
161
|
* holds. Both are funded by the source `S`.
|
|
@@ -209,4 +226,4 @@ declare function planFinishCloseAccount(intent: {
|
|
|
209
226
|
/** Nothing is owed beyond the claim: the tokens land and quotas catch up. */
|
|
210
227
|
declare function planFinishClaimOnly(claimable: ClaimableWithdrawal): Step[];
|
|
211
228
|
//#endregion
|
|
212
|
-
export { AccountView, Amount, RAISED, Step, planAddCollateral, planAdjustLeverage, planAdjustLeverageDelayed, planDeposit, planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw, planRepay, planWithdraw, planWithdrawAsset, planWithdrawDelayed };
|
|
229
|
+
export { AccountView, Amount, RAISED, Step, planAddCollateral, planAdjustLeverage, planAdjustLeverageDelayed, planDeposit, planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw, planRepay, planUpdateQuota, planWithdraw, planWithdrawAsset, planWithdrawDelayed };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { OperationLimitOptions } from "../../../model/errors/operation-errors.js";
|
|
2
|
+
import "../../../model/index.js";
|
|
3
|
+
import { Asset } from "../../base/types.js";
|
|
4
|
+
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
5
|
+
import { QuotaUpdateState } from "./operations.js";
|
|
6
|
+
import { CreditAccountSlice } from "./types.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/onchain/accounts/intents/resolveQuotaUpdate.d.ts
|
|
9
|
+
interface ResolveQuotaUpdateProps {
|
|
10
|
+
sdk: OnchainSDK;
|
|
11
|
+
creditAccount: Pick<CreditAccountSlice, "creditManager"> & {
|
|
12
|
+
tokens: ReadonlyArray<Pick<CreditAccountSlice["tokens"][number], "token" | "balance" | "quota">>;
|
|
13
|
+
};
|
|
14
|
+
token: Address;
|
|
15
|
+
/** Target in underlying units; `undefined` sizes it to the balance. */
|
|
16
|
+
quota: bigint | undefined;
|
|
17
|
+
quotaReserve: number | undefined;
|
|
18
|
+
limits?: OperationLimitOptions;
|
|
19
|
+
}
|
|
20
|
+
interface ResolvedQuotaUpdate {
|
|
21
|
+
update: QuotaUpdateState;
|
|
22
|
+
/** Passed to the facade as the quota the token must end at or above. */
|
|
23
|
+
minQuota: Asset[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Synchronous calculation from the SDK's loaded market state; no RPC reads.
|
|
27
|
+
* @throws IntentPreviewError when quota validation rejects the change.
|
|
28
|
+
*
|
|
29
|
+
* The single `updateQuota` an `UPDATE_QUOTA` intent sends, checked against
|
|
30
|
+
* what the facade and the quota keeper would revert on.
|
|
31
|
+
*
|
|
32
|
+
* A target is taken as named and refused when the market cannot meet it. A
|
|
33
|
+
* sized quota is held to what the market can give instead: an increase is capped
|
|
34
|
+
* at the pool's available quota, and `minQuota` accepts a partial fill so long as the
|
|
35
|
+
* token stays enabled.
|
|
36
|
+
*/
|
|
37
|
+
declare function resolveQuotaUpdate(props: ResolveQuotaUpdateProps): ResolvedQuotaUpdate;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { ResolveQuotaUpdateProps, ResolvedQuotaUpdate, resolveQuotaUpdate };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { OnchainSDK } from "../../../OnchainSDK.js";
|
|
2
|
+
import { CreditAccountSlice, UpdateQuotaIntent } from "../types.js";
|
|
3
|
+
import "../../../index.js";
|
|
4
|
+
import { ExpectedFlowOp } from "../testing/expect.js";
|
|
5
|
+
import { MarketSdkExtras, caToken } from "../testing/market.js";
|
|
6
|
+
//#region src/onchain/accounts/intents/tests/update-quota.fixtures.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Start update-quota fixtures.
|
|
9
|
+
*
|
|
10
|
+
* The account holds 1000 UND and 2000 ANY (another 1000 UND) against 500 UND of
|
|
11
|
+
* debt. Nothing moves, so every case is a single `changeQuota` and the totals
|
|
12
|
+
* stand still.
|
|
13
|
+
*/
|
|
14
|
+
declare const BASE_UND = 100000000000n;
|
|
15
|
+
declare const BALANCE_ANY = 2000000000000000000000n;
|
|
16
|
+
declare const DEBT = 50000000000n;
|
|
17
|
+
/** What 2000 ANY is sized to: 1000 UND × 92%. */
|
|
18
|
+
declare const SIZED_ANY = 92000000000n;
|
|
19
|
+
declare const TOTAL_VALUE: bigint;
|
|
20
|
+
interface UpdateQuotaCase {
|
|
21
|
+
intent: UpdateQuotaIntent;
|
|
22
|
+
/** ANY's quota before the operation. */
|
|
23
|
+
current: bigint;
|
|
24
|
+
/** Balances besides ANY; the underlying by default. */
|
|
25
|
+
others?: ReturnType<typeof caToken>[];
|
|
26
|
+
totalDebt?: bigint;
|
|
27
|
+
ops: ExpectedFlowOp[];
|
|
28
|
+
/** ANY's quota afterwards. */
|
|
29
|
+
quotaAfter: bigint;
|
|
30
|
+
/** `minQuota` sent to the facade for ANY. */
|
|
31
|
+
minQuota: bigint;
|
|
32
|
+
extras?: MarketSdkExtras;
|
|
33
|
+
}
|
|
34
|
+
/** Omitted quota on an unquoted balance: bought at balance × LT. */
|
|
35
|
+
declare const case_auto_increase: UpdateQuotaCase;
|
|
36
|
+
/** A lower target: the quota drops to exactly it. */
|
|
37
|
+
declare const case_target_decrease: UpdateQuotaCase;
|
|
38
|
+
/** Target 0: the quota is reset with the sentinel. */
|
|
39
|
+
declare const case_target_disable: UpdateQuotaCase;
|
|
40
|
+
declare function buildUpdateQuotaSdk(c: UpdateQuotaCase): OnchainSDK;
|
|
41
|
+
declare function buildUpdateQuotaProps(c: UpdateQuotaCase, sdk: OnchainSDK): {
|
|
42
|
+
intent: UpdateQuotaIntent;
|
|
43
|
+
creditAccount: CreditAccountSlice;
|
|
44
|
+
sdk: OnchainSDK<{}>;
|
|
45
|
+
quotaReserve: undefined;
|
|
46
|
+
slippage: undefined;
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { BALANCE_ANY, BASE_UND, DEBT, SIZED_ANY, TOTAL_VALUE, UpdateQuotaCase, buildUpdateQuotaProps, buildUpdateQuotaSdk, case_auto_increase, case_target_decrease, case_target_disable };
|
|
@@ -284,6 +284,7 @@ type IntentRoutesResult = {
|
|
|
284
284
|
* | `DEPOSIT` | `prepare.depositStrategy` | grows |
|
|
285
285
|
* | `WITHDRAW` | `prepare.withdrawStrategy` | shrinks |
|
|
286
286
|
* | `REPAY` | `prepare.repayStrategy` | shrinks |
|
|
287
|
+
* | `UPDATE_QUOTA` | `prepare.updateQuota` | fixed |
|
|
287
288
|
*/
|
|
288
289
|
/** Shared inputs for every start intent. */
|
|
289
290
|
type StartIntentProps = {
|
|
@@ -479,6 +480,22 @@ interface WithdrawStrategyIntent {
|
|
|
479
480
|
*/
|
|
480
481
|
sourceToken?: Address;
|
|
481
482
|
}
|
|
483
|
+
/**
|
|
484
|
+
* Change the quota of one token the account already holds.
|
|
485
|
+
*
|
|
486
|
+
* No balance moves and debt is untouched; only how much of the token counts
|
|
487
|
+
* as collateral changes, and with it the quota fee the account pays.
|
|
488
|
+
*/
|
|
489
|
+
interface UpdateQuotaIntent {
|
|
490
|
+
type: "UPDATE_QUOTA";
|
|
491
|
+
/** Collateral token on the account, other than the underlying. */
|
|
492
|
+
token: Address;
|
|
493
|
+
/**
|
|
494
|
+
* Target quota in underlying units; 0 disables it. Omit to size it to the
|
|
495
|
+
* balance: its value in underlying × LT, raised by `quotaReserve`.
|
|
496
|
+
*/
|
|
497
|
+
quota?: bigint;
|
|
498
|
+
}
|
|
482
499
|
/**
|
|
483
500
|
* Where a withdraw form's scale ends, in underlying units — and it ends twice.
|
|
484
501
|
*
|
|
@@ -535,7 +552,7 @@ interface WithdrawCeilings {
|
|
|
535
552
|
*/
|
|
536
553
|
exit: bigint;
|
|
537
554
|
}
|
|
538
|
-
type StartIntent = AddCollateralIntent | WithdrawAssetIntent | AdjustLeverageIntent | DepositStrategyIntent | RepayStrategyIntent | WithdrawStrategyIntent;
|
|
555
|
+
type StartIntent = AddCollateralIntent | WithdrawAssetIntent | AdjustLeverageIntent | DepositStrategyIntent | RepayStrategyIntent | WithdrawStrategyIntent | UpdateQuotaIntent;
|
|
539
556
|
/**
|
|
540
557
|
* The intents that can be started as a redemption rather than a swap: the two
|
|
541
558
|
* that sell a position asset. The others buy one, and buying settles at once.
|
|
@@ -559,4 +576,4 @@ type FinishIntentProps = StartIntentProps & {
|
|
|
559
576
|
claimable: ClaimableWithdrawal;
|
|
560
577
|
};
|
|
561
578
|
//#endregion
|
|
562
|
-
export { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, SimulationPrices, StartIntent, StartIntentProps, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent };
|
|
579
|
+
export { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, SimulationPrices, StartIntent, StartIntentProps, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent };
|
|
@@ -7,5 +7,5 @@ import { assembleOperationCalls } from "./assemble-operation-calls.js";
|
|
|
7
7
|
import { calcBorrowedAmountPlusInterestAndFees } from "./borrowed-amount-plus-interest-and-fees.js";
|
|
8
8
|
import { eq, resolveCreditManager, toRouterCaSlice, toTargetDecimals } from "./common.js";
|
|
9
9
|
import { LedgerSnapshot, OperationLedger } from "./ledger.js";
|
|
10
|
-
import { clearedQuotas, getQuotasForUpdate, quotaIncreaseLimit, quotasAfterUpdate, withDirectTransferQuota } from "./quotas-for-update.js";
|
|
11
|
-
export { CandidateToken, LedgerSnapshot, LegProbe, OpenStrategyLeg, OperationLedger, RouterPaths, SwapLeg, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, clearedQuotas, collectPriceImpact, createOraclePaths, createRouterPaths, eq, fetchCreditAccountSlice, getQuotasForUpdate, isPhantomToken, isRedemptionPhantomToken, lossRate, pickFattestNonPhantomToken, quotaIncreaseLimit, quotasAfterUpdate, rankAccountTokens, resolveCreditManager, startProbe, toCreditAccountSlice, toRouterCaSlice, toTargetDecimals, unopenedAccountSlice, withDirectTransferQuota };
|
|
10
|
+
import { ResizedQuotaProps, clearedQuotas, getQuotasForUpdate, quotaIncreaseLimit, quotasAfterUpdate, resizedQuota, withDirectTransferQuota } from "./quotas-for-update.js";
|
|
11
|
+
export { CandidateToken, LedgerSnapshot, LegProbe, OpenStrategyLeg, OperationLedger, ResizedQuotaProps, RouterPaths, SwapLeg, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, clearedQuotas, collectPriceImpact, createOraclePaths, createRouterPaths, eq, fetchCreditAccountSlice, getQuotasForUpdate, isPhantomToken, isRedemptionPhantomToken, lossRate, pickFattestNonPhantomToken, quotaIncreaseLimit, quotasAfterUpdate, rankAccountTokens, resizedQuota, resolveCreditManager, startProbe, toCreditAccountSlice, toRouterCaSlice, toTargetDecimals, unopenedAccountSlice, withDirectTransferQuota };
|
|
@@ -22,9 +22,8 @@ interface Quota {
|
|
|
22
22
|
limit: bigint;
|
|
23
23
|
isActive: boolean;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
assetsAfter: Asset[];
|
|
25
|
+
/** The market inputs every quota sizing reads. */
|
|
26
|
+
interface QuotaSizingProps {
|
|
28
27
|
initialQuotas: Array<InitialQuota> | readonly InitialQuota[];
|
|
29
28
|
quotaReserve: number | undefined;
|
|
30
29
|
underlyingToken: Address;
|
|
@@ -33,6 +32,16 @@ interface GetQuotasForUpdateProps {
|
|
|
33
32
|
maxDebt: bigint;
|
|
34
33
|
convert: ConvertFn;
|
|
35
34
|
}
|
|
35
|
+
interface GetQuotasForUpdateProps extends QuotaSizingProps {
|
|
36
|
+
assetsBefore: Asset[] | readonly Asset[];
|
|
37
|
+
assetsAfter: Asset[];
|
|
38
|
+
}
|
|
39
|
+
interface ResizedQuotaProps extends QuotaSizingProps {
|
|
40
|
+
/** The one token whose quota is sized. */
|
|
41
|
+
token: Address;
|
|
42
|
+
/** What the account holds; `token`'s balance is what the quota is sized to. */
|
|
43
|
+
assets: Asset[] | readonly Asset[];
|
|
44
|
+
}
|
|
36
45
|
interface QuotaIncreaseLimitProps {
|
|
37
46
|
suite: CreditSuite;
|
|
38
47
|
token: Address;
|
|
@@ -41,7 +50,16 @@ interface QuotaIncreaseLimitProps {
|
|
|
41
50
|
quotaReserve?: number;
|
|
42
51
|
rwaAsset?: Address;
|
|
43
52
|
}
|
|
44
|
-
declare function getQuotasForUpdate(
|
|
53
|
+
declare function getQuotasForUpdate(props: GetQuotasForUpdateProps): QuotaUpdateState;
|
|
54
|
+
/**
|
|
55
|
+
* The update that sizes one token's quota to the balance the account holds of
|
|
56
|
+
* it, whatever moved.
|
|
57
|
+
*
|
|
58
|
+
* Sits beside {@link getQuotasForUpdate} because that one only resizes what an
|
|
59
|
+
* operation spent or obtained, and an operation that changes a quota alone
|
|
60
|
+
* moves no balance at all.
|
|
61
|
+
*/
|
|
62
|
+
declare function resizedQuota(props: ResizedQuotaProps): QuotaUpdateState;
|
|
45
63
|
/**
|
|
46
64
|
* The update that leaves the account holding no quota at all.
|
|
47
65
|
*
|
|
@@ -73,4 +91,4 @@ declare function quotasAfterUpdate(initialQuotas: Array<InitialQuota> | readonly
|
|
|
73
91
|
/** Largest additional underlying amount whose purchase fits this token's quota. */
|
|
74
92
|
declare function quotaIncreaseLimit({ suite, token, balance, initialQuotas, quotaReserve, rwaAsset }: QuotaIncreaseLimitProps): SafeValue<bigint | undefined, UnpriceableTokenError>;
|
|
75
93
|
//#endregion
|
|
76
|
-
export { clearedQuotas, getQuotasForUpdate, quotaIncreaseLimit, quotasAfterUpdate, withDirectTransferQuota };
|
|
94
|
+
export { ResizedQuotaProps, clearedQuotas, getQuotasForUpdate, quotaIncreaseLimit, quotasAfterUpdate, resizedQuota, withDirectTransferQuota };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, NO_VERSION } from "./address-provider.js";
|
|
2
2
|
import { ADDRESS_0X0, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED } from "./addresses.js";
|
|
3
3
|
import { BotPermissions, botPermissionsToString } from "./bot-permissions.js";
|
|
4
|
-
import { DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, PRICE_DECIMALS_POW, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, WAD, WAD_DECIMALS_POW, halfRAY, isZeroBalance } from "./math.js";
|
|
4
|
+
import { DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_INT96, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, PRICE_DECIMALS_POW, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, WAD, WAD_DECIMALS_POW, halfRAY, isZeroBalance } from "./math.js";
|
|
5
5
|
import { BLOCKS_PER_WEEK_BY_NETWORK, RAMP_DURATION_BY_NETWORK } from "./networks.js";
|
|
6
6
|
import { PERIPHERY_CONTRACTS, PeripheryContract } from "./periphery.js";
|
|
7
7
|
import { VERSION_RANGE_310, VersionRange, isV310, isVersionRange } from "./versions.js";
|
|
8
|
-
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_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, BLOCKS_PER_WEEK_BY_NETWORK, BotPermissions, DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PRICE_DECIMALS, PRICE_DECIMALS_POW, PeripheryContract, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, VERSION_RANGE_310, VersionRange, WAD, WAD_DECIMALS_POW, botPermissionsToString, halfRAY, isV310, isVersionRange, isZeroBalance };
|
|
8
|
+
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_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, BLOCKS_PER_WEEK_BY_NETWORK, BotPermissions, DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PRICE_DECIMALS, PRICE_DECIMALS_POW, PeripheryContract, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, VERSION_RANGE_310, VersionRange, WAD, WAD_DECIMALS_POW, botPermissionsToString, halfRAY, isV310, isVersionRange, isZeroBalance };
|
|
@@ -16,6 +16,11 @@ declare const PERCENTAGE_FACTOR = 10000n;
|
|
|
16
16
|
declare const PERCENTAGE_FACTOR_1KK: bigint;
|
|
17
17
|
declare const LEVERAGE_DECIMALS = 100n;
|
|
18
18
|
declare const SLIPPAGE_DECIMALS = 100n;
|
|
19
|
+
/**
|
|
20
|
+
* The facade's `maxQuotaMultiplier`: a token's quota may not exceed this many
|
|
21
|
+
* times `maxDebt`. A constant on-chain, so it is not read.
|
|
22
|
+
**/
|
|
23
|
+
declare const MAX_QUOTA_MULTIPLIER = 2n;
|
|
19
24
|
/**
|
|
20
25
|
* Token balances at or below this threshold are treated as dust and ignored.
|
|
21
26
|
**/
|
|
@@ -29,4 +34,4 @@ declare const DUST_THRESHOLD = 10n;
|
|
|
29
34
|
*/
|
|
30
35
|
declare function isZeroBalance(balance: bigint | undefined): boolean;
|
|
31
36
|
//#endregion
|
|
32
|
-
export { DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, PRICE_DECIMALS_POW, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, WAD, WAD_DECIMALS_POW, halfRAY, isZeroBalance };
|
|
37
|
+
export { DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_INT96, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, PRICE_DECIMALS_POW, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, WAD, WAD_DECIMALS_POW, halfRAY, isZeroBalance };
|