Skip to content

Commit

Permalink
chore: add commonly enforced attributes and rm unused deps (paradigmx…
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored May 20, 2023
1 parent 8b2948f commit 3aa32c0
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 73 deletions.
34 changes: 0 additions & 34 deletions Cargo.lock

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

23 changes: 9 additions & 14 deletions crates/artemis-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,21 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

## eth
ethers = { version = "2", features = ["ws", "rustls"]}
tokio = { version = "1.18", features = ["full"] }
eyre = "0.6"
dotenv = "0.15.0"
futures = "0.3"
tokio-tungstenite = "*"
async-trait = "0.1.64"
opensea-stream = { git = "https://github.com/FrankieIsLost/opensea-stream-rs"}
mev-share-rs = { git = "https://github.com/mattsse/mev-share-rs" }
ethers-flashbots = { git = "https://github.com/FrankieIsLost/ethers-flashbots", features = ["rustls"] }

## async
async-trait = "0.1.64"
futures = "0.3"
reqwest = { version = "0.11.14", default-features = false, features = ["rustls-tls"] }
serde = "1.0.152"
serde_json = { version = "1.0", features = ["arbitrary_precision"] }
tokio = { version = "1.18", features = ["full"] }
tokio-stream = { version = "0.1", features = ['sync'] }
async-stream = "0.3.4"

## misc
anyhow = "1.0.70"
thiserror = "1.0.40"
tracing = "0.1.37"


[build-dependencies]
ethers = { version = "2", features = ["ws", "rustls"]}
eyre = "0.6"
2 changes: 1 addition & 1 deletion crates/artemis-core/src/collectors/block_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ where
M::Provider: PubsubClient,
M::Error: 'static,
{
async fn get_event_stream(&self) -> Result<CollectorStream<NewBlock>> {
async fn get_event_stream(&self) -> Result<CollectorStream<'_, NewBlock>> {
let stream = self.provider.subscribe_blocks().await?;
let stream = stream.filter_map(|block| match block.hash {
Some(hash) => block.number.map(|number| NewBlock { hash, number }),
Expand Down
2 changes: 1 addition & 1 deletion crates/artemis-core/src/collectors/log_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ where
M::Provider: PubsubClient,
M::Error: 'static,
{
async fn get_event_stream(&self) -> Result<CollectorStream<NewLog>> {
async fn get_event_stream(&self) -> Result<CollectorStream<'_, NewLog>> {
let stream = self.provider.subscribe_logs(&self.filter).await?;
let stream = stream.filter_map(|log| {
let topic0 = log.topics.get(0).copied();
Expand Down
2 changes: 1 addition & 1 deletion crates/artemis-core/src/collectors/mempool_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ where
M::Provider: PubsubClient,
M::Error: 'static,
{
async fn get_event_stream(&self) -> Result<CollectorStream<Transaction>> {
async fn get_event_stream(&self) -> Result<CollectorStream<'_, Transaction>> {
let stream = self.provider.subscribe_pending_txs().await?;
let stream = stream.transactions_unordered(256);
let stream = stream.filter_map(|res| async move { res.ok() });
Expand Down
2 changes: 1 addition & 1 deletion crates/artemis-core/src/collectors/mevshare_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl MevShareCollector {
/// [MevShareCollector](MevShareCollector).
#[async_trait]
impl Collector<Event> for MevShareCollector {
async fn get_event_stream(&self) -> Result<CollectorStream<Event>> {
async fn get_event_stream(&self) -> Result<CollectorStream<'_, Event>> {
let client = EventClient::default();
let stream = client.subscribe(&self.mevshare_sse_url).await.unwrap();
let stream = stream.filter_map(|event| match event {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct OpenseaOrder {
/// Implementation of the [Collector](Collector) trait for the [OpenseaOrderCollector](OpenseaOrderCollector).
#[async_trait]
impl Collector<OpenseaOrder> for OpenseaOrderCollector {
async fn get_event_stream(&self) -> Result<CollectorStream<OpenseaOrder>> {
async fn get_event_stream(&self) -> Result<CollectorStream<'_, OpenseaOrder>> {
let mut client = client(Network::Mainnet, &self.api_key).await;

let collection = Collection::All;
Expand Down
9 changes: 8 additions & 1 deletion crates/artemis-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#![warn(unused_crate_dependencies)]
#![deny(unused_must_use, rust_2018_idioms)]
#![doc(test(
no_crate_inject,
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
))]

//! A library for writing MEV bots, designed to be simple, modular, and fast.
//!
//! At it's core, Artemis is architected as an event processing pipeline. The
//! At its core, Artemis is architected as an event processing pipeline. The
//! library is made up of three main components:
//!
//! 1. [Collectors](types::Collector): *Collectors* take in external events (such as pending txs,
Expand Down
4 changes: 2 additions & 2 deletions crates/artemis-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub type CollectorStream<'a, E> = Pin<Box<dyn Stream<Item = E> + Send + 'a>>;
#[async_trait]
pub trait Collector<E>: Send + Sync {
/// Returns the core event stream for the collector.
async fn get_event_stream(&self) -> Result<CollectorStream<E>>;
async fn get_event_stream(&self) -> Result<CollectorStream<'_, E>>;
}

/// Strategy trait, which defines the core logic for each opportunity.
Expand Down Expand Up @@ -57,7 +57,7 @@ where
E2: Send + Sync + 'static,
F: Fn(E1) -> E2 + Send + Sync + Clone + 'static,
{
async fn get_event_stream(&self) -> Result<CollectorStream<E2>> {
async fn get_event_stream(&self) -> Result<CollectorStream<'_, E2>> {
let stream = self.collector.get_event_stream().await?;
let f = self.f.clone();
let stream = stream.map(f);
Expand Down
8 changes: 2 additions & 6 deletions crates/artemis-core/tests/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
use std::{sync::Arc, time::Duration};

use artemis_core::{
collectors::{
block_collector::BlockCollector, mempool_collector::MempoolCollector,
mevshare_collector::MevShareCollector,
},
collectors::{block_collector::BlockCollector, mempool_collector::MempoolCollector},
executors::mempool_executor::{MempoolExecutor, SubmitTxToMempool},
types::{Collector, Executor},
};
Expand All @@ -14,6 +9,7 @@ use ethers::{
types::{BlockNumber, TransactionRequest, U256},
utils::{Anvil, AnvilInstance},
};
use std::{sync::Arc, time::Duration};
use tokio::time::sleep;

/// Spawns Anvil and instantiates an Http provider.
Expand Down
6 changes: 3 additions & 3 deletions crates/clients/opensea-v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ license = "MIT OR Apache-2.0"

[dependencies]
ethers = { version = "2", features = ["ws", "rustls"]}
tokio = { version = "1.18", features = ["full"] }
reqwest = { version = "0.11.14", default-features = false, features = ["rustls-tls"] }
serde = "1.0.152"
serde_json = { version = "1.0", features = ["arbitrary_precision"] }
dotenv = "0.15.0"
thiserror = "1.0.40"

[dev-dependencies]
serde_json = { version = "1.0", features = ["arbitrary_precision"] }
1 change: 1 addition & 0 deletions crates/clients/opensea-v2/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl OpenSeaV2Client {

#[cfg(test)]
mod tests {

use super::*;
use std::path::PathBuf;

Expand Down
6 changes: 6 additions & 0 deletions crates/clients/opensea-v2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#![warn(unused_crate_dependencies)]
#![deny(unused_must_use, rust_2018_idioms)]
#![doc(test(
no_crate_inject,
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
))]
//! A partial implementation of the Opensea V2 API, supporting the
//! [fulfill listing endpoint](https://docs.opensea.io/reference/fulfill-a-listing).
//! This endpoint is useful for taker stragegies, as it provides the arguments
Expand Down
16 changes: 8 additions & 8 deletions crates/strategies/opensea-sudo-arb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ name = "opensea-sudo-arb"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ethers = { version = "2", features = ["ws", "rustls"]}
tokio = { version = "1.18", features = ["full"] }
dotenv = "0.15.0"
async-trait = "0.1.64"

## eth
artemis-core = { path = "../../artemis-core" }
ethers = { version = "2", features = ["ws", "rustls"]}
bindings = { path = "./bindings" }
opensea-stream = { git = "https://github.com/FrankieIsLost/opensea-stream-rs"}
futures = "0.3.27"
opensea-v2 = { path = "../../clients/opensea-v2" }

## async
async-trait = "0.1.64"

## misc
anyhow = "1.0.70"
tracing = "0.1.37"
tracing-subscriber = "0.3.16"


6 changes: 6 additions & 0 deletions crates/strategies/opensea-sudo-arb/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#![warn(unused_crate_dependencies)]
#![deny(unused_must_use, rust_2018_idioms)]
#![doc(test(
no_crate_inject,
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
))]
//! A strategy implementing atomic, cross-market NFT arbitrage between
//! Seaport and Sudoswap. At a high level, we listen to a stream of new seaport orders,
//! and compute whether we can atomically fulfill the order and sell the NFT into a
Expand Down

0 comments on commit 3aa32c0

Please sign in to comment.