@gearbox-protocol/sdk 14.5.9 → 14.6.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/abi/kyc/iDSToken.js +1907 -20
- package/dist/cjs/common-utils/utils/apy/bonus-apy-from-points.js +28 -0
- package/dist/cjs/common-utils/utils/apy/calculate-effective-borrow-rate.js +35 -0
- package/dist/cjs/common-utils/utils/apy/get-complex-apy-list.js +45 -0
- package/dist/cjs/common-utils/utils/apy/get-rate-with-fee.js +31 -0
- package/dist/cjs/common-utils/utils/apy/get-single-quota-borrow-rate.js +33 -0
- package/dist/cjs/common-utils/utils/apy/index.js +32 -0
- package/dist/cjs/common-utils/utils/apy/max-apy-formula.js +40 -0
- package/dist/cjs/common-utils/utils/index.js +5 -1
- package/dist/cjs/common-utils/utils/strategies/__test-utils.js +95 -0
- package/dist/cjs/common-utils/utils/strategies/availability/check-boolean.js +33 -0
- package/dist/cjs/common-utils/utils/strategies/availability/check-degen-nft.js +35 -0
- package/dist/cjs/common-utils/utils/strategies/availability/index.js +28 -0
- package/dist/cjs/common-utils/utils/strategies/availability/validate-open-account-pool-quota-status.js +40 -0
- package/dist/cjs/common-utils/utils/strategies/availability/validate-open-account-pool-status.js +76 -0
- package/dist/cjs/common-utils/utils/strategies/index.js +28 -0
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-loss-coefficient.js +31 -0
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +45 -0
- package/dist/cjs/common-utils/utils/strategies/leverage/get-factor-from-leverage.js +31 -0
- package/dist/cjs/common-utils/utils/strategies/leverage/get-leverage-from-factor.js +31 -0
- package/dist/cjs/common-utils/utils/strategies/leverage/index.js +32 -0
- package/dist/cjs/common-utils/utils/strategies/leverage/max-leverage-threshold.js +42 -0
- package/dist/cjs/common-utils/utils/strategies/leverage/max-leverage.js +35 -0
- package/dist/cjs/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.js +22 -0
- package/dist/cjs/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.js +64 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +63 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-info.js +98 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.js +102 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-info/index.js +30 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.js +33 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-info/types.js +16 -0
- package/dist/cjs/plugins/adapters/abi/securitize/iBaseOnRamp.js +351 -0
- package/dist/cjs/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +2 -1
- package/dist/esm/abi/kyc/iDSToken.js +1907 -20
- package/dist/esm/common-utils/utils/apy/bonus-apy-from-points.js +4 -0
- package/dist/esm/common-utils/utils/apy/calculate-effective-borrow-rate.js +11 -0
- package/dist/esm/common-utils/utils/apy/get-complex-apy-list.js +21 -0
- package/dist/esm/common-utils/utils/apy/get-rate-with-fee.js +7 -0
- package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +9 -0
- package/dist/esm/common-utils/utils/apy/index.js +6 -0
- package/dist/esm/common-utils/utils/apy/max-apy-formula.js +16 -0
- package/dist/esm/common-utils/utils/index.js +2 -0
- package/dist/esm/common-utils/utils/strategies/__test-utils.js +65 -0
- package/dist/esm/common-utils/utils/strategies/availability/check-boolean.js +9 -0
- package/dist/esm/common-utils/utils/strategies/availability/check-degen-nft.js +11 -0
- package/dist/esm/common-utils/utils/strategies/availability/index.js +4 -0
- package/dist/esm/common-utils/utils/strategies/availability/validate-open-account-pool-quota-status.js +16 -0
- package/dist/esm/common-utils/utils/strategies/availability/validate-open-account-pool-status.js +52 -0
- package/dist/esm/common-utils/utils/strategies/index.js +4 -0
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-loss-coefficient.js +7 -0
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +21 -0
- package/dist/esm/common-utils/utils/strategies/leverage/get-factor-from-leverage.js +7 -0
- package/dist/esm/common-utils/utils/strategies/leverage/get-leverage-from-factor.js +7 -0
- package/dist/esm/common-utils/utils/strategies/leverage/index.js +6 -0
- package/dist/esm/common-utils/utils/strategies/leverage/max-leverage-threshold.js +18 -0
- package/dist/esm/common-utils/utils/strategies/leverage/max-leverage.js +11 -0
- package/dist/esm/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.js +1 -0
- package/dist/esm/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.js +43 -0
- package/dist/esm/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +43 -0
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-info.js +74 -0
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.js +85 -0
- package/dist/esm/common-utils/utils/strategies/strategy-info/index.js +5 -0
- package/dist/esm/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.js +9 -0
- package/dist/esm/common-utils/utils/strategies/strategy-info/types.js +0 -0
- package/dist/esm/plugins/adapters/abi/securitize/iBaseOnRamp.js +327 -0
- package/dist/esm/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +2 -1
- package/dist/types/abi/kyc/iDSToken.d.ts +1446 -13
- package/dist/types/common-utils/utils/apy/bonus-apy-from-points.d.ts +4 -0
- package/dist/types/common-utils/utils/apy/calculate-effective-borrow-rate.d.ts +6 -0
- package/dist/types/common-utils/utils/apy/get-complex-apy-list.d.ts +5 -0
- package/dist/types/common-utils/utils/apy/get-rate-with-fee.d.ts +7 -0
- package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +9 -0
- package/dist/types/common-utils/utils/apy/index.d.ts +6 -0
- package/dist/types/common-utils/utils/apy/max-apy-formula.d.ts +6 -0
- package/dist/types/common-utils/utils/index.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/__test-utils.d.ts +11 -0
- package/dist/types/common-utils/utils/strategies/availability/check-boolean.d.ts +1 -0
- package/dist/types/common-utils/utils/strategies/availability/check-degen-nft.d.ts +5 -0
- package/dist/types/common-utils/utils/strategies/availability/index.d.ts +4 -0
- package/dist/types/common-utils/utils/strategies/availability/validate-open-account-pool-quota-status.d.ts +6 -0
- package/dist/types/common-utils/utils/strategies/availability/validate-open-account-pool-status.d.ts +24 -0
- package/dist/types/common-utils/utils/strategies/index.d.ts +4 -0
- package/dist/types/common-utils/utils/strategies/leverage/calculate-loss-coefficient.d.ts +1 -0
- package/dist/types/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.d.ts +12 -0
- package/dist/types/common-utils/utils/strategies/leverage/get-factor-from-leverage.d.ts +4 -0
- package/dist/types/common-utils/utils/strategies/leverage/get-leverage-from-factor.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/leverage/index.d.ts +6 -0
- package/dist/types/common-utils/utils/strategies/leverage/max-leverage-threshold.d.ts +5 -0
- package/dist/types/common-utils/utils/strategies/leverage/max-leverage.d.ts +9 -0
- package/dist/types/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.d.ts +1 -0
- package/dist/types/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.d.ts +13 -0
- package/dist/types/common-utils/utils/strategies/strategy-info/cm-availability-condition.d.ts +3 -0
- package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-info.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.d.ts +13 -0
- package/dist/types/common-utils/utils/strategies/strategy-info/index.d.ts +5 -0
- package/dist/types/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/strategy-info/types.d.ts +80 -0
- package/dist/types/plugins/adapters/abi/securitize/iBaseOnRamp.d.ts +255 -0
- package/dist/types/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.d.ts +254 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var calculate_max_leverage_factor_exports = {};
|
|
20
|
+
__export(calculate_max_leverage_factor_exports, {
|
|
21
|
+
calculateMaxLeverageFactor: () => calculateMaxLeverageFactor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(calculate_max_leverage_factor_exports);
|
|
24
|
+
var import_sdk = require("../../../../sdk/index.js");
|
|
25
|
+
var import_bigint_math = require("../../bigint-math.js");
|
|
26
|
+
var import_calculate_loss_coefficient = require("./calculate-loss-coefficient.js");
|
|
27
|
+
var import_max_leverage = require("./max-leverage.js");
|
|
28
|
+
const DEFAULT_LEVERAGE_CONSTANT_LOSS = 500n;
|
|
29
|
+
function calculateMaxLeverageFactor({
|
|
30
|
+
targetToken,
|
|
31
|
+
slippage,
|
|
32
|
+
creditManagers,
|
|
33
|
+
constantLoss = DEFAULT_LEVERAGE_CONSTANT_LOSS,
|
|
34
|
+
leverageLimit
|
|
35
|
+
}) {
|
|
36
|
+
const maxPossibleLeverage = (0, import_max_leverage.maxLeverage)(targetToken, creditManagers);
|
|
37
|
+
const coefficient = (0, import_calculate_loss_coefficient.calculateLossCoefficient)(slippage, constantLoss);
|
|
38
|
+
const maxLeverageValue = BigInt(maxPossibleLeverage) * coefficient / import_sdk.PERCENTAGE_FACTOR;
|
|
39
|
+
const r = leverageLimit !== void 0 ? import_bigint_math.BigIntMath.min(BigInt(leverageLimit), maxLeverageValue) : maxLeverageValue;
|
|
40
|
+
return r;
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
calculateMaxLeverageFactor
|
|
45
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_factor_from_leverage_exports = {};
|
|
20
|
+
__export(get_factor_from_leverage_exports, {
|
|
21
|
+
getFactorFromLeverage: () => getFactorFromLeverage
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(get_factor_from_leverage_exports);
|
|
24
|
+
var import_sdk = require("../../../../sdk/index.js");
|
|
25
|
+
function getFactorFromLeverage(leverage) {
|
|
26
|
+
return leverage - import_sdk.LEVERAGE_DECIMALS;
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
getFactorFromLeverage
|
|
31
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_leverage_from_factor_exports = {};
|
|
20
|
+
__export(get_leverage_from_factor_exports, {
|
|
21
|
+
getLeverageFromFactor: () => getLeverageFromFactor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(get_leverage_from_factor_exports);
|
|
24
|
+
var import_sdk = require("../../../../sdk/index.js");
|
|
25
|
+
function getLeverageFromFactor(factor) {
|
|
26
|
+
return factor + import_sdk.LEVERAGE_DECIMALS;
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
getLeverageFromFactor
|
|
31
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var leverage_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(leverage_exports);
|
|
18
|
+
__reExport(leverage_exports, require("./calculate-loss-coefficient.js"), module.exports);
|
|
19
|
+
__reExport(leverage_exports, require("./calculate-max-leverage-factor.js"), module.exports);
|
|
20
|
+
__reExport(leverage_exports, require("./get-factor-from-leverage.js"), module.exports);
|
|
21
|
+
__reExport(leverage_exports, require("./get-leverage-from-factor.js"), module.exports);
|
|
22
|
+
__reExport(leverage_exports, require("./max-leverage.js"), module.exports);
|
|
23
|
+
__reExport(leverage_exports, require("./max-leverage-threshold.js"), module.exports);
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
...require("./calculate-loss-coefficient.js"),
|
|
27
|
+
...require("./calculate-max-leverage-factor.js"),
|
|
28
|
+
...require("./get-factor-from-leverage.js"),
|
|
29
|
+
...require("./get-leverage-from-factor.js"),
|
|
30
|
+
...require("./max-leverage.js"),
|
|
31
|
+
...require("./max-leverage-threshold.js")
|
|
32
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var max_leverage_threshold_exports = {};
|
|
20
|
+
__export(max_leverage_threshold_exports, {
|
|
21
|
+
maxLeverageThreshold: () => maxLeverageThreshold
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(max_leverage_threshold_exports);
|
|
24
|
+
const EMPTY_ADDRESS = "";
|
|
25
|
+
function maxLeverageThreshold(lpToken, cms) {
|
|
26
|
+
const lpTokenLC = lpToken.toLowerCase();
|
|
27
|
+
const ltByCM = cms.map((cm2) => {
|
|
28
|
+
const lt2 = cm2.liquidationThresholds[lpTokenLC] || 0n;
|
|
29
|
+
return [cm2.address, lt2];
|
|
30
|
+
});
|
|
31
|
+
const sorted = ltByCM.sort(([, ltA], [, ltB]) => {
|
|
32
|
+
if (ltA > ltB) return -1;
|
|
33
|
+
if (ltB > ltA) return 1;
|
|
34
|
+
return 0;
|
|
35
|
+
});
|
|
36
|
+
const [cm = EMPTY_ADDRESS, lt = 0n] = sorted[0] || [];
|
|
37
|
+
return [lt, cm];
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
maxLeverageThreshold
|
|
42
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var max_leverage_exports = {};
|
|
20
|
+
__export(max_leverage_exports, {
|
|
21
|
+
maxLeverage: () => maxLeverage
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(max_leverage_exports);
|
|
24
|
+
var import_sdk = require("../../../../sdk/index.js");
|
|
25
|
+
var import_get_factor_from_leverage = require("./get-factor-from-leverage.js");
|
|
26
|
+
var import_max_leverage_threshold = require("./max-leverage-threshold.js");
|
|
27
|
+
function maxLeverage(lpToken, cms, targetHF = import_sdk.PERCENTAGE_FACTOR) {
|
|
28
|
+
const [maxThreshold] = (0, import_max_leverage_threshold.maxLeverageThreshold)(lpToken, cms);
|
|
29
|
+
const maxLeverageValue = targetHF * import_sdk.LEVERAGE_DECIMALS / (targetHF - maxThreshold);
|
|
30
|
+
return (0, import_get_factor_from_leverage.getFactorFromLeverage)(maxLeverageValue);
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
maxLeverage
|
|
35
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var sort_strategy_cms_by_availability_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(sort_strategy_cms_by_availability_exports);
|
|
18
|
+
__reExport(sort_strategy_cms_by_availability_exports, require("./sort-strategy-cms-by-availability.js"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./sort-strategy-cms-by-availability.js")
|
|
22
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var sort_strategy_cms_by_availability_exports = {};
|
|
20
|
+
__export(sort_strategy_cms_by_availability_exports, {
|
|
21
|
+
sortStrategyCMsByAvailability: () => sortStrategyCMsByAvailability
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(sort_strategy_cms_by_availability_exports);
|
|
24
|
+
var import_sort = require("../../creditAccount/sort.js");
|
|
25
|
+
var import_strategy_info = require("../strategy-info/index.js");
|
|
26
|
+
function sortStrategyCMsByAvailability({
|
|
27
|
+
targetToken,
|
|
28
|
+
allCreditManagers,
|
|
29
|
+
apyListByNetwork,
|
|
30
|
+
pools,
|
|
31
|
+
slippage,
|
|
32
|
+
quotaReserve,
|
|
33
|
+
leverageLimit,
|
|
34
|
+
isStrategy
|
|
35
|
+
}) {
|
|
36
|
+
const list = [...allCreditManagers].sort((cmA, cmB) => {
|
|
37
|
+
const sort = (0, import_strategy_info.cmAvailabilityCondition)(targetToken, cmA, cmB, pools);
|
|
38
|
+
if (sort !== 0) return sort;
|
|
39
|
+
const apyA = (0, import_strategy_info.getStrategyMaxAPY)(
|
|
40
|
+
targetToken,
|
|
41
|
+
cmA,
|
|
42
|
+
apyListByNetwork,
|
|
43
|
+
slippage,
|
|
44
|
+
quotaReserve,
|
|
45
|
+
leverageLimit
|
|
46
|
+
);
|
|
47
|
+
const apyB = (0, import_strategy_info.getStrategyMaxAPY)(
|
|
48
|
+
targetToken,
|
|
49
|
+
cmB,
|
|
50
|
+
apyListByNetwork,
|
|
51
|
+
slippage,
|
|
52
|
+
quotaReserve,
|
|
53
|
+
leverageLimit
|
|
54
|
+
);
|
|
55
|
+
const sortAPY = isStrategy ? (apyB?.totalMaxApy || 0) - (apyA?.totalMaxApy || 0) : (apyA?.totalBorrowRate || 0) - (apyB?.totalBorrowRate || 0);
|
|
56
|
+
if (sortAPY !== 0) return sortAPY;
|
|
57
|
+
return (0, import_sort.amountAbcComparator)(cmA.maxDebt, cmB.maxDebt);
|
|
58
|
+
});
|
|
59
|
+
return list;
|
|
60
|
+
}
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
sortStrategyCMsByAvailability
|
|
64
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var cm_availability_condition_exports = {};
|
|
20
|
+
__export(cm_availability_condition_exports, {
|
|
21
|
+
cmAvailabilityCondition: () => cmAvailabilityCondition
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(cm_availability_condition_exports);
|
|
24
|
+
var import_availability = require("../availability/index.js");
|
|
25
|
+
function cmAvailabilityCondition(targetToken, cmA, cmB, pools) {
|
|
26
|
+
const aHasMinError = (0, import_availability.validateOpenAccountPoolStatus)({
|
|
27
|
+
pool: pools?.[cmA.pool],
|
|
28
|
+
debt: cmA.minDebt,
|
|
29
|
+
creditManager: cmA,
|
|
30
|
+
targetToken
|
|
31
|
+
});
|
|
32
|
+
const bHasMinError = (0, import_availability.validateOpenAccountPoolStatus)({
|
|
33
|
+
pool: pools?.[cmB.pool],
|
|
34
|
+
debt: cmB.minDebt,
|
|
35
|
+
creditManager: cmB,
|
|
36
|
+
targetToken
|
|
37
|
+
});
|
|
38
|
+
const minSort = (0, import_availability.checkBoolean)(!aHasMinError, !bHasMinError);
|
|
39
|
+
if (minSort !== 0) return minSort;
|
|
40
|
+
const { freeOfNFT: aFreeOfNFT } = (0, import_availability.checkDegenNFT)(cmA);
|
|
41
|
+
const { freeOfNFT: bFreeOfNFT } = (0, import_availability.checkDegenNFT)(cmB);
|
|
42
|
+
const nftSort = (0, import_availability.checkBoolean)(aFreeOfNFT, bFreeOfNFT);
|
|
43
|
+
if (nftSort !== 0) return nftSort;
|
|
44
|
+
const aHasMaxError = (0, import_availability.validateOpenAccountPoolStatus)({
|
|
45
|
+
pool: pools?.[cmA.pool],
|
|
46
|
+
debt: cmA.maxDebt,
|
|
47
|
+
creditManager: cmA,
|
|
48
|
+
targetToken
|
|
49
|
+
});
|
|
50
|
+
const bHasMaxError = (0, import_availability.validateOpenAccountPoolStatus)({
|
|
51
|
+
pool: pools?.[cmB.pool],
|
|
52
|
+
debt: cmB.maxDebt,
|
|
53
|
+
creditManager: cmB,
|
|
54
|
+
targetToken
|
|
55
|
+
});
|
|
56
|
+
const maxSort = (0, import_availability.checkBoolean)(!aHasMaxError, !bHasMaxError);
|
|
57
|
+
if (maxSort !== 0) return maxSort;
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
cmAvailabilityCondition
|
|
63
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_strategy_info_exports = {};
|
|
20
|
+
__export(get_strategy_info_exports, {
|
|
21
|
+
getStrategyInfo: () => getStrategyInfo
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(get_strategy_info_exports);
|
|
24
|
+
var import_price_math = require("../../price-math.js");
|
|
25
|
+
var import_leverage = require("../leverage/index.js");
|
|
26
|
+
var import_sort_strategy_cms_by_availability = require("../sort-strategy-cms-by-availability/index.js");
|
|
27
|
+
var import_get_strategy_max_apy = require("./get-strategy-max-apy.js");
|
|
28
|
+
var import_is_strategy_cm_disabled = require("./is-strategy-cm-disabled.js");
|
|
29
|
+
const EMPTY_ADDRESS = "";
|
|
30
|
+
const EMPTY_CHAIN_ID = 0;
|
|
31
|
+
function getStrategyInfo({
|
|
32
|
+
strategy,
|
|
33
|
+
creditManagers,
|
|
34
|
+
sdkStateByChain,
|
|
35
|
+
apyListByNetwork,
|
|
36
|
+
quotaReserve,
|
|
37
|
+
slippage,
|
|
38
|
+
allPricesByChain
|
|
39
|
+
}) {
|
|
40
|
+
const strategyCMs = creditManagers?.[strategy.chainId]?.[strategy.id] || {};
|
|
41
|
+
const strategyCMsList = Object.values(strategyCMs);
|
|
42
|
+
if (strategyCMsList.length === 0) return void 0;
|
|
43
|
+
const openableCMsList = strategyCMsList.filter(
|
|
44
|
+
(cm) => !(0, import_is_strategy_cm_disabled.isStrategyCMDisabled)(cm, cm.quotas[strategy.tokenOutAddress])
|
|
45
|
+
);
|
|
46
|
+
const currentSdkState = sdkStateByChain?.[strategy.chainId];
|
|
47
|
+
const pools = currentSdkState?.pools;
|
|
48
|
+
const tokensList = currentSdkState?.tokens?.tokenDataList;
|
|
49
|
+
const targetTokenAddress = strategy.tokenOutAddress;
|
|
50
|
+
const minCreditManager = (0, import_sort_strategy_cms_by_availability.sortStrategyCMsByAvailability)({
|
|
51
|
+
targetToken: targetTokenAddress,
|
|
52
|
+
allCreditManagers: openableCMsList.length > 0 ? openableCMsList : strategyCMsList,
|
|
53
|
+
apyListByNetwork,
|
|
54
|
+
slippage,
|
|
55
|
+
quotaReserve,
|
|
56
|
+
pools,
|
|
57
|
+
leverageLimit: strategy.maxLeverage,
|
|
58
|
+
isStrategy: true
|
|
59
|
+
})?.[0] || strategyCMsList[0];
|
|
60
|
+
const { underlyingToken = EMPTY_ADDRESS, availableToBorrow = 0n } = minCreditManager || {};
|
|
61
|
+
const {
|
|
62
|
+
bonusAPY,
|
|
63
|
+
totalMaxApy = 0,
|
|
64
|
+
maxLeverage = 0n,
|
|
65
|
+
baseBorrowRate = 0,
|
|
66
|
+
quotaRateMin = 0n
|
|
67
|
+
} = (0, import_get_strategy_max_apy.getStrategyMaxAPY)(
|
|
68
|
+
targetTokenAddress,
|
|
69
|
+
minCreditManager,
|
|
70
|
+
apyListByNetwork,
|
|
71
|
+
slippage,
|
|
72
|
+
quotaReserve,
|
|
73
|
+
strategy.maxLeverage
|
|
74
|
+
) || {};
|
|
75
|
+
const prices = allPricesByChain?.[minCreditManager?.chainId ?? EMPTY_CHAIN_ID]?.prices?.[minCreditManager?.pool || EMPTY_ADDRESS];
|
|
76
|
+
const underlyingPrice = prices?.[underlyingToken] || 0n;
|
|
77
|
+
const underlyingDecimals = tokensList?.[underlyingToken]?.decimals || 18;
|
|
78
|
+
const availableToBorrowMoney = import_price_math.PriceUtils.calcTotalPrice(
|
|
79
|
+
underlyingPrice,
|
|
80
|
+
availableToBorrow,
|
|
81
|
+
underlyingDecimals
|
|
82
|
+
);
|
|
83
|
+
const r = BigInt(baseBorrowRate) * (0, import_leverage.getFactorFromLeverage)(maxLeverage) / maxLeverage;
|
|
84
|
+
const qr = quotaRateMin;
|
|
85
|
+
const totalBorrowRate = Number(r + qr);
|
|
86
|
+
return {
|
|
87
|
+
maxLeverage,
|
|
88
|
+
maxAPY: totalMaxApy,
|
|
89
|
+
bonusAPY,
|
|
90
|
+
totalBorrowRate,
|
|
91
|
+
availableToBorrowMoney,
|
|
92
|
+
minCreditManager
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
getStrategyInfo
|
|
98
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_strategy_max_apy_exports = {};
|
|
20
|
+
__export(get_strategy_max_apy_exports, {
|
|
21
|
+
getStrategyMaxAPY: () => getStrategyMaxAPY
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(get_strategy_max_apy_exports);
|
|
24
|
+
var import_sdk = require("../../../../sdk/index.js");
|
|
25
|
+
var import_bonus_apy_from_points = require("../../apy/bonus-apy-from-points.js");
|
|
26
|
+
var import_calculate_effective_borrow_rate = require("../../apy/calculate-effective-borrow-rate.js");
|
|
27
|
+
var import_get_complex_apy_list = require("../../apy/get-complex-apy-list.js");
|
|
28
|
+
var import_get_single_quota_borrow_rate = require("../../apy/get-single-quota-borrow-rate.js");
|
|
29
|
+
var import_max_apy_formula = require("../../apy/max-apy-formula.js");
|
|
30
|
+
var import_leverage = require("../leverage/index.js");
|
|
31
|
+
function getStrategyMaxAPY(targetToken, cm, apyListByNetwork, slippage, quotaReserve, leverageLimit) {
|
|
32
|
+
if (!cm) return void 0;
|
|
33
|
+
const apyRecord = (0, import_get_complex_apy_list.getComplexAPYList)(
|
|
34
|
+
apyListByNetwork?.[cm.chainId]?.apyList,
|
|
35
|
+
apyListByNetwork?.[cm.chainId]?.extraCollateralAPYList,
|
|
36
|
+
cm.pool
|
|
37
|
+
);
|
|
38
|
+
const baseRateWithFee = (0, import_calculate_effective_borrow_rate.calculateEffectiveBorrowRate)({
|
|
39
|
+
underlyingTokenAddress: cm.underlyingToken,
|
|
40
|
+
baseRateWithFee: cm.baseBorrowRate,
|
|
41
|
+
apyList: apyRecord
|
|
42
|
+
});
|
|
43
|
+
const lt = cm.liquidationThresholds[targetToken] || 0n;
|
|
44
|
+
const feeInterest = cm.feeInterest;
|
|
45
|
+
const tokenQuota = cm.quotas[targetToken] || {
|
|
46
|
+
token: targetToken,
|
|
47
|
+
rate: 0n,
|
|
48
|
+
quotaIncreaseFee: 0n,
|
|
49
|
+
totalQuoted: 0n,
|
|
50
|
+
limit: 0n,
|
|
51
|
+
isActive: true
|
|
52
|
+
};
|
|
53
|
+
const qRate = (tokenQuota?.rate || 0n) * lt / import_sdk.PERCENTAGE_FACTOR;
|
|
54
|
+
const qRate_reserve = qRate * (import_sdk.PERCENTAGE_FACTOR + (0, import_sdk.toBigInt)(quotaReserve)) / import_sdk.PERCENTAGE_FACTOR;
|
|
55
|
+
const quotaRateWithFee = (0, import_get_single_quota_borrow_rate.getSingleQuotaBorrowRate)({
|
|
56
|
+
quotaRates: {
|
|
57
|
+
[targetToken]: {
|
|
58
|
+
...tokenQuota,
|
|
59
|
+
rate: qRate_reserve
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
feeInterest,
|
|
63
|
+
quotas: {
|
|
64
|
+
[targetToken]: {
|
|
65
|
+
token: targetToken,
|
|
66
|
+
balance: 1n
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const leverage = (0, import_leverage.getLeverageFromFactor)(
|
|
71
|
+
(0, import_leverage.calculateMaxLeverageFactor)({
|
|
72
|
+
targetToken,
|
|
73
|
+
creditManagers: [cm],
|
|
74
|
+
slippage,
|
|
75
|
+
leverageLimit
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
const apy = apyRecord?.[targetToken] || 0;
|
|
79
|
+
const maxAPY = apyRecord ? (0, import_max_apy_formula.maxAPYFormula)({
|
|
80
|
+
apy,
|
|
81
|
+
leverage,
|
|
82
|
+
baseRateWithFee,
|
|
83
|
+
quotaRateWithFee: Number(quotaRateWithFee)
|
|
84
|
+
}) : void 0;
|
|
85
|
+
const bonusAPY = import_bonus_apy_from_points.BONUS_APY_FROM_POINTS[targetToken];
|
|
86
|
+
const bonusAPYTotal = BigInt(bonusAPY?.value || 0) * leverage / import_sdk.LEVERAGE_DECIMALS;
|
|
87
|
+
const totalMaxApy = (maxAPY || 0) + Number(bonusAPYTotal);
|
|
88
|
+
const totalBorrowRate = baseRateWithFee + Number(quotaRateWithFee);
|
|
89
|
+
return {
|
|
90
|
+
totalMaxApy,
|
|
91
|
+
bonusAPY,
|
|
92
|
+
maxAPY: maxAPY || 0,
|
|
93
|
+
maxLeverage: leverage,
|
|
94
|
+
quotaRateMin: quotaRateWithFee,
|
|
95
|
+
baseBorrowRate: baseRateWithFee,
|
|
96
|
+
totalBorrowRate
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
getStrategyMaxAPY
|
|
102
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var strategy_info_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(strategy_info_exports);
|
|
18
|
+
__reExport(strategy_info_exports, require("./cm-availability-condition.js"), module.exports);
|
|
19
|
+
__reExport(strategy_info_exports, require("./get-strategy-info.js"), module.exports);
|
|
20
|
+
__reExport(strategy_info_exports, require("./get-strategy-max-apy.js"), module.exports);
|
|
21
|
+
__reExport(strategy_info_exports, require("./is-strategy-cm-disabled.js"), module.exports);
|
|
22
|
+
__reExport(strategy_info_exports, require("./types.js"), module.exports);
|
|
23
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
+
0 && (module.exports = {
|
|
25
|
+
...require("./cm-availability-condition.js"),
|
|
26
|
+
...require("./get-strategy-info.js"),
|
|
27
|
+
...require("./get-strategy-max-apy.js"),
|
|
28
|
+
...require("./is-strategy-cm-disabled.js"),
|
|
29
|
+
...require("./types.js")
|
|
30
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var is_strategy_cm_disabled_exports = {};
|
|
20
|
+
__export(is_strategy_cm_disabled_exports, {
|
|
21
|
+
isStrategyCMDisabled: () => isStrategyCMDisabled
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(is_strategy_cm_disabled_exports);
|
|
24
|
+
function isStrategyCMDisabled(cm, quota) {
|
|
25
|
+
if (!quota) return true;
|
|
26
|
+
const realLimit = quota.isActive ? quota.limit : 0n;
|
|
27
|
+
const quotaLeft = realLimit - quota.totalQuoted;
|
|
28
|
+
return cm.availableToBorrow < cm.minDebt || quotaLeft < cm.minDebt;
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
isStrategyCMDisabled
|
|
33
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|