Skip to content

Commit

Permalink
handle invalid asset in transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
YaroShkvorets committed Mar 22, 2024
1 parent a498215 commit e5ad191
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ fn map_transfers(block: Block) -> Result<TransferEvents, Error> {

match abi::Transfer::try_from(action_trace.json_data.as_str()) {
Ok(data) => {
let quantity = Asset::from(data.quantity.as_str());
let quantity = match data.quantity.parse::<Asset>() {
Ok(asset) => asset,
Err(e) => {
log::info!("Error parsing transfer asset in trx {}: {:?}", trx.id, e);
return None;
}
};
let symcode = quantity.symbol.code().to_string();
let precision = quantity.symbol.precision().into();
let amount = quantity.amount;
Expand Down

0 comments on commit e5ad191

Please sign in to comment.