oracle.go 24 KB

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