Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Asseman <alexis@semiotic.ai>
  • Loading branch information
aasseman committed Sep 21, 2023
1 parent 35e8210 commit 7ae5d65
Show file tree
Hide file tree
Showing 20 changed files with 2,066 additions and 18 deletions.

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

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

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

90 changes: 75 additions & 15 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
members = [
"common",
"service",
"tap_agent",
]
resolver = "2"

Expand Down
4 changes: 4 additions & 0 deletions common/src/escrow_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ impl EscrowMonitor {
self.inner.sender_accounts.read().await
}

pub async fn get_account_balance(&self, address: &Address) -> Option<U256> {
self.inner.sender_accounts.read().await.get(address).copied()
}

/// Returns true if the given address has a non-zero balance in the escrow contract.
///
/// Note that this method does not take into account the outstanding TAP balance (Escrow balance - TAP receipts).
Expand Down
1 change: 1 addition & 0 deletions migrations/20230915230734_tap_ravs.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS scalar_tap_ravs CASCADE;
5 changes: 5 additions & 0 deletions migrations/20230915230734_tap_ravs.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE IF NOT EXISTS scalar_tap_ravs (
allocation_id CHAR(40) PRIMARY KEY,
timestamp_ns NUMERIC(20) NOT NULL,
rav JSON NOT NULL
);
3 changes: 0 additions & 3 deletions service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ mod server;
mod tap_manager;
mod util;

#[cfg(test)]
mod test_vectors;

/// Create Indexer service App
///
/// Initialization for server and Query processor
Expand Down
42 changes: 42 additions & 0 deletions tap_agent/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[package]
name = "indexer_tap_agent"
version = "0.1.0"
edition = "2021"
publish = false

[[bin]]
name = "indexer_tap_agent"
path = "src/main.rs"

[dependencies]
alloy-primitives = "0.3.3"
alloy-sol-types = "0.3.2"
anyhow = "1.0.72"
async-trait = "0.1.72"
clap = { version = "4.4.3", features = ["derive", "env"] }
confy = "0.5.1"
dotenvy = "0.15.7"
ethereum-types = "0.14.1"
indexer-common = { version = "0.1.0", path = "../common" }
log = "0.4.19"
reqwest = "0.11.20"
serde = "1.0.188"
serde_json = "1.0.104"
sqlx = { version = "0.7.1", features = ["postgres", "runtime-tokio", "bigdecimal", "rust_decimal"] }
tap_core = "0.5.1"
thiserror = "1.0.44"
tokio = { version = "1.29.1", features = ["rt"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3", features = [
"env-filter",
"ansi",
"fmt",
"std",
"json",
] }

[dev-dependencies]
ethers-signers = "2.0.8"
faux = "0.1.10"
indexer-common = { path = "../common", features = ["mock"] }
rstest = "0.18.1"
14 changes: 14 additions & 0 deletions tap_agent/src/agent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use indexer_common::prelude::{GraphNodeInstance, EscrowMonitor};

use crate::config;

pub async fn start_agent(config: config::Cli) {
let graph_node = GraphNodeInstance::new(&config.indexer_infrastructure.graph_node_query_endpoint);

let escrow_monitor = EscrowMonitor::new(
graph_node.clone(),
config.escrow_subgraph.escrow_subgraph_deployment,
config.ethereum.indexer_address,
config.escrow_subgraph.escrow_syncing_interval
);
}
Loading

0 comments on commit 7ae5d65

Please sign in to comment.