Merge branch 'haveno-dex:master' into haveno-reto

This commit is contained in:
boldsuck 2025-01-19 17:38:50 +01:00 committed by GitHub
commit 2ba2946ca0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 56 additions and 40 deletions

View File

@ -49,7 +49,7 @@ configure(subprojects) {
gsonVersion = '2.8.5'
guavaVersion = '32.1.1-jre'
guiceVersion = '7.0.0'
moneroJavaVersion = '0.8.34'
moneroJavaVersion = '0.8.35'
httpclient5Version = '5.0'
hamcrestVersion = '2.2'
httpclientVersion = '4.5.12'
@ -610,7 +610,7 @@ configure(project(':desktop')) {
apply plugin: 'com.github.johnrengelman.shadow'
apply from: 'package/package.gradle'
version = '1.0.17-SNAPSHOT'
version = '1.0.18-SNAPSHOT'
jar.manifest.attributes(
"Implementation-Title": project.name,

View File

@ -28,7 +28,7 @@ import static com.google.common.base.Preconditions.checkArgument;
public class Version {
// The application versions
// We use semantic versioning with major, minor and patch
public static final String VERSION = "1.0.17";
public static final String VERSION = "1.0.18";
/**
* Holds a list of the tagged resource files for optimizing the getData requests.

View File

@ -151,11 +151,9 @@ public class CreateOfferService {
throw new IllegalArgumentException("Must provide fixed price");
}
// adjust amount and min amount for fixed-price offer
if (fixedPrice != null) {
amount = CoinUtil.getRoundedAmount(amount, fixedPrice, null, currencyCode, paymentAccount.getPaymentMethod().getId());
minAmount = CoinUtil.getRoundedAmount(minAmount, fixedPrice, null, currencyCode, paymentAccount.getPaymentMethod().getId());
}
// adjust amount and min amount
amount = CoinUtil.getRoundedAmount(amount, fixedPrice, null, currencyCode, paymentAccount.getPaymentMethod().getId());
minAmount = CoinUtil.getRoundedAmount(minAmount, fixedPrice, null, currencyCode, paymentAccount.getPaymentMethod().getId());
// generate one-time challenge for private offer
String challenge = null;

View File

@ -31,7 +31,7 @@ import lombok.extern.slf4j.Slf4j;
@Singleton
public class TradeLimits {
private static final BigInteger MAX_TRADE_LIMIT = HavenoUtils.xmrToAtomicUnits(528); // max trade limit for lowest risk payment method. Others will get derived from that.
private static final BigInteger MAX_TRADE_LIMIT_WITHOUT_BUYER_AS_TAKER_DEPOSIT = HavenoUtils.xmrToAtomicUnits(1); // max trade limit without deposit from buyer
private static final BigInteger MAX_TRADE_LIMIT_WITHOUT_BUYER_AS_TAKER_DEPOSIT = HavenoUtils.xmrToAtomicUnits(1.5); // max trade limit without deposit from buyer
@Nullable
@Getter

View File

@ -71,6 +71,7 @@ import javax.sound.sampled.SourceDataLine;
import lombok.extern.slf4j.Slf4j;
import monero.common.MoneroRpcConnection;
import monero.common.MoneroUtils;
import monero.daemon.model.MoneroOutput;
import monero.wallet.model.MoneroDestination;
import monero.wallet.model.MoneroTxWallet;
@ -204,11 +205,11 @@ public class HavenoUtils {
}
public static double atomicUnitsToXmr(BigInteger atomicUnits) {
return new BigDecimal(atomicUnits).divide(new BigDecimal(XMR_AU_MULTIPLIER)).doubleValue();
return MoneroUtils.atomicUnitsToXmr(atomicUnits);
}
public static BigInteger xmrToAtomicUnits(double xmr) {
return new BigDecimal(xmr).multiply(new BigDecimal(XMR_AU_MULTIPLIER)).toBigInteger();
return MoneroUtils.xmrToAtomicUnits(xmr);
}
public static long xmrToCentineros(double xmr) {
@ -220,11 +221,11 @@ public class HavenoUtils {
}
public static double divide(BigInteger auDividend, BigInteger auDivisor) {
return atomicUnitsToXmr(auDividend) / atomicUnitsToXmr(auDivisor);
return MoneroUtils.divide(auDividend, auDivisor);
}
public static BigInteger multiply(BigInteger amount1, double amount2) {
return amount1 == null ? null : new BigDecimal(amount1).multiply(BigDecimal.valueOf(amount2)).toBigInteger();
return MoneroUtils.multiply(amount1, amount2);
}
// ------------------------- FORMAT UTILS ---------------------------------

View File

@ -76,14 +76,14 @@ public class CoinUtil {
}
public static BigInteger getRoundedAmount(BigInteger amount, Price price, Long maxTradeLimit, String currencyCode, String paymentMethodId) {
if (PaymentMethod.isRoundedForAtmCash(paymentMethodId)) {
return getRoundedAtmCashAmount(amount, price, maxTradeLimit);
} else if (CurrencyUtil.isVolumeRoundedToNearestUnit(currencyCode)) {
return getRoundedAmountUnit(amount, price, maxTradeLimit);
} else if (CurrencyUtil.isFiatCurrency(currencyCode)) {
return getRoundedAmount4Decimals(amount, price, maxTradeLimit);
if (price != null) {
if (PaymentMethod.isRoundedForAtmCash(paymentMethodId)) {
return getRoundedAtmCashAmount(amount, price, maxTradeLimit);
} else if (CurrencyUtil.isVolumeRoundedToNearestUnit(currencyCode)) {
return getRoundedAmountUnit(amount, price, maxTradeLimit);
}
}
return amount;
return getRoundedAmount4Decimals(amount, maxTradeLimit);
}
public static BigInteger getRoundedAtmCashAmount(BigInteger amount, Price price, Long maxTradeLimit) {
@ -103,7 +103,7 @@ public class CoinUtil {
return getAdjustedAmount(amount, price, maxTradeLimit, 1);
}
public static BigInteger getRoundedAmount4Decimals(BigInteger amount, Price price, Long maxTradeLimit) {
public static BigInteger getRoundedAmount4Decimals(BigInteger amount, Long maxTradeLimit) {
DecimalFormat decimalFormat = new DecimalFormat("#.####");
double roundedXmrAmount = Double.parseDouble(decimalFormat.format(HavenoUtils.atomicUnitsToXmr(amount)));
return HavenoUtils.xmrToAtomicUnits(roundedXmrAmount);

View File

@ -781,11 +781,23 @@ public class XmrWalletService extends XmrWalletBase {
BigInteger actualSendAmount = transferCheck.getReceivedAmount();
// verify trade fee amount
if (!actualTradeFee.equals(tradeFeeAmount)) throw new RuntimeException("Invalid trade fee amount, expected " + tradeFeeAmount + " but was " + actualTradeFee);
if (!actualTradeFee.equals(tradeFeeAmount)) {
if (equalsWithinFractionError(actualTradeFee, tradeFeeAmount)) {
log.warn("Trade tx fee amount is within fraction error, expected " + tradeFeeAmount + " but was " + actualTradeFee);
} else {
throw new RuntimeException("Invalid trade fee amount, expected " + tradeFeeAmount + " but was " + actualTradeFee);
}
}
// verify send amount
BigInteger expectedSendAmount = sendAmount.subtract(tx.getFee());
if (!actualSendAmount.equals(expectedSendAmount)) throw new RuntimeException("Invalid send amount, expected " + expectedSendAmount + " but was " + actualSendAmount + " with tx fee " + tx.getFee());
if (!actualSendAmount.equals(expectedSendAmount)) {
if (equalsWithinFractionError(actualSendAmount, expectedSendAmount)) {
log.warn("Trade tx send amount is within fraction error, expected " + expectedSendAmount + " but was " + actualSendAmount + " with tx fee " + tx.getFee());
} else {
throw new RuntimeException("Invalid send amount, expected " + expectedSendAmount + " but was " + actualSendAmount + " with tx fee " + tx.getFee());
}
}
return tx;
} catch (Exception e) {
log.warn("Error verifying trade tx with offer id=" + offerId + (tx == null ? "" : ", tx=\n" + tx) + ": " + e.getMessage());
@ -801,6 +813,11 @@ public class XmrWalletService extends XmrWalletBase {
}
}
// TODO: old bug in atomic unit conversion could cause fractional difference error, remove this in future release, maybe re-sign all offers then
private static boolean equalsWithinFractionError(BigInteger a, BigInteger b) {
return a.subtract(b).abs().compareTo(new BigInteger("1")) <= 0;
}
/**
* Get the tx fee estimate based on its weight.
*

View File

@ -3012,9 +3012,9 @@ Any special terms/conditions; \n\
Any other details.
payment.tradingRestrictions=Please review the maker's terms and conditions.\n\
If you do not meet the requirements do not take this trade.
payment.cashAtAtm.info=Cash at ATM: Cardless withdraw at ATM using code\n\n\
payment.cashAtAtm.info=Cardless Cash: Cardless withdraw at ATM using code\n\n\
To use this payment method:\n\n\
1. Create a Cash at ATM payment account, lising your accepted banks, regions, or other terms to be shown with the offer.\n\n\
1. Create a Cardless Cash payment account, lising your accepted banks, regions, or other terms to be shown with the offer.\n\n\
2. Create or take an offer with the payment account.\n\n\
3. When the offer is taken, chat with your peer to coordinate a time to complete the payment and share the payment details.\n\n\
If you cannot complete the transaction as specified in your trade contract, you may lose some (or all) of your security deposit.
@ -3073,7 +3073,7 @@ SPECIFIC_BANKS=Transfers with specific banks
US_POSTAL_MONEY_ORDER=US Postal Money Order
CASH_DEPOSIT=Cash Deposit
PAY_BY_MAIL=Pay By Mail
CASH_AT_ATM=Cash at ATM
CASH_AT_ATM=Cardless Cash
MONEY_GRAM=MoneyGram
WESTERN_UNION=Western Union
F2F=Face to face (in person)
@ -3093,7 +3093,7 @@ CASH_DEPOSIT_SHORT=Cash Deposit
# suppress inspection "UnusedProperty"
PAY_BY_MAIL_SHORT=Pay By Mail
# suppress inspection "UnusedProperty"
CASH_AT_ATM_SHORT=Cash At ATM
CASH_AT_ATM_SHORT=Cardless Cash
# suppress inspection "UnusedProperty"
MONEY_GRAM_SHORT=MoneyGram
# suppress inspection "UnusedProperty"

View File

@ -3012,9 +3012,9 @@ Jakékoli zvláštní podmínky; \n\
Jakékoli další údaje.
payment.tradingRestrictions=Přečtěte si prosím podmínky tvůrce.\n\
Pokud nesplňujete požadavky, nepřijímejte tento obchod.
payment.cashAtAtm.info=Hotovost u bankomatu: Výběr z bankomatu bez karty a pomocí kódu\n\n\
payment.cashAtAtm.info=Výběr bez karty: Výběr z bankomatu bez karty a pomocí kódu\n\n\
Použití tohoto způsobu platby:\n\n\
1. Vytvořte si platební účet Hotovost u bankomatu a uveďte přijímané banky, regiony nebo jiné podmínky, které se zobrazí u nabídky.\n\n\n\
1. Vytvořte si platební účet Výběr bez karty a uveďte přijímané banky, regiony nebo jiné podmínky, které se zobrazí u nabídky.\n\n\n\
2. Vytvořte nebo přijměte nabídku s tímto platebním účtem.\n\n\
3. Po přijetí nabídky se domluvte s obchodním partnerem na čase dokončení platby a sdílejte podrobnosti o platbě.\n\n\
Pokud se vám nepodaří dokončit transakci, jak je uvedeno v obchodní smlouvě, můžete přijít o část (nebo celou) vaší kauci.

View File

@ -2999,9 +2999,9 @@ payment.payByMail.extraInfo.prompt=Tekliflerinize lütfen şunları belirtin: \n
Diğer detaylar.
payment.tradingRestrictions=Lütfen yapıcı tarafın şartlarını ve koşullarını gözden geçirin.\n\
Gereksinimleri karşılamıyorsanız bu ticareti yapmayın.
payment.cashAtAtm.info=ATM'de Nakit: Kod kullanarak ATM'den kartsız para çekme\n\n\
payment.cashAtAtm.info=Kartsız Nakit: Kod kullanarak ATM'den kartsız para çekme\n\n\
Bu ödeme yöntemini kullanmak için:\n\n\
1. Kabul ettiğiniz bankaları, bölgeleri veya teklifle birlikte gösterilecek diğer şartları listeleyerek bir ATM'de Nakit ödeme hesabı oluşturun.\n\n\
1. Kabul ettiğiniz bankaları, bölgeleri veya teklifle birlikte gösterilecek diğer şartları listeleyerek bir Kartsız Nakit ödeme hesabı oluşturun.\n\n\
2. Ödeme hesabı ile bir teklif oluşturun veya bir teklifi kabul edin.\n\n\
3. Teklif kabul edildiğinde, ödeme detaylarını paylaşmak ve ödemeyi tamamlamak için eşinizle sohbet edin.\n\n\
Ticaret sözleşmenizde belirtilen şekilde işlemi tamamlayamazsanız, güvenlik teminatınızın bir kısmını (veya tamamını) kaybedebilirsiniz.

View File

@ -60,6 +60,6 @@
</content_rating>
<releases>
<release version="1.0.17" date="2024-12-21"/>
<release version="1.0.18" date="2025-01-19"/>
</releases>
</component>

View File

@ -5,10 +5,10 @@
<!-- See: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -->
<key>CFBundleVersion</key>
<string>1.0.17</string>
<string>1.0.18</string>
<key>CFBundleShortVersionString</key>
<string>1.0.17</string>
<string>1.0.18</string>
<key>CFBundleExecutable</key>
<string>Haveno</string>

View File

@ -43,7 +43,7 @@ public class CashAtAtmForm extends PaymentMethodForm {
PaymentAccountPayload paymentAccountPayload) {
CashAtAtmAccountPayload cbm = (CashAtAtmAccountPayload) paymentAccountPayload;
TextArea textExtraInfo = addCompactTopLabelTextArea(gridPane, gridRow, 1, Res.get("payment.shared.extraInfo"), "").second;
TextArea textExtraInfo = addCompactTopLabelTextArea(gridPane, ++gridRow, 0, Res.get("payment.shared.extraInfo"), "").second;
textExtraInfo.setMinHeight(70);
textExtraInfo.setEditable(false);
textExtraInfo.setText(cbm.getExtraInfo());

View File

@ -270,7 +270,7 @@ Then follow these instructions: https://github.com/haveno-dex/haveno/blob/master
<b>Set the mandatory minimum version for trading (optional)</b>
If applicable, update the mandatory minimum version for trading, by entering `ctrl + f` to open the Filter window, enter a private key with developer privileges, and enter the minimum version (e.g. 1.0.17) in the field labeled "Min. version required for trading".
If applicable, update the mandatory minimum version for trading, by entering `ctrl + f` to open the Filter window, enter a private key with developer privileges, and enter the minimum version (e.g. 1.0.18) in the field labeled "Min. version required for trading".
<b>Send update alert</b>

View File

@ -815,9 +815,9 @@
<sha256 value="c92e2ca40a3f2474d61e56831aeb379cf8ae3dddeea61b4a828cee2d99f71f38" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="io.github.woodser" name="monero-java" version="0.8.34">
<artifact name="monero-java-0.8.34.jar">
<sha256 value="12662589eec0a188175274c6ae3ca309172358a936b27fc95a9013d6015fc81a" origin="Generated by Gradle"/>
<component group="io.github.woodser" name="monero-java" version="0.8.35">
<artifact name="monero-java-0.8.35.jar">
<sha256 value="bd6e7ae8cba64928f16279cb9d21f84484ca7e7377ee7da68bd6686762bb1016" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="io.grpc" name="grpc-api" version="1.42.1">

View File

@ -41,7 +41,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SeedNodeMain extends ExecutableForAppWithP2p {
private static final long CHECK_CONNECTION_LOSS_SEC = 30;
private static final String VERSION = "1.0.17";
private static final String VERSION = "1.0.18";
private SeedNode seedNode;
private Timer checkConnectionLossTime;