This commit is contained in:
jl777
2018-07-23 06:02:25 -11:00
parent 3f030864cd
commit 6ff08712db
3 changed files with 23 additions and 0 deletions

View File

@@ -4842,6 +4842,27 @@ int32_t ensure_CCrequirements()
#include "../cc/CCfaucet.h"
UniValue faucetaddress(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); std::vector<unsigned char> pubkey; char destaddr[64];
if ( fHelp || params.size() > 1 )
throw runtime_error("faucetaddress [pubkey]\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");
result.push_back(Pair("result", "success"));
if ( GetCCaddress(FAUCET_ASSETS,destaddr,pubkey2pk(pubkey)) != 0 )
result.push_back(Pair("AssetsCCaddress",destaddr));
if ( params.size() == 1 )
{
pubkey = ParseHex(params[0].get_str().c_str());
if ( GetCCaddress(FAUCET_ASSETS,destaddr,pubkey2pk(pubkey)) != 0 )
result.push_back(Pair("CCaddress",destaddr));
}
if ( GetCCaddress(FAUCET_ASSETS,destaddr,pubkey2pk(Mypubkey())) != 0 )
result.push_back(Pair("myCCaddress",destaddr));
return(result);
}
UniValue faucetfund(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint64_t funds; std::string hex;