Merge branch 'prices-rpc' of https://github.com/dimxy/komodo into dimxy-prices-rpc

This commit is contained in:
blackjok3r
2019-05-08 17:44:49 +08:00
14 changed files with 2260 additions and 695 deletions

View File

@@ -17,34 +17,39 @@
#ifndef CC_PRICES_H
#define CC_PRICES_H
#include "komodo_defs.h"
#include "CCinclude.h"
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
#define PRICES_DAYWINDOW ((3600*24/ASSETCHAINS_BLOCKTIME) + 1)
// #define PRICES_DAYWINDOW ((3600*24/ASSETCHAINS_BLOCKTIME) + 1) // defined in komodo_defs.h
#define PRICES_TXFEE 10000
#define PRICES_MAXLEVERAGE 777
#define PRICES_SMOOTHWIDTH 1
#define KOMODO_MAXPRICES 2048 // must be power of 2 and less than 8192
#define KOMODO_PRICEMASK (~(KOMODO_MAXPRICES - 1))
#define PRICES_WEIGHT (KOMODO_MAXPRICES * 1)
#define PRICES_MULT (KOMODO_MAXPRICES * 2)
#define PRICES_DIV (KOMODO_MAXPRICES * 3)
#define PRICES_INV (KOMODO_MAXPRICES * 4)
#define PRICES_MDD (KOMODO_MAXPRICES * 5)
#define PRICES_MMD (KOMODO_MAXPRICES * 6)
#define PRICES_MMM (KOMODO_MAXPRICES * 7)
#define PRICES_DDD (KOMODO_MAXPRICES * 8)
#define KOMODO_PRICEMASK (~(KOMODO_MAXPRICES - 1)) // actually 1111 1000 0000 0000
#define PRICES_WEIGHT (KOMODO_MAXPRICES * 1) // 0000 1000 0000 0000
#define PRICES_MULT (KOMODO_MAXPRICES * 2) // 0001 0000 0000 0000
#define PRICES_DIV (KOMODO_MAXPRICES * 3) // 0001 1000 0000 0000
#define PRICES_INV (KOMODO_MAXPRICES * 4) // 0010 0000 0000 0000
#define PRICES_MDD (KOMODO_MAXPRICES * 5) // 0010 1000 0000 0000
#define PRICES_MMD (KOMODO_MAXPRICES * 6) // 0011 0000 0000 0000
#define PRICES_MMM (KOMODO_MAXPRICES * 7) // 0011 1000 0000 0000
#define PRICES_DDD (KOMODO_MAXPRICES * 8) // 0100 0000 0000 0000
#define PRICES_NORMFACTOR (int64_t)(SATOSHIDEN)
#define PRICES_POINTFACTOR (int64_t)10000
bool PricesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
// CCcustom
UniValue PricesBet(uint64_t txfee,int64_t amount,int16_t leverage,std::vector<std::string> 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 PricesBet(int64_t txfee,int64_t amount,int16_t leverage,std::vector<std::string> synthetic);
UniValue PricesAddFunding(int64_t txfee,uint256 bettxid,int64_t amount);
UniValue PricesSetcostbasis(int64_t txfee,uint256 bettxid);
UniValue PricesRekt(int64_t txfee,uint256 bettxid,int32_t rektheight);
UniValue PricesCashout(int64_t txfee,uint256 bettxid);
UniValue PricesInfo(uint256 bettxid,int32_t refheight);
UniValue PricesList();
UniValue PricesList(uint32_t filter, CPubKey mypk);
UniValue PricesGetOrderbook();
#endif

View File

@@ -298,6 +298,7 @@ UniValue ValueFromAmount(const CAmount& amount);
int64_t TotalPubkeyNormalInputs(const CTransaction &tx, const CPubKey &pubkey);
int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey);
inline std::string STR_TOLOWER(const std::string &str) { std::string out; for (std::string::const_iterator i = str.begin(); i != str.end(); i++) out += std::tolower(*i); return out; }
// bitcoin LogPrintStr with category "-debug" cmdarg support for C++ ostringstream:
#define CCLOG_INFO 0

File diff suppressed because it is too large Load Diff