diff --git a/rust/processor/src/models/fungible_asset_models/v2_fungible_asset_balances.rs b/rust/processor/src/models/fungible_asset_models/v2_fungible_asset_balances.rs
index adf510b30..b409de169 100644
--- a/rust/processor/src/models/fungible_asset_models/v2_fungible_asset_balances.rs
+++ b/rust/processor/src/models/fungible_asset_models/v2_fungible_asset_balances.rs
@@ -165,6 +165,13 @@ impl FungibleAssetBalance {
let asset_type = inner.metadata.get_reference_address();
let is_primary = Self::is_primary(&owner_address, &asset_type, &storage_id);
+ let concurrent_balance = object_data
+ .concurrent_fungible_asset_balance
+ .as_ref()
+ .map(|concurrent_fungible_asset_balance| {
+ concurrent_fungible_asset_balance.balance.value.clone()
+ });
+
let coin_balance = Self {
transaction_version: txn_version,
write_set_change_index,
@@ -173,7 +180,9 @@ impl FungibleAssetBalance {
asset_type: asset_type.clone(),
is_primary,
is_frozen: inner.frozen,
- amount: inner.balance.clone(),
+ amount: concurrent_balance
+ .clone()
+ .unwrap_or_else(|| inner.balance.clone()),
transaction_timestamp: txn_timestamp,
token_standard: TokenStandard::V2.to_string(),
};
@@ -183,7 +192,7 @@ impl FungibleAssetBalance {
asset_type: asset_type.clone(),
is_primary,
is_frozen: inner.frozen,
- amount: inner.balance.clone(),
+ amount: concurrent_balance.unwrap_or_else(|| inner.balance.clone()),
last_transaction_version: txn_version,
last_transaction_timestamp: txn_timestamp,
token_standard: TokenStandard::V2.to_string(),
diff --git a/rust/processor/src/models/fungible_asset_models/v2_fungible_asset_utils.rs b/rust/processor/src/models/fungible_asset_models/v2_fungible_asset_utils.rs
index 102dfe7c6..6529b7cbd 100644
--- a/rust/processor/src/models/fungible_asset_models/v2_fungible_asset_utils.rs
+++ b/rust/processor/src/models/fungible_asset_models/v2_fungible_asset_utils.rs
@@ -9,7 +9,7 @@ use crate::{
coin_models::coin_utils::COIN_ADDR, default_models::move_resources::MoveResource,
token_models::token_utils::URI_LENGTH, token_v2_models::v2_token_utils::ResourceReference,
},
- utils::util::{deserialize_from_string, truncate_str},
+ utils::util::{deserialize_from_string, truncate_str, Aggregator},
};
use anyhow::{Context, Result};
use aptos_protos::transaction::v1::WriteResource;
@@ -187,6 +187,76 @@ impl FungibleAssetSupply {
}
}
+#[derive(Serialize, Deserialize, Debug, Clone)]
+pub struct ConcurrentFungibleAssetSupply {
+ pub current: Aggregator,
+}
+
+impl ConcurrentFungibleAssetSupply {
+ pub fn from_write_resource(
+ write_resource: &WriteResource,
+ txn_version: i64,
+ ) -> anyhow::Result