2

I am currently deploying my ChangeManager contract in truffle and I want to call the contract later in Nethereum. For this I need the contract address in Nethereum. I figured I could just create an event which is emitted in the constructor like so emit ChangeManagerEvent(address). Currently I am testing this in a truffle testsuite but I can't seem to filter for the events triggered in the constructor of my ChangeManager contract. How can I subscribe to events which have been emitted by the constructor in truffle?

contract('ChangeManager', function (accounts) {
it('should have emitted event with contract address', async function () {
    changemanager = await  ChangeManager.deployed();
    var event = changemanager.allEvents();

    event.watch(function (error, result) {
        if (!error)
            console.log("Result: ", result.event);
    });
});

The goal of this undertaking is to call the contract in Nethereum after I have received the constructor event there. Maybe you have a better suggestion how I could access a contract deployed by truffle in Nethereum.

1 Answer 1

1

I have found out how to get the event in the truffle test suite:

var event = changemanager.allEvents({fromBlock: 0, toBlock: 'latest'});

It seems not to default to this option. Would be still happy to get suggestions on how to pass contract addresses from truffle to Nethereum.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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