Skip to content

Commit

Permalink
Safe executed amount conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
squadgazzz committed Jan 17, 2024
1 parent 38de5f9 commit aaf7c29
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/driver/src/domain/liquidity/zeroex.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::domain::{eth, liquidity},
anyhow::anyhow,
anyhow::{anyhow, Context},
contracts::IZeroEx,
ethcontract::Bytes,
primitive_types::{H160, H256, U256},
Expand Down Expand Up @@ -61,7 +61,13 @@ impl LimitOrder {
Bytes(self.order.signature.r.0),
Bytes(self.order.signature.s.0),
),
input.0.amount.0.as_u128(),
input
.0
.amount
.0
.try_into()
.map_err(|err: &str| anyhow!(err))
.context("executed amount does not fit into u128")?,
);
let calldata = method.tx.data.ok_or(anyhow!("no calldata"))?;

Expand Down

0 comments on commit aaf7c29

Please sign in to comment.