github.com/theQRL/go-zond@v0.1.1/accounts/abi/bind/template.go (about)

     1  // Copyright 2016 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package bind
    18  
    19  import "github.com/theQRL/go-zond/accounts/abi"
    20  
    21  // tmplData is the data structure required to fill the binding template.
    22  type tmplData struct {
    23  	Package   string                   // Name of the package to place the generated file in
    24  	Contracts map[string]*tmplContract // List of contracts to generate into this file
    25  	Libraries map[string]string        // Map the bytecode's link pattern to the library name
    26  	Structs   map[string]*tmplStruct   // Contract struct type definitions
    27  }
    28  
    29  // tmplContract contains the data needed to generate an individual contract binding.
    30  type tmplContract struct {
    31  	Type        string                 // Type name of the main contract binding
    32  	InputABI    string                 // JSON ABI used as the input to generate the binding from
    33  	InputBin    string                 // Optional EVM bytecode used to generate deploy code from
    34  	FuncSigs    map[string]string      // Optional map: string signature -> 4-byte signature
    35  	Constructor abi.Method             // Contract constructor for deploy parametrization
    36  	Calls       map[string]*tmplMethod // Contract calls that only read state data
    37  	Transacts   map[string]*tmplMethod // Contract calls that write state data
    38  	Fallback    *tmplMethod            // Additional special fallback function
    39  	Receive     *tmplMethod            // Additional special receive function
    40  	Events      map[string]*tmplEvent  // Contract events accessors
    41  	Libraries   map[string]string      // Same as tmplData, but filtered to only keep what the contract needs
    42  	Library     bool                   // Indicator whether the contract is a library
    43  }
    44  
    45  // tmplMethod is a wrapper around an abi.Method that contains a few preprocessed
    46  // and cached data fields.
    47  type tmplMethod struct {
    48  	Original   abi.Method // Original method as parsed by the abi package
    49  	Normalized abi.Method // Normalized version of the parsed method (capitalized names, non-anonymous args/returns)
    50  	Structured bool       // Whether the returns should be accumulated into a struct
    51  }
    52  
    53  // tmplEvent is a wrapper around an abi.Event that contains a few preprocessed
    54  // and cached data fields.
    55  type tmplEvent struct {
    56  	Original   abi.Event // Original event as parsed by the abi package
    57  	Normalized abi.Event // Normalized version of the parsed fields
    58  }
    59  
    60  // tmplField is a wrapper around a struct field with binding language
    61  // struct type definition and relative filed name.
    62  type tmplField struct {
    63  	Type    string   // Field type representation depends on target binding language
    64  	Name    string   // Field name converted from the raw user-defined field name
    65  	SolKind abi.Type // Raw abi type information
    66  }
    67  
    68  // tmplStruct is a wrapper around an abi.tuple and contains an auto-generated
    69  // struct name.
    70  type tmplStruct struct {
    71  	Name   string       // Auto-generated struct name(before solidity v0.5.11) or raw name.
    72  	Fields []*tmplField // Struct fields definition depends on the binding language.
    73  }
    74  
    75  // tmplSource is language to template mapping containing all the supported
    76  // programming languages the package can generate to.
    77  var tmplSource = map[Lang]string{
    78  	LangGo: tmplSourceGo,
    79  }
    80  
    81  // tmplSourceGo is the Go source template that the generated Go contract binding
    82  // is based on.
    83  const tmplSourceGo = `
    84  // Code generated - DO NOT EDIT.
    85  // This file is a generated binding and any manual changes will be lost.
    86  
    87  package {{.Package}}
    88  
    89  import (
    90  	"math/big"
    91  	"strings"
    92  	"errors"
    93  
    94  	ethereum "github.com/theQRL/go-zond"
    95  	"github.com/theQRL/go-zond/accounts/abi"
    96  	"github.com/theQRL/go-zond/accounts/abi/bind"
    97  	"github.com/theQRL/go-zond/common"
    98  	"github.com/theQRL/go-zond/core/types"
    99  	"github.com/theQRL/go-zond/event"
   100  )
   101  
   102  // Reference imports to suppress errors if they are not otherwise used.
   103  var (
   104  	_ = errors.New
   105  	_ = big.NewInt
   106  	_ = strings.NewReader
   107  	_ = zond.NotFound
   108  	_ = bind.Bind
   109  	_ = common.Big1
   110  	_ = types.BloomLookup
   111  	_ = event.NewSubscription
   112  	_ = abi.ConvertType
   113  )
   114  
   115  {{$structs := .Structs}}
   116  {{range $structs}}
   117  	// {{.Name}} is an auto generated low-level Go binding around an user-defined struct.
   118  	type {{.Name}} struct {
   119  	{{range $field := .Fields}}
   120  	{{$field.Name}} {{$field.Type}}{{end}}
   121  	}
   122  {{end}}
   123  
   124  {{range $contract := .Contracts}}
   125  	// {{.Type}}MetaData contains all meta data concerning the {{.Type}} contract.
   126  	var {{.Type}}MetaData = &bind.MetaData{
   127  		ABI: "{{.InputABI}}",
   128  		{{if $contract.FuncSigs -}}
   129  		Sigs: map[string]string{
   130  			{{range $strsig, $binsig := .FuncSigs}}"{{$binsig}}": "{{$strsig}}",
   131  			{{end}}
   132  		},
   133  		{{end -}}
   134  		{{if .InputBin -}}
   135  		Bin: "0x{{.InputBin}}",
   136  		{{end}}
   137  	}
   138  	// {{.Type}}ABI is the input ABI used to generate the binding from.
   139  	// Deprecated: Use {{.Type}}MetaData.ABI instead.
   140  	var {{.Type}}ABI = {{.Type}}MetaData.ABI
   141  
   142  	{{if $contract.FuncSigs}}
   143  		// Deprecated: Use {{.Type}}MetaData.Sigs instead.
   144  		// {{.Type}}FuncSigs maps the 4-byte function signature to its string representation.
   145  		var {{.Type}}FuncSigs = {{.Type}}MetaData.Sigs
   146  	{{end}}
   147  
   148  	{{if .InputBin}}
   149  		// {{.Type}}Bin is the compiled bytecode used for deploying new contracts.
   150  		// Deprecated: Use {{.Type}}MetaData.Bin instead.
   151  		var {{.Type}}Bin = {{.Type}}MetaData.Bin
   152  
   153  		// Deploy{{.Type}} deploys a new Ethereum contract, binding an instance of {{.Type}} to it.
   154  		func Deploy{{.Type}}(auth *bind.TransactOpts, backend bind.ContractBackend {{range .Constructor.Inputs}}, {{.Name}} {{bindtype .Type $structs}}{{end}}) (common.Address, *types.Transaction, *{{.Type}}, error) {
   155  		  parsed, err := {{.Type}}MetaData.GetAbi()
   156  		  if err != nil {
   157  		    return common.Address{}, nil, nil, err
   158  		  }
   159  		  if parsed == nil {
   160  			return common.Address{}, nil, nil, errors.New("GetABI returned nil")
   161  		  }
   162  		  {{range $pattern, $name := .Libraries}}
   163  			{{decapitalise $name}}Addr, _, _, _ := Deploy{{capitalise $name}}(auth, backend)
   164  			{{$contract.Type}}Bin = strings.ReplaceAll({{$contract.Type}}Bin, "__${{$pattern}}$__", {{decapitalise $name}}Addr.String()[2:])
   165  		  {{end}}
   166  		  address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex({{.Type}}Bin), backend {{range .Constructor.Inputs}}, {{.Name}}{{end}})
   167  		  if err != nil {
   168  		    return common.Address{}, nil, nil, err
   169  		  }
   170  		  return address, tx, &{{.Type}}{ {{.Type}}Caller: {{.Type}}Caller{contract: contract}, {{.Type}}Transactor: {{.Type}}Transactor{contract: contract}, {{.Type}}Filterer: {{.Type}}Filterer{contract: contract} }, nil
   171  		}
   172  	{{end}}
   173  
   174  	// {{.Type}} is an auto generated Go binding around an Ethereum contract.
   175  	type {{.Type}} struct {
   176  	  {{.Type}}Caller     // Read-only binding to the contract
   177  	  {{.Type}}Transactor // Write-only binding to the contract
   178  	  {{.Type}}Filterer   // Log filterer for contract events
   179  	}
   180  
   181  	// {{.Type}}Caller is an auto generated read-only Go binding around an Ethereum contract.
   182  	type {{.Type}}Caller struct {
   183  	  contract *bind.BoundContract // Generic contract wrapper for the low level calls
   184  	}
   185  
   186  	// {{.Type}}Transactor is an auto generated write-only Go binding around an Ethereum contract.
   187  	type {{.Type}}Transactor struct {
   188  	  contract *bind.BoundContract // Generic contract wrapper for the low level calls
   189  	}
   190  
   191  	// {{.Type}}Filterer is an auto generated log filtering Go binding around an Ethereum contract events.
   192  	type {{.Type}}Filterer struct {
   193  	  contract *bind.BoundContract // Generic contract wrapper for the low level calls
   194  	}
   195  
   196  	// {{.Type}}Session is an auto generated Go binding around an Ethereum contract,
   197  	// with pre-set call and transact options.
   198  	type {{.Type}}Session struct {
   199  	  Contract     *{{.Type}}        // Generic contract binding to set the session for
   200  	  CallOpts     bind.CallOpts     // Call options to use throughout this session
   201  	  TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
   202  	}
   203  
   204  	// {{.Type}}CallerSession is an auto generated read-only Go binding around an Ethereum contract,
   205  	// with pre-set call options.
   206  	type {{.Type}}CallerSession struct {
   207  	  Contract *{{.Type}}Caller // Generic contract caller binding to set the session for
   208  	  CallOpts bind.CallOpts    // Call options to use throughout this session
   209  	}
   210  
   211  	// {{.Type}}TransactorSession is an auto generated write-only Go binding around an Ethereum contract,
   212  	// with pre-set transact options.
   213  	type {{.Type}}TransactorSession struct {
   214  	  Contract     *{{.Type}}Transactor // Generic contract transactor binding to set the session for
   215  	  TransactOpts bind.TransactOpts    // Transaction auth options to use throughout this session
   216  	}
   217  
   218  	// {{.Type}}Raw is an auto generated low-level Go binding around an Ethereum contract.
   219  	type {{.Type}}Raw struct {
   220  	  Contract *{{.Type}} // Generic contract binding to access the raw methods on
   221  	}
   222  
   223  	// {{.Type}}CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
   224  	type {{.Type}}CallerRaw struct {
   225  		Contract *{{.Type}}Caller // Generic read-only contract binding to access the raw methods on
   226  	}
   227  
   228  	// {{.Type}}TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
   229  	type {{.Type}}TransactorRaw struct {
   230  		Contract *{{.Type}}Transactor // Generic write-only contract binding to access the raw methods on
   231  	}
   232  
   233  	// New{{.Type}} creates a new instance of {{.Type}}, bound to a specific deployed contract.
   234  	func New{{.Type}}(address common.Address, backend bind.ContractBackend) (*{{.Type}}, error) {
   235  	  contract, err := bind{{.Type}}(address, backend, backend, backend)
   236  	  if err != nil {
   237  	    return nil, err
   238  	  }
   239  	  return &{{.Type}}{ {{.Type}}Caller: {{.Type}}Caller{contract: contract}, {{.Type}}Transactor: {{.Type}}Transactor{contract: contract}, {{.Type}}Filterer: {{.Type}}Filterer{contract: contract} }, nil
   240  	}
   241  
   242  	// New{{.Type}}Caller creates a new read-only instance of {{.Type}}, bound to a specific deployed contract.
   243  	func New{{.Type}}Caller(address common.Address, caller bind.ContractCaller) (*{{.Type}}Caller, error) {
   244  	  contract, err := bind{{.Type}}(address, caller, nil, nil)
   245  	  if err != nil {
   246  	    return nil, err
   247  	  }
   248  	  return &{{.Type}}Caller{contract: contract}, nil
   249  	}
   250  
   251  	// New{{.Type}}Transactor creates a new write-only instance of {{.Type}}, bound to a specific deployed contract.
   252  	func New{{.Type}}Transactor(address common.Address, transactor bind.ContractTransactor) (*{{.Type}}Transactor, error) {
   253  	  contract, err := bind{{.Type}}(address, nil, transactor, nil)
   254  	  if err != nil {
   255  	    return nil, err
   256  	  }
   257  	  return &{{.Type}}Transactor{contract: contract}, nil
   258  	}
   259  
   260  	// New{{.Type}}Filterer creates a new log filterer instance of {{.Type}}, bound to a specific deployed contract.
   261   	func New{{.Type}}Filterer(address common.Address, filterer bind.ContractFilterer) (*{{.Type}}Filterer, error) {
   262   	  contract, err := bind{{.Type}}(address, nil, nil, filterer)
   263   	  if err != nil {
   264   	    return nil, err
   265   	  }
   266   	  return &{{.Type}}Filterer{contract: contract}, nil
   267   	}
   268  
   269  	// bind{{.Type}} binds a generic wrapper to an already deployed contract.
   270  	func bind{{.Type}}(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
   271  	  parsed, err := {{.Type}}MetaData.GetAbi()
   272  	  if err != nil {
   273  	    return nil, err
   274  	  }
   275  	  return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil
   276  	}
   277  
   278  	// Call invokes the (constant) contract method with params as input values and
   279  	// sets the output to result. The result type might be a single field for simple
   280  	// returns, a slice of interfaces for anonymous returns and a struct for named
   281  	// returns.
   282  	func (_{{$contract.Type}} *{{$contract.Type}}Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
   283  		return _{{$contract.Type}}.Contract.{{$contract.Type}}Caller.contract.Call(opts, result, method, params...)
   284  	}
   285  
   286  	// Transfer initiates a plain transaction to move funds to the contract, calling
   287  	// its default method if one is available.
   288  	func (_{{$contract.Type}} *{{$contract.Type}}Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
   289  		return _{{$contract.Type}}.Contract.{{$contract.Type}}Transactor.contract.Transfer(opts)
   290  	}
   291  
   292  	// Transact invokes the (paid) contract method with params as input values.
   293  	func (_{{$contract.Type}} *{{$contract.Type}}Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
   294  		return _{{$contract.Type}}.Contract.{{$contract.Type}}Transactor.contract.Transact(opts, method, params...)
   295  	}
   296  
   297  	// Call invokes the (constant) contract method with params as input values and
   298  	// sets the output to result. The result type might be a single field for simple
   299  	// returns, a slice of interfaces for anonymous returns and a struct for named
   300  	// returns.
   301  	func (_{{$contract.Type}} *{{$contract.Type}}CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
   302  		return _{{$contract.Type}}.Contract.contract.Call(opts, result, method, params...)
   303  	}
   304  
   305  	// Transfer initiates a plain transaction to move funds to the contract, calling
   306  	// its default method if one is available.
   307  	func (_{{$contract.Type}} *{{$contract.Type}}TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
   308  		return _{{$contract.Type}}.Contract.contract.Transfer(opts)
   309  	}
   310  
   311  	// Transact invokes the (paid) contract method with params as input values.
   312  	func (_{{$contract.Type}} *{{$contract.Type}}TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
   313  		return _{{$contract.Type}}.Contract.contract.Transact(opts, method, params...)
   314  	}
   315  
   316  	{{range .Calls}}
   317  		// {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.ID}}.
   318  		//
   319  		// Solidity: {{.Original.String}}
   320  		func (_{{$contract.Type}} *{{$contract.Type}}Caller) {{.Normalized.Name}}(opts *bind.CallOpts {{range .Normalized.Inputs}}, {{.Name}} {{bindtype .Type $structs}} {{end}}) ({{if .Structured}}struct{ {{range .Normalized.Outputs}}{{.Name}} {{bindtype .Type $structs}};{{end}} },{{else}}{{range .Normalized.Outputs}}{{bindtype .Type $structs}},{{end}}{{end}} error) {
   321  			var out []interface{}
   322  			err := _{{$contract.Type}}.contract.Call(opts, &out, "{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}})
   323  			{{if .Structured}}
   324  			outstruct := new(struct{ {{range .Normalized.Outputs}} {{.Name}} {{bindtype .Type $structs}}; {{end}} })
   325  			if err != nil {
   326  				return *outstruct, err
   327  			}
   328  			{{range $i, $t := .Normalized.Outputs}}
   329  			outstruct.{{.Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}){{end}}
   330  
   331  			return *outstruct, err
   332  			{{else}}
   333  			if err != nil {
   334  				return {{range $i, $_ := .Normalized.Outputs}}*new({{bindtype .Type $structs}}), {{end}} err
   335  			}
   336  			{{range $i, $t := .Normalized.Outputs}}
   337  			out{{$i}} := *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}){{end}}
   338  
   339  			return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} err
   340  			{{end}}
   341  		}
   342  
   343  		// {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.ID}}.
   344  		//
   345  		// Solidity: {{.Original.String}}
   346  		func (_{{$contract.Type}} *{{$contract.Type}}Session) {{.Normalized.Name}}({{range $i, $_ := .Normalized.Inputs}}{{if ne $i 0}},{{end}} {{.Name}} {{bindtype .Type $structs}} {{end}}) ({{if .Structured}}struct{ {{range .Normalized.Outputs}}{{.Name}} {{bindtype .Type $structs}};{{end}} }, {{else}} {{range .Normalized.Outputs}}{{bindtype .Type $structs}},{{end}} {{end}} error) {
   347  		  return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.CallOpts {{range .Normalized.Inputs}}, {{.Name}}{{end}})
   348  		}
   349  
   350  		// {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.ID}}.
   351  		//
   352  		// Solidity: {{.Original.String}}
   353  		func (_{{$contract.Type}} *{{$contract.Type}}CallerSession) {{.Normalized.Name}}({{range $i, $_ := .Normalized.Inputs}}{{if ne $i 0}},{{end}} {{.Name}} {{bindtype .Type $structs}} {{end}}) ({{if .Structured}}struct{ {{range .Normalized.Outputs}}{{.Name}} {{bindtype .Type $structs}};{{end}} }, {{else}} {{range .Normalized.Outputs}}{{bindtype .Type $structs}},{{end}} {{end}} error) {
   354  		  return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.CallOpts {{range .Normalized.Inputs}}, {{.Name}}{{end}})
   355  		}
   356  	{{end}}
   357  
   358  	{{range .Transacts}}
   359  		// {{.Normalized.Name}} is a paid mutator transaction binding the contract method 0x{{printf "%x" .Original.ID}}.
   360  		//
   361  		// Solidity: {{.Original.String}}
   362  		func (_{{$contract.Type}} *{{$contract.Type}}Transactor) {{.Normalized.Name}}(opts *bind.TransactOpts {{range .Normalized.Inputs}}, {{.Name}} {{bindtype .Type $structs}} {{end}}) (*types.Transaction, error) {
   363  			return _{{$contract.Type}}.contract.Transact(opts, "{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}})
   364  		}
   365  
   366  		// {{.Normalized.Name}} is a paid mutator transaction binding the contract method 0x{{printf "%x" .Original.ID}}.
   367  		//
   368  		// Solidity: {{.Original.String}}
   369  		func (_{{$contract.Type}} *{{$contract.Type}}Session) {{.Normalized.Name}}({{range $i, $_ := .Normalized.Inputs}}{{if ne $i 0}},{{end}} {{.Name}} {{bindtype .Type $structs}} {{end}}) (*types.Transaction, error) {
   370  		  return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.TransactOpts {{range $i, $_ := .Normalized.Inputs}}, {{.Name}}{{end}})
   371  		}
   372  
   373  		// {{.Normalized.Name}} is a paid mutator transaction binding the contract method 0x{{printf "%x" .Original.ID}}.
   374  		//
   375  		// Solidity: {{.Original.String}}
   376  		func (_{{$contract.Type}} *{{$contract.Type}}TransactorSession) {{.Normalized.Name}}({{range $i, $_ := .Normalized.Inputs}}{{if ne $i 0}},{{end}} {{.Name}} {{bindtype .Type $structs}} {{end}}) (*types.Transaction, error) {
   377  		  return _{{$contract.Type}}.Contract.{{.Normalized.Name}}(&_{{$contract.Type}}.TransactOpts {{range $i, $_ := .Normalized.Inputs}}, {{.Name}}{{end}})
   378  		}
   379  	{{end}}
   380  
   381  	{{if .Fallback}}
   382  		// Fallback is a paid mutator transaction binding the contract fallback function.
   383  		//
   384  		// Solidity: {{.Fallback.Original.String}}
   385  		func (_{{$contract.Type}} *{{$contract.Type}}Transactor) Fallback(opts *bind.TransactOpts, calldata []byte) (*types.Transaction, error) {
   386  			return _{{$contract.Type}}.contract.RawTransact(opts, calldata)
   387  		}
   388  
   389  		// Fallback is a paid mutator transaction binding the contract fallback function.
   390  		//
   391  		// Solidity: {{.Fallback.Original.String}}
   392  		func (_{{$contract.Type}} *{{$contract.Type}}Session) Fallback(calldata []byte) (*types.Transaction, error) {
   393  		  return _{{$contract.Type}}.Contract.Fallback(&_{{$contract.Type}}.TransactOpts, calldata)
   394  		}
   395  
   396  		// Fallback is a paid mutator transaction binding the contract fallback function.
   397  		//
   398  		// Solidity: {{.Fallback.Original.String}}
   399  		func (_{{$contract.Type}} *{{$contract.Type}}TransactorSession) Fallback(calldata []byte) (*types.Transaction, error) {
   400  		  return _{{$contract.Type}}.Contract.Fallback(&_{{$contract.Type}}.TransactOpts, calldata)
   401  		}
   402  	{{end}}
   403  
   404  	{{if .Receive}}
   405  		// Receive is a paid mutator transaction binding the contract receive function.
   406  		//
   407  		// Solidity: {{.Receive.Original.String}}
   408  		func (_{{$contract.Type}} *{{$contract.Type}}Transactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) {
   409  			return _{{$contract.Type}}.contract.RawTransact(opts, nil) // calldata is disallowed for receive function
   410  		}
   411  
   412  		// Receive is a paid mutator transaction binding the contract receive function.
   413  		//
   414  		// Solidity: {{.Receive.Original.String}}
   415  		func (_{{$contract.Type}} *{{$contract.Type}}Session) Receive() (*types.Transaction, error) {
   416  		  return _{{$contract.Type}}.Contract.Receive(&_{{$contract.Type}}.TransactOpts)
   417  		}
   418  
   419  		// Receive is a paid mutator transaction binding the contract receive function.
   420  		//
   421  		// Solidity: {{.Receive.Original.String}}
   422  		func (_{{$contract.Type}} *{{$contract.Type}}TransactorSession) Receive() (*types.Transaction, error) {
   423  		  return _{{$contract.Type}}.Contract.Receive(&_{{$contract.Type}}.TransactOpts)
   424  		}
   425  	{{end}}
   426  
   427  	{{range .Events}}
   428  		// {{$contract.Type}}{{.Normalized.Name}}Iterator is returned from Filter{{.Normalized.Name}} and is used to iterate over the raw logs and unpacked data for {{.Normalized.Name}} events raised by the {{$contract.Type}} contract.
   429  		type {{$contract.Type}}{{.Normalized.Name}}Iterator struct {
   430  			Event *{{$contract.Type}}{{.Normalized.Name}} // Event containing the contract specifics and raw log
   431  
   432  			contract *bind.BoundContract // Generic contract to use for unpacking event data
   433  			event    string              // Event name to use for unpacking event data
   434  
   435  			logs chan types.Log        // Log channel receiving the found contract events
   436  			sub  zond.Subscription // Subscription for errors, completion and termination
   437  			done bool                  // Whether the subscription completed delivering logs
   438  			fail error                 // Occurred error to stop iteration
   439  		}
   440  		// Next advances the iterator to the subsequent event, returning whether there
   441  		// are any more events found. In case of a retrieval or parsing error, false is
   442  		// returned and Error() can be queried for the exact failure.
   443  		func (it *{{$contract.Type}}{{.Normalized.Name}}Iterator) Next() bool {
   444  			// If the iterator failed, stop iterating
   445  			if (it.fail != nil) {
   446  				return false
   447  			}
   448  			// If the iterator completed, deliver directly whatever's available
   449  			if (it.done) {
   450  				select {
   451  				case log := <-it.logs:
   452  					it.Event = new({{$contract.Type}}{{.Normalized.Name}})
   453  					if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
   454  						it.fail = err
   455  						return false
   456  					}
   457  					it.Event.Raw = log
   458  					return true
   459  
   460  				default:
   461  					return false
   462  				}
   463  			}
   464  			// Iterator still in progress, wait for either a data or an error event
   465  			select {
   466  			case log := <-it.logs:
   467  				it.Event = new({{$contract.Type}}{{.Normalized.Name}})
   468  				if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
   469  					it.fail = err
   470  					return false
   471  				}
   472  				it.Event.Raw = log
   473  				return true
   474  
   475  			case err := <-it.sub.Err():
   476  				it.done = true
   477  				it.fail = err
   478  				return it.Next()
   479  			}
   480  		}
   481  		// Error returns any retrieval or parsing error occurred during filtering.
   482  		func (it *{{$contract.Type}}{{.Normalized.Name}}Iterator) Error() error {
   483  			return it.fail
   484  		}
   485  		// Close terminates the iteration process, releasing any pending underlying
   486  		// resources.
   487  		func (it *{{$contract.Type}}{{.Normalized.Name}}Iterator) Close() error {
   488  			it.sub.Unsubscribe()
   489  			return nil
   490  		}
   491  
   492  		// {{$contract.Type}}{{.Normalized.Name}} represents a {{.Normalized.Name}} event raised by the {{$contract.Type}} contract.
   493  		type {{$contract.Type}}{{.Normalized.Name}} struct { {{range .Normalized.Inputs}}
   494  			{{capitalise .Name}} {{if .Indexed}}{{bindtopictype .Type $structs}}{{else}}{{bindtype .Type $structs}}{{end}}; {{end}}
   495  			Raw types.Log // Blockchain specific contextual infos
   496  		}
   497  
   498  		// Filter{{.Normalized.Name}} is a free log retrieval operation binding the contract event 0x{{printf "%x" .Original.ID}}.
   499  		//
   500  		// Solidity: {{.Original.String}}
   501   		func (_{{$contract.Type}} *{{$contract.Type}}Filterer) Filter{{.Normalized.Name}}(opts *bind.FilterOpts{{range .Normalized.Inputs}}{{if .Indexed}}, {{.Name}} []{{bindtype .Type $structs}}{{end}}{{end}}) (*{{$contract.Type}}{{.Normalized.Name}}Iterator, error) {
   502  			{{range .Normalized.Inputs}}
   503  			{{if .Indexed}}var {{.Name}}Rule []interface{}
   504  			for _, {{.Name}}Item := range {{.Name}} {
   505  				{{.Name}}Rule = append({{.Name}}Rule, {{.Name}}Item)
   506  			}{{end}}{{end}}
   507  
   508  			logs, sub, err := _{{$contract.Type}}.contract.FilterLogs(opts, "{{.Original.Name}}"{{range .Normalized.Inputs}}{{if .Indexed}}, {{.Name}}Rule{{end}}{{end}})
   509  			if err != nil {
   510  				return nil, err
   511  			}
   512  			return &{{$contract.Type}}{{.Normalized.Name}}Iterator{contract: _{{$contract.Type}}.contract, event: "{{.Original.Name}}", logs: logs, sub: sub}, nil
   513   		}
   514  
   515  		// Watch{{.Normalized.Name}} is a free log subscription operation binding the contract event 0x{{printf "%x" .Original.ID}}.
   516  		//
   517  		// Solidity: {{.Original.String}}
   518  		func (_{{$contract.Type}} *{{$contract.Type}}Filterer) Watch{{.Normalized.Name}}(opts *bind.WatchOpts, sink chan<- *{{$contract.Type}}{{.Normalized.Name}}{{range .Normalized.Inputs}}{{if .Indexed}}, {{.Name}} []{{bindtype .Type $structs}}{{end}}{{end}}) (event.Subscription, error) {
   519  			{{range .Normalized.Inputs}}
   520  			{{if .Indexed}}var {{.Name}}Rule []interface{}
   521  			for _, {{.Name}}Item := range {{.Name}} {
   522  				{{.Name}}Rule = append({{.Name}}Rule, {{.Name}}Item)
   523  			}{{end}}{{end}}
   524  
   525  			logs, sub, err := _{{$contract.Type}}.contract.WatchLogs(opts, "{{.Original.Name}}"{{range .Normalized.Inputs}}{{if .Indexed}}, {{.Name}}Rule{{end}}{{end}})
   526  			if err != nil {
   527  				return nil, err
   528  			}
   529  			return event.NewSubscription(func(quit <-chan struct{}) error {
   530  				defer sub.Unsubscribe()
   531  				for {
   532  					select {
   533  					case log := <-logs:
   534  						// New log arrived, parse the event and forward to the user
   535  						event := new({{$contract.Type}}{{.Normalized.Name}})
   536  						if err := _{{$contract.Type}}.contract.UnpackLog(event, "{{.Original.Name}}", log); err != nil {
   537  							return err
   538  						}
   539  						event.Raw = log
   540  
   541  						select {
   542  						case sink <- event:
   543  						case err := <-sub.Err():
   544  							return err
   545  						case <-quit:
   546  							return nil
   547  						}
   548  					case err := <-sub.Err():
   549  						return err
   550  					case <-quit:
   551  						return nil
   552  					}
   553  				}
   554  			}), nil
   555  		}
   556  
   557  		// Parse{{.Normalized.Name}} is a log parse operation binding the contract event 0x{{printf "%x" .Original.ID}}.
   558  		//
   559  		// Solidity: {{.Original.String}}
   560  		func (_{{$contract.Type}} *{{$contract.Type}}Filterer) Parse{{.Normalized.Name}}(log types.Log) (*{{$contract.Type}}{{.Normalized.Name}}, error) {
   561  			event := new({{$contract.Type}}{{.Normalized.Name}})
   562  			if err := _{{$contract.Type}}.contract.UnpackLog(event, "{{.Original.Name}}", log); err != nil {
   563  				return nil, err
   564  			}
   565  			event.Raw = log
   566  			return event, nil
   567  		}
   568  
   569   	{{end}}
   570  {{end}}
   571  `