aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/bind/backend.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-08-23 05:20:13 +0800
committerFelix Lange <fjl@twurst.com>2016-08-23 05:20:13 +0800
commitc97df052a96820742fffdbb3ef5e77dbf1397637 (patch)
tree363e7e1a3439424e00a4e7e72a701b97f737e6aa /accounts/abi/bind/backend.go
parentd62d5fe59aedf9635a175d663632512b1cbbf2c3 (diff)
downloadgo-tangerine-c97df052a96820742fffdbb3ef5e77dbf1397637.tar
go-tangerine-c97df052a96820742fffdbb3ef5e77dbf1397637.tar.gz
go-tangerine-c97df052a96820742fffdbb3ef5e77dbf1397637.tar.bz2
go-tangerine-c97df052a96820742fffdbb3ef5e77dbf1397637.tar.lz
go-tangerine-c97df052a96820742fffdbb3ef5e77dbf1397637.tar.xz
go-tangerine-c97df052a96820742fffdbb3ef5e77dbf1397637.tar.zst
go-tangerine-c97df052a96820742fffdbb3ef5e77dbf1397637.zip
accounts/abi/bind: add utilities for waiting on transactions
The need for these functions comes up in code that actually deploys and uses contracts. As of this commit, they can be used with both SimulatedBackend and ethclient. SimulatedBackend gains some additional methods in the process and is now safe for concurrent use.
Diffstat (limited to 'accounts/abi/bind/backend.go')
-rw-r--r--accounts/abi/bind/backend.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/accounts/abi/bind/backend.go b/accounts/abi/bind/backend.go
index 3d38f87cd..a4e90914f 100644
--- a/accounts/abi/bind/backend.go
+++ b/accounts/abi/bind/backend.go
@@ -35,6 +35,10 @@ var (
// This error is raised when attempting to perform a pending state action
// on a backend that doesn't implement PendingContractCaller.
ErrNoPendingState = errors.New("backend does not support pending state")
+
+ // This error is returned by WaitDeployed if contract creation leaves an
+ // empty contract behind.
+ ErrNoCodeAfterDeploy = errors.New("no contract code after deployment")
)
// ContractCaller defines the methods needed to allow operating with contract on a read
@@ -48,6 +52,12 @@ type ContractCaller interface {
CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
}
+// DeployBackend wraps the operations needed by WaitMined and WaitDeployed.
+type DeployBackend interface {
+ TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
+ CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
+}
+
// PendingContractCaller defines methods to perform contract calls on the pending state.
// Call will try to discover this interface when access to the pending state is requested.
// If the backend does not support the pending state, Call returns ErrNoPendingState.