diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index c50d702a3..d764f392d 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -356,19 +356,6 @@ static const CRPCCommand vRPCCommands[] = { "crosschain", "migrate_createnotaryapprovaltransaction", &migrate_createnotaryapprovaltransaction, true }, { "crosschain", "selfimport", &selfimport, true }, { "crosschain", "importdual", &importdual, true }, - //ImportGateway - { "crosschain", "importgatewayddress", &importgatewayaddress, true }, - { "crosschain", "importgatewayinfo", &importgatewayinfo, true }, - { "crosschain", "importgatewaybind", &importgatewaybind, true }, - { "crosschain", "importgatewaydeposit", &importgatewaydeposit, true }, - { "crosschain", "importgatewaywithdraw", &importgatewaywithdraw, true }, - { "crosschain", "importgatewaypartialsign", &importgatewaypartialsign, true }, - { "crosschain", "importgatewaycompletesigning", &importgatewaycompletesigning, true }, - { "crosschain", "importgatewaymarkdone", &importgatewaymarkdone, true }, - { "crosschain", "importgatewaypendingwithdraws", &importgatewaypendingwithdraws, true }, - { "crosschain", "importgatewayprocessed", &importgatewayprocessed, true }, - - /* Mining */ { "mining", "getblocktemplate", &getblocktemplate, true }, @@ -489,23 +476,6 @@ static const CRPCCommand vRPCCommands[] = { "CClib", "cclibinfo", &cclibinfo, true }, { "CClib", "cclib", &cclib, true }, - // Gateways - { "gateways", "gatewaysaddress", &gatewaysaddress, true }, - { "gateways", "gatewayslist", &gatewayslist, true }, - { "gateways", "gatewaysexternaladdress", &gatewaysexternaladdress, true }, - { "gateways", "gatewaysdumpprivkey", &gatewaysdumpprivkey, true }, - { "gateways", "gatewaysinfo", &gatewaysinfo, true }, - { "gateways", "gatewaysbind", &gatewaysbind, true }, - { "gateways", "gatewaysdeposit", &gatewaysdeposit, true }, - { "gateways", "gatewaysclaim", &gatewaysclaim, true }, - { "gateways", "gatewayswithdraw", &gatewayswithdraw, true }, - { "gateways", "gatewayspartialsign", &gatewayspartialsign, true }, - { "gateways", "gatewayscompletesigning", &gatewayscompletesigning, true }, - { "gateways", "gatewaysmarkdone", &gatewaysmarkdone, true }, - { "gateways", "gatewayspendingdeposits", &gatewayspendingdeposits, true }, - { "gateways", "gatewayspendingwithdraws", &gatewayspendingwithdraws, true }, - { "gateways", "gatewaysprocessed", &gatewaysprocessed, true }, - // dice { "dice", "dicelist", &dicelist, true }, { "dice", "diceinfo", &diceinfo, true }, diff --git a/src/rpc/server.h b/src/rpc/server.h index 3b229d6f3..8f90627fe 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -284,21 +284,6 @@ extern UniValue payments_list(const UniValue& params, bool fHelp, const CPubKey& extern UniValue cclibaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue cclibinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue cclib(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewayslist(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysdumpprivkey(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysexternaladdress(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysbind(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysclaim(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewayswithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewayspartialsign(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewayscompletesigning(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysmarkdone(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewayspendingdeposits(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewayspendingwithdraws(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue gatewaysprocessed(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue channelslist(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue channelsinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue channelsopen(const UniValue& params, bool fHelp, const CPubKey& mypk); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 1dcc1525c..630c9be13 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -6486,19 +6486,6 @@ UniValue paymentsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk return(CCaddress(cp,(char *)"Payments",pubkey)); } -UniValue gatewaysaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - struct CCcontract_info *cp,C; std::vector pubkey; - cp = CCinit(&C,EVAL_GATEWAYS); - if ( fHelp || params.size() > 1 ) - throw runtime_error("gatewaysaddress [pubkey]\n"); - if ( ensure_CCrequirements(cp->evalcode) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - if ( params.size() == 1 ) - pubkey = ParseHex(params[0].get_str().c_str()); - return(CCaddress(cp,(char *)"Gateways",pubkey)); -} - UniValue heiraddress(const UniValue& params, bool fHelp, const CPubKey& mypk) { struct CCcontract_info *cp,C; std::vector pubkey; @@ -6617,19 +6604,6 @@ UniValue tokenaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) return(CCaddress(cp,(char *)"Tokens", pubkey)); } -UniValue importgatewayaddress(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - struct CCcontract_info *cp,C; std::vector pubkey; - cp = CCinit(&C,EVAL_IMPORTGATEWAY); - if ( fHelp || params.size() > 1 ) - throw runtime_error("importgatewayddress [pubkey]\n"); - if ( ensure_CCrequirements(cp->evalcode) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - if ( params.size() == 1 ) - pubkey = ParseHex(params[0].get_str().c_str()); - return(CCaddress(cp,(char *)"ImportGateway", pubkey)); -} - UniValue channelslist(const UniValue& params, bool fHelp, const CPubKey& mypk) { if ( fHelp || params.size() > 0 ) @@ -6929,297 +6903,7 @@ UniValue rewardsinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) return(RewardsInfo(fundingtxid)); } -UniValue gatewayslist(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - if ( fHelp || params.size() > 0 ) - throw runtime_error("gatewayslist\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - const CKeyStore& keystore = *pwalletMain; - return(GatewaysList()); -} - -UniValue gatewaysexternaladdress(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 bindtxid; CPubKey pubkey; - - if ( fHelp || params.size() != 2) - throw runtime_error("gatewaysexternaladdress bindtxid pubkey\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - pubkey = ParseHex(params[1].get_str().c_str()); - return(GatewaysExternalAddress(bindtxid,pubkey)); -} - -UniValue gatewaysdumpprivkey(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 bindtxid; - - if ( fHelp || params.size() != 2) - throw runtime_error("gatewaysdumpprivkey bindtxid address\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - std::string strAddress = params[1].get_str(); - CTxDestination dest = DecodeDestination(strAddress); - if (!IsValidDestination(dest)) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid transparent address"); - } - const CKeyID *keyID = boost::get(&dest); - if (!keyID) { - throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key"); - } - CKey vchSecret; - if (!pwalletMain->GetKey(*keyID, vchSecret)) { - throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known"); - } - return(GatewaysDumpPrivKey(bindtxid,vchSecret)); -} -UniValue gatewaysinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 txid; - if ( fHelp || params.size() != 1 ) - throw runtime_error("gatewaysinfo bindtxid\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - txid = Parseuint256((char *)params[0].get_str().c_str()); - return(GatewaysInfo(txid)); -} - -UniValue gatewaysbind(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 tokenid,oracletxid; int32_t i; int64_t totalsupply; std::vector pubkeys; - uint8_t M,N,p1,p2,p3,p4=0; std::string coin; std::vector pubkey; - - if ( fHelp || params.size() < 10 ) - throw runtime_error("gatewaysbind tokenid oracletxid coin tokensupply M N pubkey(s) pubtype p2shtype wiftype [taddr]\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - tokenid = Parseuint256((char *)params[0].get_str().c_str()); - oracletxid = Parseuint256((char *)params[1].get_str().c_str()); - coin = params[2].get_str(); - totalsupply = atol((char *)params[3].get_str().c_str()); - M = atoi((char *)params[4].get_str().c_str()); - N = atoi((char *)params[5].get_str().c_str()); - if ( M > N || N == 0 || N > 15 || totalsupply < COIN/100 || tokenid == zeroid ) - { - Unlock2NSPV(mypk); - throw runtime_error("illegal M or N > 15 or tokensupply or invalid tokenid\n"); - } - if ( params.size() < 6+N+3 ) - { - Unlock2NSPV(mypk); - throw runtime_error("not enough parameters for N pubkeys\n"); - } - for (i=0; i 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue gatewaysdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); int32_t i,claimvout,height; int64_t amount; std::string coin,deposithex; uint256 bindtxid,cointxid; std::vectorproof,destpub,pubkey; - if ( fHelp || params.size() != 9 ) - throw runtime_error("gatewaysdeposit bindtxid height coin cointxid claimvout deposithex proof destpub amount\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - height = atoi((char *)params[1].get_str().c_str()); - coin = params[2].get_str(); - cointxid = Parseuint256((char *)params[3].get_str().c_str()); - claimvout = atoi((char *)params[4].get_str().c_str()); - deposithex = params[5].get_str(); - proof = ParseHex(params[6].get_str()); - destpub = ParseHex(params[7].get_str()); - amount = atof((char *)params[8].get_str().c_str()) * COIN + 0.00000000499999; - if ( amount <= 0 || claimvout < 0 ) - { - Unlock2NSPV(mypk); - throw runtime_error("invalid param: amount, numpks or claimvout\n"); - } - if (destpub.size()!= 33) - { - Unlock2NSPV(mypk); - throw runtime_error("invalid destination pubkey"); - } - result = GatewaysDeposit(mypk,0,bindtxid,height,coin,cointxid,claimvout,deposithex,proof,pubkey2pk(destpub),amount); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue gatewaysclaim(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); std::string coin; uint256 bindtxid,deposittxid; std::vectordestpub; int64_t amount; - if ( fHelp || params.size() != 5 ) - throw runtime_error("gatewaysclaim bindtxid coin deposittxid destpub amount\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); - deposittxid = Parseuint256((char *)params[2].get_str().c_str()); - destpub = ParseHex(params[3].get_str()); - amount = atof((char *)params[4].get_str().c_str()) * COIN + 0.00000000499999; - if (destpub.size()!= 33) - { - Unlock2NSPV(mypk); - throw runtime_error("invalid destination pubkey"); - } - result = GatewaysClaim(mypk,0,bindtxid,coin,deposittxid,pubkey2pk(destpub),amount); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue gatewayswithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 bindtxid; int64_t amount; std::string coin; std::vector withdrawpub; - if ( fHelp || params.size() != 4 ) - throw runtime_error("gatewayswithdraw bindtxid coin withdrawpub amount\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); - withdrawpub = ParseHex(params[2].get_str()); - amount = atof((char *)params[3].get_str().c_str()) * COIN + 0.00000000499999; - if (withdrawpub.size()!= 33) - { - Unlock2NSPV(mypk); - throw runtime_error("invalid destination pubkey"); - } - result = GatewaysWithdraw(mypk,0,bindtxid,coin,pubkey2pk(withdrawpub),amount); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Lock2NSPV(mypk); - return(result); -} - -UniValue gatewayspartialsign(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); std::string coin,parthex; uint256 txid; - if ( fHelp || params.size() != 3 ) - throw runtime_error("gatewayspartialsign txidaddr refcoin hex\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - txid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); - parthex = params[2].get_str(); - result = GatewaysPartialSign(mypk,0,txid,coin,parthex); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue gatewayscompletesigning(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 withdrawtxid; std::string txhex,coin; - if ( fHelp || params.size() != 3 ) - throw runtime_error("gatewayscompletesigning withdrawtxid coin hex\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - withdrawtxid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); - txhex = params[2].get_str(); - result = GatewaysCompleteSigning(mypk,0,withdrawtxid,coin,txhex); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue gatewaysmarkdone(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - UniValue result(UniValue::VOBJ); uint256 completetxid; std::string coin; - if ( fHelp || params.size() != 2 ) - throw runtime_error("gatewaysmarkdone completesigningtx coin\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - Lock2NSPV(mypk); - completetxid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); - result = GatewaysMarkDone(mypk,0,completetxid,coin); - if ( result[JSON_HEXTX].getValStr().size() > 0 ) - { - result.push_back(Pair("result", "success")); - } - Unlock2NSPV(mypk); - return(result); -} - -UniValue gatewayspendingdeposits(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 bindtxid; std::string coin; - if ( fHelp || params.size() != 2 ) - throw runtime_error("gatewayspendingdeposits bindtxid coin\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); - return(GatewaysPendingDeposits(mypk,bindtxid,coin)); -} - -UniValue gatewayspendingwithdraws(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 bindtxid; std::string coin; - if ( fHelp || params.size() != 2 ) - throw runtime_error("gatewayspendingwithdraws bindtxid coin\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); - return(GatewaysPendingWithdraws(mypk,bindtxid,coin)); -} - -UniValue gatewaysprocessed(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - uint256 bindtxid; std::string coin; - if ( fHelp || params.size() != 2 ) - throw runtime_error("gatewaysprocessed bindtxid coin\n"); - if ( ensure_CCrequirements(EVAL_GATEWAYS) < 0 ) - throw runtime_error(CC_REQUIREMENTS_MSG); - bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); - return(GatewaysProcessedWithdraws(mypk,bindtxid,coin)); -} UniValue oracleslist(const UniValue& params, bool fHelp, const CPubKey& mypk) {