Dice refund

This commit is contained in:
jl777
2018-07-30 02:14:52 -11:00
parent 730f13dc06
commit 544593c6ab
5 changed files with 43 additions and 0 deletions

View File

@@ -5207,6 +5207,25 @@ UniValue diceloser(const UniValue& params, bool fHelp)
return(result);
}
UniValue dicerefund(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); char *name; uint256 fundingtxid,bettxid; uint64_t amount; std::string hex;
if ( fHelp || params.size() != 3 )
throw runtime_error("dicerefund name fundingtxid bettxid\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");
name = (char *)params[0].get_str().c_str();
fundingtxid = Parseuint256((char *)params[1].get_str().c_str());
bettxid = Parseuint256((char *)params[2].get_str().c_str());
hex = DiceRefund(0,name,fundingtxid,bettxid);
if ( hex.size() > 0 )
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", hex));
} else result.push_back(Pair("error", "couldnt create diceloser transaction"));
return(result);
}
UniValue dicelist(const UniValue& params, bool fHelp)
{
uint256 tokenid;