From e24e0b73ce018e8449816151eb2ae90bdf3d995a Mon Sep 17 00:00:00 2001 From: Charles Morin Date: Thu, 10 Oct 2024 10:56:30 -0400 Subject: [PATCH 1/2] eosmechanics: skips for loop if new block format --- eosmechanics/src/maps.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/eosmechanics/src/maps.rs b/eosmechanics/src/maps.rs index 06261d4..ca7722d 100644 --- a/eosmechanics/src/maps.rs +++ b/eosmechanics/src/maps.rs @@ -67,8 +67,20 @@ pub fn map_schedule_change(block: Block) -> Result { None => vec![], // New ??? }; + // New block format + if !block.proposer_policy.as_ref().is_none() { + return Ok(ScheduleChange { + producer: block.header.as_ref().unwrap().producer.clone(), + schedule_version: block.header.as_ref().unwrap().schedule_version, + active_schedule, + pending_schedule, + add_to_schedule: Default::default(), + remove_from_schedule: Default::default(), + }); + } + // 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() { + if pending_schedule.is_empty() { return Ok(Default::default()); } From c030c599d02ecefc60d7425ab9939580d636f917 Mon Sep 17 00:00:00 2001 From: Charles Morin Date: Thu, 10 Oct 2024 11:30:49 -0400 Subject: [PATCH 2/2] eosmechanics: rolled back to return after loop --- eosmechanics/src/maps.rs | 16 +- gems.blend/src/abi/contract.rs | 150 +++++++++++++++++-- pomelo.bounties/src/abi/contract.rs | 224 +++++++++++++++++++++++++--- sx.stats/src/abi/contract.rs | 106 ++++++++++++- 4 files changed, 443 insertions(+), 53 deletions(-) diff --git a/eosmechanics/src/maps.rs b/eosmechanics/src/maps.rs index ca7722d..4ea33a1 100644 --- a/eosmechanics/src/maps.rs +++ b/eosmechanics/src/maps.rs @@ -64,23 +64,11 @@ pub fn map_schedule_change(block: Block) -> Result { }; 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 ??? + None => vec![], // New }; - // New block format - if !block.proposer_policy.as_ref().is_none() { - return Ok(ScheduleChange { - producer: block.header.as_ref().unwrap().producer.clone(), - schedule_version: block.header.as_ref().unwrap().schedule_version, - active_schedule, - pending_schedule, - add_to_schedule: Default::default(), - remove_from_schedule: Default::default(), - }); - } - // If there is no pending schedule and it's old block format, then there is no schedule change - if pending_schedule.is_empty() { + if pending_schedule.is_empty() && block.proposer_policy.as_ref().is_none() { return Ok(Default::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