Skip to content

Commit

Permalink
fix: Fix typo in supply reducer (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Feb 8, 2023
1 parent e05f460 commit 0058948
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/reducers/supply_by_asset.rs
Expand Up @@ -3,7 +3,7 @@ use std::str::FromStr;
use gasket::error::AsWorkError;
use pallas::crypto::hash::Hash;
use pallas::ledger::traverse::Asset;
use pallas::ledger::traverse::{MultiEraBlock, MultiEraTx};
use pallas::ledger::traverse::MultiEraBlock;
use serde::Deserialize;

use crate::{crosscut, model};
Expand Down Expand Up @@ -38,7 +38,7 @@ impl Reducer {
if !self.is_policy_id_accepted(&policy) {
return Ok(());
}
let prefix = self.config.key_prefix.as_deref();

let asset_id = &format!("{}{}", policy, hex::encode(asset));

let key = match &self.config.key_prefix {
Expand All @@ -58,15 +58,15 @@ impl Reducer {
output: &mut super::OutputPort,
) -> Result<(), gasket::error::Error> {
for tx in block.txs().into_iter() {
for (idx, txo) in ctx.find_consumed_txos(&tx, &self.policy).or_panic()? {
for (_, txo) in ctx.find_consumed_txos(&tx, &self.policy).or_panic()? {
for asset in txo.assets() {
if let Asset::NativeAsset(policy, asset, qty) = asset {
self.process_asset(policy,asset, -1 * qty as i64, output)?;
self.process_asset(policy, asset, -1 * qty as i64, output)?;
}
}
}

for (idx, txo) in tx.produces() {
for (_, txo) in tx.produces() {
for asset in txo.assets() {
if let Asset::NativeAsset(policy, asset, qty) = asset {
self.process_asset(policy, asset, qty as i64, output)?;
Expand All @@ -92,11 +92,13 @@ impl Config {
}
None => None,
};

let reducer = Reducer {
config: self,
policy: policy.clone(),
policy_ids,
};

super::Reducer::UtxosByAsset(reducer)
super::Reducer::SupplyByAsset(reducer)
}
}

0 comments on commit 0058948

Please sign in to comment.