Skip to content

Commit

Permalink
Merge delegation_implicit_accounts_amount with locked_amount
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Mar 20, 2024
1 parent 14c34de commit 208e26c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions sdk/src/wallet/operations/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<S: 'static + SecretManage> Wallet<S> {

let mut balance = Balance::default();
let mut total_storage_cost = 0;
let mut delegation_implicit_accounts_amount = 0;
let mut locked_amount = 0;
let mut total_native_tokens = NativeTokensBuilder::default();

#[cfg(feature = "participation")]
Expand Down Expand Up @@ -272,7 +272,6 @@ impl<S: 'static + SecretManage> Wallet<S> {
// for `available` get locked_outputs, sum outputs amount and subtract from total_amount
log::debug!("[BALANCE] locked outputs: {:#?}", wallet_ledger.locked_outputs);

let mut locked_amount = 0;
let mut locked_mana = DecayedMana::default();
let mut locked_native_tokens = NativeTokensBuilder::default();

Expand Down Expand Up @@ -346,18 +345,13 @@ impl<S: 'static + SecretManage> Wallet<S> {

#[cfg(not(feature = "participation"))]
{
balance.base_coin.available = balance
.base_coin
.total
.saturating_sub(delegation_implicit_accounts_amount)
.saturating_sub(locked_amount);
balance.base_coin.available = balance.base_coin.total.saturating_sub(locked_amount);
}
#[cfg(feature = "participation")]
{
balance.base_coin.available = balance
.base_coin
.total
.saturating_sub(delegation_implicit_accounts_amount)
.saturating_sub(locked_amount)
.saturating_sub(balance.base_coin.voting_power);
}
Expand Down

0 comments on commit 208e26c

Please sign in to comment.