Dice list and dice info
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user