1

I am new to solidity and trying to deploy a contract to see whether the address is EOA or Smart Contract. The code is listed below. I am not able to see the boolean value when I executed the contract in the mainnet.

pragma solidity ^0.4.0;
contract Ballot {

event isEOAOrNot(bool val);

function isContract(address addr) returns (bool) {
  uint size;

  assembly { size := extcodesize(addr) }
  bool val = size > 0;
  isEOAOrNot(val);
  return val;
}




}
2

Here's the best way I know:

  1. Launch contract:

Step 1

  1. Run transaction:

Step 2

  1. View transaction data:

enter image description here

  1. Find the "event" and "args" parameters under logs: enter image description here

And there you have it; the event and the arguments.

  • It's not there. – Erick Robertson Jun 15 '18 at 20:28
  • @ErickRobertson if you could provide more details, I will try and see what went wrong. On what step did you get stuck? – Nicholas Jun 17 '18 at 19:22
  • It was there for me, this should be the accepted answer. – CMikeB1 Nov 10 '18 at 17:28
1

You've missed the emit when calling the isEOAOrNot(val) event. should be:

emit isEOAOrNot(val);
0

If you compile a different contract, previous contracts that you deployed will no longer show events. So, recompile the contract you want to see the events for before calling the method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.