Value vote2(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"votedev \n"
"Percentage to be given to developers 0-10");
if (nSubsidy <= 0)
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Invalid Subsidy");
if (!(params[0].get_real() >= 0 && params[0].get_real() <= 10))
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid Percentage");
int64 nVote2 = nSubsidy * params[0].get_real() / 100;
CChatcoinAddress address(GetVote2Addr());
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Chatcoin address");
// Amount
int64 nAmount = GetVote2Value();
// Wallet comments
CWalletTx wtx;
wtx.mapValue["to"] = GetVote2Lbl();
if (pwalletMain->IsLocked())
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx, false, nVote2);
if (strError != "")
throw JSONRPCError(RPC_WALLET_ERROR, strError);
return wtx.GetHash().GetHex();
}