github.com/ethereum/go-ethereum@v1.16.1/accounts/abi/bind/v2/internal/contracts/events/bindings.go (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 events
     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  // CMetaData contains all meta data concerning the C contract.
    28  var CMetaData = bind.MetaData{
    29  	ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"data\",\"type\":\"uint256\"}],\"name\":\"basic1\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"flag\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"data\",\"type\":\"uint256\"}],\"name\":\"basic2\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"EmitMulti\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"EmitOne\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
    30  	ID:  "55ef3c19a0ab1c1845f9e347540c1e51f5",
    31  	Bin: "0x6080604052348015600e575f5ffd5b506101a08061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610034575f3560e01c8063cb49374914610038578063e8e49a7114610042575b5f5ffd5b61004061004c565b005b61004a6100fd565b005b60017f8f17dc823e2f9fcdf730b8182c935574691e811e7d46399fe0ff0087795cd207600260405161007e9190610151565b60405180910390a260037f8f17dc823e2f9fcdf730b8182c935574691e811e7d46399fe0ff0087795cd20760046040516100b89190610151565b60405180910390a25f15157f3b29b9f6d15ba80d866afb3d70b7548ab1ffda3ef6e65f35f1cb05b0e2b29f4e60016040516100f39190610151565b60405180910390a2565b60017f8f17dc823e2f9fcdf730b8182c935574691e811e7d46399fe0ff0087795cd207600260405161012f9190610151565b60405180910390a2565b5f819050919050565b61014b81610139565b82525050565b5f6020820190506101645f830184610142565b9291505056fea26469706673582212207331c79de16a73a1639c4c4b3489ea78a3ed35fe62a178824f586df12672ac0564736f6c634300081c0033",
    32  }
    33  
    34  // C is an auto generated Go binding around an Ethereum contract.
    35  type C struct {
    36  	abi abi.ABI
    37  }
    38  
    39  // NewC creates a new instance of C.
    40  func NewC() *C {
    41  	parsed, err := CMetaData.ParseABI()
    42  	if err != nil {
    43  		panic(errors.New("invalid ABI: " + err.Error()))
    44  	}
    45  	return &C{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 *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
    51  	return bind.NewBoundContract(addr, c.abi, backend, backend, backend)
    52  }
    53  
    54  // PackEmitMulti is the Go binding used to pack the parameters required for calling
    55  // the contract method with ID 0xcb493749.  This method will panic if any
    56  // invalid/nil inputs are passed.
    57  //
    58  // Solidity: function EmitMulti() returns()
    59  func (c *C) PackEmitMulti() []byte {
    60  	enc, err := c.abi.Pack("EmitMulti")
    61  	if err != nil {
    62  		panic(err)
    63  	}
    64  	return enc
    65  }
    66  
    67  // TryPackEmitMulti is the Go binding used to pack the parameters required for calling
    68  // the contract method with ID 0xcb493749.  This method will return an error
    69  // if any inputs are invalid/nil.
    70  //
    71  // Solidity: function EmitMulti() returns()
    72  func (c *C) TryPackEmitMulti() ([]byte, error) {
    73  	return c.abi.Pack("EmitMulti")
    74  }
    75  
    76  // PackEmitOne is the Go binding used to pack the parameters required for calling
    77  // the contract method with ID 0xe8e49a71.  This method will panic if any
    78  // invalid/nil inputs are passed.
    79  //
    80  // Solidity: function EmitOne() returns()
    81  func (c *C) PackEmitOne() []byte {
    82  	enc, err := c.abi.Pack("EmitOne")
    83  	if err != nil {
    84  		panic(err)
    85  	}
    86  	return enc
    87  }
    88  
    89  // TryPackEmitOne is the Go binding used to pack the parameters required for calling
    90  // the contract method with ID 0xe8e49a71.  This method will return an error
    91  // if any inputs are invalid/nil.
    92  //
    93  // Solidity: function EmitOne() returns()
    94  func (c *C) TryPackEmitOne() ([]byte, error) {
    95  	return c.abi.Pack("EmitOne")
    96  }
    97  
    98  // CBasic1 represents a basic1 event raised by the C contract.
    99  type CBasic1 struct {
   100  	Id   *big.Int
   101  	Data *big.Int
   102  	Raw  *types.Log // Blockchain specific contextual infos
   103  }
   104  
   105  const CBasic1EventName = "basic1"
   106  
   107  // ContractEventName returns the user-defined event name.
   108  func (CBasic1) ContractEventName() string {
   109  	return CBasic1EventName
   110  }
   111  
   112  // UnpackBasic1Event is the Go binding that unpacks the event data emitted
   113  // by contract.
   114  //
   115  // Solidity: event basic1(uint256 indexed id, uint256 data)
   116  func (c *C) UnpackBasic1Event(log *types.Log) (*CBasic1, error) {
   117  	event := "basic1"
   118  	if log.Topics[0] != c.abi.Events[event].ID {
   119  		return nil, errors.New("event signature mismatch")
   120  	}
   121  	out := new(CBasic1)
   122  	if len(log.Data) > 0 {
   123  		if err := c.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
   124  			return nil, err
   125  		}
   126  	}
   127  	var indexed abi.Arguments
   128  	for _, arg := range c.abi.Events[event].Inputs {
   129  		if arg.Indexed {
   130  			indexed = append(indexed, arg)
   131  		}
   132  	}
   133  	if err := abi.ParseTopics(out, indexed, log.Topics[1:]); err != nil {
   134  		return nil, err
   135  	}
   136  	out.Raw = log
   137  	return out, nil
   138  }
   139  
   140  // CBasic2 represents a basic2 event raised by the C contract.
   141  type CBasic2 struct {
   142  	Flag bool
   143  	Data *big.Int
   144  	Raw  *types.Log // Blockchain specific contextual infos
   145  }
   146  
   147  const CBasic2EventName = "basic2"
   148  
   149  // ContractEventName returns the user-defined event name.
   150  func (CBasic2) ContractEventName() string {
   151  	return CBasic2EventName
   152  }
   153  
   154  // UnpackBasic2Event is the Go binding that unpacks the event data emitted
   155  // by contract.
   156  //
   157  // Solidity: event basic2(bool indexed flag, uint256 data)
   158  func (c *C) UnpackBasic2Event(log *types.Log) (*CBasic2, error) {
   159  	event := "basic2"
   160  	if log.Topics[0] != c.abi.Events[event].ID {
   161  		return nil, errors.New("event signature mismatch")
   162  	}
   163  	out := new(CBasic2)
   164  	if len(log.Data) > 0 {
   165  		if err := c.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
   166  			return nil, err
   167  		}
   168  	}
   169  	var indexed abi.Arguments
   170  	for _, arg := range c.abi.Events[event].Inputs {
   171  		if arg.Indexed {
   172  			indexed = append(indexed, arg)
   173  		}
   174  	}
   175  	if err := abi.ParseTopics(out, indexed, log.Topics[1:]); err != nil {
   176  		return nil, err
   177  	}
   178  	out.Raw = log
   179  	return out, nil
   180  }