]> Git Repo - VerusCoin.git/commitdiff
Dice list and dice info
authorjl777 <[email protected]>
Sun, 29 Jul 2018 16:31:42 +0000 (05:31 -1100)
committerjl777 <[email protected]>
Sun, 29 Jul 2018 16:31:42 +0000 (05:31 -1100)
src/cc/CCdice.h
src/cc/dice.cpp
src/rpcserver.cpp
src/rpcserver.h
src/wallet/rpcwallet.cpp

index 8f76108ddc0eb542e1a1a01faee682a0e1e57762..14d08596a411c7f0a8a95b89702078e875600e94 100644 (file)
@@ -25,5 +25,7 @@ bool DiceValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx);
 
 std::string DiceCreateFunding(uint64_t txfee,char *planstr,int64_t funds,int64_t minbet,int64_t maxbet,int64_t maxodds,int64_t forfeitblocks);
 std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t amount);
+UniValue DiceInfo(uint256 diceid);
+UniValue DiceList();
 
 #endif
index 2b596c446419ad0e420e407ee1098623591de9e0..0e6669964c6a3ccb221c33366cfc0e414a73a011 100644 (file)
@@ -423,7 +423,7 @@ std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int6
 std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet,int32_t odds)
 {
     CMutableTransaction mtx; CPubKey mypk,dicepk; CScript opret; uint64_t sbits; int64_t funding,minbet,maxbet,maxodds,forfeitblocks; struct CCcontract_info *cp,C;
-    if ( bet < 0 )
+    if ( bet < 0 || odds < 1 )
     {
         fprintf(stderr,"negative parameter error\n");
         return(0);
index 0330c8939dab402cc79339abed83b77eda93136c..580a050c33680831b275e4f3577ac2957ea8eec2 100644 (file)
@@ -368,6 +368,8 @@ static const CRPCCommand vRPCCommands[] =
     { "faucet",       "faucetaddress",   &faucetaddress,      true },
     
     /* dice */
+    { "dice",       "dicelist",      &dicelist,         true },
+    { "dice",       "diceinfo",      &diceinfo,         true },
     { "dice",       "dicefund",      &dicefund,         true },
     { "dice",       "diceaddfunds",  &diceaddfunds,     true },
     { "dice",       "dicebet",       &dicebet,          true },
index c0e29020edfea2d61f1623902948acb72be2347d..665ae50234898e2ba818043dab2ba9e9527c0853 100644 (file)
@@ -234,7 +234,8 @@ extern UniValue rewardsaddfunding(const UniValue& params, bool fHelp);
 extern UniValue rewardslock(const UniValue& params, bool fHelp);
 extern UniValue rewardsunlock(const UniValue& params, bool fHelp);
 extern UniValue diceaddress(const UniValue& params, bool fHelp);
-extern UniValue dicefund(const UniValue& params, bool fHelp);
+extern UniValue dicelist(const UniValue& params, bool fHelp);
+extern UniValue diceinfo(const UniValue& params, bool fHelp);
 extern UniValue diceaddfunds(const UniValue& params, bool fHelp);
 extern UniValue dicebet(const UniValue& params, bool fHelp);
 extern UniValue lottoaddress(const UniValue& params, bool fHelp);
index 653add7a93265f8d1ff23dd32d660163d76981f5..71451cd2faae68ab72c78b70e548600310d23e00 100644 (file)
@@ -5054,6 +5054,27 @@ UniValue rewardsunlock(const UniValue& params, bool fHelp)
     return(result);
 }
 
+UniValue rewardslist(const UniValue& params, bool fHelp)
+{
+    uint256 tokenid;
+    if ( fHelp || params.size() > 0 )
+        throw runtime_error("rewardslist\n");
+    if ( ensure_CCrequirements() < 0 )
+        throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
+    return(RewardsList());
+}
+
+UniValue rewardsinfo(const UniValue& params, bool fHelp)
+{
+    uint256 fundingtxid;
+    if ( fHelp || params.size() != 1 )
+        throw runtime_error("rewardsinfo fundingtxid\n");
+    if ( ensure_CCrequirements() < 0 )
+        throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
+    fundingtxid = Parseuint256((char *)params[0].get_str().c_str());
+    return(RewardsInfo(fundingtxid));
+}
+
 UniValue faucetfund(const UniValue& params, bool fHelp)
 {
     UniValue result(UniValue::VOBJ); uint64_t funds; std::string hex;
@@ -5148,25 +5169,25 @@ UniValue dicebet(const UniValue& params, bool fHelp)
     return(result);
 }
 
-UniValue rewardslist(const UniValue& params, bool fHelp)
+UniValue dicelist(const UniValue& params, bool fHelp)
 {
     uint256 tokenid;
     if ( fHelp || params.size() > 0 )
-        throw runtime_error("rewardslist\n");
+        throw runtime_error("dicelist\n");
     if ( ensure_CCrequirements() < 0 )
         throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
-    return(RewardsList());
+    return(DiceList());
 }
 
-UniValue rewardsinfo(const UniValue& params, bool fHelp)
+UniValue diceinfo(const UniValue& params, bool fHelp)
 {
     uint256 fundingtxid;
     if ( fHelp || params.size() != 1 )
-        throw runtime_error("rewardsinfo fundingtxid\n");
+        throw runtime_error("diceinfo fundingtxid\n");
     if ( ensure_CCrequirements() < 0 )
         throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
     fundingtxid = Parseuint256((char *)params[0].get_str().c_str());
-    return(RewardsInfo(fundingtxid));
+    return(DiceInfo(fundingtxid));
 }
 
 UniValue tokenlist(const UniValue& params, bool fHelp)
This page took 0.04485 seconds and 4 git commands to generate.