Guest User

Untitled

a guest
Jan 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. pragma solidity ^0.4.0;
  2.  
  3. contract Child {
  4. uint X;
  5.  
  6. function Child (uint a) {
  7. X = a;
  8. }
  9.  
  10. function getChild() view public returns ( uint) {
  11. return (10);
  12. } }
  13.  
  14. contract Constructor {
  15.  
  16. Child public d;
  17.  
  18. event Mined (address childAdd);
  19.  
  20. function createChild(uint a) public {
  21. Child d = new Child(a);
  22. Mined (address (d));
  23. }
  24. }
  25.  
  26. var childEvent = Constructor.Mined();
  27.  
  28. childEvent.watch(function(error, result){
  29. if (!error) console.log('Child created');
  30. else console.error(error);
  31. });
  32.  
  33. var childEvent = Constructor.Mined({}, {fromBlock: 2000, toBlock:'latest'});
  34.  
  35. Constructor.Mined({}, { fromBlock: 0, toBlock: 'latest' }).get((error, eventResult) => {
  36. if (error)
  37. console.log(error);
  38. else
  39. console.log('Ok');
  40. });
Add Comment
Please, Sign In to add comment