From eca34fd97846f3e8a03c8fd7375dd8922c47dd5e Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 24 Jul 2018 08:50:42 -1100 Subject: [PATCH] Test --- src/wallet/rpcwallet.cpp | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 7f6816cee..3c2e45b55 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4844,10 +4844,14 @@ int32_t ensure_CCrequirements() #include "../cc/CCassets.h" #include "../cc/CCrewards.h" #include "../cc/CCdice.h" +#include "../cc/CCponzi.h" +#include "../cc/CCauction.h" +#include "../cc/CClotto.h" UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector &pubkey) { UniValue result(UniValue::VOBJ); ; char destaddr[64],str[64]; + { uint8_t p[32]; Myprivkey(p); } result.push_back(Pair("result", "success")); sprintf(str,"%sCCaddress",name); if ( GetCCaddress(cp,destaddr,pubkey2pk(pubkey)) != 0 ) @@ -4862,6 +4866,45 @@ UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector pubkey; + cp = CCinit(&C,EVAL_LOTTO); + if ( fHelp || params.size() > 1 ) + throw runtime_error("lottoaddress [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"); + if ( params.size() == 1 ) + pubkey = ParseHex(params[0].get_str().c_str()); + return(CCaddress(cp,(char *)"Lotto",pubkey)); +} + +UniValue ponziaddress(const UniValue& params, bool fHelp) +{ + struct CCcontract_info *cp,C; std::vector pubkey; + cp = CCinit(&C,EVAL_PONZI); + if ( fHelp || params.size() > 1 ) + throw runtime_error("ponziaddress [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"); + if ( params.size() == 1 ) + pubkey = ParseHex(params[0].get_str().c_str()); + return(CCaddress(cp,(char *)"Ponzi",pubkey)); +} + +UniValue auctionaddress(const UniValue& params, bool fHelp) +{ + struct CCcontract_info *cp,C; std::vector pubkey; + cp = CCinit(&C,EVAL_DICE); + if ( fHelp || params.size() > 1 ) + throw runtime_error("auctionaddress [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"); + if ( params.size() == 1 ) + pubkey = ParseHex(params[0].get_str().c_str()); + return(CCaddress(cp,(char *)"Auction",pubkey)); +} + UniValue diceaddress(const UniValue& params, bool fHelp) { struct CCcontract_info *cp,C; std::vector pubkey;