diff --git a/src/cc/marmara.cpp b/src/cc/marmara.cpp index 41287c76f..9a5a1e6ef 100644 --- a/src/cc/marmara.cpp +++ b/src/cc/marmara.cpp @@ -251,20 +251,9 @@ bool MarmaraValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t } else if ( funcid == 'S' ) // collect -> automatically spend issuers locked funds, given 'I' { - return(true); - } - else if ( funcid == 'A' ) // agree -> agree that 'I' is unable to be redeemed, remainder - { - return(true); - } - else if ( funcid == 'D' ) // dispute -> given 'I' submit for manual arbitration - { - return(true); - } - else if ( funcid == 'F' ) // foreclose -> given 'A' collect as much of remainder from credit loop - { - return(true); + return(true); // iterate from issuer all remainder after maturity } + // staking only for locked utxo } return eval->Invalid("fall through error"); } @@ -315,6 +304,7 @@ UniValue MarmaraReceive(uint64_t txfee,CPubKey senderpk,int64_t amount,std::stri cp = CCinit(&C,EVAL_MARMARA); if ( txfee == 0 ) txfee = 10000; + // check for batonownership by senderpk and parameters match createtxid mypk = pubkey2pk(Mypubkey()); if ( currency != "MARMARA" ) errorstr = (char *)"for now, only MARMARA loops are supported"; @@ -363,6 +353,7 @@ UniValue MarmaraIssue(uint64_t txfee,uint8_t funcid,CPubKey receiverpk,int64_t a cp = CCinit(&C,EVAL_MARMARA); if ( txfee == 0 ) txfee = 10000; + // make sure if transfer that it is not too late mypk = pubkey2pk(Mypubkey()); if ( currency != "MARMARA" ) errorstr = (char *)"for now, only MARMARA loops are supported"; @@ -376,7 +367,7 @@ UniValue MarmaraIssue(uint64_t txfee,uint8_t funcid,CPubKey receiverpk,int64_t a { errorstr = (char *)"couldnt finalize CCtx"; mtx.vout.push_back(MakeCC1vout(EVAL_MARMARA,txfee,receiverpk)); - rawtx = FinalizeCCTx(0,cp,mtx,mypk,txfee,MarmaraLoopOpret('I',createtxid,receiverpk,amount,matures,currency)); + rawtx = FinalizeCCTx(0,cp,mtx,mypk,txfee,MarmaraLoopOpret(funcid,createtxid,receiverpk,amount,matures,currency)); if ( rawtx.size() > 0 ) errorstr = 0; } else errorstr = (char *)"dont have enough normal inputs for 2*txfee"; diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 841396a00..9ecb8ce77 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1165,10 +1165,12 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) //fprintf(stderr,"(%d %.8f).%d ",i,dstr(pblock->vtx[i].vout[j].nValue),j); if ( i != 0 || j != 1 ) total += pblock->vtx[i].vout[j].nValue; + if ( total > 1000000 * COIN ) + total = 1000000 * COIN; } } - commission = ((total / 10000) * ASSETCHAINS_COMMISSION) / 10000; - //commission = ((total * ASSETCHAINS_COMMISSION) / COIN); + //commission = ((total / 10000) * ASSETCHAINS_COMMISSION) / 10000; + commission = ((total * ASSETCHAINS_COMMISSION) / COIN); } if ( commission < 10000 ) commission = 0; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d0dc60489..f17faca58 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5601,7 +5601,7 @@ UniValue marmara_transfer(const UniValue& params, bool fHelp) UniValue result(UniValue::VOBJ); uint256 createtxid; std::vector receiverpub; int64_t amount; int32_t matures; std::string currency; if ( fHelp || params.size() != 5 ) { - // marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 2693 e5b1ef8ec90e981d3011c8e024cef869b69af2d4dd6837d1ab1d394d3730b7cb + // marmaratransfer 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 2693 e5b1ef8ec90e981d3011c8e024cef869b69af2d4dd6837d1ab1d394d3730b7cb throw runtime_error("marmaratransfer receiverpk amount currency matures createtxid\n"); } if ( ensure_CCrequirements() < 0 )