Initial Payments CC without validation

This commit is contained in:
jl777
2019-03-21 03:14:59 -11:00
parent 42200a4716
commit ac5ec55126
14 changed files with 620 additions and 138 deletions

View File

@@ -5577,6 +5577,84 @@ UniValue cclib(const UniValue& params, bool fHelp)
return(CClib(cp,method,jsonstr));
}
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 ( 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;
LOCK2(cs_main, pwalletMain->cs_wallet);
cp = CCinit(&C,EVAL_PAYMENTS);
return(PaymentsRelease(cp,jsonstr));
}
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 ( 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;
LOCK2(cs_main, pwalletMain->cs_wallet);
cp = CCinit(&C,EVAL_PAYMENTS);
return(PaymentsFund(cp,jsonstr));
}
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 ( 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;
LOCK2(cs_main, pwalletMain->cs_wallet);
cp = CCinit(&C,EVAL_PAYMENTS);
return(PaymentsTxidopret(cp,jsonstr));
}
UniValue payments_create(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; char *jsonstr=0;
if ( fHelp || params.size() < 5 )
throw runtime_error("paymentscreate updateallowed lockedblocks minamount paytxid0,...,paytxidN\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;
LOCK2(cs_main, pwalletMain->cs_wallet);
cp = CCinit(&C,EVAL_PAYMENTS);
return(PaymentsCreate(cp,jsonstr));
}
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");
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;
LOCK2(cs_main, pwalletMain->cs_wallet);
cp = CCinit(&C,EVAL_PAYMENTS);
return(PaymentsInfo(cp,jsonstr));
}
UniValue payments_list(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; char *jsonstr=0;
if ( fHelp || params.size() != 0 )
throw runtime_error("paymentslist\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;
LOCK2(cs_main, pwalletMain->cs_wallet);
cp = CCinit(&C,EVAL_PAYMENTS);
return(PaymentsList(cp,jsonstr));
}
UniValue oraclesaddress(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;