github.com/ethereum/go-ethereum@v1.16.1/accounts/abi/abigen/testdata/v2/overload.go.txt (about)

     1  // Code generated via abigen V2 - DO NOT EDIT.
     2  // This file is a generated binding and any manual changes will be lost.
     3  
     4  package bindtests
     5  
     6  import (
     7  	"bytes"
     8  	"errors"
     9  	"math/big"
    10  
    11  	"github.com/ethereum/go-ethereum/accounts/abi"
    12  	"github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
    13  	"github.com/ethereum/go-ethereum/common"
    14  	"github.com/ethereum/go-ethereum/core/types"
    15  )
    16  
    17  // Reference imports to suppress errors if they are not otherwise used.
    18  var (
    19  	_ = bytes.Equal
    20  	_ = errors.New
    21  	_ = big.NewInt
    22  	_ = common.Big1
    23  	_ = types.BloomLookup
    24  	_ = abi.ConvertType
    25  )
    26  
    27  // OverloadMetaData contains all meta data concerning the Overload contract.
    28  var OverloadMetaData = bind.MetaData{
    29  	ABI: "[{\"constant\":false,\"inputs\":[{\"name\":\"i\",\"type\":\"uint256\"},{\"name\":\"j\",\"type\":\"uint256\"}],\"name\":\"foo\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"foo\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"bar\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"i\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"j\",\"type\":\"uint256\"}],\"name\":\"bar\",\"type\":\"event\"}]",
    30  	ID:  "f49f0ff7ed407de5c37214f49309072aec",
    31  	Bin: "0x608060405234801561001057600080fd5b50610153806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806304bc52f81461003b5780632fbebd3814610073575b600080fd5b6100716004803603604081101561005157600080fd5b8101908080359060200190929190803590602001909291905050506100a1565b005b61009f6004803603602081101561008957600080fd5b81019080803590602001909291905050506100e4565b005b7fae42e9514233792a47a1e4554624e83fe852228e1503f63cd383e8a431f4f46d8282604051808381526020018281526020019250505060405180910390a15050565b7f0423a1321222a0a8716c22b92fac42d85a45a612b696a461784d9fa537c81e5c816040518082815260200191505060405180910390a15056fea265627a7a72305820e22b049858b33291cbe67eeaece0c5f64333e439d27032ea8337d08b1de18fe864736f6c634300050a0032",
    32  }
    33  
    34  // Overload is an auto generated Go binding around an Ethereum contract.
    35  type Overload struct {
    36  	abi abi.ABI
    37  }
    38  
    39  // NewOverload creates a new instance of Overload.
    40  func NewOverload() *Overload {
    41  	parsed, err := OverloadMetaData.ParseABI()
    42  	if err != nil {
    43  		panic(errors.New("invalid ABI: " + err.Error()))
    44  	}
    45  	return &Overload{abi: *parsed}
    46  }
    47  
    48  // Instance creates a wrapper for a deployed contract instance at the given address.
    49  // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
    50  func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
    51  	return bind.NewBoundContract(addr, c.abi, backend, backend, backend)
    52  }
    53  
    54  // PackFoo is the Go binding used to pack the parameters required for calling
    55  // the contract method with ID 0x04bc52f8.  This method will panic if any
    56  // invalid/nil inputs are passed.
    57  //
    58  // Solidity: function foo(uint256 i, uint256 j) returns()
    59  func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
    60  	enc, err := overload.abi.Pack("foo", i, j)
    61  	if err != nil {
    62  		panic(err)
    63  	}
    64  	return enc
    65  }
    66  
    67  // TryPackFoo is the Go binding used to pack the parameters required for calling
    68  // the contract method with ID 0x04bc52f8.  This method will return an error
    69  // if any inputs are invalid/nil.
    70  //
    71  // Solidity: function foo(uint256 i, uint256 j) returns()
    72  func (overload *Overload) TryPackFoo(i *big.Int, j *big.Int) ([]byte, error) {
    73  	return overload.abi.Pack("foo", i, j)
    74  }
    75  
    76  // PackFoo0 is the Go binding used to pack the parameters required for calling
    77  // the contract method with ID 0x2fbebd38.  This method will panic if any
    78  // invalid/nil inputs are passed.
    79  //
    80  // Solidity: function foo(uint256 i) returns()
    81  func (overload *Overload) PackFoo0(i *big.Int) []byte {
    82  	enc, err := overload.abi.Pack("foo0", i)
    83  	if err != nil {
    84  		panic(err)
    85  	}
    86  	return enc
    87  }
    88  
    89  // TryPackFoo0 is the Go binding used to pack the parameters required for calling
    90  // the contract method with ID 0x2fbebd38.  This method will return an error
    91  // if any inputs are invalid/nil.
    92  //
    93  // Solidity: function foo(uint256 i) returns()
    94  func (overload *Overload) TryPackFoo0(i *big.Int) ([]byte, error) {
    95  	return overload.abi.Pack("foo0", i)
    96  }
    97  
    98  // OverloadBar represents a bar event raised by the Overload contract.
    99  type OverloadBar struct {
   100  	I   *big.Int
   101  	Raw *types.Log // Blockchain specific contextual infos
   102  }
   103  
   104  const OverloadBarEventName = "bar"
   105  
   106  // ContractEventName returns the user-defined event name.
   107  func (OverloadBar) ContractEventName() string {
   108  	return OverloadBarEventName
   109  }
   110  
   111  // UnpackBarEvent is the Go binding that unpacks the event data emitted
   112  // by contract.
   113  //
   114  // Solidity: event bar(uint256 i)
   115  func (overload *Overload) UnpackBarEvent(log *types.Log) (*OverloadBar, error) {
   116  	event := "bar"
   117  	if log.Topics[0] != overload.abi.Events[event].ID {
   118  		return nil, errors.New("event signature mismatch")
   119  	}
   120  	out := new(OverloadBar)
   121  	if len(log.Data) > 0 {
   122  		if err := overload.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
   123  			return nil, err
   124  		}
   125  	}
   126  	var indexed abi.Arguments
   127  	for _, arg := range overload.abi.Events[event].Inputs {
   128  		if arg.Indexed {
   129  			indexed = append(indexed, arg)
   130  		}
   131  	}
   132  	if err := abi.ParseTopics(out, indexed, log.Topics[1:]); err != nil {
   133  		return nil, err
   134  	}
   135  	out.Raw = log
   136  	return out, nil
   137  }
   138  
   139  // OverloadBar0 represents a bar0 event raised by the Overload contract.
   140  type OverloadBar0 struct {
   141  	I   *big.Int
   142  	J   *big.Int
   143  	Raw *types.Log // Blockchain specific contextual infos
   144  }
   145  
   146  const OverloadBar0EventName = "bar0"
   147  
   148  // ContractEventName returns the user-defined event name.
   149  func (OverloadBar0) ContractEventName() string {
   150  	return OverloadBar0EventName
   151  }
   152  
   153  // UnpackBar0Event is the Go binding that unpacks the event data emitted
   154  // by contract.
   155  //
   156  // Solidity: event bar(uint256 i, uint256 j)
   157  func (overload *Overload) UnpackBar0Event(log *types.Log) (*OverloadBar0, error) {
   158  	event := "bar0"
   159  	if log.Topics[0] != overload.abi.Events[event].ID {
   160  		return nil, errors.New("event signature mismatch")
   161  	}
   162  	out := new(OverloadBar0)
   163  	if len(log.Data) > 0 {
   164  		if err := overload.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
   165  			return nil, err
   166  		}
   167  	}
   168  	var indexed abi.Arguments
   169  	for _, arg := range overload.abi.Events[event].Inputs {
   170  		if arg.Indexed {
   171  			indexed = append(indexed, arg)
   172  		}
   173  	}
   174  	if err := abi.ParseTopics(out, indexed, log.Topics[1:]); err != nil {
   175  		return nil, err
   176  	}
   177  	out.Raw = log
   178  	return out, nil
   179  }