Skip to content

Commit

Permalink
Merge pull request #9 from pinax-network/refactor/events
Browse files Browse the repository at this point in the history
Refactor/add events
  • Loading branch information
fschoell authored Apr 10, 2024
2 parents 2086dbd + 881e9ea commit 0f2410f
Show file tree
Hide file tree
Showing 9 changed files with 648 additions and 236 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "antelope_tokens"
version = "0.3.8"
version = "0.4.0"
authors = [
"Denis <[email protected]>",
"Yaro <[email protected]>",
Expand Down
80 changes: 27 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,84 +16,58 @@ $ make gui

```mermaid
graph TD;
map_transfers[map: map_transfers];
sf.antelope.type.v1.Block[source: sf.antelope.type.v1.Block] --> map_transfers;
map_accounts[map: map_accounts];
sf.antelope.type.v1.Block[source: sf.antelope.type.v1.Block] --> map_accounts;
map_stat[map: map_stat];
sf.antelope.type.v1.Block[source: sf.antelope.type.v1.Block] --> map_stat;
map_events[map: map_events];
sf.antelope.type.v1.Block[source: sf.antelope.type.v1.Block] --> map_events;
graph_out[map: graph_out];
map_accounts --> graph_out;
map_stat --> graph_out;
map_transfers --> graph_out;
map_events --> graph_out;
ch_out[map: ch_out];
map_accounts --> ch_out;
map_stat --> ch_out;
map_transfers --> ch_out;
map_events --> ch_out;
```

### Modules

```yaml
Package name: antelope_tokens
Version: v0.3.8
Version: v0.4.0
Doc: Antelope `eosio.token` based action traces & database operations.
Modules:
----
Name: map_transfers
----
Name: map_events
Initial block: 0
Kind: map
Input: source: sf.antelope.type.v1.Block
Output Type: proto:antelope.eosio.token.v1.TransferEvents
Hash: 68580bd87f70567d5a794b7ed2c42829563c17a6

Name: map_accounts
Initial block: 0
Kind: map
Input: source: sf.antelope.type.v1.Block
Output Type: proto:antelope.eosio.token.v1.Accounts
Hash: dc10dd69bc5bc0ae08a87724995a97e728158dbd

Name: map_stat
Initial block: 0
Kind: map
Input: source: sf.antelope.type.v1.Block
Output Type: proto:antelope.eosio.token.v1.Stats
Hash: 8124e7464c489fe27ee13e4f1ed80abb4c8b6763
Output Type: proto:antelope.eosio.token.v1.Events
Hash: 8dd2fd12c9cb5ad0bb6f32f3b9defcce90090715

Name: graph_out
Initial block: 0
Kind: map
Input: map: map_accounts
Input: map: map_stat
Input: map: map_transfers
Input: map: map_events
Output Type: proto:sf.substreams.sink.entity.v1.EntityChanges
Hash: d4b1a6dc23e5467da5e613ed76366cd73a43fade
Hash: b34452f9c92c173f7a9976534b622ad093dad242

Name: ch_out
Initial block: 0
Kind: map
Input: map: map_accounts
Input: map: map_stat
Input: map: map_transfers
Input: map: map_events
Output Type: proto:sf.substreams.sink.database.v1.DatabaseChanges
Hash: 6f3621429ae1087b55ba3753a1d0cd7cb632948d
Hash: 1515b91545f2d2812ac27fbe5f556dc117d57e20

Sink config:
----
----
type: sf.substreams.sink.sql.v1.Service
configs:
- schema: (6376 bytes) MD5SUM: 6c54c43f4c19f465e51cf36c415bc9f6 [LOADED_FILE]
- dbt_config:
- files: (empty) [ZIPPED_FOLDER]
- run_interval_seconds: 0
- enabled: false
- wire_protocol_access: false
- hasura_frontend:
- enabled: false
- postgraphile_frontend:
- enabled: false
- pgweb_frontend:
- enabled: false
- engine: 2
- schema: (6814 bytes) MD5SUM: adf98a1becc37604e5f14ce2ed6a1629 [LOADED_FILE]
- dbt_config:
- files: (empty) [ZIPPED_FOLDER]
- run_interval_seconds: 0
- enabled: false
- wire_protocol_access: false
- hasura_frontend:
- enabled: false
- postgraphile_frontend:
- enabled: false
- pgweb_frontend:
- enabled: false
- engine: 2
```
118 changes: 93 additions & 25 deletions proto/v1/eosio.token.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,29 @@ package antelope.eosio.token.v1;

import "google/protobuf/timestamp.proto";

message Accounts {
repeated Account items = 1;
message Events {
repeated Transfer transfers = 1;
repeated Issue issues = 2;
repeated Retire retires = 3;
repeated Create creates = 4;
repeated BalanceChange balance_changes = 5;
repeated SupplyChange supply_changes = 6;
}

message Account {
message Transfer {
// trace information
string trx_id = 1;
uint32 action_index = 2;

// contract & scope
string contract = 3;
string symcode = 4;
string symcode = 5;

// data payload
string account = 5;
string balance = 6;
int64 balance_delta = 7;
string from = 6;
string to = 7;
string quantity = 8;
string memo = 9;

// extras
uint32 precision = 10;
Expand All @@ -32,11 +38,79 @@ message Account {
google.protobuf.Timestamp timestamp = 14;
}

message Stats {
repeated Stat items = 1;
message Issue {
// trace information
string trx_id = 1;
uint32 action_index = 2;

// contract & scope
string contract = 3;
string symcode = 4;

// data payload
string issuer = 5;
string to = 6;
string quantity = 7;
string memo = 8;

// extras
uint32 precision = 9;
int64 amount = 10;
double value = 11;

// block information
uint64 block_num = 12;
google.protobuf.Timestamp timestamp = 13;
}

message Stat {
message Retire {
// trace information
string trx_id = 1;
uint32 action_index = 2;

// contract & scope
string contract = 3;
string symcode = 5;

// data payload
string from = 6;
string quantity = 7;
string memo = 8;

// extras
uint32 precision = 9;
int64 amount = 10;
double value = 11;

// block information
uint64 block_num = 12;
google.protobuf.Timestamp timestamp = 13;
}

message Create {
// trace information
string trx_id = 1;
uint32 action_index = 2;

// contract & scope
string contract = 3;
string symcode = 5;

// data payload
string issuer = 6;
string maximum_supply = 7;

// extras
uint32 precision = 8;
int64 amount = 9;
double value = 10;

// block information
uint64 block_num = 11;
google.protobuf.Timestamp timestamp = 12;
}

message BalanceChange {
// trace information
string trx_id = 1;
uint32 action_index = 2;
Expand All @@ -46,10 +120,9 @@ message Stat {
string symcode = 4;

// data payload
string issuer = 5;
string max_supply = 6;
string supply = 7;
int64 supply_delta = 8;
string account = 5;
string balance = 6;
int64 balance_delta = 7;

// extras
uint32 precision = 10;
Expand All @@ -61,25 +134,20 @@ message Stat {
google.protobuf.Timestamp timestamp = 14;
}

message TransferEvents {
repeated TransferEvent items = 1;
}

message TransferEvent {
message SupplyChange {
// trace information
string trx_id = 1;
uint32 action_index = 2;

// contract & scope
string contract = 3;
string action = 4;
string symcode = 5;
string symcode = 4;

// data payload
string from = 6;
string to = 7;
string quantity = 8;
string memo = 9;
string issuer = 5;
string max_supply = 6;
string supply = 7;
int64 supply_delta = 8;

// extras
uint32 precision = 10;
Expand Down
Loading

0 comments on commit 0f2410f

Please sign in to comment.