diff --git a/.gitignore b/.gitignore index 2ffc37f..ec45bc5 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ localblocks rpc-cache localdata *.spkg +!/**/imports/*.spkg ### VisualStudioCode template .vscode/* diff --git a/eosmechanics/Cargo.toml b/eosmechanics/Cargo.toml index 38f66b0..5b9de82 100644 --- a/eosmechanics/Cargo.toml +++ b/eosmechanics/Cargo.toml @@ -1,7 +1,11 @@ [package] name = "eosmechanics" -version = "0.3.6" -authors = ["Denis ", "Fred ", "Charles "] +version = "0.4.0" +authors = [ + "Denis ", + "Fred ", + "Charles ", +] description = "Block Producer Benchmarks" license = "MIT OR Apache-2.0" edition = "2021" @@ -17,7 +21,6 @@ crate-type = ["cdylib"] prost = { workspace = true } prost-types = { workspace = true } substreams = { workspace = true } -# substreams-antelope = { workspace = true } substreams-antelope = "0.5" substreams-sink-kv = { workspace = true } substreams-sink-prometheus = { workspace = true } diff --git a/eosmechanics/Makefile b/eosmechanics/Makefile index fdc7eac..7ff8590 100644 --- a/eosmechanics/Makefile +++ b/eosmechanics/Makefile @@ -27,13 +27,17 @@ info: .PHONY: run run: - substreams run -e telos.substreams.pinax.network:443 prom_out -s 273976005 -o jsonl + substreams run ./substreams.yaml -e telos.substreams.pinax.network:443 prom_out -s 273976005 -o jsonl .PHONY: gui gui: - substreams gui -e kylin.substreams.pinax.network:443 prom_out -s 273976005 -t +1000 + substreams gui ./substreams.yaml -e eos.substreams.pinax.network:443 prom_out -s 396958039 + +.PHONY: cache +cache: + substreams gui ./substreams.yaml -e eos.substreams.pinax.network:443 prom_out -s 396958039 -t 0 --production-mode .PHONY: sink sink: - substreams-sink-prometheus run -e eos.substreams.pinax.network:443 https://github.com/pinax-network/substreams/releases/download/eosmechanics-v0.3.5/eosmechanics-v0.3.5.spkg -s 292103130 + substreams-sink-prometheus run -e eos.substreams.pinax.network:443 https://github.com/pinax-network/substreams/releases/download/eosmechanics-v0.3.5/eosmechanics-v0.3.5.spkg -s 292103130 prom_out diff --git a/eosmechanics/imports/substreams-sink-prometheus-v0.2.0.spkg b/eosmechanics/imports/substreams-sink-prometheus-v0.2.0.spkg new file mode 100644 index 0000000..8b38ac0 Binary files /dev/null and b/eosmechanics/imports/substreams-sink-prometheus-v0.2.0.spkg differ diff --git a/eosmechanics/src/maps.rs b/eosmechanics/src/maps.rs index 0ceaebe..4ea33a1 100644 --- a/eosmechanics/src/maps.rs +++ b/eosmechanics/src/maps.rs @@ -1,6 +1,6 @@ use std::collections::HashSet; -use substreams::errors::Error; +use substreams::{errors::Error, skip_empty_output}; use substreams_antelope::pb::{Block, ProducerAuthoritySchedule}; use crate::eosmechanics::{ProducerUsage, ScheduleChange}; @@ -29,6 +29,8 @@ use crate::eosmechanics::{ProducerUsage, ScheduleChange}; /// producer. #[substreams::handlers::map] pub fn map_producer_usage(block: Block) -> Result { + skip_empty_output(); + // Producer is found in the block header let producer = block.header.as_ref().unwrap().producer.clone(); @@ -54,11 +56,19 @@ pub fn map_producer_usage(block: Block) -> Result { #[substreams::handlers::map] pub fn map_schedule_change(block: Block) -> Result { - let active_schedule: Vec = schedule_to_accounts(block.active_schedule_v2.as_ref().unwrap()); - let pending_schedule: Vec = schedule_to_accounts(block.pending_schedule.as_ref().unwrap().schedule_v2.as_ref().unwrap()); + skip_empty_output(); + + let active_schedule: Vec = match block.proposer_policy.as_ref() { + Some(proposer_policy) => schedule_to_accounts(proposer_policy.proposer_schedule.as_ref().unwrap()), // New + None => schedule_to_accounts(block.active_schedule_v2.as_ref().unwrap()), // Old + }; + let pending_schedule: Vec = match block.pending_schedule.as_ref() { + Some(pending_schedule) => schedule_to_accounts(pending_schedule.schedule_v2.as_ref().unwrap()), // Old + None => vec![], // New + }; - // If there is no pending schedule, then there is no schedule change - if pending_schedule.is_empty() { + // If there is no pending schedule and it's old block format, then there is no schedule change + if pending_schedule.is_empty() && block.proposer_policy.as_ref().is_none() { return Ok(Default::default()); } diff --git a/eosmechanics/src/sinks.rs b/eosmechanics/src/sinks.rs index 0a92058..43fa27c 100644 --- a/eosmechanics/src/sinks.rs +++ b/eosmechanics/src/sinks.rs @@ -1,16 +1,14 @@ use std::collections::HashMap; -use substreams::errors::Error; use substreams::log; -use substreams_sink_prometheus::{PrometheusOperations, Counter, Gauge, Histogram, Summary}; +use substreams::{errors::Error, skip_empty_output}; +use substreams_sink_prometheus::{Counter, Gauge, Histogram, PrometheusOperations, Summary}; use crate::eosmechanics::{ProducerUsage, ScheduleChange}; #[substreams::handlers::map] -pub fn prom_out( - producer_usage: ProducerUsage, - schedule_change: ScheduleChange -) -> Result { +pub fn prom_out(producer_usage: ProducerUsage, schedule_change: ScheduleChange) -> Result { + skip_empty_output(); let mut prom_out = PrometheusOperations::default(); let producer = producer_usage.producer.clone(); diff --git a/eosmechanics/substreams.yaml b/eosmechanics/substreams.yaml index dd30aab..760c4a6 100644 --- a/eosmechanics/substreams.yaml +++ b/eosmechanics/substreams.yaml @@ -1,12 +1,11 @@ specVersion: v0.1.0 package: name: eosmechanics - version: v0.3.6 + version: v0.4.0 url: https://github.com/pinax-network/substreams - doc: Block Producer Benchmarks -# imports: -# prometheus: https://github.com/pinax-network/substreams-sink-prometheus.rs/releases/download/v0.2.0/substreams-sink-prometheus-v0.2.0.spkg +imports: + prometheus: ./imports/substreams-sink-prometheus-v0.2.0.spkg binaries: default: diff --git a/gems.blend/src/abi/contract.rs b/gems.blend/src/abi/contract.rs index 6f378ff..da94a6e 100644 --- a/gems.blend/src/abi/contract.rs +++ b/gems.blend/src/abi/contract.rs @@ -14,11 +14,23 @@ pub mod types { pub start_time: TimePointSec, pub end_time: TimePointSec, } + impl std::str::FromStr for BlendsRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct CollectionsRow { pub collection_names: Vec, } + impl std::str::FromStr for CollectionsRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct ConfigRow { @@ -26,6 +38,12 @@ pub mod types { pub protocol_fee: Uint16, pub fee_account: Name, } + impl std::str::FromStr for ConfigRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct LimitsRow { @@ -35,12 +53,24 @@ pub mod types { #[serde(deserialize_with = "substreams_antelope::decoder::str_or_i64")] pub max_mint_assets: Int64, } + impl std::str::FromStr for LimitsRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct Nft { pub collection_name: Name, pub template_id: Int32, } + impl std::str::FromStr for Nft { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct NftExtra { @@ -48,12 +78,24 @@ pub mod types { pub template_id: Int32, pub schema_name: Name, } + impl std::str::FromStr for NftExtra { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct OrdersRow { pub id: Nft, pub quantity: ExtendedAsset, } + impl std::str::FromStr for OrdersRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct RecipesRow { @@ -61,12 +103,24 @@ pub mod types { pub id: Uint64, pub templates: Vec, } + impl std::str::FromStr for RecipesRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct StatusRow { pub counters: Vec, pub last_updated: TimePointSec, } + impl std::str::FromStr for StatusRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } } pub mod actions { use substreams_antelope::types::*; @@ -80,12 +134,18 @@ pub mod actions { pub template_id: Int32, pub templates: Vec, } + impl std::str::FromStr for Addrecipe { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Addrecipe { const NAME: &'static str = "addrecipe"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -102,12 +162,18 @@ pub mod actions { pub total_mint: Int32, pub total_burn: Int32, } + impl std::str::FromStr for Blendlog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Blendlog { const NAME: &'static str = "blendlog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -116,12 +182,18 @@ pub mod actions { pub owner: Name, pub template_id: Int32, } + impl std::str::FromStr for Cancel { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Cancel { const NAME: &'static str = "cancel"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -130,12 +202,18 @@ pub mod actions { pub collection_name: Name, pub template_id: Int32, } + impl std::str::FromStr for Delblend { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Delblend { const NAME: &'static str = "delblend"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -144,12 +222,18 @@ pub mod actions { pub collection_name: Name, pub template_id: Int32, } + impl std::str::FromStr for Dellimit { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Dellimit { const NAME: &'static str = "dellimit"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -160,12 +244,18 @@ pub mod actions { #[serde(deserialize_with = "substreams_antelope::decoder::str_or_u64")] pub recipe_id: Uint64, } + impl std::str::FromStr for Delrecipe { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Delrecipe { const NAME: &'static str = "delrecipe"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -174,12 +264,18 @@ pub mod actions { pub table: Name, pub scope: Name, } + impl std::str::FromStr for Reset { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Reset { const NAME: &'static str = "reset"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -193,12 +289,18 @@ pub mod actions { pub start_time: TimePointSec, pub end_time: TimePointSec, } + impl std::str::FromStr for Setblend { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Setblend { const NAME: &'static str = "setblend"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -207,12 +309,18 @@ pub mod actions { pub protocol_fee: Uint16, pub fee_account: Name, } + impl std::str::FromStr for Setfee { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Setfee { const NAME: &'static str = "setfee"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -223,12 +331,18 @@ pub mod actions { #[serde(deserialize_with = "substreams_antelope::decoder::str_or_i64")] pub max_mint_assets: Int64, } + impl std::str::FromStr for Setlimit { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Setlimit { const NAME: &'static str = "setlimit"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -239,12 +353,18 @@ pub mod actions { #[serde(deserialize_with = "substreams_antelope::decoder::vec_str_or_u64")] pub recipe_ids: Vec, } + impl std::str::FromStr for Setrecipes { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Setrecipes { const NAME: &'static str = "setrecipes"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -252,12 +372,18 @@ pub mod actions { pub struct Setstatus { pub status: Name, } + impl std::str::FromStr for Setstatus { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Setstatus { const NAME: &'static str = "setstatus"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } } \ No newline at end of file diff --git a/pomelo.bounties/src/abi/contract.rs b/pomelo.bounties/src/abi/contract.rs index fe132a6..26392b5 100644 --- a/pomelo.bounties/src/abi/contract.rs +++ b/pomelo.bounties/src/abi/contract.rs @@ -23,6 +23,12 @@ pub mod types { pub submitted_at: TimePointSec, pub completed_at: TimePointSec, } + impl std::str::FromStr for BountiesRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct ConfigsRow { @@ -33,30 +39,60 @@ pub mod types { pub fee_account: Name, pub metadata_keys: Vec, } + impl std::str::FromStr for ConfigsRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct ExtendedSymbol { pub sym: Symbol, pub contract: Name, } + impl std::str::FromStr for ExtendedSymbol { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct PairNameAsset { pub first: Name, pub second: Asset, } + impl std::str::FromStr for PairNameAsset { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct PairNameString { pub first: Name, pub second: String, } + impl std::str::FromStr for PairNameString { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct StatusRow { pub counters: Vec, pub last_updated: TimePointSec, } + impl std::str::FromStr for StatusRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct TokensRow { @@ -67,6 +103,12 @@ pub mod types { #[serde(deserialize_with = "substreams_antelope::decoder::str_or_u64")] pub oracle_id: Uint64, } + impl std::str::FromStr for TokensRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct TransfersRow { @@ -83,6 +125,12 @@ pub mod types { pub trx_id: Checksum256, pub created_at: TimePointSec, } + impl std::str::FromStr for TransfersRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } } pub mod actions { use substreams_antelope::types::*; @@ -95,12 +143,18 @@ pub mod actions { pub bounty_id: Name, pub user_id: Name, } + impl std::str::FromStr for Apply { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Apply { const NAME: &'static str = "apply"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -109,12 +163,18 @@ pub mod actions { pub bounty_id: Name, pub applicant_user_id: Name, } + impl std::str::FromStr for Approve { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Approve { const NAME: &'static str = "approve"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -123,12 +183,18 @@ pub mod actions { pub bounty_id: Name, pub receiver: Name, } + impl std::str::FromStr for Claim { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Claim { const NAME: &'static str = "claim"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -142,12 +208,18 @@ pub mod actions { pub worker_user_id: Name, pub days_since_created: Uint32, } + impl std::str::FromStr for Claimlog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Claimlog { const NAME: &'static str = "claimlog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -155,12 +227,18 @@ pub mod actions { pub struct Close { pub bounty_id: Name, } + impl std::str::FromStr for Close { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Close { const NAME: &'static str = "close"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -168,12 +246,18 @@ pub mod actions { pub struct Complete { pub bounty_id: Name, } + impl std::str::FromStr for Complete { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Complete { const NAME: &'static str = "complete"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -184,12 +268,18 @@ pub mod actions { pub accepted_token: SymbolCode, pub bounty_type: Name, } + impl std::str::FromStr for Create { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Create { const NAME: &'static str = "create"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -202,12 +292,18 @@ pub mod actions { pub type_: Name, pub permissions: Name, } + impl std::str::FromStr for Createlog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Createlog { const NAME: &'static str = "createlog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -215,12 +311,18 @@ pub mod actions { pub struct Deltoken { pub symcode: SymbolCode, } + impl std::str::FromStr for Deltoken { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Deltoken { const NAME: &'static str = "deltoken"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -228,12 +330,18 @@ pub mod actions { pub struct Deny { pub bounty_id: Name, } + impl std::str::FromStr for Deny { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Deny { const NAME: &'static str = "deny"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -247,12 +355,18 @@ pub mod actions { pub value: Float64, pub memo: String, } + impl std::str::FromStr for Depositlog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Depositlog { const NAME: &'static str = "depositlog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -260,12 +374,18 @@ pub mod actions { pub struct Forfeit { pub bounty_id: Name, } + impl std::str::FromStr for Forfeit { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Forfeit { const NAME: &'static str = "forfeit"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -273,12 +393,18 @@ pub mod actions { pub struct Publish { pub bounty_id: Name, } + impl std::str::FromStr for Publish { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Publish { const NAME: &'static str = "publish"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -286,12 +412,18 @@ pub mod actions { pub struct Release { pub bounty_id: Name, } + impl std::str::FromStr for Release { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Release { const NAME: &'static str = "release"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -304,12 +436,18 @@ pub mod actions { pub fee_account: Name, pub metadata_keys: Vec, } + impl std::str::FromStr for Setconfig { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Setconfig { const NAME: &'static str = "setconfig"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -319,12 +457,18 @@ pub mod actions { pub metadata_key: Name, pub metadata_value: String, } + impl std::str::FromStr for Setmetadata { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Setmetadata { const NAME: &'static str = "setmetadata"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -333,12 +477,18 @@ pub mod actions { pub bounty_id: Name, pub state: Name, } + impl std::str::FromStr for Setstate { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Setstate { const NAME: &'static str = "setstate"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -348,12 +498,18 @@ pub mod actions { pub status: Name, pub action: Name, } + impl std::str::FromStr for Statelog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Statelog { const NAME: &'static str = "statelog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -367,12 +523,18 @@ pub mod actions { pub submitted_at: TimePointSec, pub completed_at: TimePointSec, } + impl std::str::FromStr for Syncbounty { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Syncbounty { const NAME: &'static str = "syncbounty"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -385,12 +547,18 @@ pub mod actions { #[serde(deserialize_with = "substreams_antelope::decoder::str_or_u64")] pub oracle_id: Uint64, } + impl std::str::FromStr for Token { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Token { const NAME: &'static str = "token"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -399,12 +567,18 @@ pub mod actions { pub bounty_id: Name, pub receiver: Name, } + impl std::str::FromStr for Withdraw { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Withdraw { const NAME: &'static str = "withdraw"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -416,12 +590,18 @@ pub mod actions { pub receiver: Name, pub refund: ExtendedAsset, } + impl std::str::FromStr for Withdrawlog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Withdrawlog { const NAME: &'static str = "withdrawlog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } } \ No newline at end of file diff --git a/sx.stats/src/abi/contract.rs b/sx.stats/src/abi/contract.rs index 619755b..4dfc218 100644 --- a/sx.stats/src/abi/contract.rs +++ b/sx.stats/src/abi/contract.rs @@ -13,6 +13,12 @@ pub mod types { pub fees: Vec, pub reserves: Vec, } + impl std::str::FromStr for FlashRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct GatewayRow { @@ -26,6 +32,12 @@ pub mod types { pub savings: Vec, pub fees: Vec, } + impl std::str::FromStr for GatewayRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct PairNameUint64 { @@ -33,24 +45,48 @@ pub mod types { #[serde(deserialize_with = "substreams_antelope::decoder::str_or_u64")] pub value: Uint64, } + impl std::str::FromStr for PairNameUint64 { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct PairSymbolCodeAsset { pub key: SymbolCode, pub value: Asset, } + impl std::str::FromStr for PairSymbolCodeAsset { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct PairSymbolCodeFloat64 { pub key: SymbolCode, pub value: Float64, } + impl std::str::FromStr for PairSymbolCodeFloat64 { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct PairSymbolCodePairUint64Asset { pub key: SymbolCode, pub value: PairUint64Asset, } + impl std::str::FromStr for PairSymbolCodePairUint64Asset { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct PairSymbolCodeUint64 { @@ -58,6 +94,12 @@ pub mod types { #[serde(deserialize_with = "substreams_antelope::decoder::str_or_u64")] pub value: Uint64, } + impl std::str::FromStr for PairSymbolCodeUint64 { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct PairUint64Asset { @@ -65,6 +107,12 @@ pub mod types { pub first: Uint64, pub second: Asset, } + impl std::str::FromStr for PairUint64Asset { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct SpotpricesRow { @@ -73,6 +121,12 @@ pub mod types { pub base: SymbolCode, pub quotes: Vec, } + impl std::str::FromStr for SpotpricesRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct TradesRow { @@ -87,6 +141,12 @@ pub mod types { pub executors: Vec, pub profits: Vec, } + impl std::str::FromStr for TradesRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] #[serde(deny_unknown_fields)] pub struct VolumeRow { @@ -97,6 +157,12 @@ pub mod types { pub volume: Vec, pub fees: Vec, } + impl std::str::FromStr for VolumeRow { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } } pub mod actions { use substreams_antelope::types::*; @@ -108,12 +174,18 @@ pub mod actions { pub struct Clean { pub contract: Name, } + impl std::str::FromStr for Clean { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Clean { const NAME: &'static str = "clean"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -121,12 +193,18 @@ pub mod actions { pub struct Erase { pub contract: Name, } + impl std::str::FromStr for Erase { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Erase { const NAME: &'static str = "erase"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -140,12 +218,18 @@ pub mod actions { pub savings: Asset, pub fee: Asset, } + impl std::str::FromStr for Gatewaylog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Gatewaylog { const NAME: &'static str = "gatewaylog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -157,12 +241,18 @@ pub mod actions { pub amount_out: Asset, pub fee: Asset, } + impl std::str::FromStr for Swaplog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Swaplog { const NAME: &'static str = "swaplog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } #[derive(Debug, Clone, PartialEq, serde::Deserialize)] @@ -175,12 +265,18 @@ pub mod actions { pub codes: Vec, pub profit: Asset, } + impl std::str::FromStr for Tradelog { + type Err = substreams_antelope::Error; + fn from_str(value: &str) -> Result { + substreams_antelope::decoder::decode::(value) + } + } impl substreams_antelope::Action for Tradelog { const NAME: &'static str = "tradelog"; fn decode( trace: &substreams_antelope::pb::ActionTrace, ) -> Result { - Ok(decode::(&trace.action.as_ref().unwrap().json_data)?) + decode::(&trace.action.as_ref().unwrap().json_data) } } } \ No newline at end of file