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

package util

import (
	"errors"
	"math/big"
	"strings"

	ethereum "github.com/ethereum/go-ethereum"
	"github.com/ethereum/go-ethereum/accounts/abi"
	"github.com/ethereum/go-ethereum/accounts/abi/bind"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
	"github.com/ethereum/go-ethereum/event"
)

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

// FhlMetaData contains all meta data concerning the Fhl contract.
var FhlMetaData = &bind.MetaData{
	ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_referrer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_price\",\"type\":\"uint256\"}],\"name\":\"newDeposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"newWithdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_ktoPrice\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_referrer\",\"type\":\"address\"}],\"name\":\"join\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"users\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_time\",\"type\":\"string\"},{\"internalType\":\"bytes32\",\"name\":\"_sign\",\"type\":\"bytes32\"}],\"name\":\"widthow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
}

// FhlABI is the input ABI used to generate the binding from.
// Deprecated: Use FhlMetaData.ABI instead.
var FhlABI = FhlMetaData.ABI

// Fhl is an auto generated Go binding around an Ethereum contract.
type Fhl struct {
	FhlCaller     // Read-only binding to the contract
	FhlTransactor // Write-only binding to the contract
	FhlFilterer   // Log filterer for contract events
}

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

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

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

// FhlSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type FhlSession struct {
	Contract     *Fhl              // 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
}

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

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

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

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

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

// NewFhl creates a new instance of Fhl, bound to a specific deployed contract.
func NewFhl(address common.Address, backend bind.ContractBackend) (*Fhl, error) {
	contract, err := bindFhl(address, backend, backend, backend)
	if err != nil {
		return nil, err
	}
	return &Fhl{FhlCaller: FhlCaller{contract: contract}, FhlTransactor: FhlTransactor{contract: contract}, FhlFilterer: FhlFilterer{contract: contract}}, nil
}

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

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

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

// bindFhl binds a generic wrapper to an already deployed contract.
func bindFhl(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
	parsed, err := abi.JSON(strings.NewReader(FhlABI))
	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 (_Fhl *FhlRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
	return _Fhl.Contract.FhlCaller.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 (_Fhl *FhlRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
	return _Fhl.Contract.FhlTransactor.contract.Transfer(opts)
}

// Transact invokes the (paid) contract method with params as input values.
func (_Fhl *FhlRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
	return _Fhl.Contract.FhlTransactor.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 (_Fhl *FhlCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
	return _Fhl.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 (_Fhl *FhlTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
	return _Fhl.Contract.contract.Transfer(opts)
}

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

// GetPrice is a free data retrieval call binding the contract method 0x98d5fdca.
//
// Solidity: function getPrice() view returns(uint256 _ktoPrice)
func (_Fhl *FhlCaller) GetPrice(opts *bind.CallOpts) (*big.Int, error) {
	var out []interface{}
	err := _Fhl.contract.Call(opts, &out, "getPrice")

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

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

	return out0, err

}

// GetPrice is a free data retrieval call binding the contract method 0x98d5fdca.
//
// Solidity: function getPrice() view returns(uint256 _ktoPrice)
func (_Fhl *FhlSession) GetPrice() (*big.Int, error) {
	return _Fhl.Contract.GetPrice(&_Fhl.CallOpts)
}

// GetPrice is a free data retrieval call binding the contract method 0x98d5fdca.
//
// Solidity: function getPrice() view returns(uint256 _ktoPrice)
func (_Fhl *FhlCallerSession) GetPrice() (*big.Int, error) {
	return _Fhl.Contract.GetPrice(&_Fhl.CallOpts)
}

// Users is a free data retrieval call binding the contract method 0xa87430ba.
//
// Solidity: function users(address _user) view returns(uint256)
func (_Fhl *FhlCaller) Users(opts *bind.CallOpts, _user common.Address) (*big.Int, error) {
	var out []interface{}
	err := _Fhl.contract.Call(opts, &out, "users", _user)

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

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

	return out0, err

}

// Users is a free data retrieval call binding the contract method 0xa87430ba.
//
// Solidity: function users(address _user) view returns(uint256)
func (_Fhl *FhlSession) Users(_user common.Address) (*big.Int, error) {
	return _Fhl.Contract.Users(&_Fhl.CallOpts, _user)
}

// Users is a free data retrieval call binding the contract method 0xa87430ba.
//
// Solidity: function users(address _user) view returns(uint256)
func (_Fhl *FhlCallerSession) Users(_user common.Address) (*big.Int, error) {
	return _Fhl.Contract.Users(&_Fhl.CallOpts, _user)
}

// Join is a paid mutator transaction binding the contract method 0x28ffe6c8.
//
// Solidity: function join(address _referrer) payable returns()
func (_Fhl *FhlTransactor) Join(opts *bind.TransactOpts, _referrer common.Address) (*types.Transaction, error) {
	return _Fhl.contract.Transact(opts, "join", _referrer)
}

// Join is a paid mutator transaction binding the contract method 0x28ffe6c8.
//
// Solidity: function join(address _referrer) payable returns()
func (_Fhl *FhlSession) Join(_referrer common.Address) (*types.Transaction, error) {
	return _Fhl.Contract.Join(&_Fhl.TransactOpts, _referrer)
}

// Join is a paid mutator transaction binding the contract method 0x28ffe6c8.
//
// Solidity: function join(address _referrer) payable returns()
func (_Fhl *FhlTransactorSession) Join(_referrer common.Address) (*types.Transaction, error) {
	return _Fhl.Contract.Join(&_Fhl.TransactOpts, _referrer)
}

// Widthow is a paid mutator transaction binding the contract method 0x5de8e38c.
//
// Solidity: function widthow(uint256 _amount, string _time, bytes32 _sign) returns()
func (_Fhl *FhlTransactor) Widthow(opts *bind.TransactOpts, _amount *big.Int, _time string, _sign [32]byte) (*types.Transaction, error) {
	return _Fhl.contract.Transact(opts, "widthow", _amount, _time, _sign)
}

// Widthow is a paid mutator transaction binding the contract method 0x5de8e38c.
//
// Solidity: function widthow(uint256 _amount, string _time, bytes32 _sign) returns()
func (_Fhl *FhlSession) Widthow(_amount *big.Int, _time string, _sign [32]byte) (*types.Transaction, error) {
	return _Fhl.Contract.Widthow(&_Fhl.TransactOpts, _amount, _time, _sign)
}

// Widthow is a paid mutator transaction binding the contract method 0x5de8e38c.
//
// Solidity: function widthow(uint256 _amount, string _time, bytes32 _sign) returns()
func (_Fhl *FhlTransactorSession) Widthow(_amount *big.Int, _time string, _sign [32]byte) (*types.Transaction, error) {
	return _Fhl.Contract.Widthow(&_Fhl.TransactOpts, _amount, _time, _sign)
}

// FhlNewDepositIterator is returned from FilterNewDeposit and is used to iterate over the raw logs and unpacked data for NewDeposit events raised by the Fhl contract.
type FhlNewDepositIterator struct {
	Event *FhlNewDeposit // Event containing the contract specifics and raw log

	contract *bind.BoundContract // Generic contract to use for unpacking event data
	event    string              // Event name to use for unpacking event data

	logs chan types.Log        // Log channel receiving the found contract events
	sub  ethereum.Subscription // Subscription for errors, completion and termination
	done bool                  // Whether the subscription completed delivering logs
	fail error                 // Occurred error to stop iteration
}

// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *FhlNewDepositIterator) Next() bool {
	// If the iterator failed, stop iterating
	if it.fail != nil {
		return false
	}
	// If the iterator completed, deliver directly whatever's available
	if it.done {
		select {
		case log := <-it.logs:
			it.Event = new(FhlNewDeposit)
			if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
				it.fail = err
				return false
			}
			it.Event.Raw = log
			return true

		default:
			return false
		}
	}
	// Iterator still in progress, wait for either a data or an error event
	select {
	case log := <-it.logs:
		it.Event = new(FhlNewDeposit)
		if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
			it.fail = err
			return false
		}
		it.Event.Raw = log
		return true

	case err := <-it.sub.Err():
		it.done = true
		it.fail = err
		return it.Next()
	}
}

// Error returns any retrieval or parsing error occurred during filtering.
func (it *FhlNewDepositIterator) Error() error {
	return it.fail
}

// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *FhlNewDepositIterator) Close() error {
	it.sub.Unsubscribe()
	return nil
}

// FhlNewDeposit represents a NewDeposit event raised by the Fhl contract.
type FhlNewDeposit struct {
	User     common.Address
	Referrer common.Address
	Amount   *big.Int
	Price    *big.Int
	Raw      types.Log // Blockchain specific contextual infos
}

// FilterNewDeposit is a free log retrieval operation binding the contract event 0xddd670a4142d06229b922c5d433d29131580e1a2952c86700b0a36ea9e8b87ee.
//
// Solidity: event newDeposit(address _user, address _referrer, uint256 _amount, uint256 _price)
func (_Fhl *FhlFilterer) FilterNewDeposit(opts *bind.FilterOpts) (*FhlNewDepositIterator, error) {

	logs, sub, err := _Fhl.contract.FilterLogs(opts, "newDeposit")
	if err != nil {
		return nil, err
	}
	return &FhlNewDepositIterator{contract: _Fhl.contract, event: "newDeposit", logs: logs, sub: sub}, nil
}

// WatchNewDeposit is a free log subscription operation binding the contract event 0xddd670a4142d06229b922c5d433d29131580e1a2952c86700b0a36ea9e8b87ee.
//
// Solidity: event newDeposit(address _user, address _referrer, uint256 _amount, uint256 _price)
func (_Fhl *FhlFilterer) WatchNewDeposit(opts *bind.WatchOpts, sink chan<- *FhlNewDeposit) (event.Subscription, error) {

	logs, sub, err := _Fhl.contract.WatchLogs(opts, "newDeposit")
	if err != nil {
		return nil, err
	}
	return event.NewSubscription(func(quit <-chan struct{}) error {
		defer sub.Unsubscribe()
		for {
			select {
			case log := <-logs:
				// New log arrived, parse the event and forward to the user
				event := new(FhlNewDeposit)
				if err := _Fhl.contract.UnpackLog(event, "newDeposit", log); err != nil {
					return err
				}
				event.Raw = log

				select {
				case sink <- event:
				case err := <-sub.Err():
					return err
				case <-quit:
					return nil
				}
			case err := <-sub.Err():
				return err
			case <-quit:
				return nil
			}
		}
	}), nil
}

// ParseNewDeposit is a log parse operation binding the contract event 0xddd670a4142d06229b922c5d433d29131580e1a2952c86700b0a36ea9e8b87ee.
//
// Solidity: event newDeposit(address _user, address _referrer, uint256 _amount, uint256 _price)
func (_Fhl *FhlFilterer) ParseNewDeposit(log types.Log) (*FhlNewDeposit, error) {
	event := new(FhlNewDeposit)
	if err := _Fhl.contract.UnpackLog(event, "newDeposit", log); err != nil {
		return nil, err
	}
	event.Raw = log
	return event, nil
}

// FhlNewWithdrawIterator is returned from FilterNewWithdraw and is used to iterate over the raw logs and unpacked data for NewWithdraw events raised by the Fhl contract.
type FhlNewWithdrawIterator struct {
	Event *FhlNewWithdraw // Event containing the contract specifics and raw log

	contract *bind.BoundContract // Generic contract to use for unpacking event data
	event    string              // Event name to use for unpacking event data

	logs chan types.Log        // Log channel receiving the found contract events
	sub  ethereum.Subscription // Subscription for errors, completion and termination
	done bool                  // Whether the subscription completed delivering logs
	fail error                 // Occurred error to stop iteration
}

// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *FhlNewWithdrawIterator) Next() bool {
	// If the iterator failed, stop iterating
	if it.fail != nil {
		return false
	}
	// If the iterator completed, deliver directly whatever's available
	if it.done {
		select {
		case log := <-it.logs:
			it.Event = new(FhlNewWithdraw)
			if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
				it.fail = err
				return false
			}
			it.Event.Raw = log
			return true

		default:
			return false
		}
	}
	// Iterator still in progress, wait for either a data or an error event
	select {
	case log := <-it.logs:
		it.Event = new(FhlNewWithdraw)
		if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
			it.fail = err
			return false
		}
		it.Event.Raw = log
		return true

	case err := <-it.sub.Err():
		it.done = true
		it.fail = err
		return it.Next()
	}
}

// Error returns any retrieval or parsing error occurred during filtering.
func (it *FhlNewWithdrawIterator) Error() error {
	return it.fail
}

// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *FhlNewWithdrawIterator) Close() error {
	it.sub.Unsubscribe()
	return nil
}

// FhlNewWithdraw represents a NewWithdraw event raised by the Fhl contract.
type FhlNewWithdraw struct {
	User   common.Address
	Amount *big.Int
	Raw    types.Log // Blockchain specific contextual infos
}

// FilterNewWithdraw is a free log retrieval operation binding the contract event 0x056f1f5cdd8662230b94b7f88e06d95549d18e77cb2959933db3849d36df790a.
//
// Solidity: event newWithdraw(address _user, uint256 _amount)
func (_Fhl *FhlFilterer) FilterNewWithdraw(opts *bind.FilterOpts) (*FhlNewWithdrawIterator, error) {

	logs, sub, err := _Fhl.contract.FilterLogs(opts, "newWithdraw")
	if err != nil {
		return nil, err
	}
	return &FhlNewWithdrawIterator{contract: _Fhl.contract, event: "newWithdraw", logs: logs, sub: sub}, nil
}

// WatchNewWithdraw is a free log subscription operation binding the contract event 0x056f1f5cdd8662230b94b7f88e06d95549d18e77cb2959933db3849d36df790a.
//
// Solidity: event newWithdraw(address _user, uint256 _amount)
func (_Fhl *FhlFilterer) WatchNewWithdraw(opts *bind.WatchOpts, sink chan<- *FhlNewWithdraw) (event.Subscription, error) {

	logs, sub, err := _Fhl.contract.WatchLogs(opts, "newWithdraw")
	if err != nil {
		return nil, err
	}
	return event.NewSubscription(func(quit <-chan struct{}) error {
		defer sub.Unsubscribe()
		for {
			select {
			case log := <-logs:
				// New log arrived, parse the event and forward to the user
				event := new(FhlNewWithdraw)
				if err := _Fhl.contract.UnpackLog(event, "newWithdraw", log); err != nil {
					return err
				}
				event.Raw = log

				select {
				case sink <- event:
				case err := <-sub.Err():
					return err
				case <-quit:
					return nil
				}
			case err := <-sub.Err():
				return err
			case <-quit:
				return nil
			}
		}
	}), nil
}

// ParseNewWithdraw is a log parse operation binding the contract event 0x056f1f5cdd8662230b94b7f88e06d95549d18e77cb2959933db3849d36df790a.
//
// Solidity: event newWithdraw(address _user, uint256 _amount)
func (_Fhl *FhlFilterer) ParseNewWithdraw(log types.Log) (*FhlNewWithdraw, error) {
	event := new(FhlNewWithdraw)
	if err := _Fhl.contract.UnpackLog(event, "newWithdraw", log); err != nil {
		return nil, err
	}
	event.Raw = log
	return event, nil
}
