Connect marmara_poolpayout
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#define MARMARA_MINLOCK (1440 * 3 * 30)
|
||||
#define MARMARA_MAXLOCK (1440 * 24 * 30)
|
||||
uint64_t komodo_block_prg(uint32_t nHeight);
|
||||
UniValue MarmaraPoolPayout(uint64_t txfee,int32_t firstheight,double perc,CPubKey poolpk,char *jsonstr); // [[pk0, shares0], [pk1, shares1], ...]
|
||||
UniValue MarmaraPoolPayout(uint64_t txfee,int32_t firstheight,double perc,char *jsonstr); // [[pk0, shares0], [pk1, shares1], ...]
|
||||
|
||||
bool MarmaraValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
|
||||
|
||||
|
||||
@@ -290,16 +290,11 @@ UniValue MarmaraInfo()
|
||||
return(result);
|
||||
}
|
||||
|
||||
UniValue MarmaraPoolPayout(uint64_t txfee,int32_t firstheight,double perc,CPubKey poolpk,char *jsonstr) // [[pk0, shares0], [pk1, shares1], ...]
|
||||
UniValue MarmaraPoolPayout(uint64_t txfee,int32_t firstheight,double perc,char *jsonstr) // [[pk0, shares0], [pk1, shares1], ...]
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
UniValue result(UniValue::VOBJ); cJSON *item,*array; std::string rawtx; int32_t i,n; uint8_t buf[33]; CPubKey Marmarapk,pk; int64_t payout,total,totalpayout=0; double poolshares,share,shares = 0.; char *pkstr,*errorstr=0; struct CCcontract_info *cp,C;
|
||||
if ( pubkey2pk(Mypubkey()) != poolpk )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error","poolpk is not your pubkey"));
|
||||
return(result);
|
||||
}
|
||||
UniValue result(UniValue::VOBJ); cJSON *item,*array; std::string rawtx; int32_t i,n; uint8_t buf[33]; CPubKey Marmarapk,pk,poolpk; int64_t payout,total,totalpayout=0; double poolshares,share,shares = 0.; char *pkstr,*errorstr=0; struct CCcontract_info *cp,C;
|
||||
poolpk = pubkey2pk(Mypubkey());
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
cp = CCinit(&C,EVAL_MARMARA);
|
||||
|
||||
@@ -443,6 +443,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
|
||||
// Marmara
|
||||
{ "marmara", "Marmaraaddress", &marmaraaddress, true },
|
||||
{ "marmara", "Marmarapoolpayout", &marmara_poolpayout, true },
|
||||
|
||||
// Payments
|
||||
{ "payments", "paymentsaddress", &paymentsaddress, true },
|
||||
|
||||
@@ -272,6 +272,7 @@ 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);
|
||||
extern UniValue paymentsaddress(const UniValue& params, bool fHelp);
|
||||
extern UniValue gatewaysaddress(const UniValue& params, bool fHelp);
|
||||
extern UniValue gatewayslist(const UniValue& params, bool fHelp);
|
||||
|
||||
@@ -5531,6 +5531,19 @@ UniValue tokenaddress(const UniValue& params, bool fHelp)
|
||||
return(CCaddress(cp,(char *)"Assets",pubkey));
|
||||
}
|
||||
|
||||
UniValue marmara_poolpayout(const UniValue& params, bool fHelp)
|
||||
{
|
||||
int32_t firstheight; double perc; char *jsonstr;
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("marmara_poolpayout perc firstheight \"[[pubkey:shares], ...]\"\n");
|
||||
if ( ensure_CCrequirements() < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
perc = atof(params[0].get_str().c_str()) / 100.;
|
||||
firstheight = atol(params[1].get_str().c_str());
|
||||
jsonstr = (char *)params[2].get_str().c_str();
|
||||
return(MarmaraPoolPayout(0,firstheight,perc,jsonstr)); // [[pk0, shares0], [pk1, shares1], ...]
|
||||
}
|
||||
|
||||
UniValue channelslist(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if ( fHelp || params.size() > 0 )
|
||||
|
||||
Reference in New Issue
Block a user