Browse Source

Remove oracles RPCs

duke
Duke 4 months ago
parent
commit
86104c4ef7
  1. 12
      src/rpc/server.cpp
  2. 10
      src/rpc/server.h
  3. 155
      src/wallet/rpcwallet.cpp

12
src/rpc/server.cpp

@ -417,18 +417,6 @@ static const CRPCCommand vRPCCommands[] =
{ "heir", "heirinfo", &heirinfo, true },
{ "heir", "heirlist", &heirlist, true },
// Oracles
{ "oracles", "oraclesaddress", &oraclesaddress, true },
{ "oracles", "oracleslist", &oracleslist, true },
{ "oracles", "oraclesinfo", &oraclesinfo, true },
{ "oracles", "oraclescreate", &oraclescreate, true },
{ "oracles", "oraclesfund", &oraclesfund, true },
{ "oracles", "oraclesregister", &oraclesregister, true },
{ "oracles", "oraclessubscribe", &oraclessubscribe, true },
{ "oracles", "oraclesdata", &oraclesdata, true },
{ "oracles", "oraclessample", &oraclessample, true },
{ "oracles", "oraclessamples", &oraclessamples, true },
{ "CClib", "cclibaddress", &cclibaddress, true },
{ "CClib", "cclibinfo", &cclibinfo, true },
{ "CClib", "cclib", &cclib, true },

10
src/rpc/server.h

@ -245,16 +245,6 @@ extern UniValue heirclaim(const UniValue& params, bool fHelp, const CPubKey& myp
extern UniValue heirinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue heirlist(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue channelsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclesaddress(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oracleslist(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclesinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclescreate(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclesfund(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclesregister(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclessubscribe(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclesdata(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclessample(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue oraclessamples(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue cclibaddress(const UniValue& params, bool fHelp, const CPubKey& mypk);
extern UniValue cclibinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);

155
src/wallet/rpcwallet.cpp

@ -6327,19 +6327,6 @@ UniValue cclib(const UniValue& params, bool fHelp, const CPubKey& mypk)
return(CClib(cp,method,jsonstr));
}
UniValue oraclesaddress(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;
cp = CCinit(&C,EVAL_ORACLES);
if ( fHelp || params.size() > 1 )
throw runtime_error("oraclesaddress [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 *)"Oracles",pubkey));
}
UniValue heiraddress(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;
@ -6406,148 +6393,6 @@ UniValue assetsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk)
return(CCaddress(cp, (char *)"Assets", pubkey));
}
UniValue oracleslist(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if ( fHelp || params.size() > 0 )
throw runtime_error("oracleslist\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
return(OraclesList());
}
UniValue oraclesinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
uint256 txid;
if ( fHelp || params.size() != 1 )
throw runtime_error("oraclesinfo oracletxid\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
txid = Parseuint256((char *)params[0].get_str().c_str());
return(OracleInfo(txid));
}
UniValue oraclesfund(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue result(UniValue::VOBJ); uint256 txid;
if ( fHelp || params.size() != 1 )
throw runtime_error("oraclesfund oracletxid\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
Lock2NSPV(mypk);
txid = Parseuint256((char *)params[0].get_str().c_str());
result = OracleFund(mypk,0,txid);
if ( result[JSON_HEXTX].getValStr().size() > 0 )
{
result.push_back(Pair("result", "success"));
}
Unlock2NSPV(mypk);
return(result);
}
UniValue oraclesregister(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue result(UniValue::VOBJ); uint256 txid; int64_t datafee;
if ( fHelp || params.size() != 2 )
throw runtime_error("oraclesregister oracletxid datafee\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
Lock2NSPV(mypk);
txid = Parseuint256((char *)params[0].get_str().c_str());
if ( (datafee= atol((char *)params[1].get_str().c_str())) == 0 )
datafee = atof((char *)params[1].get_str().c_str()) * COIN + 0.00000000499999;
result = OracleRegister(mypk,0,txid,datafee);
if ( result[JSON_HEXTX].getValStr().size() > 0 )
{
result.push_back(Pair("result", "success"));
}
Unlock2NSPV(mypk);
return(result);
}
UniValue oraclessubscribe(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue result(UniValue::VOBJ); uint256 txid; int64_t amount; std::vector<unsigned char> pubkey;
if ( fHelp || params.size() != 3 )
throw runtime_error("oraclessubscribe oracletxid publisher amount\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
Lock2NSPV(mypk);
txid = Parseuint256((char *)params[0].get_str().c_str());
pubkey = ParseHex(params[1].get_str().c_str());
amount = atof((char *)params[2].get_str().c_str()) * COIN + 0.00000000499999;
result = OracleSubscribe(mypk,0,txid,pubkey2pk(pubkey),amount);
if ( result[JSON_HEXTX].getValStr().size() > 0 )
{
result.push_back(Pair("result", "success"));
}
Unlock2NSPV(mypk);
return(result);
}
UniValue oraclessample(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue result(UniValue::VOBJ); uint256 oracletxid,txid; int32_t num; char *batonaddr;
if ( fHelp || params.size() != 2 )
throw runtime_error("oraclessample oracletxid txid\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
oracletxid = Parseuint256((char *)params[0].get_str().c_str());
txid = Parseuint256((char *)params[1].get_str().c_str());
return(OracleDataSample(oracletxid,txid));
}
UniValue oraclessamples(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue result(UniValue::VOBJ); uint256 txid; int32_t num; char *batonaddr;
if ( fHelp || params.size() != 3 )
throw runtime_error("oraclessamples oracletxid batonaddress num\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
txid = Parseuint256((char *)params[0].get_str().c_str());
batonaddr = (char *)params[1].get_str().c_str();
num = atoi((char *)params[2].get_str().c_str());
return(OracleDataSamples(txid,batonaddr,num));
}
UniValue oraclesdata(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue result(UniValue::VOBJ); uint256 txid; std::vector<unsigned char> data;
if ( fHelp || params.size() != 2 )
throw runtime_error("oraclesdata oracletxid hexstr\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
Lock2NSPV(mypk);
txid = Parseuint256((char *)params[0].get_str().c_str());
data = ParseHex(params[1].get_str().c_str());
result = OracleData(mypk,0,txid,data);
if ( result[JSON_HEXTX].getValStr().size() > 0 )
{
result.push_back(Pair("result", "success"));
}
Unlock2NSPV(mypk);
return(result);
}
UniValue oraclescreate(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue result(UniValue::VOBJ); std::string name,description,format;
if ( fHelp || params.size() != 3 )
throw runtime_error("oraclescreate name description format\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error(CC_REQUIREMENTS_MSG);
Lock2NSPV(mypk);
name = params[0].get_str();
description = params[1].get_str();
format = params[2].get_str();
result = OracleCreate(mypk,0,name,description,format);
if ( result[JSON_HEXTX].getValStr().size() > 0 )
{
result.push_back(Pair("result", "success"));
}
Unlock2NSPV(mypk);
return(result);
}
UniValue FSMcreate(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
UniValue result(UniValue::VOBJ); std::string name,states,hex;

Loading…
Cancel
Save