@@ -165,8 +165,9 @@ func TestInvalidABI(t *testing.T) {
165165
166166// TestConstructor tests a constructor function.
167167// The test is based on the following contract:
168- // contract TestConstructor {
169- // constructor(uint256 a, uint256 b) public{}
168+ //
169+ // contract TestConstructor {
170+ // constructor(uint256 a, uint256 b) public{}
170171// }
171172func TestConstructor (t * testing.T ) {
172173 json := `[{ "inputs": [{"internalType": "uint256","name": "a","type": "uint256" },{ "internalType": "uint256","name": "b","type": "uint256"}],"stateMutability": "nonpayable","type": "constructor"}]`
@@ -710,16 +711,19 @@ func TestBareEvents(t *testing.T) {
710711}
711712
712713// TestUnpackEvent is based on this contract:
713- // contract T {
714- // event received(address sender, uint amount, bytes memo);
715- // event receivedAddr(address sender);
716- // function receive(bytes memo) external payable {
717- // received(msg.sender, msg.value, memo);
718- // receivedAddr(msg.sender);
719- // }
720- // }
714+ //
715+ // contract T {
716+ // event received(address sender, uint amount, bytes memo);
717+ // event receivedAddr(address sender);
718+ // function receive(bytes memo) external payable {
719+ // received(msg.sender, msg.value, memo);
720+ // receivedAddr(msg.sender);
721+ // }
722+ // }
723+ //
721724// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
722- // receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
725+ //
726+ // receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
723727func TestUnpackEvent (t * testing.T ) {
724728 const abiJSON = `[{"constant":false,"inputs":[{"name":"memo","type":"bytes"}],"name":"receive","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"memo","type":"bytes"}],"name":"received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"}],"name":"receivedAddr","type":"event"}]`
725729 abi , err := JSON (strings .NewReader (abiJSON ))
@@ -1024,9 +1028,7 @@ func TestABI_EventById(t *testing.T) {
10241028 }
10251029 if event == nil {
10261030 t .Errorf ("We should find a event for topic %s, test #%d" , topicID .Hex (), testnum )
1027- }
1028-
1029- if event .ID != topicID {
1031+ } else if event .ID != topicID {
10301032 t .Errorf ("Event id %s does not match topic %s, test #%d" , event .ID .Hex (), topicID .Hex (), testnum )
10311033 }
10321034
@@ -1066,8 +1068,9 @@ func TestDoubleDuplicateMethodNames(t *testing.T) {
10661068// TestDoubleDuplicateEventNames checks that if send0 already exists, there won't be a name
10671069// conflict and that the second send event will be renamed send1.
10681070// The test runs the abi of the following contract.
1069- // contract DuplicateEvent {
1070- // event send(uint256 a);
1071+ //
1072+ // contract DuplicateEvent {
1073+ // event send(uint256 a);
10711074// event send0();
10721075// event send();
10731076// }
@@ -1094,7 +1097,8 @@ func TestDoubleDuplicateEventNames(t *testing.T) {
10941097// TestUnnamedEventParam checks that an event with unnamed parameters is
10951098// correctly handled.
10961099// The test runs the abi of the following contract.
1097- // contract TestEvent {
1100+ //
1101+ // contract TestEvent {
10981102// event send(uint256, uint256);
10991103// }
11001104func TestUnnamedEventParam (t * testing.T ) {
0 commit comments