@@ -65,6 +65,14 @@ func makeTestDeployer(backend simulated.Client) func(input, deployer []byte) (co
65
65
return bind .DefaultDeployer (bind .NewKeyedTransactor (testKey , chainId ), backend )
66
66
}
67
67
68
+ // makeTestDeployerWithNonceAssignment is similar to makeTestDeployer,
69
+ // but it returns a deployer that automatically tracks nonce,
70
+ // enabling the deployment of multiple contracts from the same account.
71
+ func makeTestDeployerWithNonceAssignment (backend simulated.Client ) func (input , deployer []byte ) (common.Address , * types.Transaction , error ) {
72
+ chainId , _ := backend .ChainID (context .Background ())
73
+ return bind .DeployerWithNonceAssignment (bind .NewKeyedTransactor (testKey , chainId ), backend )
74
+ }
75
+
68
76
// test that deploying a contract with library dependencies works,
69
77
// verifying by calling method on the deployed contract.
70
78
func TestDeploymentLibraries (t * testing.T ) {
@@ -80,7 +88,7 @@ func TestDeploymentLibraries(t *testing.T) {
80
88
Contracts : []* bind.MetaData {& nested_libraries .C1MetaData },
81
89
Inputs : map [string ][]byte {nested_libraries .C1MetaData .ID : constructorInput },
82
90
}
83
- res , err := bind .LinkAndDeploy (deploymentParams , makeTestDeployer (bindBackend .Client ))
91
+ res , err := bind .LinkAndDeploy (deploymentParams , makeTestDeployerWithNonceAssignment (bindBackend .Client ))
84
92
if err != nil {
85
93
t .Fatalf ("err: %+v\n " , err )
86
94
}
@@ -122,7 +130,7 @@ func TestDeploymentWithOverrides(t *testing.T) {
122
130
deploymentParams := & bind.DeploymentParams {
123
131
Contracts : nested_libraries .C1MetaData .Deps ,
124
132
}
125
- res , err := bind .LinkAndDeploy (deploymentParams , makeTestDeployer (bindBackend ))
133
+ res , err := bind .LinkAndDeploy (deploymentParams , makeTestDeployerWithNonceAssignment (bindBackend ))
126
134
if err != nil {
127
135
t .Fatalf ("err: %+v\n " , err )
128
136
}
0 commit comments