watcher.go 861 B

123456789101112131415161718192021222324252627282930
  1. package algorand
  2. import (
  3. "context"
  4. "github.com/certusone/wormhole/node/pkg/common"
  5. "github.com/certusone/wormhole/node/pkg/readiness"
  6. )
  7. type (
  8. // Watcher is responsible for looking over Algorand blockchain and reporting new transactions to the contract
  9. Watcher struct {
  10. urlRPC string
  11. urlToken string
  12. contract string
  13. msgChan chan *common.MessagePublication
  14. setChan chan *common.GuardianSet
  15. }
  16. )
  17. // NewWatcher creates a new Algorand contract watcher
  18. func NewWatcher(urlRPC string, urlToken string, contract string, lockEvents chan *common.MessagePublication, setEvents chan *common.GuardianSet) *Watcher {
  19. return &Watcher{urlRPC: urlRPC, urlToken: urlToken, contract: contract, msgChan: lockEvents, setChan: setEvents}
  20. }
  21. func (e *Watcher) Run(ctx context.Context) error {
  22. readiness.SetReady(common.ReadinessAlgorandSyncing)
  23. select {}
  24. }