go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

Abigen sol

Open emrahsariboz opened this issue 3 years ago • 6 comments

Is abigen command removed "sol" flag? I was able to run

abigen --sol=contract.sol --pkg=pkg --out=pkg/solidity_wrapper/token.go but now I can't. I get error of flag provided but not defined: -sol

emrahsariboz avatar Aug 25 '22 15:08 emrahsariboz

yeap. This is the commit that removed the sol, solc flag. 8541ddbd951370b2a42df8d82b0633ff0efeba12

note this : https://geth.ethereum.org/docs/dapp/native-bindings

ray-themedium avatar Aug 26 '22 02:08 ray-themedium

This is not good. How to generate a single binding from a contract that has multiple contract in it?

emrahsariboz avatar Aug 26 '22 02:08 emrahsariboz

$ ls
Contract1.sol Contract2.sol Main.sol
---
import "./Contract1.sol";
import "./Contract2.sol";
Contract Main is Contract1, Contract2 {
   .
   .
   .
}
---

$ solc --abi Main.sol -o build
$ abigen --abi ./build/Main.abi --pkg main --type Main --out Main.go

Like this. Doesn't it work?

ray-themedium avatar Aug 26 '22 02:08 ray-themedium

Not really. It still generates three different abi file which I have to pass one by one to abigen.

emrahsariboz avatar Aug 26 '22 02:08 emrahsariboz

Can you provide an example for your case? What's the relationship between your three abi files? Maybe only one is required for binding generation?

Theoretically you can use the output from solc compiler and pass it to abigen. It shouldn't break your pipeline at all.

rjl493456442 avatar Sep 06 '22 12:09 rjl493456442

I can't produce abi with hardhat nor foundry... I tried to do it with solc but it doesn't find any dependency...

StEvUgnIn avatar Feb 06 '23 13:02 StEvUgnIn

Try to use combined-json

davidqhr avatar Jun 08 '23 04:06 davidqhr

Yes we deprecated the -sol flag in abigen. Contracts need to be compiled with solc and we can consume the abi and bin files from that. Will close this issue for now, for advice on how to compile multiple contracts into a single abi, please consult the solidity compiler repository or the ethereum stack exchange.

MariusVanDerWijden avatar Dec 01 '23 11:12 MariusVanDerWijden