@gearbox-protocol/sdk 16.4.0-next.3 → 16.4.0-next.5
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/dev/midasUtils.js +46 -11
- 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/index.js +4 -0
- package/dist/cjs/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +11 -3
- package/dist/cjs/onchain/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/midasGreenlistsAccount.js +17 -0
- package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +3 -1
- package/dist/cjs/onchain/validation/bundles/checkMidasAccountGreenlist.js +46 -0
- package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +15 -5
- package/dist/cjs/onchain/validation/bundles/index.js +2 -0
- package/dist/cjs/onchain/validation/index.js +2 -0
- package/dist/esm/dev/midasUtils.js +47 -12
- 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/index.js +3 -1
- package/dist/esm/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +11 -3
- package/dist/esm/onchain/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/midasGreenlistsAccount.js +16 -0
- package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +3 -1
- package/dist/esm/onchain/validation/bundles/checkMidasAccountGreenlist.js +45 -0
- package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +15 -5
- package/dist/esm/onchain/validation/bundles/index.js +2 -1
- package/dist/esm/onchain/validation/index.js +2 -1
- package/dist/types/dev/midasUtils.d.ts +4 -3
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +14 -1
- package/dist/types/model/index.d.ts +2 -2
- package/dist/types/model/previews.d.ts +6 -0
- package/dist/types/onchain/index.d.ts +4 -2
- package/dist/types/onchain/market/adapters/contracts/MidasGatewayAdapterContract.d.ts +8 -2
- package/dist/types/onchain/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/midasGreenlistsAccount.d.ts +13 -0
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/checkMidasAccountGreenlist.d.ts +23 -0
- package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +6 -4
- package/dist/types/onchain/validation/bundles/index.d.ts +3 -2
- package/dist/types/onchain/validation/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -10,14 +10,24 @@ const iMidasPausableVaultAbi = (0, viem.parseAbi)([
|
|
|
10
10
|
"function paused() external view returns (bool)",
|
|
11
11
|
"function pause() external",
|
|
12
12
|
"function unpause() external",
|
|
13
|
+
"function fnPaused(bytes4 fn) external view returns (bool)",
|
|
14
|
+
"function pauseFn(bytes4 fn) external",
|
|
15
|
+
"function unpauseFn(bytes4 fn) external",
|
|
13
16
|
"function pauseAdminRole() external view returns (bytes32)",
|
|
14
17
|
"function accessControl() external view returns (address)"
|
|
15
18
|
]);
|
|
16
19
|
const iMidasAccessControlAbi = (0, viem.parseAbi)(["function hasRole(bytes32 role, address account) external view returns (bool)", "function grantRole(bytes32 role, address account) external"]);
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
+
* Selector for `DepositVault.depositInstant(address,uint256,uint256,bytes32)`,
|
|
22
|
+
* the 4-arg mint Gearbox adapters encode. Distinct from the custom-recipient
|
|
23
|
+
* overload.
|
|
24
|
+
*/
|
|
25
|
+
const DEPOSIT_INSTANT_SELECTOR = (0, viem.toFunctionSelector)("depositInstant(address,uint256,uint256,bytes32)");
|
|
26
|
+
/**
|
|
27
|
+
* Unpauses a Midas issuance vault on an anvil fork so that `depositInstant`
|
|
28
|
+
* stops reverting with `Pausable: paused` (global) or `Pausable: fn paused`
|
|
29
|
+
* (per-selector), and returns a callback that restores the original pause
|
|
30
|
+
* state of each layer that was cleared.
|
|
21
31
|
*
|
|
22
32
|
* Impersonates `admin` and grants it `pauseAdminRole()` when missing, same as
|
|
23
33
|
* `greenlistMidasGateway` does with the greenlist roles. The grant is not
|
|
@@ -25,11 +35,20 @@ const iMidasAccessControlAbi = (0, viem.parseAbi)(["function hasRole(bytes32 rol
|
|
|
25
35
|
*/
|
|
26
36
|
async function unpauseMidasIssuanceVault(props) {
|
|
27
37
|
const { anvil, vault, admin, logger } = props;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
const [paused, depositInstantPaused] = await anvil.multicall({
|
|
39
|
+
allowFailure: false,
|
|
40
|
+
contracts: [{
|
|
41
|
+
address: vault,
|
|
42
|
+
abi: iMidasPausableVaultAbi,
|
|
43
|
+
functionName: "paused"
|
|
44
|
+
}, {
|
|
45
|
+
address: vault,
|
|
46
|
+
abi: iMidasPausableVaultAbi,
|
|
47
|
+
functionName: "fnPaused",
|
|
48
|
+
args: [DEPOSIT_INSTANT_SELECTOR]
|
|
49
|
+
}]
|
|
50
|
+
});
|
|
51
|
+
if (!paused && !depositInstantPaused) {
|
|
33
52
|
logger?.debug(`midas: issuance vault ${vault} is not paused`);
|
|
34
53
|
return async () => {};
|
|
35
54
|
}
|
|
@@ -51,7 +70,7 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
51
70
|
functionName: "hasRole",
|
|
52
71
|
args: [pauseAdminRole, admin]
|
|
53
72
|
});
|
|
54
|
-
logger?.debug(`midas: unpausing issuance vault ${vault} as ${admin}, access control ${accessControl}, pause admin role ${pauseAdminRole}`);
|
|
73
|
+
logger?.debug(`midas: unpausing issuance vault ${vault} as ${admin}, access control ${accessControl}, pause admin role ${pauseAdminRole}` + (paused ? ", global" : "") + (depositInstantPaused ? ", depositInstant" : ""));
|
|
55
74
|
await anvil.impersonateAccount({ address: admin });
|
|
56
75
|
try {
|
|
57
76
|
await anvil.setBalance({
|
|
@@ -69,13 +88,21 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
69
88
|
});
|
|
70
89
|
logger?.debug(`midas: granted pause admin role to ${admin}`);
|
|
71
90
|
}
|
|
72
|
-
await require_dev_kycUtils.writeAndWait(anvil, {
|
|
91
|
+
if (paused) await require_dev_kycUtils.writeAndWait(anvil, {
|
|
73
92
|
account: admin,
|
|
74
93
|
chain: anvil.chain,
|
|
75
94
|
address: vault,
|
|
76
95
|
abi: iMidasPausableVaultAbi,
|
|
77
96
|
functionName: "unpause"
|
|
78
97
|
});
|
|
98
|
+
if (depositInstantPaused) await require_dev_kycUtils.writeAndWait(anvil, {
|
|
99
|
+
account: admin,
|
|
100
|
+
chain: anvil.chain,
|
|
101
|
+
address: vault,
|
|
102
|
+
abi: iMidasPausableVaultAbi,
|
|
103
|
+
functionName: "unpauseFn",
|
|
104
|
+
args: [DEPOSIT_INSTANT_SELECTOR]
|
|
105
|
+
});
|
|
79
106
|
} finally {
|
|
80
107
|
await anvil.stopImpersonatingAccount({ address: admin });
|
|
81
108
|
}
|
|
@@ -90,13 +117,21 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
90
117
|
address: admin,
|
|
91
118
|
value: (0, viem.parseEther)("100")
|
|
92
119
|
});
|
|
93
|
-
await require_dev_kycUtils.writeAndWait(anvil, {
|
|
120
|
+
if (paused) await require_dev_kycUtils.writeAndWait(anvil, {
|
|
94
121
|
account: admin,
|
|
95
122
|
chain: anvil.chain,
|
|
96
123
|
address: vault,
|
|
97
124
|
abi: iMidasPausableVaultAbi,
|
|
98
125
|
functionName: "pause"
|
|
99
126
|
});
|
|
127
|
+
if (depositInstantPaused) await require_dev_kycUtils.writeAndWait(anvil, {
|
|
128
|
+
account: admin,
|
|
129
|
+
chain: anvil.chain,
|
|
130
|
+
address: vault,
|
|
131
|
+
abi: iMidasPausableVaultAbi,
|
|
132
|
+
functionName: "pauseFn",
|
|
133
|
+
args: [DEPOSIT_INSTANT_SELECTOR]
|
|
134
|
+
});
|
|
100
135
|
} catch (e) {
|
|
101
136
|
logger?.warn(`midas: failed to pause issuance vault ${vault} back: ${e}`);
|
|
102
137
|
} finally {
|
|
@@ -5,6 +5,7 @@ const require_model_errors_operation_errors = require("./operation-errors.js");
|
|
|
5
5
|
const require_model_errors_oracle_errors = require("./oracle-errors.js");
|
|
6
6
|
const require_model_errors_prepare_errors = require("./prepare-errors.js");
|
|
7
7
|
const require_model_errors_preview_errors = require("./preview-errors.js");
|
|
8
|
+
exports.accountNotMidasGreenlisted = require_model_errors_operation_errors.accountNotMidasGreenlisted;
|
|
8
9
|
exports.creditAccountFrozen = require_model_errors_liquidation_errors.creditAccountFrozen;
|
|
9
10
|
exports.creditAccountNotEmpty = require_model_errors_prepare_errors.creditAccountNotEmpty;
|
|
10
11
|
exports.creditAccountNotFound = require_model_errors_prepare_errors.creditAccountNotFound;
|
|
@@ -126,7 +126,16 @@ function rwaOpenRequirementsNotMet(args) {
|
|
|
126
126
|
...args
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
+
/** {@inheritDoc AccountNotMidasGreenlistedError} */
|
|
130
|
+
function accountNotMidasGreenlisted(args) {
|
|
131
|
+
return {
|
|
132
|
+
code: "accountNotMidasGreenlisted",
|
|
133
|
+
message: `The credit account is not Midas-greenlisted for ${args.token.symbol}.`,
|
|
134
|
+
...args
|
|
135
|
+
};
|
|
136
|
+
}
|
|
129
137
|
//#endregion
|
|
138
|
+
exports.accountNotMidasGreenlisted = accountNotMidasGreenlisted;
|
|
130
139
|
exports.creditManagerPaused = creditManagerPaused;
|
|
131
140
|
exports.debtOutOfRange = debtOutOfRange;
|
|
132
141
|
exports.forbiddenToken = forbiddenToken;
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -50,6 +50,7 @@ exports.SECURITIZE_REGISTER_VAULT_TYPES = require_model_rwa.SECURITIZE_REGISTER_
|
|
|
50
50
|
exports.STRATEGY_OPPORTUNITY_CHART_METRICS = require_model_charts.STRATEGY_OPPORTUNITY_CHART_METRICS;
|
|
51
51
|
exports.STRATEGY_POSITION_CHART_METRICS = require_model_charts.STRATEGY_POSITION_CHART_METRICS;
|
|
52
52
|
exports.STRATEGY_POSITION_COLLATERAL_ERROR = require_model_positions.STRATEGY_POSITION_COLLATERAL_ERROR;
|
|
53
|
+
exports.accountNotMidasGreenlisted = require_model_errors_operation_errors.accountNotMidasGreenlisted;
|
|
53
54
|
exports.amountSchema = require_model_primitives_schema.amountSchema;
|
|
54
55
|
exports.analyticsChartQueryOptionsSchema = require_model_analytics_schema.analyticsChartQueryOptionsSchema;
|
|
55
56
|
exports.analyticsChartQueryParamsSchema = require_model_analytics_schema.analyticsChartQueryParamsSchema;
|
|
@@ -223,6 +223,7 @@ const require_onchain_validation_bundles_checkIncreaseDebt = require("./validati
|
|
|
223
223
|
const require_onchain_validation_bundles_checkIncreaseQuota = require("./validation/bundles/checkIncreaseQuota.js");
|
|
224
224
|
const require_onchain_validation_bundles_checkMarket = require("./validation/bundles/checkMarket.js");
|
|
225
225
|
const require_onchain_validation_bundles_checkObtained = require("./validation/bundles/checkObtained.js");
|
|
226
|
+
const require_onchain_validation_bundles_checkMidasAccountGreenlist = require("./validation/bundles/checkMidasAccountGreenlist.js");
|
|
226
227
|
const require_onchain_validation_bundles_checkRWAOpenRequirements = require("./validation/bundles/checkRWAOpenRequirements.js");
|
|
227
228
|
const require_onchain_validation_bundles_checkRWAOpening = require("./validation/bundles/checkRWAOpening.js");
|
|
228
229
|
const require_onchain_validation_bundles_checkCreditOperation = require("./validation/bundles/checkCreditOperation.js");
|
|
@@ -293,6 +294,7 @@ const require_onchain_preview_preview_detectCloseOrRepay = require("./preview/pr
|
|
|
293
294
|
const require_onchain_preview_preview_detectDelayedClaim = require("./preview/preview/detectDelayedClaim.js");
|
|
294
295
|
const require_onchain_preview_preview_detectDelayedOperation = require("./preview/preview/detectDelayedOperation.js");
|
|
295
296
|
const require_onchain_preview_preview_estimateClaimableAt = require("./preview/preview/estimateClaimableAt.js");
|
|
297
|
+
const require_onchain_preview_preview_midasGreenlistsAccount = require("./preview/preview/midasGreenlistsAccount.js");
|
|
296
298
|
const require_onchain_preview_preview_previewAdjustStrategyPosition = require("./preview/preview/previewAdjustStrategyPosition.js");
|
|
297
299
|
const require_onchain_preview_preview_previewExitOrRepayStrategyPosition = require("./preview/preview/previewExitOrRepayStrategyPosition.js");
|
|
298
300
|
const require_onchain_preview_preview_replayInnerOperations = require("./preview/preview/replayInnerOperations.js");
|
|
@@ -576,6 +578,7 @@ exports.checkLiquidationFunding = require_onchain_validation_bundles_checkLiquid
|
|
|
576
578
|
exports.checkLiquidatorEligible = require_onchain_validation_checks_checkLiquidatorEligible.checkLiquidatorEligible;
|
|
577
579
|
exports.checkMarket = require_onchain_validation_bundles_checkMarket.checkMarket;
|
|
578
580
|
exports.checkMarketExpired = require_onchain_validation_checks_checkMarketExpired.checkMarketExpired;
|
|
581
|
+
exports.checkMidasAccountGreenlist = require_onchain_validation_bundles_checkMidasAccountGreenlist.checkMidasAccountGreenlist;
|
|
579
582
|
exports.checkObtained = require_onchain_validation_bundles_checkObtained.checkObtained;
|
|
580
583
|
exports.checkOperation = require_onchain_validation_checkOperation.checkOperation;
|
|
581
584
|
exports.checkPoolFunding = require_onchain_validation_bundles_checkPoolFunding.checkPoolFunding;
|
|
@@ -755,6 +758,7 @@ exports.json_stringify = require_onchain_utils_json.json_stringify;
|
|
|
755
758
|
exports.lidoV1_WETHGatewayAbi = require_onchain_market_adapters_abi_targetContractAbi.lidoV1_WETHGatewayAbi;
|
|
756
759
|
exports.makeReplayState = require_onchain_preview_preview_replayInnerOperations.makeReplayState;
|
|
757
760
|
exports.mellowDvvAdapterAbi = require_onchain_market_adapters_abi_adapters_mellowDvvAdapter.mellowDvvAdapterAbi;
|
|
761
|
+
exports.midasGreenlistsAccount = require_onchain_preview_preview_midasGreenlistsAccount.midasGreenlistsAccount;
|
|
758
762
|
exports.minSeizedAmount = require_onchain_market_math.minSeizedAmount;
|
|
759
763
|
exports.numberWithCommas = require_onchain_utils_formatter.numberWithCommas;
|
|
760
764
|
exports.onchainSDKOptionsSchema = require_onchain_options.onchainSDKOptionsSchema;
|
|
@@ -170,13 +170,21 @@ var MidasGatewayAdapterContract = class extends require_onchain_market_adapters_
|
|
|
170
170
|
return { redeemer };
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
+
* Whether `calldata` is `receiveGreenlist()`, the call that grants the
|
|
174
|
+
* Midas greenlisted role to the credit account.
|
|
175
|
+
*/
|
|
176
|
+
isReceiveGreenlist(calldata) {
|
|
177
|
+
return calldata === receiveGreenlistCalldata;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
173
180
|
* `receiveGreenlist()` is prepended by `prependMidasReceiveGreenlist`
|
|
174
181
|
* before the balance bracket when the multicall mints a permissioned
|
|
175
|
-
* mToken: it only
|
|
176
|
-
* so it is legal outside a bracket and
|
|
182
|
+
* mToken: it only grants the Midas greenlisted role to the credit
|
|
183
|
+
* account and is balance-neutral, so it is legal outside a bracket and
|
|
184
|
+
* leaves balances untouched.
|
|
177
185
|
*/
|
|
178
186
|
replayOutOfBracketCall(_balances, calldata) {
|
|
179
|
-
return calldata
|
|
187
|
+
return this.isReceiveGreenlist(calldata);
|
|
180
188
|
}
|
|
181
189
|
applyBalanceChanges(balances, decoded) {
|
|
182
190
|
switch (decoded.functionName) {
|
|
@@ -12,6 +12,7 @@ const require_onchain_preview_preview_detectCloseOrRepay = require("./preview/de
|
|
|
12
12
|
const require_onchain_preview_preview_detectDelayedClaim = require("./preview/detectDelayedClaim.js");
|
|
13
13
|
const require_onchain_preview_preview_detectDelayedOperation = require("./preview/detectDelayedOperation.js");
|
|
14
14
|
const require_onchain_preview_preview_estimateClaimableAt = require("./preview/estimateClaimableAt.js");
|
|
15
|
+
const require_onchain_preview_preview_midasGreenlistsAccount = require("./preview/midasGreenlistsAccount.js");
|
|
15
16
|
const require_onchain_preview_preview_previewAdjustStrategyPosition = require("./preview/previewAdjustStrategyPosition.js");
|
|
16
17
|
const require_onchain_preview_preview_previewExitOrRepayStrategyPosition = require("./preview/previewExitOrRepayStrategyPosition.js");
|
|
17
18
|
const require_onchain_preview_preview_replayInnerOperations = require("./preview/replayInnerOperations.js");
|
|
@@ -29,6 +30,7 @@ exports.isCloseOrRepay = require_onchain_preview_preview_detectCloseOrRepay.isCl
|
|
|
29
30
|
exports.isPoolOperation = require_onchain_preview_parse_types.isPoolOperation;
|
|
30
31
|
exports.isRWAOperation = require_onchain_preview_parse_types.isRWAOperation;
|
|
31
32
|
exports.makeReplayState = require_onchain_preview_preview_replayInnerOperations.makeReplayState;
|
|
33
|
+
exports.midasGreenlistsAccount = require_onchain_preview_preview_midasGreenlistsAccount.midasGreenlistsAccount;
|
|
32
34
|
exports.parseFacadeOperationCalldata = require_onchain_preview_parse_parseFacadeOperationCalldata.parseFacadeOperationCalldata;
|
|
33
35
|
exports.parseOperationCalldata = require_onchain_preview_parse_parseOperationCalldata.parseOperationCalldata;
|
|
34
36
|
exports.parsePoolOperationCalldata = require_onchain_preview_parse_parsePoolOperationCalldata.parsePoolOperationCalldata;
|
|
@@ -5,6 +5,7 @@ const require_onchain_preview_preview_detectCloseOrRepay = require("./detectClos
|
|
|
5
5
|
const require_onchain_preview_preview_detectDelayedClaim = require("./detectDelayedClaim.js");
|
|
6
6
|
const require_onchain_preview_preview_detectDelayedOperation = require("./detectDelayedOperation.js");
|
|
7
7
|
const require_onchain_preview_preview_estimateClaimableAt = require("./estimateClaimableAt.js");
|
|
8
|
+
const require_onchain_preview_preview_midasGreenlistsAccount = require("./midasGreenlistsAccount.js");
|
|
8
9
|
const require_onchain_preview_preview_previewAdjustStrategyPosition = require("./previewAdjustStrategyPosition.js");
|
|
9
10
|
const require_onchain_preview_preview_previewExitOrRepayStrategyPosition = require("./previewExitOrRepayStrategyPosition.js");
|
|
10
11
|
const require_onchain_preview_preview_replayInnerOperations = require("./replayInnerOperations.js");
|
|
@@ -18,6 +19,7 @@ exports.detectDelayedOperation = require_onchain_preview_preview_detectDelayedOp
|
|
|
18
19
|
exports.estimateClaimableAt = require_onchain_preview_preview_estimateClaimableAt.estimateClaimableAt;
|
|
19
20
|
exports.isCloseOrRepay = require_onchain_preview_preview_detectCloseOrRepay.isCloseOrRepay;
|
|
20
21
|
exports.makeReplayState = require_onchain_preview_preview_replayInnerOperations.makeReplayState;
|
|
22
|
+
exports.midasGreenlistsAccount = require_onchain_preview_preview_midasGreenlistsAccount.midasGreenlistsAccount;
|
|
21
23
|
exports.previewAdjustStrategyPosition = require_onchain_preview_preview_previewAdjustStrategyPosition.previewAdjustStrategyPosition;
|
|
22
24
|
exports.previewExitOrRepayStrategyPosition = require_onchain_preview_preview_previewExitOrRepayStrategyPosition.previewExitOrRepayStrategyPosition;
|
|
23
25
|
exports.previewOperation = require_onchain_preview_preview_previewOperation.previewOperation;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_onchain_market_adapters_contracts_MidasGatewayAdapterContract = require("../../market/adapters/contracts/MidasGatewayAdapterContract.js");
|
|
3
|
+
//#region src/onchain/preview/preview/midasGreenlistsAccount.ts
|
|
4
|
+
/**
|
|
5
|
+
* Whether the multicall grants the Midas greenlisted role to the credit
|
|
6
|
+
* account via `receiveGreenlist()`.
|
|
7
|
+
*/
|
|
8
|
+
function midasGreenlistsAccount(sdk, multicall) {
|
|
9
|
+
for (const op of multicall) {
|
|
10
|
+
if (op.operation !== "Execute") continue;
|
|
11
|
+
const adapter = sdk.getContract(op.adapter);
|
|
12
|
+
if (adapter instanceof require_onchain_market_adapters_contracts_MidasGatewayAdapterContract.MidasGatewayAdapterContract && adapter.isReceiveGreenlist(op.calldata)) return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.midasGreenlistsAccount = midasGreenlistsAccount;
|
|
@@ -3,6 +3,7 @@ const require_onchain_constants_address_provider = require("../../constants/addr
|
|
|
3
3
|
const require_model_previews = require("../../../model/previews.js");
|
|
4
4
|
const require_model_result = require("../../../model/result.js");
|
|
5
5
|
require("../../../model/index.js");
|
|
6
|
+
const require_onchain_preview_preview_midasGreenlistsAccount = require("./midasGreenlistsAccount.js");
|
|
6
7
|
const require_onchain_preview_preview_unwrapNativeCollateral = require("./unwrapNativeCollateral.js");
|
|
7
8
|
//#region src/onchain/preview/preview/previewOpenStrategyPosition.ts
|
|
8
9
|
function previewOpenStrategyPosition(sdk, input, operation, replay) {
|
|
@@ -33,7 +34,8 @@ function previewOpenStrategyPosition(sdk, input, operation, replay) {
|
|
|
33
34
|
...projection,
|
|
34
35
|
operation: "OpenCreditAccount",
|
|
35
36
|
...operation.operation === "MultiCall" || operation.operation === "BotMulticall" || operation.operation === "RWAMulticall" ? { creditAccount: operation.creditAccount } : {},
|
|
36
|
-
..."args" in operation ? { rwaArgs: operation.args } : {}
|
|
37
|
+
..."args" in operation ? { rwaArgs: operation.args } : {},
|
|
38
|
+
midasGreenlistsAccount: require_onchain_preview_preview_midasGreenlistsAccount.midasGreenlistsAccount(sdk, operation.multicall)
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_errors_operation_errors = require("../../../model/errors/operation-errors.js");
|
|
3
|
+
const require_model_errors_prepare_errors = require("../../../model/errors/prepare-errors.js");
|
|
4
|
+
require("../../../model/index.js");
|
|
5
|
+
const require_onchain_validation_helpers_token = require("../helpers/token.js");
|
|
6
|
+
require("../helpers/index.js");
|
|
7
|
+
//#region src/onchain/validation/bundles/checkMidasAccountGreenlist.ts
|
|
8
|
+
/**
|
|
9
|
+
* Whether the credit account already holds the Midas greenlisted role
|
|
10
|
+
* this permissioned mToken requires of its holder, or the transaction
|
|
11
|
+
* grants it via `receiveGreenlist()`.
|
|
12
|
+
*/
|
|
13
|
+
async function checkMidasAccountGreenlist(input) {
|
|
14
|
+
const { sdk, preview, nft, tokens } = input;
|
|
15
|
+
if (nft.protocol !== "midas") return [];
|
|
16
|
+
if (preview.midasGreenlistsAccount) return [];
|
|
17
|
+
if (tokens.length === 0) return [];
|
|
18
|
+
const account = preview.creditAccount;
|
|
19
|
+
if (!account) return tokens.map((token) => require_model_errors_operation_errors.accountNotMidasGreenlisted({
|
|
20
|
+
token: require_onchain_validation_helpers_token.toToken(sdk, token),
|
|
21
|
+
creditManager: preview.creditManager
|
|
22
|
+
}));
|
|
23
|
+
return (await Promise.all(tokens.map((token) => checkAccountRole({
|
|
24
|
+
sdk,
|
|
25
|
+
nft,
|
|
26
|
+
account,
|
|
27
|
+
token,
|
|
28
|
+
preview
|
|
29
|
+
})))).flat();
|
|
30
|
+
}
|
|
31
|
+
async function checkAccountRole(input) {
|
|
32
|
+
const { sdk, nft, account, token, preview } = input;
|
|
33
|
+
try {
|
|
34
|
+
const requirements = await nft.getOpenAccountRequirements(account, { tokenOutAddress: token });
|
|
35
|
+
if (nft.isRegistered(requirements)) return [];
|
|
36
|
+
return [require_model_errors_operation_errors.accountNotMidasGreenlisted({
|
|
37
|
+
token: require_onchain_validation_helpers_token.toToken(sdk, token),
|
|
38
|
+
creditManager: preview.creditManager,
|
|
39
|
+
creditAccount: account
|
|
40
|
+
})];
|
|
41
|
+
} catch (cause) {
|
|
42
|
+
return [require_model_errors_prepare_errors.unexpectedFailure(cause, "read the Midas account greenlist")];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.checkMidasAccountGreenlist = checkMidasAccountGreenlist;
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_utils_AddressSet = require("../../utils/AddressSet.js");
|
|
3
|
+
const require_onchain_validation_bundles_checkMidasAccountGreenlist = require("./checkMidasAccountGreenlist.js");
|
|
3
4
|
const require_onchain_validation_bundles_checkRWAOpenRequirements = require("./checkRWAOpenRequirements.js");
|
|
4
5
|
//#region src/onchain/validation/bundles/checkRWAOpening.ts
|
|
5
6
|
/**
|
|
6
7
|
* Per KYC-gated token among `collateralAdded ∪ quotas`, whether the
|
|
7
|
-
* borrower still has to register or sign before this opening can land
|
|
8
|
+
* borrower still has to register or sign before this opening can land,
|
|
9
|
+
* and whether a Midas credit account may hold the mToken.
|
|
8
10
|
*/
|
|
9
11
|
async function checkRWAOpening(input) {
|
|
10
12
|
const { sdk, preview, sender } = input;
|
|
11
13
|
const nft = await sdk.marketRegister.findCreditManager(preview.creditManager).degenNFT();
|
|
12
14
|
if (!nft) return [];
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const nftTokens = new require_onchain_utils_AddressSet.AddressSet(await nft.getTokens());
|
|
16
|
+
let candidates = new require_onchain_utils_AddressSet.AddressSet([...preview.collateralAdded.map((a) => a.token.address), ...preview.quotas.map((q) => q.token.address)]).asArray();
|
|
17
|
+
candidates = candidates.filter((token) => nftTokens.has(token));
|
|
18
|
+
let tokensToCheck = candidates;
|
|
19
|
+
if (tokensToCheck.length === 0 && !preview.creditAccount && nft.protocol === "midas") tokensToCheck = nftTokens.asArray();
|
|
20
|
+
return (await Promise.all([...tokensToCheck.map((token) => require_onchain_validation_bundles_checkRWAOpenRequirements.checkRWAOpenRequirements({
|
|
16
21
|
sdk,
|
|
17
22
|
wallet: sender,
|
|
18
23
|
creditManager: preview.creditManager,
|
|
19
24
|
token,
|
|
20
25
|
providedArgs: preview.rwaArgs
|
|
21
|
-
}))
|
|
26
|
+
})), require_onchain_validation_bundles_checkMidasAccountGreenlist.checkMidasAccountGreenlist({
|
|
27
|
+
sdk,
|
|
28
|
+
preview,
|
|
29
|
+
nft,
|
|
30
|
+
tokens: candidates
|
|
31
|
+
})])).flat();
|
|
22
32
|
}
|
|
23
33
|
//#endregion
|
|
24
34
|
exports.checkRWAOpening = checkRWAOpening;
|
|
@@ -8,6 +8,7 @@ const require_onchain_validation_bundles_checkIncreaseDebt = require("./checkInc
|
|
|
8
8
|
const require_onchain_validation_bundles_checkIncreaseQuota = require("./checkIncreaseQuota.js");
|
|
9
9
|
const require_onchain_validation_bundles_checkMarket = require("./checkMarket.js");
|
|
10
10
|
const require_onchain_validation_bundles_checkObtained = require("./checkObtained.js");
|
|
11
|
+
const require_onchain_validation_bundles_checkMidasAccountGreenlist = require("./checkMidasAccountGreenlist.js");
|
|
11
12
|
const require_onchain_validation_bundles_checkRWAOpenRequirements = require("./checkRWAOpenRequirements.js");
|
|
12
13
|
const require_onchain_validation_bundles_checkRWAOpening = require("./checkRWAOpening.js");
|
|
13
14
|
const require_onchain_validation_bundles_checkCreditOperation = require("./checkCreditOperation.js");
|
|
@@ -25,6 +26,7 @@ exports.checkIncreaseQuota = require_onchain_validation_bundles_checkIncreaseQuo
|
|
|
25
26
|
exports.checkLiquidationEligibility = require_onchain_validation_bundles_checkLiquidationEligibility.checkLiquidationEligibility;
|
|
26
27
|
exports.checkLiquidationFunding = require_onchain_validation_bundles_checkLiquidationFunding.checkLiquidationFunding;
|
|
27
28
|
exports.checkMarket = require_onchain_validation_bundles_checkMarket.checkMarket;
|
|
29
|
+
exports.checkMidasAccountGreenlist = require_onchain_validation_bundles_checkMidasAccountGreenlist.checkMidasAccountGreenlist;
|
|
28
30
|
exports.checkObtained = require_onchain_validation_bundles_checkObtained.checkObtained;
|
|
29
31
|
exports.checkPoolFunding = require_onchain_validation_bundles_checkPoolFunding.checkPoolFunding;
|
|
30
32
|
exports.checkPoolOperation = require_onchain_validation_bundles_checkPoolOperation.checkPoolOperation;
|
|
@@ -29,6 +29,7 @@ const require_onchain_validation_bundles_checkIncreaseDebt = require("./bundles/
|
|
|
29
29
|
const require_onchain_validation_bundles_checkIncreaseQuota = require("./bundles/checkIncreaseQuota.js");
|
|
30
30
|
const require_onchain_validation_bundles_checkMarket = require("./bundles/checkMarket.js");
|
|
31
31
|
const require_onchain_validation_bundles_checkObtained = require("./bundles/checkObtained.js");
|
|
32
|
+
const require_onchain_validation_bundles_checkMidasAccountGreenlist = require("./bundles/checkMidasAccountGreenlist.js");
|
|
32
33
|
const require_onchain_validation_bundles_checkRWAOpenRequirements = require("./bundles/checkRWAOpenRequirements.js");
|
|
33
34
|
const require_onchain_validation_bundles_checkRWAOpening = require("./bundles/checkRWAOpening.js");
|
|
34
35
|
const require_onchain_validation_bundles_checkCreditOperation = require("./bundles/checkCreditOperation.js");
|
|
@@ -67,6 +68,7 @@ exports.checkLiquidationFunding = require_onchain_validation_bundles_checkLiquid
|
|
|
67
68
|
exports.checkLiquidatorEligible = require_onchain_validation_checks_checkLiquidatorEligible.checkLiquidatorEligible;
|
|
68
69
|
exports.checkMarket = require_onchain_validation_bundles_checkMarket.checkMarket;
|
|
69
70
|
exports.checkMarketExpired = require_onchain_validation_checks_checkMarketExpired.checkMarketExpired;
|
|
71
|
+
exports.checkMidasAccountGreenlist = require_onchain_validation_bundles_checkMidasAccountGreenlist.checkMidasAccountGreenlist;
|
|
70
72
|
exports.checkObtained = require_onchain_validation_bundles_checkObtained.checkObtained;
|
|
71
73
|
exports.checkOperation = require_onchain_validation_checkOperation.checkOperation;
|
|
72
74
|
exports.checkPoolFunding = require_onchain_validation_bundles_checkPoolFunding.checkPoolFunding;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { writeAndWait } from "./kycUtils.js";
|
|
2
|
-
import { parseAbi, parseEther } from "viem";
|
|
2
|
+
import { parseAbi, parseEther, toFunctionSelector } from "viem";
|
|
3
3
|
//#region src/dev/midasUtils.ts
|
|
4
4
|
/**
|
|
5
5
|
* Midas vaults inherit their own `Pausable`, whose global pause is guarded by
|
|
@@ -9,14 +9,24 @@ const iMidasPausableVaultAbi = parseAbi([
|
|
|
9
9
|
"function paused() external view returns (bool)",
|
|
10
10
|
"function pause() external",
|
|
11
11
|
"function unpause() external",
|
|
12
|
+
"function fnPaused(bytes4 fn) external view returns (bool)",
|
|
13
|
+
"function pauseFn(bytes4 fn) external",
|
|
14
|
+
"function unpauseFn(bytes4 fn) external",
|
|
12
15
|
"function pauseAdminRole() external view returns (bytes32)",
|
|
13
16
|
"function accessControl() external view returns (address)"
|
|
14
17
|
]);
|
|
15
18
|
const iMidasAccessControlAbi = parseAbi(["function hasRole(bytes32 role, address account) external view returns (bool)", "function grantRole(bytes32 role, address account) external"]);
|
|
16
19
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
+
* Selector for `DepositVault.depositInstant(address,uint256,uint256,bytes32)`,
|
|
21
|
+
* the 4-arg mint Gearbox adapters encode. Distinct from the custom-recipient
|
|
22
|
+
* overload.
|
|
23
|
+
*/
|
|
24
|
+
const DEPOSIT_INSTANT_SELECTOR = toFunctionSelector("depositInstant(address,uint256,uint256,bytes32)");
|
|
25
|
+
/**
|
|
26
|
+
* Unpauses a Midas issuance vault on an anvil fork so that `depositInstant`
|
|
27
|
+
* stops reverting with `Pausable: paused` (global) or `Pausable: fn paused`
|
|
28
|
+
* (per-selector), and returns a callback that restores the original pause
|
|
29
|
+
* state of each layer that was cleared.
|
|
20
30
|
*
|
|
21
31
|
* Impersonates `admin` and grants it `pauseAdminRole()` when missing, same as
|
|
22
32
|
* `greenlistMidasGateway` does with the greenlist roles. The grant is not
|
|
@@ -24,11 +34,20 @@ const iMidasAccessControlAbi = parseAbi(["function hasRole(bytes32 role, address
|
|
|
24
34
|
*/
|
|
25
35
|
async function unpauseMidasIssuanceVault(props) {
|
|
26
36
|
const { anvil, vault, admin, logger } = props;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
const [paused, depositInstantPaused] = await anvil.multicall({
|
|
38
|
+
allowFailure: false,
|
|
39
|
+
contracts: [{
|
|
40
|
+
address: vault,
|
|
41
|
+
abi: iMidasPausableVaultAbi,
|
|
42
|
+
functionName: "paused"
|
|
43
|
+
}, {
|
|
44
|
+
address: vault,
|
|
45
|
+
abi: iMidasPausableVaultAbi,
|
|
46
|
+
functionName: "fnPaused",
|
|
47
|
+
args: [DEPOSIT_INSTANT_SELECTOR]
|
|
48
|
+
}]
|
|
49
|
+
});
|
|
50
|
+
if (!paused && !depositInstantPaused) {
|
|
32
51
|
logger?.debug(`midas: issuance vault ${vault} is not paused`);
|
|
33
52
|
return async () => {};
|
|
34
53
|
}
|
|
@@ -50,7 +69,7 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
50
69
|
functionName: "hasRole",
|
|
51
70
|
args: [pauseAdminRole, admin]
|
|
52
71
|
});
|
|
53
|
-
logger?.debug(`midas: unpausing issuance vault ${vault} as ${admin}, access control ${accessControl}, pause admin role ${pauseAdminRole}`);
|
|
72
|
+
logger?.debug(`midas: unpausing issuance vault ${vault} as ${admin}, access control ${accessControl}, pause admin role ${pauseAdminRole}` + (paused ? ", global" : "") + (depositInstantPaused ? ", depositInstant" : ""));
|
|
54
73
|
await anvil.impersonateAccount({ address: admin });
|
|
55
74
|
try {
|
|
56
75
|
await anvil.setBalance({
|
|
@@ -68,13 +87,21 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
68
87
|
});
|
|
69
88
|
logger?.debug(`midas: granted pause admin role to ${admin}`);
|
|
70
89
|
}
|
|
71
|
-
await writeAndWait(anvil, {
|
|
90
|
+
if (paused) await writeAndWait(anvil, {
|
|
72
91
|
account: admin,
|
|
73
92
|
chain: anvil.chain,
|
|
74
93
|
address: vault,
|
|
75
94
|
abi: iMidasPausableVaultAbi,
|
|
76
95
|
functionName: "unpause"
|
|
77
96
|
});
|
|
97
|
+
if (depositInstantPaused) await writeAndWait(anvil, {
|
|
98
|
+
account: admin,
|
|
99
|
+
chain: anvil.chain,
|
|
100
|
+
address: vault,
|
|
101
|
+
abi: iMidasPausableVaultAbi,
|
|
102
|
+
functionName: "unpauseFn",
|
|
103
|
+
args: [DEPOSIT_INSTANT_SELECTOR]
|
|
104
|
+
});
|
|
78
105
|
} finally {
|
|
79
106
|
await anvil.stopImpersonatingAccount({ address: admin });
|
|
80
107
|
}
|
|
@@ -89,13 +116,21 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
89
116
|
address: admin,
|
|
90
117
|
value: parseEther("100")
|
|
91
118
|
});
|
|
92
|
-
await writeAndWait(anvil, {
|
|
119
|
+
if (paused) await writeAndWait(anvil, {
|
|
93
120
|
account: admin,
|
|
94
121
|
chain: anvil.chain,
|
|
95
122
|
address: vault,
|
|
96
123
|
abi: iMidasPausableVaultAbi,
|
|
97
124
|
functionName: "pause"
|
|
98
125
|
});
|
|
126
|
+
if (depositInstantPaused) await writeAndWait(anvil, {
|
|
127
|
+
account: admin,
|
|
128
|
+
chain: anvil.chain,
|
|
129
|
+
address: vault,
|
|
130
|
+
abi: iMidasPausableVaultAbi,
|
|
131
|
+
functionName: "pauseFn",
|
|
132
|
+
args: [DEPOSIT_INSTANT_SELECTOR]
|
|
133
|
+
});
|
|
99
134
|
} catch (e) {
|
|
100
135
|
logger?.warn(`midas: failed to pause issuance vault ${vault} back: ${e}`);
|
|
101
136
|
} finally {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./base.js";
|
|
2
2
|
import { creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./liquidation-errors.js";
|
|
3
|
-
import { creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet } from "./operation-errors.js";
|
|
3
|
+
import { accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, 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 { creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
7
|
+
export { accountNotMidasGreenlisted, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
@@ -125,5 +125,13 @@ function rwaOpenRequirementsNotMet(args) {
|
|
|
125
125
|
...args
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
+
/** {@inheritDoc AccountNotMidasGreenlistedError} */
|
|
129
|
+
function accountNotMidasGreenlisted(args) {
|
|
130
|
+
return {
|
|
131
|
+
code: "accountNotMidasGreenlisted",
|
|
132
|
+
message: `The credit account is not Midas-greenlisted for ${args.token.symbol}.`,
|
|
133
|
+
...args
|
|
134
|
+
};
|
|
135
|
+
}
|
|
128
136
|
//#endregion
|
|
129
|
-
export { creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet };
|
|
137
|
+
export { accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet };
|
package/dist/esm/model/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analy
|
|
|
15
15
|
import "./curators.js";
|
|
16
16
|
import "./delayed-intents.js";
|
|
17
17
|
import { creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./errors/liquidation-errors.js";
|
|
18
|
-
import { creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
18
|
+
import { accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
19
19
|
import { unpriceableTokenError } from "./errors/oracle-errors.js";
|
|
20
20
|
import { creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
|
|
21
21
|
import { malformedTransaction } from "./errors/preview-errors.js";
|
|
@@ -32,4 +32,4 @@ import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourc
|
|
|
32
32
|
import { safeValue, sdkErr, sdkOk } from "./result.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, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|
|
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, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|