code: func (lp *LocalProfile) newChequebookFromContract(path string, backend chequebook.Backend) error {
  	hexkey := common.Bytes2Hex(lp.Contract.Bytes())
  	err := os.MkdirAll(filepath.Join(path, "chequebooks"), os.ModePerm)
  	if err != nil {
  		return fmt.Errorf("unable to create directory for chequebooks: %v", err)
  	}
  
  	chbookpath := filepath.Join(path, "chequebooks", hexkey+".json")
  	lp.chbook, err = chequebook.LoadChequebook(chbookpath, lp.privateKey, backend, true)
  
  	if err != nil {
  		lp.chbook, err = chequebook.NewChequebook(chbookpath, lp.Contract, lp.privateKey, backend)
  		if err != nil {
  			log.Warn(fmt.Sprintf("unable to initialise chequebook (owner: %v): %v", lp.owner.Hex(), err))
  			return fmt.Errorf("unable to initialise chequebook (owner: %v): %v", lp.owner.Hex(), err)
  		}
  	}
  
  	lp.chbook.AutoDeposit(lp.AutoDepositInterval, lp.AutoDepositThreshold, lp.AutoDepositBuffer)
  	log.Info(fmt.Sprintf("auto deposit ON for %v -> %v: interval = %v, threshold = %v, buffer = %v)", crypto.PubkeyToAddress(*(lp.publicKey)).Hex()[:8], lp.Contract.Hex()[:8], lp.AutoDepositInterval, lp.AutoDepositThreshold, lp.AutoDepositBuffer))
  
  	return nil
  }
docs: // newChequebookFromContract - initialise the chequebook from a persisted json file or create a new one
  // caller holds the lock