FSM skeleton
This commit is contained in:
@@ -4844,7 +4844,7 @@ int32_t ensure_CCrequirements()
|
||||
#include "../cc/CCassets.h"
|
||||
#include "../cc/CCrewards.h"
|
||||
#include "../cc/CCdice.h"
|
||||
#include "../cc/CCponzi.h"
|
||||
#include "../cc/CCfsm.h"
|
||||
#include "../cc/CCauction.h"
|
||||
#include "../cc/CClotto.h"
|
||||
|
||||
@@ -4881,17 +4881,17 @@ UniValue lottoaddress(const UniValue& params, bool fHelp)
|
||||
return(CCaddress(cp,(char *)"Lotto",pubkey));
|
||||
}
|
||||
|
||||
UniValue ponziaddress(const UniValue& params, bool fHelp)
|
||||
UniValue FSMaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;
|
||||
cp = CCinit(&C,EVAL_PONZI);
|
||||
cp = CCinit(&C,EVAL_FSM);
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("ponziaddress [pubkey]\n");
|
||||
throw runtime_error("FSMaddress [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));
|
||||
return(CCaddress(cp,(char *)"FSM",pubkey));
|
||||
}
|
||||
|
||||
UniValue auctionaddress(const UniValue& params, bool fHelp)
|
||||
@@ -5083,6 +5083,47 @@ UniValue rewardsinfo(const UniValue& params, bool fHelp)
|
||||
return(RewardsInfo(fundingtxid));
|
||||
}
|
||||
|
||||
UniValue FSMcreate(const UniValue& params, bool fHelp)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); std::string name,states,hex;
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("FSMcreate name states\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");
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = params[0].get_str();
|
||||
states = params[1].get_str();
|
||||
hex = FSMcreate(0,name,states);
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
result.push_back(Pair("result", "success"));
|
||||
result.push_back(Pair("hex", hex));
|
||||
} else result.push_back(Pair("error", "couldnt create FSM transaction"));
|
||||
return(result);
|
||||
}
|
||||
|
||||
UniValue FSMlist(const UniValue& params, bool fHelp)
|
||||
{
|
||||
uint256 tokenid;
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("FSMlist\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");
|
||||
return(FSMList());
|
||||
}
|
||||
|
||||
UniValue FSMinfo(const UniValue& params, bool fHelp)
|
||||
{
|
||||
uint256 FSMtxid;
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("FSMinfo fundingtxid\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");
|
||||
fundingtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
return(FSMInfo(FSMtxid));
|
||||
}
|
||||
|
||||
UniValue faucetinfo(const UniValue& params, bool fHelp)
|
||||
{
|
||||
uint256 fundingtxid;
|
||||
|
||||
Reference in New Issue
Block a user