github.com/aquanetwork/aquachain@v1.7.8/opt/contracts/chequebook/contract/chequebook.go (about)

     1  // Code generated - DO NOT EDIT.
     2  // This file is a generated binding and any manual changes will be lost.
     3  
     4  package contract
     5  
     6  import (
     7  	"math/big"
     8  	"strings"
     9  
    10  	ethereum "gitlab.com/aquachain/aquachain"
    11  	"gitlab.com/aquachain/aquachain/aqua/accounts/abi"
    12  	"gitlab.com/aquachain/aquachain/aqua/accounts/abi/bind"
    13  	"gitlab.com/aquachain/aquachain/aqua/event"
    14  	"gitlab.com/aquachain/aquachain/common"
    15  	"gitlab.com/aquachain/aquachain/core/types"
    16  )
    17  
    18  // ChequebookABI is the input ABI used to generate the binding from.
    19  const ChequebookABI = "[{\"constant\":false,\"inputs\":[],\"name\":\"kill\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"sent\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"beneficiary\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"sig_v\",\"type\":\"uint8\"},{\"name\":\"sig_r\",\"type\":\"bytes32\"},{\"name\":\"sig_s\",\"type\":\"bytes32\"}],\"name\":\"cash\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"deadbeat\",\"type\":\"address\"}],\"name\":\"Overdraft\",\"type\":\"event\"}]"
    20  
    21  // ChequebookBin is the compiled bytecode used for deploying new contracts.
    22  const ChequebookBin = `0x606060405260008054600160a060020a033316600160a060020a03199091161790556102ec806100306000396000f3006060604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b581146100585780637bf786f81461006b578063fbf788d61461009c575b005b341561006357600080fd5b6100566100ca565b341561007657600080fd5b61008a600160a060020a03600435166100f1565b60405190815260200160405180910390f35b34156100a757600080fd5b610056600160a060020a036004351660243560ff60443516606435608435610103565b60005433600160a060020a03908116911614156100ef57600054600160a060020a0316ff5b565b60016020526000908152604090205481565b600160a060020a0385166000908152600160205260408120548190861161012957600080fd5b3087876040516c01000000000000000000000000600160a060020a03948516810282529290931690910260148301526028820152604801604051809103902091506001828686866040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f115156101cf57600080fd5b505060206040510351600054600160a060020a039081169116146101f257600080fd5b50600160a060020a03808716600090815260016020526040902054860390301631811161026257600160a060020a0387166000818152600160205260409081902088905582156108fc0290839051600060405180830381858888f19350505050151561025d57600080fd5b6102b7565b6000547f2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f97890600160a060020a0316604051600160a060020a03909116815260200160405180910390a186600160a060020a0316ff5b505050505050505600a165627a7a72305820533e856fc37e3d64d1706bcc7dfb6b1d490c8d566ea498d9d01ec08965a896ca0029`
    23  
    24  // DeployChequebook deploys a new Ethereum contract, binding an instance of Chequebook to it.
    25  func DeployChequebook(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Chequebook, error) {
    26  	parsed, err := abi.JSON(strings.NewReader(ChequebookABI))
    27  	if err != nil {
    28  		return common.Address{}, nil, nil, err
    29  	}
    30  	address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ChequebookBin), backend)
    31  	if err != nil {
    32  		return common.Address{}, nil, nil, err
    33  	}
    34  	return address, tx, &Chequebook{ChequebookCaller: ChequebookCaller{contract: contract}, ChequebookTransactor: ChequebookTransactor{contract: contract}, ChequebookFilterer: ChequebookFilterer{contract: contract}}, nil
    35  }
    36  
    37  // Chequebook is an auto generated Go binding around an Ethereum contract.
    38  type Chequebook struct {
    39  	ChequebookCaller     // Read-only binding to the contract
    40  	ChequebookTransactor // Write-only binding to the contract
    41  	ChequebookFilterer   // Log filterer for contract events
    42  }
    43  
    44  // ChequebookCaller is an auto generated read-only Go binding around an Ethereum contract.
    45  type ChequebookCaller struct {
    46  	contract *bind.BoundContract // Generic contract wrapper for the low level calls
    47  }
    48  
    49  // ChequebookTransactor is an auto generated write-only Go binding around an Ethereum contract.
    50  type ChequebookTransactor struct {
    51  	contract *bind.BoundContract // Generic contract wrapper for the low level calls
    52  }
    53  
    54  // ChequebookFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
    55  type ChequebookFilterer struct {
    56  	contract *bind.BoundContract // Generic contract wrapper for the low level calls
    57  }
    58  
    59  // ChequebookSession is an auto generated Go binding around an Ethereum contract,
    60  // with pre-set call and transact options.
    61  type ChequebookSession struct {
    62  	Contract     *Chequebook       // Generic contract binding to set the session for
    63  	CallOpts     bind.CallOpts     // Call options to use throughout this session
    64  	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
    65  }
    66  
    67  // ChequebookCallerSession is an auto generated read-only Go binding around an Ethereum contract,
    68  // with pre-set call options.
    69  type ChequebookCallerSession struct {
    70  	Contract *ChequebookCaller // Generic contract caller binding to set the session for
    71  	CallOpts bind.CallOpts     // Call options to use throughout this session
    72  }
    73  
    74  // ChequebookTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
    75  // with pre-set transact options.
    76  type ChequebookTransactorSession struct {
    77  	Contract     *ChequebookTransactor // Generic contract transactor binding to set the session for
    78  	TransactOpts bind.TransactOpts     // Transaction auth options to use throughout this session
    79  }
    80  
    81  // ChequebookRaw is an auto generated low-level Go binding around an Ethereum contract.
    82  type ChequebookRaw struct {
    83  	Contract *Chequebook // Generic contract binding to access the raw methods on
    84  }
    85  
    86  // ChequebookCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
    87  type ChequebookCallerRaw struct {
    88  	Contract *ChequebookCaller // Generic read-only contract binding to access the raw methods on
    89  }
    90  
    91  // ChequebookTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
    92  type ChequebookTransactorRaw struct {
    93  	Contract *ChequebookTransactor // Generic write-only contract binding to access the raw methods on
    94  }
    95  
    96  // NewChequebook creates a new instance of Chequebook, bound to a specific deployed contract.
    97  func NewChequebook(address common.Address, backend bind.ContractBackend) (*Chequebook, error) {
    98  	contract, err := bindChequebook(address, backend, backend, backend)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &Chequebook{ChequebookCaller: ChequebookCaller{contract: contract}, ChequebookTransactor: ChequebookTransactor{contract: contract}, ChequebookFilterer: ChequebookFilterer{contract: contract}}, nil
   103  }
   104  
   105  // NewChequebookCaller creates a new read-only instance of Chequebook, bound to a specific deployed contract.
   106  func NewChequebookCaller(address common.Address, caller bind.ContractCaller) (*ChequebookCaller, error) {
   107  	contract, err := bindChequebook(address, caller, nil, nil)
   108  	if err != nil {
   109  		return nil, err
   110  	}
   111  	return &ChequebookCaller{contract: contract}, nil
   112  }
   113  
   114  // NewChequebookTransactor creates a new write-only instance of Chequebook, bound to a specific deployed contract.
   115  func NewChequebookTransactor(address common.Address, transactor bind.ContractTransactor) (*ChequebookTransactor, error) {
   116  	contract, err := bindChequebook(address, nil, transactor, nil)
   117  	if err != nil {
   118  		return nil, err
   119  	}
   120  	return &ChequebookTransactor{contract: contract}, nil
   121  }
   122  
   123  // NewChequebookFilterer creates a new log filterer instance of Chequebook, bound to a specific deployed contract.
   124  func NewChequebookFilterer(address common.Address, filterer bind.ContractFilterer) (*ChequebookFilterer, error) {
   125  	contract, err := bindChequebook(address, nil, nil, filterer)
   126  	if err != nil {
   127  		return nil, err
   128  	}
   129  	return &ChequebookFilterer{contract: contract}, nil
   130  }
   131  
   132  // bindChequebook binds a generic wrapper to an already deployed contract.
   133  func bindChequebook(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
   134  	parsed, err := abi.JSON(strings.NewReader(ChequebookABI))
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
   139  }
   140  
   141  // Call invokes the (constant) contract method with params as input values and
   142  // sets the output to result. The result type might be a single field for simple
   143  // returns, a slice of interfaces for anonymous returns and a struct for named
   144  // returns.
   145  func (_Chequebook *ChequebookRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
   146  	return _Chequebook.Contract.ChequebookCaller.contract.Call(opts, result, method, params...)
   147  }
   148  
   149  // Transfer initiates a plain transaction to move funds to the contract, calling
   150  // its default method if one is available.
   151  func (_Chequebook *ChequebookRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
   152  	return _Chequebook.Contract.ChequebookTransactor.contract.Transfer(opts)
   153  }
   154  
   155  // Transact invokes the (paid) contract method with params as input values.
   156  func (_Chequebook *ChequebookRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
   157  	return _Chequebook.Contract.ChequebookTransactor.contract.Transact(opts, method, params...)
   158  }
   159  
   160  // Call invokes the (constant) contract method with params as input values and
   161  // sets the output to result. The result type might be a single field for simple
   162  // returns, a slice of interfaces for anonymous returns and a struct for named
   163  // returns.
   164  func (_Chequebook *ChequebookCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
   165  	return _Chequebook.Contract.contract.Call(opts, result, method, params...)
   166  }
   167  
   168  // Transfer initiates a plain transaction to move funds to the contract, calling
   169  // its default method if one is available.
   170  func (_Chequebook *ChequebookTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
   171  	return _Chequebook.Contract.contract.Transfer(opts)
   172  }
   173  
   174  // Transact invokes the (paid) contract method with params as input values.
   175  func (_Chequebook *ChequebookTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
   176  	return _Chequebook.Contract.contract.Transact(opts, method, params...)
   177  }
   178  
   179  // Sent is a free data retrieval call binding the contract method 0x7bf786f8.
   180  //
   181  // Solidity: function sent( address) constant returns(uint256)
   182  func (_Chequebook *ChequebookCaller) Sent(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {
   183  	var (
   184  		ret0 = new(*big.Int)
   185  	)
   186  	out := ret0
   187  	err := _Chequebook.contract.Call(opts, out, "sent", arg0)
   188  	return *ret0, err
   189  }
   190  
   191  // Sent is a free data retrieval call binding the contract method 0x7bf786f8.
   192  //
   193  // Solidity: function sent( address) constant returns(uint256)
   194  func (_Chequebook *ChequebookSession) Sent(arg0 common.Address) (*big.Int, error) {
   195  	return _Chequebook.Contract.Sent(&_Chequebook.CallOpts, arg0)
   196  }
   197  
   198  // Sent is a free data retrieval call binding the contract method 0x7bf786f8.
   199  //
   200  // Solidity: function sent( address) constant returns(uint256)
   201  func (_Chequebook *ChequebookCallerSession) Sent(arg0 common.Address) (*big.Int, error) {
   202  	return _Chequebook.Contract.Sent(&_Chequebook.CallOpts, arg0)
   203  }
   204  
   205  // Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
   206  //
   207  // Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
   208  func (_Chequebook *ChequebookTransactor) Cash(opts *bind.TransactOpts, beneficiary common.Address, amount *big.Int, sig_v uint8, sig_r [32]byte, sig_s [32]byte) (*types.Transaction, error) {
   209  	return _Chequebook.contract.Transact(opts, "cash", beneficiary, amount, sig_v, sig_r, sig_s)
   210  }
   211  
   212  // Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
   213  //
   214  // Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
   215  func (_Chequebook *ChequebookSession) Cash(beneficiary common.Address, amount *big.Int, sig_v uint8, sig_r [32]byte, sig_s [32]byte) (*types.Transaction, error) {
   216  	return _Chequebook.Contract.Cash(&_Chequebook.TransactOpts, beneficiary, amount, sig_v, sig_r, sig_s)
   217  }
   218  
   219  // Cash is a paid mutator transaction binding the contract method 0xfbf788d6.
   220  //
   221  // Solidity: function cash(beneficiary address, amount uint256, sig_v uint8, sig_r bytes32, sig_s bytes32) returns()
   222  func (_Chequebook *ChequebookTransactorSession) Cash(beneficiary common.Address, amount *big.Int, sig_v uint8, sig_r [32]byte, sig_s [32]byte) (*types.Transaction, error) {
   223  	return _Chequebook.Contract.Cash(&_Chequebook.TransactOpts, beneficiary, amount, sig_v, sig_r, sig_s)
   224  }
   225  
   226  // Kill is a paid mutator transaction binding the contract method 0x41c0e1b5.
   227  //
   228  // Solidity: function kill() returns()
   229  func (_Chequebook *ChequebookTransactor) Kill(opts *bind.TransactOpts) (*types.Transaction, error) {
   230  	return _Chequebook.contract.Transact(opts, "kill")
   231  }
   232  
   233  // Kill is a paid mutator transaction binding the contract method 0x41c0e1b5.
   234  //
   235  // Solidity: function kill() returns()
   236  func (_Chequebook *ChequebookSession) Kill() (*types.Transaction, error) {
   237  	return _Chequebook.Contract.Kill(&_Chequebook.TransactOpts)
   238  }
   239  
   240  // Kill is a paid mutator transaction binding the contract method 0x41c0e1b5.
   241  //
   242  // Solidity: function kill() returns()
   243  func (_Chequebook *ChequebookTransactorSession) Kill() (*types.Transaction, error) {
   244  	return _Chequebook.Contract.Kill(&_Chequebook.TransactOpts)
   245  }
   246  
   247  // ChequebookOverdraftIterator is returned from FilterOverdraft and is used to iterate over the raw logs and unpacked data for Overdraft events raised by the Chequebook contract.
   248  type ChequebookOverdraftIterator struct {
   249  	Event *ChequebookOverdraft // Event containing the contract specifics and raw log
   250  
   251  	contract *bind.BoundContract // Generic contract to use for unpacking event data
   252  	event    string              // Event name to use for unpacking event data
   253  
   254  	logs chan types.Log        // Log channel receiving the found contract events
   255  	sub  ethereum.Subscription // Subscription for errors, completion and termination
   256  	done bool                  // Whether the subscription completed delivering logs
   257  	fail error                 // Occurred error to stop iteration
   258  }
   259  
   260  // Next advances the iterator to the subsequent event, returning whether there
   261  // are any more events found. In case of a retrieval or parsing error, false is
   262  // returned and Error() can be queried for the exact failure.
   263  func (it *ChequebookOverdraftIterator) Next() bool {
   264  	// If the iterator failed, stop iterating
   265  	if it.fail != nil {
   266  		return false
   267  	}
   268  	// If the iterator completed, deliver directly whatever's available
   269  	if it.done {
   270  		select {
   271  		case log := <-it.logs:
   272  			it.Event = new(ChequebookOverdraft)
   273  			if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
   274  				it.fail = err
   275  				return false
   276  			}
   277  			it.Event.Raw = log
   278  			return true
   279  
   280  		default:
   281  			return false
   282  		}
   283  	}
   284  	// Iterator still in progress, wait for either a data or an error event
   285  	select {
   286  	case log := <-it.logs:
   287  		it.Event = new(ChequebookOverdraft)
   288  		if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
   289  			it.fail = err
   290  			return false
   291  		}
   292  		it.Event.Raw = log
   293  		return true
   294  
   295  	case err := <-it.sub.Err():
   296  		it.done = true
   297  		it.fail = err
   298  		return it.Next()
   299  	}
   300  }
   301  
   302  // Error retruned any retrieval or parsing error occurred during filtering.
   303  func (it *ChequebookOverdraftIterator) Error() error {
   304  	return it.fail
   305  }
   306  
   307  // Close terminates the iteration process, releasing any pending underlying
   308  // resources.
   309  func (it *ChequebookOverdraftIterator) Close() error {
   310  	it.sub.Unsubscribe()
   311  	return nil
   312  }
   313  
   314  // ChequebookOverdraft represents a Overdraft event raised by the Chequebook contract.
   315  type ChequebookOverdraft struct {
   316  	Deadbeat common.Address
   317  	Raw      types.Log // Blockchain specific contextual infos
   318  }
   319  
   320  // FilterOverdraft is a free log retrieval operation binding the contract event 0x2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f978.
   321  //
   322  // Solidity: event Overdraft(deadbeat address)
   323  func (_Chequebook *ChequebookFilterer) FilterOverdraft(opts *bind.FilterOpts) (*ChequebookOverdraftIterator, error) {
   324  
   325  	logs, sub, err := _Chequebook.contract.FilterLogs(opts, "Overdraft")
   326  	if err != nil {
   327  		return nil, err
   328  	}
   329  	return &ChequebookOverdraftIterator{contract: _Chequebook.contract, event: "Overdraft", logs: logs, sub: sub}, nil
   330  }
   331  
   332  // WatchOverdraft is a free log subscription operation binding the contract event 0x2250e2993c15843b32621c89447cc589ee7a9f049c026986e545d3c2c0c6f978.
   333  //
   334  // Solidity: event Overdraft(deadbeat address)
   335  func (_Chequebook *ChequebookFilterer) WatchOverdraft(opts *bind.WatchOpts, sink chan<- *ChequebookOverdraft) (event.Subscription, error) {
   336  
   337  	logs, sub, err := _Chequebook.contract.WatchLogs(opts, "Overdraft")
   338  	if err != nil {
   339  		return nil, err
   340  	}
   341  	return event.NewSubscription(func(quit <-chan struct{}) error {
   342  		defer sub.Unsubscribe()
   343  		for {
   344  			select {
   345  			case log := <-logs:
   346  				// New log arrived, parse the event and forward to the user
   347  				event := new(ChequebookOverdraft)
   348  				if err := _Chequebook.contract.UnpackLog(event, "Overdraft", log); err != nil {
   349  					return err
   350  				}
   351  				event.Raw = log
   352  
   353  				select {
   354  				case sink <- event:
   355  				case err := <-sub.Err():
   356  					return err
   357  				case <-quit:
   358  					return nil
   359  				}
   360  			case err := <-sub.Err():
   361  				return err
   362  			case <-quit:
   363  				return nil
   364  			}
   365  		}
   366  	}), nil
   367  }