@@ -282,7 +282,9 @@ var bindTests = []struct {
282
282
// Generate a new random account and a funded simulator
283
283
key, _ := crypto.GenerateKey()
284
284
auth := bind.NewKeyedTransactor(key)
285
+
285
286
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
287
+ defer sim.Close()
286
288
287
289
// Deploy an interaction tester contract and call a transaction on it
288
290
_, _, interactor, err := DeployInteractor(auth, sim, "Deploy string")
@@ -334,7 +336,9 @@ var bindTests = []struct {
334
336
// Generate a new random account and a funded simulator
335
337
key, _ := crypto.GenerateKey()
336
338
auth := bind.NewKeyedTransactor(key)
339
+
337
340
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
341
+ defer sim.Close()
338
342
339
343
// Deploy a tuple tester contract and execute a structured call on it
340
344
_, _, getter, err := DeployGetter(auth, sim)
@@ -377,7 +381,9 @@ var bindTests = []struct {
377
381
// Generate a new random account and a funded simulator
378
382
key, _ := crypto.GenerateKey()
379
383
auth := bind.NewKeyedTransactor(key)
384
+
380
385
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
386
+ defer sim.Close()
381
387
382
388
// Deploy a tuple tester contract and execute a structured call on it
383
389
_, _, tupler, err := DeployTupler(auth, sim)
@@ -432,7 +438,9 @@ var bindTests = []struct {
432
438
// Generate a new random account and a funded simulator
433
439
key, _ := crypto.GenerateKey()
434
440
auth := bind.NewKeyedTransactor(key)
441
+
435
442
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
443
+ defer sim.Close()
436
444
437
445
// Deploy a slice tester contract and execute a n array call on it
438
446
_, _, slicer, err := DeploySlicer(auth, sim)
@@ -477,7 +485,9 @@ var bindTests = []struct {
477
485
// Generate a new random account and a funded simulator
478
486
key, _ := crypto.GenerateKey()
479
487
auth := bind.NewKeyedTransactor(key)
488
+
480
489
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
490
+ defer sim.Close()
481
491
482
492
// Deploy a default method invoker contract and execute its default method
483
493
_, _, defaulter, err := DeployDefaulter(auth, sim)
@@ -519,7 +529,9 @@ var bindTests = []struct {
519
529
` ,
520
530
`
521
531
// Create a simulator and wrap a non-deployed contract
532
+
522
533
sim := backends.NewSimulatedBackend(core.GenesisAlloc{}, uint64(10000000000))
534
+ defer sim.Close()
523
535
524
536
nonexistent, err := NewNonExistent(common.Address{}, sim)
525
537
if err != nil {
@@ -566,7 +578,9 @@ var bindTests = []struct {
566
578
// Generate a new random account and a funded simulator
567
579
key, _ := crypto.GenerateKey()
568
580
auth := bind.NewKeyedTransactor(key)
581
+
569
582
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
583
+ defer sim.Close()
570
584
571
585
// Deploy a funky gas pattern contract
572
586
_, _, limiter, err := DeployFunkyGasPattern(auth, sim)
@@ -613,7 +627,9 @@ var bindTests = []struct {
613
627
// Generate a new random account and a funded simulator
614
628
key, _ := crypto.GenerateKey()
615
629
auth := bind.NewKeyedTransactor(key)
630
+
616
631
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
632
+ defer sim.Close()
617
633
618
634
// Deploy a sender tester contract and execute a structured call on it
619
635
_, _, callfrom, err := DeployCallFrom(auth, sim)
@@ -685,7 +701,9 @@ var bindTests = []struct {
685
701
// Generate a new random account and a funded simulator
686
702
key, _ := crypto.GenerateKey()
687
703
auth := bind.NewKeyedTransactor(key)
704
+
688
705
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
706
+ defer sim.Close()
689
707
690
708
// Deploy a underscorer tester contract and execute a structured call on it
691
709
_, _, underscorer, err := DeployUnderscorer(auth, sim)
@@ -776,7 +794,9 @@ var bindTests = []struct {
776
794
// Generate a new random account and a funded simulator
777
795
key, _ := crypto.GenerateKey()
778
796
auth := bind.NewKeyedTransactor(key)
797
+
779
798
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
799
+ defer sim.Close()
780
800
781
801
// Deploy an eventer contract
782
802
_, _, eventer, err := DeployEventer(auth, sim)
@@ -963,7 +983,9 @@ var bindTests = []struct {
963
983
// Generate a new random account and a funded simulator
964
984
key, _ := crypto.GenerateKey()
965
985
auth := bind.NewKeyedTransactor(key)
986
+
966
987
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
988
+ defer sim.Close()
967
989
968
990
//deploy the test contract
969
991
_, _, testContract, err := DeployDeeplyNestedArray(auth, sim)
@@ -1059,12 +1081,12 @@ var bindTests = []struct {
1059
1081
`
1060
1082
pragma solidity >=0.4.19 <0.6.0;
1061
1083
pragma experimental ABIEncoderV2;
1062
-
1084
+
1063
1085
contract Tuple {
1064
1086
struct S { uint a; uint[] b; T[] c; }
1065
1087
struct T { uint x; uint y; }
1066
1088
event TupleEvent(S a, T[2][] b, T[][2] c, S[] d, uint[] e);
1067
-
1089
+
1068
1090
function func1(S memory a, T[2][] memory b, T[][2] memory c, S[] memory d, uint[] memory e) public pure returns (S memory, T[2][] memory, T[][2] memory, S[] memory, uint[] memory) {
1069
1091
return (a, b, c, d, e);
1070
1092
}
@@ -1081,7 +1103,7 @@ var bindTests = []struct {
1081
1103
`
1082
1104
"math/big"
1083
1105
"reflect"
1084
-
1106
+
1085
1107
"github.com/ethereum/go-ethereum/accounts/abi/bind"
1086
1108
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
1087
1109
"github.com/ethereum/go-ethereum/core"
@@ -1091,13 +1113,15 @@ var bindTests = []struct {
1091
1113
`
1092
1114
key, _ := crypto.GenerateKey()
1093
1115
auth := bind.NewKeyedTransactor(key)
1094
- backend := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
1095
1116
1096
- _, _, contract, err := DeployTuple(auth, backend)
1117
+ sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
1118
+ defer sim.Close()
1119
+
1120
+ _, _, contract, err := DeployTuple(auth, sim)
1097
1121
if err != nil {
1098
1122
t.Fatalf("deploy contract failed %v", err)
1099
1123
}
1100
- backend .Commit()
1124
+ sim .Commit()
1101
1125
1102
1126
check := func(a, b interface{}, errMsg string) {
1103
1127
if !reflect.DeepEqual(a, b) {
@@ -1169,7 +1193,7 @@ var bindTests = []struct {
1169
1193
if err != nil {
1170
1194
t.Fatalf("invoke contract failed, err %v", err)
1171
1195
}
1172
- backend .Commit()
1196
+ sim .Commit()
1173
1197
1174
1198
iter, err := contract.FilterTupleEvent(nil)
1175
1199
if err != nil {
@@ -1225,7 +1249,9 @@ var bindTests = []struct {
1225
1249
// Generate a new random account and a funded simulator
1226
1250
key, _ := crypto.GenerateKey()
1227
1251
auth := bind.NewKeyedTransactor(key)
1252
+
1228
1253
sim := backends.NewSimulatedBackend(core.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000)}}, 10000000)
1254
+ defer sim.Close()
1229
1255
1230
1256
//deploy the test contract
1231
1257
_, _, testContract, err := DeployUseLibrary(auth, sim)
0 commit comments