diff --git a/rust/processor/src/db/common/models/coin_models/coin_activities.rs b/rust/processor/src/db/common/models/coin_models/coin_activities.rs
index e7467761f..674252f81 100644
--- a/rust/processor/src/db/common/models/coin_models/coin_activities.rs
+++ b/rust/processor/src/db/common/models/coin_models/coin_activities.rs
@@ -149,18 +149,24 @@ impl CoinActivity {
}
// Need coin info from move resources
- for wsc in &transaction_info.changes {
+ for (wsc_index, wsc) in transaction_info.changes.iter().enumerate() {
let (maybe_coin_info, maybe_coin_balance_data) =
if let WriteSetChangeEnum::WriteResource(write_resource) =
&wsc.change.as_ref().unwrap()
{
(
- CoinInfo::from_write_resource(write_resource, txn_version, txn_timestamp)
- .unwrap(),
+ CoinInfo::from_write_resource(
+ write_resource,
+ txn_version,
+ txn_timestamp,
+ wsc_index as i64,
+ )
+ .unwrap(),
CoinBalance::from_write_resource(
write_resource,
txn_version,
txn_timestamp,
+ wsc_index as i64,
)
.unwrap(),
)
diff --git a/rust/processor/src/db/common/models/coin_models/coin_balances.rs b/rust/processor/src/db/common/models/coin_models/coin_balances.rs
index 7f1572734..7cde6fb7b 100644
--- a/rust/processor/src/db/common/models/coin_models/coin_balances.rs
+++ b/rust/processor/src/db/common/models/coin_models/coin_balances.rs
@@ -49,6 +49,7 @@ impl CoinBalance {
write_resource: &WriteResource,
txn_version: i64,
txn_timestamp: chrono::NaiveDateTime,
+ wsc_index: i64,
) -> anyhow::Result