MCPcopy Create free account
hub / github.com/EnsoBuild/temper / simulate

Function simulate

src/simulation.rs:229–255  ·  view source on GitHub ↗
(transaction: SimulationRequest, config: Config)

Source from the content-addressed store, hash-verified

227}
228
229pub 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
257pub async fn simulate_bundle(
258 transactions: Vec<SimulationRequest>,

Callers

nothing calls this directly

Calls 5

chain_id_to_fork_urlFunction · 0.85
runFunction · 0.85
get_chain_idMethod · 0.80
set_block_timestampMethod · 0.80

Tested by

no test coverage detected