Skip to content

Commit

Permalink
fix some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
melotik committed Jan 24, 2023
1 parent 8c32a2d commit c83c3aa
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 231 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ message Token {
string name = 2;
string symbol = 3;
uint64 decimals = 4;
optional string total_supply = 5;
}

message Transfers {
Expand Down
10 changes: 4 additions & 6 deletions eth-balance/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#[rustfmt::skip]
pub mod pb;

use substreams_helper::pb::evm_token::v1 as token;
// use pb::evm_token::v1 as token;
use substreams::Hex;
use substreams_ethereum::pb::eth as pbeth;
use substreams_helper::pb::evm_token::v1 as token;
use substreams_helper::token as token_helper;

#[substreams::handlers::map]
Expand All @@ -26,7 +24,7 @@ fn map_balances(block: pbeth::v2::Block) -> Result<token::Transfers, substreams:
}
}
transfers.push(token::Transfer {
tx_hash: Hex(&transaction.hash).to_string(),
tx_hash: Hex::encode(&transaction.hash),
block_number: block.number,
timestamp: block
.header
Expand All @@ -38,8 +36,8 @@ fn map_balances(block: pbeth::v2::Block) -> Result<token::Transfers, substreams:
.seconds as u64,
log_index: transaction.index,
token: token_helper::get_eth_token(),
to: Hex(&transaction.to).to_string(),
from: Hex(&transaction.from).to_string(),
to: Hex::encode(&transaction.to),
from: Hex::encode(&transaction.from),
amount: token_helper::bigint_to_string(transaction.value.clone()),
amount_usd: None,
balance_changes: balance_changes,
Expand Down
217 changes: 0 additions & 217 deletions eth-balance/src/pb/messari.token.v1.rs

This file was deleted.

5 changes: 2 additions & 3 deletions eth-balance/substreams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ imports:

protobuf:
files:
- evm_token.proto
- eth_balance.proto
importPaths:
- ../common/proto
- ./proto

binaries:
default:
Expand All @@ -20,7 +20,6 @@ binaries:
modules:
- name: map_balances
kind: map
initialBlock: 0
inputs:
- source: sf.ethereum.type.v2.Block
output:
Expand Down
4 changes: 2 additions & 2 deletions substreams-helper/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ pub fn get_eth_token() -> Option<Token> {
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".to_string(),
name: "Ethereum".to_string(),
symbol: "ETH".to_string(),
decimals: 18 as u64,
total_supply: None,
decimals: 18_u64,
};

Some(eth_token)
}

// TODO: replace this with substreams::scalar::BigInt once the wrapper is integrated
// TODO: make this an impl of fmt::Display
pub fn bigint_to_string(number: Option<pbeth::v2::BigInt>) -> String {
number
.as_ref()
Expand Down
4 changes: 2 additions & 2 deletions substreams-helper/substreams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ imports:

protobuf:
files:
- evm_token.proto
- eth_balance.proto
-
importPaths:
- ../common/proto
- ../eth-balance/proto

binaries:
default:
Expand Down

0 comments on commit c83c3aa

Please sign in to comment.