Created
December 13, 2017 14:25
-
-
Save anonymous/2deeacf8a583101b7c7bffc34901da9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is an automatically generated Go binding. Do not modify as any | |
// change will likely be lost upon the next re-generation! | |
package main | |
import ( | |
"math/big" | |
"strings" | |
) | |
// ExampleABI is the input ABI used to generate the binding from. | |
const ExampleABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"}]" | |
// ExampleBin is the compiled bytecode used for deploying new contracts. | |
const ExampleBin = `0x6060604052341561000c57fe5b5b6101608061001c6000396000f300606060405263ffffffff60e060020a60003504166370a08231811461002c578063a9059cbb1461005a575bfe5b341561003457fe5b610048600160a060020a036004351661008d565b60408051918252519081900360200190f35b341561006257fe5b610079600160a060020a03600435166024356100ac565b604080519115158252519081900360200190f35b600160a060020a0381166000908152602081905260409020545b919050565b600160a060020a0333166000908152602081905260408120548290108015906100ef5750600160a060020a03831660009081526020819052604090205482810110155b156101295750600160a060020a0333811660009081526020819052604080822080548590039055918416815220805482019055600161012d565b5060005b5b929150505600a165627a7a72305820be56c41daec03aa239a354bb861af282c0f5c490ee066a227d814362678a71620029` | |
// DeployExample deploys a new Ethereum contract, binding an instance of Example to it. | |
func DeployExample(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Example, error) { | |
parsed, err := abi.JSON(strings.NewReader(ExampleABI)) | |
if err != nil { | |
return common.Address{}, nil, nil, err | |
} | |
address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ExampleBin), backend) | |
if err != nil { | |
return common.Address{}, nil, nil, err | |
} | |
return address, tx, &Example{ExampleCaller: ExampleCaller{contract: contract}, ExampleTransactor: ExampleTransactor{contract: contract}}, nil | |
} | |
// Example is an auto generated Go binding around an Ethereum contract. | |
type Example struct { | |
ExampleCaller // Read-only binding to the contract | |
ExampleTransactor // Write-only binding to the contract | |
} | |
// ExampleCaller is an auto generated read-only Go binding around an Ethereum contract. | |
type ExampleCaller struct { | |
contract *bind.BoundContract // Generic contract wrapper for the low level calls | |
} | |
// ExampleTransactor is an auto generated write-only Go binding around an Ethereum contract. | |
type ExampleTransactor struct { | |
contract *bind.BoundContract // Generic contract wrapper for the low level calls | |
} | |
// ExampleSession is an auto generated Go binding around an Ethereum contract, | |
// with pre-set call and transact options. | |
type ExampleSession struct { | |
Contract *Example // Generic contract binding to set the session for | |
CallOpts bind.CallOpts // Call options to use throughout this session | |
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session | |
} | |
// ExampleCallerSession is an auto generated read-only Go binding around an Ethereum contract, | |
// with pre-set call options. | |
type ExampleCallerSession struct { | |
Contract *ExampleCaller // Generic contract caller binding to set the session for | |
CallOpts bind.CallOpts // Call options to use throughout this session | |
} | |
// ExampleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, | |
// with pre-set transact options. | |
type ExampleTransactorSession struct { | |
Contract *ExampleTransactor // Generic contract transactor binding to set the session for | |
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session | |
} | |
// ExampleRaw is an auto generated low-level Go binding around an Ethereum contract. | |
type ExampleRaw struct { | |
Contract *Example // Generic contract binding to access the raw methods on | |
} | |
// ExampleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. | |
type ExampleCallerRaw struct { | |
Contract *ExampleCaller // Generic read-only contract binding to access the raw methods on | |
} | |
// ExampleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. | |
type ExampleTransactorRaw struct { | |
Contract *ExampleTransactor // Generic write-only contract binding to access the raw methods on | |
} | |
// NewExample creates a new instance of Example, bound to a specific deployed contract. | |
func NewExample(address common.Address, backend bind.ContractBackend) (*Example, error) { | |
contract, err := bindExample(address, backend, backend) | |
if err != nil { | |
return nil, err | |
} | |
return &Example{ExampleCaller: ExampleCaller{contract: contract}, ExampleTransactor: ExampleTransactor{contract: contract}}, nil | |
} | |
// NewExampleCaller creates a new read-only instance of Example, bound to a specific deployed contract. | |
func NewExampleCaller(address common.Address, caller bind.ContractCaller) (*ExampleCaller, error) { | |
contract, err := bindExample(address, caller, nil) | |
if err != nil { | |
return nil, err | |
} | |
return &ExampleCaller{contract: contract}, nil | |
} | |
// NewExampleTransactor creates a new write-only instance of Example, bound to a specific deployed contract. | |
func NewExampleTransactor(address common.Address, transactor bind.ContractTransactor) (*ExampleTransactor, error) { | |
contract, err := bindExample(address, nil, transactor) | |
if err != nil { | |
return nil, err | |
} | |
return &ExampleTransactor{contract: contract}, nil | |
} | |
// bindExample binds a generic wrapper to an already deployed contract. | |
func bindExample(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { | |
parsed, err := abi.JSON(strings.NewReader(ExampleABI)) | |
if err != nil { | |
return nil, err | |
} | |
return bind.NewBoundContract(address, parsed, caller, transactor), nil | |
} | |
// Call invokes the (constant) contract method with params as input values and | |
// sets the output to result. The result type might be a single field for simple | |
// returns, a slice of interfaces for anonymous returns and a struct for named | |
// returns. | |
func (_Example *ExampleRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { | |
return _Example.Contract.ExampleCaller.contract.Call(opts, result, method, params...) | |
} | |
// Transfer initiates a plain transaction to move funds to the contract, calling | |
// its default method if one is available. | |
func (_Example *ExampleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { | |
return _Example.Contract.ExampleTransactor.contract.Transfer(opts) | |
} | |
// Transact invokes the (paid) contract method with params as input values. | |
func (_Example *ExampleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { | |
return _Example.Contract.ExampleTransactor.contract.Transact(opts, method, params...) | |
} | |
// Call invokes the (constant) contract method with params as input values and | |
// sets the output to result. The result type might be a single field for simple | |
// returns, a slice of interfaces for anonymous returns and a struct for named | |
// returns. | |
func (_Example *ExampleCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { | |
return _Example.Contract.contract.Call(opts, result, method, params...) | |
} | |
// Transfer initiates a plain transaction to move funds to the contract, calling | |
// its default method if one is available. | |
func (_Example *ExampleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { | |
return _Example.Contract.contract.Transfer(opts) | |
} | |
// Transact invokes the (paid) contract method with params as input values. | |
func (_Example *ExampleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { | |
return _Example.Contract.contract.Transact(opts, method, params...) | |
} | |
// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. | |
// | |
// Solidity: function balanceOf(_owner address) constant returns(uint256) | |
func (_Example *ExampleCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) { | |
var ( | |
ret0 = new(*big.Int) | |
) | |
out := ret0 | |
err := _Example.contract.Call(opts, out, "balanceOf", _owner) | |
return *ret0, err | |
} | |
// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. | |
// | |
// Solidity: function balanceOf(_owner address) constant returns(uint256) | |
func (_Example *ExampleSession) BalanceOf(_owner common.Address) (*big.Int, error) { | |
return _Example.Contract.BalanceOf(&_Example.CallOpts, _owner) | |
} | |
// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. | |
// | |
// Solidity: function balanceOf(_owner address) constant returns(uint256) | |
func (_Example *ExampleCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) { | |
return _Example.Contract.BalanceOf(&_Example.CallOpts, _owner) | |
} | |
// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. | |
// | |
// Solidity: function transfer(_to address, _value uint256) returns(bool) | |
func (_Example *ExampleTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error) { | |
return _Example.contract.Transact(opts, "transfer", _to, _value) | |
} | |
// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. | |
// | |
// Solidity: function transfer(_to address, _value uint256) returns(bool) | |
func (_Example *ExampleSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) { | |
return _Example.Contract.Transfer(&_Example.TransactOpts, _to, _value) | |
} | |
// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. | |
// | |
// Solidity: function transfer(_to address, _value uint256) returns(bool) | |
func (_Example *ExampleTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error) { | |
return _Example.Contract.Transfer(&_Example.TransactOpts, _to, _value) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment