// Copyright (c) 2014-2016 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. #include "main.h" #include "db.h" #include "init.h" #include "activemasternode.h" #include "governance.h" #include "masternode-payments.h" #include "masternode-sync.h" #include "masternodeconfig.h" #include "masternodeman.h" #include "rpcserver.h" #include "utilmoneystr.h" #include #include #include #include #include using namespace std; /** * 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: * * For instructions on creating registers, see dashbrain * * * governance prepare new nTypeIn nParentID "name" epoch-start epoch-end register1 register2 register3 * >> fee transaction hash * * governance submit fee-hash nTypeIn nParentID, "name", epoch-start, epoch-end, fee-hash, register1, register2, register3 * >> governance object hash * * governance vote(-alias|many) type hash yes|no|abstain * >> success|failure * * governance list * >> flat data representation of the governance system * >> NOTE: this shouldn't be altered, we'll analyze the system outside of this project * * governance get hash * >> show one proposal * */ UniValue mngovernance(const UniValue& params, bool fHelp) { string strCommand; if (params.size() >= 1) strCommand = params[0].get_str(); if (fHelp || (strCommand != "vote-many" && strCommand != "vote-alias" && strCommand != "prepare" && strCommand != "submit" && strCommand != "vote" && strCommand != "get" && strCommand != "list" && strCommand != "diff")) throw runtime_error( "mngovernance \"command\"...\n" "Manage proposals\n" "\nAvailable commands:\n" " prepare - Prepare proposal by signing and creating tx\n" " submit - Submit proposal to network\n" " get - Get proposal hash(es) by proposal name\n" " list - List all proposals\n" " diff - List differences since last diff\n" " vote-alias - Vote on a proposal by masternode alias\n" ); if(strCommand == "prepare") { if (params.size() != 7) throw JSONRPCError(RPC_INVALID_PARAMETER, "Correct usage is 'mngovernance prepare