Initial dice morph from rewards.cpp

This commit is contained in:
jl777
2018-07-29 05:06:39 -11:00
parent ba30129fa6
commit d0d96ab044
4 changed files with 55 additions and 50 deletions

View File

@@ -5089,18 +5089,22 @@ UniValue faucetget(const UniValue& params, bool fHelp)
UniValue dicefund(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint64_t funds; std::string hex;
if ( fHelp || params.size() > 1 )
throw runtime_error("faucetfund amount\n");
UniValue result(UniValue::VOBJ); int64_t funds,minbet,maxbet,maxodds,forfeitblocks; std::string hex;
if ( fHelp || params.size() != 5 )
throw runtime_error("dicefund funds minbet maxbet maxodds forfeitblocks\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");
funds = atof(params[0].get_str().c_str()) * COIN;
//hex = DiceFund(0,funds);
minbet = atof(params[1].get_str().c_str()) * COIN;
maxbet = atof(params[2].get_str().c_str()) * COIN;
maxodds = atol(params[3].get_str().c_str());
forfeitblocks = atol(params[4].get_str().c_str());
hex = DiceCreateFunding(0,funds,minbet,maxbet,maxodds,forfeitblocks);
if ( hex.size() > 0 )
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", hex));
} else result.push_back(Pair("error", "couldnt create faucet funding transaction"));
} else result.push_back(Pair("error", "couldnt create dice funding transaction"));
return(result);
}