Skip to content

Commit

Permalink
chore(fmt-clippy): fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexangelj committed Nov 3, 2023
1 parent 0c06b94 commit cd0c11d
Show file tree
Hide file tree
Showing 15 changed files with 3,742 additions and 4,801 deletions.
427 changes: 187 additions & 240 deletions simulation/src/bindings/atomic_arbitrage.rs

Large diffs are not rendered by default.

227 changes: 101 additions & 126 deletions simulation/src/bindings/counter.rs

Large diffs are not rendered by default.

2,785 changes: 1,215 additions & 1,570 deletions simulation/src/bindings/g3m.rs

Large diffs are not rendered by default.

695 changes: 301 additions & 394 deletions simulation/src/bindings/i_strategy.rs

Large diffs are not rendered by default.

1,539 changes: 658 additions & 881 deletions simulation/src/bindings/ig3m.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion simulation/src/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ pub mod i_strategy;
pub mod ig3m;
pub mod rmm;
pub mod sd5_9x_18_math;
pub mod shared_types;
pub mod shared_types;
2,124 changes: 931 additions & 1,193 deletions simulation/src/bindings/rmm.rs

Large diffs are not rendered by default.

669 changes: 305 additions & 364 deletions simulation/src/bindings/sd5_9x_18_math.rs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions simulation/src/bindings/shared_types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///`FuzzInterface(address,string[])`
/// `FuzzInterface(address,string[])`
#[derive(
Clone,
::ethers::contract::EthAbiType,
Expand All @@ -9,13 +9,13 @@
Debug,
PartialEq,
Eq,
Hash
Hash,
)]
pub struct FuzzInterface {
pub addr: ::ethers::core::types::Address,
pub artifacts: ::std::vec::Vec<::std::string::String>,
}
///`FuzzSelector(address,bytes4[])`
/// `FuzzSelector(address,bytes4[])`
#[derive(
Clone,
::ethers::contract::EthAbiType,
Expand All @@ -26,7 +26,7 @@ pub struct FuzzInterface {
Debug,
PartialEq,
Eq,
Hash
Hash,
)]
pub struct FuzzSelector {
pub addr: ::ethers::core::types::Address,
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ use std::time::Instant;

use anyhow::Result;
use clap::{ArgAction, CommandFactory, Parser, Subcommand};
use dotenv::dotenv;
use simulation::simulations;
use ui as interface;

use dotenv::dotenv;

/// Represents command-line arguments passed to the `Arbiter` tool.
#[derive(Parser)]
#[clap(name = "Excalibur")]
Expand Down
6 changes: 4 additions & 2 deletions ui/src/example/deployer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Widget for deploying a smart contract.
use crate::sdk::vault::*;
use ethers::prelude::*;
use iced::{
alignment::{self},
Expand All @@ -10,6 +9,8 @@ use iced::{
use thiserror::Error;
use tracing::info;

use crate::sdk::vault::*;

#[derive(Debug, Clone)]
pub enum DeployerToAppMessage {
TriggerDeploy,
Expand Down Expand Up @@ -72,7 +73,8 @@ impl DeployerComponent {

content = content.push(button("Deploy", AppToDeployerMessage::Deploy));

// Push the address to content if `self.address` is not the zero address (Address::zero()).
// Push the address to content if `self.address` is not the zero address
// (Address::zero()).
if self.address != Address::zero() {
content = content.push(text(format!("Address: {}", self.address)));
}
Expand Down
18 changes: 11 additions & 7 deletions ui/src/example/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ use arbiter_core::{
environment::{builder::EnvironmentBuilder, Environment},
middleware::RevmMiddleware,
};
use ethers::prelude::*;
use tracing::info;

use super::*;

use crate::sdk::production::*;
use ethers::prelude::*;
use tracing::info;

mod components;
mod deployer;
Expand Down Expand Up @@ -136,9 +135,13 @@ impl Application for ExampleApp {
match state {
true => {
info!("Starting watcher");
// Turn on the watcher, which returns an instance of `Watcher`.
// `Watcher` has a `handle` which is a cancel token to cancel the event listener stream.
// This cancel token is cloned and sent to the component, so it can cancel the stream when it receives
// Turn on the watcher, which returns an instance of
// `Watcher`.
// `Watcher` has a `handle` which is a cancel token to
// cancel the event listener stream.
// This cancel token is cloned and sent to the
// component, so it can cancel the stream when it
// receives
// an abort message from this application.
return Command::perform(
watcher::Watcher::new(production.clone().get()),
Expand All @@ -161,7 +164,8 @@ impl Application for ExampleApp {
}
false => {
info!("Stopping watcher");
// Turn off the watcher by sending the abort message to the component.
// Turn off the watcher by sending the abort message to
// the component.
return Command::perform(
async { Ok::<(), ()>(()) },
|_| {
Expand Down
9 changes: 5 additions & 4 deletions ui/src/example/screen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use std::sync::Arc;
use arbiter_core::middleware::RevmMiddleware;
use iced::{widget::column, Element};

use super::deployer;
use super::watcher;
use super::{deployer, watcher};

mod banner;
pub mod start;
Expand Down Expand Up @@ -104,14 +103,16 @@ impl ExampleScreen {
pub fn view<'a>(&self) -> Element<'a, ExampleScreenMessage> {
let mut content = column![];

// Render the Deployer component, wraps the component's messages in a screen message.
// Render the Deployer component, wraps the component's messages in a screen
// message.
content = content.push(
self.deployer
.view()
.map(|message| ExampleScreenMessage::DeployerComponent(message)),
);

// Render the Watcher component, wraps the component's messages in a screen message.
// Render the Watcher component, wraps the component's messages in a screen
// message.
content = content.push(
self.watcher
.view()
Expand Down
19 changes: 11 additions & 8 deletions ui/src/example/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
//! Subscribes to an event using Websocket protocol from an ethers-rs provider.
//! It's possible to define event filters to watch using abigen! macro.
use std::sync::Arc;

use ethers::{
contract::{abigen, Contract},
prelude::*,
};
use iced::{
alignment::{self},
widget::{button, column, text},
Alignment, Element, Length,
};

use ethers::contract::{abigen, Contract};
use ethers::prelude::*;
use std::sync::Arc;
use tokio_util::sync::CancellationToken;

use tracing::info;

abigen!(
Expand Down Expand Up @@ -43,13 +44,14 @@ impl Watcher {
info!("Starting event stream watcher");

// Note that `log` has type AnswerUpdatedFilter
// In this code, the tokio::select! block will either wait for the cancellation token to be triggered or for the event stream to complete.
// In this code, the tokio::select! block will either wait for the cancellation
// token to be triggered or for the event stream to complete.
// If the cancellation token is triggered,
// it will log a message and then return,
// effectively stopping the task.
// If the event stream completes,
// it will log a message and continue running.
let handle = tokio::spawn(async move {
let _handle = tokio::spawn(async move {
tokio::select! {
_ = cloned_token.cancelled() => {
info!("Cancellation token triggered");
Expand Down Expand Up @@ -141,7 +143,8 @@ impl WatcherComponent {
}
}

/// Returns AppToWatcherMessage to the application, which passes it back this Watcher component.
/// Returns AppToWatcherMessage to the application, which passes it back
/// this Watcher component.
pub fn view<'a>(&self) -> Element<'a, AppToWatcherMessage> {
let mut content = column![];

Expand Down
12 changes: 7 additions & 5 deletions ui/src/sdk/production.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//! Abstraction for interacting with production or test networks via an ethers-rs provider/client.
//! Abstraction for interacting with production or test networks via an
//! ethers-rs provider/client.
use ethers::prelude::*;
use std::sync::Arc;

use ethers::prelude::*;
use tracing::info;

const RPC_URL_WS: &str = "ws://localhost:8545";
Expand Down Expand Up @@ -33,7 +35,8 @@ impl Production<Ws> {
}

/// Used for testing the connection to the network.
/// Make sure the rpc is online, i.e. if using localhost anvil must be running.
/// Make sure the rpc is online, i.e. if using localhost anvil must be
/// running.
pub async fn debug_tx(&self) -> eyre::Result<()> {
let client = self.client.clone();
let tx = TransactionRequest::new().to(client.address()).value(10000);
Expand Down Expand Up @@ -63,9 +66,8 @@ impl Production<Ws> {
#[cfg(test)]
mod tests {

use ethers::prelude::*;

use dotenv::dotenv;
use ethers::prelude::*;

/// Fails if anvil is not running!
#[tokio::test]
Expand Down

0 comments on commit cd0c11d

Please sign in to comment.