code: func (cb *Chequebook) Issue(beneficiary common.Address, amount *big.Int) (*Cheque, error) {
  	defer cb.lock.Unlock()
  	cb.lock.Lock()
  
  	if amount.Sign() <= 0 {
  		return nil, fmt.Errorf("amount must be greater than zero (%v)", amount)
  	}
  	var (
  		ch  *Cheque
  		err error
  	)
  	if cb.balance.Cmp(amount) < 0 {
  		err = fmt.Errorf("insufficient funds to issue cheque for amount: %v. balance: %v", amount, cb.balance)
  	} else {
  		var sig []byte
  		sent, found := cb.sent[beneficiary]
  		if !found {
  			sent = new(big.Int)
  			cb.sent[beneficiary] = sent
  		}
  		sum := new(big.Int).Set(sent)
  		sum.Add(sum, amount)
  
  		sig, err = crypto.Sign(sigHash(cb.contractAddr, beneficiary, sum), cb.prvKey)
  		if err == nil {
  			ch = &Cheque{
  				Contract:    cb.contractAddr,
  				Beneficiary: beneficiary,
  				Amount:      sum,
  				Sig:         sig,
  			}
  			sent.Set(sum)
  			cb.balance.Sub(cb.balance, amount) // subtract amount from balance
  		}
  	}
  	// auto deposit if threshold is set and balance is less then threshold
  	// note this is called even if issuing cheque fails
  	// so we reattempt depositing
  	if cb.threshold != nil {
  		if cb.balance.Cmp(cb.threshold) < 0 {
  			send := new(big.Int).Sub(cb.buffer, cb.balance)
  			cb.deposit(send)
  		}
  	}
  	return ch, err
  }
docs: // Issue creates a cheque signed by the chequebook owner's private key. The
  // signer commits to a contract (one that they own), a beneficiary and amount.