mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
taker security deposit based on trade amount in range
This commit is contained in:
parent
281b7d0905
commit
a723c0d86b
2 changed files with 13 additions and 7 deletions
|
@ -1021,7 +1021,8 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
|||
setGraphic(null);
|
||||
} else {
|
||||
setText("");
|
||||
setGraphic(new ColoredDecimalPlacesWithZerosText(model.formatDepositString(
|
||||
String rangePrefix = item.getOffer().isRange() ? "<= " : "";
|
||||
setGraphic(new ColoredDecimalPlacesWithZerosText(rangePrefix + model.formatDepositString(
|
||||
deposit, item.getOffer().getAmount().longValueExact()),
|
||||
GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS));
|
||||
}
|
||||
|
|
|
@ -182,9 +182,7 @@ class TakeOfferDataModel extends OfferDataModel {
|
|||
|
||||
this.amount.set(offer.getAmount().min(BigInteger.valueOf(getMaxTradeLimit())));
|
||||
|
||||
securityDeposit = offer.getDirection() == OfferDirection.SELL ?
|
||||
getBuyerSecurityDeposit() :
|
||||
getSellerSecurityDeposit();
|
||||
updateSecurityDeposit();
|
||||
|
||||
calculateVolume();
|
||||
calculateTotalToPay();
|
||||
|
@ -374,11 +372,12 @@ class TakeOfferDataModel extends OfferDataModel {
|
|||
|
||||
void applyAmount(BigInteger amount) {
|
||||
this.amount.set(amount.min(BigInteger.valueOf(getMaxTradeLimit())));
|
||||
|
||||
calculateTotalToPay();
|
||||
}
|
||||
|
||||
void calculateTotalToPay() {
|
||||
updateSecurityDeposit();
|
||||
|
||||
// Taker pays 2 times the tx fee because the mining fee might be different when maker created the offer
|
||||
// and reserved his funds, so that would not work well with dynamic fees.
|
||||
// The mining fee for the takeOfferFee tx is deducted from the createOfferFee and not visible to the trader
|
||||
|
@ -468,11 +467,17 @@ class TakeOfferDataModel extends OfferDataModel {
|
|||
return securityDeposit;
|
||||
}
|
||||
|
||||
public BigInteger getBuyerSecurityDeposit() {
|
||||
private void updateSecurityDeposit() {
|
||||
securityDeposit = offer.getDirection() == OfferDirection.SELL ?
|
||||
getBuyerSecurityDeposit() :
|
||||
getSellerSecurityDeposit();
|
||||
}
|
||||
|
||||
private BigInteger getBuyerSecurityDeposit() {
|
||||
return offer.getOfferPayload().getBuyerSecurityDepositForTradeAmount(amount.get());
|
||||
}
|
||||
|
||||
public BigInteger getSellerSecurityDeposit() {
|
||||
private BigInteger getSellerSecurityDeposit() {
|
||||
return offer.getOfferPayload().getSellerSecurityDepositForTradeAmount(amount.get());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue