diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-04-01 21:42:05 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-04-01 21:42:05 +0800 |
commit | fb578f4550a08617485d9146876489d1f3bb1b52 (patch) | |
tree | f502b5ee41d1d8b5c2eb3908468c05f1d8b0d939 /accounts/abi/bind/template.go | |
parent | 8b2aca96c598dda14f0cbc94e1c41b930c4ab822 (diff) | |
parent | 4097478884fb27db3f90e0997c12d8266eed9531 (diff) | |
download | go-tangerine-fb578f4550a08617485d9146876489d1f3bb1b52.tar go-tangerine-fb578f4550a08617485d9146876489d1f3bb1b52.tar.gz go-tangerine-fb578f4550a08617485d9146876489d1f3bb1b52.tar.bz2 go-tangerine-fb578f4550a08617485d9146876489d1f3bb1b52.tar.lz go-tangerine-fb578f4550a08617485d9146876489d1f3bb1b52.tar.xz go-tangerine-fb578f4550a08617485d9146876489d1f3bb1b52.tar.zst go-tangerine-fb578f4550a08617485d9146876489d1f3bb1b52.zip |
Merge pull request #2405 from karalabe/abigen-default-methods
accounts/abi/bind: surface raw wrappers to access low level ops
Diffstat (limited to 'accounts/abi/bind/template.go')
-rw-r--r-- | accounts/abi/bind/template.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/accounts/abi/bind/template.go b/accounts/abi/bind/template.go index f1a10137c..36ac1d78d 100644 --- a/accounts/abi/bind/template.go +++ b/accounts/abi/bind/template.go @@ -110,6 +110,21 @@ package {{.Package}} TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } + // {{.Type}}Raw is an auto generated low-level Go binding around an Ethereum contract. + type {{.Type}}Raw struct { + Contract *{{.Type}} // Generic contract binding to access the raw methods on + } + + // {{.Type}}CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. + type {{.Type}}CallerRaw struct { + Contract *{{.Type}}Caller // Generic read-only contract binding to access the raw methods on + } + + // {{.Type}}TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. + type {{.Type}}TransactorRaw struct { + Contract *{{.Type}}Transactor // Generic write-only contract binding to access the raw methods on + } + // New{{.Type}} creates a new instance of {{.Type}}, bound to a specific deployed contract. func New{{.Type}}(address common.Address, backend bind.ContractBackend) (*{{.Type}}, error) { contract, err := bind{{.Type}}(address, backend.(bind.ContractCaller), backend.(bind.ContractTransactor)) @@ -146,6 +161,44 @@ package {{.Package}} 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 (_{{$contract.Type}} *{{$contract.Type}}Raw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _{{$contract.Type}}.Contract.{{$contract.Type}}Caller.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 (_{{$contract.Type}} *{{$contract.Type}}Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.{{$contract.Type}}Transactor.contract.Transfer(opts) + } + + // Transact invokes the (paid) contract method with params as input values. + func (_{{$contract.Type}} *{{$contract.Type}}Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.{{$contract.Type}}Transactor.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 (_{{$contract.Type}} *{{$contract.Type}}CallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _{{$contract.Type}}.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 (_{{$contract.Type}} *{{$contract.Type}}TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.contract.Transfer(opts) + } + + // Transact invokes the (paid) contract method with params as input values. + func (_{{$contract.Type}} *{{$contract.Type}}TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _{{$contract.Type}}.Contract.contract.Transact(opts, method, params...) + } + {{range .Calls}} // {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.Id}}. // |