mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Change burn target calculation.
Left side is amount to burn to reach the max allowed receiver share based on the burned amount of all BM. The right side is the amount to burn to reach the max allowed receiver share based the boosted max burn target. Increase ISSUANCE_BOOST_FACTOR from 3 to 4. Add help overlay to burn target table header. Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
f799e115b0
commit
4860c1177a
5 changed files with 31 additions and 27 deletions
|
@ -61,10 +61,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
public class BurningManPresentationService implements DaoStateListener {
|
||||
// Burn target gets increased by that amount to give more flexibility.
|
||||
// Burn target is calculated from reimbursements + estimated BTC fees - burned amounts.
|
||||
private static final long BURN_TARGET_BOOST_AMOUNT = Config.baseCurrencyNetwork().isRegtest() ? 1000000 : 10000000;
|
||||
// To avoid that the BM get locked in small total burn amounts we allow to burn up to 1000 BSQ more than the
|
||||
// calculation to not exceed the cap would suggest.
|
||||
private static final long MAX_BURN_TARGET_LOWER_FLOOR = 100000;
|
||||
private static final long BURN_TARGET_BOOST_AMOUNT = 10000000;
|
||||
public static final String LEGACY_BURNING_MAN_DPT_NAME = "Legacy Burningman (DPT)";
|
||||
public static final String LEGACY_BURNING_MAN_BTC_FEES_NAME = "Legacy Burningman (BTC fees)";
|
||||
static final String LEGACY_BURNING_MAN_BTC_FEES_ADDRESS = "38bZBj5peYS3Husdz7AH3gEUiUbYRD951t";
|
||||
|
@ -173,44 +170,43 @@ public class BurningManPresentationService implements DaoStateListener {
|
|||
return Math.round(burningManCandidate.getCappedBurnAmountShare() * getAverageDistributionPerCycle());
|
||||
}
|
||||
|
||||
// Left side in tuple is the amount to burn to reach the max. burn share based on the total burned amount.
|
||||
// This value is safe to not burn more than needed and to avoid to get capped.
|
||||
// The right side is the amount to burn to reach the max. burn share based on the boosted burn target.
|
||||
// This can lead to burning too much and getting capped.
|
||||
public Tuple2<Long, Long> getCandidateBurnTarget(BurningManCandidate burningManCandidate) {
|
||||
long burnTarget = getBurnTarget();
|
||||
long boostedBurnTarget = burnTarget + BURN_TARGET_BOOST_AMOUNT;
|
||||
double compensationShare = burningManCandidate.getCompensationShare();
|
||||
if (burnTarget == 0 || compensationShare == 0) {
|
||||
|
||||
if (boostedBurnTarget <= 0 || compensationShare == 0) {
|
||||
return new Tuple2<>(0L, 0L);
|
||||
}
|
||||
|
||||
double maxCompensationShare = Math.min(BurningManService.MAX_BURN_SHARE, compensationShare);
|
||||
long lowerBaseTarget = Math.round(burnTarget * maxCompensationShare);
|
||||
long boostedBurnAmount = burnTarget + BURN_TARGET_BOOST_AMOUNT;
|
||||
double maxBoostedCompensationShare = Math.min(BurningManService.MAX_BURN_SHARE, compensationShare * BurningManService.ISSUANCE_BOOST_FACTOR);
|
||||
long upperBaseTarget = Math.round(boostedBurnAmount * maxBoostedCompensationShare);
|
||||
double maxBoostedCompensationShare = burningManCandidate.getMaxBoostedCompensationShare();
|
||||
long upperBaseTarget = Math.round(boostedBurnTarget * maxBoostedCompensationShare);
|
||||
long totalBurnedAmount = burnTargetService.getAccumulatedDecayedBurnedAmount(getBurningManCandidatesByName().values(), currentChainHeight);
|
||||
|
||||
if (totalBurnedAmount == 0) {
|
||||
// The first BM would reach their max burn share by 5.46 BSQ already. But we suggest the lowerBaseTarget
|
||||
// as lower target to speed up the bootstrapping.
|
||||
return new Tuple2<>(lowerBaseTarget, upperBaseTarget);
|
||||
}
|
||||
|
||||
double burnAmountShare = burningManCandidate.getBurnAmountShare();
|
||||
long candidatesBurnAmount = burningManCandidate.getAccumulatedDecayedBurnAmount();
|
||||
if (burnAmountShare < maxBoostedCompensationShare) {
|
||||
long myBurnAmount = getMissingAmountToReachTargetShare(totalBurnedAmount, candidatesBurnAmount, maxCompensationShare);
|
||||
long myMaxBurnAmount = getMissingAmountToReachTargetShare(totalBurnedAmount, candidatesBurnAmount, maxBoostedCompensationShare);
|
||||
|
||||
// We limit to base targets
|
||||
myBurnAmount = Math.min(myBurnAmount, lowerBaseTarget);
|
||||
myMaxBurnAmount = Math.min(myMaxBurnAmount, upperBaseTarget);
|
||||
|
||||
// We allow at least MAX_BURN_TARGET_LOWER_FLOOR (1000 BSQ) to burn, even if that means to hit the cap to give more flexibility
|
||||
// when low amounts are burned and the 11% cap would lock in BM to small increments per burn iteration.
|
||||
myMaxBurnAmount = Math.max(myMaxBurnAmount, MAX_BURN_TARGET_LOWER_FLOOR);
|
||||
long candidatesBurnAmount = burningManCandidate.getAccumulatedDecayedBurnAmount();
|
||||
long myBurnAmount = getMissingAmountToReachTargetShare(totalBurnedAmount, candidatesBurnAmount, maxBoostedCompensationShare);
|
||||
|
||||
// If below dust we set value to 0
|
||||
myBurnAmount = myBurnAmount < 546 ? 0 : myBurnAmount;
|
||||
return new Tuple2<>(myBurnAmount, myMaxBurnAmount);
|
||||
|
||||
return new Tuple2<>(myBurnAmount, upperBaseTarget);
|
||||
} else {
|
||||
// We have reached our cap.
|
||||
return new Tuple2<>(0L, MAX_BURN_TARGET_LOWER_FLOOR);
|
||||
return new Tuple2<>(0L, upperBaseTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,9 +91,9 @@ public class BurningManService {
|
|||
// Factor for boosting the issuance share (issuance is compensation requests + genesis output).
|
||||
// This will be used for increasing the allowed burn amount. The factor gives more flexibility
|
||||
// and compensates for those who do not burn. The burn share is capped by that factor as well.
|
||||
// E.g. a contributor with 10% issuance share will be able to receive max 20% of the BTC fees or DPT output
|
||||
// even if they had burned more and had a higher burn share than 20%.
|
||||
public static final double ISSUANCE_BOOST_FACTOR = 3;
|
||||
// E.g. a contributor with 2% issuance share will be able to receive max 8% of the BTC fees or DPT output
|
||||
// even if they had burned more and had a higher burn share than 8%.
|
||||
public static final double ISSUANCE_BOOST_FACTOR = 4;
|
||||
|
||||
// The max amount the burn share can reach. This value is derived from the min. security deposit in a trade and
|
||||
// ensures that an attack where a BM would take all sell offers cannot be economically profitable as they would
|
||||
|
|
|
@ -93,10 +93,13 @@ public class BurningManCandidate {
|
|||
|
||||
public void calculateShares(double totalDecayedCompensationAmounts, double totalDecayedBurnAmounts) {
|
||||
compensationShare = totalDecayedCompensationAmounts > 0 ? accumulatedDecayedCompensationAmount / totalDecayedCompensationAmounts : 0;
|
||||
double maxBoostedCompensationShare = Math.min(BurningManService.MAX_BURN_SHARE, compensationShare * BurningManService.ISSUANCE_BOOST_FACTOR);
|
||||
|
||||
burnAmountShare = totalDecayedBurnAmounts > 0 ? accumulatedDecayedBurnAmount / totalDecayedBurnAmounts : 0;
|
||||
cappedBurnAmountShare = Math.min(maxBoostedCompensationShare, burnAmountShare);
|
||||
cappedBurnAmountShare = Math.min(getMaxBoostedCompensationShare(), burnAmountShare);
|
||||
}
|
||||
|
||||
public double getMaxBoostedCompensationShare() {
|
||||
return Math.min(BurningManService.MAX_BURN_SHARE, compensationShare * BurningManService.ISSUANCE_BOOST_FACTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2307,6 +2307,10 @@ dao.burningman.shared.table.cycle=Cycle
|
|||
dao.burningman.shared.table.date=Date
|
||||
dao.burningman.table.name=Contributor name
|
||||
dao.burningman.table.burnTarget=Burn target
|
||||
dao.burningman.table.burnTarget.help=The left value is the amount to burn to reach the max. receiver share based on the total burned amount.\n\
|
||||
This value is safe to not burn more than needed and to avoid to get a capped receiver share.\n\n\
|
||||
The right value is the amount to burn to reach the max. receiver share based on the max. burn target.\n\
|
||||
This can lead to a capped receiver share but once the burn target is reached it should fall below the cap.
|
||||
dao.burningman.table.expectedRevenue=Expected to receive
|
||||
dao.burningman.table.burnAmount=Burned amount
|
||||
dao.burningman.table.decayedBurnAmount=Decayed burned amount
|
||||
|
|
|
@ -756,8 +756,9 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
|||
burningManTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getName().toLowerCase()));
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.burnTarget"));
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.burnTarget"), Res.get("dao.burningman.table.burnTarget.help"));
|
||||
column.setMinWidth(200);
|
||||
column.getGraphic().setStyle("-fx-alignment: center-right; -fx-padding: 2 10 2 0");
|
||||
column.getStyleClass().add("last-column");
|
||||
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||
column.setCellFactory(new Callback<>() {
|
||||
|
|
Loading…
Add table
Reference in a new issue