github.com/ethereum/go-ethereum@v1.16.1/accounts/abi/bind/v2/internal/contracts/db/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 db
     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  // DBStats is an auto generated low-level Go binding around an user-defined struct.
    28  type DBStats struct {
    29  	Gets    *big.Int
    30  	Inserts *big.Int
    31  	Mods    *big.Int
    32  }
    33  
    34  // DBMetaData contains all meta data concerning the DB contract.
    35  var DBMetaData = bind.MetaData{
    36  	ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"key\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"Insert\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"key\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"KeyedInsert\",\"type\":\"event\"},{\"stateMutability\":\"nonpayable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"k\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNamedStatParams\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gets\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"inserts\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"mods\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStatParams\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStatsStruct\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"gets\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"inserts\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"mods\",\"type\":\"uint256\"}],\"internalType\":\"structDB.Stats\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"k\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"v\",\"type\":\"uint256\"}],\"name\":\"insert\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]",
    37  	ID:  "253cc2574e2f8b5e909644530e4934f6ac",
    38  	Bin: "0x60806040525f5f553480156011575f5ffd5b5060405180606001604052805f81526020015f81526020015f81525060035f820151815f015560208201518160010155604082015181600201559050506105f78061005b5f395ff3fe60806040526004361061004d575f3560e01c80631d834a1b146100cb5780636fcb9c70146101075780639507d39a14610133578063e369ba3b1461016f578063ee8161e01461019b5761006a565b3661006a57345f5f82825461006291906103eb565b925050819055005b348015610075575f5ffd5b505f36606082828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050509050915050805190602001f35b3480156100d6575f5ffd5b506100f160048036038101906100ec919061044c565b6101c5565b6040516100fe9190610499565b60405180910390f35b348015610112575f5ffd5b5061011b6102ef565b60405161012a939291906104b2565b60405180910390f35b34801561013e575f5ffd5b50610159600480360381019061015491906104e7565b61030e565b6040516101669190610499565b60405180910390f35b34801561017a575f5ffd5b50610183610341565b604051610192939291906104b2565b60405180910390f35b3480156101a6575f5ffd5b506101af610360565b6040516101bc9190610561565b60405180910390f35b5f5f82036101da5760028054905090506102e9565b5f60015f8581526020019081526020015f20540361023757600283908060018154018082558091505060019003905f5260205f20015f909190919091505560036001015f81548092919061022d9061057a565b9190505550610252565b60036002015f81548092919061024c9061057a565b91905055505b8160015f8581526020019081526020015f20819055507f8b39ff47dca36ab5b8b80845238af53aa579625ac7fb173dc09376adada4176983836002805490506040516102a0939291906104b2565b60405180910390a1827f40bed843c6c5f72002f9b469cf4c1ee9f7fb1eb48f091c1267970f98522ac02d836040516102d89190610499565b60405180910390a260028054905090505b92915050565b5f5f5f60035f0154600360010154600360020154925092509250909192565b5f60035f015f8154809291906103239061057a565b919050555060015f8381526020019081526020015f20549050919050565b5f5f5f60035f0154600360010154600360020154925092509250909192565b610368610397565b60036040518060600160405290815f820154815260200160018201548152602001600282015481525050905090565b60405180606001604052805f81526020015f81526020015f81525090565b5f819050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6103f5826103b5565b9150610400836103b5565b9250828201905080821115610418576104176103be565b5b92915050565b5f5ffd5b61042b816103b5565b8114610435575f5ffd5b50565b5f8135905061044681610422565b92915050565b5f5f604083850312156104625761046161041e565b5b5f61046f85828601610438565b925050602061048085828601610438565b9150509250929050565b610493816103b5565b82525050565b5f6020820190506104ac5f83018461048a565b92915050565b5f6060820190506104c55f83018661048a565b6104d2602083018561048a565b6104df604083018461048a565b949350505050565b5f602082840312156104fc576104fb61041e565b5b5f61050984828501610438565b91505092915050565b61051b816103b5565b82525050565b606082015f8201516105355f850182610512565b5060208201516105486020850182610512565b50604082015161055b6040850182610512565b50505050565b5f6060820190506105745f830184610521565b92915050565b5f610584826103b5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036105b6576105b56103be565b5b60018201905091905056fea264697066735822122063e58431f2afdc667f8e687d3e6a99085a93c1fd3ce40b218463b8ddd3cc093664736f6c634300081c0033",
    39  }
    40  
    41  // DB is an auto generated Go binding around an Ethereum contract.
    42  type DB struct {
    43  	abi abi.ABI
    44  }
    45  
    46  // NewDB creates a new instance of DB.
    47  func NewDB() *DB {
    48  	parsed, err := DBMetaData.ParseABI()
    49  	if err != nil {
    50  		panic(errors.New("invalid ABI: " + err.Error()))
    51  	}
    52  	return &DB{abi: *parsed}
    53  }
    54  
    55  // Instance creates a wrapper for a deployed contract instance at the given address.
    56  // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
    57  func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
    58  	return bind.NewBoundContract(addr, c.abi, backend, backend, backend)
    59  }
    60  
    61  // PackGet is the Go binding used to pack the parameters required for calling
    62  // the contract method with ID 0x9507d39a.  This method will panic if any
    63  // invalid/nil inputs are passed.
    64  //
    65  // Solidity: function get(uint256 k) returns(uint256)
    66  func (dB *DB) PackGet(k *big.Int) []byte {
    67  	enc, err := dB.abi.Pack("get", k)
    68  	if err != nil {
    69  		panic(err)
    70  	}
    71  	return enc
    72  }
    73  
    74  // TryPackGet is the Go binding used to pack the parameters required for calling
    75  // the contract method with ID 0x9507d39a.  This method will return an error
    76  // if any inputs are invalid/nil.
    77  //
    78  // Solidity: function get(uint256 k) returns(uint256)
    79  func (dB *DB) TryPackGet(k *big.Int) ([]byte, error) {
    80  	return dB.abi.Pack("get", k)
    81  }
    82  
    83  // UnpackGet is the Go binding that unpacks the parameters returned
    84  // from invoking the contract method with ID 0x9507d39a.
    85  //
    86  // Solidity: function get(uint256 k) returns(uint256)
    87  func (dB *DB) UnpackGet(data []byte) (*big.Int, error) {
    88  	out, err := dB.abi.Unpack("get", data)
    89  	if err != nil {
    90  		return new(big.Int), err
    91  	}
    92  	out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
    93  	return out0, nil
    94  }
    95  
    96  // PackGetNamedStatParams is the Go binding used to pack the parameters required for calling
    97  // the contract method with ID 0xe369ba3b.  This method will panic if any
    98  // invalid/nil inputs are passed.
    99  //
   100  // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods)
   101  func (dB *DB) PackGetNamedStatParams() []byte {
   102  	enc, err := dB.abi.Pack("getNamedStatParams")
   103  	if err != nil {
   104  		panic(err)
   105  	}
   106  	return enc
   107  }
   108  
   109  // TryPackGetNamedStatParams is the Go binding used to pack the parameters required for calling
   110  // the contract method with ID 0xe369ba3b.  This method will return an error
   111  // if any inputs are invalid/nil.
   112  //
   113  // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods)
   114  func (dB *DB) TryPackGetNamedStatParams() ([]byte, error) {
   115  	return dB.abi.Pack("getNamedStatParams")
   116  }
   117  
   118  // GetNamedStatParamsOutput serves as a container for the return parameters of contract
   119  // method GetNamedStatParams.
   120  type GetNamedStatParamsOutput struct {
   121  	Gets    *big.Int
   122  	Inserts *big.Int
   123  	Mods    *big.Int
   124  }
   125  
   126  // UnpackGetNamedStatParams is the Go binding that unpacks the parameters returned
   127  // from invoking the contract method with ID 0xe369ba3b.
   128  //
   129  // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods)
   130  func (dB *DB) UnpackGetNamedStatParams(data []byte) (GetNamedStatParamsOutput, error) {
   131  	out, err := dB.abi.Unpack("getNamedStatParams", data)
   132  	outstruct := new(GetNamedStatParamsOutput)
   133  	if err != nil {
   134  		return *outstruct, err
   135  	}
   136  	outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
   137  	outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
   138  	outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int)
   139  	return *outstruct, nil
   140  }
   141  
   142  // PackGetStatParams is the Go binding used to pack the parameters required for calling
   143  // the contract method with ID 0x6fcb9c70.  This method will panic if any
   144  // invalid/nil inputs are passed.
   145  //
   146  // Solidity: function getStatParams() view returns(uint256, uint256, uint256)
   147  func (dB *DB) PackGetStatParams() []byte {
   148  	enc, err := dB.abi.Pack("getStatParams")
   149  	if err != nil {
   150  		panic(err)
   151  	}
   152  	return enc
   153  }
   154  
   155  // TryPackGetStatParams is the Go binding used to pack the parameters required for calling
   156  // the contract method with ID 0x6fcb9c70.  This method will return an error
   157  // if any inputs are invalid/nil.
   158  //
   159  // Solidity: function getStatParams() view returns(uint256, uint256, uint256)
   160  func (dB *DB) TryPackGetStatParams() ([]byte, error) {
   161  	return dB.abi.Pack("getStatParams")
   162  }
   163  
   164  // GetStatParamsOutput serves as a container for the return parameters of contract
   165  // method GetStatParams.
   166  type GetStatParamsOutput struct {
   167  	Arg0 *big.Int
   168  	Arg1 *big.Int
   169  	Arg2 *big.Int
   170  }
   171  
   172  // UnpackGetStatParams is the Go binding that unpacks the parameters returned
   173  // from invoking the contract method with ID 0x6fcb9c70.
   174  //
   175  // Solidity: function getStatParams() view returns(uint256, uint256, uint256)
   176  func (dB *DB) UnpackGetStatParams(data []byte) (GetStatParamsOutput, error) {
   177  	out, err := dB.abi.Unpack("getStatParams", data)
   178  	outstruct := new(GetStatParamsOutput)
   179  	if err != nil {
   180  		return *outstruct, err
   181  	}
   182  	outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
   183  	outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
   184  	outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int)
   185  	return *outstruct, nil
   186  }
   187  
   188  // PackGetStatsStruct is the Go binding used to pack the parameters required for calling
   189  // the contract method with ID 0xee8161e0.  This method will panic if any
   190  // invalid/nil inputs are passed.
   191  //
   192  // Solidity: function getStatsStruct() view returns((uint256,uint256,uint256))
   193  func (dB *DB) PackGetStatsStruct() []byte {
   194  	enc, err := dB.abi.Pack("getStatsStruct")
   195  	if err != nil {
   196  		panic(err)
   197  	}
   198  	return enc
   199  }
   200  
   201  // TryPackGetStatsStruct is the Go binding used to pack the parameters required for calling
   202  // the contract method with ID 0xee8161e0.  This method will return an error
   203  // if any inputs are invalid/nil.
   204  //
   205  // Solidity: function getStatsStruct() view returns((uint256,uint256,uint256))
   206  func (dB *DB) TryPackGetStatsStruct() ([]byte, error) {
   207  	return dB.abi.Pack("getStatsStruct")
   208  }
   209  
   210  // UnpackGetStatsStruct is the Go binding that unpacks the parameters returned
   211  // from invoking the contract method with ID 0xee8161e0.
   212  //
   213  // Solidity: function getStatsStruct() view returns((uint256,uint256,uint256))
   214  func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) {
   215  	out, err := dB.abi.Unpack("getStatsStruct", data)
   216  	if err != nil {
   217  		return *new(DBStats), err
   218  	}
   219  	out0 := *abi.ConvertType(out[0], new(DBStats)).(*DBStats)
   220  	return out0, nil
   221  }
   222  
   223  // PackInsert is the Go binding used to pack the parameters required for calling
   224  // the contract method with ID 0x1d834a1b.  This method will panic if any
   225  // invalid/nil inputs are passed.
   226  //
   227  // Solidity: function insert(uint256 k, uint256 v) returns(uint256)
   228  func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte {
   229  	enc, err := dB.abi.Pack("insert", k, v)
   230  	if err != nil {
   231  		panic(err)
   232  	}
   233  	return enc
   234  }
   235  
   236  // TryPackInsert is the Go binding used to pack the parameters required for calling
   237  // the contract method with ID 0x1d834a1b.  This method will return an error
   238  // if any inputs are invalid/nil.
   239  //
   240  // Solidity: function insert(uint256 k, uint256 v) returns(uint256)
   241  func (dB *DB) TryPackInsert(k *big.Int, v *big.Int) ([]byte, error) {
   242  	return dB.abi.Pack("insert", k, v)
   243  }
   244  
   245  // UnpackInsert is the Go binding that unpacks the parameters returned
   246  // from invoking the contract method with ID 0x1d834a1b.
   247  //
   248  // Solidity: function insert(uint256 k, uint256 v) returns(uint256)
   249  func (dB *DB) UnpackInsert(data []byte) (*big.Int, error) {
   250  	out, err := dB.abi.Unpack("insert", data)
   251  	if err != nil {
   252  		return new(big.Int), err
   253  	}
   254  	out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
   255  	return out0, nil
   256  }
   257  
   258  // DBInsert represents a Insert event raised by the DB contract.
   259  type DBInsert struct {
   260  	Key    *big.Int
   261  	Value  *big.Int
   262  	Length *big.Int
   263  	Raw    *types.Log // Blockchain specific contextual infos
   264  }
   265  
   266  const DBInsertEventName = "Insert"
   267  
   268  // ContractEventName returns the user-defined event name.
   269  func (DBInsert) ContractEventName() string {
   270  	return DBInsertEventName
   271  }
   272  
   273  // UnpackInsertEvent is the Go binding that unpacks the event data emitted
   274  // by contract.
   275  //
   276  // Solidity: event Insert(uint256 key, uint256 value, uint256 length)
   277  func (dB *DB) UnpackInsertEvent(log *types.Log) (*DBInsert, error) {
   278  	event := "Insert"
   279  	if log.Topics[0] != dB.abi.Events[event].ID {
   280  		return nil, errors.New("event signature mismatch")
   281  	}
   282  	out := new(DBInsert)
   283  	if len(log.Data) > 0 {
   284  		if err := dB.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
   285  			return nil, err
   286  		}
   287  	}
   288  	var indexed abi.Arguments
   289  	for _, arg := range dB.abi.Events[event].Inputs {
   290  		if arg.Indexed {
   291  			indexed = append(indexed, arg)
   292  		}
   293  	}
   294  	if err := abi.ParseTopics(out, indexed, log.Topics[1:]); err != nil {
   295  		return nil, err
   296  	}
   297  	out.Raw = log
   298  	return out, nil
   299  }
   300  
   301  // DBKeyedInsert represents a KeyedInsert event raised by the DB contract.
   302  type DBKeyedInsert struct {
   303  	Key   *big.Int
   304  	Value *big.Int
   305  	Raw   *types.Log // Blockchain specific contextual infos
   306  }
   307  
   308  const DBKeyedInsertEventName = "KeyedInsert"
   309  
   310  // ContractEventName returns the user-defined event name.
   311  func (DBKeyedInsert) ContractEventName() string {
   312  	return DBKeyedInsertEventName
   313  }
   314  
   315  // UnpackKeyedInsertEvent is the Go binding that unpacks the event data emitted
   316  // by contract.
   317  //
   318  // Solidity: event KeyedInsert(uint256 indexed key, uint256 value)
   319  func (dB *DB) UnpackKeyedInsertEvent(log *types.Log) (*DBKeyedInsert, error) {
   320  	event := "KeyedInsert"
   321  	if log.Topics[0] != dB.abi.Events[event].ID {
   322  		return nil, errors.New("event signature mismatch")
   323  	}
   324  	out := new(DBKeyedInsert)
   325  	if len(log.Data) > 0 {
   326  		if err := dB.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
   327  			return nil, err
   328  		}
   329  	}
   330  	var indexed abi.Arguments
   331  	for _, arg := range dB.abi.Events[event].Inputs {
   332  		if arg.Indexed {
   333  			indexed = append(indexed, arg)
   334  		}
   335  	}
   336  	if err := abi.ParseTopics(out, indexed, log.Topics[1:]); err != nil {
   337  		return nil, err
   338  	}
   339  	out.Raw = log
   340  	return out, nil
   341  }