mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 18:15:19 +00:00
735d44ba32
* check receipt status for failed txs from evm * make EvmSigner's Auth public * setup evm state initialization for e2e * add a dummy Greeter contract, deployed on start * move WaitForEvmTxReceipt to from account to util * add tests for interacting with the contract * add ContractAddrs map to Chain |
||
---|---|---|
.. | ||
greeter | ||
readme.md |
This directory contains contract interfaces used by the e2e test suite.
Prereq
- Abigen: https://geth.ethereum.org/docs/tools/abigen
- Solidity: https://docs.soliditylang.org/en/latest/installing-solidity.html
Create Contract Interfaces for Go
If you have the compiled ABI, you can skip directly to step 4.
To create new go interfaces to contracts:
- add the solidity file:
<filename>.sol
- decide on a package name. this will be the name of the package you'll import into go (
<pkg-name>
) - compile the abi & bin for the contract:
solc -o <pkg-name> --abi --bin <filename>.sol
- run from this directory
- note that
-o
is the output directory. this will generate<pkg-name>/<filename>.abi
- generate the golang interface:
abigen --abi=<pkg-name>/<filename>.abi --bin=<pkg-name>/<filename>.bin --pkg=<pkg-name> --out=<pkg-name>/main.go
- import and use the contract in Go.
By including the bin, the generated interface will have a Deploy*
method. If you only need to interact with an existing contract, you can exclude the --bin
and only an interaction method interface will be generated.