@gearbox-protocol/sdk 16.3.0-next.2 → 16.3.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/model/errors/index.js +0 -1
- package/dist/cjs/model/errors/operation-errors.js +1 -1
- package/dist/cjs/model/errors/prepare-errors.js +0 -8
- package/dist/cjs/model/index.js +2 -3
- package/dist/cjs/model/rwa.js +4 -4
- package/dist/cjs/model/rwa.schema.js +4 -4
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +1 -3
- package/dist/cjs/onchain/accounts/intents/guards.js +4 -4
- package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/cjs/onchain/market/credit/CreditSuite.js +26 -12
- package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +56 -12
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
- package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
- package/dist/cjs/onchain/opportunities/OpportunitiesService.js +16 -4
- package/dist/cjs/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +3 -2
- package/dist/cjs/onchain/validation/bundles/checkDraw.js +3 -3
- package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
- package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +6 -5
- package/dist/cjs/onchain/validation/checkSimulation.js +11 -14
- package/dist/cjs/onchain/validation/checks/checkDebtLimits.js +3 -2
- package/dist/cjs/sdk/execute/ExecuteApi.js +2 -2
- package/dist/cjs/sdk/index.js +0 -1
- package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +9 -3
- package/dist/cjs/sdk/prepare/PrepareApi.js +27 -8
- package/dist/cjs/sdk/prepare/index.js +0 -1
- package/dist/esm/model/errors/index.js +2 -2
- package/dist/esm/model/errors/operation-errors.js +1 -1
- package/dist/esm/model/errors/prepare-errors.js +1 -8
- package/dist/esm/model/index.js +4 -4
- package/dist/esm/model/rwa.js +4 -4
- package/dist/esm/model/rwa.schema.js +5 -5
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +1 -3
- package/dist/esm/onchain/accounts/intents/guards.js +4 -4
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/market/credit/CreditSuite.js +26 -12
- package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +55 -10
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
- package/dist/esm/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
- package/dist/esm/onchain/opportunities/OpportunitiesService.js +16 -4
- package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +3 -2
- package/dist/esm/onchain/validation/bundles/checkDraw.js +3 -3
- package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
- package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +6 -5
- package/dist/esm/onchain/validation/checkSimulation.js +11 -14
- package/dist/esm/onchain/validation/checks/checkDebtLimits.js +3 -2
- package/dist/esm/sdk/execute/ExecuteApi.js +2 -2
- package/dist/esm/sdk/index.js +2 -2
- package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +9 -3
- package/dist/esm/sdk/prepare/PrepareApi.js +28 -9
- package/dist/esm/sdk/prepare/index.js +2 -2
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +10 -4
- package/dist/types/model/errors/prepare-errors.d.ts +1 -10
- package/dist/types/model/index.d.ts +4 -4
- package/dist/types/model/opportunities.d.ts +4 -5
- package/dist/types/model/rwa.d.ts +47 -27
- package/dist/types/model/rwa.schema.d.ts +3 -3
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -2
- package/dist/types/offchain/opportunities/types.d.ts +1 -4
- package/dist/types/onchain/accounts/types.d.ts +4 -2
- package/dist/types/onchain/index.d.ts +3 -3
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +8 -3
- package/dist/types/onchain/market/credit/types.d.ts +2 -2
- package/dist/types/onchain/market/index.d.ts +2 -2
- package/dist/types/onchain/market/rwa/index.d.ts +2 -2
- package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +19 -4
- package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +24 -4
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +2 -14
- package/dist/types/onchain/market/rwa/types.d.ts +39 -37
- package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +5 -1
- package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +10 -3
- package/dist/types/onchain/opportunities/types.d.ts +6 -1
- package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +3 -3
- package/dist/types/onchain/validation/checkSimulation.d.ts +9 -20
- package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +4 -0
- package/dist/types/onchain/validation/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +4 -3
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +5 -1
- package/dist/types/sdk/opportunities/types.d.ts +9 -3
- package/dist/types/sdk/prepare/PrepareApi.d.ts +6 -5
- package/dist/types/sdk/prepare/index.d.ts +4 -3
- package/dist/types/sdk/prepare/types.d.ts +47 -21
- package/package.json +1 -1
|
@@ -10,7 +10,6 @@ exports.creditAccountNotEmpty = require_model_errors_prepare_errors.creditAccoun
|
|
|
10
10
|
exports.creditAccountNotFound = require_model_errors_prepare_errors.creditAccountNotFound;
|
|
11
11
|
exports.creditManagerPaused = require_model_errors_operation_errors.creditManagerPaused;
|
|
12
12
|
exports.debtOutOfRange = require_model_errors_operation_errors.debtOutOfRange;
|
|
13
|
-
exports.emptyOpenTakesNothing = require_model_errors_prepare_errors.emptyOpenTakesNothing;
|
|
14
13
|
exports.forbiddenToken = require_model_errors_operation_errors.forbiddenToken;
|
|
15
14
|
exports.insufficientAllowance = require_model_errors_operation_errors.insufficientAllowance;
|
|
16
15
|
exports.insufficientBalance = require_model_errors_operation_errors.insufficientBalance;
|
|
@@ -114,7 +114,7 @@ function insufficientAllowance(args) {
|
|
|
114
114
|
function rwaOpenRequirementsNotMet(args) {
|
|
115
115
|
return {
|
|
116
116
|
code: "rwaOpenRequirementsNotMet",
|
|
117
|
-
message:
|
|
117
|
+
message: `${args.protocol} still wants something from the borrower before ${args.token.symbol} can be opened on.`,
|
|
118
118
|
...args
|
|
119
119
|
};
|
|
120
120
|
}
|
|
@@ -73,13 +73,6 @@ function creditAccountNotEmpty(creditAccount) {
|
|
|
73
73
|
creditAccount
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
/** {@inheritDoc EmptyOpenTakesNothingError} */
|
|
77
|
-
function emptyOpenTakesNothing() {
|
|
78
|
-
return {
|
|
79
|
-
code: "emptyOpenTakesNothing",
|
|
80
|
-
message: "An empty opening takes no collateral, no account to reuse and no leverage."
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
76
|
/**
|
|
84
77
|
* {@inheritDoc UnexpectedFailureError}
|
|
85
78
|
*
|
|
@@ -97,7 +90,6 @@ function unexpectedFailure(thrown, action = "prepare this operation") {
|
|
|
97
90
|
//#endregion
|
|
98
91
|
exports.creditAccountNotEmpty = creditAccountNotEmpty;
|
|
99
92
|
exports.creditAccountNotFound = creditAccountNotFound;
|
|
100
|
-
exports.emptyOpenTakesNothing = emptyOpenTakesNothing;
|
|
101
93
|
exports.multipleDelayedWithdrawals = multipleDelayedWithdrawals;
|
|
102
94
|
exports.noDelayedRoute = noDelayedRoute;
|
|
103
95
|
exports.noRecordedIntent = noRecordedIntent;
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -39,13 +39,13 @@ exports.CHART_METRIC_UNITS = require_model_charts.CHART_METRIC_UNITS;
|
|
|
39
39
|
exports.CHART_RANGES = require_model_charts.CHART_RANGES;
|
|
40
40
|
exports.CHART_UNAVAILABLE_CODES = require_model_charts.CHART_UNAVAILABLE_CODES;
|
|
41
41
|
exports.FILTER_ALL = require_model_filters.FILTER_ALL;
|
|
42
|
-
exports.KYC_PROTOCOLS = require_model_rwa.KYC_PROTOCOLS;
|
|
43
42
|
exports.KYC_REGISTRATION_LINKS = require_model_rwa.KYC_REGISTRATION_LINKS;
|
|
44
43
|
exports.POOL_OPPORTUNITY_CHART_METRICS = require_model_charts.POOL_OPPORTUNITY_CHART_METRICS;
|
|
45
44
|
exports.POOL_POSITION_CHART_METRICS = require_model_charts.POOL_POSITION_CHART_METRICS;
|
|
46
45
|
exports.PROTOCOL_CHART_METRICS = require_model_charts.PROTOCOL_CHART_METRICS;
|
|
47
46
|
exports.RWA_FACTORY_SECURITIZE = require_model_rwa.RWA_FACTORY_SECURITIZE;
|
|
48
47
|
exports.RWA_FACTORY_TYPES = require_model_rwa.RWA_FACTORY_TYPES;
|
|
48
|
+
exports.RWA_PROTOCOLS = require_model_rwa.RWA_PROTOCOLS;
|
|
49
49
|
exports.SECURITIZE_REGISTER_VAULT_TYPES = require_model_rwa.SECURITIZE_REGISTER_VAULT_TYPES;
|
|
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;
|
|
@@ -92,7 +92,6 @@ exports.curatorSchema = require_model_curators_schema.curatorSchema;
|
|
|
92
92
|
exports.dataSourceSchema = require_model_response_schema.dataSourceSchema;
|
|
93
93
|
exports.debtOutOfRange = require_model_errors_operation_errors.debtOutOfRange;
|
|
94
94
|
exports.delayedReceivedAssetSchema = require_model_liquidations_schema.delayedReceivedAssetSchema;
|
|
95
|
-
exports.emptyOpenTakesNothing = require_model_errors_prepare_errors.emptyOpenTakesNothing;
|
|
96
95
|
exports.encodeFlag = require_model_filters_schema.encodeFlag;
|
|
97
96
|
exports.filterAllSchema = require_model_filters_schema.filterAllSchema;
|
|
98
97
|
exports.filterable = require_model_filters_schema.filterable;
|
|
@@ -103,7 +102,6 @@ exports.insufficientBalance = require_model_errors_operation_errors.insufficient
|
|
|
103
102
|
exports.insufficientCollateral = require_model_errors_operation_errors.insufficientCollateral;
|
|
104
103
|
exports.insufficientPoolLiquidity = require_model_errors_operation_errors.insufficientPoolLiquidity;
|
|
105
104
|
exports.isFilterSet = require_model_filters.isFilterSet;
|
|
106
|
-
exports.kycProtocolSchema = require_model_rwa_schema.kycProtocolSchema;
|
|
107
105
|
exports.kycRequirementSchema = require_model_rwa_schema.kycRequirementSchema;
|
|
108
106
|
exports.leverageOutOfRange = require_model_errors_operation_errors.leverageOutOfRange;
|
|
109
107
|
exports.leverageSchema = require_model_primitives_schema.leverageSchema;
|
|
@@ -182,6 +180,7 @@ exports.responseSchema = require_model_response_schema.responseSchema;
|
|
|
182
180
|
exports.rewardsPnLSchema = require_model_positions_schema.rewardsPnLSchema;
|
|
183
181
|
exports.rewardsSchema = require_model_opportunities_schema.rewardsSchema;
|
|
184
182
|
exports.rwaOpenRequirementsNotMet = require_model_errors_operation_errors.rwaOpenRequirementsNotMet;
|
|
183
|
+
exports.rwaProtocolSchema = require_model_rwa_schema.rwaProtocolSchema;
|
|
185
184
|
exports.safeValue = require_model_result.safeValue;
|
|
186
185
|
exports.sdkErr = require_model_result.sdkErr;
|
|
187
186
|
exports.sdkOk = require_model_result.sdkOk;
|
package/dist/cjs/model/rwa.js
CHANGED
|
@@ -35,19 +35,19 @@ const SECURITIZE_REGISTER_VAULT_TYPES = { RegisterVault: [
|
|
|
35
35
|
}
|
|
36
36
|
] };
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* RWA protocols that require dedicated flows
|
|
39
39
|
**/
|
|
40
|
-
const
|
|
40
|
+
const RWA_PROTOCOLS = ["securitize", "midas"];
|
|
41
41
|
/**
|
|
42
|
-
* Hardcoded registration URLs for each {@link
|
|
42
|
+
* Hardcoded registration URLs for each {@link RWAProtocol}.
|
|
43
43
|
**/
|
|
44
44
|
const KYC_REGISTRATION_LINKS = {
|
|
45
45
|
securitize: "https://securitize.io/",
|
|
46
46
|
midas: "https://form.typeform.com/to/DqZaw6kr"
|
|
47
47
|
};
|
|
48
48
|
//#endregion
|
|
49
|
-
exports.KYC_PROTOCOLS = KYC_PROTOCOLS;
|
|
50
49
|
exports.KYC_REGISTRATION_LINKS = KYC_REGISTRATION_LINKS;
|
|
51
50
|
exports.RWA_FACTORY_SECURITIZE = RWA_FACTORY_SECURITIZE;
|
|
52
51
|
exports.RWA_FACTORY_TYPES = RWA_FACTORY_TYPES;
|
|
52
|
+
exports.RWA_PROTOCOLS = RWA_PROTOCOLS;
|
|
53
53
|
exports.SECURITIZE_REGISTER_VAULT_TYPES = SECURITIZE_REGISTER_VAULT_TYPES;
|
|
@@ -4,17 +4,17 @@ const require_model_rwa = require("./rwa.js");
|
|
|
4
4
|
let zod_v4 = require("zod/v4");
|
|
5
5
|
//#region src/model/rwa.schema.ts
|
|
6
6
|
/**
|
|
7
|
-
* {@link ./rwa.js#
|
|
7
|
+
* {@link ./rwa.js#RWAProtocol}
|
|
8
8
|
**/
|
|
9
|
-
const
|
|
9
|
+
const rwaProtocolSchema = zod_v4.z.enum(require_model_rwa.RWA_PROTOCOLS);
|
|
10
10
|
/**
|
|
11
11
|
* {@link ./rwa.js#KycRequirement}
|
|
12
12
|
**/
|
|
13
13
|
const kycRequirementSchema = zod_v4.z.object({
|
|
14
|
-
protocol:
|
|
14
|
+
protocol: rwaProtocolSchema,
|
|
15
15
|
token: require_model_primitives_schema.tokenSchema.optional(),
|
|
16
16
|
registrationLink: zod_v4.z.string()
|
|
17
17
|
});
|
|
18
18
|
//#endregion
|
|
19
|
-
exports.kycProtocolSchema = kycProtocolSchema;
|
|
20
19
|
exports.kycRequirementSchema = kycRequirementSchema;
|
|
20
|
+
exports.rwaProtocolSchema = rwaProtocolSchema;
|
|
@@ -36,7 +36,7 @@ var OffchainOpportunities = class extends require_offchain_AbstractOffchainNames
|
|
|
36
36
|
/**
|
|
37
37
|
* {@inheritDoc IOffchainOpportunities.getStrategy}
|
|
38
38
|
**/
|
|
39
|
-
async getStrategy(key
|
|
39
|
+
async getStrategy(key) {
|
|
40
40
|
return this.get({
|
|
41
41
|
path: this.#strategyPath(key),
|
|
42
42
|
schema: require_model_opportunities_schema.strategyOpportunityDetailSchema
|
|
@@ -189,9 +189,7 @@ var CreditAccountsServiceV310 = class extends require_onchain_base_SDKConstruct.
|
|
|
189
189
|
* {@inheritDoc ICreditAccountsService.getOpenAccountRequirements}
|
|
190
190
|
*/
|
|
191
191
|
async getOpenAccountRequirements(borrower, creditManager, props) {
|
|
192
|
-
|
|
193
|
-
if (!rwaFactory) return;
|
|
194
|
-
return rwaFactory.getOpenAccountRequirements(borrower, props);
|
|
192
|
+
return (await this.sdk.marketRegister.findCreditManager(creditManager).degenNFT())?.getOpenAccountRequirements(borrower, props);
|
|
195
193
|
}
|
|
196
194
|
/**
|
|
197
195
|
* {@inheritDoc ICreditAccountsService.openCA}
|
|
@@ -44,13 +44,13 @@ function assertMarketOperable(suite) {
|
|
|
44
44
|
}
|
|
45
45
|
/** The pool has to be able to lend what the plan means to draw. */
|
|
46
46
|
function assertCanBorrow(sdk, suite, amount) {
|
|
47
|
-
const
|
|
47
|
+
const maxBorrowAmount = suite.maxBorrowAmount();
|
|
48
48
|
require_onchain_validation_raise.raise(require_onchain_validation_checks_checkBorrowLimit.checkBorrowLimit({
|
|
49
49
|
requested: amount,
|
|
50
|
-
available: value,
|
|
51
|
-
limit,
|
|
50
|
+
available: maxBorrowAmount.amount.value,
|
|
51
|
+
limit: maxBorrowAmount.limit,
|
|
52
52
|
underlying: require_onchain_validation_helpers_token.toToken(sdk, suite.market.pool.underlying)
|
|
53
|
-
}), `borrow: ${amount} exceeds what the pool can lend now (${value})`);
|
|
53
|
+
}), `borrow: ${amount} exceeds what the pool can lend now (${maxBorrowAmount.amount.value})`);
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* What the account is allowed to end up holding more of than it started with.
|
|
@@ -10,9 +10,9 @@ require("../../utils/index.js");
|
|
|
10
10
|
const require_onchain_base_SDKConstruct = require("../../base/SDKConstruct.js");
|
|
11
11
|
require("../../base/index.js");
|
|
12
12
|
const require_onchain_market_math = require("../../market/math.js");
|
|
13
|
+
const require_onchain_market_rwa_midas_constants = require("../../market/rwa/midas/constants.js");
|
|
13
14
|
const require_model_liquidations = require("../../../model/liquidations.js");
|
|
14
15
|
require("../../../model/index.js");
|
|
15
|
-
const require_onchain_market_rwa_midas_constants = require("../../market/rwa/midas/constants.js");
|
|
16
16
|
const require_onchain_market_rwa_securitize_constants = require("../../market/rwa/securitize/constants.js");
|
|
17
17
|
const require_onchain_market_credit_collateralUtils = require("../../market/credit/collateralUtils.js");
|
|
18
18
|
const require_onchain_market_rwa_midas_MidasLiquidatorContract = require("../../market/rwa/midas/MidasLiquidatorContract.js");
|
|
@@ -8,8 +8,6 @@ require("../../utils/index.js");
|
|
|
8
8
|
const require_onchain_base_SDKConstruct = require("../../base/SDKConstruct.js");
|
|
9
9
|
require("../../base/index.js");
|
|
10
10
|
const require_onchain_market_math = require("../math.js");
|
|
11
|
-
const require_model_rwa = require("../../../model/rwa.js");
|
|
12
|
-
require("../../../model/index.js");
|
|
13
11
|
const require_onchain_market_rwa_createDegenNFT = require("../rwa/createDegenNFT.js");
|
|
14
12
|
const require_onchain_market_strategyName = require("../strategyName.js");
|
|
15
13
|
const require_onchain_market_credit_collateralUtils = require("./collateralUtils.js");
|
|
@@ -126,25 +124,37 @@ var CreditSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
|
|
|
126
124
|
degenNFT() {
|
|
127
125
|
const address = this.creditFacade.degenNFT;
|
|
128
126
|
if ((0, viem.isAddressEqual)(address, "0x0000000000000000000000000000000000000000")) return Promise.resolve(void 0);
|
|
127
|
+
const factoryNft = this.rwaFactory?.degenNFT;
|
|
128
|
+
if (factoryNft && (0, viem.isAddressEqual)(factoryNft.address, address)) return Promise.resolve(factoryNft);
|
|
129
129
|
if (!this.#degenNFT) this.#degenNFT = require_onchain_market_rwa_createDegenNFT.createDegenNFT(this.sdk, address);
|
|
130
130
|
return this.#degenNFT;
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
133
|
+
* The KYC gate of this suite's strategy; `null` when there is none.
|
|
134
|
+
* Wallet-independent.
|
|
135
135
|
*/
|
|
136
|
-
async kycRequirement(
|
|
136
|
+
async kycRequirement(targetCollateral) {
|
|
137
137
|
const nft = await this.degenNFT();
|
|
138
138
|
if (!nft) return null;
|
|
139
|
-
const
|
|
140
|
-
|
|
139
|
+
const tokens = await nft.getTokens();
|
|
140
|
+
const token = tokens.find((t) => (0, viem.isAddressEqual)(t, targetCollateral)) ?? tokens[0];
|
|
141
141
|
return {
|
|
142
142
|
protocol: nft.protocol,
|
|
143
|
-
token: this.tokensMeta.getToken(token),
|
|
144
|
-
registrationLink:
|
|
143
|
+
token: token ? this.tokensMeta.getToken(token) : void 0,
|
|
144
|
+
registrationLink: nft.registrationLink
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
+
* Whether `wallet` may open this suite's strategy today; `true` when there
|
|
149
|
+
* is no KYC gate.
|
|
150
|
+
*/
|
|
151
|
+
async isEligibleForStrategy(wallet, targetCollateral) {
|
|
152
|
+
const nft = await this.degenNFT();
|
|
153
|
+
if (!nft) return true;
|
|
154
|
+
const requirements = await nft.getOpenAccountRequirements(wallet, { tokenOutAddress: targetCollateral });
|
|
155
|
+
return nft.isRegistered(requirements);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
148
158
|
* Builds a transaction that executes a multicall on one of this suite's
|
|
149
159
|
* credit accounts.
|
|
150
160
|
*
|
|
@@ -279,11 +289,11 @@ var CreditSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
|
|
|
279
289
|
const { pool } = this.market.pool;
|
|
280
290
|
const { maxDebtPerBlockMultiplier, maxDebt } = this.creditFacade;
|
|
281
291
|
if (maxDebtPerBlockMultiplier === 0) return {
|
|
282
|
-
|
|
292
|
+
amount: this.market.toUnderlyingAmount(0n),
|
|
283
293
|
limit: "debtPerBlockLimit"
|
|
284
294
|
};
|
|
285
295
|
const available = pool.creditManagerDebtParams.get(this.creditManager.address)?.available;
|
|
286
|
-
|
|
296
|
+
const { value, limit } = [
|
|
287
297
|
{
|
|
288
298
|
value: pool.availableLiquidity,
|
|
289
299
|
limit: "poolAvailableLiquidity"
|
|
@@ -297,6 +307,10 @@ var CreditSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
|
|
|
297
307
|
limit: "maxDebt"
|
|
298
308
|
}
|
|
299
309
|
].reduce((a, b) => b.value < a.value ? b : a);
|
|
310
|
+
return {
|
|
311
|
+
amount: this.market.toUnderlyingAmount(value),
|
|
312
|
+
limit
|
|
313
|
+
};
|
|
300
314
|
}
|
|
301
315
|
/**
|
|
302
316
|
* The single target collateral of this suite's strategy, or `undefined` when
|
|
@@ -355,7 +369,7 @@ var CreditSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
|
|
|
355
369
|
* or `undefined` when credit suite does not offer a strategy opportunity.
|
|
356
370
|
*/
|
|
357
371
|
strategyOpportunity() {
|
|
358
|
-
const maxBorrowAmount = this.maxBorrowAmount().value;
|
|
372
|
+
const maxBorrowAmount = this.maxBorrowAmount().amount.value;
|
|
359
373
|
if (maxBorrowAmount <= MIN_STRATEGY_BORROW_AMOUNT) return;
|
|
360
374
|
const collateral = this.strategyTargetCollateral;
|
|
361
375
|
if (!collateral) return;
|
|
@@ -6,14 +6,23 @@ require("../../adapters/abi/index.js");
|
|
|
6
6
|
const require_abi_rwa_iMidasDegenNFT = require("../../../../abi/rwa/iMidasDegenNFT.js");
|
|
7
7
|
require("./constants.js");
|
|
8
8
|
const require_abi_rwa_iMidasAccessControl = require("../../../../abi/rwa/iMidasAccessControl.js");
|
|
9
|
+
const require_model_rwa = require("../../../../model/rwa.js");
|
|
10
|
+
require("../../../../model/index.js");
|
|
9
11
|
let viem = require("viem");
|
|
10
12
|
//#region src/onchain/market/rwa/midas/MidasDegenNFT.ts
|
|
11
13
|
const abi = require_abi_rwa_iMidasDegenNFT.iMidasDegenNFTAbi;
|
|
14
|
+
/**
|
|
15
|
+
* Midas is an RWA protocol without a factory: accounts open through the plain
|
|
16
|
+
* facade. Only a Permissioned-mode gateway deploys a degen NFT, so a Midas
|
|
17
|
+
* strategy that does not require KYC has no NFT at all.
|
|
18
|
+
*/
|
|
12
19
|
var MidasDegenNFT = class extends require_onchain_base_BaseContract.BaseContract {
|
|
13
20
|
protocol = "midas";
|
|
21
|
+
registrationLink = require_model_rwa.KYC_REGISTRATION_LINKS.midas;
|
|
14
22
|
gateway;
|
|
15
23
|
accessControl;
|
|
16
24
|
greenlistedRole;
|
|
25
|
+
#mToken;
|
|
17
26
|
constructor(sdk, baseParams) {
|
|
18
27
|
super(sdk, {
|
|
19
28
|
...baseParams,
|
|
@@ -31,9 +40,26 @@ var MidasDegenNFT = class extends require_onchain_base_BaseContract.BaseContract
|
|
|
31
40
|
this.accessControl = accessControl;
|
|
32
41
|
this.greenlistedRole = greenlistedRole;
|
|
33
42
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
async getTokens() {
|
|
44
|
+
return [await this.#mTokenAddress()];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Same predicate `MidasDegenNFT.burn` reverts on; the mToken rides along in
|
|
48
|
+
* the batch until it is cached.
|
|
49
|
+
*/
|
|
50
|
+
async getOpenAccountRequirements(wallet, _props) {
|
|
51
|
+
const token = this.#mToken;
|
|
52
|
+
if (token !== void 0) return {
|
|
53
|
+
protocol: "midas",
|
|
54
|
+
token,
|
|
55
|
+
greenlisted: await this.client.readContract({
|
|
56
|
+
abi: require_abi_rwa_iMidasAccessControl.iMidasAccessControlAbi,
|
|
57
|
+
address: this.accessControl,
|
|
58
|
+
functionName: "hasRole",
|
|
59
|
+
args: [this.greenlistedRole, wallet]
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
const [greenlisted, mToken] = await this.client.multicall({
|
|
37
63
|
allowFailure: false,
|
|
38
64
|
contracts: [{
|
|
39
65
|
abi: require_abi_rwa_iMidasAccessControl.iMidasAccessControlAbi,
|
|
@@ -46,11 +72,25 @@ var MidasDegenNFT = class extends require_onchain_base_BaseContract.BaseContract
|
|
|
46
72
|
functionName: "mToken"
|
|
47
73
|
}]
|
|
48
74
|
});
|
|
75
|
+
this.#mToken = mToken;
|
|
49
76
|
return {
|
|
50
|
-
|
|
51
|
-
token
|
|
77
|
+
protocol: "midas",
|
|
78
|
+
token: mToken,
|
|
79
|
+
greenlisted
|
|
52
80
|
};
|
|
53
81
|
}
|
|
82
|
+
isRegistered(requirements) {
|
|
83
|
+
return requirements.greenlisted;
|
|
84
|
+
}
|
|
85
|
+
getMissingRequirements() {}
|
|
86
|
+
async #mTokenAddress() {
|
|
87
|
+
if (this.#mToken === void 0) this.#mToken = await this.client.readContract({
|
|
88
|
+
abi: require_onchain_market_adapters_abi_midas_iMidasGatewayV311.iMidasGatewayV311Abi,
|
|
89
|
+
address: this.gateway,
|
|
90
|
+
functionName: "mToken"
|
|
91
|
+
});
|
|
92
|
+
return this.#mToken;
|
|
93
|
+
}
|
|
54
94
|
};
|
|
55
95
|
//#endregion
|
|
56
96
|
exports.MidasDegenNFT = MidasDegenNFT;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_onchain_utils_AddressSet = require("../../../utils/AddressSet.js");
|
|
3
|
+
require("../../../utils/index.js");
|
|
2
4
|
const require_onchain_base_BaseContract = require("../../../base/BaseContract.js");
|
|
3
5
|
require("../../../base/index.js");
|
|
6
|
+
const require_model_rwa = require("../../../../model/rwa.js");
|
|
7
|
+
require("../../../../model/index.js");
|
|
4
8
|
const require_onchain_market_rwa_securitize_constants = require("./constants.js");
|
|
5
|
-
const require_abi_rwa_iSecuritizeDegenNFT = require("../../../../abi/rwa/iSecuritizeDegenNFT.js");
|
|
6
|
-
let viem = require("viem");
|
|
7
9
|
//#region src/onchain/market/rwa/securitize/SecuritizeDegenNFT.ts
|
|
8
|
-
const abi =
|
|
10
|
+
const abi = require("../../../../abi/rwa/iSecuritizeDegenNFT.js").iSecuritizeDegenNFTAbi;
|
|
11
|
+
/**
|
|
12
|
+
* Securitize always has a factory, which deploys this NFT. DS-token data,
|
|
13
|
+
* registrars and cached signatures live here; the factory only builds txs
|
|
14
|
+
* and looks up investor/wallet addresses.
|
|
15
|
+
*/
|
|
9
16
|
var SecuritizeDegenNFT = class extends require_onchain_base_BaseContract.BaseContract {
|
|
10
17
|
protocol = "securitize";
|
|
18
|
+
registrationLink = require_model_rwa.KYC_REGISTRATION_LINKS.securitize;
|
|
11
19
|
factory;
|
|
20
|
+
#sdk;
|
|
12
21
|
constructor(sdk, address, factory) {
|
|
13
22
|
super(sdk, {
|
|
14
23
|
addr: address,
|
|
@@ -17,19 +26,54 @@ var SecuritizeDegenNFT = class extends require_onchain_base_BaseContract.BaseCon
|
|
|
17
26
|
name: "SecuritizeDegenNFT",
|
|
18
27
|
abi
|
|
19
28
|
});
|
|
29
|
+
this.#sdk = sdk;
|
|
20
30
|
this.factory = factory;
|
|
21
31
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
async getTokens() {
|
|
33
|
+
return this.factory.getTokens();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Registration on Securitize is the protocol-side KYC step; pending
|
|
37
|
+
* EIP-712 signatures are tx-side leftover, not KYC.
|
|
38
|
+
*/
|
|
39
|
+
async getOpenAccountRequirements(wallet, props) {
|
|
40
|
+
const tokensToRegister = new require_onchain_utils_AddressSet.AddressSet(this.factory.getTokens()).has(props.tokenOutAddress) ? new require_onchain_utils_AddressSet.AddressSet([props.tokenOutAddress]) : new require_onchain_utils_AddressSet.AddressSet();
|
|
41
|
+
if (tokensToRegister.size === 0) return {
|
|
42
|
+
protocol: "securitize",
|
|
43
|
+
factory: this.factory.address,
|
|
44
|
+
securitizeTokensToRegister: [],
|
|
45
|
+
tokensToRegister: [],
|
|
46
|
+
requiredSignatures: []
|
|
47
|
+
};
|
|
48
|
+
const [investorData] = await this.#sdk.rwa.getInvestorData(wallet, [this.factory.address]);
|
|
49
|
+
const registredTokens = new require_onchain_utils_AddressSet.AddressSet(investorData.registeredTokens);
|
|
50
|
+
const signedTokens = new require_onchain_utils_AddressSet.AddressSet(investorData.cachedSignatures.map((s) => s.token));
|
|
51
|
+
const unsignedTokens = tokensToRegister.difference(signedTokens);
|
|
52
|
+
const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
|
|
53
|
+
const requiredSignatures = investorData.registerVaultMessages.filter((m) => unsignedTokens.has(m.message.token));
|
|
54
|
+
return {
|
|
55
|
+
protocol: "securitize",
|
|
56
|
+
factory: this.factory.address,
|
|
57
|
+
securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
|
|
58
|
+
tokensToRegister: Array.from(tokensToRegister),
|
|
59
|
+
requiredSignatures
|
|
28
60
|
};
|
|
29
|
-
|
|
61
|
+
}
|
|
62
|
+
isRegistered(requirements) {
|
|
63
|
+
return requirements.securitizeTokensToRegister.length === 0;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A required signature is omitted when `providedArgs.signaturesToCache`
|
|
67
|
+
* already carries a signature for the same token: the transaction caches it
|
|
68
|
+
* on-chain as part of the operation.
|
|
69
|
+
*/
|
|
70
|
+
getMissingRequirements(requirements, providedArgs) {
|
|
71
|
+
const providedTokens = new require_onchain_utils_AddressSet.AddressSet((providedArgs?.signaturesToCache ?? []).map((s) => s.token));
|
|
72
|
+
const requiredSignatures = requirements.requiredSignatures.filter((message) => !providedTokens.has(message.message.token));
|
|
73
|
+
if (requiredSignatures.length === 0) return;
|
|
30
74
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
75
|
+
protocol: "securitize",
|
|
76
|
+
requiredSignatures
|
|
33
77
|
};
|
|
34
78
|
}
|
|
35
79
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_utils_AddressMap = require("../../../utils/AddressMap.js");
|
|
3
|
-
const require_onchain_utils_AddressSet = require("../../../utils/AddressSet.js");
|
|
4
3
|
require("../../../utils/index.js");
|
|
5
4
|
const require_onchain_base_BaseContract = require("../../../base/BaseContract.js");
|
|
6
5
|
require("../../../base/index.js");
|
|
@@ -12,7 +11,6 @@ let viem = require("viem");
|
|
|
12
11
|
//#region src/onchain/market/rwa/securitize/SecuritizeRWAFactory.ts
|
|
13
12
|
const abi = require_abi_rwa_iSecuritizeRWAFactory.iSecuritizeRWAFactoryAbi;
|
|
14
13
|
var SecuritizeRWAFactory = class extends require_onchain_base_BaseContract.BaseContract {
|
|
15
|
-
#sdk;
|
|
16
14
|
#investorCache = new require_onchain_utils_AddressMap.AddressMap();
|
|
17
15
|
degenNFT;
|
|
18
16
|
owner;
|
|
@@ -24,7 +22,6 @@ var SecuritizeRWAFactory = class extends require_onchain_base_BaseContract.BaseC
|
|
|
24
22
|
name: "SecuritizeRWAFactory",
|
|
25
23
|
abi
|
|
26
24
|
});
|
|
27
|
-
this.#sdk = sdk;
|
|
28
25
|
const decoded = (0, viem.decodeAbiParameters)([
|
|
29
26
|
{
|
|
30
27
|
name: "owner",
|
|
@@ -185,40 +182,6 @@ var SecuritizeRWAFactory = class extends require_onchain_base_BaseContract.BaseC
|
|
|
185
182
|
});
|
|
186
183
|
}
|
|
187
184
|
/**
|
|
188
|
-
* {@inheritDoc IRWAFactory.getOpenAccountRequirements}
|
|
189
|
-
*/
|
|
190
|
-
async getOpenAccountRequirements(investor, props) {
|
|
191
|
-
const [investorData] = await this.#sdk.rwa.getInvestorData(investor, [this.address]);
|
|
192
|
-
const tokensToRegister = new require_onchain_utils_AddressSet.AddressSet([props.tokenOutAddress]);
|
|
193
|
-
const registredTokens = new require_onchain_utils_AddressSet.AddressSet(investorData.registeredTokens);
|
|
194
|
-
const signedTokens = new require_onchain_utils_AddressSet.AddressSet(investorData.cachedSignatures.map((s) => s.token));
|
|
195
|
-
const unsignedTokens = tokensToRegister.difference(signedTokens);
|
|
196
|
-
const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
|
|
197
|
-
const requiredSignatures = investorData.registerVaultMessages.filter((m) => unsignedTokens.has(m.message.token));
|
|
198
|
-
return {
|
|
199
|
-
type: require_model_rwa.RWA_FACTORY_SECURITIZE,
|
|
200
|
-
securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
|
|
201
|
-
tokensToRegister: Array.from(tokensToRegister),
|
|
202
|
-
requiredSignatures
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* {@inheritDoc IRWAFactory.getMissingRequirements}
|
|
207
|
-
*
|
|
208
|
-
* A required signature is omitted when `providedArgs.signaturesToCache`
|
|
209
|
-
* already carries a signature for the same token: the transaction caches it
|
|
210
|
-
* on-chain as part of the operation.
|
|
211
|
-
*/
|
|
212
|
-
getMissingRequirements(requirements, providedArgs) {
|
|
213
|
-
const providedTokens = new require_onchain_utils_AddressSet.AddressSet((providedArgs?.signaturesToCache ?? []).map((s) => s.token));
|
|
214
|
-
const requiredSignatures = requirements.requiredSignatures.filter((message) => !providedTokens.has(message.message.token));
|
|
215
|
-
if (requiredSignatures.length === 0) return;
|
|
216
|
-
return {
|
|
217
|
-
type: require_model_rwa.RWA_FACTORY_SECURITIZE,
|
|
218
|
-
requiredSignatures
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
185
|
* {@inheritDoc IRWAFactory.openCreditAccount}
|
|
223
186
|
*/
|
|
224
187
|
openCreditAccount(creditManager, calls, args) {
|
|
@@ -38,12 +38,18 @@ var MultichainOpportunitiesService = class extends require_onchain_base_Multicha
|
|
|
38
38
|
*
|
|
39
39
|
* See {@link MultichainOpportunitiesService.getPool}.
|
|
40
40
|
**/
|
|
41
|
-
async getStrategy(key
|
|
41
|
+
async getStrategy(key) {
|
|
42
42
|
return this.queryChain({
|
|
43
43
|
network: key.chainId,
|
|
44
|
-
run: (sdk) => sdk.opportunities.getStrategy(key
|
|
44
|
+
run: (sdk) => sdk.opportunities.getStrategy(key)
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* {@inheritDoc OpportunitiesService.isEligibleForStrategy}
|
|
49
|
+
**/
|
|
50
|
+
async isEligibleForStrategy(key, wallet) {
|
|
51
|
+
return this.sdk.chain(key.chainId).opportunities.isEligibleForStrategy(key, wallet);
|
|
52
|
+
}
|
|
47
53
|
};
|
|
48
54
|
//#endregion
|
|
49
55
|
exports.MultichainOpportunitiesService = MultichainOpportunitiesService;
|
|
@@ -37,22 +37,34 @@ var OpportunitiesService = class extends require_onchain_base_SDKConstruct.SDKCo
|
|
|
37
37
|
* A single strategy opportunity plus the rate curve of the pool it borrows
|
|
38
38
|
* from and the price feeds its liquidation price depends on.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
* with the strategy's KYC provider first; `null` otherwise.
|
|
40
|
+
* `kyc` is the strategy's KYC gate, independent of any wallet.
|
|
42
41
|
*
|
|
43
42
|
* @throws If the credit manager is unknown, or does not currently offer a
|
|
44
43
|
* strategy.
|
|
45
44
|
**/
|
|
46
|
-
async getStrategy(key
|
|
45
|
+
async getStrategy(key) {
|
|
47
46
|
const suite = this.sdk.marketRegister.findCreditManager(key.creditManager);
|
|
48
47
|
const detail = suite.strategyOpportunityDetail();
|
|
49
48
|
if (!detail) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
|
|
50
|
-
const kyc =
|
|
49
|
+
const kyc = await suite.kycRequirement(detail.targetCollateral.address);
|
|
51
50
|
return {
|
|
52
51
|
...detail,
|
|
53
52
|
kyc
|
|
54
53
|
};
|
|
55
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Whether `wallet` may open this strategy today: `true` when it is not
|
|
57
|
+
* KYC-gated or the wallet already passed the gate.
|
|
58
|
+
*
|
|
59
|
+
* @throws If the credit manager is unknown, or does not currently offer a
|
|
60
|
+
* strategy.
|
|
61
|
+
**/
|
|
62
|
+
async isEligibleForStrategy(key, wallet) {
|
|
63
|
+
const suite = this.sdk.marketRegister.findCreditManager(key.creditManager);
|
|
64
|
+
const opportunity = suite.strategyOpportunity();
|
|
65
|
+
if (!opportunity) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
|
|
66
|
+
return suite.isEligibleForStrategy(wallet, opportunity.targetCollateral.address);
|
|
67
|
+
}
|
|
56
68
|
};
|
|
57
69
|
//#endregion
|
|
58
70
|
exports.OpportunitiesService = OpportunitiesService;
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_onchain_utils_hex = require("../../utils/hex.js");
|
|
3
3
|
const require_onchain_market_adapters_contracts_AbstractAdapter = require("../../market/adapters/contracts/AbstractAdapter.js");
|
|
4
4
|
const require_onchain_market_credit_CreditFacadeV310Contract = require("../../market/credit/CreditFacadeV310Contract.js");
|
|
5
|
-
|
|
5
|
+
require("../../../model/rwa.js");
|
|
6
6
|
require("../../../model/index.js");
|
|
7
7
|
const require_onchain_market_rwa_types = require("../../market/rwa/types.js");
|
|
8
8
|
const require_onchain_preview_parse_classifyInnerOperations = require("./classifyInnerOperations.js");
|
|
@@ -33,7 +33,7 @@ function parseSecuritizeOperationCalldata(sdk, factory, calldata) {
|
|
|
33
33
|
const { rawArgs } = parsed;
|
|
34
34
|
const innerCalls = rawArgs.calls ?? [];
|
|
35
35
|
const args = {
|
|
36
|
-
|
|
36
|
+
protocol: "securitize",
|
|
37
37
|
tokensToRegister: [...rawArgs.tokensToRegister ?? []],
|
|
38
38
|
signaturesToCache: [...rawArgs.signaturesToCache ?? []]
|
|
39
39
|
};
|
|
@@ -33,7 +33,8 @@ async function checkCreditOperation(args) {
|
|
|
33
33
|
minDebt: suite.creditFacade.minDebt,
|
|
34
34
|
maxDebt: suite.creditFacade.maxDebt,
|
|
35
35
|
underlying,
|
|
36
|
-
allowZero: !isOpening
|
|
36
|
+
allowZero: !isOpening,
|
|
37
|
+
maxBorrowAmount: suite.maxBorrowAmount()
|
|
37
38
|
}),
|
|
38
39
|
...require_onchain_validation_bundles_checkDraw.checkDraw(suite, preview, underlying),
|
|
39
40
|
...require_onchain_validation_bundles_checkObtained.checkObtained(suite, preview),
|
|
@@ -50,7 +51,7 @@ async function checkCreditOperation(args) {
|
|
|
50
51
|
preview,
|
|
51
52
|
sender,
|
|
52
53
|
blockNumber
|
|
53
|
-
}), preview.operation === "RWAOpenCreditAccount" ? require_onchain_validation_bundles_checkRWAOpening.checkRWAOpening({
|
|
54
|
+
}), preview.operation === "OpenCreditAccount" || preview.operation === "RWAOpenCreditAccount" ? require_onchain_validation_bundles_checkRWAOpening.checkRWAOpening({
|
|
54
55
|
sdk,
|
|
55
56
|
preview,
|
|
56
57
|
sender
|
|
@@ -16,11 +16,11 @@ require("../checks/index.js");
|
|
|
16
16
|
function checkDraw(suite, preview, underlying) {
|
|
17
17
|
const drawn = preview.operation === "AdjustCreditAccount" ? preview.totalDebtChange.value : preview.totalDebt.value;
|
|
18
18
|
if (drawn <= 0n) return [];
|
|
19
|
-
const
|
|
19
|
+
const maxBorrowAmount = suite.maxBorrowAmount();
|
|
20
20
|
return require_onchain_validation_checks_checkBorrowLimit.checkBorrowLimit({
|
|
21
21
|
requested: drawn,
|
|
22
|
-
available: value,
|
|
23
|
-
limit,
|
|
22
|
+
available: maxBorrowAmount.amount.value,
|
|
23
|
+
limit: maxBorrowAmount.limit,
|
|
24
24
|
underlying
|
|
25
25
|
});
|
|
26
26
|
}
|