Skip to content

Commit

Permalink
Update based on feedback
Browse files Browse the repository at this point in the history
- remove `version`
- remove transfer details in `Balances`
- add `call.address` in `Balances`

ref: streamingfast#17
  • Loading branch information
DenisCarriere committed Mar 5, 2025
1 parent 17b29c8 commit e7c4e0f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 38 deletions.
9 changes: 1 addition & 8 deletions erc20-balances-transfers/src/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub fn to_balance_change<'a>(

// -- call --
call_index: call.index,
call_address: Hex::encode(&call.address),

// -- log --
log_index: log.index,
Expand All @@ -94,14 +95,6 @@ pub fn to_balance_change<'a>(
old_balance: old_balance.to_string(),
new_balance: new_balance.to_string(),

// -- transfer --
from: Hex::encode(&transfer.from),
to: Hex::encode(&transfer.to),
value: transfer.value.to_string(),

// -- indexing --
version: index_to_version(clock, storage_change),

// -- debug --
balance_change_type: change_type as i32,
}
Expand Down
25 changes: 8 additions & 17 deletions erc20-balances-transfers/src/pb/erc20.types.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,24 @@ pub struct BalanceChange {
/// -- call --
#[prost(uint32, tag="6")]
pub call_index: u32,
/// may indicate the “to” or “from” in a lower-level call context, but is not the address that emitted the event.
#[prost(string, tag="7")]
pub call_address: ::prost::alloc::string::String,
/// -- log --
///
/// Index is the index of the log relative to the transaction. This index is always populated regardless of the state revertion of the the call that emitted this log.
#[prost(uint32, tag="7")]
#[prost(uint32, tag="10")]
pub log_index: u32,
/// BlockIndex represents the index of the log relative to the Block.
#[prost(uint32, tag="8")]
#[prost(uint32, tag="11")]
pub log_block_index: u32,
/// the block's global ordinal when the transfer was recorded.
#[prost(uint64, tag="9")]
#[prost(uint64, tag="12")]
pub log_ordinal: u64,
/// -- storage change --
#[prost(string, tag="10")]
#[prost(string, tag="13")]
pub storage_key: ::prost::alloc::string::String,
#[prost(uint64, tag="11")]
#[prost(uint64, tag="14")]
pub storage_ordinal: u64,
/// -- balance change --
///
Expand All @@ -53,18 +56,6 @@ pub struct BalanceChange {
pub old_balance: ::prost::alloc::string::String,
#[prost(string, tag="23")]
pub new_balance: ::prost::alloc::string::String,
/// -- transfer --
#[prost(string, tag="25")]
pub from: ::prost::alloc::string::String,
#[prost(string, tag="26")]
pub to: ::prost::alloc::string::String,
#[prost(string, tag="27")]
pub value: ::prost::alloc::string::String,
/// -- indexing --
///
/// latest version of the balance change (block_num << 32 + storage_ordinal)
#[prost(uint64, tag="30")]
pub version: u64,
/// -- debug --
///
/// type enum isn't supported yet as a leaf node
Expand Down
19 changes: 6 additions & 13 deletions proto/v1/erc20.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,23 @@ message BalanceChange {

// -- call --
uint32 call_index = 6;
string call_address = 7; // may indicate the “to” or “from” in a lower-level call context, but is not the address that emitted the event.

// -- log --
uint32 log_index = 7; // Index is the index of the log relative to the transaction. This index is always populated regardless of the state revertion of the the call that emitted this log.
uint32 log_block_index = 8; // BlockIndex represents the index of the log relative to the Block.
uint64 log_ordinal = 9; // the block's global ordinal when the transfer was recorded.
uint32 log_index = 10; // Index is the index of the log relative to the transaction. This index is always populated regardless of the state revertion of the the call that emitted this log.
uint32 log_block_index = 11; // BlockIndex represents the index of the log relative to the Block.
uint64 log_ordinal = 12; // the block's global ordinal when the transfer was recorded.

// -- storage change --
string storage_key = 10;
uint64 storage_ordinal = 11;
string storage_key = 13;
uint64 storage_ordinal = 14;

// -- balance change --
string contract = 20; // storage_change.address
string owner = 21;
string old_balance = 22;
string new_balance = 23;

// -- transfer --
string from = 25;
string to = 26;
string value = 27;

// -- indexing --
uint64 version = 30; // latest version of the balance change (block_num << 32 + storage_ordinal)

// -- debug --
int32 balance_change_type = 99; // type enum isn't supported yet as a leaf node
}
Expand Down

0 comments on commit e7c4e0f

Please sign in to comment.