@@ -65,6 +65,14 @@ func makeTestDeployer(backend simulated.Client) func(input, deployer []byte) (co
6565 return bind .DefaultDeployer (bind .NewKeyedTransactor (testKey , chainId ), backend )
6666}
6767
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+
6876// test that deploying a contract with library dependencies works,
6977// verifying by calling method on the deployed contract.
7078func TestDeploymentLibraries (t * testing.T ) {
@@ -80,7 +88,7 @@ func TestDeploymentLibraries(t *testing.T) {
8088 Contracts : []* bind.MetaData {& nested_libraries .C1MetaData },
8189 Inputs : map [string ][]byte {nested_libraries .C1MetaData .ID : constructorInput },
8290 }
83- res , err := bind .LinkAndDeploy (deploymentParams , makeTestDeployer (bindBackend .Client ))
91+ res , err := bind .LinkAndDeploy (deploymentParams , makeTestDeployerWithNonceAssignment (bindBackend .Client ))
8492 if err != nil {
8593 t .Fatalf ("err: %+v\n " , err )
8694 }
@@ -122,7 +130,7 @@ func TestDeploymentWithOverrides(t *testing.T) {
122130 deploymentParams := & bind.DeploymentParams {
123131 Contracts : nested_libraries .C1MetaData .Deps ,
124132 }
125- res , err := bind .LinkAndDeploy (deploymentParams , makeTestDeployer (bindBackend ))
133+ res , err := bind .LinkAndDeploy (deploymentParams , makeTestDeployerWithNonceAssignment (bindBackend ))
126134 if err != nil {
127135 t .Fatalf ("err: %+v\n " , err )
128136 }
0 commit comments