diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-03-18 01:27:37 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-03-24 20:15:32 +0800 |
commit | 86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe (patch) | |
tree | f080840b4ac808304862846125bf8b4d47a4ef37 /accounts/abi/bind/backends/nil.go | |
parent | 72826bb5adddedf0fd4fb9903e883d4c64fa18a6 (diff) | |
download | go-tangerine-86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe.tar go-tangerine-86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe.tar.gz go-tangerine-86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe.tar.bz2 go-tangerine-86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe.tar.lz go-tangerine-86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe.tar.xz go-tangerine-86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe.tar.zst go-tangerine-86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe.zip |
accounts/abi/bind: constructor, auth utils and various backends
Diffstat (limited to 'accounts/abi/bind/backends/nil.go')
-rw-r--r-- | accounts/abi/bind/backends/nil.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/accounts/abi/bind/backends/nil.go b/accounts/abi/bind/backends/nil.go new file mode 100644 index 000000000..8b1f9d63e --- /dev/null +++ b/accounts/abi/bind/backends/nil.go @@ -0,0 +1,46 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package backends + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" +) + +// nilBackend implements bind.ContractBackend, but panics on any method call. +// Its sole purpose is to support the binding tests to construct the generated +// wrappers without calling any methods on them. +type nilBackend struct{} + +func (*nilBackend) ContractCall(common.Address, []byte, bool) ([]byte, error) { + panic("not implemented") +} +func (*nilBackend) GasLimit(common.Address, *common.Address, *big.Int, []byte) (*big.Int, error) { + panic("not implemented") +} +func (*nilBackend) GasPrice() (*big.Int, error) { panic("not implemented") } +func (*nilBackend) AccountNonce(common.Address) (uint64, error) { panic("not implemented") } +func (*nilBackend) SendTransaction(*types.Transaction) error { panic("not implemented") } + +// NewNilBackend creates a new binding backend that can be used for instantiation +// but will panic on any invocation. Its sole purpose is to help testing. +func NewNilBackend() bind.ContractBackend { + return new(nilBackend) +} |