Advertisement
Guest User

Untitled

a guest
Aug 7th, 2018
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.53 KB | None | 0 0
  1. // TestCon is basically a contract with a single method "Gotcha()" which upon called throws an event "HandleEvent(uint256 code)" and set "code" to 10.
  2.  
  3. func GetTestCon(address string){
  4.     testcon, err := TestCon.NewTestCon(common.HexToAddress(address), ethercl)
  5.     if(err != nil){
  6.         fmt.Println(err)
  7.     }
  8.  
  9.     iter, err := testcon.FilterHandleEvent(&bind.FilterOpts{
  10.     Context: context.Background()})
  11.  
  12.     if(err != nil){
  13.         fmt.Println(err)
  14.     }
  15.  
  16.     for iter.Next(){
  17.         fmt.Println("Got an event:", iter.Event.Code)  // Got an event: 10
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement