diff --git a/core/src/main/java/bisq/core/dao/burningman/BurningManPresentationService.java b/core/src/main/java/bisq/core/dao/burningman/BurningManPresentationService.java index d32843536c..b78fce15aa 100644 --- a/core/src/main/java/bisq/core/dao/burningman/BurningManPresentationService.java +++ b/core/src/main/java/bisq/core/dao/burningman/BurningManPresentationService.java @@ -45,12 +45,14 @@ import javax.inject.Singleton; import com.google.common.annotations.VisibleForTesting; import java.util.Collection; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.LongStream; import lombok.extern.slf4j.Slf4j; @@ -359,6 +361,17 @@ public class BurningManPresentationService implements DaoStateListener { .sum(); } + public long getBsqBurnedByMonth(Date dateFilter) { + Set defaultZeroBurn = new HashSet<>(); + defaultZeroBurn.add(new BurnOutputModel(0, 0, 0, "", 0L, 0)); + Map burningMen = getBurningManCandidatesByName(); + return burningMen.values().stream() + .map(burningMan -> burningMan.getBurnOutputModelsByMonth().getOrDefault(dateFilter, defaultZeroBurn).stream() + .mapToLong(BurnOutputModel::getAmount)) + .mapToLong(LongStream::sum) + .sum(); + } + public String getGenesisTxId() { return daoStateService.getGenesisTxId(); } diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/burningman/BurningManView.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/burningman/BurningManView.java index dd2acd47ea..4bbfdefcfa 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/burningman/BurningManView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/burningman/BurningManView.java @@ -675,7 +675,7 @@ public class BurningManView extends ActivatableView implements private void exportToCSV() { List result = new ArrayList<>(); String separator = "~"; - String tableColumns = "Month~BTC Fees~Fees as BSQ~DPT as BTC~DPT as BSQ~Distributed BTC~Distributed BTC as BSQ"; + String tableColumns = "Month~BTC Fees~Fees as BSQ~DPT as BTC~DPT as BSQ~Distributed BTC~Distributed BTC as BSQ~BSQ burned"; CSVEntryConverter headerConverter = item -> tableColumns.split(separator); CSVEntryConverter contentConverter = item -> item.split(separator); Date now = new Date(); @@ -686,6 +686,7 @@ public class BurningManView extends ActivatableView implements long feeAsBsqSum = 0; long dptAsBsqSum = 0; long distributedBtcAsBsqSum = 0; + long bsqBurnedSum = 0; long feeAsBsq, dptAsBsq, distributedBtcAsBsq; int year = 2023; int month = 0; @@ -697,7 +698,7 @@ public class BurningManView extends ActivatableView implements Map averageBsqPriceByMonth = burningManAccountingService.getAverageBsqPriceByMonth(); Optional price = Optional.ofNullable(averageBsqPriceByMonth.get(date)); - + long bsqBurned = burningManPresentationService.getBsqBurnedByMonth(date); List distributedBtcBalanceByMonth = burningManAccountingService.getDistributedBtcBalanceByMonth(date) .collect(Collectors.toList()); long feeAsBtc = distributedBtcBalanceByMonth.stream() @@ -726,7 +727,7 @@ public class BurningManView extends ActivatableView implements feeAsBsqSum += feeAsBsq; dptAsBsqSum += dptAsBsq; distributedBtcAsBsqSum += distributedBtcAsBsq; - + bsqBurnedSum += bsqBurned; line = new SimpleDateFormat("MMM yyyy", Locale.ENGLISH).format(date) + separator + btcFormatter.formatCoin(Coin.valueOf(feeAsBtc)) @@ -734,7 +735,8 @@ public class BurningManView extends ActivatableView implements + separator + btcFormatter.formatCoin(Coin.valueOf(dptAsBtc)) + separator + bsqFormatter.formatCoin(Coin.valueOf(dptAsBsq)) + separator + btcFormatter.formatCoin(Coin.valueOf(distributedBtc)) - + separator + bsqFormatter.formatCoin(Coin.valueOf(distributedBtcAsBsq)); + + separator + bsqFormatter.formatCoin(Coin.valueOf(distributedBtcAsBsq)) + + separator + bsqFormatter.formatCoin(Coin.valueOf(bsqBurned)); result.add(line); if (++month > 11) { month = 0; @@ -750,7 +752,8 @@ public class BurningManView extends ActivatableView implements + separator + btcFormatter.formatCoin(Coin.valueOf(dptAsBtcSum)) + separator + bsqFormatter.formatCoin(Coin.valueOf(dptAsBsqSum)) + separator + btcFormatter.formatCoin(Coin.valueOf(distributedBtcSum)) - + separator + bsqFormatter.formatCoin(Coin.valueOf(distributedBtcAsBsqSum)); + + separator + bsqFormatter.formatCoin(Coin.valueOf(distributedBtcAsBsqSum)) + + separator + bsqFormatter.formatCoin(Coin.valueOf(bsqBurnedSum)); result.add(line); GUIUtil.exportCSV("Burningman_dao_revenue.csv", headerConverter, contentConverter,