code: func (ch *Cheque) Verify(signerKey *ecdsa.PublicKey, contract, beneficiary common.Address, sum *big.Int) (*big.Int, error) {
  	log.Trace("Verifying chequebook cheque", "cheque", ch, "sum", sum)
  	if sum == nil {
  		return nil, fmt.Errorf("invalid amount")
  	}
  
  	if ch.Beneficiary != beneficiary {
  		return nil, fmt.Errorf("beneficiary mismatch: %v != %v", ch.Beneficiary.Hex(), beneficiary.Hex())
  	}
  	if ch.Contract != contract {
  		return nil, fmt.Errorf("contract mismatch: %v != %v", ch.Contract.Hex(), contract.Hex())
  	}
  
  	amount := new(big.Int).Set(ch.Amount)
  	if sum != nil {
  		amount.Sub(amount, sum)
  		if amount.Sign() <= 0 {
  			return nil, fmt.Errorf("incorrect amount: %v <= 0", amount)
  		}
  	}
  
  	pubKey, err := crypto.SigToPub(sigHash(ch.Contract, beneficiary, ch.Amount), ch.Sig)
  	if err != nil {
  		return nil, fmt.Errorf("invalid signature: %v", err)
  	}
  	if !bytes.Equal(crypto.FromECDSAPub(pubKey), crypto.FromECDSAPub(signerKey)) {
  		return nil, fmt.Errorf("signer mismatch: %x != %x", crypto.FromECDSAPub(pubKey), crypto.FromECDSAPub(signerKey))
  	}
  	return amount, nil
  }
docs: // Verify verifies cheque for signer, contract, beneficiary, amount, valid signature.