From 94f448d6fa4ed8ffdc798f7ec5aebd614e48dfb6 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Sat, 16 Apr 2016 17:29:41 -0700 Subject: [PATCH] update gitignore --- .gitignore | 1 + src/governance-settings.h | 16 ++++++++ src/governance.h | 76 ++++++++++++++++++------------------ src/rpcmasternode-budget.cpp | 22 +++++++++-- 4 files changed, 73 insertions(+), 42 deletions(-) create mode 100644 src/governance-settings.h diff --git a/.gitignore b/.gitignore index 53c5b28349..3f5db06554 100644 --- a/.gitignore +++ b/.gitignore @@ -131,3 +131,4 @@ qa/pull-tester/tests-config.sh dash-cli dashd dash-qt +make diff --git a/src/governance-settings.h b/src/governance-settings.h new file mode 100644 index 0000000000..0e43422d8e --- /dev/null +++ b/src/governance-settings.h @@ -0,0 +1,16 @@ +// Copyright (c) 2014-2016 The Dash Core developers + +/* + + +*/ + +class CGovernanceSettings +{ + template + // strName=trigger, strParamater=ban-block ... obj= tigger.ban-block(args) + static &T GetSetting(std::string strName) + { + + } +} \ No newline at end of file diff --git a/src/governance.h b/src/governance.h index 9b24da260b..baec9023d0 100644 --- a/src/governance.h +++ b/src/governance.h @@ -186,7 +186,6 @@ private: public: bool fValid; std::string strName; //org name, username, prop name, etc. - std::string strURL; int nStartTime; int nEndTime; CAmount nAmount; // 12.1 - remove @@ -200,8 +199,42 @@ public: // -- check governance wiki for correct usage std::map mapRegister; + + CGovernanceObject(); + CGovernanceObject(const CGovernanceObject& other); + CGovernanceObject(std::string strNameIn, int64_t nStartTimeIn, int64_t nEndTimeIn, uint256 nFeeTXHashIn); + + bool HasMinimumRequiredSupport(); + bool IsValid(const CBlockIndex* pindex, std::string& strError, bool fCheckCollateral=true); + bool IsEstablished(); + bool NetworkWillPay(); + + std::string GetName() {return strName; } + std::string GetURL() {return strURL; } + int GetStartTime() {return nStartTime;} + int GetEndTime() {return nEndTime;} + int IsActive(int64_t nTime) {return nTime > nStartTime && nTime < nEndTime;} + int GetAbsoluteYesCount(); + int GetYesCount(); + int GetNoCount(); + int GetAbstainCount(); + + void CleanAndRemove(bool fSignatureCheck); + void Relay(); + + uint256 GetHash(){ + CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); + ss << strName; + ss << nStartTime; + ss << nEndTime; + //ss << mapRegister; + uint256 h1 = ss.GetHash(); + + return h1; + } + /** - * Example usage: + * AddRegister - Example usage: * -------------------------------------------------------- * * We don't really care what's in these, as long as the masternode network @@ -238,47 +271,12 @@ public: return true; } - CGovernanceObject(); - CGovernanceObject(const CGovernanceObject& other); - CGovernanceObject(std::string strNameIn, std::string strURLIn, int64_t nStartTimeIn, int64_t nEndTimeIn, uint256 nFeeTXHashIn); - - bool HasMinimumRequiredSupport(); - bool IsValid(const CBlockIndex* pindex, std::string& strError, bool fCheckCollateral=true); - bool IsEstablished(); - bool NetworkWillPay(); - - std::string GetName() {return strName; } - std::string GetURL() {return strURL; } - int GetStartTime() {return nStartTime;} - int GetEndTime() {return nEndTime;} - int IsActive(int64_t nTime) {return nTime > nStartTime && nTime < nEndTime;} - int GetAbsoluteYesCount(); - int GetYesCount(); - int GetNoCount(); - int GetAbstainCount(); - - void CleanAndRemove(bool fSignatureCheck); - - uint256 GetHash(){ - CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); - ss << strName; - ss << strURL; - ss << nStartTime; - ss << nEndTime; - //ss << mapRegister; - uint256 h1 = ss.GetHash(); - - return h1; - } - void Relay(); - ADD_SERIALIZE_METHODS; template - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { - //for syncing with other clients + inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) + { READWRITE(LIMITED_STRING(strName, 20)); - READWRITE(LIMITED_STRING(strURL, 64)); READWRITE(nTime); READWRITE(nStartTime); READWRITE(nEndTime); diff --git a/src/rpcmasternode-budget.cpp b/src/rpcmasternode-budget.cpp index c7a77d6415..012fcfbd69 100644 --- a/src/rpcmasternode-budget.cpp +++ b/src/rpcmasternode-budget.cpp @@ -22,9 +22,25 @@ using namespace std; -/* - 12.1 - needs to be rewritten - - none of this is in the correct context now +/** +* NOTE: 12.1 - code needs to be rewritten, much of it's in the incorrect context +* +* Governance Object Creation and Voting +* ------------------------------------------------------- +* +* This code allows users to create new types of objects. To correctly use the system +* please see the governance wiki and code-as-law implementation. Any conflicting entries will be +* automatically downvoted and deleted, requiring resubmission to correct. +* +* command structure: +* +* governance prepare new nTypeIn nParentID "name" epoch-start epoch-end parameter1 parameter2 parameter3 +* >> fee transaction hash +* +* governance submit fee-hash nTypeIn nParentID, "name", epoch-start, epoch-end, fee-hash, parameter1, parameter2, parameter3 +* >> governance object hash +* +* */ UniValue mnbudget(const UniValue& params, bool fHelp)