From 2f9dfa9ad24fe49d8a65c47293b3fde66029e0d5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 6 Apr 2019 00:21:26 -1100 Subject: [PATCH] Truncated prices roc --- src/cc/CCPrices.h | 9 +++++++-- src/cc/prices.cpp | 40 ++++++++++++++++++++-------------------- src/rpc/server.cpp | 5 ----- src/rpc/server.h | 5 ----- 4 files changed, 27 insertions(+), 32 deletions(-) diff --git a/src/cc/CCPrices.h b/src/cc/CCPrices.h index 672d6d9d8..9ff4f2957 100644 --- a/src/cc/CCPrices.h +++ b/src/cc/CCPrices.h @@ -38,8 +38,13 @@ int32_t prices_extract(int64_t *pricedata,int32_t firstheight,int32_t numblocks, bool PricesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn); // CCcustom -UniValue PricesList(); -UniValue PricesBet(uint64_t txfee,int64_t amount,int32_t leverage,std::string synthetic); +UniValue PricesBet(uint64_t txfee,int64_t amount,int16_t leverage,std::vector synthetic); +UniValue PricesAddFunding(uint64_t txfee,uint256 bettxid,int64_t amount); +UniValue PricesSetcostbasis(uint64_t txfee,uint256 bettxid); +UniValue PricesRekt(uint64_t txfee,uint256 bettxid,int32_t rektheight); +UniValue PricesCashout(uint64_t txfee,uint256 bettxid); +UniValue PricesInfo(uint256 bettxid,int32_t refheight); +UniValue PricesList() #endif diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index 8dc9d7d02..cedf05f2b 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -152,26 +152,6 @@ int64_t AddPricesInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,char return(totalinputs); } -UniValue PricesList() -{ - UniValue result(UniValue::VARR); std::vector > addressIndex; struct CCcontract_info *cp,C; int64_t amount,firstprice; int32_t height; int16_t leverage; uint256 txid,hashBlock,tokenid; CPubKey pk,pricespk; std::vector vec; CTransaction vintx; char str[65]; - cp = CCinit(&C,EVAL_PRICES); - pricespk = GetUnspendable(cp,0); - SetCCtxids(addressIndex,cp->normaladdr); - for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) - { - txid = it->first.txhash; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) - { - if ( vintx.vout.size() > 0 && prices_betopretdecode(vintx.vout[vintx.vout.size()-1].scriptPubKey,pk,height,amount,leverage,firstprice,vec,tokenid) == 'B' ) - { - result.push_back(uint256_str(str,txid)); - } - } - } - return(result); -} - UniValue prices_rawtxresult(UniValue &result,std::string rawtx,int32_t broadcastflag) { CTransaction tx; @@ -624,4 +604,24 @@ UniValue PricesInfo(uint256 bettxid,int32_t refheight) return(result); } +UniValue PricesList() +{ + UniValue result(UniValue::VARR); std::vector > addressIndex; struct CCcontract_info *cp,C; int64_t amount,firstprice; int32_t height; int16_t leverage; uint256 txid,hashBlock,tokenid; CPubKey pk,pricespk; std::vector vec; CTransaction vintx; char str[65]; + cp = CCinit(&C,EVAL_PRICES); + pricespk = GetUnspendable(cp,0); + SetCCtxids(addressIndex,cp->normaladdr); + for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) + { + txid = it->first.txhash; + if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + { + if ( vintx.vout.size() > 0 && prices_betopretdecode(vintx.vout[vintx.vout.size()-1].scriptPubKey,pk,height,amount,leverage,firstprice,vec,tokenid) == 'B' ) + { + result.push_back(uint256_str(str,txid)); + } + } + } + return(result); +} + diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index e3f4ca0cf..a48ef6cb1 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -445,11 +445,6 @@ static const CRPCCommand vRPCCommands[] = { "prices", "pricesaddress", &pricesaddress, true }, { "prices", "priceslist", &priceslist, true }, { "prices", "pricesinfo", &pricesinfo, true }, - { "prices", "pricescreate", &pricescreate, true }, - { "prices", "pricesaddfunding", &pricesaddfunding, true }, - { "prices", "pricesbet", &pricesbet, true }, - { "prices", "pricesstatus", &pricesstatus, true }, - { "prices", "pricesfinish", &pricesfinish, true }, // Pegs { "pegs", "pegsaddress", &pegsaddress, true }, diff --git a/src/rpc/server.h b/src/rpc/server.h index 997a418b4..79a12bb7b 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -272,11 +272,6 @@ extern UniValue oraclessamples(const UniValue& params, bool fHelp); extern UniValue pricesaddress(const UniValue& params, bool fHelp); extern UniValue priceslist(const UniValue& params, bool fHelp); extern UniValue pricesinfo(const UniValue& params, bool fHelp); -extern UniValue pricescreate(const UniValue& params, bool fHelp); -extern UniValue pricesaddfunding(const UniValue& params, bool fHelp); -extern UniValue pricesbet(const UniValue& params, bool fHelp); -extern UniValue pricesstatus(const UniValue& params, bool fHelp); -extern UniValue pricesfinish(const UniValue& params, bool fHelp); extern UniValue pegsaddress(const UniValue& params, bool fHelp); extern UniValue marmaraaddress(const UniValue& params, bool fHelp); extern UniValue marmara_poolpayout(const UniValue& params, bool fHelp);