@gearbox-protocol/sdk 18.4.0 → 18.4.1-aave.10
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/abi/rwa/iSecuritizeRWAFactory.js +15 -0
- package/dist/cjs/model/errors/index.js +1 -0
- package/dist/cjs/model/errors/operation-errors.js +9 -0
- package/dist/cjs/model/index.js +2 -4
- package/dist/cjs/offchain/GearboxAPI.js +0 -7
- package/dist/cjs/offchain/index.js +0 -3
- package/dist/cjs/onchain/accounts/bots/AccountBotsService.js +29 -0
- package/dist/cjs/onchain/accounts/bots/PeripheryCompressorV310Contract.js +2 -1
- package/dist/cjs/onchain/accounts/index.js +1 -1
- package/dist/cjs/onchain/accounts/intents/index.js +33 -0
- package/dist/cjs/onchain/accounts/intents/operations.js +21 -0
- package/dist/cjs/onchain/accounts/intents/plan.js +55 -0
- package/dist/cjs/onchain/accounts/intents/readAaveHoldings.js +56 -0
- package/dist/cjs/onchain/accounts/intents/realize.js +84 -2
- package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -0
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +3 -2
- package/dist/cjs/onchain/accounts/intents/utils/ledger.js +8 -0
- package/dist/cjs/onchain/chain/chains.js +4 -0
- package/dist/cjs/onchain/index.js +25 -1
- package/dist/cjs/onchain/market/ZapperRegister.js +1 -1
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +94 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveOracle.js +20 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +278 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +11 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iVariableDebtToken.js +17 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/index.js +11 -0
- package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +224 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +177 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/index.js +4 -0
- package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -0
- package/dist/cjs/onchain/market/adapters/abi/index.js +17 -0
- package/dist/cjs/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.js +15 -0
- package/dist/cjs/onchain/market/adapters/abi/securitize/index.js +2 -0
- package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +218 -0
- package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +213 -0
- package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
- package/dist/cjs/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +42 -5
- package/dist/cjs/onchain/market/adapters/contracts/index.js +4 -0
- package/dist/cjs/onchain/market/adapters/createAdapter.js +4 -0
- package/dist/cjs/onchain/market/adapters/index.js +20 -0
- package/dist/cjs/onchain/market/adapters/types.js +2 -0
- package/dist/cjs/onchain/market/index.js +20 -0
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
- package/dist/cjs/onchain/positions/MultichainPositionsService.js +15 -0
- package/dist/cjs/onchain/positions/PositionsService.js +31 -0
- package/dist/cjs/onchain/positions/aaveMoveCalls.js +45 -0
- package/dist/cjs/onchain/positions/projectAavePosition.js +178 -0
- package/dist/cjs/onchain/positions/readAavePosition.js +152 -0
- package/dist/cjs/onchain/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/aaveBridgeBorrows.js +24 -0
- package/dist/cjs/onchain/preview/preview/aaveMoveStart.js +27 -0
- package/dist/cjs/onchain/preview/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/loadAdapterReplayState.js +17 -0
- package/dist/cjs/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
- package/dist/cjs/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +5 -2
- package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +4 -1
- package/dist/cjs/onchain/preview/preview/previewOperation.js +33 -8
- package/dist/cjs/onchain/validation/bundles/checkAaveDelegation.js +54 -0
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +36 -11
- package/dist/cjs/onchain/validation/bundles/index.js +2 -0
- package/dist/cjs/onchain/validation/checkOperation.js +16 -4
- package/dist/cjs/onchain/validation/index.js +2 -0
- package/dist/cjs/sdk/GearboxSDK.js +0 -9
- package/dist/cjs/sdk/execute/ExecuteApi.js +1 -0
- package/dist/cjs/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +98 -0
- package/dist/cjs/sdk/preview/PreviewNamespace.js +42 -0
- package/dist/esm/abi/rwa/iSecuritizeRWAFactory.js +15 -0
- package/dist/esm/model/errors/index.js +2 -2
- package/dist/esm/model/errors/operation-errors.js +9 -1
- package/dist/esm/model/index.js +3 -4
- package/dist/esm/offchain/GearboxAPI.js +0 -7
- package/dist/esm/offchain/index.js +1 -3
- package/dist/esm/onchain/accounts/bots/AccountBotsService.js +29 -0
- package/dist/esm/onchain/accounts/bots/PeripheryCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/index.js +1 -1
- package/dist/esm/onchain/accounts/intents/index.js +34 -1
- package/dist/esm/onchain/accounts/intents/operations.js +20 -1
- package/dist/esm/onchain/accounts/intents/plan.js +56 -2
- package/dist/esm/onchain/accounts/intents/readAaveHoldings.js +55 -0
- package/dist/esm/onchain/accounts/intents/realize.js +86 -4
- package/dist/esm/onchain/accounts/intents/testing/market.js +1 -0
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +3 -2
- package/dist/esm/onchain/accounts/intents/utils/ledger.js +8 -0
- package/dist/esm/onchain/chain/chains.js +4 -0
- package/dist/esm/onchain/index.js +14 -2
- package/dist/esm/onchain/market/ZapperRegister.js +1 -1
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +93 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveOracle.js +19 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +277 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +10 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iVariableDebtToken.js +16 -0
- package/dist/esm/onchain/market/adapters/abi/aave/index.js +6 -0
- package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +223 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +176 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/index.js +3 -1
- package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -0
- package/dist/esm/onchain/market/adapters/abi/index.js +10 -1
- package/dist/esm/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.js +14 -0
- package/dist/esm/onchain/market/adapters/abi/securitize/index.js +2 -1
- package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +217 -0
- package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +212 -0
- package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
- package/dist/esm/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +43 -6
- package/dist/esm/onchain/market/adapters/contracts/index.js +3 -1
- package/dist/esm/onchain/market/adapters/createAdapter.js +4 -0
- package/dist/esm/onchain/market/adapters/index.js +11 -1
- package/dist/esm/onchain/market/adapters/types.js +2 -0
- package/dist/esm/onchain/market/index.js +11 -1
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
- package/dist/esm/onchain/positions/MultichainPositionsService.js +15 -0
- package/dist/esm/onchain/positions/PositionsService.js +31 -0
- package/dist/esm/onchain/positions/aaveMoveCalls.js +44 -0
- package/dist/esm/onchain/positions/projectAavePosition.js +177 -0
- package/dist/esm/onchain/positions/readAavePosition.js +151 -0
- package/dist/esm/onchain/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/aaveBridgeBorrows.js +23 -0
- package/dist/esm/onchain/preview/preview/aaveMoveStart.js +26 -0
- package/dist/esm/onchain/preview/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/loadAdapterReplayState.js +16 -0
- package/dist/esm/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
- package/dist/esm/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +5 -2
- package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +4 -1
- package/dist/esm/onchain/preview/preview/previewOperation.js +33 -8
- package/dist/esm/onchain/validation/bundles/checkAaveDelegation.js +53 -0
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +36 -11
- package/dist/esm/onchain/validation/bundles/index.js +2 -1
- package/dist/esm/onchain/validation/checkOperation.js +16 -4
- package/dist/esm/onchain/validation/index.js +2 -1
- package/dist/esm/sdk/GearboxSDK.js +0 -9
- package/dist/esm/sdk/execute/ExecuteApi.js +1 -0
- package/dist/esm/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/esm/sdk/prepare/PrepareApi.js +99 -1
- package/dist/esm/sdk/preview/PreviewNamespace.js +42 -0
- package/dist/types/abi/rwa/iSecuritizeRWAFactory.d.ts +14 -0
- package/dist/types/model/aave.d.ts +89 -0
- package/dist/types/model/analytics.d.ts +2 -2
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +19 -0
- package/dist/types/model/index.d.ts +6 -7
- package/dist/types/model/positions.d.ts +1 -1
- package/dist/types/model/previews.d.ts +31 -0
- package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
- package/dist/types/offchain/GearboxAPI.d.ts +0 -6
- package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +1 -1
- package/dist/types/offchain/analytics/types.d.ts +1 -1
- package/dist/types/offchain/index.d.ts +1 -3
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -1
- package/dist/types/offchain/opportunities/types.d.ts +1 -1
- package/dist/types/offchain/positions/OffchainPositions.d.ts +1 -1
- package/dist/types/offchain/positions/types.d.ts +1 -1
- package/dist/types/onchain/accounts/bots/AccountBotsService.d.ts +11 -1
- package/dist/types/onchain/accounts/bots/index.d.ts +2 -2
- package/dist/types/onchain/accounts/bots/types.d.ts +7 -1
- package/dist/types/onchain/accounts/index.d.ts +3 -3
- package/dist/types/onchain/accounts/intents/index.d.ts +21 -3
- package/dist/types/onchain/accounts/intents/operations.d.ts +41 -1
- package/dist/types/onchain/accounts/intents/plan.d.ts +32 -3
- package/dist/types/onchain/accounts/intents/readAaveHoldings.d.ts +16 -0
- package/dist/types/onchain/accounts/intents/testing/market.d.ts +4 -0
- package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +4 -0
- package/dist/types/onchain/accounts/intents/types.d.ts +42 -0
- package/dist/types/onchain/index.d.ts +16 -4
- package/dist/types/onchain/market/adapters/abi/aave/iAaveHorizonBridge.d.ts +83 -0
- package/dist/types/onchain/market/adapters/abi/aave/iAaveOracle.d.ts +22 -0
- package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +229 -0
- package/dist/types/onchain/market/adapters/abi/aave/iPoolAddressesProvider.d.ts +11 -0
- package/dist/types/onchain/market/adapters/abi/aave/iVariableDebtToken.d.ts +17 -0
- package/dist/types/onchain/market/adapters/abi/aave/index.d.ts +6 -0
- package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +207 -0
- package/dist/types/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.d.ts +172 -0
- package/dist/types/onchain/market/adapters/abi/adapters/index.d.ts +3 -1
- package/dist/types/onchain/market/adapters/abi/index.d.ts +10 -1
- package/dist/types/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.d.ts +13 -0
- package/dist/types/onchain/market/adapters/abi/securitize/index.d.ts +2 -1
- package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +361 -0
- package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +455 -0
- package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +8 -0
- package/dist/types/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +19 -4
- package/dist/types/onchain/market/adapters/contracts/index.d.ts +3 -1
- package/dist/types/onchain/market/adapters/index.d.ts +11 -1
- package/dist/types/onchain/market/adapters/types.d.ts +3 -1
- package/dist/types/onchain/market/index.d.ts +11 -1
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +20 -0
- package/dist/types/onchain/market/rwa/types.d.ts +6 -0
- package/dist/types/onchain/positions/MultichainPositionsService.d.ts +7 -1
- package/dist/types/onchain/positions/PositionsService.d.ts +16 -2
- package/dist/types/onchain/positions/aaveMoveCalls.d.ts +30 -0
- package/dist/types/onchain/positions/index.d.ts +2 -2
- package/dist/types/onchain/positions/projectAavePosition.d.ts +46 -0
- package/dist/types/onchain/positions/readAavePosition.d.ts +22 -0
- package/dist/types/onchain/positions/types.d.ts +25 -0
- package/dist/types/onchain/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/aaveBridgeBorrows.d.ts +15 -0
- package/dist/types/onchain/preview/preview/aaveMoveStart.d.ts +18 -0
- package/dist/types/onchain/preview/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/loadAdapterReplayState.d.ts +13 -0
- package/dist/types/onchain/validation/bundles/checkAaveDelegation.d.ts +21 -0
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/index.d.ts +2 -1
- package/dist/types/onchain/validation/index.d.ts +2 -1
- package/dist/types/sdk/GearboxSDK.d.ts +1 -8
- package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +1 -1
- package/dist/types/sdk/analytics/types.d.ts +1 -1
- package/dist/types/sdk/execute/types.d.ts +7 -5
- package/dist/types/sdk/index.d.ts +3 -3
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
- package/dist/types/sdk/opportunities/types.d.ts +1 -1
- package/dist/types/sdk/positions/PositionsNamespace.d.ts +7 -2
- package/dist/types/sdk/positions/types.d.ts +10 -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 +116 -1
- package/dist/types/sdk/preview/PreviewNamespace.d.ts +5 -1
- package/dist/types/sdk/preview/types.d.ts +12 -1
- package/dist/types/sdk/types.d.ts +0 -20
- package/package.json +1 -1
- package/dist/cjs/model/notices.schema.js +0 -25
- package/dist/cjs/offchain/notices/OffchainNotices.js +0 -27
- package/dist/cjs/offchain/notices/index.js +0 -3
- package/dist/esm/model/notices.schema.js +0 -23
- package/dist/esm/offchain/notices/OffchainNotices.js +0 -26
- package/dist/esm/offchain/notices/index.js +0 -1
- package/dist/types/model/notices.d.ts +0 -28
- package/dist/types/model/notices.schema.d.ts +0 -22
- package/dist/types/offchain/notices/OffchainNotices.d.ts +0 -18
- package/dist/types/offchain/notices/index.d.ts +0 -2
- /package/dist/cjs/model/{notices.js → aave.js} +0 -0
- /package/dist/esm/model/{notices.js → aave.js} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toToken } from "../helpers/token.js";
|
|
2
2
|
import "../helpers/index.js";
|
|
3
|
+
import { checkAaveDelegation } from "./checkAaveDelegation.js";
|
|
3
4
|
import { checkDebtLimits } from "../checks/checkDebtLimits.js";
|
|
4
5
|
import "../checks/index.js";
|
|
5
6
|
import { checkAccountQuotas } from "./checkAccountQuotas.js";
|
|
@@ -49,21 +50,45 @@ async function checkCreditOperation(args) {
|
|
|
49
50
|
safeHealthFactor: preview.estSafeHealthFactor
|
|
50
51
|
}, thresholds)
|
|
51
52
|
];
|
|
52
|
-
const [funding, rwa] = await Promise.all([
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
const [funding, rwa, ...delegations] = await Promise.all([
|
|
54
|
+
checkCollateralFunding({
|
|
55
|
+
sdk,
|
|
56
|
+
preview,
|
|
57
|
+
sender,
|
|
58
|
+
blockNumber
|
|
59
|
+
}),
|
|
60
|
+
isOpening ? checkRWAOpening({
|
|
61
|
+
sdk,
|
|
62
|
+
preview,
|
|
63
|
+
sender
|
|
64
|
+
}) : [],
|
|
65
|
+
...aaveBorrows(preview).map((borrow) => checkAaveDelegation({
|
|
66
|
+
sdk,
|
|
67
|
+
owner: sender,
|
|
68
|
+
borrow,
|
|
69
|
+
blockNumber
|
|
70
|
+
}))
|
|
71
|
+
]);
|
|
62
72
|
return [
|
|
63
73
|
...protocol,
|
|
64
74
|
...funding,
|
|
65
|
-
...rwa
|
|
75
|
+
...rwa,
|
|
76
|
+
...delegations.flat()
|
|
66
77
|
];
|
|
67
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* What the Horizon bridge borrows as the owner: the loans the transaction
|
|
81
|
+
* takes itself — an opening that moves to Aave at once, or an adjustment — or
|
|
82
|
+
* else the whole debt an Aave opening moves with once its mint settles.
|
|
83
|
+
*/
|
|
84
|
+
function aaveBorrows(preview) {
|
|
85
|
+
if ((preview.operation === "OpenCreditAccount" || preview.operation === "AdjustCreditAccount") && preview.aaveBorrows) return preview.aaveBorrows;
|
|
86
|
+
if (isAaveOpening(preview)) return [{
|
|
87
|
+
bridge: preview.aave.bridge,
|
|
88
|
+
amount: preview.aave.totalDebt
|
|
89
|
+
}];
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
const isAaveOpening = (preview) => "aave" in preview;
|
|
68
93
|
//#endregion
|
|
69
94
|
export { checkCreditOperation };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { checkAaveDelegation } from "./checkAaveDelegation.js";
|
|
1
2
|
import { checkAccountQuotas } from "./checkAccountQuotas.js";
|
|
2
3
|
import { checkWalletAllowance } from "./checkWalletAllowance.js";
|
|
3
4
|
import { checkWalletBalance } from "./checkWalletBalance.js";
|
|
@@ -17,4 +18,4 @@ import { checkLiquidationFunding } from "./checkLiquidationFunding.js";
|
|
|
17
18
|
import { checkWallet } from "./checkWallet.js";
|
|
18
19
|
import { checkPoolFunding } from "./checkPoolFunding.js";
|
|
19
20
|
import { checkPoolOperation } from "./checkPoolOperation.js";
|
|
20
|
-
export { checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
|
|
21
|
+
export { checkAaveDelegation, checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { checkAaveDelegation } from "./bundles/checkAaveDelegation.js";
|
|
1
2
|
import { checkCollateralFunding } from "./bundles/checkCollateralFunding.js";
|
|
2
3
|
import { checkMarket } from "./bundles/checkMarket.js";
|
|
3
4
|
import { checkCreditOperation } from "./bundles/checkCreditOperation.js";
|
|
@@ -49,10 +50,21 @@ async function checkOperation(input, options = {}) {
|
|
|
49
50
|
blockNumber,
|
|
50
51
|
...thresholds
|
|
51
52
|
});
|
|
52
|
-
case "RepayCreditAccount":
|
|
53
|
-
...
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
case "RepayCreditAccount": {
|
|
54
|
+
const [funding, ...delegations] = await Promise.all([checkCollateralFunding({
|
|
55
|
+
...wallet,
|
|
56
|
+
preview
|
|
57
|
+
}), ...(preview.aaveBorrows ?? []).map((borrow) => checkAaveDelegation({
|
|
58
|
+
...wallet,
|
|
59
|
+
owner: sender,
|
|
60
|
+
borrow
|
|
61
|
+
}))]);
|
|
62
|
+
return [
|
|
63
|
+
...checkMarket(sdk.marketRegister.findCreditManager(preview.creditManager)),
|
|
64
|
+
...funding,
|
|
65
|
+
...delegations.flat()
|
|
66
|
+
];
|
|
67
|
+
}
|
|
56
68
|
case "CloseCreditAccount": return checkMarket(sdk.marketRegister.findCreditManager(preview.creditManager));
|
|
57
69
|
}
|
|
58
70
|
}
|
|
@@ -2,6 +2,7 @@ import { amountOf } from "./helpers/amount.js";
|
|
|
2
2
|
import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM } from "./helpers/health-factor-limits.js";
|
|
3
3
|
import { toToken, toTokenAmount } from "./helpers/token.js";
|
|
4
4
|
import "./helpers/index.js";
|
|
5
|
+
import { checkAaveDelegation } from "./bundles/checkAaveDelegation.js";
|
|
5
6
|
import { checkBorrowLimit } from "./checks/checkBorrowLimit.js";
|
|
6
7
|
import { checkCollateralised } from "./checks/checkCollateralised.js";
|
|
7
8
|
import { checkCreditAccountFrozen } from "./checks/checkCreditAccountFrozen.js";
|
|
@@ -47,4 +48,4 @@ import { checkLiquidation } from "./checkLiquidation.js";
|
|
|
47
48
|
import { checkOperation } from "./checkOperation.js";
|
|
48
49
|
import { checkSimulation } from "./checkSimulation.js";
|
|
49
50
|
import { raise } from "./raise.js";
|
|
50
|
-
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, checkPartiallyLiquidatable, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
|
|
51
|
+
export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkAaveDelegation, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMaxQuota, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPartiallyLiquidatable, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
|
|
@@ -80,13 +80,6 @@ var GearboxSDK = class {
|
|
|
80
80
|
* Namespace for claimable rewards. Absent in `offchain` mode.
|
|
81
81
|
**/
|
|
82
82
|
rewards;
|
|
83
|
-
/**
|
|
84
|
-
* The banners the backend attaches to a pool opportunity or a strategy
|
|
85
|
-
* position, see {@link Notice}. Top-level because the subject is either
|
|
86
|
-
* kind of entity, so neither namespace owns it. Backend-only, hence gated
|
|
87
|
-
* by mode like every other backend read: absent in `onchain` mode.
|
|
88
|
-
**/
|
|
89
|
-
notices;
|
|
90
83
|
#attachOptions;
|
|
91
84
|
#onchain;
|
|
92
85
|
#offchain;
|
|
@@ -146,8 +139,6 @@ var GearboxSDK = class {
|
|
|
146
139
|
this.liquidations = this.#onchain ? new LiquidationsNamespace(this.#onchain, namespaceOptions) : void 0;
|
|
147
140
|
this.preview = this.#onchain ? new PreviewNamespace(this.#onchain, namespaceOptions) : void 0;
|
|
148
141
|
this.rewards = this.#onchain ? new RewardsNamespace(this.#onchain, rewards, namespaceOptions) : void 0;
|
|
149
|
-
const backend = this.#offchain;
|
|
150
|
-
this.notices = backend ? (subject) => backend.notices.list(subject) : void 0;
|
|
151
142
|
}
|
|
152
143
|
/**
|
|
153
144
|
* Attaches the on-chain SDK when this instance owns one; a no-op in `offchain`
|
|
@@ -61,6 +61,7 @@ async function openTx(sdk, request) {
|
|
|
61
61
|
calls: state.calls,
|
|
62
62
|
averageQuota: state.averageQuota,
|
|
63
63
|
minQuota: state.minQuota,
|
|
64
|
+
callsAfter: "moveCalls" in state ? state.moveCalls : void 0,
|
|
64
65
|
reopenCreditAccount: state.creditAccount,
|
|
65
66
|
permits: {},
|
|
66
67
|
referralCode: 0n,
|
|
@@ -61,6 +61,12 @@ var PositionsNamespace = class extends AbstractNamespace {
|
|
|
61
61
|
async getCurrentWithdrawals(props) {
|
|
62
62
|
return this.onchain.getCurrentWithdrawals(props);
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* {@inheritDoc IPositionsOnchainOnly.listAavePositions}
|
|
66
|
+
**/
|
|
67
|
+
async listAavePositions(props) {
|
|
68
|
+
return this.onchain.listAavePositions(props);
|
|
69
|
+
}
|
|
64
70
|
};
|
|
65
71
|
//#endregion
|
|
66
72
|
export { PositionsNamespace };
|
|
@@ -2,7 +2,8 @@ import { PERCENTAGE_FACTOR } from "../../onchain/constants/math.js";
|
|
|
2
2
|
import { hexEq } from "../../onchain/utils/hex.js";
|
|
3
3
|
import { MultichainConstruct } from "../../onchain/base/MultichainConstruct.js";
|
|
4
4
|
import "../../onchain/market/math.js";
|
|
5
|
-
import {
|
|
5
|
+
import { debtOutOfRange } from "../../model/errors/operation-errors.js";
|
|
6
|
+
import { creditAccountNotEmpty, creditAccountNotFound, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair } from "../../model/errors/prepare-errors.js";
|
|
6
7
|
import { sdkErr, sdkOk } from "../../model/result.js";
|
|
7
8
|
import "../../model/index.js";
|
|
8
9
|
import { toToken } from "../../onchain/validation/helpers/token.js";
|
|
@@ -13,6 +14,8 @@ import { toCreditAccountSlice } from "../../onchain/accounts/intents/utils/credi
|
|
|
13
14
|
import { resolveQuotaUpdate } from "../../onchain/accounts/intents/resolveQuotaUpdate.js";
|
|
14
15
|
import { CreditAccountOperationsService } from "../../onchain/accounts/intents/index.js";
|
|
15
16
|
import "../../onchain/index.js";
|
|
17
|
+
import { aaveMoveCalls } from "../../onchain/positions/aaveMoveCalls.js";
|
|
18
|
+
import { projectAavePosition } from "../../onchain/positions/projectAavePosition.js";
|
|
16
19
|
import { withdrawableCollaterals } from "./withdrawable-collaterals.js";
|
|
17
20
|
import { isAddressEqual } from "viem";
|
|
18
21
|
//#region src/sdk/prepare/PrepareApi.ts
|
|
@@ -257,6 +260,58 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
/**
|
|
263
|
+
* {@inheritDoc IOpportunitiesPrepare.openAavePosition}
|
|
264
|
+
**/
|
|
265
|
+
async openAavePosition(strategy, params) {
|
|
266
|
+
const opened = await this.openNewStrategy(strategy, params);
|
|
267
|
+
if (!opened.ok) return opened;
|
|
268
|
+
const { state } = opened.data;
|
|
269
|
+
try {
|
|
270
|
+
const sdk = this.sdk.chain(strategy.chainId);
|
|
271
|
+
const projected = await projectAavePosition(sdk, {
|
|
272
|
+
creditManager: state.creditManager,
|
|
273
|
+
assets: state.averageAssets.map((a) => ({
|
|
274
|
+
token: a.token.address,
|
|
275
|
+
balance: a.value
|
|
276
|
+
})),
|
|
277
|
+
quotas: state.averageQuota,
|
|
278
|
+
totalDebt: state.totalDebt.value,
|
|
279
|
+
totalValue: state.totalValue.value
|
|
280
|
+
}, params.wallet);
|
|
281
|
+
const suite = sdk.marketRegister.findCreditManager(strategy.creditManager);
|
|
282
|
+
if (!projected) {
|
|
283
|
+
const target = params.targetToken ?? suite.strategy?.targetCollateral;
|
|
284
|
+
return refused(target ? unsupportedCollateralToken(toToken(sdk, target)) : noStrategyTargetCollateral(strategy.creditManager), state);
|
|
285
|
+
}
|
|
286
|
+
const { aave, maxDebt } = projected;
|
|
287
|
+
if (aave.totalDebt.value > maxDebt) {
|
|
288
|
+
const market = sdk.marketRegister.findByCreditManager(strategy.creditManager);
|
|
289
|
+
const { creditFacade } = suite;
|
|
290
|
+
return refused(debtOutOfRange({
|
|
291
|
+
requested: aave.totalDebt,
|
|
292
|
+
minDebt: market.toUnderlyingAmount(creditFacade.minDebt),
|
|
293
|
+
maxDebt: market.toUnderlyingAmount(maxDebt)
|
|
294
|
+
}), state);
|
|
295
|
+
}
|
|
296
|
+
const moveCalls = aave.mintDuration === 0 ? await aaveMoveCalls(sdk, {
|
|
297
|
+
creditManager: state.creditManager,
|
|
298
|
+
token: aave.assets[0].token.address,
|
|
299
|
+
debt: state.totalDebt.value,
|
|
300
|
+
quotas: state.averageQuota
|
|
301
|
+
}) ?? [] : [];
|
|
302
|
+
return sdkOk({
|
|
303
|
+
...opened.data,
|
|
304
|
+
state: {
|
|
305
|
+
...state,
|
|
306
|
+
aave,
|
|
307
|
+
moveCalls
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
} catch (e) {
|
|
311
|
+
return refused(unexpectedFailure(e), state);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
260
315
|
* {@inheritDoc IOpportunitiesPrepare.borrow}
|
|
261
316
|
**/
|
|
262
317
|
async borrow(strategy, params) {
|
|
@@ -344,6 +399,32 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
344
399
|
});
|
|
345
400
|
}
|
|
346
401
|
/**
|
|
402
|
+
* {@inheritDoc IOpportunitiesPrepare.closeAavePosition}
|
|
403
|
+
**/
|
|
404
|
+
async closeAavePosition(position, params) {
|
|
405
|
+
const state = {};
|
|
406
|
+
try {
|
|
407
|
+
const sdk = await this.#chain(position.chainId);
|
|
408
|
+
const at = stateBlock(sdk);
|
|
409
|
+
const data = await sdk.accounts.getCreditAccountData(position.creditAccount);
|
|
410
|
+
if (!data) return refused(creditAccountNotFound(position.creditAccount), state);
|
|
411
|
+
const creditAccount = toCreditAccountSlice(data);
|
|
412
|
+
if (creditAccount.totalDebt > 0n || creditAccount.tokens.some((t) => t.quota > 0n)) return refused(creditAccountNotEmpty(position.creditAccount), state);
|
|
413
|
+
return delayedStarted(await service(sdk).closeAavePositionIntent({
|
|
414
|
+
creditAccount,
|
|
415
|
+
sdk,
|
|
416
|
+
token: params.token,
|
|
417
|
+
to: params.to,
|
|
418
|
+
owner: data.investor ?? data.owner,
|
|
419
|
+
slippage: params.slippage,
|
|
420
|
+
quotaReserve: params.quotaReserve,
|
|
421
|
+
draft: state
|
|
422
|
+
}), at);
|
|
423
|
+
} catch (e) {
|
|
424
|
+
return refused(unexpectedFailure(e), state);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
347
428
|
* {@inheritDoc IOpportunitiesPrepare.adjustLeverage}
|
|
348
429
|
**/
|
|
349
430
|
async adjustLeverage(position, params) {
|
|
@@ -731,6 +812,23 @@ function finalized(result, at) {
|
|
|
731
812
|
}
|
|
732
813
|
/**
|
|
733
814
|
* {@inheritDoc planned}
|
|
815
|
+
*
|
|
816
|
+
* A request carries one thing an instant operation does not: what it recorded
|
|
817
|
+
* for the tail, and when that tail can run.
|
|
818
|
+
**/
|
|
819
|
+
function delayedStarted(result, at) {
|
|
820
|
+
if (!result.ok) return methodError(result);
|
|
821
|
+
const { operations, state, calls, delayed } = result;
|
|
822
|
+
return sdkOk({
|
|
823
|
+
operations,
|
|
824
|
+
state,
|
|
825
|
+
calls,
|
|
826
|
+
delayed,
|
|
827
|
+
...at
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* {@inheritDoc planned}
|
|
734
832
|
**/
|
|
735
833
|
function opened(result, at) {
|
|
736
834
|
return result.ok ? sdkOk({
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { sdkErr, sdkOk } from "../../model/result.js";
|
|
2
|
+
import "../../model/index.js";
|
|
1
3
|
import { checkOperation } from "../../onchain/validation/checkOperation.js";
|
|
2
4
|
import { checkSimulation } from "../../onchain/validation/checkSimulation.js";
|
|
5
|
+
import { parseOperationCalldata } from "../../onchain/preview/parse/parseOperationCalldata.js";
|
|
3
6
|
import { previewOperation } from "../../onchain/preview/preview/previewOperation.js";
|
|
4
7
|
import "../../onchain/index.js";
|
|
8
|
+
import { projectAavePosition } from "../../onchain/positions/projectAavePosition.js";
|
|
5
9
|
//#region src/sdk/preview/PreviewNamespace.ts
|
|
6
10
|
/**
|
|
7
11
|
* {@inheritDoc IPreview}
|
|
@@ -22,6 +26,44 @@ var PreviewNamespace = class {
|
|
|
22
26
|
return previewOperation(sdk, input, options);
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
29
|
+
* {@inheritDoc IPreview.openAavePosition}
|
|
30
|
+
**/
|
|
31
|
+
async openAavePosition(input, options) {
|
|
32
|
+
const previewed = await this.previewOperation(input, options);
|
|
33
|
+
if (!previewed.ok) return previewed;
|
|
34
|
+
const preview = previewed.data;
|
|
35
|
+
if (preview.operation !== "OpenCreditAccount") return sdkErr({
|
|
36
|
+
code: "unsupportedOperation",
|
|
37
|
+
message: `operation "${preview.operation}" is not an Aave position opening`,
|
|
38
|
+
operation: preview.operation
|
|
39
|
+
});
|
|
40
|
+
const sdk = this.#onchain.chain(input.chainId);
|
|
41
|
+
const parsed = parseOperationCalldata(sdk, input);
|
|
42
|
+
const owner = parsed.ok && parsed.data.operation === "OpenCreditAccount" ? parsed.data.onBehalfOf : input.sender;
|
|
43
|
+
const projected = await projectAavePosition(sdk, {
|
|
44
|
+
creditManager: preview.creditManager,
|
|
45
|
+
assets: preview.estAssets.map((a) => ({
|
|
46
|
+
token: a.token.address,
|
|
47
|
+
balance: a.value
|
|
48
|
+
})),
|
|
49
|
+
quotas: preview.quotas.map((q) => ({
|
|
50
|
+
token: q.token.address,
|
|
51
|
+
balance: q.value
|
|
52
|
+
})),
|
|
53
|
+
totalDebt: preview.totalDebt.value,
|
|
54
|
+
totalValue: preview.estTotalValue.value
|
|
55
|
+
}, owner);
|
|
56
|
+
if (!projected) return sdkErr({
|
|
57
|
+
code: "unsupportedOperation",
|
|
58
|
+
message: `credit manager ${preview.creditManager} cannot move this opening to Aave`,
|
|
59
|
+
operation: preview.operation
|
|
60
|
+
});
|
|
61
|
+
return sdkOk({
|
|
62
|
+
...preview,
|
|
63
|
+
aave: projected.aave
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
25
67
|
* {@inheritDoc IPreview.checkOperation}
|
|
26
68
|
**/
|
|
27
69
|
async checkOperation(props, options) {
|
|
@@ -71,6 +71,20 @@ export declare const iSecuritizeRWAFactoryAbi: readonly [{
|
|
|
71
71
|
readonly internalType: "address";
|
|
72
72
|
}];
|
|
73
73
|
readonly stateMutability: "view";
|
|
74
|
+
}, {
|
|
75
|
+
readonly type: "function";
|
|
76
|
+
readonly name: "isAllowedBot";
|
|
77
|
+
readonly inputs: readonly [{
|
|
78
|
+
readonly name: "bot";
|
|
79
|
+
readonly type: "address";
|
|
80
|
+
readonly internalType: "address";
|
|
81
|
+
}];
|
|
82
|
+
readonly outputs: readonly [{
|
|
83
|
+
readonly name: "";
|
|
84
|
+
readonly type: "bool";
|
|
85
|
+
readonly internalType: "bool";
|
|
86
|
+
}];
|
|
87
|
+
readonly stateMutability: "view";
|
|
74
88
|
}, {
|
|
75
89
|
readonly type: "function";
|
|
76
90
|
readonly name: "isCreditAccount";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Timestamp, TokenAmount } from "./primitives.js";
|
|
2
|
+
import { AccountProjection } from "./previews.js";
|
|
3
|
+
import { StrategyPosition } from "./positions.js";
|
|
4
|
+
import { Address } from "viem";
|
|
5
|
+
//#region src/model/aave.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A loan the Horizon bridge takes on Aave as the credit account owner. Aave
|
|
8
|
+
* lends it only up to what the owner delegated to the bridge on the variable
|
|
9
|
+
* debt token of the borrowed token (`approveDelegation`).
|
|
10
|
+
**/
|
|
11
|
+
export interface AaveBridgeBorrow {
|
|
12
|
+
bridge: Address;
|
|
13
|
+
amount: TokenAmount;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Where an opening lands once it has moved to Aave Horizon.
|
|
17
|
+
*
|
|
18
|
+
* An RWA collateral may be minted asynchronously, so the leverage is built in a
|
|
19
|
+
* Gearbox credit account first; once the mint settles, the minted collateral is
|
|
20
|
+
* supplied to Aave, the Gearbox debt is refinanced there with the interest it
|
|
21
|
+
* accrued in the meantime, and the credit account closes. This is that second
|
|
22
|
+
* half — the account itself is described by the projection beside it.
|
|
23
|
+
*
|
|
24
|
+
* The shared fields mean what they mean on an {@link AccountProjection}, read
|
|
25
|
+
* on Aave: `assets` is the collateral supplied there, `totalDebt` includes
|
|
26
|
+
* {@link mintPeriodInterest}, and `netValue` is what the wallet ends up owning.
|
|
27
|
+
**/
|
|
28
|
+
export interface AavePositionProjection extends Pick<AccountProjection, "totalValue" | "totalDebt" | "netValue" | "assets" | "healthFactor" | "liquidationPrice" | "borrowRate" | "leverage"> {
|
|
29
|
+
/**
|
|
30
|
+
* Interest the Gearbox debt accrues while the mint settles, already part of
|
|
31
|
+
* `totalDebt`.
|
|
32
|
+
**/
|
|
33
|
+
mintPeriodInterest: TokenAmount;
|
|
34
|
+
/**
|
|
35
|
+
* How long the mint takes to settle, in seconds: the `withdrawalLength` of
|
|
36
|
+
* the RWA's delayed operation, `0` where the opening mints it outright.
|
|
37
|
+
**/
|
|
38
|
+
mintDuration: number;
|
|
39
|
+
/**
|
|
40
|
+
* Estimated unix seconds at which the position is live on Aave: the
|
|
41
|
+
* opening's own block where the mint is instant, and once the mint settles
|
|
42
|
+
* otherwise, when the finalizer bot moves it.
|
|
43
|
+
**/
|
|
44
|
+
estLiveAt: Timestamp;
|
|
45
|
+
/**
|
|
46
|
+
* Horizon bridge that borrows `totalDebt` as the owner when the position
|
|
47
|
+
* moves, see {@link AaveBridgeBorrow}.
|
|
48
|
+
**/
|
|
49
|
+
bridge: Address;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A position that lives on Aave Horizon: the RWA the account owner supplied to
|
|
53
|
+
* the Aave pool and the loan the Horizon bridge took against it in the owner's
|
|
54
|
+
* name. The credit account it was built in stays open with no debt, and the
|
|
55
|
+
* exit runs through such an account again. One pool holds one position per
|
|
56
|
+
* owner, however many accounts moved into it.
|
|
57
|
+
*
|
|
58
|
+
* Shaped like {@link StrategyPosition} so the two are shown alike. The shared
|
|
59
|
+
* fields mean what they mean there, read on Aave for the owner (the investor
|
|
60
|
+
* of an RWA account):
|
|
61
|
+
*
|
|
62
|
+
* - `creditManager` and `creditAccount` are an account of the owner the exit
|
|
63
|
+
* can run through, not necessarily the one the position was built in;
|
|
64
|
+
* - `collaterals` lists the RWA supplied to Aave in the RWA itself, not in its
|
|
65
|
+
* aToken, which Aave mints one for one; `quota` is always zero, since Aave
|
|
66
|
+
* charges none, and `withdrawals` is empty;
|
|
67
|
+
* - `totalDebt` is the variable debt owed on Aave, and `totalValue` the
|
|
68
|
+
* collateral at the Aave oracle's prices, both in the underlying;
|
|
69
|
+
* - `healthFactor` is Aave's, of everything the owner holds on the pool;
|
|
70
|
+
* - `borrowApy` and `borrowRate` are the pool's variable borrow rate, with no
|
|
71
|
+
* quota part.
|
|
72
|
+
**/
|
|
73
|
+
export interface AavePosition extends Omit<StrategyPosition, "kind" | "borrowApyAvg7D" | "netApy" | "netApyAvg7D" | "borrowRateAvg7D" | "pnl" | "error"> {
|
|
74
|
+
/**
|
|
75
|
+
* Tells this position from a credit account; not one of the
|
|
76
|
+
* {@link PositionKind}s `positions.list` returns.
|
|
77
|
+
**/
|
|
78
|
+
kind: "aave";
|
|
79
|
+
/**
|
|
80
|
+
* Aave pool the collateral is supplied to and the debt is owed on.
|
|
81
|
+
**/
|
|
82
|
+
pool: Address;
|
|
83
|
+
/**
|
|
84
|
+
* Horizon bridge that holds the owner's borrow delegation, see
|
|
85
|
+
* {@link AaveBridgeBorrow}.
|
|
86
|
+
**/
|
|
87
|
+
bridge: Address;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ChainId, Token, UnderlyingToken } from "./primitives.js";
|
|
2
|
-
import { ChartRange, ProtocolChartMetric } from "./charts.js";
|
|
3
2
|
import { Curator, CuratorName } from "./curators.js";
|
|
4
3
|
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
5
|
-
import { PoolPosition, PositionFilter, StrategyPosition } from "./positions.js";
|
|
6
4
|
import { LiquidationPosition } from "./liquidations.js";
|
|
5
|
+
import { PoolPosition, PositionFilter, StrategyPosition } from "./positions.js";
|
|
6
|
+
import { ChartRange, ProtocolChartMetric } from "./charts.js";
|
|
7
7
|
import { Address } from "viem";
|
|
8
8
|
//#region src/model/analytics.d.ts
|
|
9
9
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IGearboxError } from "./base.js";
|
|
2
2
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, PartialLiquidationImpossibleError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator, partialLiquidationImpossible } from "./liquidation-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";
|
|
3
|
+
import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientBorrowAllowanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, 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, PartialLiquidationImpossibleError, 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, partialLiquidationImpossible, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
7
|
+
export { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientBorrowAllowanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageLimits, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, OperationLimitOptions, PartialLiquidationImpossibleError, 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, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, partialLiquidationImpossible, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
@@ -317,6 +317,25 @@ export interface InsufficientAllowanceError extends IGearboxError {
|
|
|
317
317
|
}
|
|
318
318
|
/** {@inheritDoc InsufficientAllowanceError} */
|
|
319
319
|
export declare function insufficientAllowance(args: Omit<InsufficientAllowanceError, "code" | "message">): InsufficientAllowanceError;
|
|
320
|
+
/**
|
|
321
|
+
* `owner` has not delegated `spender` enough credit on an Aave variable debt
|
|
322
|
+
* token for what the operation borrows as the owner — the `approveDelegation`
|
|
323
|
+
* counterpart of {@link InsufficientAllowanceError}.
|
|
324
|
+
**/
|
|
325
|
+
export interface InsufficientBorrowAllowanceError extends IGearboxError {
|
|
326
|
+
code: "insufficientBorrowAllowance";
|
|
327
|
+
owner: Address;
|
|
328
|
+
/** The Horizon bridge, which borrows as `owner`. */
|
|
329
|
+
spender: Address;
|
|
330
|
+
/** The variable debt token `approveDelegation` is called on. */
|
|
331
|
+
debtToken: Address;
|
|
332
|
+
/** In the borrowed token. */
|
|
333
|
+
required: TokenAmount;
|
|
334
|
+
/** What is delegated today. */
|
|
335
|
+
allowed: TokenAmount;
|
|
336
|
+
}
|
|
337
|
+
/** {@inheritDoc InsufficientBorrowAllowanceError} */
|
|
338
|
+
export declare function insufficientBorrowAllowance(args: Omit<InsufficientBorrowAllowanceError, "code" | "message">): InsufficientBorrowAllowanceError;
|
|
320
339
|
/**
|
|
321
340
|
* The RWA protocol still wants something from the borrower before this token
|
|
322
341
|
* can be opened on.
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { Amount, Asset, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall, UnderlyingToken } from "./primitives.js";
|
|
2
|
-
import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, ProtocolChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
|
|
3
2
|
import { Curator, CuratorName } from "./curators.js";
|
|
4
3
|
import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
|
|
5
4
|
import { DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedWithdrawCollateralIntent } from "./delayed-intents.js";
|
|
6
5
|
import { IGearboxError } from "./errors/base.js";
|
|
7
6
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, PartialLiquidationImpossibleError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator, partialLiquidationImpossible } from "./errors/liquidation-errors.js";
|
|
8
7
|
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, 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";
|
|
8
|
+
import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientBorrowAllowanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
10
9
|
import { UnpriceableTokenError, unpriceableTokenError } from "./errors/oracle-errors.js";
|
|
11
10
|
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
11
|
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./errors/preview-errors.js";
|
|
13
12
|
import "./errors/index.js";
|
|
13
|
+
import { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, CreditOperationMarket, DelayedStrategyPositionOperationPreview, Estimated, EstimatedProjection, ExitStrategyPositionPreview, InstantStrategyPositionOperationPreview, OpenAavePositionPreview, OpenStrategyPositionPreview, OperationPreview, PoolOperationType, PoolPositionOperationPreview, PreviewOperationInput, PreviewOperationOptions, RepayStrategyPositionPreview, RoutedField, asEstimated } from "./previews.js";
|
|
14
|
+
import { DelayedReceivedAsset, InstantReceivedAsset, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, ReceivedAsset, matchesLiquidatableAccountFilter } from "./liquidations.js";
|
|
14
15
|
import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
15
16
|
import { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, RewardsPnL, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenQuotaRate, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
17
|
+
import { AaveBridgeBorrow, AavePosition, AavePositionProjection } from "./aave.js";
|
|
18
|
+
import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, ProtocolChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
|
|
18
19
|
import { AnalyticsChartQuery, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition } from "./analytics.js";
|
|
19
20
|
import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema } from "./analytics.schema.js";
|
|
20
21
|
import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, protocolChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
|
|
@@ -22,8 +23,6 @@ import { CompareTag, CompareTolerance, ToleranceCompareTag, backendPreferred, co
|
|
|
22
23
|
import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
|
|
23
24
|
import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
|
|
24
25
|
import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
|
|
25
|
-
import { Notice, NoticeKind, NoticeSubject } from "./notices.js";
|
|
26
|
-
import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
|
|
27
26
|
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
28
27
|
import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
|
|
29
28
|
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
|
|
@@ -34,4 +33,4 @@ import { MerklReward, PointsReward, Reward } from "./rewards.js";
|
|
|
34
33
|
import { kycRequirementSchema, rwaProtocolSchema } from "./rwa.schema.js";
|
|
35
34
|
import { PositionClaimableWithdrawal, PositionPendingWithdrawal, PositionWithdrawals, WithdrawalOutputAmount } from "./withdrawals.js";
|
|
36
35
|
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, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, 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,
|
|
36
|
+
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AaveBridgeBorrow, AavePosition, AavePositionProjection, AccountHoldings, AccountMetrics, AccountNotMidasGreenlistedError, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, 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, InsufficientBorrowAllowanceError, 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, OpenAavePositionPreview, OpenStrategyPositionPreview, OperationLimitOptions, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PartialLiquidationImpossibleError, 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, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, 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, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, partialLiquidationImpossible, 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 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, UnderlyingToken } from "./primitives.js";
|
|
2
2
|
import { Curator } from "./curators.js";
|
|
3
3
|
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
4
|
-
import { ApyBreakdown, PointsProgram } from "./opportunities.js";
|
|
5
4
|
import { DelayedReceivedAsset, LiquidationPosition } from "./liquidations.js";
|
|
5
|
+
import { ApyBreakdown, PointsProgram } from "./opportunities.js";
|
|
6
6
|
import { Address, Hex } from "viem";
|
|
7
7
|
//#region src/model/positions.d.ts
|
|
8
8
|
/**
|