Hi there,
When trying to run abigen on contracts that uses structs in function params ("tuple" type in ABI JSON) and with ABIEncoderV2 enabled, the output produces invalid go code for the corresponding struct.
Solc: 0.5.7+commit.6da8b019.Linux.g++
Go: go1.12.1 linux/amd64
abigen generates the following go code, which has invalid parts in the function params: data (address,address)
...
func (_Test *TestTransactor) TestData(opts *bind.TransactOpts , data (address,address) ) (*types.Transaction, error) {
return _Test.contract.Transact(opts, "testData" , data)
}
...
run abigen --sol Test.sol --pkg main --out test.go
on Test.sol file with content:
pragma solidity ^0.5.5;
pragma experimental ABIEncoderV2;
contract Test {
struct Data {
address addr1;
address addr2;
}
function testData(Data memory data)
public
returns(address)
{
return data.addr1;
}
}
corresponding ABI JSON:
[
{
"constant":false,
"inputs":[
{
"components":[
{
"name":"addr1",
"type":"address"
},
{
"name":"addr2",
"type":"address"
}
],
"name":"data",
"type":"tuple"
}
],
"name":"testData",
"outputs":[
{
"name":"",
"type":"address"
}
],
"payable":false,
"stateMutability":"nonpayable",
"type":"function"
}
]
Failed to generate ABI binding: 201:80: expected ')', found ','
https://github.com/ethereum/go-ethereum/pull/18491 seems to fix it
Fixed so closing
This cannot be closed until the linked PR is merged.
I think this can be closed, the fix is merged @fjl
@fjl @MariusVanDerWijden @adamschmideg sorry, but what is the status of it, eventually? Does abigen support structs or is it on hold?
Abigen supports structs as of July 2019
Most helpful comment
This cannot be closed until the linked PR is merged.