From ee4bb4c23d3761661a496d02fff03c33a0e8fcf0 Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Fri, 19 Nov 2021 10:44:55 +0400 Subject: [PATCH] add smartchef harvest method --- pancakeswap/contracts/smartchef.abi | 1 + pancakeswap/contracts/smartchef.go | 2171 +++++++++++++++++++++++++++ pancakeswap/smartchef.go | 35 + 3 files changed, 2207 insertions(+) create mode 100644 pancakeswap/contracts/smartchef.abi create mode 100644 pancakeswap/contracts/smartchef.go create mode 100644 pancakeswap/smartchef.go diff --git a/pancakeswap/contracts/smartchef.abi b/pancakeswap/contracts/smartchef.abi new file mode 100644 index 0000000..a760778 --- /dev/null +++ b/pancakeswap/contracts/smartchef.abi @@ -0,0 +1 @@ +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenRecovered","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AdminTokenRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"poolLimitPerUser","type":"uint256"}],"name":"NewPoolLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"name":"NewRewardPerBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"}],"name":"NewStartAndEndBlocks","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"RewardsStop","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"PRECISION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SMART_CHEF_FACTORY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"emergencyRewardWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"hasUserLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBEP20","name":"_stakedToken","type":"address"},{"internalType":"contract IBEP20","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusEndBlock","type":"uint256"},{"internalType":"uint256","name":"_poolLimitPerUser","type":"uint256"},{"internalType":"address","name":"_admin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLimitPerUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"recoverWrongTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IBEP20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedToken","outputs":[{"internalType":"contract IBEP20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stopReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_hasUserLimit","type":"bool"},{"internalType":"uint256","name":"_poolLimitPerUser","type":"uint256"}],"name":"updatePoolLimitPerUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"}],"name":"updateRewardPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusEndBlock","type":"uint256"}],"name":"updateStartAndEndBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/pancakeswap/contracts/smartchef.go b/pancakeswap/contracts/smartchef.go new file mode 100644 index 0000000..1922896 --- /dev/null +++ b/pancakeswap/contracts/smartchef.go @@ -0,0 +1,2171 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contracts + +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 +) + +// SmartChefMetaData contains all meta data concerning the SmartChef contract. +var SmartChefMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"tokenRecovered\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AdminTokenRecovery\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyWithdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"poolLimitPerUser\",\"type\":\"uint256\"}],\"name\":\"NewPoolLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardPerBlock\",\"type\":\"uint256\"}],\"name\":\"NewRewardPerBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endBlock\",\"type\":\"uint256\"}],\"name\":\"NewStartAndEndBlocks\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"RewardsStop\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"PRECISION_FACTOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SMART_CHEF_FACTORY\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accTokenPerShare\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bonusEndBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"emergencyRewardWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hasUserLimit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIBEP20\",\"name\":\"_stakedToken\",\"type\":\"address\"},{\"internalType\":\"contractIBEP20\",\"name\":\"_rewardToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rewardPerBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_startBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_bonusEndBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_poolLimitPerUser\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isInitialized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastRewardBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"pendingReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolLimitPerUser\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_tokenAmount\",\"type\":\"uint256\"}],\"name\":\"recoverWrongTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardPerBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardToken\",\"outputs\":[{\"internalType\":\"contractIBEP20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakedToken\",\"outputs\":[{\"internalType\":\"contractIBEP20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stopReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_hasUserLimit\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_poolLimitPerUser\",\"type\":\"uint256\"}],\"name\":\"updatePoolLimitPerUser\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardPerBlock\",\"type\":\"uint256\"}],\"name\":\"updateRewardPerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_startBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_bonusEndBlock\",\"type\":\"uint256\"}],\"name\":\"updateStartAndEndBlocks\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"userInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardDebt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// SmartChefABI is the input ABI used to generate the binding from. +// Deprecated: Use SmartChefMetaData.ABI instead. +var SmartChefABI = SmartChefMetaData.ABI + +// SmartChef is an auto generated Go binding around an Ethereum contract. +type SmartChef struct { + SmartChefCaller // Read-only binding to the contract + SmartChefTransactor // Write-only binding to the contract + SmartChefFilterer // Log filterer for contract events +} + +// SmartChefCaller is an auto generated read-only Go binding around an Ethereum contract. +type SmartChefCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SmartChefTransactor is an auto generated write-only Go binding around an Ethereum contract. +type SmartChefTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SmartChefFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type SmartChefFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SmartChefSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type SmartChefSession struct { + Contract *SmartChef // 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 +} + +// SmartChefCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type SmartChefCallerSession struct { + Contract *SmartChefCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// SmartChefTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type SmartChefTransactorSession struct { + Contract *SmartChefTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SmartChefRaw is an auto generated low-level Go binding around an Ethereum contract. +type SmartChefRaw struct { + Contract *SmartChef // Generic contract binding to access the raw methods on +} + +// SmartChefCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type SmartChefCallerRaw struct { + Contract *SmartChefCaller // Generic read-only contract binding to access the raw methods on +} + +// SmartChefTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type SmartChefTransactorRaw struct { + Contract *SmartChefTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewSmartChef creates a new instance of SmartChef, bound to a specific deployed contract. +func NewSmartChef(address common.Address, backend bind.ContractBackend) (*SmartChef, error) { + contract, err := bindSmartChef(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &SmartChef{SmartChefCaller: SmartChefCaller{contract: contract}, SmartChefTransactor: SmartChefTransactor{contract: contract}, SmartChefFilterer: SmartChefFilterer{contract: contract}}, nil +} + +// NewSmartChefCaller creates a new read-only instance of SmartChef, bound to a specific deployed contract. +func NewSmartChefCaller(address common.Address, caller bind.ContractCaller) (*SmartChefCaller, error) { + contract, err := bindSmartChef(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &SmartChefCaller{contract: contract}, nil +} + +// NewSmartChefTransactor creates a new write-only instance of SmartChef, bound to a specific deployed contract. +func NewSmartChefTransactor(address common.Address, transactor bind.ContractTransactor) (*SmartChefTransactor, error) { + contract, err := bindSmartChef(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &SmartChefTransactor{contract: contract}, nil +} + +// NewSmartChefFilterer creates a new log filterer instance of SmartChef, bound to a specific deployed contract. +func NewSmartChefFilterer(address common.Address, filterer bind.ContractFilterer) (*SmartChefFilterer, error) { + contract, err := bindSmartChef(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &SmartChefFilterer{contract: contract}, nil +} + +// bindSmartChef binds a generic wrapper to an already deployed contract. +func bindSmartChef(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(SmartChefABI)) + 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 (_SmartChef *SmartChefRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SmartChef.Contract.SmartChefCaller.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 (_SmartChef *SmartChefRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SmartChef.Contract.SmartChefTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_SmartChef *SmartChefRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SmartChef.Contract.SmartChefTransactor.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 (_SmartChef *SmartChefCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SmartChef.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 (_SmartChef *SmartChefTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SmartChef.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_SmartChef *SmartChefTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SmartChef.Contract.contract.Transact(opts, method, params...) +} + +// PRECISIONFACTOR is a free data retrieval call binding the contract method 0xccd34cd5. +// +// Solidity: function PRECISION_FACTOR() view returns(uint256) +func (_SmartChef *SmartChefCaller) PRECISIONFACTOR(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "PRECISION_FACTOR") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// PRECISIONFACTOR is a free data retrieval call binding the contract method 0xccd34cd5. +// +// Solidity: function PRECISION_FACTOR() view returns(uint256) +func (_SmartChef *SmartChefSession) PRECISIONFACTOR() (*big.Int, error) { + return _SmartChef.Contract.PRECISIONFACTOR(&_SmartChef.CallOpts) +} + +// PRECISIONFACTOR is a free data retrieval call binding the contract method 0xccd34cd5. +// +// Solidity: function PRECISION_FACTOR() view returns(uint256) +func (_SmartChef *SmartChefCallerSession) PRECISIONFACTOR() (*big.Int, error) { + return _SmartChef.Contract.PRECISIONFACTOR(&_SmartChef.CallOpts) +} + +// SMARTCHEFFACTORY is a free data retrieval call binding the contract method 0xbd617191. +// +// Solidity: function SMART_CHEF_FACTORY() view returns(address) +func (_SmartChef *SmartChefCaller) SMARTCHEFFACTORY(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "SMART_CHEF_FACTORY") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// SMARTCHEFFACTORY is a free data retrieval call binding the contract method 0xbd617191. +// +// Solidity: function SMART_CHEF_FACTORY() view returns(address) +func (_SmartChef *SmartChefSession) SMARTCHEFFACTORY() (common.Address, error) { + return _SmartChef.Contract.SMARTCHEFFACTORY(&_SmartChef.CallOpts) +} + +// SMARTCHEFFACTORY is a free data retrieval call binding the contract method 0xbd617191. +// +// Solidity: function SMART_CHEF_FACTORY() view returns(address) +func (_SmartChef *SmartChefCallerSession) SMARTCHEFFACTORY() (common.Address, error) { + return _SmartChef.Contract.SMARTCHEFFACTORY(&_SmartChef.CallOpts) +} + +// AccTokenPerShare is a free data retrieval call binding the contract method 0x8f662915. +// +// Solidity: function accTokenPerShare() view returns(uint256) +func (_SmartChef *SmartChefCaller) AccTokenPerShare(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "accTokenPerShare") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// AccTokenPerShare is a free data retrieval call binding the contract method 0x8f662915. +// +// Solidity: function accTokenPerShare() view returns(uint256) +func (_SmartChef *SmartChefSession) AccTokenPerShare() (*big.Int, error) { + return _SmartChef.Contract.AccTokenPerShare(&_SmartChef.CallOpts) +} + +// AccTokenPerShare is a free data retrieval call binding the contract method 0x8f662915. +// +// Solidity: function accTokenPerShare() view returns(uint256) +func (_SmartChef *SmartChefCallerSession) AccTokenPerShare() (*big.Int, error) { + return _SmartChef.Contract.AccTokenPerShare(&_SmartChef.CallOpts) +} + +// BonusEndBlock is a free data retrieval call binding the contract method 0x1aed6553. +// +// Solidity: function bonusEndBlock() view returns(uint256) +func (_SmartChef *SmartChefCaller) BonusEndBlock(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "bonusEndBlock") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BonusEndBlock is a free data retrieval call binding the contract method 0x1aed6553. +// +// Solidity: function bonusEndBlock() view returns(uint256) +func (_SmartChef *SmartChefSession) BonusEndBlock() (*big.Int, error) { + return _SmartChef.Contract.BonusEndBlock(&_SmartChef.CallOpts) +} + +// BonusEndBlock is a free data retrieval call binding the contract method 0x1aed6553. +// +// Solidity: function bonusEndBlock() view returns(uint256) +func (_SmartChef *SmartChefCallerSession) BonusEndBlock() (*big.Int, error) { + return _SmartChef.Contract.BonusEndBlock(&_SmartChef.CallOpts) +} + +// HasUserLimit is a free data retrieval call binding the contract method 0x92e8990e. +// +// Solidity: function hasUserLimit() view returns(bool) +func (_SmartChef *SmartChefCaller) HasUserLimit(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "hasUserLimit") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasUserLimit is a free data retrieval call binding the contract method 0x92e8990e. +// +// Solidity: function hasUserLimit() view returns(bool) +func (_SmartChef *SmartChefSession) HasUserLimit() (bool, error) { + return _SmartChef.Contract.HasUserLimit(&_SmartChef.CallOpts) +} + +// HasUserLimit is a free data retrieval call binding the contract method 0x92e8990e. +// +// Solidity: function hasUserLimit() view returns(bool) +func (_SmartChef *SmartChefCallerSession) HasUserLimit() (bool, error) { + return _SmartChef.Contract.HasUserLimit(&_SmartChef.CallOpts) +} + +// IsInitialized is a free data retrieval call binding the contract method 0x392e53cd. +// +// Solidity: function isInitialized() view returns(bool) +func (_SmartChef *SmartChefCaller) IsInitialized(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "isInitialized") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsInitialized is a free data retrieval call binding the contract method 0x392e53cd. +// +// Solidity: function isInitialized() view returns(bool) +func (_SmartChef *SmartChefSession) IsInitialized() (bool, error) { + return _SmartChef.Contract.IsInitialized(&_SmartChef.CallOpts) +} + +// IsInitialized is a free data retrieval call binding the contract method 0x392e53cd. +// +// Solidity: function isInitialized() view returns(bool) +func (_SmartChef *SmartChefCallerSession) IsInitialized() (bool, error) { + return _SmartChef.Contract.IsInitialized(&_SmartChef.CallOpts) +} + +// LastRewardBlock is a free data retrieval call binding the contract method 0xa9f8d181. +// +// Solidity: function lastRewardBlock() view returns(uint256) +func (_SmartChef *SmartChefCaller) LastRewardBlock(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "lastRewardBlock") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// LastRewardBlock is a free data retrieval call binding the contract method 0xa9f8d181. +// +// Solidity: function lastRewardBlock() view returns(uint256) +func (_SmartChef *SmartChefSession) LastRewardBlock() (*big.Int, error) { + return _SmartChef.Contract.LastRewardBlock(&_SmartChef.CallOpts) +} + +// LastRewardBlock is a free data retrieval call binding the contract method 0xa9f8d181. +// +// Solidity: function lastRewardBlock() view returns(uint256) +func (_SmartChef *SmartChefCallerSession) LastRewardBlock() (*big.Int, error) { + return _SmartChef.Contract.LastRewardBlock(&_SmartChef.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_SmartChef *SmartChefCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_SmartChef *SmartChefSession) Owner() (common.Address, error) { + return _SmartChef.Contract.Owner(&_SmartChef.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_SmartChef *SmartChefCallerSession) Owner() (common.Address, error) { + return _SmartChef.Contract.Owner(&_SmartChef.CallOpts) +} + +// PendingReward is a free data retrieval call binding the contract method 0xf40f0f52. +// +// Solidity: function pendingReward(address _user) view returns(uint256) +func (_SmartChef *SmartChefCaller) PendingReward(opts *bind.CallOpts, _user common.Address) (*big.Int, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "pendingReward", _user) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// PendingReward is a free data retrieval call binding the contract method 0xf40f0f52. +// +// Solidity: function pendingReward(address _user) view returns(uint256) +func (_SmartChef *SmartChefSession) PendingReward(_user common.Address) (*big.Int, error) { + return _SmartChef.Contract.PendingReward(&_SmartChef.CallOpts, _user) +} + +// PendingReward is a free data retrieval call binding the contract method 0xf40f0f52. +// +// Solidity: function pendingReward(address _user) view returns(uint256) +func (_SmartChef *SmartChefCallerSession) PendingReward(_user common.Address) (*big.Int, error) { + return _SmartChef.Contract.PendingReward(&_SmartChef.CallOpts, _user) +} + +// PoolLimitPerUser is a free data retrieval call binding the contract method 0x66fe9f8a. +// +// Solidity: function poolLimitPerUser() view returns(uint256) +func (_SmartChef *SmartChefCaller) PoolLimitPerUser(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "poolLimitPerUser") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// PoolLimitPerUser is a free data retrieval call binding the contract method 0x66fe9f8a. +// +// Solidity: function poolLimitPerUser() view returns(uint256) +func (_SmartChef *SmartChefSession) PoolLimitPerUser() (*big.Int, error) { + return _SmartChef.Contract.PoolLimitPerUser(&_SmartChef.CallOpts) +} + +// PoolLimitPerUser is a free data retrieval call binding the contract method 0x66fe9f8a. +// +// Solidity: function poolLimitPerUser() view returns(uint256) +func (_SmartChef *SmartChefCallerSession) PoolLimitPerUser() (*big.Int, error) { + return _SmartChef.Contract.PoolLimitPerUser(&_SmartChef.CallOpts) +} + +// RewardPerBlock is a free data retrieval call binding the contract method 0x8ae39cac. +// +// Solidity: function rewardPerBlock() view returns(uint256) +func (_SmartChef *SmartChefCaller) RewardPerBlock(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "rewardPerBlock") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// RewardPerBlock is a free data retrieval call binding the contract method 0x8ae39cac. +// +// Solidity: function rewardPerBlock() view returns(uint256) +func (_SmartChef *SmartChefSession) RewardPerBlock() (*big.Int, error) { + return _SmartChef.Contract.RewardPerBlock(&_SmartChef.CallOpts) +} + +// RewardPerBlock is a free data retrieval call binding the contract method 0x8ae39cac. +// +// Solidity: function rewardPerBlock() view returns(uint256) +func (_SmartChef *SmartChefCallerSession) RewardPerBlock() (*big.Int, error) { + return _SmartChef.Contract.RewardPerBlock(&_SmartChef.CallOpts) +} + +// RewardToken is a free data retrieval call binding the contract method 0xf7c618c1. +// +// Solidity: function rewardToken() view returns(address) +func (_SmartChef *SmartChefCaller) RewardToken(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "rewardToken") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// RewardToken is a free data retrieval call binding the contract method 0xf7c618c1. +// +// Solidity: function rewardToken() view returns(address) +func (_SmartChef *SmartChefSession) RewardToken() (common.Address, error) { + return _SmartChef.Contract.RewardToken(&_SmartChef.CallOpts) +} + +// RewardToken is a free data retrieval call binding the contract method 0xf7c618c1. +// +// Solidity: function rewardToken() view returns(address) +func (_SmartChef *SmartChefCallerSession) RewardToken() (common.Address, error) { + return _SmartChef.Contract.RewardToken(&_SmartChef.CallOpts) +} + +// StakedToken is a free data retrieval call binding the contract method 0xcc7a262e. +// +// Solidity: function stakedToken() view returns(address) +func (_SmartChef *SmartChefCaller) StakedToken(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "stakedToken") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// StakedToken is a free data retrieval call binding the contract method 0xcc7a262e. +// +// Solidity: function stakedToken() view returns(address) +func (_SmartChef *SmartChefSession) StakedToken() (common.Address, error) { + return _SmartChef.Contract.StakedToken(&_SmartChef.CallOpts) +} + +// StakedToken is a free data retrieval call binding the contract method 0xcc7a262e. +// +// Solidity: function stakedToken() view returns(address) +func (_SmartChef *SmartChefCallerSession) StakedToken() (common.Address, error) { + return _SmartChef.Contract.StakedToken(&_SmartChef.CallOpts) +} + +// StartBlock is a free data retrieval call binding the contract method 0x48cd4cb1. +// +// Solidity: function startBlock() view returns(uint256) +func (_SmartChef *SmartChefCaller) StartBlock(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "startBlock") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// StartBlock is a free data retrieval call binding the contract method 0x48cd4cb1. +// +// Solidity: function startBlock() view returns(uint256) +func (_SmartChef *SmartChefSession) StartBlock() (*big.Int, error) { + return _SmartChef.Contract.StartBlock(&_SmartChef.CallOpts) +} + +// StartBlock is a free data retrieval call binding the contract method 0x48cd4cb1. +// +// Solidity: function startBlock() view returns(uint256) +func (_SmartChef *SmartChefCallerSession) StartBlock() (*big.Int, error) { + return _SmartChef.Contract.StartBlock(&_SmartChef.CallOpts) +} + +// UserInfo is a free data retrieval call binding the contract method 0x1959a002. +// +// Solidity: function userInfo(address ) view returns(uint256 amount, uint256 rewardDebt) +func (_SmartChef *SmartChefCaller) UserInfo(opts *bind.CallOpts, arg0 common.Address) (struct { + Amount *big.Int + RewardDebt *big.Int +}, error) { + var out []interface{} + err := _SmartChef.contract.Call(opts, &out, "userInfo", arg0) + + outstruct := new(struct { + Amount *big.Int + RewardDebt *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Amount = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.RewardDebt = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// UserInfo is a free data retrieval call binding the contract method 0x1959a002. +// +// Solidity: function userInfo(address ) view returns(uint256 amount, uint256 rewardDebt) +func (_SmartChef *SmartChefSession) UserInfo(arg0 common.Address) (struct { + Amount *big.Int + RewardDebt *big.Int +}, error) { + return _SmartChef.Contract.UserInfo(&_SmartChef.CallOpts, arg0) +} + +// UserInfo is a free data retrieval call binding the contract method 0x1959a002. +// +// Solidity: function userInfo(address ) view returns(uint256 amount, uint256 rewardDebt) +func (_SmartChef *SmartChefCallerSession) UserInfo(arg0 common.Address) (struct { + Amount *big.Int + RewardDebt *big.Int +}, error) { + return _SmartChef.Contract.UserInfo(&_SmartChef.CallOpts, arg0) +} + +// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// +// Solidity: function deposit(uint256 _amount) returns() +func (_SmartChef *SmartChefTransactor) Deposit(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "deposit", _amount) +} + +// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// +// Solidity: function deposit(uint256 _amount) returns() +func (_SmartChef *SmartChefSession) Deposit(_amount *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.Deposit(&_SmartChef.TransactOpts, _amount) +} + +// Deposit is a paid mutator transaction binding the contract method 0xb6b55f25. +// +// Solidity: function deposit(uint256 _amount) returns() +func (_SmartChef *SmartChefTransactorSession) Deposit(_amount *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.Deposit(&_SmartChef.TransactOpts, _amount) +} + +// EmergencyRewardWithdraw is a paid mutator transaction binding the contract method 0x3279beab. +// +// Solidity: function emergencyRewardWithdraw(uint256 _amount) returns() +func (_SmartChef *SmartChefTransactor) EmergencyRewardWithdraw(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "emergencyRewardWithdraw", _amount) +} + +// EmergencyRewardWithdraw is a paid mutator transaction binding the contract method 0x3279beab. +// +// Solidity: function emergencyRewardWithdraw(uint256 _amount) returns() +func (_SmartChef *SmartChefSession) EmergencyRewardWithdraw(_amount *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.EmergencyRewardWithdraw(&_SmartChef.TransactOpts, _amount) +} + +// EmergencyRewardWithdraw is a paid mutator transaction binding the contract method 0x3279beab. +// +// Solidity: function emergencyRewardWithdraw(uint256 _amount) returns() +func (_SmartChef *SmartChefTransactorSession) EmergencyRewardWithdraw(_amount *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.EmergencyRewardWithdraw(&_SmartChef.TransactOpts, _amount) +} + +// EmergencyWithdraw is a paid mutator transaction binding the contract method 0xdb2e21bc. +// +// Solidity: function emergencyWithdraw() returns() +func (_SmartChef *SmartChefTransactor) EmergencyWithdraw(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "emergencyWithdraw") +} + +// EmergencyWithdraw is a paid mutator transaction binding the contract method 0xdb2e21bc. +// +// Solidity: function emergencyWithdraw() returns() +func (_SmartChef *SmartChefSession) EmergencyWithdraw() (*types.Transaction, error) { + return _SmartChef.Contract.EmergencyWithdraw(&_SmartChef.TransactOpts) +} + +// EmergencyWithdraw is a paid mutator transaction binding the contract method 0xdb2e21bc. +// +// Solidity: function emergencyWithdraw() returns() +func (_SmartChef *SmartChefTransactorSession) EmergencyWithdraw() (*types.Transaction, error) { + return _SmartChef.Contract.EmergencyWithdraw(&_SmartChef.TransactOpts) +} + +// Initialize is a paid mutator transaction binding the contract method 0x83a5041c. +// +// Solidity: function initialize(address _stakedToken, address _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, address _admin) returns() +func (_SmartChef *SmartChefTransactor) Initialize(opts *bind.TransactOpts, _stakedToken common.Address, _rewardToken common.Address, _rewardPerBlock *big.Int, _startBlock *big.Int, _bonusEndBlock *big.Int, _poolLimitPerUser *big.Int, _admin common.Address) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "initialize", _stakedToken, _rewardToken, _rewardPerBlock, _startBlock, _bonusEndBlock, _poolLimitPerUser, _admin) +} + +// Initialize is a paid mutator transaction binding the contract method 0x83a5041c. +// +// Solidity: function initialize(address _stakedToken, address _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, address _admin) returns() +func (_SmartChef *SmartChefSession) Initialize(_stakedToken common.Address, _rewardToken common.Address, _rewardPerBlock *big.Int, _startBlock *big.Int, _bonusEndBlock *big.Int, _poolLimitPerUser *big.Int, _admin common.Address) (*types.Transaction, error) { + return _SmartChef.Contract.Initialize(&_SmartChef.TransactOpts, _stakedToken, _rewardToken, _rewardPerBlock, _startBlock, _bonusEndBlock, _poolLimitPerUser, _admin) +} + +// Initialize is a paid mutator transaction binding the contract method 0x83a5041c. +// +// Solidity: function initialize(address _stakedToken, address _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, address _admin) returns() +func (_SmartChef *SmartChefTransactorSession) Initialize(_stakedToken common.Address, _rewardToken common.Address, _rewardPerBlock *big.Int, _startBlock *big.Int, _bonusEndBlock *big.Int, _poolLimitPerUser *big.Int, _admin common.Address) (*types.Transaction, error) { + return _SmartChef.Contract.Initialize(&_SmartChef.TransactOpts, _stakedToken, _rewardToken, _rewardPerBlock, _startBlock, _bonusEndBlock, _poolLimitPerUser, _admin) +} + +// RecoverWrongTokens is a paid mutator transaction binding the contract method 0x3f138d4b. +// +// Solidity: function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) returns() +func (_SmartChef *SmartChefTransactor) RecoverWrongTokens(opts *bind.TransactOpts, _tokenAddress common.Address, _tokenAmount *big.Int) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "recoverWrongTokens", _tokenAddress, _tokenAmount) +} + +// RecoverWrongTokens is a paid mutator transaction binding the contract method 0x3f138d4b. +// +// Solidity: function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) returns() +func (_SmartChef *SmartChefSession) RecoverWrongTokens(_tokenAddress common.Address, _tokenAmount *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.RecoverWrongTokens(&_SmartChef.TransactOpts, _tokenAddress, _tokenAmount) +} + +// RecoverWrongTokens is a paid mutator transaction binding the contract method 0x3f138d4b. +// +// Solidity: function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) returns() +func (_SmartChef *SmartChefTransactorSession) RecoverWrongTokens(_tokenAddress common.Address, _tokenAmount *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.RecoverWrongTokens(&_SmartChef.TransactOpts, _tokenAddress, _tokenAmount) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_SmartChef *SmartChefTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_SmartChef *SmartChefSession) RenounceOwnership() (*types.Transaction, error) { + return _SmartChef.Contract.RenounceOwnership(&_SmartChef.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_SmartChef *SmartChefTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _SmartChef.Contract.RenounceOwnership(&_SmartChef.TransactOpts) +} + +// StopReward is a paid mutator transaction binding the contract method 0x80dc0672. +// +// Solidity: function stopReward() returns() +func (_SmartChef *SmartChefTransactor) StopReward(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "stopReward") +} + +// StopReward is a paid mutator transaction binding the contract method 0x80dc0672. +// +// Solidity: function stopReward() returns() +func (_SmartChef *SmartChefSession) StopReward() (*types.Transaction, error) { + return _SmartChef.Contract.StopReward(&_SmartChef.TransactOpts) +} + +// StopReward is a paid mutator transaction binding the contract method 0x80dc0672. +// +// Solidity: function stopReward() returns() +func (_SmartChef *SmartChefTransactorSession) StopReward() (*types.Transaction, error) { + return _SmartChef.Contract.StopReward(&_SmartChef.TransactOpts) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_SmartChef *SmartChefTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_SmartChef *SmartChefSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _SmartChef.Contract.TransferOwnership(&_SmartChef.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_SmartChef *SmartChefTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _SmartChef.Contract.TransferOwnership(&_SmartChef.TransactOpts, newOwner) +} + +// UpdatePoolLimitPerUser is a paid mutator transaction binding the contract method 0xa0b40905. +// +// Solidity: function updatePoolLimitPerUser(bool _hasUserLimit, uint256 _poolLimitPerUser) returns() +func (_SmartChef *SmartChefTransactor) UpdatePoolLimitPerUser(opts *bind.TransactOpts, _hasUserLimit bool, _poolLimitPerUser *big.Int) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "updatePoolLimitPerUser", _hasUserLimit, _poolLimitPerUser) +} + +// UpdatePoolLimitPerUser is a paid mutator transaction binding the contract method 0xa0b40905. +// +// Solidity: function updatePoolLimitPerUser(bool _hasUserLimit, uint256 _poolLimitPerUser) returns() +func (_SmartChef *SmartChefSession) UpdatePoolLimitPerUser(_hasUserLimit bool, _poolLimitPerUser *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.UpdatePoolLimitPerUser(&_SmartChef.TransactOpts, _hasUserLimit, _poolLimitPerUser) +} + +// UpdatePoolLimitPerUser is a paid mutator transaction binding the contract method 0xa0b40905. +// +// Solidity: function updatePoolLimitPerUser(bool _hasUserLimit, uint256 _poolLimitPerUser) returns() +func (_SmartChef *SmartChefTransactorSession) UpdatePoolLimitPerUser(_hasUserLimit bool, _poolLimitPerUser *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.UpdatePoolLimitPerUser(&_SmartChef.TransactOpts, _hasUserLimit, _poolLimitPerUser) +} + +// UpdateRewardPerBlock is a paid mutator transaction binding the contract method 0x01f8a976. +// +// Solidity: function updateRewardPerBlock(uint256 _rewardPerBlock) returns() +func (_SmartChef *SmartChefTransactor) UpdateRewardPerBlock(opts *bind.TransactOpts, _rewardPerBlock *big.Int) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "updateRewardPerBlock", _rewardPerBlock) +} + +// UpdateRewardPerBlock is a paid mutator transaction binding the contract method 0x01f8a976. +// +// Solidity: function updateRewardPerBlock(uint256 _rewardPerBlock) returns() +func (_SmartChef *SmartChefSession) UpdateRewardPerBlock(_rewardPerBlock *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.UpdateRewardPerBlock(&_SmartChef.TransactOpts, _rewardPerBlock) +} + +// UpdateRewardPerBlock is a paid mutator transaction binding the contract method 0x01f8a976. +// +// Solidity: function updateRewardPerBlock(uint256 _rewardPerBlock) returns() +func (_SmartChef *SmartChefTransactorSession) UpdateRewardPerBlock(_rewardPerBlock *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.UpdateRewardPerBlock(&_SmartChef.TransactOpts, _rewardPerBlock) +} + +// UpdateStartAndEndBlocks is a paid mutator transaction binding the contract method 0x9513997f. +// +// Solidity: function updateStartAndEndBlocks(uint256 _startBlock, uint256 _bonusEndBlock) returns() +func (_SmartChef *SmartChefTransactor) UpdateStartAndEndBlocks(opts *bind.TransactOpts, _startBlock *big.Int, _bonusEndBlock *big.Int) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "updateStartAndEndBlocks", _startBlock, _bonusEndBlock) +} + +// UpdateStartAndEndBlocks is a paid mutator transaction binding the contract method 0x9513997f. +// +// Solidity: function updateStartAndEndBlocks(uint256 _startBlock, uint256 _bonusEndBlock) returns() +func (_SmartChef *SmartChefSession) UpdateStartAndEndBlocks(_startBlock *big.Int, _bonusEndBlock *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.UpdateStartAndEndBlocks(&_SmartChef.TransactOpts, _startBlock, _bonusEndBlock) +} + +// UpdateStartAndEndBlocks is a paid mutator transaction binding the contract method 0x9513997f. +// +// Solidity: function updateStartAndEndBlocks(uint256 _startBlock, uint256 _bonusEndBlock) returns() +func (_SmartChef *SmartChefTransactorSession) UpdateStartAndEndBlocks(_startBlock *big.Int, _bonusEndBlock *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.UpdateStartAndEndBlocks(&_SmartChef.TransactOpts, _startBlock, _bonusEndBlock) +} + +// Withdraw is a paid mutator transaction binding the contract method 0x2e1a7d4d. +// +// Solidity: function withdraw(uint256 _amount) returns() +func (_SmartChef *SmartChefTransactor) Withdraw(opts *bind.TransactOpts, _amount *big.Int) (*types.Transaction, error) { + return _SmartChef.contract.Transact(opts, "withdraw", _amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0x2e1a7d4d. +// +// Solidity: function withdraw(uint256 _amount) returns() +func (_SmartChef *SmartChefSession) Withdraw(_amount *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.Withdraw(&_SmartChef.TransactOpts, _amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0x2e1a7d4d. +// +// Solidity: function withdraw(uint256 _amount) returns() +func (_SmartChef *SmartChefTransactorSession) Withdraw(_amount *big.Int) (*types.Transaction, error) { + return _SmartChef.Contract.Withdraw(&_SmartChef.TransactOpts, _amount) +} + +// SmartChefAdminTokenRecoveryIterator is returned from FilterAdminTokenRecovery and is used to iterate over the raw logs and unpacked data for AdminTokenRecovery events raised by the SmartChef contract. +type SmartChefAdminTokenRecoveryIterator struct { + Event *SmartChefAdminTokenRecovery // 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 *SmartChefAdminTokenRecoveryIterator) 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(SmartChefAdminTokenRecovery) + 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(SmartChefAdminTokenRecovery) + 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 *SmartChefAdminTokenRecoveryIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefAdminTokenRecoveryIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefAdminTokenRecovery represents a AdminTokenRecovery event raised by the SmartChef contract. +type SmartChefAdminTokenRecovery struct { + TokenRecovered common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAdminTokenRecovery is a free log retrieval operation binding the contract event 0x74545154aac348a3eac92596bd1971957ca94795f4e954ec5f613b55fab78129. +// +// Solidity: event AdminTokenRecovery(address tokenRecovered, uint256 amount) +func (_SmartChef *SmartChefFilterer) FilterAdminTokenRecovery(opts *bind.FilterOpts) (*SmartChefAdminTokenRecoveryIterator, error) { + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "AdminTokenRecovery") + if err != nil { + return nil, err + } + return &SmartChefAdminTokenRecoveryIterator{contract: _SmartChef.contract, event: "AdminTokenRecovery", logs: logs, sub: sub}, nil +} + +// WatchAdminTokenRecovery is a free log subscription operation binding the contract event 0x74545154aac348a3eac92596bd1971957ca94795f4e954ec5f613b55fab78129. +// +// Solidity: event AdminTokenRecovery(address tokenRecovered, uint256 amount) +func (_SmartChef *SmartChefFilterer) WatchAdminTokenRecovery(opts *bind.WatchOpts, sink chan<- *SmartChefAdminTokenRecovery) (event.Subscription, error) { + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "AdminTokenRecovery") + 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(SmartChefAdminTokenRecovery) + if err := _SmartChef.contract.UnpackLog(event, "AdminTokenRecovery", 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 +} + +// ParseAdminTokenRecovery is a log parse operation binding the contract event 0x74545154aac348a3eac92596bd1971957ca94795f4e954ec5f613b55fab78129. +// +// Solidity: event AdminTokenRecovery(address tokenRecovered, uint256 amount) +func (_SmartChef *SmartChefFilterer) ParseAdminTokenRecovery(log types.Log) (*SmartChefAdminTokenRecovery, error) { + event := new(SmartChefAdminTokenRecovery) + if err := _SmartChef.contract.UnpackLog(event, "AdminTokenRecovery", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SmartChefDepositIterator is returned from FilterDeposit and is used to iterate over the raw logs and unpacked data for Deposit events raised by the SmartChef contract. +type SmartChefDepositIterator struct { + Event *SmartChefDeposit // 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 *SmartChefDepositIterator) 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(SmartChefDeposit) + 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(SmartChefDeposit) + 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 *SmartChefDepositIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefDepositIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefDeposit represents a Deposit event raised by the SmartChef contract. +type SmartChefDeposit struct { + User common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDeposit is a free log retrieval operation binding the contract event 0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c. +// +// Solidity: event Deposit(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) FilterDeposit(opts *bind.FilterOpts, user []common.Address) (*SmartChefDepositIterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "Deposit", userRule) + if err != nil { + return nil, err + } + return &SmartChefDepositIterator{contract: _SmartChef.contract, event: "Deposit", logs: logs, sub: sub}, nil +} + +// WatchDeposit is a free log subscription operation binding the contract event 0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c. +// +// Solidity: event Deposit(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) WatchDeposit(opts *bind.WatchOpts, sink chan<- *SmartChefDeposit, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "Deposit", userRule) + 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(SmartChefDeposit) + if err := _SmartChef.contract.UnpackLog(event, "Deposit", 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 +} + +// ParseDeposit is a log parse operation binding the contract event 0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c. +// +// Solidity: event Deposit(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) ParseDeposit(log types.Log) (*SmartChefDeposit, error) { + event := new(SmartChefDeposit) + if err := _SmartChef.contract.UnpackLog(event, "Deposit", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SmartChefEmergencyWithdrawIterator is returned from FilterEmergencyWithdraw and is used to iterate over the raw logs and unpacked data for EmergencyWithdraw events raised by the SmartChef contract. +type SmartChefEmergencyWithdrawIterator struct { + Event *SmartChefEmergencyWithdraw // 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 *SmartChefEmergencyWithdrawIterator) 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(SmartChefEmergencyWithdraw) + 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(SmartChefEmergencyWithdraw) + 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 *SmartChefEmergencyWithdrawIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefEmergencyWithdrawIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefEmergencyWithdraw represents a EmergencyWithdraw event raised by the SmartChef contract. +type SmartChefEmergencyWithdraw struct { + User common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterEmergencyWithdraw is a free log retrieval operation binding the contract event 0x5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695. +// +// Solidity: event EmergencyWithdraw(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) FilterEmergencyWithdraw(opts *bind.FilterOpts, user []common.Address) (*SmartChefEmergencyWithdrawIterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "EmergencyWithdraw", userRule) + if err != nil { + return nil, err + } + return &SmartChefEmergencyWithdrawIterator{contract: _SmartChef.contract, event: "EmergencyWithdraw", logs: logs, sub: sub}, nil +} + +// WatchEmergencyWithdraw is a free log subscription operation binding the contract event 0x5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695. +// +// Solidity: event EmergencyWithdraw(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) WatchEmergencyWithdraw(opts *bind.WatchOpts, sink chan<- *SmartChefEmergencyWithdraw, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "EmergencyWithdraw", userRule) + 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(SmartChefEmergencyWithdraw) + if err := _SmartChef.contract.UnpackLog(event, "EmergencyWithdraw", 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 +} + +// ParseEmergencyWithdraw is a log parse operation binding the contract event 0x5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695. +// +// Solidity: event EmergencyWithdraw(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) ParseEmergencyWithdraw(log types.Log) (*SmartChefEmergencyWithdraw, error) { + event := new(SmartChefEmergencyWithdraw) + if err := _SmartChef.contract.UnpackLog(event, "EmergencyWithdraw", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SmartChefNewPoolLimitIterator is returned from FilterNewPoolLimit and is used to iterate over the raw logs and unpacked data for NewPoolLimit events raised by the SmartChef contract. +type SmartChefNewPoolLimitIterator struct { + Event *SmartChefNewPoolLimit // 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 *SmartChefNewPoolLimitIterator) 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(SmartChefNewPoolLimit) + 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(SmartChefNewPoolLimit) + 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 *SmartChefNewPoolLimitIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefNewPoolLimitIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefNewPoolLimit represents a NewPoolLimit event raised by the SmartChef contract. +type SmartChefNewPoolLimit struct { + PoolLimitPerUser *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewPoolLimit is a free log retrieval operation binding the contract event 0x241f67ee5f41b7a5cabf911367329be7215900f602ebfc47f89dce2a6bcd847c. +// +// Solidity: event NewPoolLimit(uint256 poolLimitPerUser) +func (_SmartChef *SmartChefFilterer) FilterNewPoolLimit(opts *bind.FilterOpts) (*SmartChefNewPoolLimitIterator, error) { + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "NewPoolLimit") + if err != nil { + return nil, err + } + return &SmartChefNewPoolLimitIterator{contract: _SmartChef.contract, event: "NewPoolLimit", logs: logs, sub: sub}, nil +} + +// WatchNewPoolLimit is a free log subscription operation binding the contract event 0x241f67ee5f41b7a5cabf911367329be7215900f602ebfc47f89dce2a6bcd847c. +// +// Solidity: event NewPoolLimit(uint256 poolLimitPerUser) +func (_SmartChef *SmartChefFilterer) WatchNewPoolLimit(opts *bind.WatchOpts, sink chan<- *SmartChefNewPoolLimit) (event.Subscription, error) { + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "NewPoolLimit") + 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(SmartChefNewPoolLimit) + if err := _SmartChef.contract.UnpackLog(event, "NewPoolLimit", 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 +} + +// ParseNewPoolLimit is a log parse operation binding the contract event 0x241f67ee5f41b7a5cabf911367329be7215900f602ebfc47f89dce2a6bcd847c. +// +// Solidity: event NewPoolLimit(uint256 poolLimitPerUser) +func (_SmartChef *SmartChefFilterer) ParseNewPoolLimit(log types.Log) (*SmartChefNewPoolLimit, error) { + event := new(SmartChefNewPoolLimit) + if err := _SmartChef.contract.UnpackLog(event, "NewPoolLimit", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SmartChefNewRewardPerBlockIterator is returned from FilterNewRewardPerBlock and is used to iterate over the raw logs and unpacked data for NewRewardPerBlock events raised by the SmartChef contract. +type SmartChefNewRewardPerBlockIterator struct { + Event *SmartChefNewRewardPerBlock // 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 *SmartChefNewRewardPerBlockIterator) 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(SmartChefNewRewardPerBlock) + 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(SmartChefNewRewardPerBlock) + 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 *SmartChefNewRewardPerBlockIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefNewRewardPerBlockIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefNewRewardPerBlock represents a NewRewardPerBlock event raised by the SmartChef contract. +type SmartChefNewRewardPerBlock struct { + RewardPerBlock *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewRewardPerBlock is a free log retrieval operation binding the contract event 0x0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df. +// +// Solidity: event NewRewardPerBlock(uint256 rewardPerBlock) +func (_SmartChef *SmartChefFilterer) FilterNewRewardPerBlock(opts *bind.FilterOpts) (*SmartChefNewRewardPerBlockIterator, error) { + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "NewRewardPerBlock") + if err != nil { + return nil, err + } + return &SmartChefNewRewardPerBlockIterator{contract: _SmartChef.contract, event: "NewRewardPerBlock", logs: logs, sub: sub}, nil +} + +// WatchNewRewardPerBlock is a free log subscription operation binding the contract event 0x0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df. +// +// Solidity: event NewRewardPerBlock(uint256 rewardPerBlock) +func (_SmartChef *SmartChefFilterer) WatchNewRewardPerBlock(opts *bind.WatchOpts, sink chan<- *SmartChefNewRewardPerBlock) (event.Subscription, error) { + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "NewRewardPerBlock") + 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(SmartChefNewRewardPerBlock) + if err := _SmartChef.contract.UnpackLog(event, "NewRewardPerBlock", 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 +} + +// ParseNewRewardPerBlock is a log parse operation binding the contract event 0x0c4d677eef92893ac7ec52faf8140fc6c851ab4736302b4f3a89dfb20696a0df. +// +// Solidity: event NewRewardPerBlock(uint256 rewardPerBlock) +func (_SmartChef *SmartChefFilterer) ParseNewRewardPerBlock(log types.Log) (*SmartChefNewRewardPerBlock, error) { + event := new(SmartChefNewRewardPerBlock) + if err := _SmartChef.contract.UnpackLog(event, "NewRewardPerBlock", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SmartChefNewStartAndEndBlocksIterator is returned from FilterNewStartAndEndBlocks and is used to iterate over the raw logs and unpacked data for NewStartAndEndBlocks events raised by the SmartChef contract. +type SmartChefNewStartAndEndBlocksIterator struct { + Event *SmartChefNewStartAndEndBlocks // 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 *SmartChefNewStartAndEndBlocksIterator) 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(SmartChefNewStartAndEndBlocks) + 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(SmartChefNewStartAndEndBlocks) + 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 *SmartChefNewStartAndEndBlocksIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefNewStartAndEndBlocksIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefNewStartAndEndBlocks represents a NewStartAndEndBlocks event raised by the SmartChef contract. +type SmartChefNewStartAndEndBlocks struct { + StartBlock *big.Int + EndBlock *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterNewStartAndEndBlocks is a free log retrieval operation binding the contract event 0x7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce06. +// +// Solidity: event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock) +func (_SmartChef *SmartChefFilterer) FilterNewStartAndEndBlocks(opts *bind.FilterOpts) (*SmartChefNewStartAndEndBlocksIterator, error) { + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "NewStartAndEndBlocks") + if err != nil { + return nil, err + } + return &SmartChefNewStartAndEndBlocksIterator{contract: _SmartChef.contract, event: "NewStartAndEndBlocks", logs: logs, sub: sub}, nil +} + +// WatchNewStartAndEndBlocks is a free log subscription operation binding the contract event 0x7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce06. +// +// Solidity: event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock) +func (_SmartChef *SmartChefFilterer) WatchNewStartAndEndBlocks(opts *bind.WatchOpts, sink chan<- *SmartChefNewStartAndEndBlocks) (event.Subscription, error) { + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "NewStartAndEndBlocks") + 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(SmartChefNewStartAndEndBlocks) + if err := _SmartChef.contract.UnpackLog(event, "NewStartAndEndBlocks", 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 +} + +// ParseNewStartAndEndBlocks is a log parse operation binding the contract event 0x7cd0ab87d19036f3dfadadb232c78aa4879dda3f0c994a9d637532410ee2ce06. +// +// Solidity: event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock) +func (_SmartChef *SmartChefFilterer) ParseNewStartAndEndBlocks(log types.Log) (*SmartChefNewStartAndEndBlocks, error) { + event := new(SmartChefNewStartAndEndBlocks) + if err := _SmartChef.contract.UnpackLog(event, "NewStartAndEndBlocks", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SmartChefOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the SmartChef contract. +type SmartChefOwnershipTransferredIterator struct { + Event *SmartChefOwnershipTransferred // 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 *SmartChefOwnershipTransferredIterator) 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(SmartChefOwnershipTransferred) + 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(SmartChefOwnershipTransferred) + 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 *SmartChefOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefOwnershipTransferred represents a OwnershipTransferred event raised by the SmartChef contract. +type SmartChefOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_SmartChef *SmartChefFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*SmartChefOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &SmartChefOwnershipTransferredIterator{contract: _SmartChef.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_SmartChef *SmartChefFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *SmartChefOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + 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(SmartChefOwnershipTransferred) + if err := _SmartChef.contract.UnpackLog(event, "OwnershipTransferred", 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 +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_SmartChef *SmartChefFilterer) ParseOwnershipTransferred(log types.Log) (*SmartChefOwnershipTransferred, error) { + event := new(SmartChefOwnershipTransferred) + if err := _SmartChef.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SmartChefRewardsStopIterator is returned from FilterRewardsStop and is used to iterate over the raw logs and unpacked data for RewardsStop events raised by the SmartChef contract. +type SmartChefRewardsStopIterator struct { + Event *SmartChefRewardsStop // 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 *SmartChefRewardsStopIterator) 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(SmartChefRewardsStop) + 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(SmartChefRewardsStop) + 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 *SmartChefRewardsStopIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefRewardsStopIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefRewardsStop represents a RewardsStop event raised by the SmartChef contract. +type SmartChefRewardsStop struct { + BlockNumber *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRewardsStop is a free log retrieval operation binding the contract event 0xfed9fcb0ca3d1e761a4b929792bb24082fba92dca81252646ad306d306806566. +// +// Solidity: event RewardsStop(uint256 blockNumber) +func (_SmartChef *SmartChefFilterer) FilterRewardsStop(opts *bind.FilterOpts) (*SmartChefRewardsStopIterator, error) { + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "RewardsStop") + if err != nil { + return nil, err + } + return &SmartChefRewardsStopIterator{contract: _SmartChef.contract, event: "RewardsStop", logs: logs, sub: sub}, nil +} + +// WatchRewardsStop is a free log subscription operation binding the contract event 0xfed9fcb0ca3d1e761a4b929792bb24082fba92dca81252646ad306d306806566. +// +// Solidity: event RewardsStop(uint256 blockNumber) +func (_SmartChef *SmartChefFilterer) WatchRewardsStop(opts *bind.WatchOpts, sink chan<- *SmartChefRewardsStop) (event.Subscription, error) { + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "RewardsStop") + 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(SmartChefRewardsStop) + if err := _SmartChef.contract.UnpackLog(event, "RewardsStop", 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 +} + +// ParseRewardsStop is a log parse operation binding the contract event 0xfed9fcb0ca3d1e761a4b929792bb24082fba92dca81252646ad306d306806566. +// +// Solidity: event RewardsStop(uint256 blockNumber) +func (_SmartChef *SmartChefFilterer) ParseRewardsStop(log types.Log) (*SmartChefRewardsStop, error) { + event := new(SmartChefRewardsStop) + if err := _SmartChef.contract.UnpackLog(event, "RewardsStop", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SmartChefWithdrawIterator is returned from FilterWithdraw and is used to iterate over the raw logs and unpacked data for Withdraw events raised by the SmartChef contract. +type SmartChefWithdrawIterator struct { + Event *SmartChefWithdraw // 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 *SmartChefWithdrawIterator) 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(SmartChefWithdraw) + 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(SmartChefWithdraw) + 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 *SmartChefWithdrawIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SmartChefWithdrawIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SmartChefWithdraw represents a Withdraw event raised by the SmartChef contract. +type SmartChefWithdraw struct { + User common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterWithdraw is a free log retrieval operation binding the contract event 0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364. +// +// Solidity: event Withdraw(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) FilterWithdraw(opts *bind.FilterOpts, user []common.Address) (*SmartChefWithdrawIterator, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _SmartChef.contract.FilterLogs(opts, "Withdraw", userRule) + if err != nil { + return nil, err + } + return &SmartChefWithdrawIterator{contract: _SmartChef.contract, event: "Withdraw", logs: logs, sub: sub}, nil +} + +// WatchWithdraw is a free log subscription operation binding the contract event 0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364. +// +// Solidity: event Withdraw(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) WatchWithdraw(opts *bind.WatchOpts, sink chan<- *SmartChefWithdraw, user []common.Address) (event.Subscription, error) { + + var userRule []interface{} + for _, userItem := range user { + userRule = append(userRule, userItem) + } + + logs, sub, err := _SmartChef.contract.WatchLogs(opts, "Withdraw", userRule) + 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(SmartChefWithdraw) + if err := _SmartChef.contract.UnpackLog(event, "Withdraw", 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 +} + +// ParseWithdraw is a log parse operation binding the contract event 0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364. +// +// Solidity: event Withdraw(address indexed user, uint256 amount) +func (_SmartChef *SmartChefFilterer) ParseWithdraw(log types.Log) (*SmartChefWithdraw, error) { + event := new(SmartChefWithdraw) + if err := _SmartChef.contract.UnpackLog(event, "Withdraw", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pancakeswap/smartchef.go b/pancakeswap/smartchef.go new file mode 100644 index 0000000..51ce40d --- /dev/null +++ b/pancakeswap/smartchef.go @@ -0,0 +1,35 @@ +package pancakeswap + +import ( + "context" + "math/big" + + "git.lehouerou.net/laurent/evm" + "git.lehouerou.net/laurent/evm/bsc" + "git.lehouerou.net/laurent/evm/pancakeswap/contracts" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/pkg/errors" +) + +type SmartChef struct { + client *bsc.Client + contract *contracts.SmartChef +} + +func NewSmartChef(client *bsc.Client, address common.Address) (*SmartChef, error) { + contract, err := contracts.NewSmartChef(address, client) + if err != nil { + return nil, errors.Wrap(err, "init contract") + } + return &SmartChef{ + client: client, + contract: contract, + }, nil +} + +func (s *SmartChef) Harvest(ctx context.Context) (evm.Transaction, error) { + return s.client.Execute(ctx, func(ctx context.Context, opts *evm.TransactOpts) (*types.Transaction, error) { + return s.contract.Deposit(opts.TransactOpts, big.NewInt(0)) + }) +}