Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect BSQ display #2118

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading