Exclude proof of burn amounts from trade fee display.

Use Proof of burn fee instead of burned BSQ from invalid tx.
This commit is contained in:
chimp1984 2021-01-24 20:40:34 -05:00
parent 51bde57f93
commit db86b89377
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3
4 changed files with 43 additions and 30 deletions

View file

@ -650,8 +650,12 @@ public class DaoFacade implements DaoSetupService {
return daoStateService.getLockupTxOutput(txId); return daoStateService.getLockupTxOutput(txId);
} }
public long getTotalBurntFee() { public long getTotalBurntTradeFee() {
return daoStateService.getTotalBurntFee(); return daoStateService.getTotalBurntTradeFee();
}
public long getTotalProofOfBurnAmount() {
return daoStateService.getTotalProofOfBurnAmount();
} }
public long getTotalIssuedAmount(IssuanceType issuanceType) { public long getTotalIssuedAmount(IssuanceType issuanceType) {

View file

@ -394,7 +394,7 @@ public class DaoStateService implements DaoSetupService {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// BurntFee // BurntFee (trade fee and fee burned at proof of burn)
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public long getBurntFee(String txId) { public long getBurntFee(String txId) {
@ -405,8 +405,16 @@ public class DaoStateService implements DaoSetupService {
return getBurntFee(txId) > 0; return getBurntFee(txId) > 0;
} }
public long getTotalBurntFee() { public long getTotalBurntTradeFee() {
return getUnorderedTxStream().mapToLong(Tx::getBurntFee).sum(); return getUnorderedTxStream()
.filter(tx -> TxOutputType.PROOF_OF_BURN_OP_RETURN_OUTPUT != tx.getLastTxOutput().getTxOutputType())
.mapToLong(Tx::getBurntFee).sum();
}
public long getTotalProofOfBurnAmount() {
return getUnorderedTxStream()
.filter(tx -> TxOutputType.PROOF_OF_BURN_OP_RETURN_OUTPUT == tx.getLastTxOutput().getTxOutputType())
.mapToLong(Tx::getBurntFee).sum();
} }
public Set<Tx> getBurntFeeTxs() { public Set<Tx> getBurntFeeTxs() {

View file

@ -2451,8 +2451,8 @@ dao.factsAndFigures.supply.totalLockedUpAmount=Locked up in bonds
dao.factsAndFigures.supply.totalUnlockingAmount=Unlocking BSQ from bonds dao.factsAndFigures.supply.totalUnlockingAmount=Unlocking BSQ from bonds
dao.factsAndFigures.supply.totalUnlockedAmount=Unlocked BSQ from bonds dao.factsAndFigures.supply.totalUnlockedAmount=Unlocked BSQ from bonds
dao.factsAndFigures.supply.totalConfiscatedAmount=Confiscated BSQ from bonds dao.factsAndFigures.supply.totalConfiscatedAmount=Confiscated BSQ from bonds
dao.factsAndFigures.supply.invalidTxs=Burned BSQ (invalid transactions) dao.factsAndFigures.supply.proofOfBurnAmount=BSQ burned via 'Proof of Burn'
dao.factsAndFigures.supply.burntAmount=Burned BSQ (fees) dao.factsAndFigures.supply.burntAmount=Burned BSQ (trade fees)
dao.factsAndFigures.transactions.genesis=Genesis transaction dao.factsAndFigures.transactions.genesis=Genesis transaction
dao.factsAndFigures.transactions.genesisBlockHeight=Genesis block height dao.factsAndFigures.transactions.genesisBlockHeight=Genesis block height

View file

@ -105,8 +105,8 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
private int gridRow = 0; private int gridRow = 0;
private TextField genesisIssueAmountTextField, compRequestIssueAmountTextField, reimbursementAmountTextField, private TextField genesisIssueAmountTextField, compRequestIssueAmountTextField, reimbursementAmountTextField,
totalBurntFeeAmountTextField, totalLockedUpAmountTextField, totalUnlockingAmountTextField, totalBurntTradeFeeTextField, totalLockedUpAmountTextField, totalUnlockingAmountTextField,
totalUnlockedAmountTextField, totalConfiscatedAmountTextField, totalAmountOfInvalidatedBsqTextField; totalUnlockedAmountTextField, totalConfiscatedAmountTextField, totalProofOfBurnAmountTextField;
private XYChart.Series<Number, Number> seriesBSQIssuedMonthly, seriesBSQBurntMonthly, seriesBSQBurntDaily, private XYChart.Series<Number, Number> seriesBSQIssuedMonthly, seriesBSQBurntMonthly, seriesBSQBurntDaily,
seriesBSQBurntDailyMA; seriesBSQBurntDailyMA;
@ -256,10 +256,10 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
private void createSupplyReducedInformation() { private void createSupplyReducedInformation() {
addTitledGroupBg(root, ++gridRow, 3, Res.get("dao.factsAndFigures.supply.burnt"), Layout.GROUP_DISTANCE); addTitledGroupBg(root, ++gridRow, 3, Res.get("dao.factsAndFigures.supply.burnt"), Layout.GROUP_DISTANCE);
totalBurntFeeAmountTextField = addTopLabelReadOnlyTextField(root, gridRow, totalBurntTradeFeeTextField = addTopLabelReadOnlyTextField(root, gridRow,
Res.get("dao.factsAndFigures.supply.burntAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; Res.get("dao.factsAndFigures.supply.burntAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
totalAmountOfInvalidatedBsqTextField = addTopLabelReadOnlyTextField(root, gridRow, 1, totalProofOfBurnAmountTextField = addTopLabelReadOnlyTextField(root, gridRow, 1,
Res.get("dao.factsAndFigures.supply.invalidTxs"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; Res.get("dao.factsAndFigures.supply.proofOfBurnAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
var buttonTitle = Res.get("dao.factsAndFigures.supply.burntZoomToInliers"); var buttonTitle = Res.get("dao.factsAndFigures.supply.burntZoomToInliers");
zoomToInliersSlide = addSlideToggleButton(root, ++gridRow, buttonTitle); zoomToInliersSlide = addSlideToggleButton(root, ++gridRow, buttonTitle);
@ -348,7 +348,7 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
yAxisBSQBurntDaily, chartMaxNumberOfTicks, chartPercentToTrim, chartHowManyStdDevsConstituteOutlier); yAxisBSQBurntDaily, chartMaxNumberOfTicks, chartPercentToTrim, chartHowManyStdDevsConstituteOutlier);
} }
public static List<Number> getListXMinMax (List<XYChart.Data<Number, Number>> bsqList) { public static List<Number> getListXMinMax(List<XYChart.Data<Number, Number>> bsqList) {
long min = Long.MAX_VALUE, max = 0; long min = Long.MAX_VALUE, max = 0;
for (XYChart.Data<Number, ?> data : bsqList) { for (XYChart.Data<Number, ?> data : bsqList) {
min = Math.min(data.getXValue().longValue(), min); min = Math.min(data.getXValue().longValue(), min);
@ -477,20 +477,21 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
Coin issuedAmountFromReimbursementRequests = Coin.valueOf(daoFacade.getTotalIssuedAmount(IssuanceType.REIMBURSEMENT)); Coin issuedAmountFromReimbursementRequests = Coin.valueOf(daoFacade.getTotalIssuedAmount(IssuanceType.REIMBURSEMENT));
reimbursementAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(issuedAmountFromReimbursementRequests)); reimbursementAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(issuedAmountFromReimbursementRequests));
Coin totalBurntFee = Coin.valueOf(daoFacade.getTotalBurntFee()); Coin totalBurntTradeFee = Coin.valueOf(daoFacade.getTotalBurntTradeFee());
Coin totalProofOfBurnAmount = Coin.valueOf(daoFacade.getTotalProofOfBurnAmount());
Coin totalLockedUpAmount = Coin.valueOf(daoFacade.getTotalLockupAmount()); Coin totalLockedUpAmount = Coin.valueOf(daoFacade.getTotalLockupAmount());
Coin totalUnlockingAmount = Coin.valueOf(daoFacade.getTotalAmountOfUnLockingTxOutputs()); Coin totalUnlockingAmount = Coin.valueOf(daoFacade.getTotalAmountOfUnLockingTxOutputs());
Coin totalUnlockedAmount = Coin.valueOf(daoFacade.getTotalAmountOfUnLockedTxOutputs()); Coin totalUnlockedAmount = Coin.valueOf(daoFacade.getTotalAmountOfUnLockedTxOutputs());
Coin totalConfiscatedAmount = Coin.valueOf(daoFacade.getTotalAmountOfConfiscatedTxOutputs()); Coin totalConfiscatedAmount = Coin.valueOf(daoFacade.getTotalAmountOfConfiscatedTxOutputs());
Coin totalAmountOfInvalidatedBsq = Coin.valueOf(daoFacade.getTotalAmountOfInvalidatedBsq());
totalBurntFeeAmountTextField.setText("-" + bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalBurntFee)); String minusSign = totalBurntTradeFee.isPositive() ? "-" : "";
totalBurntTradeFeeTextField.setText(minusSign + bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalBurntTradeFee));
minusSign = totalProofOfBurnAmount.isPositive() ? "-" : "";
totalProofOfBurnAmountTextField.setText(minusSign + bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalProofOfBurnAmount));
totalLockedUpAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalLockedUpAmount)); totalLockedUpAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalLockedUpAmount));
totalUnlockingAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockingAmount)); totalUnlockingAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockingAmount));
totalUnlockedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockedAmount)); totalUnlockedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockedAmount));
totalConfiscatedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalConfiscatedAmount)); totalConfiscatedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalConfiscatedAmount));
String minusSign = totalAmountOfInvalidatedBsq.isPositive() ? "-" : "";
totalAmountOfInvalidatedBsqTextField.setText(minusSign + bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalAmountOfInvalidatedBsq));
updateChartSeries(); updateChartSeries();
} }