diff --git a/Cargo.toml b/Cargo.toml index f7577c3..4e81821 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ members = [ prost = "0.11" prost-types = "0.11" substreams = "0.5" -substreams-antelope = "0.1" +substreams-antelope = "0.3.2" substreams-ethereum = "0.9" substreams-bitcoin = "1" substreams-sink-kv = "0.1.2" diff --git a/accounts/src/maps.rs b/accounts/src/maps.rs index 0a1f1fc..aa43fc5 100644 --- a/accounts/src/maps.rs +++ b/accounts/src/maps.rs @@ -1,6 +1,6 @@ -use substreams::log; use substreams::errors::Error; -use substreams_antelope::Block; +use substreams::log; +use substreams_antelope::pb::Block; use crate::abi; use crate::accounts; diff --git a/antelope.oracles/src/maps.rs b/antelope.oracles/src/maps.rs index 74679a8..74ead67 100644 --- a/antelope.oracles/src/maps.rs +++ b/antelope.oracles/src/maps.rs @@ -1,6 +1,6 @@ -use substreams::log; use substreams::errors::Error; -use substreams_antelope::Block; +use substreams::log; +use substreams_antelope::pb::Block; use crate::abi; use crate::antelope_oracles::*; @@ -38,13 +38,13 @@ fn map_prices(_params: String, block: Block) -> Result { acc_price: price.acc_price, last_price: price.last_price, avg_price: price.avg_price, - last_update: price.last_update + last_update: price.last_update, }); } Err(e) => { log::debug!("error={:?}", e); continue; - }, + } } } } @@ -76,14 +76,14 @@ fn map_quotes(_params: String, block: Block) -> Result { median: datapoint.median, owner: datapoint.owner.as_str().to_string(), timestamp: datapoint.timestamp.as_str().to_string(), - value: datapoint.value - }) + value: datapoint.value, + }), }); } Err(e) => { log::debug!("error={:?}", e); continue; - }, + } } } } diff --git a/antelope.trxstats/src/lib.rs b/antelope.trxstats/src/lib.rs index 039932d..a9c3535 100644 --- a/antelope.trxstats/src/lib.rs +++ b/antelope.trxstats/src/lib.rs @@ -1,5 +1,5 @@ use substreams::errors::Error; -use substreams_antelope::Block; +use substreams_antelope::pb::Block; use substreams_database_change::pb::database::DatabaseChanges; use substreams_database_change::tables::Tables as DatabaseChangeTables; diff --git a/atomicmarket/Cargo.toml b/atomicmarket/Cargo.toml index 8c401b3..a06a621 100644 --- a/atomicmarket/Cargo.toml +++ b/atomicmarket/Cargo.toml @@ -16,7 +16,7 @@ crate-type = ["cdylib"] [dependencies] serde_json = "1" serde = { version = "1", features = ["derive"] } -antelope = "0.0.11" +antelope = "0.1" substreams = { workspace = true } substreams-antelope = { workspace = true } substreams-sink-prometheus = { workspace = true } diff --git a/atomicmarket/src/abi.rs b/atomicmarket/src/abi.rs index 54bb262..4214da3 100644 --- a/atomicmarket/src/abi.rs +++ b/atomicmarket/src/abi.rs @@ -1,6 +1,6 @@ -use substreams_antelope::ActionTrace; use antelope::Asset; use serde::{Deserialize, Serialize}; +use substreams_antelope::pb::ActionTrace; #[derive(Serialize, Deserialize, Debug)] #[serde(deny_unknown_fields)] @@ -22,7 +22,9 @@ pub struct NewSale { pub fn parse_lognewsale(action_trace: &ActionTrace) -> Option { let action = action_trace.action.as_ref()?; - if action.name != "lognewsale" { return None; } + if action.name != "lognewsale" { + return None; + } let data: LogNewSale = serde_json::from_str(&action.json_data).unwrap(); Some(NewSale { collection_name: data.collection_name, diff --git a/atomicmarket/src/maps.rs b/atomicmarket/src/maps.rs index 1e154fa..029b908 100644 --- a/atomicmarket/src/maps.rs +++ b/atomicmarket/src/maps.rs @@ -1,5 +1,5 @@ use substreams::errors::Error; -use substreams_antelope::{Block, ActionTraces}; +use substreams_antelope::pb::{ActionTraces, Block}; #[substreams::handlers::map] fn map_actions(block: Block) -> Result { @@ -8,8 +8,12 @@ fn map_actions(block: Block) -> Result { for trx in block.all_transaction_traces() { for trace in &trx.action_traces { let action_trace = trace.action.as_ref().unwrap().clone(); - if action_trace.account != "atomicmarket" { continue; } - if action_trace.account != trace.receiver { continue; } + if action_trace.account != "atomicmarket" { + continue; + } + if action_trace.account != trace.receiver { + continue; + } action_traces.push(trace.clone()); } } diff --git a/atomicmarket/src/sinks.rs b/atomicmarket/src/sinks.rs index cef707f..fd6df38 100644 --- a/atomicmarket/src/sinks.rs +++ b/atomicmarket/src/sinks.rs @@ -1,9 +1,9 @@ -use substreams_antelope::ActionTraces; use std::collections::HashMap; +use substreams_antelope::pb::ActionTraces; -use substreams::errors::Error; -use substreams_sink_prometheus::{PrometheusOperations, Counter}; use crate::abi; +use substreams::errors::Error; +use substreams_sink_prometheus::{Counter, PrometheusOperations}; #[substreams::handlers::map] pub fn prom_out(action_traces: ActionTraces) -> Result { @@ -14,9 +14,9 @@ pub fn prom_out(action_traces: ActionTraces) -> Result (), } } Ok(prom_out) -} \ No newline at end of file +} diff --git a/common/src/maps.rs b/common/src/maps.rs index 105ab3a..ca5069a 100644 --- a/common/src/maps.rs +++ b/common/src/maps.rs @@ -1,5 +1,5 @@ use substreams::errors::Error; -use substreams_antelope::{Block, BlockHeader, ActionTraces, BlockRootMerkle, TransactionTraces, DbOps }; +use substreams_antelope::pb::{ActionTraces, Block, BlockHeader, BlockRootMerkle, DbOps, TransactionTraces}; use crate::utils; @@ -10,7 +10,7 @@ fn map_block_header(block: Block) -> Result { #[substreams::handlers::map] fn map_blockroot_merkle(block: Block) -> Result { - Ok(block.blockroot_merkle.unwrap() ) + Ok(block.blockroot_merkle.unwrap()) } #[substreams::handlers::map] @@ -30,13 +30,23 @@ fn map_transaction_traces(params: String, block: Block) -> Result Result Result { for trx in block.all_transaction_traces() { for db_op in &trx.db_ops { - // filter by params - if !filter_contract.is_empty() && !filter_contract.contains(&db_op.code) { continue; } - if !filter_table.is_empty() && !filter_table.contains(&db_op.table_name) { continue; } + if !filter_contract.is_empty() && !filter_contract.contains(&db_op.code) { + continue; + } + if !filter_table.is_empty() && !filter_table.contains(&db_op.table_name) { + continue; + } db_ops.push(db_op.clone()); } diff --git a/deferred/src/lib.rs b/deferred/src/lib.rs index c5df38b..4a918b6 100644 --- a/deferred/src/lib.rs +++ b/deferred/src/lib.rs @@ -1,14 +1,13 @@ use sinkfiles::Lines; use substreams::errors::Error; -use substreams_antelope::{Block, d_trx_op}; +use substreams_antelope::pb::{d_trx_op, Block}; - -#[path = "pb/substreams.sink.files.v1.rs"] -#[allow(dead_code)] -pub mod sinkfiles; #[path = "pb/antelope.eosio.deferred.v1.rs"] #[allow(dead_code)] pub mod eosio_deferred; +#[path = "pb/substreams.sink.files.v1.rs"] +#[allow(dead_code)] +pub mod sinkfiles; pub use self::eosio_deferred::*; fn get_op_str(op: d_trx_op::Operation) -> String { @@ -32,7 +31,11 @@ fn map_deferred(block: Block) -> Result { for dtrx in &trx.dtrx_ops { let dtrx = dtrx.clone(); let actions = dtrx.transaction.unwrap().transaction.unwrap().actions; - let action = if actions.len() != 0 { actions.get(0).unwrap().clone() } else { substreams_antelope::Action { ..Default::default() } }; + let action = if actions.len() != 0 { + actions.get(0).unwrap().clone() + } else { + substreams_antelope::pb::Action { ..Default::default() } + }; res.transactions.push(Transaction { parent_trx_id: trx.id.clone(), trx_id: dtrx.transaction_id, @@ -43,7 +46,7 @@ fn map_deferred(block: Block) -> Result { json_data: action.json_data, block_num: trx.block_num, timestamp: block.header.as_ref().unwrap().timestamp.clone(), - producer: producer.to_string() + producer: producer.to_string(), }); } } @@ -52,21 +55,25 @@ fn map_deferred(block: Block) -> Result { #[substreams::handlers::map] fn csv_out(transactions: Transactions) -> Result { - Ok(Lines { - lines: transactions.transactions.into_iter().map(|t| { - format!("{},{},{},{},{},{},\"{}\",{},{},{}", - t.trx_id, - t.parent_trx_id, - t.op, - t.sender, - t.account, - t.action, - t.json_data.replace("\"", "'"), - t.block_num, - t.timestamp.unwrap().to_string(), - t.producer - ) - }).collect() + lines: transactions + .transactions + .into_iter() + .map(|t| { + format!( + "{},{},{},{},{},{},\"{}\",{},{},{}", + t.trx_id, + t.parent_trx_id, + t.op, + t.sender, + t.account, + t.action, + t.json_data.replace("\"", "'"), + t.block_num, + t.timestamp.unwrap().to_string(), + t.producer + ) + }) + .collect(), }) -} \ No newline at end of file +} diff --git a/eosio.cpu/src/maps.rs b/eosio.cpu/src/maps.rs index 31a38c5..763b5d5 100644 --- a/eosio.cpu/src/maps.rs +++ b/eosio.cpu/src/maps.rs @@ -1,7 +1,7 @@ use antelope::Symbol; use substreams::errors::Error; -use substreams_antelope::Block; use substreams::log; +use substreams_antelope::pb::Block; use crate::abi; use crate::eosio_cpu::*; @@ -26,7 +26,6 @@ fn map_transfers(params: String, block: Block) -> Result let mut transaction_count: u32 = 0; for trx in block.all_transaction_traces() { - let cpu_usage = trx.receipt.as_ref().unwrap().cpu_usage_micro_seconds as u32; let net_usage = trx.net_usage as u32; let producer = block.header.as_ref().unwrap().producer.clone(); @@ -35,8 +34,12 @@ fn map_transfers(params: String, block: Block) -> Result for trace in &trx.action_traces { let action_trace = trace.action.as_ref().unwrap(); - if action_trace.account != trace.receiver { continue; } - if action_trace.name != "transfer" { continue; } + if action_trace.account != trace.receiver { + continue; + } + if action_trace.name != "transfer" { + continue; + } match abi::Transfer::try_from(action_trace.json_data.as_str()) { Ok(data) => { @@ -47,11 +50,21 @@ fn map_transfers(params: String, block: Block) -> Result let contract = action_trace.account.clone(); // filter by params - if !filter_from.is_empty() && !filter_from.contains(&data.from) { continue; } - if !filter_to.is_empty() && !filter_to.contains(&data.to) { continue; } - if !filter_symcode.is_empty() && !filter_symcode.contains(&symcode) { continue; } - if !filter_contract.is_empty() && !filter_contract.contains(&contract) { continue; } - if !filter_to_or_from.is_empty() && !(filter_to_or_from.contains(&data.to) || filter_to_or_from.contains(&data.from)) { continue; } + if !filter_from.is_empty() && !filter_from.contains(&data.from) { + continue; + } + if !filter_to.is_empty() && !filter_to.contains(&data.to) { + continue; + } + if !filter_symcode.is_empty() && !filter_symcode.contains(&symcode) { + continue; + } + if !filter_contract.is_empty() && !filter_contract.contains(&contract) { + continue; + } + if !filter_to_or_from.is_empty() && !(filter_to_or_from.contains(&data.to) || filter_to_or_from.contains(&data.from)) { + continue; + } //if filter_quantity_lt.is_some() && !(quantity.amount < filter_quantity_lt.unwrap()) { continue; } //if filter_quantity_gt.is_some() && !(quantity.amount > filter_quantity_gt.unwrap()) { continue; } //if filter_quantity_lte.is_some() && !(quantity.amount <= filter_quantity_lte.unwrap()) { continue; } @@ -84,7 +97,7 @@ fn map_transfers(params: String, block: Block) -> Result producer: producer.to_string(), cpu_usage: cpu_usage, net_usage: net_usage, - tx_count: transaction_count + tx_count: transaction_count, }); } Err(_) => continue, diff --git a/eosio.evm/src/maps.rs b/eosio.evm/src/maps.rs index 917f88c..575a516 100644 --- a/eosio.evm/src/maps.rs +++ b/eosio.evm/src/maps.rs @@ -1,14 +1,14 @@ use substreams::errors::Error; -use substreams_antelope::Block; use substreams::log; +use substreams_antelope::pb::Block; use antelope::{Asset, Name, SymbolCode}; //use serde_json::Result; use serde_json::Value; -use crate::eosio_evm; use crate::abi; +use crate::eosio_evm; #[substreams::handlers::map] fn map_pushtx(block: Block) -> Result { @@ -16,8 +16,12 @@ fn map_pushtx(block: Block) -> Result { for trx in block.all_transaction_traces() { for trace in &trx.action_traces { let action_trace = trace.action.as_ref().unwrap(); - if action_trace.account != "eosio.evm" { continue; } - if action_trace.name != "pushtx" { continue; } + if action_trace.account != "eosio.evm" { + continue; + } + if action_trace.name != "pushtx" { + continue; + } match abi::Pushtx::try_from(action_trace.json_data.as_str()) { Ok(pushtx) => { @@ -42,29 +46,31 @@ fn map_balances(block: Block) -> Result { for db_op in &trx.db_ops { let contract = db_op.code.clone(); - if contract == "eosio.evm" && db_op.table_name == "balances" { - + if contract == "eosio.evm" && db_op.table_name == "balances" { match serde_json::from_str::(&db_op.new_data_json) { Ok(parsed_value) => { - let owner = (parsed_value.get("owner").unwrap().to_string()).trim_matches('"').to_string(); let balances = (parsed_value.get("balance").unwrap().to_string()).trim_matches('"').to_string(); match serde_json::from_str::(&balances) { Ok(parsed_value_balance) => { - let balancesym = (parsed_value_balance.get("balance").unwrap().to_string()).trim_matches('"').to_string(); - let dust = (parsed_value_balance.get("dust").unwrap().to_string()).trim_matches('"').to_string(); + let balancesym = (parsed_value_balance.get("balance").unwrap().to_string()) + .trim_matches('"') + .to_string(); + let dust = (parsed_value_balance.get("dust").unwrap().to_string()) + .trim_matches('"') + .to_string(); let parts: Vec<&str> = balancesym.split_whitespace().collect(); if parts.len() == 2 { let balance = parts[0].parse::().unwrap_or(0.0); let sym = String::from(parts[1]); - + events.push(eosio_evm::Pushbalance { miner: owner, balance: balance, symcode: sym, - dust: dust.parse::().ok().unwrap() + dust: dust.parse::().ok().unwrap(), }); } } @@ -72,17 +78,13 @@ fn map_balances(block: Block) -> Result { log::debug!("Failed to parse JSON: {}", e); } } - - - } Err(e) => { log::debug!("Failed to parse JSON: {}", e); } } - } - } + } } Ok(eosio_evm::Pushbalances { events }) -} \ No newline at end of file +} diff --git a/eosio.evm/src/sinks.rs b/eosio.evm/src/sinks.rs index 4a41467..36dd437 100644 --- a/eosio.evm/src/sinks.rs +++ b/eosio.evm/src/sinks.rs @@ -1,6 +1,6 @@ use substreams::errors::Error; -use substreams_antelope::Block; -use substreams_entity_change::pb::entity::{EntityChanges}; +use substreams_antelope::pb::Block; +use substreams_entity_change::pb::entity::EntityChanges; use substreams_sink_kv::pb::sf::substreams::sink::kv::v1::KvOperations; use crate::maps; diff --git a/eosio.ibc/src/lib.rs b/eosio.ibc/src/lib.rs index 7f7257e..2f130ab 100644 --- a/eosio.ibc/src/lib.rs +++ b/eosio.ibc/src/lib.rs @@ -1,5 +1,5 @@ use substreams::errors::Error; -use substreams_antelope::Block; +use substreams_antelope::pb::Block; #[path = "pb/antelope.eosio.ibc.v1.rs"] #[allow(dead_code)] diff --git a/eosio.token/src/maps.rs b/eosio.token/src/maps.rs index dfdbe07..00082df 100644 --- a/eosio.token/src/maps.rs +++ b/eosio.token/src/maps.rs @@ -1,7 +1,7 @@ use antelope::Symbol; use substreams::errors::Error; use substreams::log; -use substreams_antelope::Block; +use substreams_antelope::pb::Block; use crate::abi; use crate::eosio_token::*; @@ -29,7 +29,9 @@ fn map_accounts(params: String, block: Block) -> Result { for trx in block.all_transaction_traces() { for db_op in &trx.db_ops { - if db_op.table_name != "accounts" { continue; } + if db_op.table_name != "accounts" { + continue; + } let contract = db_op.code.clone(); let raw_primary_key = Name::from(db_op.primary_key.as_str()).value; @@ -37,13 +39,21 @@ fn map_accounts(params: String, block: Block) -> Result { let account = db_op.scope.clone(); // filter by params - if !filter_account.is_empty() && !filter_account.contains(&account) { continue; } - if !filter_symcode.is_empty() && !filter_symcode.contains(&symcode.to_string()) { continue; } - if !filter_contract.is_empty() && !filter_contract.contains(&contract) { continue; } + if !filter_account.is_empty() && !filter_account.contains(&account) { + continue; + } + if !filter_symcode.is_empty() && !filter_symcode.contains(&symcode.to_string()) { + continue; + } + if !filter_contract.is_empty() && !filter_contract.contains(&contract) { + continue; + } let old_data = abi::Account::try_from(db_op.old_data_json.as_str()).ok(); let new_data = abi::Account::try_from(db_op.new_data_json.as_str()).ok(); - if old_data.is_none() && new_data.is_none() { continue; } // no data + if old_data.is_none() && new_data.is_none() { + continue; + } // no data let old_balance = match &old_data { Some(data) => Some(Asset::from(data.balance.as_str())), @@ -69,15 +79,31 @@ fn map_accounts(params: String, block: Block) -> Result { }; // filter by params - if filter_balance_lt.is_some() && !(balance.amount < filter_balance_lt.unwrap()) { continue; } - if filter_balance_gt.is_some() && !(balance.amount > filter_balance_gt.unwrap()) { continue; } - if filter_balance_lte.is_some() && !(balance.amount <= filter_balance_lte.unwrap()) { continue; } - if filter_balance_gte.is_some() && !(balance.amount >= filter_balance_gte.unwrap()) { continue; } + if filter_balance_lt.is_some() && !(balance.amount < filter_balance_lt.unwrap()) { + continue; + } + if filter_balance_gt.is_some() && !(balance.amount > filter_balance_gt.unwrap()) { + continue; + } + if filter_balance_lte.is_some() && !(balance.amount <= filter_balance_lte.unwrap()) { + continue; + } + if filter_balance_gte.is_some() && !(balance.amount >= filter_balance_gte.unwrap()) { + continue; + } - if filter_balance_delta_lt.is_some() && !(balance_delta < filter_balance_delta_lt.unwrap()) { continue; } - if filter_balance_delta_gt.is_some() && !(balance_delta > filter_balance_delta_gt.unwrap()) { continue; } - if filter_balance_delta_lte.is_some() && !(balance_delta <= filter_balance_delta_lte.unwrap()) { continue; } - if filter_balance_delta_gte.is_some() && !(balance_delta >= filter_balance_delta_gte.unwrap()) { continue; } + if filter_balance_delta_lt.is_some() && !(balance_delta < filter_balance_delta_lt.unwrap()) { + continue; + } + if filter_balance_delta_gt.is_some() && !(balance_delta > filter_balance_delta_gt.unwrap()) { + continue; + } + if filter_balance_delta_lte.is_some() && !(balance_delta <= filter_balance_delta_lte.unwrap()) { + continue; + } + if filter_balance_delta_gte.is_some() && !(balance_delta >= filter_balance_delta_gte.unwrap()) { + continue; + } items.push(Account { // trace information @@ -123,20 +149,30 @@ fn map_stat(params: String, block: Block) -> Result { for trx in block.all_transaction_traces() { for db_op in &trx.db_ops { - if db_op.table_name != "stat" { continue; } + if db_op.table_name != "stat" { + continue; + } let contract = db_op.code.clone(); let raw_primary_key = Name::from(db_op.primary_key.as_str()).value; let symcode = SymbolCode::from(raw_primary_key); // filter by params - if !filter_contract.is_empty() && !filter_contract.contains(&contract) { continue; } - if !filter_symcode.is_empty() && !filter_symcode.contains(&symcode.to_string()) { continue; } - if !filter_contract.is_empty() && !filter_contract.contains(&contract) { continue; } + if !filter_contract.is_empty() && !filter_contract.contains(&contract) { + continue; + } + if !filter_symcode.is_empty() && !filter_symcode.contains(&symcode.to_string()) { + continue; + } + if !filter_contract.is_empty() && !filter_contract.contains(&contract) { + continue; + } let old_data = abi::CurrencyStats::try_from(db_op.old_data_json.as_str()).ok(); let new_data = abi::CurrencyStats::try_from(db_op.new_data_json.as_str()).ok(); - if old_data.is_none() && new_data.is_none() { continue; } // no data + if old_data.is_none() && new_data.is_none() { + continue; + } // no data let old_supply = match &old_data { Some(data) => Some(Asset::from(data.supply.as_str())), @@ -162,15 +198,31 @@ fn map_stat(params: String, block: Block) -> Result { }; // filter by params - if filter_supply_lt.is_some() && !(supply.amount < filter_supply_lt.unwrap()) { continue; } - if filter_supply_gt.is_some() && !(supply.amount > filter_supply_gt.unwrap()) { continue; } - if filter_supply_lte.is_some() && !(supply.amount <= filter_supply_lte.unwrap()) { continue; } - if filter_supply_gte.is_some() && !(supply.amount >= filter_supply_gte.unwrap()) { continue; } + if filter_supply_lt.is_some() && !(supply.amount < filter_supply_lt.unwrap()) { + continue; + } + if filter_supply_gt.is_some() && !(supply.amount > filter_supply_gt.unwrap()) { + continue; + } + if filter_supply_lte.is_some() && !(supply.amount <= filter_supply_lte.unwrap()) { + continue; + } + if filter_supply_gte.is_some() && !(supply.amount >= filter_supply_gte.unwrap()) { + continue; + } - if filter_supply_delta_lt.is_some() && !(supply_delta < filter_supply_delta_lt.unwrap()) { continue; } - if filter_supply_delta_gt.is_some() && !(supply_delta > filter_supply_delta_gt.unwrap()) { continue; } - if filter_supply_delta_lte.is_some() && !(supply_delta <= filter_supply_delta_lte.unwrap()) { continue; } - if filter_supply_delta_gte.is_some() && !(supply_delta >= filter_supply_delta_gte.unwrap()) { continue; } + if filter_supply_delta_lt.is_some() && !(supply_delta < filter_supply_delta_lt.unwrap()) { + continue; + } + if filter_supply_delta_gt.is_some() && !(supply_delta > filter_supply_delta_gt.unwrap()) { + continue; + } + if filter_supply_delta_lte.is_some() && !(supply_delta <= filter_supply_delta_lte.unwrap()) { + continue; + } + if filter_supply_delta_gte.is_some() && !(supply_delta >= filter_supply_delta_gte.unwrap()) { + continue; + } // TO-DO fix in case of new_data is None let data = new_data.unwrap(); @@ -220,8 +272,12 @@ fn map_transfers(params: String, block: Block) -> Result // action traces for trace in &trx.action_traces { let action_trace = trace.action.as_ref().unwrap(); - if action_trace.account != trace.receiver { continue; } - if action_trace.name != "transfer" { continue; } + if action_trace.account != trace.receiver { + continue; + } + if action_trace.name != "transfer" { + continue; + } match abi::Transfer::try_from(action_trace.json_data.as_str()) { Ok(data) => { @@ -232,15 +288,33 @@ fn map_transfers(params: String, block: Block) -> Result let contract = action_trace.account.clone(); // filter by params - if !filter_from.is_empty() && !filter_from.contains(&data.from) { continue; } - if !filter_to.is_empty() && !filter_to.contains(&data.to) { continue; } - if !filter_symcode.is_empty() && !filter_symcode.contains(&symcode) { continue; } - if !filter_contract.is_empty() && !filter_contract.contains(&contract) { continue; } - if !filter_to_or_from.is_empty() && !(filter_to_or_from.contains(&data.to) || filter_to_or_from.contains(&data.from)) { continue; } - if filter_quantity_lt.is_some() && !(quantity.amount < filter_quantity_lt.unwrap()) { continue; } - if filter_quantity_gt.is_some() && !(quantity.amount > filter_quantity_gt.unwrap()) { continue; } - if filter_quantity_lte.is_some() && !(quantity.amount <= filter_quantity_lte.unwrap()) { continue; } - if filter_quantity_gte.is_some() && !(quantity.amount >= filter_quantity_gte.unwrap()) { continue; } + if !filter_from.is_empty() && !filter_from.contains(&data.from) { + continue; + } + if !filter_to.is_empty() && !filter_to.contains(&data.to) { + continue; + } + if !filter_symcode.is_empty() && !filter_symcode.contains(&symcode) { + continue; + } + if !filter_contract.is_empty() && !filter_contract.contains(&contract) { + continue; + } + if !filter_to_or_from.is_empty() && !(filter_to_or_from.contains(&data.to) || filter_to_or_from.contains(&data.from)) { + continue; + } + if filter_quantity_lt.is_some() && !(quantity.amount < filter_quantity_lt.unwrap()) { + continue; + } + if filter_quantity_gt.is_some() && !(quantity.amount > filter_quantity_gt.unwrap()) { + continue; + } + if filter_quantity_lte.is_some() && !(quantity.amount <= filter_quantity_lte.unwrap()) { + continue; + } + if filter_quantity_gte.is_some() && !(quantity.amount >= filter_quantity_gte.unwrap()) { + continue; + } log::debug!("symcode: {:?}", symcode); diff --git a/eosmechanics/src/maps.rs b/eosmechanics/src/maps.rs index c6b380e..28e89a0 100644 --- a/eosmechanics/src/maps.rs +++ b/eosmechanics/src/maps.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; use substreams::errors::Error; -use substreams_antelope::{Block, ProducerAuthoritySchedule}; +use substreams_antelope::pb::{Block, ProducerAuthoritySchedule}; use crate::eosmechanics::{ProducerUsage, ScheduleChange}; @@ -39,12 +39,13 @@ pub fn map_producer_usage(block: Block) -> Result { // Only return a value if the transaction trace contains `eosmechanics:cpu` action for trace in &trx.action_traces { let action_trace = trace.action.as_ref().unwrap(); - if action_trace.account != "eosmechanics" { continue; } - if action_trace.name != "cpu" { continue; } - return Ok(ProducerUsage{ - producer, - cpu_usage, - }) + if action_trace.account != "eosmechanics" { + continue; + } + if action_trace.name != "cpu" { + continue; + } + return Ok(ProducerUsage { producer, cpu_usage }); } } // If no transaction trace contains `eosmechanics:cpu` action, return default value @@ -57,7 +58,9 @@ pub fn map_schedule_change(block: Block) -> Result { let pending_schedule: Vec = schedule_to_accounts(block.pending_schedule.as_ref().unwrap().schedule_v2.as_ref().unwrap()); // If there is no pending schedule, then there is no schedule change - if pending_schedule.is_empty() { return Ok(Default::default()); } + if pending_schedule.is_empty() { + return Ok(Default::default()); + } let mut add_to_schedule: Vec = Default::default(); let mut remove_from_schedule: Vec = Default::default(); @@ -81,7 +84,7 @@ pub fn map_schedule_change(block: Block) -> Result { // header let header = block.header.as_ref().unwrap(); - Ok(ScheduleChange{ + Ok(ScheduleChange { producer: header.producer.clone(), schedule_version: header.schedule_version, active_schedule, @@ -95,8 +98,10 @@ pub fn schedule_to_accounts(schedule: &ProducerAuthoritySchedule) -> Vec schedule.producers.iter().map(|p| p.account_name.clone()).collect() } -pub fn producer_in_schedule(producer: String, schedule: Vec ) -> Option { - if schedule.is_empty() { return None; } +pub fn producer_in_schedule(producer: String, schedule: Vec) -> Option { + if schedule.is_empty() { + return None; + } Some(schedule_to_set(schedule).contains(producer.as_str())) } @@ -106,4 +111,4 @@ pub fn schedule_to_set(schedule: Vec) -> HashSet { set.insert(account); } set -} \ No newline at end of file +} diff --git a/erc721/Cargo.toml b/erc721/Cargo.toml index cc5f190..90ed2f8 100644 --- a/erc721/Cargo.toml +++ b/erc721/Cargo.toml @@ -27,8 +27,3 @@ getrandom = { version = "0.2", features = ["custom"] } [build-dependencies] substreams-ethereum = "0.9" - -[profile.release] -lto = true -opt-level = 's' -strip = "debuginfo" diff --git a/gems.blend/Cargo.toml b/gems.blend/Cargo.toml index b40de3f..911b776 100644 --- a/gems.blend/Cargo.toml +++ b/gems.blend/Cargo.toml @@ -10,14 +10,10 @@ crate-type = ["cdylib"] prost = { workspace = true } prost-types = { workspace = true } substreams = { workspace = true } -#substreams-antelope = { workspace = true } +substreams-antelope = { workspace = true } #substreams-antelope = { path = "/Users/shkvo/github/Pinax/substreams-antelope/substreams-antelope" } -substreams-antelope = "0.3" serde_json = "1.0.91" serde = { version = "1.0", features = ["derive"] } [build-dependencies] -#substreams-antelope = { path = "/Users/shkvo/github/Pinax/substreams-antelope/substreams-antelope" } -# substreams-antelope = { workspace = true } -#substreams-antelope = { path = "/Users/shkvo/github/Pinax/substreams-antelope" } -substreams-antelope = "0.3" \ No newline at end of file +substreams-antelope = { workspace = true } diff --git a/pomelo.bounties/Cargo.toml b/pomelo.bounties/Cargo.toml index b1022f9..1a0254e 100644 --- a/pomelo.bounties/Cargo.toml +++ b/pomelo.bounties/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pomelo_bounties" version = "0.1.0" -authors = ["Yaro " ] +authors = ["Yaro "] description = "Antelope Pomelo substreams" license = "MIT OR Apache-2.0" edition = "2021" @@ -17,9 +17,9 @@ crate-type = ["cdylib"] prost = { workspace = true } prost-types = { workspace = true } substreams = { workspace = true } -substreams-antelope = "0.3.*" +substreams-antelope = { workspace = true } serde_json = "1.0.91" serde = { version = "1.0", features = ["derive"] } [build-dependencies] -substreams-antelope = "0.3.*" +substreams-antelope = { workspace = true } diff --git a/pomelo/src/sinks.rs b/pomelo/src/sinks.rs index 0776b0d..6461490 100644 --- a/pomelo/src/sinks.rs +++ b/pomelo/src/sinks.rs @@ -1,14 +1,13 @@ -use substreams::{log}; use substreams::errors::Error; -use substreams_antelope::{Block}; -use substreams_entity_change::pb::entity::{EntityChanges}; +use substreams::log; +use substreams_antelope::pb::Block; +use substreams_entity_change::pb::entity::EntityChanges; use crate::abi; use crate::utils::from_dbop_to_entityop; - #[substreams::handlers::map] -pub fn entity_out( block: Block) -> Result { +pub fn entity_out(block: Block) -> Result { let mut entity_changes: EntityChanges = Default::default(); for trx in block.all_transaction_traces() { @@ -19,7 +18,8 @@ pub fn entity_out( block: Block) -> Result { let grant = abi::GrantsRow::try_from(db_op.new_data_json.as_str()).unwrap(); let op = from_dbop_to_entityop(&db_op.operation()); log::info!("Op: {:?}, Grant={:?}", op, grant); - entity_changes.push_change("Grant", &grant.id, 1, op) + entity_changes + .push_change("Grant", &grant.id, 1, op) .change("id", grant.id) .change("author_user_id", grant.author_user_id) .change("funding_account", grant.funding_account) @@ -33,15 +33,16 @@ pub fn entity_out( block: Block) -> Result { let op = from_dbop_to_entityop(&db_op.operation()); let transfer_id = format!("{}-{}", transfer.round_id, transfer.transfer_id); log::info!("Op: {:?}, Transfer={:?}", op, transfer); - entity_changes.push_change("Transfer", &transfer_id, 1, op) + entity_changes + .push_change("Transfer", &transfer_id, 1, op) .change("user_id", transfer.user_id) .change("from", transfer.from) .change("to", transfer.to) .change("quantity", transfer.ext_quantity.quantity) .change("contract", transfer.ext_quantity.contract) .change("fee", transfer.fee) - .change("value",transfer.value.to_string()) - .change("memo",transfer.memo) + .change("value", transfer.value.to_string()) + .change("memo", transfer.memo) .change("project_id", transfer.project_id) .change("created_at", transfer.created_at) .change("trx_id", transfer.trx_id); @@ -51,5 +52,5 @@ pub fn entity_out( block: Block) -> Result { } } } - Ok( entity_changes ) -} \ No newline at end of file + Ok(entity_changes) +} diff --git a/pomelo/src/utils.rs b/pomelo/src/utils.rs index 3ac6720..5d1559a 100644 --- a/pomelo/src/utils.rs +++ b/pomelo/src/utils.rs @@ -1,4 +1,4 @@ -use substreams_antelope::db_op; +use substreams_antelope::pb::db_op; use substreams_entity_change::pb::entity::entity_change; pub fn from_dbop_to_entityop(op: &db_op::Operation) -> entity_change::Operation { @@ -8,4 +8,4 @@ pub fn from_dbop_to_entityop(op: &db_op::Operation) -> entity_change::Operation db_op::Operation::Remove => entity_change::Operation::Delete, db_op::Operation::Unknown => entity_change::Operation::Unspecified, } -} \ No newline at end of file +} diff --git a/sx.stats/Cargo.toml b/sx.stats/Cargo.toml index 3dbc5d7..28c4c93 100644 --- a/sx.stats/Cargo.toml +++ b/sx.stats/Cargo.toml @@ -10,11 +10,10 @@ crate-type = ["cdylib"] prost = { workspace = true } prost-types = { workspace = true } substreams = { workspace = true } -#substreams-antelope = { path = "/Users/shkvo/github/Pinax/substreams-antelope/substreams-antelope" } -substreams-antelope = "0.3" +substreams-antelope = { workspace = true } serde_json = "1.0.91" serde = { version = "1.0", features = ["derive"] } substreams-database-change = { workspace = true } [build-dependencies] -substreams-antelope = "0.3" +substreams-antelope = { workspace = true }