@gearbox-protocol/sdk 3.0.0-prevfour.1 → 3.0.0-prevfour.2
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 +3 -17
- package/lib/core/strategy.js +4 -16
- package/package.json +1 -1
package/lib/core/strategy.d.ts
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
import { NetworkType, PartialRecord
|
|
1
|
+
import { NetworkType, PartialRecord } from "@gearbox-protocol/sdk-gov";
|
|
2
2
|
import { Address } from "viem";
|
|
3
|
-
import { AllLPTokens } from "../apy";
|
|
4
3
|
import { CreditManagerData } from "./creditManager";
|
|
5
|
-
type ReleaseAt = undefined | number | PartialRecord<NetworkType, number>;
|
|
6
|
-
export interface StrategyPayload {
|
|
7
|
-
name: string;
|
|
8
|
-
lpTokenSymbol: AllLPTokens;
|
|
9
|
-
protocolSymbol: string;
|
|
10
|
-
collateralTokens: Array<SupportedToken>;
|
|
11
|
-
releaseAt?: ReleaseAt;
|
|
12
|
-
}
|
|
4
|
+
export type ReleaseAt = undefined | number | PartialRecord<NetworkType, number>;
|
|
13
5
|
interface CalculateMaxAPYProps {
|
|
14
6
|
apy: number;
|
|
15
7
|
leverage: number;
|
|
16
8
|
baseRateWithFee: number;
|
|
17
9
|
quotaRateWithFee: number;
|
|
18
10
|
}
|
|
19
|
-
export declare class
|
|
20
|
-
readonly name: string;
|
|
21
|
-
readonly lpTokenSymbol: AllLPTokens;
|
|
22
|
-
readonly protocolSymbol: string;
|
|
23
|
-
readonly releaseAt: ReleaseAt;
|
|
24
|
-
readonly collateralTokens: Array<SupportedToken>;
|
|
25
|
-
constructor(payload: StrategyPayload);
|
|
11
|
+
export declare class PositionUtils {
|
|
26
12
|
static maxLeverage(lpToken: Address, cms: Array<PartialCM>): number;
|
|
27
13
|
static maxAPY({ apy, leverage, baseRateWithFee, quotaRateWithFee, }: CalculateMaxAPYProps): number;
|
|
28
14
|
protected static maxLeverageThreshold(lpToken: Address, cms: Array<PartialCM>): readonly [bigint, "" | `0x${string}`];
|
package/lib/core/strategy.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PositionUtils = void 0;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
|
-
class
|
|
6
|
-
name;
|
|
7
|
-
lpTokenSymbol;
|
|
8
|
-
protocolSymbol;
|
|
9
|
-
releaseAt;
|
|
10
|
-
collateralTokens;
|
|
11
|
-
constructor(payload) {
|
|
12
|
-
this.name = payload.name;
|
|
13
|
-
this.lpTokenSymbol = payload.lpTokenSymbol;
|
|
14
|
-
this.protocolSymbol = payload.protocolSymbol;
|
|
15
|
-
this.collateralTokens = payload.collateralTokens;
|
|
16
|
-
this.releaseAt = payload.releaseAt;
|
|
17
|
-
}
|
|
5
|
+
class PositionUtils {
|
|
18
6
|
static maxLeverage(lpToken, cms) {
|
|
19
|
-
const [maxThreshold] =
|
|
7
|
+
const [maxThreshold] = this.maxLeverageThreshold(lpToken, cms);
|
|
20
8
|
const maxLeverage = (sdk_gov_1.PERCENTAGE_FACTOR * sdk_gov_1.LEVERAGE_DECIMALS) /
|
|
21
9
|
(sdk_gov_1.PERCENTAGE_FACTOR - maxThreshold);
|
|
22
10
|
return Number(maxLeverage - sdk_gov_1.LEVERAGE_DECIMALS);
|
|
@@ -55,4 +43,4 @@ class Strategy {
|
|
|
55
43
|
return currentTimestamp > releaseAtNetwork;
|
|
56
44
|
}
|
|
57
45
|
}
|
|
58
|
-
exports.
|
|
46
|
+
exports.PositionUtils = PositionUtils;
|