From 0e7a70599d02bad0e0a966a39afba316adf15b9b Mon Sep 17 00:00:00 2001
From: skynetcap <100323448+skynetcap@users.noreply.github.com>
Date: Sun, 10 Dec 2023 10:09:35 -0800
Subject: [PATCH] OBv1: Use Math.round instead of Math.ceil for lot size
calculations
---
bonfida/pom.xml | 2 +-
magiceden/pom.xml | 2 +-
mango/pom.xml | 2 +-
metaplex/pom.xml | 2 +-
openbook/pom.xml | 2 +-
phoenix/pom.xml | 6 +++---
pom.xml | 2 +-
pyth/pom.xml | 2 +-
serum/pom.xml | 2 +-
.../src/main/java/com/mmorrell/serum/model/SerumUtils.java | 4 ++--
zeta/pom.xml | 2 +-
11 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/bonfida/pom.xml b/bonfida/pom.xml
index 58d49a4..dfa9f9d 100644
--- a/bonfida/pom.xml
+++ b/bonfida/pom.xml
@@ -5,7 +5,7 @@
solanaj-programs
com.mmorrell
- 1.19.17
+ 1.19.18
4.0.0
diff --git a/magiceden/pom.xml b/magiceden/pom.xml
index 98e47f6..e5f3233 100644
--- a/magiceden/pom.xml
+++ b/magiceden/pom.xml
@@ -5,7 +5,7 @@
solanaj-programs
com.mmorrell
- 1.19.17
+ 1.19.18
4.0.0
diff --git a/mango/pom.xml b/mango/pom.xml
index 3da6767..f1c20b5 100644
--- a/mango/pom.xml
+++ b/mango/pom.xml
@@ -5,7 +5,7 @@
solanaj-programs
com.mmorrell
- 1.19.17
+ 1.19.18
4.0.0
diff --git a/metaplex/pom.xml b/metaplex/pom.xml
index f50714c..29bf6bf 100644
--- a/metaplex/pom.xml
+++ b/metaplex/pom.xml
@@ -5,7 +5,7 @@
solanaj-programs
com.mmorrell
- 1.19.17
+ 1.19.18
4.0.0
diff --git a/openbook/pom.xml b/openbook/pom.xml
index 3af9606..746e13b 100644
--- a/openbook/pom.xml
+++ b/openbook/pom.xml
@@ -5,7 +5,7 @@
solanaj-programs
com.mmorrell
- 1.19.17
+ 1.19.18
4.0.0
diff --git a/phoenix/pom.xml b/phoenix/pom.xml
index 41fd2d5..f3fc912 100644
--- a/phoenix/pom.xml
+++ b/phoenix/pom.xml
@@ -6,7 +6,7 @@
com.mmorrell
solanaj-programs
- 1.19.17
+ 1.19.18
phoenix
@@ -20,13 +20,13 @@
com.mmorrell
serum
- 1.19.17
+ 1.19.18
compile
com.mmorrell
metaplex
- 1.19.17
+ 1.19.18
test
diff --git a/pom.xml b/pom.xml
index f88894d..f7829ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.mmorrell
solanaj-programs
pom
- 1.19.17
+ 1.19.18
${project.groupId}:${project.artifactId}
Program libraries for SolanaJ, a library for Solana RPC
https://github.com/skynetcap/solanaj-programs
diff --git a/pyth/pom.xml b/pyth/pom.xml
index 00fcf44..ec137ba 100644
--- a/pyth/pom.xml
+++ b/pyth/pom.xml
@@ -5,7 +5,7 @@
solanaj-programs
com.mmorrell
- 1.19.17
+ 1.19.18
4.0.0
diff --git a/serum/pom.xml b/serum/pom.xml
index b8e2556..73b1cc6 100644
--- a/serum/pom.xml
+++ b/serum/pom.xml
@@ -5,7 +5,7 @@
solanaj-programs
com.mmorrell
- 1.19.17
+ 1.19.18
4.0.0
diff --git a/serum/src/main/java/com/mmorrell/serum/model/SerumUtils.java b/serum/src/main/java/com/mmorrell/serum/model/SerumUtils.java
index 59914e2..5f36b30 100644
--- a/serum/src/main/java/com/mmorrell/serum/model/SerumUtils.java
+++ b/serum/src/main/java/com/mmorrell/serum/model/SerumUtils.java
@@ -262,7 +262,7 @@ public static long priceNumberToLots(float price, Market market) {
public static long priceNumberToLots(float price, byte quoteDecimals, long baseLotSize, byte baseDecimals, long quoteLotSize) {
double top = (price * Math.pow(10, quoteDecimals) * baseLotSize);
double bottom = Math.pow(10, baseDecimals) * quoteLotSize;
- return (long) Math.ceil(top / bottom);
+ return Math.round(top / bottom);
}
public static float baseSizeLotsToNumber(long size, long baseLotSize, long baseMultiplier) {
@@ -272,7 +272,7 @@ public static float baseSizeLotsToNumber(long size, long baseLotSize, long baseM
public static long baseSizeNumberToLots(float size, byte baseDecimals, long baseLotSize) {
double top = Math.round(size * Math.pow(10, baseDecimals));
- return (long) Math.ceil(top / baseLotSize);
+ return Math.round(top / baseLotSize);
}
public static OpenOrdersAccount findOpenOrdersAccountForOwner(RpcClient client, PublicKey marketAddress, PublicKey ownerAddress) {
diff --git a/zeta/pom.xml b/zeta/pom.xml
index b187726..e1f1752 100644
--- a/zeta/pom.xml
+++ b/zeta/pom.xml
@@ -5,7 +5,7 @@
solanaj-programs
com.mmorrell
- 1.19.17
+ 1.19.18
4.0.0