Skip to content

Instantly share code, notes, and snippets.

@celeduc
Created December 8, 2017 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celeduc/42c89f317ac313f66390b465fab3ace2 to your computer and use it in GitHub Desktop.
Save celeduc/42c89f317ac313f66390b465fab3ace2 to your computer and use it in GitHub Desktop.
How to watch a solidity event
// a bonded verifier should be able to publish a verification
it('should let a bonded verifier publish a verification', async function(){
var debugEvent = verifierDb.Debug();
debugEvent.watch((err, e) => {
console.log('verifierRegistry.address:');
console.log(verifierRegistry.address);
console.log('verifier.address:');
console.log(verifier.address);
console.log('verifier1:');
console.log(verifier1);
console.log(err);
console.log(e);
});
var amount = new web3.BigNumber(web3.toWei(.01, 'ether'));
// starting with a new deposition
var depo = await verifier.publishDeposition("QmVpYa8krJAdwDEcHcWVwyg2vznS3MoAXycaLHmqPWkn8j", {from: verifier1, value: amount});
console.log(depo);
console.log(depo.receipt.logs[0]);
console.log(depo.receipt.logs[1]);
console.log(depo.receipt.logs[2]);
console.log(depo.receipt.logs[3]);
console.log(depo.receipt.logs[4]);
// debugEvent.stopWatching();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment