Merge pull request #1498 from dimxy/prices-rpc
Prices rpc initial version
This commit is contained in:
@@ -38,8 +38,12 @@ extern CScript KOMODO_EARLYTXID_SCRIPTPUB;
|
||||
#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
|
||||
//#define PRICES_NORMFACTOR (int64_t)(SATOSHIDEN)
|
||||
//#define PRICES_POINTFACTOR (int64_t)10000
|
||||
|
||||
#define PRICES_REVSHAREDUST 10000
|
||||
#define PRICES_SUBREVSHAREFEE(amount) ((amount) * 199 / 200) // revshare fee percentage == 0.005
|
||||
#define PRICES_MINAVAILFUNDFRACTION 0.1 // leveraged bet limit < fund fraction
|
||||
|
||||
bool PricesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
|
||||
|
||||
@@ -52,6 +56,7 @@ UniValue PricesCashout(int64_t txfee,uint256 bettxid);
|
||||
UniValue PricesInfo(uint256 bettxid,int32_t refheight);
|
||||
UniValue PricesList(uint32_t filter, CPubKey mypk);
|
||||
UniValue PricesGetOrderbook();
|
||||
UniValue PricesRefillFund(int64_t amount);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1454,6 +1454,23 @@ UniValue pricesgetorderbook(const UniValue& params, bool fHelp)
|
||||
return PricesGetOrderbook();
|
||||
}
|
||||
|
||||
// pricesrekt rpc implementation
|
||||
UniValue pricesrefillfund(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error("pricesrefillfund amount\n");
|
||||
LOCK(cs_main);
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
|
||||
if (ASSETCHAINS_CBOPRET == 0)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "only -ac_cbopret chains have prices");
|
||||
|
||||
CAmount amount = atof(params[0].get_str().c_str()) * COIN;
|
||||
|
||||
return PricesRefillFund(amount);
|
||||
}
|
||||
|
||||
|
||||
UniValue gettxout(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() < 2 || params.size() > 3)
|
||||
|
||||
@@ -471,7 +471,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "prices", "pricesrekt", &pricesrekt, true },
|
||||
{ "prices", "pricesaddfunding", &pricesaddfunding, true },
|
||||
{ "prices", "pricesgetorderbook", &pricesgetorderbook, true },
|
||||
|
||||
{ "prices", "pricesrefillfund", &pricesrefillfund, true },
|
||||
|
||||
// Pegs
|
||||
{ "pegs", "pegsaddress", &pegsaddress, true },
|
||||
|
||||
@@ -510,6 +510,7 @@ extern UniValue pricescashout(const UniValue& params, bool fHelp);
|
||||
extern UniValue pricesrekt(const UniValue& params, bool fHelp);
|
||||
extern UniValue pricesaddfunding(const UniValue& params, bool fHelp);
|
||||
extern UniValue pricesgetorderbook(const UniValue& params, bool fHelp);
|
||||
extern UniValue pricesrefillfund(const UniValue& params, bool fHelp);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user