@gearbox-protocol/sdk 3.0.0-next.70 → 3.0.0-next.72
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/lib/core/strategy.d.ts +1 -1
- package/lib/core/strategy.js +1 -1
- package/lib/core/strategy.spec.js +1 -16
- package/package.json +2 -2
package/lib/core/strategy.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare class Strategy {
|
|
|
27
27
|
creditManagers: Array<string>;
|
|
28
28
|
constructor(payload: StrategyPayload);
|
|
29
29
|
static maxLeverage(lpToken: string, cms: Array<PartialCM>): number;
|
|
30
|
-
maxAPY(baseAPY: number, maxLeverage: number, borrowAPY: number): number;
|
|
30
|
+
static maxAPY(baseAPY: number, maxLeverage: number, borrowAPY: number): number;
|
|
31
31
|
static liquidationPrice({ prices, liquidationThresholds, borrowed, underlyingToken, targetToken, assets, }: LiquidationPriceProps): bigint;
|
|
32
32
|
protected static maxLeverageThreshold(lpToken: string, cms: Array<PartialCM>): readonly [bigint, string];
|
|
33
33
|
}
|
package/lib/core/strategy.js
CHANGED
|
@@ -27,7 +27,7 @@ class Strategy {
|
|
|
27
27
|
(sdk_gov_1.PERCENTAGE_FACTOR - maxThreshold);
|
|
28
28
|
return Number(maxLeverage - sdk_gov_1.LEVERAGE_DECIMALS);
|
|
29
29
|
}
|
|
30
|
-
maxAPY(baseAPY, maxLeverage, borrowAPY) {
|
|
30
|
+
static maxAPY(baseAPY, maxLeverage, borrowAPY) {
|
|
31
31
|
return (baseAPY +
|
|
32
32
|
((baseAPY - borrowAPY) * (maxLeverage - Number(sdk_gov_1.LEVERAGE_DECIMALS))) /
|
|
33
33
|
Number(sdk_gov_1.LEVERAGE_DECIMALS));
|
|
@@ -2,23 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
4
4
|
const chai_1 = require("chai");
|
|
5
|
-
const contractsRegister_1 = require("../contracts/contractsRegister");
|
|
6
5
|
const formatter_1 = require("../utils/formatter");
|
|
7
6
|
const strategy_1 = require("./strategy");
|
|
8
|
-
const lidoPayload = {
|
|
9
|
-
name: "Lido",
|
|
10
|
-
lpToken: sdk_gov_1.tokenDataByNetwork.Mainnet.STETH,
|
|
11
|
-
apy: 38434,
|
|
12
|
-
creditManagers: [contractsRegister_1.creditManagerByNetwork.Mainnet.WETH_V2],
|
|
13
|
-
unleveragableCollateral: [
|
|
14
|
-
sdk_gov_1.tokenDataByNetwork.Mainnet.USDC,
|
|
15
|
-
sdk_gov_1.tokenDataByNetwork.Mainnet.DAI,
|
|
16
|
-
sdk_gov_1.tokenDataByNetwork.Mainnet.WBTC,
|
|
17
|
-
],
|
|
18
|
-
leveragableCollateral: [],
|
|
19
|
-
baseAssets: [sdk_gov_1.tokenDataByNetwork.Mainnet.WETH],
|
|
20
|
-
};
|
|
21
|
-
const lidoStrategy = new strategy_1.Strategy(lidoPayload);
|
|
22
7
|
const pools = {
|
|
23
8
|
"0x1": {
|
|
24
9
|
borrowRate: 27543,
|
|
@@ -39,7 +24,7 @@ const liquidationThresholds = {
|
|
|
39
24
|
};
|
|
40
25
|
describe("Strategy test", () => {
|
|
41
26
|
it("maxAPY calculation is correct", () => {
|
|
42
|
-
const result =
|
|
27
|
+
const result = strategy_1.Strategy.maxAPY(53203, 10 * Number(sdk_gov_1.LEVERAGE_DECIMALS), pools["0x1"].borrowRate);
|
|
43
28
|
(0, chai_1.expect)(result).to.be.eq(284143);
|
|
44
29
|
});
|
|
45
30
|
it("liquidationPrice: calculation is correct", () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.72",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test": "npx mocha -r ts-node/register -r dotenv/config src/**/*.spec.ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@gearbox-protocol/sdk-gov": "^1.15.
|
|
33
|
+
"@gearbox-protocol/sdk-gov": "^1.15.2",
|
|
34
34
|
"axios": "^1.2.6",
|
|
35
35
|
"decimal.js-light": "^2.5.1",
|
|
36
36
|
"deep-eql": "^4.1.0",
|