code: func (cb *Chequebook) autoDeposit(interval time.Duration) {
  	if cb.quit != nil {
  		close(cb.quit)
  		cb.quit = nil
  	}
  	// if threshold >= balance autodeposit after every cheque issued
  	if interval == time.Duration(0) || cb.threshold != nil && cb.buffer != nil && cb.threshold.Cmp(cb.buffer) >= 0 {
  		return
  	}
  
  	ticker := time.NewTicker(interval)
  	cb.quit = make(chan bool)
  	quit := cb.quit
  
  	go func() {
  		for {
  			select {
  			case <-quit:
  				return
  			case <-ticker.C:
  				cb.lock.Lock()
  				if cb.balance.Cmp(cb.buffer) < 0 {
  					amount := new(big.Int).Sub(cb.buffer, cb.balance)
  					txhash, err := cb.deposit(amount)
  					if err == nil {
  						cb.txhash = txhash
  					}
  				}
  				cb.lock.Unlock()
  			}
  		}
  	}()
  }
docs: // autoDeposit starts a goroutine that periodically sends funds to the chequebook
  // contract caller holds the lock the go routine terminates if Chequebook.quit is closed.