|
|
@ -26,39 +26,6 @@ |
|
|
|
#define NVOUT_CCMARKER 1 |
|
|
|
#define NVOUT_NORMALMARKER 3 |
|
|
|
|
|
|
|
typedef struct OneBetData { |
|
|
|
int64_t positionsize; |
|
|
|
int32_t firstheight; |
|
|
|
int64_t costbasis; |
|
|
|
int64_t profits; |
|
|
|
|
|
|
|
OneBetData() { positionsize = 0; firstheight = 0; costbasis = 0; profits = 0; } |
|
|
|
} onebetdata; |
|
|
|
|
|
|
|
typedef struct BetInfo { |
|
|
|
uint256 txid; |
|
|
|
int64_t averageCostbasis, firstprice, lastprice, liquidationprice, equity; |
|
|
|
int64_t exitfee; |
|
|
|
int32_t lastheight; |
|
|
|
int16_t leverage; |
|
|
|
bool isOpen, isRekt; |
|
|
|
uint256 tokenid; |
|
|
|
|
|
|
|
std::vector<uint16_t> vecparsed; |
|
|
|
std::vector<onebetdata> bets; |
|
|
|
CPubKey pk; |
|
|
|
|
|
|
|
bool isUp; |
|
|
|
|
|
|
|
BetInfo() { |
|
|
|
averageCostbasis = firstprice = lastprice = liquidationprice = equity = 0; |
|
|
|
lastheight = 0; |
|
|
|
leverage = 0; |
|
|
|
exitfee = 0; |
|
|
|
isOpen = isRekt = isUp = false; |
|
|
|
} |
|
|
|
} BetInfo; |
|
|
|
|
|
|
|
typedef struct MatchedBookTotal { |
|
|
|
|
|
|
|
int64_t diffLeveragedPosition; |
|
|
@ -250,23 +217,12 @@ int32_t prices_syntheticprofits(int64_t &costbasis, int32_t firstheight, int32_t |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
// makes result json object
|
|
|
|
void prices_betjson(UniValue &result, std::vector<OneBetData> bets, int16_t leverage, int32_t endheight, int64_t lastprice) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
// retrieves costbasis from a tx spending bettx vout1 (deprecated)
|
|
|
|
int64_t prices_costbasis(CTransaction bettx, uint256 &txidCostbasis) |
|
|
|
{ |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
// enumerates and retrieves added bets, returns the last baton txid
|
|
|
|
int64_t prices_enumaddedbets(uint256 &batontxid, std::vector<OneBetData> &bets, uint256 bettxid) |
|
|
|
{ |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
// pricesbet rpc impl: make betting tx
|
|
|
|
UniValue PricesBet(int64_t txfee, int64_t amount, int16_t leverage, std::vector<std::string> synthetic) |
|
|
|
{ |
|
|
@ -281,11 +237,6 @@ UniValue PricesAddFunding(int64_t txfee, uint256 bettxid, int64_t amount) |
|
|
|
return(result); |
|
|
|
} |
|
|
|
|
|
|
|
// scan chain from the initial bet's first position upto the chain tip and calculate bet's costbasises and profits, breaks if rekt detected
|
|
|
|
int32_t prices_scanchain(std::vector<OneBetData> &bets, int16_t leverage, std::vector<uint16_t> vec, int64_t &lastprice, int32_t &endheight) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
// pricescostbasis rpc impl: set cost basis (open price) for the bet (deprecated)
|
|
|
|
UniValue PricesSetcostbasis(int64_t txfee, uint256 bettxid) |
|
|
|
{ |
|
|
@ -302,11 +253,6 @@ UniValue PricesRefillFund(int64_t amount) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int32_t prices_getbetinfo(uint256 bettxid, BetInfo &betinfo) |
|
|
|
{ |
|
|
|
return (-420); |
|
|
|
} |
|
|
|
|
|
|
|
// pricesrekt rpc: anyone can rekt a bet at some block where losses reached limit, collecting fee
|
|
|
|
UniValue PricesRekt(int64_t txfee, uint256 bettxid, int32_t rektheight) |
|
|
|
{ |
|
|
@ -337,29 +283,12 @@ UniValue PricesList(uint32_t filter, CPubKey mypk) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool prices_addbookentry(uint256 txid, std::vector<BetInfo> &book) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool prices_ispositionup(const std::vector<uint16_t> &vecparsed, int16_t leverage) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
static bool prices_isopposite(BetInfo p1, BetInfo p2) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static std::string findMatchedBook(const std::vector<uint16_t> &vecparsed, const std::map<std::string, std::vector<BetInfo> > & bookmatched) { |
|
|
|
return std::string(""); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void prices_getorderbook(std::map<std::string, std::vector<BetInfo> > & bookmatched, std::map<std::string, MatchedBookTotal> &matchedTotals, TotalFund &fundTotals) { |
|
|
|
} |
|
|
|
|
|
|
|
static bool prices_isacceptableamount(const std::vector<uint16_t> &vecparsed, int64_t amount, int16_t leverage) { |
|
|
|
return false; |
|
|
|