All payments rpc to have one string arg

This commit is contained in:
jl777
2019-03-21 04:56:23 -11:00
parent 384ec464ed
commit b7dd9a3685
2 changed files with 20 additions and 14 deletions

View File

@@ -16,16 +16,22 @@
#include "CCPayments.h"
/*
0) create <- update_allowed flag, locked_blocks, minrelease, list of scriptPubKeys, allocations
0) txidopret <- allocation, scriptPubKey, opret
1) create <- locked_blocks, minrelease, list of txidopret
1) lock amount <create txid> to global CC address
2) lock amount <create txid> opretflag to global CC address with opret or txidaddr without
2) release amount -> vout[i] will be scriptPubKeys[i] and (amount * allocations[i]) / sumallocations[] (only using vins that have been locked for locked_blocks+). will make a tx with less than amount if it can find enough vins for minrelease amount
3) update (vins from all scriptPubkeys) new update_allowed flag, locked_blocks, minrelease, list of scriptPubKeys, allocations (only if update_allowed)
3) release amount -> vout[i] will be scriptPubKeys[i] and (amount * allocations[i]) / sumallocations[] (only using vins that have been locked for locked_blocks+). will make a tx with less than amount if it can find enough vins for minrelease amount
4) info txid -> display parameters, funds
5) list -> all txids
First step is to create txids with the info needed in their opreturns. this info is the weight, scriptPubKey and opret if needed. To do that txidopret is used:
./c is a script that invokes komodo-cli with the correct -ac_name
./komodo-cli -ac_name=PAY paymentstxidopret \"[9,%222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac%22]\"
./c paymentstxidopret \"[1,%2221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac%22]\"
*/
// start of consensus code

View File

@@ -5581,8 +5581,8 @@ UniValue cclib(const UniValue& params, bool fHelp)
UniValue payments_release(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; char *jsonstr=0;
if ( fHelp || params.size() != 2 )
throw runtime_error("paymentsrelease createtxid amount\n");
if ( fHelp || params.size() != 1 )
throw runtime_error("paymentsrelease \"[%22createtxid%22,amount]\"\n");
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;
@@ -5594,8 +5594,8 @@ UniValue payments_release(const UniValue& params, bool fHelp)
UniValue payments_fund(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; char *jsonstr=0;
if ( fHelp || params.size() < 2 || params.size() > 3 )
throw runtime_error("paymentsfund createtxid amount [useopret]\n");
if ( fHelp || params.size() != 1 )
throw runtime_error("paymentsfund \"[%22createtxid%22,amount(,useopret)]\"\n");
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;
@@ -5607,8 +5607,8 @@ UniValue payments_fund(const UniValue& params, bool fHelp)
UniValue payments_txidopret(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; char *jsonstr=0;
if ( fHelp || params.size() < 2 )
throw runtime_error("paymentstxidopret scriptPubKey opretformat\n");
if ( fHelp || params.size() != 1 )
throw runtime_error("paymentstxidopret \"[allocation,%22scriptPubKey%22(,%22destopret%22)]\"\n");
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;
@@ -5620,8 +5620,8 @@ UniValue payments_txidopret(const UniValue& params, bool fHelp)
UniValue payments_create(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; char *jsonstr=0;
if ( fHelp || params.size() < 4 )
throw runtime_error("paymentscreate lockedblocks minamount paytxid0,...,paytxidN\n");
if ( fHelp || params.size() != 1 )
throw runtime_error("paymentscreate \"[lockedblocks,minamount,%22paytxid0%22,...,%22paytxidN%22]\"\n");
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;
@@ -5634,7 +5634,7 @@ UniValue payments_info(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; char *jsonstr=0;
if ( fHelp || params.size() != 1 )
throw runtime_error("paymentsinfo createtxid\n");
throw runtime_error("paymentsinfo \"[%22createtxid%22]\"\n");
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;