Display confiscated bond value

This commit is contained in:
sqrrm 2018-11-17 01:24:42 +01:00
parent 0c855f8dd0
commit aa27d443a4
No known key found for this signature in database
GPG Key ID: 45235F9EF87089EC
4 changed files with 18 additions and 1 deletions

View File

@ -513,6 +513,10 @@ public class DaoFacade implements DaoSetupService {
return daoStateService.getTotalAmountOfUnLockedTxOutputs();
}
public long getTotalAmountOfConfiscatedTxOutputs() {
return daoStateService.getTotalAmountOfConfiscatedTxOutputs();
}
public Optional<Integer> getLockTime(String txId) {
return daoStateService.getLockTime(txId);
}

View File

@ -751,6 +751,14 @@ public class DaoStateService implements DaoSetupService {
.sum();
}
public long getTotalAmountOfConfiscatedTxOutputs() {
return daoState.getConfiscatedTxOutputMap()
.values()
.stream()
.mapToLong(TxOutput::getValue)
.sum();
}
// Confiscate bond
public void confiscateBond(String lockupTxId) {
Optional<TxOutput> optionalTxOutput = getLockupTxOutput(lockupTxId);

View File

@ -1628,6 +1628,7 @@ dao.wallet.dashboard.burntAmount=Burned BSQ (fees)
dao.wallet.dashboard.totalLockedUpAmount=Locked up in bonds
dao.wallet.dashboard.totalUnlockingAmount=Unlocking BSQ from bonds
dao.wallet.dashboard.totalUnlockedAmount=Unlocked BSQ from bonds
dao.wallet.dashboard.totalConfiscatedAmount=Confiscated BSQ from bonds
dao.wallet.dashboard.allTx=No. of all BSQ transactions
dao.wallet.dashboard.utxo=No. of all unspent transaction outputs
dao.wallet.dashboard.compensationIssuanceTx=No. of all compensation request issuance transactions

View File

@ -65,7 +65,8 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
private int gridRow = 0;
private TextField genesisIssueAmountTextField, compRequestIssueAmountTextField, reimbursementAmountTextField, availableAmountTextField,
burntAmountTextField, totalLockedUpAmountTextField, totalUnlockingAmountTextField,
totalUnlockedAmountTextField, allTxTextField, burntTxTextField, utxoTextField, compensationIssuanceTxTextField,
totalUnlockedAmountTextField, totalConfiscatedAmountTextField, allTxTextField, burntTxTextField,
utxoTextField, compensationIssuanceTxTextField,
reimbursementIssuanceTxTextField, priceTextField, marketCapTextField;
private ChangeListener<Number> priceChangeListener;
private HyperlinkWithIcon hyperlinkWithIcon;
@ -106,6 +107,7 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
totalLockedUpAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, gridRow, columnIndex, Res.get("dao.wallet.dashboard.totalLockedUpAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
totalUnlockingAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.totalUnlockingAmount")).second;
totalUnlockedAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.totalUnlockedAmount")).second;
totalConfiscatedAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.totalConfiscatedAmount")).second;
gridRow++;
gridRow++;
@ -202,6 +204,7 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
Coin totalLockedUpAmount = Coin.valueOf(daoFacade.getTotalLockupAmount());
Coin totalUnlockingAmount = Coin.valueOf(daoFacade.getTotalAmountOfUnLockingTxOutputs());
Coin totalUnlockedAmount = Coin.valueOf(daoFacade.getTotalAmountOfUnLockedTxOutputs());
Coin totalConfiscatedAmount = Coin.valueOf(daoFacade.getTotalAmountOfConfiscatedTxOutputs());
Coin availableAmount = issuedAmountFromGenesis.add(issuedAmountFromCompRequests).subtract(burntFee);
availableAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(availableAmount));
@ -209,6 +212,7 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
totalLockedUpAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalLockedUpAmount));
totalUnlockingAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockingAmount));
totalUnlockedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockedAmount));
totalConfiscatedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalConfiscatedAmount));
allTxTextField.setText(String.valueOf(daoFacade.getTxs().size()));
utxoTextField.setText(String.valueOf(daoFacade.getUnspentTxOutputs().size()));
compensationIssuanceTxTextField.setText(String.valueOf(daoFacade.getNumIssuanceTransactions(IssuanceType.COMPENSATION)));