drk: replaced rest hardcoded balance base10 decimals with the const

This commit is contained in:
skoupidi
2024-01-26 16:28:13 +02:00
parent cecf284cef
commit 9a2fad2c0f
3 changed files with 9 additions and 5 deletions

View File

@@ -111,10 +111,10 @@ impl fmt::Display for DaoParams {
"DAO Parameters",
"==============",
"Proposer limit",
encode_base10(self.proposer_limit, 8),
encode_base10(self.proposer_limit, BALANCE_BASE10_DECIMALS),
self.proposer_limit,
"Quorum",
encode_base10(self.quorum, 8),
encode_base10(self.quorum, BALANCE_BASE10_DECIMALS),
self.quorum,
"Approval ratio",
self.approval_ratio_quot as f64 / self.approval_ratio_base as f64,

View File

@@ -771,7 +771,11 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'static>>) -> Result<()> {
coin.1,
coin.0.note.token_id,
aliases,
format!("{} ({})", coin.0.note.value, encode_base10(coin.0.note.value, 8)),
format!(
"{} ({})",
coin.0.note.value,
encode_base10(coin.0.note.value, BALANCE_BASE10_DECIMALS)
),
spend_hook,
user_data
]);

View File

@@ -41,7 +41,7 @@ use darkfi_sdk::{
};
use darkfi_serial::{deserialize, serialize, Encodable};
use crate::{error::WalletDbResult, Drk};
use crate::{error::WalletDbResult, money::BALANCE_BASE10_DECIMALS, Drk};
impl Drk {
/// Import a token mint authority into the wallet
@@ -111,7 +111,7 @@ impl Drk {
let spend_hook = pallas::Base::zero();
let user_data = pallas::Base::zero();
let amount = decode_base10(amount, 8, false)?;
let amount = decode_base10(amount, BALANCE_BASE10_DECIMALS, false)?;
let mut tokens = self.list_tokens().await?;
tokens.retain(|x| x.0 == token_id);