(transaction: SimulationRequest, config: Config)
| 227 | } |
| 228 | |
| 229 | pub async fn simulate(transaction: SimulationRequest, config: Config) -> Result<Json, Rejection> { |
| 230 | let fork_url = config |
| 231 | .fork_url |
| 232 | .unwrap_or(chain_id_to_fork_url(transaction.chain_id)?); |
| 233 | let mut evm = Evm::new( |
| 234 | None, |
| 235 | fork_url, |
| 236 | transaction.block_number, |
| 237 | transaction.gas_limit, |
| 238 | true, |
| 239 | config.etherscan_key, |
| 240 | ); |
| 241 | |
| 242 | if evm.get_chain_id() != Uint::from(transaction.chain_id) { |
| 243 | return Err(warp::reject::custom(IncorrectChainIdError())); |
| 244 | } |
| 245 | |
| 246 | if let Some(timestamp) = transaction.block_timestamp { |
| 247 | evm.set_block_timestamp(timestamp) |
| 248 | .await |
| 249 | .expect("failed to set block timestamp"); |
| 250 | } |
| 251 | |
| 252 | let response = run(&mut evm, transaction, false).await?; |
| 253 | |
| 254 | Ok(warp::reply::json(&response)) |
| 255 | } |
| 256 | |
| 257 | pub async fn simulate_bundle( |
| 258 | transactions: Vec<SimulationRequest>, |
nothing calls this directly
no test coverage detected