@triadxyz/triad-protocol 2.9.6-beta → 2.9.8-beta

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/index.js CHANGED
@@ -896,11 +896,11 @@ class TriadProtocolClient {
896
896
  let adjustedPrice = orderPrice;
897
897
  if (feeBps > 0) {
898
898
  const priceSpread = new bn_js_1.default(1000000).sub(orderPrice);
899
- const fee = priceSpread
899
+ const fee = (0, helpers_1.roundUp)(priceSpread
900
900
  .mul(orderPrice)
901
901
  .mul(new bn_js_1.default(feeBps))
902
902
  .div(new bn_js_1.default(10000))
903
- .div(new bn_js_1.default(1000000));
903
+ .div(new bn_js_1.default(1000000)));
904
904
  adjustedPrice = orderPrice.add(fee);
905
905
  }
906
906
  const maxSharesForPrice = tempRemainingUSDC
@@ -945,17 +945,17 @@ class TriadProtocolClient {
945
945
  let adjustedPrice = orderPrice;
946
946
  if (feeBps > 0) {
947
947
  const priceSpread = new bn_js_1.default(1000000).sub(orderPrice);
948
- const fee = priceSpread
948
+ const fee = (0, helpers_1.roundUp)(priceSpread
949
949
  .mul(orderPrice)
950
950
  .mul(new bn_js_1.default(feeBps))
951
951
  .div(new bn_js_1.default(10000))
952
- .div(new bn_js_1.default(1000000));
952
+ .div(new bn_js_1.default(1000000)));
953
953
  adjustedPrice = orderPrice.add(fee);
954
954
  }
955
- const maxSharesForPrice = (0, helpers_1.roundUp)(remainingUSDC)
955
+ const maxSharesForPrice = remainingUSDC
956
956
  .mul(new bn_js_1.default(Math.pow(10, this.decimals)))
957
957
  .div(adjustedPrice);
958
- const sharesToBuy = bn_js_1.default.min((0, helpers_1.roundUp)(maxSharesForPrice), availableShares);
958
+ const sharesToBuy = bn_js_1.default.min(maxSharesForPrice, availableShares);
959
959
  if (sharesToBuy.lte(new bn_js_1.default(0)))
960
960
  continue;
961
961
  const usdcAmount = sharesToBuy
@@ -1033,11 +1033,11 @@ class TriadProtocolClient {
1033
1033
  let adjustedPrice = orderPrice;
1034
1034
  if (feeBps > 0) {
1035
1035
  const priceSpread = new bn_js_1.default(1000000).sub(orderPrice);
1036
- const fee = priceSpread
1036
+ const fee = (0, helpers_1.roundUp)(priceSpread
1037
1037
  .mul(orderPrice)
1038
1038
  .mul(new bn_js_1.default(feeBps))
1039
1039
  .div(new bn_js_1.default(10000))
1040
- .div(new bn_js_1.default(1000000));
1040
+ .div(new bn_js_1.default(1000000)));
1041
1041
  adjustedPrice = orderPrice.sub(fee);
1042
1042
  }
1043
1043
  amountOfUSDC = amountOfUSDC.add(sharesToSell.mul(adjustedPrice).div(new bn_js_1.default(Math.pow(10, this.decimals))));
@@ -251,7 +251,7 @@ const formatCustomer = (account, publicKey) => {
251
251
  exports.formatCustomer = formatCustomer;
252
252
  const roundUp = (value) => {
253
253
  let decimal = value.toNumber() / 1000000;
254
- let rounded = Math.round(decimal * 100) / 100;
254
+ let rounded = Math.ceil(decimal * 100) / 100;
255
255
  return new anchor_1.BN(rounded * 1000000);
256
256
  };
257
257
  exports.roundUp = roundUp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.9.6-beta",
3
+ "version": "2.9.8-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",