// Code generated by abigen. DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.

package contracts

import (
	"fmt"
	"math/big"
	"reflect"
	"strings"

	"github.com/erigontech/erigon/common"
	"github.com/erigontech/erigon/common/event"
	"github.com/erigontech/erigon/execution/abi"
	"github.com/erigontech/erigon/execution/abi/bind"
	"github.com/erigontech/erigon/execution/types"
)

// Reference imports to suppress errors if they are not otherwise used.
var (
	_ = big.NewInt
	_ = strings.NewReader
	_ = bind.Bind
	_ = common.Big1
	_ = types.BloomLookup
	_ = event.NewSubscription
	_ = fmt.Errorf
	_ = reflect.ValueOf
)

// StateChurnABI is the input ABI used to generate the binding from.
const StateChurnABI = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"check\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"computedSum\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sum\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cursor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"seed\",\"type\":\"uint256\"}],\"name\":\"poke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"trackedSum\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"

// StateChurnBin is the compiled bytecode used for deploying new contracts.
var StateChurnBin = "0x6080604052348015600e575f5ffd5b505f5b6010811015606a576040516939ba30ba32b1b43ab93760b11b6020820152602a8101829052604a01604051602081830303815290604052805190602001205f1c600182601081106061576061606f565b01556001016011565b506083565b634e487b7160e01b5f52603260045260245ffd5b610301806100905f395ff3fe608060405234801561000f575f5ffd5b5060043610610055575f3560e01c806332145f901461005957806336a0b9ef1461006e5780638c4262da1461008a578063919840ad146100925780639dc4dbfa146100aa575b5f5ffd5b61006c610067366004610229565b6100b3565b005b61007760115481565b6040519081526020015b60405180910390f35b6100776101cd565b61009a610217565b6040519015158152602001610081565b61007760125481565b5f600160106011546100c59190610240565b601081106100d5576100d561025f565b015490505f6003836011546040516020016100fa929190918252602082015260400190565b604051602081830303815290604052805190602001205f1c61011c9190610240565b5f83815260208190526040902054601254919250829161013c9190610287565b61014691906102a0565b6012555f8281526020819052604081208290556011805491610167836102b3565b91905055506012546101776101cd565b146101c85760405162461bcd60e51b815260206004820152601860248201527f5374617465436875726e3a2073756d206d69736d617463680000000000000000604482015260640160405180910390fd5b505050565b5f805b6010811015610213575f5f600183601081106101ee576101ee61025f565b015481526020019081526020015f20548261020991906102a0565b91506001016101d0565b5090565b5f6012546102236101cd565b14905090565b5f60208284031215610239575f5ffd5b5035919050565b5f8261025a57634e487b7160e01b5f52601260045260245ffd5b500690565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8181038181111561029a5761029a610273565b92915050565b8082018082111561029a5761029a610273565b5f600182016102c4576102c4610273565b506001019056fea2646970667358221220a309ee836c06941909f00f9825c9a3437e469a237d8cfd22f6886f60cd90d7ab64736f6c634300081d0033"

// DeployStateChurn deploys a new Ethereum contract, binding an instance of StateChurn to it.
func DeployStateChurn(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, types.Transaction, *StateChurn, error) {
	parsed, err := abi.JSON(strings.NewReader(StateChurnABI))
	if err != nil {
		return common.Address{}, nil, nil, err
	}

	address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(StateChurnBin), backend)
	if err != nil {
		return common.Address{}, nil, nil, err
	}
	return address, tx, &StateChurn{StateChurnCaller: StateChurnCaller{contract: contract}, StateChurnTransactor: StateChurnTransactor{contract: contract}, StateChurnFilterer: StateChurnFilterer{contract: contract}}, nil
}

// StateChurn is an auto generated Go binding around an Ethereum contract.
type StateChurn struct {
	StateChurnCaller     // Read-only binding to the contract
	StateChurnTransactor // Write-only binding to the contract
	StateChurnFilterer   // Log filterer for contract events
}

// StateChurnCaller is an auto generated read-only Go binding around an Ethereum contract.
type StateChurnCaller struct {
	contract *bind.BoundContract // Generic contract wrapper for the low level calls
}

// StateChurnTransactor is an auto generated write-only Go binding around an Ethereum contract.
type StateChurnTransactor struct {
	contract *bind.BoundContract // Generic contract wrapper for the low level calls
}

// StateChurnFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type StateChurnFilterer struct {
	contract *bind.BoundContract // Generic contract wrapper for the low level calls
}

// StateChurnSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type StateChurnSession struct {
	Contract     *StateChurn       // Generic contract binding to set the session for
	CallOpts     bind.CallOpts     // Call options to use throughout this session
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

// StateChurnCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type StateChurnCallerSession struct {
	Contract *StateChurnCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts     // Call options to use throughout this session
}

// StateChurnTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type StateChurnTransactorSession struct {
	Contract     *StateChurnTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts     // Transaction auth options to use throughout this session
}

// StateChurnRaw is an auto generated low-level Go binding around an Ethereum contract.
type StateChurnRaw struct {
	Contract *StateChurn // Generic contract binding to access the raw methods on
}

// StateChurnCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type StateChurnCallerRaw struct {
	Contract *StateChurnCaller // Generic read-only contract binding to access the raw methods on
}

// StateChurnTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type StateChurnTransactorRaw struct {
	Contract *StateChurnTransactor // Generic write-only contract binding to access the raw methods on
}

// NewStateChurn creates a new instance of StateChurn, bound to a specific deployed contract.
func NewStateChurn(address common.Address, backend bind.ContractBackend) (*StateChurn, error) {
	contract, err := bindStateChurn(address, backend, backend, backend)
	if err != nil {
		return nil, err
	}
	return &StateChurn{StateChurnCaller: StateChurnCaller{contract: contract}, StateChurnTransactor: StateChurnTransactor{contract: contract}, StateChurnFilterer: StateChurnFilterer{contract: contract}}, nil
}

// NewStateChurnCaller creates a new read-only instance of StateChurn, bound to a specific deployed contract.
func NewStateChurnCaller(address common.Address, caller bind.ContractCaller) (*StateChurnCaller, error) {
	contract, err := bindStateChurn(address, caller, nil, nil)
	if err != nil {
		return nil, err
	}
	return &StateChurnCaller{contract: contract}, nil
}

// NewStateChurnTransactor creates a new write-only instance of StateChurn, bound to a specific deployed contract.
func NewStateChurnTransactor(address common.Address, transactor bind.ContractTransactor) (*StateChurnTransactor, error) {
	contract, err := bindStateChurn(address, nil, transactor, nil)
	if err != nil {
		return nil, err
	}
	return &StateChurnTransactor{contract: contract}, nil
}

// NewStateChurnFilterer creates a new log filterer instance of StateChurn, bound to a specific deployed contract.
func NewStateChurnFilterer(address common.Address, filterer bind.ContractFilterer) (*StateChurnFilterer, error) {
	contract, err := bindStateChurn(address, nil, nil, filterer)
	if err != nil {
		return nil, err
	}
	return &StateChurnFilterer{contract: contract}, nil
}

// bindStateChurn binds a generic wrapper to an already deployed contract.
func bindStateChurn(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
	parsed, err := abi.JSON(strings.NewReader(StateChurnABI))
	if err != nil {
		return nil, err
	}
	return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
}

// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_StateChurn *StateChurnRaw) Call(opts *bind.CallOpts, result *[]any, method string, params ...any) error {
	return _StateChurn.Contract.StateChurnCaller.contract.Call(opts, result, method, params...)
}

// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_StateChurn *StateChurnRaw) Transfer(opts *bind.TransactOpts) (types.Transaction, error) {
	return _StateChurn.Contract.StateChurnTransactor.contract.Transfer(opts)
}

// Transact invokes the (paid) contract method with params as input values.
func (_StateChurn *StateChurnRaw) Transact(opts *bind.TransactOpts, method string, params ...any) (types.Transaction, error) {
	return _StateChurn.Contract.StateChurnTransactor.contract.Transact(opts, method, params...)
}

// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_StateChurn *StateChurnCallerRaw) Call(opts *bind.CallOpts, result *[]any, method string, params ...any) error {
	return _StateChurn.Contract.contract.Call(opts, result, method, params...)
}

// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_StateChurn *StateChurnTransactorRaw) Transfer(opts *bind.TransactOpts) (types.Transaction, error) {
	return _StateChurn.Contract.contract.Transfer(opts)
}

// Transact invokes the (paid) contract method with params as input values.
func (_StateChurn *StateChurnTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...any) (types.Transaction, error) {
	return _StateChurn.Contract.contract.Transact(opts, method, params...)
}

// Check is a free data retrieval call binding the contract method 0x919840ad.
//
// Solidity: function check() view returns(bool)
func (_StateChurn *StateChurnCaller) Check(opts *bind.CallOpts) (bool, error) {
	var out []any
	err := _StateChurn.contract.Call(opts, &out, "check")

	if err != nil {
		return *new(bool), err
	}

	out0 := *abi.ConvertType(out[0], new(bool)).(*bool)

	return out0, err

}

// Check is a free data retrieval call binding the contract method 0x919840ad.
//
// Solidity: function check() view returns(bool)
func (_StateChurn *StateChurnSession) Check() (bool, error) {
	return _StateChurn.Contract.Check(&_StateChurn.CallOpts)
}

// Check is a free data retrieval call binding the contract method 0x919840ad.
//
// Solidity: function check() view returns(bool)
func (_StateChurn *StateChurnCallerSession) Check() (bool, error) {
	return _StateChurn.Contract.Check(&_StateChurn.CallOpts)
}

// ComputedSum is a free data retrieval call binding the contract method 0x8c4262da.
//
// Solidity: function computedSum() view returns(uint256 sum)
func (_StateChurn *StateChurnCaller) ComputedSum(opts *bind.CallOpts) (*big.Int, error) {
	var out []any
	err := _StateChurn.contract.Call(opts, &out, "computedSum")

	if err != nil {
		return *new(*big.Int), err
	}

	out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)

	return out0, err

}

// ComputedSum is a free data retrieval call binding the contract method 0x8c4262da.
//
// Solidity: function computedSum() view returns(uint256 sum)
func (_StateChurn *StateChurnSession) ComputedSum() (*big.Int, error) {
	return _StateChurn.Contract.ComputedSum(&_StateChurn.CallOpts)
}

// ComputedSum is a free data retrieval call binding the contract method 0x8c4262da.
//
// Solidity: function computedSum() view returns(uint256 sum)
func (_StateChurn *StateChurnCallerSession) ComputedSum() (*big.Int, error) {
	return _StateChurn.Contract.ComputedSum(&_StateChurn.CallOpts)
}

// Cursor is a free data retrieval call binding the contract method 0x36a0b9ef.
//
// Solidity: function cursor() view returns(uint256)
func (_StateChurn *StateChurnCaller) Cursor(opts *bind.CallOpts) (*big.Int, error) {
	var out []any
	err := _StateChurn.contract.Call(opts, &out, "cursor")

	if err != nil {
		return *new(*big.Int), err
	}

	out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)

	return out0, err

}

// Cursor is a free data retrieval call binding the contract method 0x36a0b9ef.
//
// Solidity: function cursor() view returns(uint256)
func (_StateChurn *StateChurnSession) Cursor() (*big.Int, error) {
	return _StateChurn.Contract.Cursor(&_StateChurn.CallOpts)
}

// Cursor is a free data retrieval call binding the contract method 0x36a0b9ef.
//
// Solidity: function cursor() view returns(uint256)
func (_StateChurn *StateChurnCallerSession) Cursor() (*big.Int, error) {
	return _StateChurn.Contract.Cursor(&_StateChurn.CallOpts)
}

// TrackedSum is a free data retrieval call binding the contract method 0x9dc4dbfa.
//
// Solidity: function trackedSum() view returns(uint256)
func (_StateChurn *StateChurnCaller) TrackedSum(opts *bind.CallOpts) (*big.Int, error) {
	var out []any
	err := _StateChurn.contract.Call(opts, &out, "trackedSum")

	if err != nil {
		return *new(*big.Int), err
	}

	out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)

	return out0, err

}

// TrackedSum is a free data retrieval call binding the contract method 0x9dc4dbfa.
//
// Solidity: function trackedSum() view returns(uint256)
func (_StateChurn *StateChurnSession) TrackedSum() (*big.Int, error) {
	return _StateChurn.Contract.TrackedSum(&_StateChurn.CallOpts)
}

// TrackedSum is a free data retrieval call binding the contract method 0x9dc4dbfa.
//
// Solidity: function trackedSum() view returns(uint256)
func (_StateChurn *StateChurnCallerSession) TrackedSum() (*big.Int, error) {
	return _StateChurn.Contract.TrackedSum(&_StateChurn.CallOpts)
}

// Poke is a paid mutator transaction binding the contract method 0x32145f90.
//
// Solidity: function poke(uint256 seed) returns()
func (_StateChurn *StateChurnTransactor) Poke(opts *bind.TransactOpts, seed *big.Int) (types.Transaction, error) {
	return _StateChurn.contract.Transact(opts, "poke", seed)
}

// Poke is a paid mutator transaction binding the contract method 0x32145f90.
//
// Solidity: function poke(uint256 seed) returns()
func (_StateChurn *StateChurnSession) Poke(seed *big.Int) (types.Transaction, error) {
	return _StateChurn.Contract.Poke(&_StateChurn.TransactOpts, seed)
}

// Poke is a paid mutator transaction binding the contract method 0x32145f90.
//
// Solidity: function poke(uint256 seed) returns()
func (_StateChurn *StateChurnTransactorSession) Poke(seed *big.Int) (types.Transaction, error) {
	return _StateChurn.Contract.Poke(&_StateChurn.TransactOpts, seed)
}

// StateChurnPokeParams is an auto generated read-only Go binding of transcaction calldata params
type StateChurnPokeParams struct {
	Param_seed *big.Int
}

// Parse Poke method from calldata of a transaction
//
// Solidity: function poke(uint256 seed) returns()
func ParseStateChurnPokeParams(calldata []byte) (*StateChurnPokeParams, error) {
	if len(calldata) <= 4 {
		return nil, fmt.Errorf("invalid calldata input")
	}

	_abi, err := abi.JSON(strings.NewReader(StateChurnABI))
	if err != nil {
		return nil, fmt.Errorf("failed to get abi of registry metadata: %w", err)
	}

	out, err := _abi.Methods["poke"].Inputs.Unpack(calldata[4:])
	if err != nil {
		return nil, fmt.Errorf("failed to unpack poke params data: %w", err)
	}

	var paramsResult = new(StateChurnPokeParams)
	value := reflect.ValueOf(paramsResult).Elem()

	if value.NumField() != len(out) {
		return nil, fmt.Errorf("failed to match calldata with param field number")
	}

	out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)

	return &StateChurnPokeParams{
		Param_seed: out0,
	}, nil
}
