bluealloy/revm

Instatiating a contract from an ABI locally

CadeMichael opened this issue · 2 comments

I'm digging through some of the documentation to build a Contract object from an abi and execute transactions with it on the Evm. It seems like all of the docs and tutorials I've found point to using a contract from a pre existing chain and then running tests / simulations with it. Is there a standard approach to get a contract locally for running with REVM? Some of the relevant docs I've found include 'BundleState' but I'm not sure how to properly tie this into an 'Evm::builder()' to have the contract exist in the running Evm instance.

https://bluealloy.github.io/revm/docs/revm/db/states/bundle_state/struct.BundleBuilder.html#method.contract

I see that you can use a BundleBuilder and use 'build()' to get the BundleState out of it, but I'm getting lost on going from BundleState to changing the Evm. I'm thinking possibly BundleState::extend() but I'm not sure. If there is a clear solution that's going over my head I'd be happy to add it to the docs.

An ABI just tells you what inputs are valid for a certain bytecode, it doesn't say anything about the environment. You need to get that information either from an rpc or build it yourself locally

Are there any docs on building it locally ?