@defisaver/positions-sdk 1.0.26-dev-portfolio-3 → 1.0.26-dev-portfolio-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/cjs/maker/index.js +5 -6
- package/esm/maker/index.js +5 -6
- package/package.json +2 -2
- package/src/maker/index.ts +5 -6
package/cjs/maker/index.js
CHANGED
|
@@ -106,14 +106,13 @@ const _getMakerCdpData = (provider, network, cdp) => __awaiter(void 0, void 0, v
|
|
|
106
106
|
]);
|
|
107
107
|
const collInfo = (0, makerHelpers_1.parseCollateralInfo)(cdp.ilk, par.toString(), mat.toString(), artGlobal.toString(), rate.toString(), spot.toString(), line.toString(), duty.toString(), futureRate.toString(), chop.toString());
|
|
108
108
|
const collateral = (0, tokens_1.assetAmountInEth)(ink.toString(), cdp.asset);
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const debt = new decimal_js_1.default(cdpDebt).times(collInfo.currentRate).div(1e27).floor()
|
|
109
|
+
const collateralUsd = new decimal_js_1.default(collateral).mul(collInfo.assetPrice).toString();
|
|
110
|
+
const debt = new decimal_js_1.default(art).times(collInfo.currentRate).div(1e27).floor()
|
|
112
111
|
.toString();
|
|
113
|
-
const futureDebt = new decimal_js_1.default(
|
|
112
|
+
const futureDebt = new decimal_js_1.default(art).times(collInfo.futureRate).div(1e27).floor()
|
|
114
113
|
.toString(); // after drip
|
|
115
|
-
const liquidationPrice = new decimal_js_1.default(debt).times(collInfo.liqRatio).div(
|
|
116
|
-
let ratio = new decimal_js_1.default(
|
|
114
|
+
const liquidationPrice = new decimal_js_1.default(debt).times(collInfo.liqRatio).div(ink).toString();
|
|
115
|
+
let ratio = new decimal_js_1.default(ink).times(collInfo.assetPrice).div(debt).times(100)
|
|
117
116
|
.toString();
|
|
118
117
|
if (new decimal_js_1.default(debt).eq(0))
|
|
119
118
|
ratio = '0';
|
package/esm/maker/index.js
CHANGED
|
@@ -96,14 +96,13 @@ export const _getMakerCdpData = (provider, network, cdp) => __awaiter(void 0, vo
|
|
|
96
96
|
]);
|
|
97
97
|
const collInfo = parseCollateralInfo(cdp.ilk, par.toString(), mat.toString(), artGlobal.toString(), rate.toString(), spot.toString(), line.toString(), duty.toString(), futureRate.toString(), chop.toString());
|
|
98
98
|
const collateral = assetAmountInEth(ink.toString(), cdp.asset);
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
const debt = new Dec(cdpDebt).times(collInfo.currentRate).div(1e27).floor()
|
|
99
|
+
const collateralUsd = new Dec(collateral).mul(collInfo.assetPrice).toString();
|
|
100
|
+
const debt = new Dec(art).times(collInfo.currentRate).div(1e27).floor()
|
|
102
101
|
.toString();
|
|
103
|
-
const futureDebt = new Dec(
|
|
102
|
+
const futureDebt = new Dec(art).times(collInfo.futureRate).div(1e27).floor()
|
|
104
103
|
.toString(); // after drip
|
|
105
|
-
const liquidationPrice = new Dec(debt).times(collInfo.liqRatio).div(
|
|
106
|
-
let ratio = new Dec(
|
|
104
|
+
const liquidationPrice = new Dec(debt).times(collInfo.liqRatio).div(ink).toString();
|
|
105
|
+
let ratio = new Dec(ink).times(collInfo.assetPrice).div(debt).times(100)
|
|
107
106
|
.toString();
|
|
108
107
|
if (new Dec(debt).eq(0))
|
|
109
108
|
ratio = '0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/positions-sdk",
|
|
3
|
-
"version": "1.0.26-dev-portfolio-
|
|
3
|
+
"version": "1.0.26-dev-portfolio-4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dev": "tsc -p tsconfig.json --watch",
|
|
13
13
|
"lint": "eslint src/ --fix",
|
|
14
14
|
"lint-check": "eslint src/",
|
|
15
|
-
"test": "mocha tests/
|
|
15
|
+
"test": "mocha tests/maker.ts",
|
|
16
16
|
"test-single": "mocha ./tests/$npm_config_name.ts",
|
|
17
17
|
"test:debugger": "mocha --inspect-brk tests/*",
|
|
18
18
|
"build-test": "npm run build && npm run test",
|
package/src/maker/index.ts
CHANGED
|
@@ -168,16 +168,15 @@ export const _getMakerCdpData = async (provider: Client, network: NetworkNumber,
|
|
|
168
168
|
);
|
|
169
169
|
|
|
170
170
|
const collateral = assetAmountInEth(ink.toString(), cdp.asset);
|
|
171
|
-
const cdpDebt = assetAmountInEth(art.toString(), 'DAI');
|
|
172
171
|
|
|
173
|
-
const collateralUsd = new Dec(collateral).mul(collInfo.assetPrice).
|
|
174
|
-
const debt = new Dec(
|
|
172
|
+
const collateralUsd = new Dec(collateral).mul(collInfo.assetPrice).toString();
|
|
173
|
+
const debt = new Dec(art).times(collInfo.currentRate).div(1e27).floor()
|
|
175
174
|
.toString();
|
|
176
|
-
const futureDebt = new Dec(
|
|
175
|
+
const futureDebt = new Dec(art).times(collInfo.futureRate).div(1e27).floor()
|
|
177
176
|
.toString(); // after drip
|
|
178
|
-
const liquidationPrice = new Dec(debt).times(collInfo.liqRatio).div(
|
|
177
|
+
const liquidationPrice = new Dec(debt).times(collInfo.liqRatio).div(ink).toString();
|
|
179
178
|
|
|
180
|
-
let ratio = new Dec(
|
|
179
|
+
let ratio = new Dec(ink).times(collInfo.assetPrice).div(debt).times(100)
|
|
181
180
|
.toString();
|
|
182
181
|
if (new Dec(debt).eq(0)) ratio = '0';
|
|
183
182
|
|