|
@@ -23,6 +23,7 @@ type tmplData struct {
|
|
|
Package string // Name of the package to place the generated file in
|
|
Package string // Name of the package to place the generated file in
|
|
|
Contracts map[string]*tmplContract // List of contracts to generate into this file
|
|
Contracts map[string]*tmplContract // List of contracts to generate into this file
|
|
|
Libraries map[string]string // Map the bytecode's link pattern to the library name
|
|
Libraries map[string]string // Map the bytecode's link pattern to the library name
|
|
|
|
|
+ Structs map[string]*tmplStruct // Contract struct type definitions
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// tmplContract contains the data needed to generate an individual contract binding.
|
|
// tmplContract contains the data needed to generate an individual contract binding.
|
|
@@ -36,8 +37,7 @@ type tmplContract struct {
|
|
|
Transacts map[string]*tmplMethod // Contract calls that write state data
|
|
Transacts map[string]*tmplMethod // Contract calls that write state data
|
|
|
Events map[string]*tmplEvent // Contract events accessors
|
|
Events map[string]*tmplEvent // Contract events accessors
|
|
|
Libraries map[string]string // Same as tmplData, but filtered to only keep what the contract needs
|
|
Libraries map[string]string // Same as tmplData, but filtered to only keep what the contract needs
|
|
|
- Structs map[string]*tmplStruct // Contract struct type definitions
|
|
|
|
|
- Library bool
|
|
|
|
|
|
|
+ Library bool // Indicator whether the contract is a library
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// tmplMethod is a wrapper around an abi.Method that contains a few preprocessed
|
|
// tmplMethod is a wrapper around an abi.Method that contains a few preprocessed
|
|
@@ -108,8 +108,16 @@ var (
|
|
|
_ = event.NewSubscription
|
|
_ = event.NewSubscription
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+{{$structs := .Structs}}
|
|
|
|
|
+{{range $structs}}
|
|
|
|
|
+ // {{.Name}} is an auto generated low-level Go binding around an user-defined struct.
|
|
|
|
|
+ type {{.Name}} struct {
|
|
|
|
|
+ {{range $field := .Fields}}
|
|
|
|
|
+ {{$field.Name}} {{$field.Type}}{{end}}
|
|
|
|
|
+ }
|
|
|
|
|
+{{end}}
|
|
|
|
|
+
|
|
|
{{range $contract := .Contracts}}
|
|
{{range $contract := .Contracts}}
|
|
|
- {{$structs := $contract.Structs}}
|
|
|
|
|
// {{.Type}}ABI is the input ABI used to generate the binding from.
|
|
// {{.Type}}ABI is the input ABI used to generate the binding from.
|
|
|
const {{.Type}}ABI = "{{.InputABI}}"
|
|
const {{.Type}}ABI = "{{.InputABI}}"
|
|
|
|
|
|
|
@@ -285,14 +293,6 @@ var (
|
|
|
return _{{$contract.Type}}.Contract.contract.Transact(opts, method, params...)
|
|
return _{{$contract.Type}}.Contract.contract.Transact(opts, method, params...)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- {{range .Structs}}
|
|
|
|
|
- // {{.Name}} is an auto generated low-level Go binding around an user-defined struct.
|
|
|
|
|
- type {{.Name}} struct {
|
|
|
|
|
- {{range $field := .Fields}}
|
|
|
|
|
- {{$field.Name}} {{$field.Type}}{{end}}
|
|
|
|
|
- }
|
|
|
|
|
- {{end}}
|
|
|
|
|
-
|
|
|
|
|
{{range .Calls}}
|
|
{{range .Calls}}
|
|
|
// {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.ID}}.
|
|
// {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.ID}}.
|
|
|
//
|
|
//
|
|
@@ -507,8 +507,8 @@ package {{.Package}};
|
|
|
import org.ethereum.geth.*;
|
|
import org.ethereum.geth.*;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
+{{$structs := .Structs}}
|
|
|
{{range $contract := .Contracts}}
|
|
{{range $contract := .Contracts}}
|
|
|
-{{$structs := $contract.Structs}}
|
|
|
|
|
{{if not .Library}}public {{end}}class {{.Type}} {
|
|
{{if not .Library}}public {{end}}class {{.Type}} {
|
|
|
// ABI is the input ABI used to generate the binding from.
|
|
// ABI is the input ABI used to generate the binding from.
|
|
|
public final static String ABI = "{{.InputABI}}";
|
|
public final static String ABI = "{{.InputABI}}";
|