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

Method new

src/evm.rs:68–131  ·  view source on GitHub ↗
(
        env: Option<Env>,
        fork_url: String,
        fork_block_number: Option<u64>,
        gas_limit: u64,
        tracing: bool,
        etherscan_key: Option<String>,
    )

Source from the content-addressed store, hash-verified

66
67impl Evm {
68 pub fn new(
69 env: Option<Env>,
70 fork_url: String,
71 fork_block_number: Option<u64>,
72 gas_limit: u64,
73 tracing: bool,
74 etherscan_key: Option<String>,
75 ) -> Self {
76 let evm_opts = EvmOpts {
77 fork_url: Some(fork_url.clone()),
78 fork_block_number,
79 env: foundry_evm::executor::opts::Env {
80 chain_id: None,
81 code_size_limit: None,
82 gas_price: Some(0),
83 gas_limit: u64::MAX,
84 ..Default::default()
85 },
86 memory_limit: foundry_config::Config::default().memory_limit,
87 ..Default::default()
88 };
89
90 let fork_opts = CreateFork {
91 url: fork_url,
92 enable_caching: true,
93 env: evm_opts.evm_env_blocking().unwrap(),
94 evm_opts,
95 };
96
97 let db = Backend::spawn(Some(fork_opts.clone()));
98
99 let mut builder = ExecutorBuilder::default()
100 .with_gas_limit(gas_limit.into())
101 .set_tracing(tracing);
102
103 if let Some(env) = env {
104 builder = builder.with_config(env);
105 } else {
106 builder = builder.with_config(fork_opts.env.clone());
107 }
108
109 let executor = builder.build(db);
110
111 let foundry_config = foundry_config::Config {
112 etherscan_api_key: etherscan_key,
113 ..Default::default()
114 };
115
116 let chain: Chain = fork_opts.env.cfg.chain_id.to::<u64>().into();
117 let etherscan_identifier = EtherscanIdentifier::new(&foundry_config, Some(chain)).ok();
118 let mut decoder = CallTraceDecoderBuilder::new().with_verbosity(5).build();
119
120 if let Ok(identifier) =
121 SignaturesIdentifier::new(foundry_config::Config::foundry_cache_dir(), false)
122 {
123 decoder.add_signature_identifier(identifier);
124 }
125

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected