Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions crates/driver/src/tests/boundary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
pub use model::{DomainSeparator, order::OrderUid};
use {
crate::domain::competition,
alloy::signers::local::PrivateKeySigner,
ethrpc::alloy::conversions::IntoAlloy,
alloy::{
primitives::{Address, U256},
signers::local::PrivateKeySigner,
},
};

/// Order data used for calculating the order UID and signing.
#[derive(Debug)]
pub struct Order {
pub sell_token: ethcontract::H160,
pub buy_token: ethcontract::H160,
pub sell_amount: ethcontract::U256,
pub buy_amount: ethcontract::U256,
pub sell_token: Address,
pub buy_token: Address,
pub sell_amount: U256,
pub buy_amount: U256,
pub valid_to: u32,
pub receiver: Option<ethcontract::H160>,
pub user_fee: ethcontract::U256,
pub receiver: Option<Address>,
pub user_fee: U256,
pub side: competition::order::Side,
pub secret_key: PrivateKeySigner,
pub domain_separator: DomainSeparator,
pub owner: ethcontract::H160,
pub owner: Address,
pub partially_fillable: bool,
}

impl Order {
pub fn uid(&self) -> OrderUid {
self.build()
.data
.uid(&self.domain_separator, self.owner.into_alloy())
self.build().data.uid(&self.domain_separator, self.owner)
}

pub fn signature(&self) -> Vec<u8> {
Expand All @@ -37,13 +37,13 @@ impl Order {

fn build(&self) -> model::order::Order {
model::order::OrderBuilder::default()
.with_sell_token(self.sell_token.into_alloy())
.with_buy_token(self.buy_token.into_alloy())
.with_sell_amount(self.sell_amount.into_alloy())
.with_buy_amount(self.buy_amount.into_alloy())
.with_sell_token(self.sell_token)
.with_buy_token(self.buy_token)
.with_sell_amount(self.sell_amount)
.with_buy_amount(self.buy_amount)
.with_valid_to(self.valid_to)
.with_fee_amount(self.user_fee.into_alloy())
.with_receiver(self.receiver.map(IntoAlloy::into_alloy))
.with_fee_amount(self.user_fee)
.with_receiver(self.receiver)
.with_kind(match self.side {
competition::order::Side::Buy => model::order::OrderKind::Buy,
competition::order::Side::Sell => model::order::OrderKind::Sell,
Expand Down
6 changes: 3 additions & 3 deletions crates/driver/src/tests/cases/settle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use {
setup::{ab_order, ab_pool, ab_solution},
},
},
alloy::providers::Provider,
futures::future::join_all,
itertools::Itertools,
std::{sync::Arc, time::Duration},
web3::Transport,
};

/// Run a matrix of tests for all meaningful combinations of order kind and
Expand Down Expand Up @@ -118,8 +118,8 @@ async fn submits_huge_solution() {
// half of the block gas limit, we want it to be submitted/settled as long as it
// fits in the block.
test.web3()
.transport()
.execute("evm_setBlockGasLimit", vec![serde_json::json!(9_000_000)])
.alloy
.raw_request::<_, bool>("evm_setBlockGasLimit".into(), (9_000_000,))
.await
.unwrap();
test.settle(id).await.ok().await;
Expand Down
16 changes: 8 additions & 8 deletions crates/driver/src/tests/setup/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use {
},
ethrpc::{
Web3,
alloy::{CallBuilderExt, ProviderExt, conversions::IntoLegacy},
alloy::{CallBuilderExt, ProviderExt},
},
futures::Future,
solvers_dto::solution::Flashloan,
Expand Down Expand Up @@ -196,15 +196,15 @@ impl QuotedOrder {
blockchain: &Blockchain,
signer: PrivateKeySigner,
) -> tests::boundary::Order {
let owner = signer.address().into_legacy();
let owner = signer.address();
tests::boundary::Order {
sell_token: blockchain.get_token(self.order.sell_token).into_legacy(),
buy_token: blockchain.get_token(self.order.buy_token).into_legacy(),
sell_amount: self.sell_amount().into_legacy(),
buy_amount: self.buy_amount().into_legacy(),
sell_token: blockchain.get_token(self.order.sell_token),
buy_token: blockchain.get_token(self.order.buy_token),
sell_amount: self.sell_amount(),
buy_amount: self.buy_amount(),
valid_to: self.order.valid_to,
receiver: self.order.receiver.map(IntoLegacy::into_legacy),
user_fee: self.order.fee_amount.into_legacy(),
receiver: self.order.receiver,
user_fee: self.order.fee_amount,
side: self.order.side,
secret_key: signer,
domain_separator: blockchain.domain_separator,
Expand Down
4 changes: 2 additions & 2 deletions crates/driver/src/tests/setup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use {
signers::local::PrivateKeySigner,
},
bigdecimal::{BigDecimal, FromPrimitive},
ethcontract::dyns::DynTransport,
ethrpc::Web3,
futures::future::join_all,
hyper::StatusCode,
model::order::{BuyTokenDestination, SellTokenSource},
Expand Down Expand Up @@ -1185,7 +1185,7 @@ impl Test {
balances
}

pub fn web3(&self) -> &web3::Web3<DynTransport> {
pub fn web3(&self) -> &Web3 {
&self.blockchain.web3
}

Expand Down
73 changes: 0 additions & 73 deletions crates/ethrpc/src/extensions.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/ethrpc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod alloy;
pub mod block_stream;
pub mod buffered;
pub mod extensions;
pub mod http;
pub mod instrumented;
#[cfg(any(test, feature = "test-util"))]
Expand Down
Loading