github.com/XinFinOrg/xdcchain@v1.1.0/contracts/blocksigner/contract/blocksigner.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 "github.com/ethereum/go-ethereum" 11 "github.com/ethereum/go-ethereum/accounts/abi" 12 "github.com/ethereum/go-ethereum/accounts/abi/bind" 13 "github.com/ethereum/go-ethereum/common" 14 "github.com/ethereum/go-ethereum/core/types" 15 "github.com/ethereum/go-ethereum/event" 16 ) 17 18 // BlockSignerABI is the input ABI used to generate the binding from. 19 const BlockSignerABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"_blockNumber\",\"type\":\"uint256\"},{\"name\":\"_blockHash\",\"type\":\"bytes32\"}],\"name\":\"sign\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_blockHash\",\"type\":\"bytes32\"}],\"name\":\"getSigners\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_epochNumber\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_signer\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_blockNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"_blockHash\",\"type\":\"bytes32\"}],\"name\":\"Sign\",\"type\":\"event\"}]" 20 21 // BlockSignerBin is the compiled bytecode used for deploying new contracts. 22 const BlockSignerBin = `0x6060604052341561000f57600080fd5b604051602080610386833981016040528080516002555050610350806100366000396000f3006060604052600436106100565763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663e341eaa4811461005b578063e7ec6aef14610076578063f4145a83146100df575b600080fd5b341561006657600080fd5b610074600435602435610104565b005b341561008157600080fd5b61008c600435610227565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156100cb5780820151838201526020016100b3565b505050509050019250505060405180910390f35b34156100ea57600080fd5b6100f26102ac565b60405190815260200160405180910390f35b438290101561011257600080fd5b600280546101289184910263ffffffff6102b216565b43111561013457600080fd5b600082815260016020819052604090912080549091810161015583826102c8565b5060009182526020808320919091018390558282528190526040902080546001810161018183826102c8565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff19163373ffffffffffffffffffffffffffffffffffffffff8116919091179091557f62855fa22e051687c32ac285857751f6d3f2c100c72756d8d30cb7ecb1f64f5490838360405173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091526040808301919091526060909101905180910390a15050565b61022f6102f1565b600082815260208181526040918290208054909290918281020190519081016040528092919081815260200182805480156102a057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610275575b50505050509050919050565b60025481565b6000828201838110156102c157fe5b9392505050565b8154818355818115116102ec576000838152602090206102ec918101908301610303565b505050565b60206040519081016040526000815290565b61032191905b8082111561031d5760008155600101610309565b5090565b905600a165627a7a72305820a8ceddaea8e4ae00991e2ae81c8c88e160dd8770f255523282c24c2df4c30ec70029` 23 24 // DeployBlockSigner deploys a new Ethereum contract, binding an instance of BlockSigner to it. 25 func DeployBlockSigner(auth *bind.TransactOpts, backend bind.ContractBackend, _epochNumber *big.Int) (common.Address, *types.Transaction, *BlockSigner, error) { 26 parsed, err := abi.JSON(strings.NewReader(BlockSignerABI)) 27 if err != nil { 28 return common.Address{}, nil, nil, err 29 } 30 address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(BlockSignerBin), backend, _epochNumber) 31 if err != nil { 32 return common.Address{}, nil, nil, err 33 } 34 return address, tx, &BlockSigner{BlockSignerCaller: BlockSignerCaller{contract: contract}, BlockSignerTransactor: BlockSignerTransactor{contract: contract}, BlockSignerFilterer: BlockSignerFilterer{contract: contract}}, nil 35 } 36 37 // BlockSigner is an auto generated Go binding around an Ethereum contract. 38 type BlockSigner struct { 39 BlockSignerCaller // Read-only binding to the contract 40 BlockSignerTransactor // Write-only binding to the contract 41 BlockSignerFilterer // Log filterer for contract events 42 } 43 44 // BlockSignerCaller is an auto generated read-only Go binding around an Ethereum contract. 45 type BlockSignerCaller struct { 46 contract *bind.BoundContract // Generic contract wrapper for the low level calls 47 } 48 49 // BlockSignerTransactor is an auto generated write-only Go binding around an Ethereum contract. 50 type BlockSignerTransactor struct { 51 contract *bind.BoundContract // Generic contract wrapper for the low level calls 52 } 53 54 // BlockSignerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. 55 type BlockSignerFilterer struct { 56 contract *bind.BoundContract // Generic contract wrapper for the low level calls 57 } 58 59 // BlockSignerSession is an auto generated Go binding around an Ethereum contract, 60 // with pre-set call and transact options. 61 type BlockSignerSession struct { 62 Contract *BlockSigner // 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 // BlockSignerCallerSession is an auto generated read-only Go binding around an Ethereum contract, 68 // with pre-set call options. 69 type BlockSignerCallerSession struct { 70 Contract *BlockSignerCaller // Generic contract caller binding to set the session for 71 CallOpts bind.CallOpts // Call options to use throughout this session 72 } 73 74 // BlockSignerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, 75 // with pre-set transact options. 76 type BlockSignerTransactorSession struct { 77 Contract *BlockSignerTransactor // Generic contract transactor binding to set the session for 78 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 79 } 80 81 // BlockSignerRaw is an auto generated low-level Go binding around an Ethereum contract. 82 type BlockSignerRaw struct { 83 Contract *BlockSigner // Generic contract binding to access the raw methods on 84 } 85 86 // BlockSignerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 87 type BlockSignerCallerRaw struct { 88 Contract *BlockSignerCaller // Generic read-only contract binding to access the raw methods on 89 } 90 91 // BlockSignerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 92 type BlockSignerTransactorRaw struct { 93 Contract *BlockSignerTransactor // Generic write-only contract binding to access the raw methods on 94 } 95 96 // NewBlockSigner creates a new instance of BlockSigner, bound to a specific deployed contract. 97 func NewBlockSigner(address common.Address, backend bind.ContractBackend) (*BlockSigner, error) { 98 contract, err := bindBlockSigner(address, backend, backend, backend) 99 if err != nil { 100 return nil, err 101 } 102 return &BlockSigner{BlockSignerCaller: BlockSignerCaller{contract: contract}, BlockSignerTransactor: BlockSignerTransactor{contract: contract}, BlockSignerFilterer: BlockSignerFilterer{contract: contract}}, nil 103 } 104 105 // NewBlockSignerCaller creates a new read-only instance of BlockSigner, bound to a specific deployed contract. 106 func NewBlockSignerCaller(address common.Address, caller bind.ContractCaller) (*BlockSignerCaller, error) { 107 contract, err := bindBlockSigner(address, caller, nil, nil) 108 if err != nil { 109 return nil, err 110 } 111 return &BlockSignerCaller{contract: contract}, nil 112 } 113 114 // NewBlockSignerTransactor creates a new write-only instance of BlockSigner, bound to a specific deployed contract. 115 func NewBlockSignerTransactor(address common.Address, transactor bind.ContractTransactor) (*BlockSignerTransactor, error) { 116 contract, err := bindBlockSigner(address, nil, transactor, nil) 117 if err != nil { 118 return nil, err 119 } 120 return &BlockSignerTransactor{contract: contract}, nil 121 } 122 123 // NewBlockSignerFilterer creates a new log filterer instance of BlockSigner, bound to a specific deployed contract. 124 func NewBlockSignerFilterer(address common.Address, filterer bind.ContractFilterer) (*BlockSignerFilterer, error) { 125 contract, err := bindBlockSigner(address, nil, nil, filterer) 126 if err != nil { 127 return nil, err 128 } 129 return &BlockSignerFilterer{contract: contract}, nil 130 } 131 132 // bindBlockSigner binds a generic wrapper to an already deployed contract. 133 func bindBlockSigner(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { 134 parsed, err := abi.JSON(strings.NewReader(BlockSignerABI)) 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 (_BlockSigner *BlockSignerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { 146 return _BlockSigner.Contract.BlockSignerCaller.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 (_BlockSigner *BlockSignerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 152 return _BlockSigner.Contract.BlockSignerTransactor.contract.Transfer(opts) 153 } 154 155 // Transact invokes the (paid) contract method with params as input values. 156 func (_BlockSigner *BlockSignerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 157 return _BlockSigner.Contract.BlockSignerTransactor.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 (_BlockSigner *BlockSignerCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { 165 return _BlockSigner.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 (_BlockSigner *BlockSignerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 171 return _BlockSigner.Contract.contract.Transfer(opts) 172 } 173 174 // Transact invokes the (paid) contract method with params as input values. 175 func (_BlockSigner *BlockSignerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 176 return _BlockSigner.Contract.contract.Transact(opts, method, params...) 177 } 178 179 // EpochNumber is a free data retrieval call binding the contract method 0xf4145a83. 180 // 181 // Solidity: function epochNumber() constant returns(uint256) 182 func (_BlockSigner *BlockSignerCaller) EpochNumber(opts *bind.CallOpts) (*big.Int, error) { 183 var ( 184 ret0 = new(*big.Int) 185 ) 186 out := ret0 187 err := _BlockSigner.contract.Call(opts, out, "epochNumber") 188 return *ret0, err 189 } 190 191 // EpochNumber is a free data retrieval call binding the contract method 0xf4145a83. 192 // 193 // Solidity: function epochNumber() constant returns(uint256) 194 func (_BlockSigner *BlockSignerSession) EpochNumber() (*big.Int, error) { 195 return _BlockSigner.Contract.EpochNumber(&_BlockSigner.CallOpts) 196 } 197 198 // EpochNumber is a free data retrieval call binding the contract method 0xf4145a83. 199 // 200 // Solidity: function epochNumber() constant returns(uint256) 201 func (_BlockSigner *BlockSignerCallerSession) EpochNumber() (*big.Int, error) { 202 return _BlockSigner.Contract.EpochNumber(&_BlockSigner.CallOpts) 203 } 204 205 // GetSigners is a free data retrieval call binding the contract method 0xe7ec6aef. 206 // 207 // Solidity: function getSigners(_blockHash bytes32) constant returns(address[]) 208 func (_BlockSigner *BlockSignerCaller) GetSigners(opts *bind.CallOpts, _blockHash [32]byte) ([]common.Address, error) { 209 var ( 210 ret0 = new([]common.Address) 211 ) 212 out := ret0 213 err := _BlockSigner.contract.Call(opts, out, "getSigners", _blockHash) 214 return *ret0, err 215 } 216 217 // GetSigners is a free data retrieval call binding the contract method 0xe7ec6aef. 218 // 219 // Solidity: function getSigners(_blockHash bytes32) constant returns(address[]) 220 func (_BlockSigner *BlockSignerSession) GetSigners(_blockHash [32]byte) ([]common.Address, error) { 221 return _BlockSigner.Contract.GetSigners(&_BlockSigner.CallOpts, _blockHash) 222 } 223 224 // GetSigners is a free data retrieval call binding the contract method 0xe7ec6aef. 225 // 226 // Solidity: function getSigners(_blockHash bytes32) constant returns(address[]) 227 func (_BlockSigner *BlockSignerCallerSession) GetSigners(_blockHash [32]byte) ([]common.Address, error) { 228 return _BlockSigner.Contract.GetSigners(&_BlockSigner.CallOpts, _blockHash) 229 } 230 231 // Sign is a paid mutator transaction binding the contract method 0xe341eaa4. 232 // 233 // Solidity: function sign(_blockNumber uint256, _blockHash bytes32) returns() 234 func (_BlockSigner *BlockSignerTransactor) Sign(opts *bind.TransactOpts, _blockNumber *big.Int, _blockHash [32]byte) (*types.Transaction, error) { 235 return _BlockSigner.contract.Transact(opts, "sign", _blockNumber, _blockHash) 236 } 237 238 // Sign is a paid mutator transaction binding the contract method 0xe341eaa4. 239 // 240 // Solidity: function sign(_blockNumber uint256, _blockHash bytes32) returns() 241 func (_BlockSigner *BlockSignerSession) Sign(_blockNumber *big.Int, _blockHash [32]byte) (*types.Transaction, error) { 242 return _BlockSigner.Contract.Sign(&_BlockSigner.TransactOpts, _blockNumber, _blockHash) 243 } 244 245 // Sign is a paid mutator transaction binding the contract method 0xe341eaa4. 246 // 247 // Solidity: function sign(_blockNumber uint256, _blockHash bytes32) returns() 248 func (_BlockSigner *BlockSignerTransactorSession) Sign(_blockNumber *big.Int, _blockHash [32]byte) (*types.Transaction, error) { 249 return _BlockSigner.Contract.Sign(&_BlockSigner.TransactOpts, _blockNumber, _blockHash) 250 } 251 252 // BlockSignerSignIterator is returned from FilterSign and is used to iterate over the raw logs and unpacked data for Sign events raised by the BlockSigner contract. 253 type BlockSignerSignIterator struct { 254 Event *BlockSignerSign // Event containing the contract specifics and raw log 255 256 contract *bind.BoundContract // Generic contract to use for unpacking event data 257 event string // Event name to use for unpacking event data 258 259 logs chan types.Log // Log channel receiving the found contract events 260 sub ethereum.Subscription // Subscription for errors, completion and termination 261 done bool // Whether the subscription completed delivering logs 262 fail error // Occurred error to stop iteration 263 } 264 265 // Next advances the iterator to the subsequent event, returning whether there 266 // are any more events found. In case of a retrieval or parsing error, false is 267 // returned and Error() can be queried for the exact failure. 268 func (it *BlockSignerSignIterator) Next() bool { 269 // If the iterator failed, stop iterating 270 if it.fail != nil { 271 return false 272 } 273 // If the iterator completed, deliver directly whatever's available 274 if it.done { 275 select { 276 case log := <-it.logs: 277 it.Event = new(BlockSignerSign) 278 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 279 it.fail = err 280 return false 281 } 282 it.Event.Raw = log 283 return true 284 285 default: 286 return false 287 } 288 } 289 // Iterator still in progress, wait for either a data or an error event 290 select { 291 case log := <-it.logs: 292 it.Event = new(BlockSignerSign) 293 if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 294 it.fail = err 295 return false 296 } 297 it.Event.Raw = log 298 return true 299 300 case err := <-it.sub.Err(): 301 it.done = true 302 it.fail = err 303 return it.Next() 304 } 305 } 306 307 // Error returns any retrieval or parsing error occurred during filtering. 308 func (it *BlockSignerSignIterator) Error() error { 309 return it.fail 310 } 311 312 // Close terminates the iteration process, releasing any pending underlying 313 // resources. 314 func (it *BlockSignerSignIterator) Close() error { 315 it.sub.Unsubscribe() 316 return nil 317 } 318 319 // BlockSignerSign represents a Sign event raised by the BlockSigner contract. 320 type BlockSignerSign struct { 321 Signer common.Address 322 BlockNumber *big.Int 323 BlockHash [32]byte 324 Raw types.Log // Blockchain specific contextual infos 325 } 326 327 // FilterSign is a free log retrieval operation binding the contract event 0x62855fa22e051687c32ac285857751f6d3f2c100c72756d8d30cb7ecb1f64f54. 328 // 329 // Solidity: event Sign(_signer address, _blockNumber uint256, _blockHash bytes32) 330 func (_BlockSigner *BlockSignerFilterer) FilterSign(opts *bind.FilterOpts) (*BlockSignerSignIterator, error) { 331 332 logs, sub, err := _BlockSigner.contract.FilterLogs(opts, "Sign") 333 if err != nil { 334 return nil, err 335 } 336 return &BlockSignerSignIterator{contract: _BlockSigner.contract, event: "Sign", logs: logs, sub: sub}, nil 337 } 338 339 // WatchSign is a free log subscription operation binding the contract event 0x62855fa22e051687c32ac285857751f6d3f2c100c72756d8d30cb7ecb1f64f54. 340 // 341 // Solidity: event Sign(_signer address, _blockNumber uint256, _blockHash bytes32) 342 func (_BlockSigner *BlockSignerFilterer) WatchSign(opts *bind.WatchOpts, sink chan<- *BlockSignerSign) (event.Subscription, error) { 343 344 logs, sub, err := _BlockSigner.contract.WatchLogs(opts, "Sign") 345 if err != nil { 346 return nil, err 347 } 348 return event.NewSubscription(func(quit <-chan struct{}) error { 349 defer sub.Unsubscribe() 350 for { 351 select { 352 case log := <-logs: 353 // New log arrived, parse the event and forward to the user 354 event := new(BlockSignerSign) 355 if err := _BlockSigner.contract.UnpackLog(event, "Sign", log); err != nil { 356 return err 357 } 358 event.Raw = log 359 360 select { 361 case sink <- event: 362 case err := <-sub.Err(): 363 return err 364 case <-quit: 365 return nil 366 } 367 case err := <-sub.Err(): 368 return err 369 case <-quit: 370 return nil 371 } 372 } 373 }), nil 374 } 375 376 // SafeMathABI is the input ABI used to generate the binding from. 377 const SafeMathABI = "[]" 378 379 // SafeMathBin is the compiled bytecode used for deploying new contracts. 380 const SafeMathBin = `0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146060604052600080fd00a165627a7a72305820b9407d48ebc7efee5c9f08b3b3a957df2939281f5913225e8c1291f069b900490029` 381 382 // DeploySafeMath deploys a new Ethereum contract, binding an instance of SafeMath to it. 383 func DeploySafeMath(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *SafeMath, error) { 384 parsed, err := abi.JSON(strings.NewReader(SafeMathABI)) 385 if err != nil { 386 return common.Address{}, nil, nil, err 387 } 388 address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(SafeMathBin), backend) 389 if err != nil { 390 return common.Address{}, nil, nil, err 391 } 392 return address, tx, &SafeMath{SafeMathCaller: SafeMathCaller{contract: contract}, SafeMathTransactor: SafeMathTransactor{contract: contract}, SafeMathFilterer: SafeMathFilterer{contract: contract}}, nil 393 } 394 395 // SafeMath is an auto generated Go binding around an Ethereum contract. 396 type SafeMath struct { 397 SafeMathCaller // Read-only binding to the contract 398 SafeMathTransactor // Write-only binding to the contract 399 SafeMathFilterer // Log filterer for contract events 400 } 401 402 // SafeMathCaller is an auto generated read-only Go binding around an Ethereum contract. 403 type SafeMathCaller struct { 404 contract *bind.BoundContract // Generic contract wrapper for the low level calls 405 } 406 407 // SafeMathTransactor is an auto generated write-only Go binding around an Ethereum contract. 408 type SafeMathTransactor struct { 409 contract *bind.BoundContract // Generic contract wrapper for the low level calls 410 } 411 412 // SafeMathFilterer is an auto generated log filtering Go binding around an Ethereum contract events. 413 type SafeMathFilterer struct { 414 contract *bind.BoundContract // Generic contract wrapper for the low level calls 415 } 416 417 // SafeMathSession is an auto generated Go binding around an Ethereum contract, 418 // with pre-set call and transact options. 419 type SafeMathSession struct { 420 Contract *SafeMath // Generic contract binding to set the session for 421 CallOpts bind.CallOpts // Call options to use throughout this session 422 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 423 } 424 425 // SafeMathCallerSession is an auto generated read-only Go binding around an Ethereum contract, 426 // with pre-set call options. 427 type SafeMathCallerSession struct { 428 Contract *SafeMathCaller // Generic contract caller binding to set the session for 429 CallOpts bind.CallOpts // Call options to use throughout this session 430 } 431 432 // SafeMathTransactorSession is an auto generated write-only Go binding around an Ethereum contract, 433 // with pre-set transact options. 434 type SafeMathTransactorSession struct { 435 Contract *SafeMathTransactor // Generic contract transactor binding to set the session for 436 TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 437 } 438 439 // SafeMathRaw is an auto generated low-level Go binding around an Ethereum contract. 440 type SafeMathRaw struct { 441 Contract *SafeMath // Generic contract binding to access the raw methods on 442 } 443 444 // SafeMathCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 445 type SafeMathCallerRaw struct { 446 Contract *SafeMathCaller // Generic read-only contract binding to access the raw methods on 447 } 448 449 // SafeMathTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 450 type SafeMathTransactorRaw struct { 451 Contract *SafeMathTransactor // Generic write-only contract binding to access the raw methods on 452 } 453 454 // NewSafeMath creates a new instance of SafeMath, bound to a specific deployed contract. 455 func NewSafeMath(address common.Address, backend bind.ContractBackend) (*SafeMath, error) { 456 contract, err := bindSafeMath(address, backend, backend, backend) 457 if err != nil { 458 return nil, err 459 } 460 return &SafeMath{SafeMathCaller: SafeMathCaller{contract: contract}, SafeMathTransactor: SafeMathTransactor{contract: contract}, SafeMathFilterer: SafeMathFilterer{contract: contract}}, nil 461 } 462 463 // NewSafeMathCaller creates a new read-only instance of SafeMath, bound to a specific deployed contract. 464 func NewSafeMathCaller(address common.Address, caller bind.ContractCaller) (*SafeMathCaller, error) { 465 contract, err := bindSafeMath(address, caller, nil, nil) 466 if err != nil { 467 return nil, err 468 } 469 return &SafeMathCaller{contract: contract}, nil 470 } 471 472 // NewSafeMathTransactor creates a new write-only instance of SafeMath, bound to a specific deployed contract. 473 func NewSafeMathTransactor(address common.Address, transactor bind.ContractTransactor) (*SafeMathTransactor, error) { 474 contract, err := bindSafeMath(address, nil, transactor, nil) 475 if err != nil { 476 return nil, err 477 } 478 return &SafeMathTransactor{contract: contract}, nil 479 } 480 481 // NewSafeMathFilterer creates a new log filterer instance of SafeMath, bound to a specific deployed contract. 482 func NewSafeMathFilterer(address common.Address, filterer bind.ContractFilterer) (*SafeMathFilterer, error) { 483 contract, err := bindSafeMath(address, nil, nil, filterer) 484 if err != nil { 485 return nil, err 486 } 487 return &SafeMathFilterer{contract: contract}, nil 488 } 489 490 // bindSafeMath binds a generic wrapper to an already deployed contract. 491 func bindSafeMath(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { 492 parsed, err := abi.JSON(strings.NewReader(SafeMathABI)) 493 if err != nil { 494 return nil, err 495 } 496 return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil 497 } 498 499 // Call invokes the (constant) contract method with params as input values and 500 // sets the output to result. The result type might be a single field for simple 501 // returns, a slice of interfaces for anonymous returns and a struct for named 502 // returns. 503 func (_SafeMath *SafeMathRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { 504 return _SafeMath.Contract.SafeMathCaller.contract.Call(opts, result, method, params...) 505 } 506 507 // Transfer initiates a plain transaction to move funds to the contract, calling 508 // its default method if one is available. 509 func (_SafeMath *SafeMathRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 510 return _SafeMath.Contract.SafeMathTransactor.contract.Transfer(opts) 511 } 512 513 // Transact invokes the (paid) contract method with params as input values. 514 func (_SafeMath *SafeMathRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 515 return _SafeMath.Contract.SafeMathTransactor.contract.Transact(opts, method, params...) 516 } 517 518 // Call invokes the (constant) contract method with params as input values and 519 // sets the output to result. The result type might be a single field for simple 520 // returns, a slice of interfaces for anonymous returns and a struct for named 521 // returns. 522 func (_SafeMath *SafeMathCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { 523 return _SafeMath.Contract.contract.Call(opts, result, method, params...) 524 } 525 526 // Transfer initiates a plain transaction to move funds to the contract, calling 527 // its default method if one is available. 528 func (_SafeMath *SafeMathTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 529 return _SafeMath.Contract.contract.Transfer(opts) 530 } 531 532 // Transact invokes the (paid) contract method with params as input values. 533 func (_SafeMath *SafeMathTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 534 return _SafeMath.Contract.contract.Transact(opts, method, params...) 535 }