Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

empty network events in contract builds #2224

Open
willli666 opened this issue Jul 16, 2019 · 3 comments
Open

empty network events in contract builds #2224

willli666 opened this issue Jul 16, 2019 · 3 comments

Comments

@willli666
Copy link

willli666 commented Jul 16, 2019

  • [x ] I've asked for help in the Truffle Gitter before filing this issue.

Issue

events field is always empty in deployed contract's json file.

Steps to Reproduce

  1. Open any contract and define an event there
    in my case I simply use the TutorialToken example like this. This token contract has multiple events defined in its dependency
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
contract TutorialToken is ERC20 {
    string public name = "TutorialToken";
    string public symbol = "TT";
    uint8 public decimals = 2;
    uint public INITIAL_SUPPLY = 12000;
    constructor() public {
        _mint(msg.sender, INITIAL_SUPPLY);
    }
}
  1. Deploy this contract in truffle develop
truffle develop
compile
migrate 
  1. Exam the build/contracts/TutroialToken.json file. Under networks section, I see the following
  "networks": {
    "5777": {
      "events": {},
     .....
  1. RE-deploy the same contract in truffle develop
migrate --reset

Now exam the same TutroialToken.json file, the events are populated.

Expected Behavior

The events section should not be empty {} after the first deployment. It should not require another deployment to make it show up.

Environment

  • Operating System: Mac
    Truffle v5.0.27 (core: 5.0.27)
    Solidity - 0.4.24 (solc-js)
    Node v10.15.0
@xuhuang37
Copy link

I have the same issue.

@fainashalts
Copy link
Contributor

@tjlian616 and @xuhuang37 thank you for bringing this issue to our attention. It does seem that this is not expected behavior. We will look into it!

@miyao-gmo
Copy link
Contributor

@fainashalts truffle-contract has the events porperties, but the events properties is the function which calculates events' signature. Therefore, networks.events is empty until contract calls the events property.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants