oracle.go 25 KB

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