@reflectmoney/stable.ts 2.0.7 → 2.0.8
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.
|
@@ -338,10 +338,10 @@ class Stablecoin {
|
|
|
338
338
|
const { decimals } = yield (0, spl_token_1.getMint)(this.connection, collateralMint);
|
|
339
339
|
const collateralAmount = new bn_js_1.default(amount)
|
|
340
340
|
.mul(new bn_js_1.default(10).pow(new bn_js_1.default(decimals)))
|
|
341
|
+
.mul(new bn_js_1.default(10000 - slippageBips))
|
|
341
342
|
.div(new bn_js_1.default(10).pow(new bn_js_1.default(6))) // stablecoin decimals
|
|
342
343
|
.div(price)
|
|
343
344
|
.div(new bn_js_1.default(10).pow(new bn_js_1.default(expo)))
|
|
344
|
-
.mul(new bn_js_1.default(10000 - slippageBips))
|
|
345
345
|
.div(new bn_js_1.default(10000));
|
|
346
346
|
return collateralAmount;
|
|
347
347
|
});
|
|
@@ -364,8 +364,10 @@ class Stablecoin {
|
|
|
364
364
|
const stablecoinAmount = new bn_js_1.default(amount)
|
|
365
365
|
.mul(price)
|
|
366
366
|
.mul(new bn_js_1.default(10).pow(new bn_js_1.default(6))) // stablecoin decimals
|
|
367
|
+
.mul(new bn_js_1.default(10000 - slippageBips))
|
|
367
368
|
.div(new bn_js_1.default(10).pow(new bn_js_1.default(expo)))
|
|
368
|
-
.div(new bn_js_1.default(10).pow(new bn_js_1.default(decimals)))
|
|
369
|
+
.div(new bn_js_1.default(10).pow(new bn_js_1.default(decimals)))
|
|
370
|
+
.div(new bn_js_1.default(10000));
|
|
369
371
|
return stablecoinAmount;
|
|
370
372
|
});
|
|
371
373
|
}
|