mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 12:09:22 +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);
|
setGraphic(null);
|
||||||
} else {
|
} else {
|
||||||
setText("");
|
setText("");
|
||||||
setGraphic(new ColoredDecimalPlacesWithZerosText(model.formatDepositString(
|
String rangePrefix = item.getOffer().isRange() ? "<= " : "";
|
||||||
|
setGraphic(new ColoredDecimalPlacesWithZerosText(rangePrefix + model.formatDepositString(
|
||||||
deposit, item.getOffer().getAmount().longValueExact()),
|
deposit, item.getOffer().getAmount().longValueExact()),
|
||||||
GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS));
|
GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS));
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,9 +182,7 @@ class TakeOfferDataModel extends OfferDataModel {
|
||||||
|
|
||||||
this.amount.set(offer.getAmount().min(BigInteger.valueOf(getMaxTradeLimit())));
|
this.amount.set(offer.getAmount().min(BigInteger.valueOf(getMaxTradeLimit())));
|
||||||
|
|
||||||
securityDeposit = offer.getDirection() == OfferDirection.SELL ?
|
updateSecurityDeposit();
|
||||||
getBuyerSecurityDeposit() :
|
|
||||||
getSellerSecurityDeposit();
|
|
||||||
|
|
||||||
calculateVolume();
|
calculateVolume();
|
||||||
calculateTotalToPay();
|
calculateTotalToPay();
|
||||||
|
@ -374,11 +372,12 @@ class TakeOfferDataModel extends OfferDataModel {
|
||||||
|
|
||||||
void applyAmount(BigInteger amount) {
|
void applyAmount(BigInteger amount) {
|
||||||
this.amount.set(amount.min(BigInteger.valueOf(getMaxTradeLimit())));
|
this.amount.set(amount.min(BigInteger.valueOf(getMaxTradeLimit())));
|
||||||
|
|
||||||
calculateTotalToPay();
|
calculateTotalToPay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void calculateTotalToPay() {
|
void calculateTotalToPay() {
|
||||||
|
updateSecurityDeposit();
|
||||||
|
|
||||||
// Taker pays 2 times the tx fee because the mining fee might be different when maker created the offer
|
// 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.
|
// 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
|
// 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;
|
return securityDeposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigInteger getBuyerSecurityDeposit() {
|
private void updateSecurityDeposit() {
|
||||||
|
securityDeposit = offer.getDirection() == OfferDirection.SELL ?
|
||||||
|
getBuyerSecurityDeposit() :
|
||||||
|
getSellerSecurityDeposit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigInteger getBuyerSecurityDeposit() {
|
||||||
return offer.getOfferPayload().getBuyerSecurityDepositForTradeAmount(amount.get());
|
return offer.getOfferPayload().getBuyerSecurityDepositForTradeAmount(amount.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigInteger getSellerSecurityDeposit() {
|
private BigInteger getSellerSecurityDeposit() {
|
||||||
return offer.getOfferPayload().getSellerSecurityDepositForTradeAmount(amount.get());
|
return offer.getOfferPayload().getSellerSecurityDepositForTradeAmount(amount.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue