@gearbox-protocol/sdk 18.4.1-aave.1 → 18.4.1-aave.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/model/errors/index.js +1 -0
- package/dist/cjs/model/errors/operation-errors.js +9 -0
- package/dist/cjs/model/index.js +1 -0
- 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/intents/operations.js +2 -2
- package/dist/cjs/onchain/accounts/intents/plan.js +6 -1
- package/dist/cjs/onchain/accounts/intents/tail.js +1 -1
- package/dist/cjs/onchain/index.js +10 -0
- package/dist/cjs/onchain/market/ZapperRegister.js +1 -1
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveOracle.js +20 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +166 -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 +6 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +27 -0
- package/dist/cjs/onchain/market/adapters/abi/index.js +6 -0
- package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +71 -12
- package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +5 -11
- package/dist/cjs/onchain/market/adapters/index.js +6 -0
- package/dist/cjs/onchain/market/index.js +6 -0
- package/dist/cjs/onchain/positions/projectAavePosition.js +163 -26
- 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/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
- package/dist/cjs/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +3 -0
- package/dist/cjs/onchain/validation/bundles/checkAaveDelegation.js +54 -0
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +34 -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/prepare/PrepareApi.js +21 -3
- package/dist/cjs/sdk/preview/PreviewNamespace.js +11 -2
- 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 +2 -2
- 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/intents/operations.js +2 -2
- package/dist/esm/onchain/accounts/intents/plan.js +6 -1
- package/dist/esm/onchain/accounts/intents/tail.js +1 -1
- package/dist/esm/onchain/index.js +6 -1
- package/dist/esm/onchain/market/ZapperRegister.js +1 -1
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveOracle.js +19 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +166 -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 +4 -1
- package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +27 -0
- package/dist/esm/onchain/market/adapters/abi/index.js +4 -1
- package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +72 -13
- package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +6 -12
- package/dist/esm/onchain/market/adapters/index.js +4 -1
- package/dist/esm/onchain/market/index.js +4 -1
- package/dist/esm/onchain/positions/projectAavePosition.js +164 -27
- 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/index.js +2 -1
- package/dist/esm/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
- package/dist/esm/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +3 -0
- package/dist/esm/onchain/validation/bundles/checkAaveDelegation.js +53 -0
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +34 -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/prepare/PrepareApi.js +22 -4
- package/dist/esm/sdk/preview/PreviewNamespace.js +11 -2
- package/dist/types/model/aave.d.ts +20 -3
- 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 +3 -3
- package/dist/types/model/previews.d.ts +11 -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 +2 -2
- package/dist/types/onchain/accounts/intents/operations.d.ts +9 -3
- package/dist/types/onchain/accounts/intents/types.d.ts +5 -0
- package/dist/types/onchain/index.d.ts +7 -2
- package/dist/types/onchain/market/adapters/abi/aave/iAaveOracle.d.ts +22 -0
- package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +139 -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 +4 -1
- package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +21 -0
- package/dist/types/onchain/market/adapters/abi/index.d.ts +4 -1
- package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +47 -10
- package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +142 -4
- package/dist/types/onchain/market/adapters/index.d.ts +4 -1
- package/dist/types/onchain/market/index.d.ts +4 -1
- package/dist/types/onchain/positions/projectAavePosition.d.ts +33 -4
- 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/index.d.ts +2 -1
- 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/index.d.ts +2 -2
- package/dist/types/sdk/prepare/PrepareApi.d.ts +2 -2
- package/dist/types/sdk/prepare/index.d.ts +2 -2
- package/dist/types/sdk/prepare/types.d.ts +49 -11
- package/dist/types/sdk/preview/types.d.ts +4 -2
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_validation_helpers_token = require("../helpers/token.js");
|
|
3
3
|
require("../helpers/index.js");
|
|
4
|
+
const require_onchain_validation_bundles_checkAaveDelegation = require("./checkAaveDelegation.js");
|
|
4
5
|
const require_onchain_validation_checks_checkDebtLimits = require("../checks/checkDebtLimits.js");
|
|
5
6
|
require("../checks/index.js");
|
|
6
7
|
const require_onchain_validation_bundles_checkAccountQuotas = require("./checkAccountQuotas.js");
|
|
@@ -50,21 +51,43 @@ async function checkCreditOperation(args) {
|
|
|
50
51
|
safeHealthFactor: preview.estSafeHealthFactor
|
|
51
52
|
}, thresholds)
|
|
52
53
|
];
|
|
53
|
-
const [funding, rwa] = await Promise.all([
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
const [funding, rwa, ...delegations] = await Promise.all([
|
|
55
|
+
require_onchain_validation_bundles_checkCollateralFunding.checkCollateralFunding({
|
|
56
|
+
sdk,
|
|
57
|
+
preview,
|
|
58
|
+
sender,
|
|
59
|
+
blockNumber
|
|
60
|
+
}),
|
|
61
|
+
isOpening ? require_onchain_validation_bundles_checkRWAOpening.checkRWAOpening({
|
|
62
|
+
sdk,
|
|
63
|
+
preview,
|
|
64
|
+
sender
|
|
65
|
+
}) : [],
|
|
66
|
+
...aaveBorrows(preview).map((borrow) => require_onchain_validation_bundles_checkAaveDelegation.checkAaveDelegation({
|
|
67
|
+
sdk,
|
|
68
|
+
owner: sender,
|
|
69
|
+
borrow,
|
|
70
|
+
blockNumber
|
|
71
|
+
}))
|
|
72
|
+
]);
|
|
63
73
|
return [
|
|
64
74
|
...protocol,
|
|
65
75
|
...funding,
|
|
66
|
-
...rwa
|
|
76
|
+
...rwa,
|
|
77
|
+
...delegations.flat()
|
|
67
78
|
];
|
|
68
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* What the Horizon bridge borrows as the owner: the whole debt when an Aave
|
|
82
|
+
* opening moves, or the loans an adjustment takes itself.
|
|
83
|
+
*/
|
|
84
|
+
function aaveBorrows(preview) {
|
|
85
|
+
if (isAaveOpening(preview)) return [{
|
|
86
|
+
bridge: preview.aave.bridge,
|
|
87
|
+
amount: preview.aave.totalDebt
|
|
88
|
+
}];
|
|
89
|
+
return preview.operation === "AdjustCreditAccount" ? preview.aaveBorrows ?? [] : [];
|
|
90
|
+
}
|
|
91
|
+
const isAaveOpening = (preview) => "aave" in preview;
|
|
69
92
|
//#endregion
|
|
70
93
|
exports.checkCreditOperation = checkCreditOperation;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_onchain_validation_bundles_checkAaveDelegation = require("./checkAaveDelegation.js");
|
|
2
3
|
const require_onchain_validation_bundles_checkAccountQuotas = require("./checkAccountQuotas.js");
|
|
3
4
|
const require_onchain_validation_bundles_checkWalletAllowance = require("./checkWalletAllowance.js");
|
|
4
5
|
const require_onchain_validation_bundles_checkWalletBalance = require("./checkWalletBalance.js");
|
|
@@ -18,6 +19,7 @@ const require_onchain_validation_bundles_checkLiquidationFunding = require("./ch
|
|
|
18
19
|
const require_onchain_validation_bundles_checkWallet = require("./checkWallet.js");
|
|
19
20
|
const require_onchain_validation_bundles_checkPoolFunding = require("./checkPoolFunding.js");
|
|
20
21
|
const require_onchain_validation_bundles_checkPoolOperation = require("./checkPoolOperation.js");
|
|
22
|
+
exports.checkAaveDelegation = require_onchain_validation_bundles_checkAaveDelegation.checkAaveDelegation;
|
|
21
23
|
exports.checkAccountQuotas = require_onchain_validation_bundles_checkAccountQuotas.checkAccountQuotas;
|
|
22
24
|
exports.checkCollateralFunding = require_onchain_validation_bundles_checkCollateralFunding.checkCollateralFunding;
|
|
23
25
|
exports.checkCreditOperation = require_onchain_validation_bundles_checkCreditOperation.checkCreditOperation;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_onchain_validation_bundles_checkAaveDelegation = require("./bundles/checkAaveDelegation.js");
|
|
2
3
|
const require_onchain_validation_bundles_checkCollateralFunding = require("./bundles/checkCollateralFunding.js");
|
|
3
4
|
const require_onchain_validation_bundles_checkMarket = require("./bundles/checkMarket.js");
|
|
4
5
|
const require_onchain_validation_bundles_checkCreditOperation = require("./bundles/checkCreditOperation.js");
|
|
@@ -50,10 +51,21 @@ async function checkOperation(input, options = {}) {
|
|
|
50
51
|
blockNumber,
|
|
51
52
|
...thresholds
|
|
52
53
|
});
|
|
53
|
-
case "RepayCreditAccount":
|
|
54
|
-
...
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
case "RepayCreditAccount": {
|
|
55
|
+
const [funding, ...delegations] = await Promise.all([require_onchain_validation_bundles_checkCollateralFunding.checkCollateralFunding({
|
|
56
|
+
...wallet,
|
|
57
|
+
preview
|
|
58
|
+
}), ...(preview.aaveBorrows ?? []).map((borrow) => require_onchain_validation_bundles_checkAaveDelegation.checkAaveDelegation({
|
|
59
|
+
...wallet,
|
|
60
|
+
owner: sender,
|
|
61
|
+
borrow
|
|
62
|
+
}))]);
|
|
63
|
+
return [
|
|
64
|
+
...require_onchain_validation_bundles_checkMarket.checkMarket(sdk.marketRegister.findCreditManager(preview.creditManager)),
|
|
65
|
+
...funding,
|
|
66
|
+
...delegations.flat()
|
|
67
|
+
];
|
|
68
|
+
}
|
|
57
69
|
case "CloseCreditAccount": return require_onchain_validation_bundles_checkMarket.checkMarket(sdk.marketRegister.findCreditManager(preview.creditManager));
|
|
58
70
|
}
|
|
59
71
|
}
|
|
@@ -3,6 +3,7 @@ const require_onchain_validation_helpers_amount = require("./helpers/amount.js")
|
|
|
3
3
|
const require_onchain_validation_helpers_health_factor_limits = require("./helpers/health-factor-limits.js");
|
|
4
4
|
const require_onchain_validation_helpers_token = require("./helpers/token.js");
|
|
5
5
|
require("./helpers/index.js");
|
|
6
|
+
const require_onchain_validation_bundles_checkAaveDelegation = require("./bundles/checkAaveDelegation.js");
|
|
6
7
|
const require_onchain_validation_checks_checkBorrowLimit = require("./checks/checkBorrowLimit.js");
|
|
7
8
|
const require_onchain_validation_checks_checkCollateralised = require("./checks/checkCollateralised.js");
|
|
8
9
|
const require_onchain_validation_checks_checkCreditAccountFrozen = require("./checks/checkCreditAccountFrozen.js");
|
|
@@ -53,6 +54,7 @@ exports.MIN_HEALTH_FACTOR_FORM = require_onchain_validation_helpers_health_facto
|
|
|
53
54
|
exports.MIN_HF_LIMITED = require_onchain_validation_helpers_health_factor_limits.MIN_HF_LIMITED;
|
|
54
55
|
exports.MIN_SAFE_HEALTH_FACTOR_FORM = require_onchain_validation_helpers_health_factor_limits.MIN_SAFE_HEALTH_FACTOR_FORM;
|
|
55
56
|
exports.amountOf = require_onchain_validation_helpers_amount.amountOf;
|
|
57
|
+
exports.checkAaveDelegation = require_onchain_validation_bundles_checkAaveDelegation.checkAaveDelegation;
|
|
56
58
|
exports.checkAccountQuotas = require_onchain_validation_bundles_checkAccountQuotas.checkAccountQuotas;
|
|
57
59
|
exports.checkBorrowLimit = require_onchain_validation_checks_checkBorrowLimit.checkBorrowLimit;
|
|
58
60
|
exports.checkCollateralFunding = require_onchain_validation_bundles_checkCollateralFunding.checkCollateralFunding;
|
|
@@ -3,6 +3,7 @@ const require_onchain_constants_math = require("../../onchain/constants/math.js"
|
|
|
3
3
|
const require_onchain_utils_hex = require("../../onchain/utils/hex.js");
|
|
4
4
|
const require_onchain_base_MultichainConstruct = require("../../onchain/base/MultichainConstruct.js");
|
|
5
5
|
require("../../onchain/market/math.js");
|
|
6
|
+
const require_model_errors_operation_errors = require("../../model/errors/operation-errors.js");
|
|
6
7
|
const require_model_errors_prepare_errors = require("../../model/errors/prepare-errors.js");
|
|
7
8
|
const require_model_result = require("../../model/result.js");
|
|
8
9
|
require("../../model/index.js");
|
|
@@ -266,7 +267,8 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
|
|
|
266
267
|
if (!opened.ok) return opened;
|
|
267
268
|
const { state } = opened.data;
|
|
268
269
|
try {
|
|
269
|
-
const
|
|
270
|
+
const sdk = this.sdk.chain(strategy.chainId);
|
|
271
|
+
const projected = await require_onchain_positions_projectAavePosition.projectAavePosition(sdk, {
|
|
270
272
|
creditManager: state.creditManager,
|
|
271
273
|
assets: state.averageAssets.map((a) => ({
|
|
272
274
|
token: a.token.address,
|
|
@@ -275,7 +277,22 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
|
|
|
275
277
|
quotas: state.averageQuota,
|
|
276
278
|
totalDebt: state.totalDebt.value,
|
|
277
279
|
totalValue: state.totalValue.value
|
|
278
|
-
});
|
|
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 ? require_model_errors_prepare_errors.unsupportedCollateralToken(require_onchain_validation_helpers_token.toToken(sdk, target)) : require_model_errors_prepare_errors.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(require_model_errors_operation_errors.debtOutOfRange({
|
|
291
|
+
requested: aave.totalDebt,
|
|
292
|
+
minDebt: market.toUnderlyingAmount(creditFacade.minDebt),
|
|
293
|
+
maxDebt: market.toUnderlyingAmount(maxDebt)
|
|
294
|
+
}), state);
|
|
295
|
+
}
|
|
279
296
|
return require_model_result.sdkOk({
|
|
280
297
|
...opened.data,
|
|
281
298
|
state: {
|
|
@@ -380,7 +397,8 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
|
|
|
380
397
|
async moveToAave(position, params) {
|
|
381
398
|
return this.#startIntent(position, {}, {
|
|
382
399
|
type: "MOVE_TO_AAVE",
|
|
383
|
-
token: params.token
|
|
400
|
+
token: params.token,
|
|
401
|
+
claimable: params.claimable && toClaimableWithdrawal(params.claimable)
|
|
384
402
|
});
|
|
385
403
|
}
|
|
386
404
|
/**
|
|
@@ -3,6 +3,7 @@ const require_model_result = require("../../model/result.js");
|
|
|
3
3
|
require("../../model/index.js");
|
|
4
4
|
const require_onchain_validation_checkOperation = require("../../onchain/validation/checkOperation.js");
|
|
5
5
|
const require_onchain_validation_checkSimulation = require("../../onchain/validation/checkSimulation.js");
|
|
6
|
+
const require_onchain_preview_parse_parseOperationCalldata = require("../../onchain/preview/parse/parseOperationCalldata.js");
|
|
6
7
|
const require_onchain_preview_preview_previewOperation = require("../../onchain/preview/preview/previewOperation.js");
|
|
7
8
|
require("../../onchain/index.js");
|
|
8
9
|
const require_onchain_positions_projectAavePosition = require("../../onchain/positions/projectAavePosition.js");
|
|
@@ -37,7 +38,10 @@ var PreviewNamespace = class {
|
|
|
37
38
|
message: `operation "${preview.operation}" is not an Aave position opening`,
|
|
38
39
|
operation: preview.operation
|
|
39
40
|
});
|
|
40
|
-
const
|
|
41
|
+
const sdk = this.#onchain.chain(input.chainId);
|
|
42
|
+
const parsed = require_onchain_preview_parse_parseOperationCalldata.parseOperationCalldata(sdk, input);
|
|
43
|
+
const owner = parsed.ok && parsed.data.operation === "OpenCreditAccount" ? parsed.data.onBehalfOf : input.sender;
|
|
44
|
+
const projected = await require_onchain_positions_projectAavePosition.projectAavePosition(sdk, {
|
|
41
45
|
creditManager: preview.creditManager,
|
|
42
46
|
assets: preview.estAssets.map((a) => ({
|
|
43
47
|
token: a.token.address,
|
|
@@ -49,10 +53,15 @@ var PreviewNamespace = class {
|
|
|
49
53
|
})),
|
|
50
54
|
totalDebt: preview.totalDebt.value,
|
|
51
55
|
totalValue: preview.estTotalValue.value
|
|
56
|
+
}, owner);
|
|
57
|
+
if (!projected) return require_model_result.sdkErr({
|
|
58
|
+
code: "unsupportedOperation",
|
|
59
|
+
message: `credit manager ${preview.creditManager} cannot move this opening to Aave`,
|
|
60
|
+
operation: preview.operation
|
|
52
61
|
});
|
|
53
62
|
return require_model_result.sdkOk({
|
|
54
63
|
...preview,
|
|
55
|
-
aave
|
|
64
|
+
aave: projected.aave
|
|
56
65
|
});
|
|
57
66
|
}
|
|
58
67
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./base.js";
|
|
2
2
|
import { creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator, partialLiquidationImpossible } from "./liquidation-errors.js";
|
|
3
|
-
import { 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 { 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 } from "./oracle-errors.js";
|
|
5
5
|
import { creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./prepare-errors.js";
|
|
6
6
|
import { malformedTransaction } from "./preview-errors.js";
|
|
7
|
-
export { 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 { 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 };
|
|
@@ -141,6 +141,14 @@ function insufficientAllowance(args) {
|
|
|
141
141
|
...args
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
+
/** {@inheritDoc InsufficientBorrowAllowanceError} */
|
|
145
|
+
function insufficientBorrowAllowance(args) {
|
|
146
|
+
return {
|
|
147
|
+
code: "insufficientBorrowAllowance",
|
|
148
|
+
message: `${args.required.value} of ${args.required.token.symbol} borrowing must be delegated to ${args.spender} on ${args.debtToken}, ${args.allowed.value} is.`,
|
|
149
|
+
...args
|
|
150
|
+
};
|
|
151
|
+
}
|
|
144
152
|
/** {@inheritDoc RWAOpenRequirementsError} */
|
|
145
153
|
function rwaOpenRequirementsNotMet(args) {
|
|
146
154
|
return {
|
|
@@ -158,4 +166,4 @@ function accountNotMidasGreenlisted(args) {
|
|
|
158
166
|
};
|
|
159
167
|
}
|
|
160
168
|
//#endregion
|
|
161
|
-
export { accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet };
|
|
169
|
+
export { accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet };
|
package/dist/esm/model/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analy
|
|
|
16
16
|
import "./curators.js";
|
|
17
17
|
import "./delayed-intents.js";
|
|
18
18
|
import { creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator, partialLiquidationImpossible } from "./errors/liquidation-errors.js";
|
|
19
|
-
import { accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
19
|
+
import { 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";
|
|
20
20
|
import { unpriceableTokenError } from "./errors/oracle-errors.js";
|
|
21
21
|
import { creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
|
|
22
22
|
import { malformedTransaction } from "./errors/preview-errors.js";
|
|
@@ -32,4 +32,4 @@ import { safeValue, sdkErr, sdkOk } from "./result.js";
|
|
|
32
32
|
import "./rewards.js";
|
|
33
33
|
import "./withdrawals.js";
|
|
34
34
|
import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
|
|
35
|
-
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, KYC_REGISTRATION_LINKS, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, 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, 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 };
|
|
35
|
+
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, KYC_REGISTRATION_LINKS, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, 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,7 +1,10 @@
|
|
|
1
1
|
import { iBotListV310Abi } from "../../../abi/310/generated.js";
|
|
2
|
+
import { peripheryCompressorAbi } from "../../../abi/compressors/peripheryCompressor.js";
|
|
3
|
+
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
4
|
import { AP_PERIPHERY_COMPRESSOR } from "../../constants/address-provider.js";
|
|
3
5
|
import { VERSION_RANGE_310 } from "../../constants/versions.js";
|
|
4
6
|
import "../../constants/index.js";
|
|
7
|
+
import "../../utils/index.js";
|
|
5
8
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
6
9
|
import "../../base/index.js";
|
|
7
10
|
import { iBotAbi } from "./abi.js";
|
|
@@ -14,6 +17,32 @@ import { PeripheryCompressorV310Contract } from "./PeripheryCompressorV310Contra
|
|
|
14
17
|
* and builds the transactions that connect or disconnect one.
|
|
15
18
|
**/
|
|
16
19
|
var AccountBotsService = class extends SDKConstruct {
|
|
20
|
+
#marketBots = new AddressMap(void 0, "marketBots");
|
|
21
|
+
/**
|
|
22
|
+
* The bots a market configurator lists among its periphery contracts.
|
|
23
|
+
*
|
|
24
|
+
* Read once per configurator and kept for the service's lifetime: the list
|
|
25
|
+
* changes only when the curator adds or removes a bot. A failed read is not
|
|
26
|
+
* kept, so the next call tries again.
|
|
27
|
+
*
|
|
28
|
+
* @param marketConfigurator - Configurator to list the bots of.
|
|
29
|
+
**/
|
|
30
|
+
getMarketBots(marketConfigurator) {
|
|
31
|
+
let bots = this.#marketBots.get(marketConfigurator);
|
|
32
|
+
if (!bots) {
|
|
33
|
+
bots = this.client.readContract({
|
|
34
|
+
address: this.#compressor.address,
|
|
35
|
+
abi: peripheryCompressorAbi,
|
|
36
|
+
functionName: "getBots",
|
|
37
|
+
args: [marketConfigurator]
|
|
38
|
+
}).catch((e) => {
|
|
39
|
+
this.#marketBots.delete(marketConfigurator);
|
|
40
|
+
throw e;
|
|
41
|
+
});
|
|
42
|
+
this.#marketBots.upsert(marketConfigurator, bots);
|
|
43
|
+
}
|
|
44
|
+
return bots;
|
|
45
|
+
}
|
|
17
46
|
/**
|
|
18
47
|
* Reads the bots connected to each of the given credit accounts.
|
|
19
48
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { peripheryCompressorAbi } from "../../../abi/compressors/peripheryCompressor.js";
|
|
1
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
2
3
|
import "../../base/index.js";
|
|
3
|
-
import { peripheryCompressorAbi } from "../../../abi/compressors/peripheryCompressor.js";
|
|
4
4
|
//#region src/onchain/accounts/bots/PeripheryCompressorV310Contract.ts
|
|
5
5
|
const abi = peripheryCompressorAbi;
|
|
6
6
|
var PeripheryCompressorV310Contract = class extends BaseContract {
|
|
@@ -140,7 +140,7 @@ function buildAaveSupplyOperation(input) {
|
|
|
140
140
|
token: input.token,
|
|
141
141
|
aToken: input.aToken,
|
|
142
142
|
amount: input.amount,
|
|
143
|
-
calls: [input.adapter.
|
|
143
|
+
calls: [input.adapter.supplyDiffCall(input.token, 0n)]
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
function buildAaveOpenPositionOperation(input) {
|
|
@@ -150,7 +150,7 @@ function buildAaveOpenPositionOperation(input) {
|
|
|
150
150
|
aTokenAmount: input.aTokenAmount,
|
|
151
151
|
debtToken: input.debtToken,
|
|
152
152
|
borrowAmount: input.borrowAmount,
|
|
153
|
-
calls: [input.adapter.
|
|
153
|
+
calls: [input.adapter.openPositionDiffCall(input.aToken, input.debtToken, 0n, input.borrowAmount)]
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
@@ -7,6 +7,7 @@ import { toToken, toTokenAmount } from "../../validation/helpers/token.js";
|
|
|
7
7
|
import { IntentPreviewError } from "../../validation/raise.js";
|
|
8
8
|
import { eq, toTargetDecimals } from "./utils/common.js";
|
|
9
9
|
import { assertDebtLimits, assertLeverageAtLeastOne, debtForLeverage, proportionalDebt } from "./math.js";
|
|
10
|
+
import { instantOutput } from "./operations.js";
|
|
10
11
|
//#region src/onchain/accounts/intents/plan.ts
|
|
11
12
|
/** Whatever the previous convert produced. */
|
|
12
13
|
const RAISED = { raised: true };
|
|
@@ -113,7 +114,10 @@ function planRepay(intent, view) {
|
|
|
113
114
|
* what it does not take stays on the account.
|
|
114
115
|
*/
|
|
115
116
|
function planMoveToAave(intent, view) {
|
|
116
|
-
const
|
|
117
|
+
const { claimable } = intent;
|
|
118
|
+
const claimed = claimable ? instantOutput(claimable.outputs, intent.token) : void 0;
|
|
119
|
+
if (claimable && !claimed) throw new IntentPreviewError(unsupportedCollateralToken(toToken(view.sdk, intent.token)), `moveToAave: the claim brings no ${intent.token}`);
|
|
120
|
+
const amount = view.balanceOf(intent.token) + (claimed?.amount ?? 0n);
|
|
117
121
|
if (eq(intent.token, view.underlying) || isZeroBalance(amount)) throw new IntentPreviewError(unsupportedCollateralToken(toToken(view.sdk, intent.token)), `moveToAave: ${intent.token} is the underlying or not held by the account`);
|
|
118
122
|
if (view.debt <= 0n) throw new IntentPreviewError(debtOutOfRange({
|
|
119
123
|
requested: toTokenAmount(view.sdk, view.underlying, view.debt),
|
|
@@ -121,6 +125,7 @@ function planMoveToAave(intent, view) {
|
|
|
121
125
|
maxDebt: toTokenAmount(view.sdk, view.underlying, view.debtLimits.maxDebt)
|
|
122
126
|
}), "moveToAave: the account owes nothing");
|
|
123
127
|
return [
|
|
128
|
+
...claimable ? [claim(claimable)] : [],
|
|
124
129
|
{
|
|
125
130
|
kind: "aaveSupply",
|
|
126
131
|
token: intent.token,
|
|
@@ -6,8 +6,8 @@ import { IntentPreviewError } from "../../validation/raise.js";
|
|
|
6
6
|
import { toTargetDecimals } from "./utils/common.js";
|
|
7
7
|
import { createOraclePaths } from "./utils/router-path.js";
|
|
8
8
|
import { accountView } from "./view.js";
|
|
9
|
-
import { planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw } from "./plan.js";
|
|
10
9
|
import { instantOutput } from "./operations.js";
|
|
10
|
+
import { planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw } from "./plan.js";
|
|
11
11
|
import { realize } from "./realize.js";
|
|
12
12
|
//#region src/onchain/accounts/intents/tail.ts
|
|
13
13
|
/**
|
|
@@ -46,7 +46,10 @@ import "./base/index.js";
|
|
|
46
46
|
import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
|
|
47
47
|
import { AccountBotsService } from "./accounts/bots/AccountBotsService.js";
|
|
48
48
|
import { iAaveHorizonBridgeAbi } from "./market/adapters/abi/aave/iAaveHorizonBridge.js";
|
|
49
|
+
import { iAaveOracleAbi } from "./market/adapters/abi/aave/iAaveOracle.js";
|
|
49
50
|
import { iAaveV3PoolAbi } from "./market/adapters/abi/aave/iAaveV3Pool.js";
|
|
51
|
+
import { iPoolAddressesProviderAbi } from "./market/adapters/abi/aave/iPoolAddressesProvider.js";
|
|
52
|
+
import { iVariableDebtTokenAbi } from "./market/adapters/abi/aave/iVariableDebtToken.js";
|
|
50
53
|
import { AdapterType } from "./market/adapters/types.js";
|
|
51
54
|
import { adapterActionAbi, adapterActionSelectors, adapterActionSignatures } from "./market/adapters/abi/actionAbi.js";
|
|
52
55
|
import { erc4626ReferralAdapterAbi } from "./market/adapters/abi/adapters/erc4626ReferralAdapter.js";
|
|
@@ -216,6 +219,7 @@ import { CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.
|
|
|
216
219
|
import { amountOf } from "./validation/helpers/amount.js";
|
|
217
220
|
import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM } from "./validation/helpers/health-factor-limits.js";
|
|
218
221
|
import { toToken, toTokenAmount } from "./validation/helpers/token.js";
|
|
222
|
+
import { checkAaveDelegation } from "./validation/bundles/checkAaveDelegation.js";
|
|
219
223
|
import { checkBorrowLimit } from "./validation/checks/checkBorrowLimit.js";
|
|
220
224
|
import { checkCollateralised } from "./validation/checks/checkCollateralised.js";
|
|
221
225
|
import { checkCreditAccountFrozen } from "./validation/checks/checkCreditAccountFrozen.js";
|
|
@@ -312,6 +316,7 @@ import { parsePoolOperationCalldata } from "./preview/parse/parsePoolOperationCa
|
|
|
312
316
|
import { parseRWAFactoryOperationCalldata } from "./preview/parse/parseRWAFactoryOperationCalldata.js";
|
|
313
317
|
import { parseOperationCalldata } from "./preview/parse/parseOperationCalldata.js";
|
|
314
318
|
import { isPoolOperation, isRWAOperation } from "./preview/parse/types.js";
|
|
319
|
+
import { aaveBridgeBorrows } from "./preview/preview/aaveBridgeBorrows.js";
|
|
315
320
|
import { buildDelayedStrategyPositionOperationPreview } from "./preview/preview/buildDelayedStrategyPositionOperationPreview.js";
|
|
316
321
|
import { CreditAccountState } from "./preview/preview/CreditAccountState.js";
|
|
317
322
|
import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/preview/detectCloseOrRepay.js";
|
|
@@ -326,4 +331,4 @@ import { replayMulticall } from "./preview/preview/replayMulticall.js";
|
|
|
326
331
|
import { previewOperation } from "./preview/preview/previewOperation.js";
|
|
327
332
|
import "./preview/index.js";
|
|
328
333
|
import "./types/index.js";
|
|
329
|
-
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, AaveHorizonBridgeAdapterContract, AaveV3PoolAdapterContract, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, ConstantPriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountState, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, buildDelayedStrategyPositionOperationPreview, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, 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, childLogger, classifyCloseOrRepay, classifyCurveOperation, classifyInnerOperations, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectDelayedClaim, detectDelayedOperation, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateClaimableAt, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getDirectTransferToken, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isCloseOrRepay, isDust, isLPPriceFeed, isPhantomToken, isPoolOperation, isPublicNetwork, isRWAFactory, isRWAOperation, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, makeReplayState, maxAmountForQuota, mellowDvvAdapterAbi, midasGreenlistsAccount, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, partialLiquidationParams, percentFmt, pickStrategyTargetCollateral, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, raise, rayToBps, rayToNumber, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, updatableDependencies, usdToNumber, watchBlocksAsync };
|
|
334
|
+
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, AaveHorizonBridgeAdapterContract, AaveV3PoolAdapterContract, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, ConstantPriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountState, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, aaveBridgeBorrows, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, buildDelayedStrategyPositionOperationPreview, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, 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, childLogger, classifyCloseOrRepay, classifyCurveOperation, classifyInnerOperations, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectDelayedClaim, detectDelayedOperation, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateClaimableAt, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getDirectTransferToken, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveOracleAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iPoolAddressesProviderAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVariableDebtTokenAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isCloseOrRepay, isDust, isLPPriceFeed, isPhantomToken, isPoolOperation, isPublicNetwork, isRWAFactory, isRWAOperation, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, makeReplayState, maxAmountForQuota, mellowDvvAdapterAbi, midasGreenlistsAccount, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, partialLiquidationParams, percentFmt, pickStrategyTargetCollateral, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, raise, rayToBps, rayToNumber, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, updatableDependencies, usdToNumber, watchBlocksAsync };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
|
|
1
2
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
2
3
|
import { AP_PERIPHERY_COMPRESSOR } from "../constants/address-provider.js";
|
|
3
4
|
import { VERSION_RANGE_310 } from "../constants/versions.js";
|
|
@@ -7,7 +8,6 @@ import "../utils/index.js";
|
|
|
7
8
|
import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
|
|
8
9
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
9
10
|
import "../base/index.js";
|
|
10
|
-
import { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
|
|
11
11
|
import "../utils/viem/index.js";
|
|
12
12
|
import { createZapper } from "./zapper/createZapper.js";
|
|
13
13
|
import "./zapper/index.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/onchain/market/adapters/abi/aave/iAaveOracle.ts
|
|
2
|
+
const iAaveOracleAbi = [{
|
|
3
|
+
name: "BASE_CURRENCY_UNIT",
|
|
4
|
+
type: "function",
|
|
5
|
+
stateMutability: "view",
|
|
6
|
+
inputs: [],
|
|
7
|
+
outputs: [{ type: "uint256" }]
|
|
8
|
+
}, {
|
|
9
|
+
name: "getAssetsPrices",
|
|
10
|
+
type: "function",
|
|
11
|
+
stateMutability: "view",
|
|
12
|
+
inputs: [{
|
|
13
|
+
type: "address[]",
|
|
14
|
+
name: "assets"
|
|
15
|
+
}],
|
|
16
|
+
outputs: [{ type: "uint256[]" }]
|
|
17
|
+
}];
|
|
18
|
+
//#endregion
|
|
19
|
+
export { iAaveOracleAbi };
|