Browse Source

Diceaddfunds

metaverse
jl777 6 years ago
parent
commit
587e715dc9
  1. 1
      src/rpcserver.cpp
  2. 1
      src/rpcserver.h
  3. 21
      src/wallet/rpcwallet.cpp

1
src/rpcserver.cpp

@ -369,6 +369,7 @@ static const CRPCCommand vRPCCommands[] =
/* dice */
{ "dice", "dicefund", &dicefund, true },
{ "dice", "diceaddfunds", &diceaddfunds, true },
{ "dice", "dicebet", &dicebet, true },
{ "dice", "diceaddress", &diceaddress, true },

1
src/rpcserver.h

@ -235,6 +235,7 @@ 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 diceaddfunds(const UniValue& params, bool fHelp);
extern UniValue dicebet(const UniValue& params, bool fHelp);
extern UniValue lottoaddress(const UniValue& params, bool fHelp);
extern UniValue ponziaddress(const UniValue& params, bool fHelp);

21
src/wallet/rpcwallet.cpp

@ -5029,7 +5029,7 @@ UniValue rewardsaddfunding(const UniValue& params, bool fHelp)
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", hex));
} else result.push_back(Pair("error", "couldnt create rewards lock transaction"));
} else result.push_back(Pair("error", "couldnt create rewards addfunding transaction"));
return(result);
}
@ -5109,6 +5109,25 @@ UniValue dicefund(const UniValue& params, bool fHelp)
return(result);
}
UniValue diceaddfunds(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); char *name; uint256 fundingtxid; uint64_t amount; std::string hex;
if ( fHelp || params.size() != 3 )
throw runtime_error("diceaddfunds name fundingtxid amount\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());
amount = atof(params[2].get_str().c_str()) * COIN;
hex = DiceAddfunding(0,name,fundingtxid,amount);
if ( hex.size() > 0 )
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", hex));
} else result.push_back(Pair("error", "couldnt create dice addfunding transaction"));
return(result);
}
UniValue dicebet(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); std::string hex; uint64_t amount,odds;

Loading…
Cancel
Save