Skip to content

Commit

Permalink
Fix portfolio asset count.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neopallium authored and adamdossa committed Feb 14, 2024
1 parent a461eca commit 4247f7c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions pallets/asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ use pallet_base::{
ensure_opt_string_limited, ensure_string_limited, try_next_pre, Error::CounterOverflow,
};
use pallet_identity::PermissionedCallOriginData;
use pallet_portfolio::PortfolioAssetBalances;
use polymesh_common_utilities::asset::AssetFnTrait;
use polymesh_common_utilities::compliance_manager::ComplianceFnConfig;
use polymesh_common_utilities::constants::*;
Expand Down Expand Up @@ -1402,7 +1401,7 @@ impl<T: Config> Module<T> {
// Increase total supply.
token.total_supply = updated_total_supply;
BalanceOf::insert(ticker, issuer_portfolio.did, updated_to_balance);
PortfolioAssetBalances::insert(issuer_portfolio, ticker, updated_to_def_balance);
Portfolio::<T>::set_portfolio_balance(issuer_portfolio, ticker, updated_to_def_balance);
Tokens::insert(ticker, token);

Statistics::<T>::update_asset_stats(
Expand Down
7 changes: 3 additions & 4 deletions pallets/portfolio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
//!
//! - `default_portfolio_balance`: Returns the ticker balance of the identity's default portfolio.
//! - `user_portfolio_balance`: Returns the ticker balance of an identity's user portfolio.
//! - `set_default_portfolio_balance`: Sets the ticker balance of the identity's default portfolio.
//! - `set_portfolio_balance`: Sets the ticker balance of a portfolio.
//! - `unchecked_transfer_portfolio_balance`: Transfers funds from one portfolio to another.
//! - `ensure_portfolio_custody`: Makes sure that the given identity has custodian access over the portfolio.
//! - `ensure_portfolio_transfer_validity`: Makes sure that a transfer between two portfolios is valid.
Expand Down Expand Up @@ -447,9 +447,8 @@ impl<T: Config> Module<T> {
Self::portfolio_asset_balances(PortfolioId::user_portfolio(did, num), ticker)
}

/// Sets the ticker balance of the identity's default portfolio to `new`.
pub fn set_default_portfolio_balance(did: IdentityId, ticker: &Ticker, new: Balance) {
let pid = PortfolioId::default_portfolio(did);
/// Sets the ticker balance of the a portfolio to `new`.
pub fn set_portfolio_balance(pid: PortfolioId, ticker: &Ticker, new: Balance) {
PortfolioAssetBalances::mutate(&pid, ticker, |old| {
Self::transition_asset_count(&pid, *old, new);
*old = new;
Expand Down
2 changes: 1 addition & 1 deletion pallets/runtime/develop/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
authoring_version: 1,
// `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc`
// N.B. `d` is unpinned from the binary version
spec_version: 6_001_030,
spec_version: 6_001_031,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 4,
Expand Down
2 changes: 1 addition & 1 deletion pallets/runtime/mainnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
authoring_version: 1,
// `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc`
// N.B. `d` is unpinned from the binary version
spec_version: 6_001_030,
spec_version: 6_001_031,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 4,
Expand Down
2 changes: 1 addition & 1 deletion pallets/runtime/testnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
authoring_version: 1,
// `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc`
// N.B. `d` is unpinned from the binary version
spec_version: 6_001_030,
spec_version: 6_001_031,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 4,
Expand Down

0 comments on commit 4247f7c

Please sign in to comment.