Take abigen from ethereum-go/v1.9.11 and modify the go template to:
pre-parse ABIs and have the parsed ABIs in a generated map keyed by ABI names
remove some generated code that is never used
generate EventInfo structs for 'Unique events'. Unique events are events whose ID and name are unique across contracts. This covers all our events except 'LogPayment' which has 2 versions (the one in content.sol is not used)
// EventInfo gather information about a 'unique event'.
type EventInfo struct {
Name string // name of the event as in abi.Event
ID common.Hash // ID of the event
Type reflect.Type // type of the struct event
Unpack func(log types.Log, ev interface{}) error // unpack the given log into the given event
}
generate maps of unique events:
// Map of Unique events names to *EventInfo.
// Unique events names are constants starting with E_
var UniqueEvents = map[string]*EventInfo{}
// Map of Unique events types to EventInfo
var EventsByType = map[reflect.Type]EventInfo{}
// Map of Unique events IDs to EventInfo
var EventsByID = map[common.Hash]EventInfo{}
The generated `base_content_space.go` has been manually merged with the existing one to preserve the generated byte code (xxBin strings).
---
Note: branch `20200805` has similar changes for `133cb66c6e67fc946c6b73d7f7db3bbb913d4859` which is the revision currently used in fabric.
The new go bindings in branch `20200805` have been manually merged with the existing ones in order to preserve the `xxBin` constants (the contract byte code) since the `solc` currently in elv-toolchain produces byte code not exactly the same than the one that was generated at time.
For older versions (like in build/20200206) we could just rewrite the bindings to get the pre-parsed ABIS.
Closes content-fabric#1617
Take
abigen
fromethereum-go/v1.9.11
and modify the go template to:EventInfo
structs for 'Unique events'. Unique events are events whose ID and name are unique across contracts. This covers all our events except 'LogPayment' which has 2 versions (the one in content.sol is not used)// Map of Unique events types to EventInfo var EventsByType = map[reflect.Type]EventInfo{}
// Map of Unique events IDs to EventInfo var EventsByID = map[common.Hash]EventInfo{}