Skip to content

Commit

Permalink
Merge pull request bisq-network#2118 from HenrikJannsen/fix-bsq-displ…
Browse files Browse the repository at this point in the history
…ay-in-reputation-list

Fix incorrect BSQ display
  • Loading branch information
djing-chan authored Apr 25, 2024
2 parents a43207d + 55ba6b8 commit b6d2c15
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package bisq.desktop.main.content.user.reputation.list;

import bisq.common.monetary.Coin;
import bisq.desktop.common.threading.UIThread;
import bisq.desktop.common.view.View;
import bisq.desktop.components.table.BisqTableColumn;
Expand All @@ -25,6 +26,7 @@
import bisq.desktop.main.content.components.ReputationScoreDisplay;
import bisq.desktop.main.content.components.UserProfileIcon;
import bisq.i18n.Res;
import bisq.presentation.formatters.AmountFormatter;
import bisq.presentation.formatters.TimeFormatter;
import bisq.user.profile.UserProfile;
import bisq.user.reputation.ReputationScore;
Expand Down Expand Up @@ -268,7 +270,7 @@ void applyReputationScore(String userProfileId) {
switch (selectedReputationSource.get()) {
case BURNED_BSQ:
case BSQ_BOND:
valueProperty.set(String.valueOf(value));
valueProperty.set(AmountFormatter.formatAmount(Coin.asBsqFromValue(value)));
break;
case PROFILE_AGE:
case BISQ1_ACCOUNT_AGE:
Expand Down
15 changes: 15 additions & 0 deletions common/src/main/java/bisq/common/monetary/Coin.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ public static Coin asBtcFromFaceValue(double faceValue) {
return new Coin(faceValue, "BTC", 8);
}

/**
* @param value Value as smallest unit the Coin object can represent.
*/
public static Coin asBsqFromValue(long value) {
return new Coin(value, "BSQ", 2);
}

/**
* @param faceValue Coin value as face value. E.g. 1.123456789012 XMR
*/
public static Coin asBsqFromFaceValue(double faceValue) {
return new Coin(faceValue, "BSQ", 2);
}


/**
* @param value Value as smallest unit the Coin object can represent.
*/
Expand Down

0 comments on commit b6d2c15

Please sign in to comment.