|
|
@ -48,12 +48,16 @@ const ( |
|
|
|
// enforces compile time type safety and naming convention opposed to having to
|
|
|
|
// enforces compile time type safety and naming convention opposed to having to
|
|
|
|
// manually maintain hard coded strings that break on runtime.
|
|
|
|
// manually maintain hard coded strings that break on runtime.
|
|
|
|
func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]string, pkg string, lang Lang, libs map[string]string, aliases map[string]string) (string, error) { |
|
|
|
func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]string, pkg string, lang Lang, libs map[string]string, aliases map[string]string) (string, error) { |
|
|
|
// Process each individual contract requested binding
|
|
|
|
var ( |
|
|
|
contracts := make(map[string]*tmplContract) |
|
|
|
// contracts is the map of each individual contract requested binding
|
|
|
|
|
|
|
|
contracts = make(map[string]*tmplContract) |
|
|
|
|
|
|
|
|
|
|
|
// Map used to flag each encountered library as such
|
|
|
|
// structs is the map of all reclared structs shared by passed contracts.
|
|
|
|
isLib := make(map[string]struct{}) |
|
|
|
structs = make(map[string]*tmplStruct) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// isLib is the map used to flag each encountered library as such
|
|
|
|
|
|
|
|
isLib = make(map[string]struct{}) |
|
|
|
|
|
|
|
) |
|
|
|
for i := 0; i < len(types); i++ { |
|
|
|
for i := 0; i < len(types); i++ { |
|
|
|
// Parse the actual ABI to generate the binding for
|
|
|
|
// Parse the actual ABI to generate the binding for
|
|
|
|
evmABI, err := abi.JSON(strings.NewReader(abis[i])) |
|
|
|
evmABI, err := abi.JSON(strings.NewReader(abis[i])) |
|
|
@ -73,7 +77,6 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string] |
|
|
|
calls = make(map[string]*tmplMethod) |
|
|
|
calls = make(map[string]*tmplMethod) |
|
|
|
transacts = make(map[string]*tmplMethod) |
|
|
|
transacts = make(map[string]*tmplMethod) |
|
|
|
events = make(map[string]*tmplEvent) |
|
|
|
events = make(map[string]*tmplEvent) |
|
|
|
structs = make(map[string]*tmplStruct) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// identifiers are used to detect duplicated identifier of function
|
|
|
|
// identifiers are used to detect duplicated identifier of function
|
|
|
|
// and event. For all calls, transacts and events, abigen will generate
|
|
|
|
// and event. For all calls, transacts and events, abigen will generate
|
|
|
@ -168,7 +171,6 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string] |
|
|
|
Transacts: transacts, |
|
|
|
Transacts: transacts, |
|
|
|
Events: events, |
|
|
|
Events: events, |
|
|
|
Libraries: make(map[string]string), |
|
|
|
Libraries: make(map[string]string), |
|
|
|
Structs: structs, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// Function 4-byte signatures are stored in the same sequence
|
|
|
|
// Function 4-byte signatures are stored in the same sequence
|
|
|
|
// as types, if available.
|
|
|
|
// as types, if available.
|
|
|
@ -200,6 +202,7 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string] |
|
|
|
Package: pkg, |
|
|
|
Package: pkg, |
|
|
|
Contracts: contracts, |
|
|
|
Contracts: contracts, |
|
|
|
Libraries: libs, |
|
|
|
Libraries: libs, |
|
|
|
|
|
|
|
Structs: structs, |
|
|
|
} |
|
|
|
} |
|
|
|
buffer := new(bytes.Buffer) |
|
|
|
buffer := new(bytes.Buffer) |
|
|
|
|
|
|
|
|
|
|
|