From 1232487a0e56e404fe0aab55ed7c2e3bce5a474e Mon Sep 17 00:00:00 2001 From: YaroShkvorets Date: Mon, 31 Jul 2023 22:21:35 -0400 Subject: [PATCH] blend.gems substream --- Cargo.toml | 1 + gems.blend/Cargo.toml | 18 + gems.blend/Makefile | 34 ++ gems.blend/abi/gems.blend.abi.json | 400 ++++++++++++++++++++ gems.blend/build.rs | 9 + gems.blend/proto/v1/gems.blend.proto | 26 ++ gems.blend/src/abi/contract.rs | 307 +++++++++++++++ gems.blend/src/abi/mod.rs | 1 + gems.blend/src/lib.rs | 37 ++ gems.blend/src/pb/antelope.gems.blend.v1.rs | 42 ++ gems.blend/src/pb/mod.rs | 12 + gems.blend/substreams.yaml | 25 ++ 12 files changed, 912 insertions(+) create mode 100644 gems.blend/Cargo.toml create mode 100644 gems.blend/Makefile create mode 100644 gems.blend/abi/gems.blend.abi.json create mode 100644 gems.blend/build.rs create mode 100644 gems.blend/proto/v1/gems.blend.proto create mode 100644 gems.blend/src/abi/contract.rs create mode 100644 gems.blend/src/abi/mod.rs create mode 100644 gems.blend/src/lib.rs create mode 100644 gems.blend/src/pb/antelope.gems.blend.v1.rs create mode 100644 gems.blend/src/pb/mod.rs create mode 100644 gems.blend/substreams.yaml diff --git a/Cargo.toml b/Cargo.toml index c73c2ec..7d5e7cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ members = [ "pomelo", "erc721", "pomelo.bounties", + "gems.blend", ] [workspace.dependencies] diff --git a/gems.blend/Cargo.toml b/gems.blend/Cargo.toml new file mode 100644 index 0000000..c622931 --- /dev/null +++ b/gems.blend/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "gems_blend" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +prost = { workspace = true } +prost-types = { workspace = true } +substreams = { workspace = true } +substreams-antelope = { path = "/Users/shkvo/github/Pinax/substreams-antelope" } +serde_json = "1.0.91" +serde = { version = "1.0", features = ["derive"] } + +[build-dependencies] +substreams-antelope = { path = "/Users/shkvo/github/Pinax/substreams-antelope" } \ No newline at end of file diff --git a/gems.blend/Makefile b/gems.blend/Makefile new file mode 100644 index 0000000..5e6f9c8 --- /dev/null +++ b/gems.blend/Makefile @@ -0,0 +1,34 @@ +.PHONY: all +all: + make build + make pack + make graph + make info + +.PHONY: build +build: + cargo build --target wasm32-unknown-unknown --release + +.PHONY: protogen +protogen: + substreams protogen --exclude-paths sf/substreams,google + +.PHONY: pack +pack: + substreams pack + +.PHONY: graph +graph: + substreams graph + +.PHONY: info +info: + substreams info + +.PHONY: run +run: + substreams run -e eos.firehose.eosnation.io:9001 map_actions -s 322315024 -t +10 + +.PHONY: gui +gui: + substreams gui -e eos.firehose.eosnation.io:9001 map_actions -s 322315024 -t +10000 diff --git a/gems.blend/abi/gems.blend.abi.json b/gems.blend/abi/gems.blend.abi.json new file mode 100644 index 0000000..76ae9a8 --- /dev/null +++ b/gems.blend/abi/gems.blend.abi.json @@ -0,0 +1,400 @@ +{ + "version": "eosio::abi/1.2", + "types": [], + "structs": [{ + "name": "addrecipe", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + },{ + "name": "templates", + "type": "nft[]" + } + ] + },{ + "name": "blendlog", + "base": "", + "fields": [{ + "name": "owner", + "type": "name" + },{ + "name": "description", + "type": "string" + },{ + "name": "in_asset_ids", + "type": "uint64[]" + },{ + "name": "out_asset_id", + "type": "uint64" + },{ + "name": "in_templates", + "type": "nft_extra[]" + },{ + "name": "out_template", + "type": "nft_extra" + },{ + "name": "total_mint", + "type": "int32" + },{ + "name": "total_burn", + "type": "int32" + } + ] + },{ + "name": "blends_row", + "base": "", + "fields": [{ + "name": "id", + "type": "nft_extra" + },{ + "name": "recipe_ids", + "type": "uint64[]" + },{ + "name": "description", + "type": "string?" + },{ + "name": "plugin", + "type": "name?" + },{ + "name": "quantity", + "type": "extended_asset?" + },{ + "name": "start_time", + "type": "time_point_sec?" + },{ + "name": "end_time", + "type": "time_point_sec?" + } + ] + },{ + "name": "cancel", + "base": "", + "fields": [{ + "name": "owner", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + } + ] + },{ + "name": "collections_row", + "base": "", + "fields": [{ + "name": "collection_names", + "type": "name[]" + } + ] + },{ + "name": "config_row", + "base": "", + "fields": [{ + "name": "status", + "type": "name" + },{ + "name": "protocol_fee", + "type": "uint16" + },{ + "name": "fee_account", + "type": "name" + } + ] + },{ + "name": "delblend", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + } + ] + },{ + "name": "dellimit", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + } + ] + },{ + "name": "delrecipe", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + },{ + "name": "recipe_id", + "type": "uint64" + } + ] + },{ + "name": "limits_row", + "base": "", + "fields": [{ + "name": "template_id", + "type": "int32" + },{ + "name": "mint_assets", + "type": "int64" + },{ + "name": "max_mint_assets", + "type": "int64" + } + ] + },{ + "name": "nft", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + } + ] + },{ + "name": "nft_extra", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + },{ + "name": "schema_name", + "type": "name" + } + ] + },{ + "name": "orders_row", + "base": "", + "fields": [{ + "name": "id", + "type": "nft" + },{ + "name": "quantity", + "type": "extended_asset" + } + ] + },{ + "name": "recipes_row", + "base": "", + "fields": [{ + "name": "id", + "type": "uint64" + },{ + "name": "templates", + "type": "nft_extra[]" + } + ] + },{ + "name": "reset", + "base": "", + "fields": [{ + "name": "table", + "type": "name" + },{ + "name": "scope", + "type": "name?" + } + ] + },{ + "name": "setblend", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + },{ + "name": "description", + "type": "string?" + },{ + "name": "plugin", + "type": "name?" + },{ + "name": "quantity", + "type": "extended_asset?" + },{ + "name": "start_time", + "type": "time_point_sec?" + },{ + "name": "end_time", + "type": "time_point_sec?" + } + ] + },{ + "name": "setfee", + "base": "", + "fields": [{ + "name": "protocol_fee", + "type": "uint16?" + },{ + "name": "fee_account", + "type": "name?" + } + ] + },{ + "name": "setlimit", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + },{ + "name": "max_mint_assets", + "type": "int64" + } + ] + },{ + "name": "setrecipes", + "base": "", + "fields": [{ + "name": "collection_name", + "type": "name" + },{ + "name": "template_id", + "type": "int32" + },{ + "name": "recipe_ids", + "type": "uint64[]" + } + ] + },{ + "name": "setstatus", + "base": "", + "fields": [{ + "name": "status", + "type": "name" + } + ] + },{ + "name": "status_row", + "base": "", + "fields": [{ + "name": "counters", + "type": "uint32[]" + },{ + "name": "last_updated", + "type": "time_point_sec" + } + ] + } + ], + "actions": [{ + "name": "addrecipe", + "type": "addrecipe", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: addrecipe\nsummary: Add NFT recipe\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "blendlog", + "type": "blendlog", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: blendlog\nsummary: Blend logging\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "cancel", + "type": "cancel", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: cancel\nsummary: Returns any remaining orders to owner account\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "delblend", + "type": "delblend", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: delblend\nsummary: Delete NFT blend\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "dellimit", + "type": "dellimit", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: dellimit\nsummary: Delete limit\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "delrecipe", + "type": "delrecipe", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: delrecipe\nsummary: Delete NFT recipe\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "reset", + "type": "reset", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: reset\nsummary: Reset table\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "setblend", + "type": "setblend", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: setblend\nsummary: Set NFT blend\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "setfee", + "type": "setfee", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: setfee\nsummary: Set protocol fee\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "setlimit", + "type": "setlimit", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: setlimit\nsummary: Set limit\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "setrecipes", + "type": "setrecipes", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: setrecipes\nsummary: Set recipes\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + },{ + "name": "setstatus", + "type": "setstatus", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: setstatus\nsummary: Set status\nicon: https://avatars0.githubusercontent.com/u/75587337#4065db6936f0967a12224125dbdc91f9cc1bbc8d4ee2735ced6bdff180d73d79\n---" + } + ], + "tables": [{ + "name": "blends", + "index_type": "i64", + "key_names": [], + "key_types": [], + "type": "blends_row" + },{ + "name": "collections", + "index_type": "i64", + "key_names": [], + "key_types": [], + "type": "collections_row" + },{ + "name": "config", + "index_type": "i64", + "key_names": [], + "key_types": [], + "type": "config_row" + },{ + "name": "limits", + "index_type": "i64", + "key_names": [], + "key_types": [], + "type": "limits_row" + },{ + "name": "orders", + "index_type": "i64", + "key_names": [], + "key_types": [], + "type": "orders_row" + },{ + "name": "recipes", + "index_type": "i64", + "key_names": [], + "key_types": [], + "type": "recipes_row" + },{ + "name": "status", + "index_type": "i64", + "key_names": [], + "key_types": [], + "type": "status_row" + } + ], + "ricardian_clauses": [], + "error_messages": [], + "abi_extensions": [], + "variants": [], + "action_results": [], + "kv_tables": {} +} diff --git a/gems.blend/build.rs b/gems.blend/build.rs new file mode 100644 index 0000000..9fa6255 --- /dev/null +++ b/gems.blend/build.rs @@ -0,0 +1,9 @@ + +fn main() { + substreams_antelope::Abigen::new("Contract", "abi/gems.blend.abi.json") + .expect("failed to load abi") + .generate() + .expect("failed to generate contract") + .write_to_file("src/abi/contract.rs") + .expect("failed to write contract"); +} \ No newline at end of file diff --git a/gems.blend/proto/v1/gems.blend.proto b/gems.blend/proto/v1/gems.blend.proto new file mode 100644 index 0000000..5bb4dd7 --- /dev/null +++ b/gems.blend/proto/v1/gems.blend.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package antelope.gems.blend.v1; + +message Actions { + repeated BlendLog blendlogs = 1; +} + +message BlendLog { + string trx_id = 1; + uint32 trx_index = 2; + string owner = 3; + string description = 4; + repeated uint64 in_asset_ids = 5; + uint64 out_asset_id = 6; + repeated NftExtra in_templates = 7; + NftExtra out_template = 8; + int32 total_mint = 9; + int32 total_burn = 10; +} + +message NftExtra { + string collection_name = 1; + int32 template_id = 2; + string schema_name = 3; +} \ No newline at end of file diff --git a/gems.blend/src/abi/contract.rs b/gems.blend/src/abi/contract.rs new file mode 100644 index 0000000..2126bf3 --- /dev/null +++ b/gems.blend/src/abi/contract.rs @@ -0,0 +1,307 @@ +pub mod types { + use substreams_antelope::types::*; + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct BlendsRow { + pub id: NftExtra, + #[serde(deserialize_with = "substreams_antelope::decoder::vec_str_or_u64")] + pub recipe_ids: Vec, + pub description: String, + pub plugin: Name, + pub quantity: ExtendedAsset, + pub start_time: TimePointSec, + pub end_time: TimePointSec, + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct CollectionsRow { + pub collection_names: Vec, + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct ConfigRow { + pub status: Name, + pub protocol_fee: Uint16, + pub fee_account: Name, + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct LimitsRow { + pub template_id: Int32, + #[serde(deserialize_with = "substreams_antelope::decoder::str_or_i64")] + pub mint_assets: Int64, + #[serde(deserialize_with = "substreams_antelope::decoder::str_or_i64")] + pub max_mint_assets: Int64, + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Nft { + pub collection_name: Name, + pub template_id: Int32, + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct NftExtra { + pub collection_name: Name, + pub template_id: Int32, + pub schema_name: Name, + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct OrdersRow { + pub id: Nft, + pub quantity: ExtendedAsset, + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct RecipesRow { + #[serde(deserialize_with = "substreams_antelope::decoder::str_or_u64")] + pub id: Uint64, + pub templates: Vec, + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct StatusRow { + pub counters: Vec, + pub last_updated: TimePointSec, + } +} +pub mod actions { + use substreams_antelope::types::*; + use super::types::*; + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Addrecipe { + pub collection_name: Name, + pub template_id: Int32, + pub templates: Vec, + } + impl substreams_antelope::action::Action for Addrecipe { + const NAME: &'static str = "addrecipe"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Blendlog { + pub owner: Name, + pub description: String, + #[serde(deserialize_with = "substreams_antelope::decoder::vec_str_or_u64")] + pub in_asset_ids: Vec, + #[serde(deserialize_with = "substreams_antelope::decoder::str_or_u64")] + pub out_asset_id: Uint64, + pub in_templates: Vec, + pub out_template: NftExtra, + pub total_mint: Int32, + pub total_burn: Int32, + } + impl substreams_antelope::action::Action for Blendlog { + const NAME: &'static str = "blendlog"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Cancel { + pub owner: Name, + pub template_id: Int32, + } + impl substreams_antelope::action::Action for Cancel { + const NAME: &'static str = "cancel"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Delblend { + pub collection_name: Name, + pub template_id: Int32, + } + impl substreams_antelope::action::Action for Delblend { + const NAME: &'static str = "delblend"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Dellimit { + pub collection_name: Name, + pub template_id: Int32, + } + impl substreams_antelope::action::Action for Dellimit { + const NAME: &'static str = "dellimit"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Delrecipe { + pub collection_name: Name, + pub template_id: Int32, + #[serde(deserialize_with = "substreams_antelope::decoder::str_or_u64")] + pub recipe_id: Uint64, + } + impl substreams_antelope::action::Action for Delrecipe { + const NAME: &'static str = "delrecipe"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Reset { + pub table: Name, + pub scope: Name, + } + impl substreams_antelope::action::Action for Reset { + const NAME: &'static str = "reset"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Setblend { + pub collection_name: Name, + pub template_id: Int32, + pub description: String, + pub plugin: Name, + pub quantity: ExtendedAsset, + pub start_time: TimePointSec, + pub end_time: TimePointSec, + } + impl substreams_antelope::action::Action for Setblend { + const NAME: &'static str = "setblend"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Setfee { + pub protocol_fee: Uint16, + pub fee_account: Name, + } + impl substreams_antelope::action::Action for Setfee { + const NAME: &'static str = "setfee"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Setlimit { + pub collection_name: Name, + pub template_id: Int32, + #[serde(deserialize_with = "substreams_antelope::decoder::str_or_i64")] + pub max_mint_assets: Int64, + } + impl substreams_antelope::action::Action for Setlimit { + const NAME: &'static str = "setlimit"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Setrecipes { + pub collection_name: Name, + pub template_id: Int32, + #[serde(deserialize_with = "substreams_antelope::decoder::vec_str_or_u64")] + pub recipe_ids: Vec, + } + impl substreams_antelope::action::Action for Setrecipes { + const NAME: &'static str = "setrecipes"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } + #[derive(Debug, Clone, PartialEq, serde::Deserialize)] + #[serde(deny_unknown_fields)] + pub struct Setstatus { + pub status: Name, + } + impl substreams_antelope::action::Action for Setstatus { + const NAME: &'static str = "setstatus"; + fn decode( + trace: &substreams_antelope::pb::ActionTrace, + ) -> Result { + Ok( + substreams_antelope::decoder::decode::< + Self, + >(&trace.action.as_ref().unwrap().json_data)?, + ) + } + } +} \ No newline at end of file diff --git a/gems.blend/src/abi/mod.rs b/gems.blend/src/abi/mod.rs new file mode 100644 index 0000000..b5eb842 --- /dev/null +++ b/gems.blend/src/abi/mod.rs @@ -0,0 +1 @@ +pub mod contract; \ No newline at end of file diff --git a/gems.blend/src/lib.rs b/gems.blend/src/lib.rs new file mode 100644 index 0000000..96b2204 --- /dev/null +++ b/gems.blend/src/lib.rs @@ -0,0 +1,37 @@ +mod abi; +mod pb; + +use pb::antelope::gems::blend::v1::{Actions, BlendLog, NftExtra}; + +#[substreams::handlers::map] +fn map_actions(block: substreams_antelope::Block) -> Result { + Ok(Actions { + blendlogs: block.actions::(&["blend.gems"]) + .map(|(action, trx)| BlendLog { + trx_id: trx.transaction_id.clone(), + trx_index: trx.action_ordinal, + + owner: action.owner, + description: action.description, + in_asset_ids: action.in_asset_ids, + out_asset_id: action.out_asset_id, + in_templates: action + .in_templates + .iter() + .map(|template| NftExtra { + collection_name: template.collection_name.clone(), + template_id: template.template_id, + schema_name: template.schema_name.clone(), + }) + .collect::>(), + out_template: Some(NftExtra { + collection_name: action.out_template.collection_name, + template_id: action.out_template.template_id, + schema_name: action.out_template.schema_name, + }), + total_mint: action.total_mint, + total_burn: action.total_burn, + }) + .collect(), + }) +} \ No newline at end of file diff --git a/gems.blend/src/pb/antelope.gems.blend.v1.rs b/gems.blend/src/pb/antelope.gems.blend.v1.rs new file mode 100644 index 0000000..f29861a --- /dev/null +++ b/gems.blend/src/pb/antelope.gems.blend.v1.rs @@ -0,0 +1,42 @@ +// @generated +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Actions { + #[prost(message, repeated, tag="1")] + pub blendlogs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlendLog { + #[prost(string, tag="1")] + pub trx_id: ::prost::alloc::string::String, + #[prost(uint32, tag="2")] + pub trx_index: u32, + #[prost(string, tag="3")] + pub owner: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub description: ::prost::alloc::string::String, + #[prost(uint64, repeated, tag="5")] + pub in_asset_ids: ::prost::alloc::vec::Vec, + #[prost(uint64, tag="6")] + pub out_asset_id: u64, + #[prost(message, repeated, tag="7")] + pub in_templates: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="8")] + pub out_template: ::core::option::Option, + #[prost(int32, tag="9")] + pub total_mint: i32, + #[prost(int32, tag="10")] + pub total_burn: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NftExtra { + #[prost(string, tag="1")] + pub collection_name: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub template_id: i32, + #[prost(string, tag="3")] + pub schema_name: ::prost::alloc::string::String, +} +// @@protoc_insertion_point(module) diff --git a/gems.blend/src/pb/mod.rs b/gems.blend/src/pb/mod.rs new file mode 100644 index 0000000..eb5305c --- /dev/null +++ b/gems.blend/src/pb/mod.rs @@ -0,0 +1,12 @@ +// @generated +pub mod antelope { + pub mod gems { + pub mod blend { + // @@protoc_insertion_point(attribute:antelope.gems.blend.v1) + pub mod v1 { + include!("antelope.gems.blend.v1.rs"); + // @@protoc_insertion_point(antelope.gems.blend.v1) + } + } + } +} diff --git a/gems.blend/substreams.yaml b/gems.blend/substreams.yaml new file mode 100644 index 0000000..741a316 --- /dev/null +++ b/gems.blend/substreams.yaml @@ -0,0 +1,25 @@ +specVersion: v0.1.0 +package: + name: "gems_blend" + version: v0.1.0 + url: https://github.com/pinax-network/substreams + doc: dotGems Blend updates + +protobuf: + files: + - gems.blend.proto + importPaths: + - ./proto/v1 + +binaries: + default: + type: wasm/rust-v1 + file: ../target/wasm32-unknown-unknown/release/gems_blend.wasm + +modules: + - name: map_actions + kind: map + inputs: + - source: sf.antelope.type.v1.Block + output: + type: proto:antelope.gems.blend.v1.Actions \ No newline at end of file