Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
379285e
Migrate quote DTO to alloy
jmg-duarte Nov 7, 2025
a360fb3
Migrate the native price estimation endpoint and trait to alloy
jmg-duarte Nov 7, 2025
1cf04a3
Clippy
jmg-duarte Nov 7, 2025
cffad67
Merge branch 'jmgd/alloy/quote-dto' into jmgd/alloy/native-price
jmg-duarte Nov 7, 2025
09209ba
Migrate get_orders_by_tx endpoint to alloy
jmg-duarte Nov 7, 2025
2873159
Merge branch 'main' into jmgd/alloy/quote-dto
jmg-duarte Nov 7, 2025
7b2c90e
Merge branch 'jmgd/alloy/quote-dto' into jmgd/alloy/native-price
jmg-duarte Nov 7, 2025
0c8d469
fix compilation error
jmg-duarte Nov 7, 2025
dd25d86
Merge branch 'jmgd/alloy/native-price' into jmgd/alloy/get_orders_by_tx
jmg-duarte Nov 7, 2025
cd115d9
Migrate solver competition endpoint to alloy
jmg-duarte Nov 7, 2025
93293d7
Migrate get_token_metadata endpoint to alloy
jmg-duarte Nov 7, 2025
38f47fb
Migrate get_total_surplus_endpoint to alloy
jmg-duarte Nov 7, 2025
e5b1671
Migrate get_trades endpoint to alloy
jmg-duarte Nov 7, 2025
f5018ab
Migrate get_user_orders endpoint to alloy
jmg-duarte Nov 7, 2025
7e4b069
Migrate orderbook::database::auction_prices to alloy
jmg-duarte Nov 7, 2025
8b15cd9
Migrate orderbook::database::solver_competition to alloy
jmg-duarte Nov 10, 2025
d104971
Migrate orderbook::database::solver_competition_v2 into alloy
jmg-duarte Nov 10, 2025
cb99ac4
compilation fix
jmg-duarte Nov 10, 2025
f10166b
Migrate OrderMetadata and OnchainOrderData models to alloy
jmg-duarte Nov 10, 2025
3b939f0
Merge branch 'main' into jmgd/alloy/models_order_data
jmg-duarte Nov 20, 2025
9e23e12
compilation fixes
jmg-duarte Nov 20, 2025
9543cc4
Migrate orderbook::orderbook to alloy
jmg-duarte Nov 20, 2025
e2b30b3
Migrate orderbook::quoter into alloy
jmg-duarte Nov 24, 2025
ee05631
force uint sizes through types
jmg-duarte Nov 24, 2025
aed17b3
Migrate QuoteSearchParameters into alloy
jmg-duarte Nov 24, 2025
2cbc736
fix fmt
jmg-duarte Nov 24, 2025
ff199b2
Migrate QuoteData to alloy
jmg-duarte Nov 24, 2025
0d37d9b
Migrate EthflowData into alloy
jmg-duarte Nov 25, 2025
9868db5
Merge branch 'jmgd/alloy/orderbook' into jmgd/temp_main
jmg-duarte Nov 25, 2025
337b4b5
Merge branch 'jmgd/alloy/quoter' into jmgd/temp_main
jmg-duarte Nov 25, 2025
d5a8b95
Merge branch 'jmgd/alloy/quote_search_parameters' into jmgd/temp_main
jmg-duarte Nov 25, 2025
17315f0
Merge branch 'jmgd/alloy/quote_data' into jmgd/temp_main
jmg-duarte Nov 25, 2025
4d30fd4
Merge branch 'jmgd/alloy/ethflow_data' into jmgd/temp_main
jmg-duarte Nov 25, 2025
e01f953
Migrate DTOs and validation to alloy types
jmg-duarte Nov 25, 2025
008b832
Merge branch 'main' into jmgd/alloy/quote_data
jmg-duarte Nov 25, 2025
93f9c21
fix merge
jmg-duarte Nov 25, 2025
5754902
Merge branch 'jmgd/alloy/quote_data' into jmgd/temp_main
jmg-duarte Nov 25, 2025
0763f8c
clippy
jmg-duarte Nov 25, 2025
4dc1e4e
Replace ethcontract primitives with alloy types in quote handling, or…
jmg-duarte Nov 25, 2025
7b46762
Migrate OrderQuoteRequest to use alloy Address types
jmg-duarte Nov 25, 2025
9a2dfcd
Migrate model::order,quote;solver_comp
jmg-duarte Nov 26, 2025
d88c446
Migrate more things
jmg-duarte Nov 26, 2025
3182053
fmt
jmg-duarte Nov 26, 2025
1665333
Merge branch 'main' into jmgd/alloy/models
jmg-duarte Nov 26, 2025
c7333d6
Merge branch 'main' into jmgd/alloy/models
jmg-duarte Nov 26, 2025
e280d5a
simplifications
jmg-duarte Nov 27, 2025
593ad3a
fix bug
jmg-duarte Nov 27, 2025
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
6 changes: 3 additions & 3 deletions crates/autopilot/src/database/onchain_order_events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,9 @@ fn convert_onchain_order_placement(
// executed fast (we don't want to reserve the user's ETH for too long)
if quote.as_ref().is_ok_and(|quote| {
!order_data.within_market(QuoteAmounts {
sell: quote.sell_amount.into_legacy(),
buy: quote.buy_amount.into_legacy(),
fee: quote.fee_amount.into_legacy(),
sell: quote.sell_amount,
buy: quote.buy_amount,
fee: quote.fee_amount,
})
}) {
tracing::debug!(%order_uid, ?owner, "order is outside market price");
Expand Down
4 changes: 3 additions & 1 deletion crates/autopilot/src/run_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ impl RunLoop {
.map(|(index, participant)| SolverSettlement {
solver: participant.driver().name.clone(),
solver_address: participant.solution().solver().0.into_alloy(),
score: Some(Score::Solver(participant.solution().score().get().0)),
score: Some(Score::Solver(
participant.solution().score().get().0.into_alloy(),
)),
ranking: index + 1,
orders: participant
.solution()
Expand Down
4 changes: 2 additions & 2 deletions crates/driver/src/util/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ pub fn mul_ratio_ceil(x: U256, q: U256, d: U256) -> Option<U256> {

// fast path when math in U256 doesn't overflow
if let Some(p) = x.checked_mul(q) {
let (div, rem) = (p / d, p % d);
let (div, rem) = p.div_rem(d);
return div.checked_add(U256::from(!rem.is_zero()));
}

let p = x.widening_mul(q);
let d = U512::from(d);
// SAFETY: at this point !d.is_zero() upholds
let (div, rem) = (p / d, p % d);
let (div, rem) = p.div_rem(d);

let result = U256::uint_try_from(div).ok()?;
result.checked_add(U256::from(!rem.is_zero()))
Expand Down
55 changes: 26 additions & 29 deletions crates/e2e/src/api/zeroex.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
use {
crate::setup::TestAccount,
autopilot::domain::eth::U256,
alloy::primitives::{Address, B256, U256},
chrono::{DateTime, NaiveDateTime, Utc},
driver::domain::eth::H256,
ethcontract::common::abi::{Token, encode},
ethrpc::alloy::conversions::IntoLegacy,
hex_literal::hex,
model::DomainSeparator,
shared::{
zeroex_api,
zeroex_api::{Order, OrderMetadata, OrderRecord, ZeroExSignature},
},
shared::zeroex_api::{self, Order, OrderMetadata, OrderRecord, ZeroExSignature},
std::{net::SocketAddr, sync::LazyLock},
warp::{Filter, Reply},
web3::{signing, types::H160},
Expand Down Expand Up @@ -55,17 +52,17 @@ impl ZeroExApi {
}

pub struct Eip712TypedZeroExOrder {
pub maker_token: H160,
pub taker_token: H160,
pub maker_token: Address,
pub taker_token: Address,
pub maker_amount: u128,
pub taker_amount: u128,
pub remaining_fillable_taker_amount: u128,
pub taker_token_fee_amount: u128,
pub maker: H160,
pub taker: H160,
pub sender: H160,
pub fee_recipient: H160,
pub pool: H256,
pub maker: Address,
pub taker: Address,
pub sender: Address,
pub fee_recipient: Address,
pub pool: B256,
pub expiry: u64,
pub salt: U256,
}
Expand All @@ -85,15 +82,15 @@ impl Eip712TypedZeroExOrder {
Order {
chain_id,
expiry: NaiveDateTime::MAX.and_utc().timestamp() as u64,
fee_recipient: self.fee_recipient,
maker: self.maker,
maker_token: self.maker_token,
fee_recipient: self.fee_recipient.into_legacy(),
maker: self.maker.into_legacy(),
maker_token: self.maker_token.into_legacy(),
maker_amount: self.maker_amount,
pool: self.pool,
salt: self.salt,
sender: self.sender,
taker: self.taker,
taker_token: self.taker_token,
pool: self.pool.into_legacy(),
salt: self.salt.into_legacy(),
sender: self.sender.into_legacy(),
taker: self.taker.into_legacy(),
taker_token: self.taker_token.into_legacy(),
taker_amount: self.taker_amount,
taker_token_fee_amount: self.taker_token_fee_amount,
verifying_contract,
Expand Down Expand Up @@ -131,18 +128,18 @@ impl Eip712TypedZeroExOrder {
fn hash_struct(&self) -> [u8; 32] {
let mut hash_data = [0u8; 416];
hash_data[0..32].copy_from_slice(&Self::ZEROEX_LIMIT_ORDER_TYPEHASH);
hash_data[44..64].copy_from_slice(self.maker_token.as_fixed_bytes());
hash_data[76..96].copy_from_slice(self.taker_token.as_fixed_bytes());
hash_data[44..64].copy_from_slice(self.maker_token.as_slice());
hash_data[76..96].copy_from_slice(self.taker_token.as_slice());
hash_data[112..128].copy_from_slice(&self.maker_amount.to_be_bytes());
hash_data[144..160].copy_from_slice(&self.taker_amount.to_be_bytes());
hash_data[176..192].copy_from_slice(&self.taker_token_fee_amount.to_be_bytes());
hash_data[204..224].copy_from_slice(self.maker.as_fixed_bytes());
hash_data[236..256].copy_from_slice(self.taker.as_fixed_bytes());
hash_data[268..288].copy_from_slice(self.sender.as_fixed_bytes());
hash_data[300..320].copy_from_slice(self.fee_recipient.as_fixed_bytes());
hash_data[320..352].copy_from_slice(self.pool.as_fixed_bytes());
hash_data[204..224].copy_from_slice(self.maker.as_slice());
hash_data[236..256].copy_from_slice(self.taker.as_slice());
hash_data[268..288].copy_from_slice(self.sender.as_slice());
hash_data[300..320].copy_from_slice(self.fee_recipient.as_slice());
hash_data[320..352].copy_from_slice(self.pool.as_slice());
hash_data[376..384].copy_from_slice(&self.expiry.to_be_bytes());
self.salt.to_big_endian(&mut hash_data[384..416]);
hash_data[384..416].copy_from_slice(&self.salt.to_be_bytes::<32>());
signing::keccak256(&hash_data)
}
}
Expand Down
Loading
Loading