Merge remote-tracking branch 'origin/jl777' into cctests
Tests failing right now due to change in behavior: CC Eval EVAL_FAUCET Invalid: faucet is only for brand new addresses
This commit is contained in:
@@ -5325,7 +5325,7 @@ UniValue dicestatus(const UniValue& params, bool fHelp)
|
||||
result.push_back(Pair("status", "loss"));
|
||||
else result.push_back(Pair("status", "no pending bets"));
|
||||
}
|
||||
} else result.push_back(Pair("status", "invalid bet txid"));
|
||||
} else result.push_back(Pair("status", "bet still pending"));
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -5417,8 +5417,20 @@ UniValue tokencreate(const UniValue& params, bool fHelp)
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = params[0].get_str();
|
||||
supply = atof(params[1].get_str().c_str()) * COIN;
|
||||
if ( name.size() == 0 || supply <= 0 )
|
||||
{
|
||||
result.push_back(Pair("error", "invalid parameter"));
|
||||
return(result);
|
||||
}
|
||||
if ( params.size() == 3 )
|
||||
{
|
||||
description = params[2].get_str();
|
||||
if ( description.size() > 4096 )
|
||||
{
|
||||
result.push_back(Pair("error", "token description longer than 4096"));
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
hex = CreateAsset(0,supply,name,description);
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
@@ -5440,6 +5452,11 @@ UniValue tokentransfer(const UniValue& params, bool fHelp)
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
std::vector<unsigned char> pubkey(ParseHex(params[1].get_str().c_str()));
|
||||
amount = atol(params[2].get_str().c_str());
|
||||
if ( tokenid == zeroid || amount <= 0 )
|
||||
{
|
||||
result.push_back(Pair("error", "invalid parameter"));
|
||||
return(result);
|
||||
}
|
||||
hex = AssetTransfer(0,tokenid,pubkey,amount);
|
||||
if (amount > 0) {
|
||||
if ( hex.size() > 0 )
|
||||
@@ -5466,6 +5483,11 @@ UniValue tokenbid(const UniValue& params, bool fHelp)
|
||||
tokenid = Parseuint256((char *)params[1].get_str().c_str());
|
||||
price = atof(params[2].get_str().c_str());
|
||||
bidamount = (price * numtokens) * COIN + 0.0000000049999;
|
||||
if ( tokenid == zeroid || tokenid == zeroid || price <= 0 || bidamount <= 0 )
|
||||
{
|
||||
result.push_back(Pair("error", "invalid parameter"));
|
||||
return(result);
|
||||
}
|
||||
hex = CreateBuyOffer(0,bidamount,tokenid,numtokens);
|
||||
if (price > 0 && numtokens > 0) {
|
||||
if ( hex.size() > 0 )
|
||||
@@ -5490,6 +5512,11 @@ UniValue tokencancelbid(const UniValue& params, bool fHelp)
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
bidtxid = Parseuint256((char *)params[1].get_str().c_str());
|
||||
if ( tokenid == zeroid || bidtxid == zeroid )
|
||||
{
|
||||
result.push_back(Pair("error", "invalid parameter"));
|
||||
return(result);
|
||||
}
|
||||
hex = CancelBuyOffer(0,tokenid,bidtxid);
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
@@ -5511,6 +5538,11 @@ UniValue tokenfillbid(const UniValue& params, bool fHelp)
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
bidtxid = Parseuint256((char *)params[1].get_str().c_str());
|
||||
fillamount = atol(params[2].get_str().c_str());
|
||||
if ( tokenid == zeroid || bidtxid == zeroid || fillamount <= 0 )
|
||||
{
|
||||
result.push_back(Pair("error", "invalid parameter"));
|
||||
return(result);
|
||||
}
|
||||
hex = FillBuyOffer(0,tokenid,bidtxid,fillamount);
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
@@ -5533,6 +5565,11 @@ UniValue tokenask(const UniValue& params, bool fHelp)
|
||||
tokenid = Parseuint256((char *)params[1].get_str().c_str());
|
||||
price = atof(params[2].get_str().c_str());
|
||||
askamount = (price * numtokens) * COIN + 0.0000000049999;
|
||||
if ( tokenid == zeroid || numtokens <= 0 || price <= 0 || askamount <= 0 )
|
||||
{
|
||||
result.push_back(Pair("error", "invalid parameter"));
|
||||
return(result);
|
||||
}
|
||||
hex = CreateSell(0,numtokens,tokenid,askamount);
|
||||
if (price > 0 && numtokens > 0) {
|
||||
if ( hex.size() > 0 )
|
||||
@@ -5585,18 +5622,22 @@ UniValue tokencancelask(const UniValue& params, bool fHelp)
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
asktxid = Parseuint256((char *)params[1].get_str().c_str());
|
||||
if ( tokenid == zeroid || asktxid == zeroid )
|
||||
{
|
||||
result.push_back(Pair("error", "invalid parameter"));
|
||||
return(result);
|
||||
}
|
||||
hex = CancelSell(0,tokenid,asktxid);
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
result.push_back(Pair("result", "success"));
|
||||
result.push_back(Pair("hex", hex));
|
||||
} else ERR_RESULT("couldnt cancel bid");
|
||||
} else ERR_RESULT("couldnt cancel ask");
|
||||
return(result);
|
||||
}
|
||||
|
||||
UniValue tokenfillask(const UniValue& params, bool fHelp)
|
||||
{
|
||||
static uint256 zeroid;
|
||||
UniValue result(UniValue::VOBJ); uint64_t fillunits; std::string hex; uint256 tokenid,asktxid;
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("tokenfillask tokenid asktxid fillunits\n");
|
||||
@@ -5607,6 +5648,11 @@ UniValue tokenfillask(const UniValue& params, bool fHelp)
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
asktxid = Parseuint256((char *)params[1].get_str().c_str());
|
||||
fillunits = atol(params[2].get_str().c_str());
|
||||
if ( tokenid == zeroid || asktxid == zeroid || fillunits <= 0 )
|
||||
{
|
||||
result.push_back(Pair("error", "invalid parameter"));
|
||||
return(result);
|
||||
}
|
||||
hex = FillSell(0,tokenid,zeroid,asktxid,fillunits);
|
||||
if (fillunits > 0) {
|
||||
if (CCerror != "") {
|
||||
|
||||
Reference in New Issue
Block a user