dash/src/governance-validators.h
PastaPastaPasta ee6a5a33b7 Gov cleanup + copyright bump (#2324)
* governance.* formatting and copyright bump

* manual changes gov.cpp

* clang and copyright bump

* gov-exc.h clang and copyright bump

* gov-obj.* clang and copyright bump

* gov-val.* clang and copyright bump

* gov-vote.* clang and copyright bump

* gov-votedb.* clang and copyright bump

* fix some weirdness

* Modernize ConvertVoteOutcome, ConvertSignalToString and  ConvertOutcomeToString

* add braces

* move breaks

* add braces instead of inlining

* Revert "Modernize ConvertVoteOutcome, ConvertSignalToString and  ConvertOutcomeToString"

This reverts commit 41bc3d3d86.

* drop unused function
2018-09-28 10:56:17 +03:00

47 lines
1.2 KiB
C++

// Copyright (c) 2014-2018 The Dash Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef GOVERNANCE_VALIDATORS_H
#define GOVERNANCE_VALIDATORS_H
#include <string>
#include <univalue.h>
class CProposalValidator
{
private:
UniValue objJSON;
bool fJSONValid;
std::string strErrorMessages;
public:
CProposalValidator(const std::string& strDataHexIn = std::string());
bool Validate(bool fCheckExpiration = true);
const std::string& GetErrorMessages()
{
return strErrorMessages;
}
private:
void ParseStrHexData(const std::string& strHexData);
void ParseJSONData(const std::string& strJSONData);
bool GetDataValue(const std::string& strKey, std::string& strValueRet);
bool GetDataValue(const std::string& strKey, int64_t& nValueRet);
bool GetDataValue(const std::string& strKey, double& dValueRet);
bool ValidateName();
bool ValidateStartEndEpoch(bool fCheckExpiration = true);
bool ValidatePaymentAmount();
bool ValidatePaymentAddress();
bool ValidateURL();
bool CheckURL(const std::string& strURLIn);
};
#endif