@gearbox-protocol/sdk 14.6.0-next.2 → 14.6.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/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.js +48 -0
- package/dist/cjs/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.js +54 -0
- package/dist/cjs/common-utils/utils/strategies/credit-managers/index.js +26 -0
- package/dist/cjs/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.js +31 -0
- package/dist/cjs/common-utils/utils/strategies/eligibility/index.js +24 -0
- package/dist/cjs/common-utils/utils/strategies/eligibility/is-strategy-eligible.js +46 -0
- package/dist/cjs/common-utils/utils/strategies/eligibility/is-strategy-released.js +31 -0
- package/dist/cjs/common-utils/utils/strategies/index.js +13 -1
- package/dist/cjs/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.js +39 -0
- package/dist/cjs/common-utils/utils/strategies/lists/get-available-strategies.js +47 -0
- package/dist/cjs/common-utils/utils/strategies/lists/get-disabled-strategies.js +48 -0
- package/dist/cjs/common-utils/utils/strategies/lists/get-released-strategies-list.js +60 -0
- package/dist/cjs/common-utils/utils/strategies/lists/index.js +24 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-state/index.js +22 -0
- package/dist/cjs/common-utils/utils/strategies/strategy-state/is-strategy-disabled.js +36 -0
- package/dist/cjs/common-utils/utils/strategies/tokens/index.js +26 -0
- package/dist/cjs/common-utils/utils/strategies/tokens/is-activated-token.js +36 -0
- package/dist/cjs/common-utils/utils/strategies/tokens/is-forbidden-token.js +33 -0
- package/dist/cjs/common-utils/utils/strategies/tokens/is-usable-token.js +32 -0
- package/dist/cjs/common-utils/utils/strategies/types/chains.js +16 -0
- package/dist/cjs/common-utils/utils/strategies/types/constants.js +28 -0
- package/dist/cjs/common-utils/utils/strategies/types/credit-manager-data-legacy.js +16 -0
- package/dist/cjs/common-utils/utils/strategies/types/curator-filter.js +16 -0
- package/dist/cjs/common-utils/utils/strategies/types/index.js +36 -0
- package/dist/cjs/common-utils/utils/strategies/types/sdk-state.js +16 -0
- package/dist/cjs/common-utils/utils/strategies/types/strategies-cm-list.js +16 -0
- package/dist/cjs/common-utils/utils/strategies/types/strategy.js +16 -0
- package/dist/cjs/common-utils/utils/strategies/types/targetable.js +16 -0
- package/dist/cjs/common-utils/utils/strategies/types.js +22 -0
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.js +24 -0
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.js +30 -0
- package/dist/esm/common-utils/utils/strategies/credit-managers/index.js +3 -0
- package/dist/esm/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.js +7 -0
- package/dist/esm/common-utils/utils/strategies/eligibility/index.js +2 -0
- package/dist/esm/common-utils/utils/strategies/eligibility/is-strategy-eligible.js +22 -0
- package/dist/esm/common-utils/utils/strategies/eligibility/is-strategy-released.js +7 -0
- package/dist/esm/common-utils/utils/strategies/index.js +6 -0
- package/dist/esm/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.js +15 -0
- package/dist/esm/common-utils/utils/strategies/lists/get-available-strategies.js +23 -0
- package/dist/esm/common-utils/utils/strategies/lists/get-disabled-strategies.js +24 -0
- package/dist/esm/common-utils/utils/strategies/lists/get-released-strategies-list.js +36 -0
- package/dist/esm/common-utils/utils/strategies/lists/index.js +2 -0
- package/dist/esm/common-utils/utils/strategies/strategy-state/index.js +1 -0
- package/dist/esm/common-utils/utils/strategies/strategy-state/is-strategy-disabled.js +12 -0
- package/dist/esm/common-utils/utils/strategies/tokens/index.js +3 -0
- package/dist/esm/common-utils/utils/strategies/tokens/is-activated-token.js +12 -0
- package/dist/esm/common-utils/utils/strategies/tokens/is-forbidden-token.js +9 -0
- package/dist/esm/common-utils/utils/strategies/tokens/is-usable-token.js +8 -0
- package/dist/esm/common-utils/utils/strategies/types/chains.js +0 -0
- package/dist/esm/common-utils/utils/strategies/types/constants.js +4 -0
- package/dist/esm/common-utils/utils/strategies/types/credit-manager-data-legacy.js +0 -0
- package/dist/esm/common-utils/utils/strategies/types/curator-filter.js +0 -0
- package/dist/esm/common-utils/utils/strategies/types/index.js +8 -0
- package/dist/esm/common-utils/utils/strategies/types/sdk-state.js +0 -0
- package/dist/esm/common-utils/utils/strategies/types/strategies-cm-list.js +0 -0
- package/dist/esm/common-utils/utils/strategies/types/strategy.js +0 -0
- package/dist/esm/common-utils/utils/strategies/types/targetable.js +0 -0
- package/dist/esm/common-utils/utils/strategies/types.js +1 -0
- package/dist/types/common-utils/utils/strategies/availability/check-degen-nft.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/availability/validate-open-account-pool-quota-status.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/availability/validate-open-account-pool-status.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.d.ts +8 -0
- package/dist/types/common-utils/utils/strategies/credit-managers/index.d.ts +3 -0
- package/dist/types/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/eligibility/index.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/eligibility/is-strategy-eligible.d.ts +8 -0
- package/dist/types/common-utils/utils/strategies/eligibility/is-strategy-released.d.ts +1 -0
- package/dist/types/common-utils/utils/strategies/index.d.ts +6 -0
- package/dist/types/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.d.ts +7 -0
- package/dist/types/common-utils/utils/strategies/lists/get-available-strategies.d.ts +5 -0
- package/dist/types/common-utils/utils/strategies/lists/get-disabled-strategies.d.ts +5 -0
- package/dist/types/common-utils/utils/strategies/lists/get-released-strategies-list.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/lists/index.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.d.ts +3 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/strategy-state/index.d.ts +1 -0
- package/dist/types/common-utils/utils/strategies/strategy-state/is-strategy-disabled.d.ts +3 -0
- package/dist/types/common-utils/utils/strategies/tokens/index.d.ts +3 -0
- package/dist/types/common-utils/utils/strategies/tokens/is-activated-token.d.ts +6 -0
- package/dist/types/common-utils/utils/strategies/tokens/is-forbidden-token.d.ts +6 -0
- package/dist/types/common-utils/utils/strategies/tokens/is-usable-token.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/types/chains.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/types/constants.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/types/credit-manager-data-legacy.d.ts +35 -0
- package/dist/types/common-utils/utils/strategies/types/curator-filter.d.ts +2 -0
- package/dist/types/common-utils/utils/strategies/types/index.d.ts +9 -0
- package/dist/types/common-utils/utils/strategies/types/sdk-state.d.ts +13 -0
- package/dist/types/common-utils/utils/strategies/types/strategies-cm-list.d.ts +5 -0
- package/dist/types/common-utils/utils/strategies/types/strategy.d.ts +16 -0
- package/dist/types/common-utils/utils/strategies/types/targetable.d.ts +6 -0
- package/dist/types/common-utils/utils/strategies/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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_forbidden_token_exports = {};
|
|
20
|
+
__export(is_forbidden_token_exports, {
|
|
21
|
+
isForbiddenToken: () => isForbiddenToken
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(is_forbidden_token_exports);
|
|
24
|
+
function isForbiddenToken({
|
|
25
|
+
address,
|
|
26
|
+
creditManager
|
|
27
|
+
}) {
|
|
28
|
+
return !!creditManager.forbiddenTokens[address];
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
isForbiddenToken
|
|
33
|
+
});
|
|
@@ -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 __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_usable_token_exports = {};
|
|
20
|
+
__export(is_usable_token_exports, {
|
|
21
|
+
isUsableToken: () => isUsableToken
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(is_usable_token_exports);
|
|
24
|
+
var import_is_activated_token = require("./is-activated-token.js");
|
|
25
|
+
var import_is_forbidden_token = require("./is-forbidden-token.js");
|
|
26
|
+
function isUsableToken({ address, creditManager }) {
|
|
27
|
+
return !(0, import_is_forbidden_token.isForbiddenToken)({ address, creditManager }) && (0, import_is_activated_token.isActivatedToken)({ address, creditManager });
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
isUsableToken
|
|
32
|
+
});
|
|
@@ -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 chains_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(chains_exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
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 constants_exports = {};
|
|
20
|
+
__export(constants_exports, {
|
|
21
|
+
EMPTY_ADDRESS: () => EMPTY_ADDRESS
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(constants_exports);
|
|
24
|
+
const EMPTY_ADDRESS = "";
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
EMPTY_ADDRESS
|
|
28
|
+
});
|
|
@@ -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 credit_manager_data_legacy_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(credit_manager_data_legacy_exports);
|
|
@@ -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 curator_filter_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(curator_filter_exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
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 types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
18
|
+
__reExport(types_exports, require("./chains.js"), module.exports);
|
|
19
|
+
__reExport(types_exports, require("./constants.js"), module.exports);
|
|
20
|
+
__reExport(types_exports, require("./credit-manager-data-legacy.js"), module.exports);
|
|
21
|
+
__reExport(types_exports, require("./curator-filter.js"), module.exports);
|
|
22
|
+
__reExport(types_exports, require("./sdk-state.js"), module.exports);
|
|
23
|
+
__reExport(types_exports, require("./strategies-cm-list.js"), module.exports);
|
|
24
|
+
__reExport(types_exports, require("./strategy.js"), module.exports);
|
|
25
|
+
__reExport(types_exports, require("./targetable.js"), module.exports);
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
...require("./chains.js"),
|
|
29
|
+
...require("./constants.js"),
|
|
30
|
+
...require("./credit-manager-data-legacy.js"),
|
|
31
|
+
...require("./curator-filter.js"),
|
|
32
|
+
...require("./sdk-state.js"),
|
|
33
|
+
...require("./strategies-cm-list.js"),
|
|
34
|
+
...require("./strategy.js"),
|
|
35
|
+
...require("./targetable.js")
|
|
36
|
+
});
|
|
@@ -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 sdk_state_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(sdk_state_exports);
|
|
@@ -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 strategies_cm_list_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(strategies_cm_list_exports);
|
|
@@ -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 strategy_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(strategy_exports);
|
|
@@ -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 targetable_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(targetable_exports);
|
|
@@ -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 types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
18
|
+
__reExport(types_exports, require("./types/index.js"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./types/index.js")
|
|
22
|
+
});
|
package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TypedObjectUtils } from "../../../../sdk/utils/mappers.js";
|
|
2
|
+
import { getStrategyCreditManagers } from "./get-strategy-credit-managers.js";
|
|
3
|
+
function getStrategyCreditManagersList(strategies, sdkStateByChain, curatorFilter) {
|
|
4
|
+
if (!sdkStateByChain) return sdkStateByChain;
|
|
5
|
+
if (!strategies) return strategies;
|
|
6
|
+
const r = strategies.reduce((acc, s) => {
|
|
7
|
+
const currentSdkState = sdkStateByChain[s.chainId];
|
|
8
|
+
const { creditManagers, tokens } = currentSdkState || {};
|
|
9
|
+
const cms = creditManagers && tokens ? getStrategyCreditManagers({
|
|
10
|
+
strategy: s,
|
|
11
|
+
allCreditManagers: creditManagers
|
|
12
|
+
}) : {};
|
|
13
|
+
const cmsAfterCuratorFilter = curatorFilter ? TypedObjectUtils.entries(cms).filter(
|
|
14
|
+
([, cm]) => curatorFilter[cm.marketConfigurator]
|
|
15
|
+
) : TypedObjectUtils.entries(cms);
|
|
16
|
+
if (!acc[s.chainId]) acc[s.chainId] = {};
|
|
17
|
+
acc[s.chainId][s.id] = Object.fromEntries(cmsAfterCuratorFilter);
|
|
18
|
+
return acc;
|
|
19
|
+
}, {});
|
|
20
|
+
return r;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
getStrategyCreditManagersList
|
|
24
|
+
};
|
package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isUsableToken } from "../tokens/is-usable-token.js";
|
|
2
|
+
import { isCreditManagerUsable } from "./is-credit-manager-usable.js";
|
|
3
|
+
function getStrategyCreditManagers({
|
|
4
|
+
strategy,
|
|
5
|
+
allCreditManagers
|
|
6
|
+
}) {
|
|
7
|
+
const lpAddress = strategy.tokenOutAddress;
|
|
8
|
+
const res = (strategy?.creditManagers || []).reduce(
|
|
9
|
+
(acc, cmAddress) => {
|
|
10
|
+
const cm = allCreditManagers[cmAddress];
|
|
11
|
+
if (cm && isCreditManagerUsable(cm)) {
|
|
12
|
+
const usable = isUsableToken({
|
|
13
|
+
address: lpAddress,
|
|
14
|
+
creditManager: cm
|
|
15
|
+
});
|
|
16
|
+
const limit = cm.quotas[lpAddress]?.limit || 0n;
|
|
17
|
+
const limitZero = lpAddress === cm.underlyingToken ? false : limit === 0n;
|
|
18
|
+
if (usable && !cm.isBorrowingForbidden && !limitZero) {
|
|
19
|
+
acc[cm.address] = cm;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return acc;
|
|
23
|
+
},
|
|
24
|
+
{}
|
|
25
|
+
);
|
|
26
|
+
return res;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
getStrategyCreditManagers
|
|
30
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EMPTY_ADDRESS } from "../types.js";
|
|
2
|
+
function isStrategyEligible(s, allowedChains, showHiddenStrategies, sdkStateByChain, curatorFilter) {
|
|
3
|
+
const network = s?.chainId !== void 0 ? allowedChains[s.chainId] : void 0;
|
|
4
|
+
const isNetworkCorrect = !!network && network === s.network;
|
|
5
|
+
const isHidden = !showHiddenStrategies && s.hideInProd;
|
|
6
|
+
const networkConditionMet = isNetworkCorrect && !isHidden;
|
|
7
|
+
const tokensList = sdkStateByChain?.[s.chainId]?.tokens?.tokenDataList;
|
|
8
|
+
const targetToken = tokensList?.[s?.tokenOutAddress || EMPTY_ADDRESS];
|
|
9
|
+
const isTokensCorrect = !!targetToken;
|
|
10
|
+
const showInMainApp = s.showInMainApp ?? true;
|
|
11
|
+
const showCondition = curatorFilter || showInMainApp;
|
|
12
|
+
return networkConditionMet && isTokensCorrect && showCondition ? {
|
|
13
|
+
isEligible: true,
|
|
14
|
+
network
|
|
15
|
+
} : {
|
|
16
|
+
isEligible: false,
|
|
17
|
+
network: void 0
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
isStrategyEligible
|
|
22
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export * from "./availability/index.js";
|
|
2
|
+
export * from "./credit-managers/index.js";
|
|
3
|
+
export * from "./eligibility/index.js";
|
|
2
4
|
export * from "./leverage/index.js";
|
|
5
|
+
export * from "./lists/index.js";
|
|
3
6
|
export * from "./sort-strategy-cms-by-availability/index.js";
|
|
4
7
|
export * from "./strategy-info/index.js";
|
|
8
|
+
export * from "./strategy-state/index.js";
|
|
9
|
+
export * from "./tokens/index.js";
|
|
10
|
+
export * from "./types.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getAvailableStrategies } from "./get-available-strategies.js";
|
|
2
|
+
import { getDisabledStrategies } from "./get-disabled-strategies.js";
|
|
3
|
+
function getAvailableAndDisabledStrategies(list, listCMs, curatorFilter) {
|
|
4
|
+
const available = getAvailableStrategies(list, listCMs);
|
|
5
|
+
const disabled = getDisabledStrategies(list, listCMs, curatorFilter);
|
|
6
|
+
return {
|
|
7
|
+
available: available.record,
|
|
8
|
+
disabled: disabled.record,
|
|
9
|
+
availableList: available.list,
|
|
10
|
+
disabledList: disabled.list
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
getAvailableAndDisabledStrategies
|
|
15
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isStrategyDisabled } from "../strategy-state/is-strategy-disabled.js";
|
|
2
|
+
function getAvailableStrategies(list, listCMs) {
|
|
3
|
+
if (listCMs instanceof Error) return { record: listCMs, list: listCMs };
|
|
4
|
+
if (!list) return { record: null, list: null };
|
|
5
|
+
if (!listCMs) return { record: null, list: null };
|
|
6
|
+
const a = list.reduce(
|
|
7
|
+
(acc, s) => {
|
|
8
|
+
const targetAddress = s.tokenOutAddress;
|
|
9
|
+
const strategyCmsList = Object.values(listCMs?.[s.chainId]?.[s.id] || {});
|
|
10
|
+
if (!acc.record[s.chainId]) acc.record[s.chainId] = {};
|
|
11
|
+
if (!isStrategyDisabled(targetAddress, strategyCmsList)) {
|
|
12
|
+
acc.record[s.chainId][s.id] = s;
|
|
13
|
+
acc.list.push(s);
|
|
14
|
+
}
|
|
15
|
+
return acc;
|
|
16
|
+
},
|
|
17
|
+
{ record: {}, list: [] }
|
|
18
|
+
);
|
|
19
|
+
return a;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
getAvailableStrategies
|
|
23
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isStrategyDisabled } from "../strategy-state/is-strategy-disabled.js";
|
|
2
|
+
function getDisabledStrategies(list, listCMs, curatorFilter) {
|
|
3
|
+
if (listCMs instanceof Error) return { record: {}, list: [] };
|
|
4
|
+
if (!list) return { record: {}, list: [] };
|
|
5
|
+
if (!listCMs) return { record: {}, list: [] };
|
|
6
|
+
const d = list.reduce(
|
|
7
|
+
(acc, s) => {
|
|
8
|
+
const targetAddress = s.tokenOutAddress;
|
|
9
|
+
const strategyCmsList = Object.values(listCMs?.[s.chainId]?.[s.id] || {});
|
|
10
|
+
const disabled = isStrategyDisabled(targetAddress, strategyCmsList);
|
|
11
|
+
if (!acc.record[s.chainId]) acc.record[s.chainId] = {};
|
|
12
|
+
if (curatorFilter ? disabled && strategyCmsList.length > 0 : disabled) {
|
|
13
|
+
acc.record[s.chainId][s.id] = s;
|
|
14
|
+
acc.list.push(s);
|
|
15
|
+
}
|
|
16
|
+
return acc;
|
|
17
|
+
},
|
|
18
|
+
{ record: {}, list: [] }
|
|
19
|
+
);
|
|
20
|
+
return d;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
getDisabledStrategies
|
|
24
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isStrategyEligible } from "../eligibility/is-strategy-eligible.js";
|
|
2
|
+
import { isStrategyReleased } from "../eligibility/is-strategy-released.js";
|
|
3
|
+
function getReleasedStrategiesList(strategyPayloadsList, allowedChains, sdkStateByChain, curatorFilter, showHiddenStrategies) {
|
|
4
|
+
if (!allowedChains) return void 0;
|
|
5
|
+
if (!strategyPayloadsList) return void 0;
|
|
6
|
+
const eligibleStrategies = strategyPayloadsList.reduce(
|
|
7
|
+
(acc, s) => {
|
|
8
|
+
const eligible = isStrategyEligible(
|
|
9
|
+
s,
|
|
10
|
+
allowedChains,
|
|
11
|
+
showHiddenStrategies,
|
|
12
|
+
sdkStateByChain,
|
|
13
|
+
curatorFilter
|
|
14
|
+
);
|
|
15
|
+
if (eligible.isEligible) {
|
|
16
|
+
acc.push({
|
|
17
|
+
...s,
|
|
18
|
+
id: s.tokenOutAddress,
|
|
19
|
+
network: eligible.network
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return acc;
|
|
23
|
+
},
|
|
24
|
+
[]
|
|
25
|
+
);
|
|
26
|
+
if (!sdkStateByChain) return eligibleStrategies;
|
|
27
|
+
const releasedStrategies = eligibleStrategies.filter((s) => {
|
|
28
|
+
const lastSyncBlock = sdkStateByChain?.[s.chainId]?.lastSyncBlock;
|
|
29
|
+
if (!lastSyncBlock) return true;
|
|
30
|
+
return showHiddenStrategies ? true : isStrategyReleased(s.releaseAt, lastSyncBlock.blockTimestamp_js);
|
|
31
|
+
}, {});
|
|
32
|
+
return releasedStrategies;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
getReleasedStrategiesList
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./is-strategy-disabled.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isStrategyCMDisabled } from "../strategy-info/is-strategy-cm-disabled.js";
|
|
2
|
+
function isStrategyDisabled(tokenOutAddress, cms) {
|
|
3
|
+
if (cms.length === 0) return true;
|
|
4
|
+
const allCmsUnavailable = cms.every((cm) => {
|
|
5
|
+
const quota = cm.quotas[tokenOutAddress];
|
|
6
|
+
return isStrategyCMDisabled(cm, quota);
|
|
7
|
+
});
|
|
8
|
+
return allCmsUnavailable;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
isStrategyDisabled
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function isActivatedToken({
|
|
2
|
+
address,
|
|
3
|
+
creditManager
|
|
4
|
+
}) {
|
|
5
|
+
const zeroLt = creditManager.liquidationThresholds[address] === 0n;
|
|
6
|
+
const quotaNotActive = creditManager.quotas[address]?.isActive === false;
|
|
7
|
+
const supportedToken = !!creditManager.supportedTokens[address];
|
|
8
|
+
return supportedToken && !zeroLt && !quotaNotActive;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
isActivatedToken
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isActivatedToken } from "./is-activated-token.js";
|
|
2
|
+
import { isForbiddenToken } from "./is-forbidden-token.js";
|
|
3
|
+
function isUsableToken({ address, creditManager }) {
|
|
4
|
+
return !isForbiddenToken({ address, creditManager }) && isActivatedToken({ address, creditManager });
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
isUsableToken
|
|
8
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./chains.js";
|
|
2
|
+
export * from "./constants.js";
|
|
3
|
+
export * from "./credit-manager-data-legacy.js";
|
|
4
|
+
export * from "./curator-filter.js";
|
|
5
|
+
export * from "./sdk-state.js";
|
|
6
|
+
export * from "./strategies-cm-list.js";
|
|
7
|
+
export * from "./strategy.js";
|
|
8
|
+
export * from "./targetable.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CreditManagerSlice } from "../strategy-info/types.js";
|
|
2
|
-
export declare function checkDegenNFT(creditManager: CreditManagerSlice): {
|
|
2
|
+
export declare function checkDegenNFT(creditManager: Pick<CreditManagerSlice, "isDegenMode" | "degenNFT">): {
|
|
3
3
|
nftAddress: `0x${string}`;
|
|
4
4
|
freeOfNFT: boolean;
|
|
5
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { CreditManagerSlice } from "../strategy-info/types.js";
|
|
3
|
-
export declare function validateOpenAccountPoolQuotaStatus(targetToken: Address, creditManager: CreditManagerSlice, amountToBorrow: bigint): {
|
|
3
|
+
export declare function validateOpenAccountPoolQuotaStatus(targetToken: Address, creditManager: Pick<CreditManagerSlice, "quotas">, amountToBorrow: bigint): {
|
|
4
4
|
readonly message: "insufficientQuota";
|
|
5
5
|
readonly token: `0x${string}`;
|
|
6
6
|
} | null;
|
package/dist/types/common-utils/utils/strategies/availability/validate-open-account-pool-status.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { CreditManagerSlice, PoolSlice } from "../strategy-info/types.js";
|
|
3
3
|
export interface ValidateOpenAccountPoolStatusProps {
|
|
4
|
-
creditManager: CreditManagerSlice
|
|
4
|
+
creditManager: Pick<CreditManagerSlice, "minDebt" | "totalDebtLimit" | "totalDebt" | "availableToBorrow" | "quotas">;
|
|
5
5
|
pool: PoolSlice | undefined | null;
|
|
6
6
|
debt: bigint;
|
|
7
7
|
targetToken: Address | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { CreditManagerDataSlice, CuratorFilter, GearboxSDKFullStateByChain, StrategiesCMListByChain, Strategy } from "../types.js";
|
|
2
|
+
export declare function getStrategyCreditManagersList<CM extends CreditManagerDataSlice>(strategies: Array<Strategy> | undefined, sdkStateByChain: GearboxSDKFullStateByChain<CM> | undefined, curatorFilter: CuratorFilter): StrategiesCMListByChain<CM> | undefined;
|
package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { CreditManagerDataSlice, Strategy } from "../types.js";
|
|
3
|
+
interface GetStrategyCreditManagersProps<CM extends CreditManagerDataSlice> {
|
|
4
|
+
strategy: Pick<Strategy, "tokenOutAddress" | "creditManagers">;
|
|
5
|
+
allCreditManagers: Record<Address, CM>;
|
|
6
|
+
}
|
|
7
|
+
export declare function getStrategyCreditManagers<CM extends CreditManagerDataSlice>({ strategy, allCreditManagers, }: GetStrategyCreditManagersProps<CM>): Record<`0x${string}`, CM>;
|
|
8
|
+
export {};
|