Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
--systemdf authored and --systemdf committed Mar 26, 2024
1 parent b35122f commit cbefd16
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
23 changes: 17 additions & 6 deletions auction-server/src/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use {
Bytes,
TransactionReceipt,
TransactionRequest,
H160,
U256,
},
},
Expand Down Expand Up @@ -90,6 +91,16 @@ impl TryFrom<EthereumConfig> for Provider<Http> {
}
}

impl From<(H160, Bytes, U256)> for MulticallData {
fn from(x: (H160, Bytes, U256)) -> Self {
MulticallData {
target_contract: x.0,
target_calldata: x.1,
bid_amount: x.2,
}
}
}

pub fn get_simulation_call(
relayer: Address,
provider: Provider<Http>,
Expand Down Expand Up @@ -232,7 +243,7 @@ pub async fn run_submission_loop(store: Arc<Store>) -> Result<()> {
chain_store.config.clone(),
chain_store.network_id,
permission_key.clone(),
winner_bids.iter().map(|b| MulticallData{target_contract: b.target_contract, target_calldata: b.target_calldata.clone(), bid_amount: b.bid_amount }).collect()
winner_bids.iter().map(|b| MulticallData::from((b.target_contract, b.target_calldata.clone(), b.bid_amount))).collect()
)
.await;
match submission {
Expand Down Expand Up @@ -298,11 +309,11 @@ pub async fn handle_bid(store: Arc<Store>, bid: Bid) -> result::Result<Uuid, Res
chain_store.provider.clone(),
chain_store.config.clone(),
bid.permission_key.clone(),
vec![MulticallData {
target_contract: bid.target_contract,
target_calldata: bid.target_calldata.clone(),
bid_amount: bid.amount,
}],
vec![MulticallData::from((
bid.target_contract,
bid.target_calldata.clone(),
bid.amount,
))],
);

if let Err(e) = call.await {
Expand Down
10 changes: 5 additions & 5 deletions auction-server/src/opportunity_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ pub async fn verify_opportunity(
chain_store.provider.clone(),
chain_store.config.clone(),
opportunity.permission_key,
vec![MulticallData {
target_contract: chain_store.config.opportunity_adapter_contract,
target_calldata: adapter_calldata.clone(),
bid_amount: fake_bid.amount,
}],
vec![MulticallData::from((
chain_store.config.opportunity_adapter_contract,
adapter_calldata,
fake_bid.amount,
))],
)
.tx;
let mut state = spoof::State::default();
Expand Down

0 comments on commit cbefd16

Please sign in to comment.