@ -5468,7 +5468,6 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *
# include "../cc/CCGateways.h"
# include "../cc/CCPrices.h"
# include "../cc/CCHeir.h"
# include "../cc/CCMarmara.h"
# include "../cc/CCPayments.h"
# include "../cc/CCPegs.h"
@ -5892,19 +5891,6 @@ UniValue pegsaddress(const UniValue& params, bool fHelp, const CPubKey& mypk)
return ( CCaddress ( cp , ( char * ) " Pegs " , pubkey ) ) ;
}
UniValue marmaraaddress ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
struct CCcontract_info * cp , C ; std : : vector < unsigned char > pubkey ;
cp = CCinit ( & C , EVAL_MARMARA ) ;
if ( fHelp | | params . size ( ) > 1 )
throw runtime_error ( " Marmaraaddress [pubkey] \n " ) ;
if ( ensure_CCrequirements ( cp - > evalcode ) < 0 )
throw runtime_error ( CC_REQUIREMENTS_MSG ) ;
if ( params . size ( ) = = 1 )
pubkey = ParseHex ( params [ 0 ] . get_str ( ) . c_str ( ) ) ;
return ( CCaddress ( cp , ( char * ) " Marmara " , pubkey ) ) ;
}
UniValue paymentsaddress ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
struct CCcontract_info * cp , C ; std : : vector < unsigned char > pubkey ;
@ -6062,192 +6048,6 @@ UniValue importgatewayaddress(const UniValue& params, bool fHelp, const CPubKey&
return ( CCaddress ( cp , ( char * ) " ImportGateway " , pubkey ) ) ;
}
UniValue marmara_poolpayout ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
int32_t firstheight ; double perc ; char * jsonstr ;
if ( fHelp | | params . size ( ) ! = 3 )
{
// marmarapoolpayout 0.5 2 '[["024131032ed90941e714db8e6dd176fe5a86c9d873d279edecf005c06f773da686",1000],["02ebc786cb83de8dc3922ab83c21f3f8a2f3216940c3bf9da43ce39e2a3a882c92",100]]';
//marmarapoolpayout 0 2 '[["024131032ed90941e714db8e6dd176fe5a86c9d873d279edecf005c06f773da686",1000]]'
throw runtime_error ( " marmarapoolpayout perc firstheight \" [[ \\ \" pubkey \\ \" :shares], ...] \" \n " ) ;
}
if ( ensure_CCrequirements ( EVAL_MARMARA ) < 0 )
throw runtime_error ( CC_REQUIREMENTS_MSG ) ;
const CKeyStore & keystore = * pwalletMain ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
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 marmara_receive ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
UniValue result ( UniValue : : VOBJ ) ; uint256 batontxid ; std : : vector < uint8_t > senderpub ; int64_t amount ; int32_t matures ; std : : string currency ;
if ( fHelp | | ( params . size ( ) ! = 5 & & params . size ( ) ! = 4 ) )
{
// automatic flag -> lsb of matures
// 1st marmarareceive 028076d42eb20efc10007fafb5ca66a2052523c0d2221e607adf958d1a332159f6 7.5 MARMARA 1440
// after marmarareceive 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 1168 d72d87aa0d50436de695c93e2bf3d7273c63c92ef6307913aa01a6ee6a16548b
throw runtime_error ( " marmarareceive senderpk amount currency matures batontxid \n " ) ;
}
if ( ensure_CCrequirements ( EVAL_MARMARA ) < 0 )
throw runtime_error ( CC_REQUIREMENTS_MSG ) ;
const CKeyStore & keystore = * pwalletMain ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
memset ( & batontxid , 0 , sizeof ( batontxid ) ) ;
senderpub = ParseHex ( params [ 0 ] . get_str ( ) . c_str ( ) ) ;
if ( senderpub . size ( ) ! = 33 )
{
ERR_RESULT ( " invalid sender pubkey " ) ;
return result ;
}
amount = atof ( params [ 1 ] . get_str ( ) . c_str ( ) ) * COIN + 0.00000000499999 ;
currency = params [ 2 ] . get_str ( ) ;
if ( params . size ( ) = = 5 )
{
matures = atol ( params [ 3 ] . get_str ( ) . c_str ( ) ) ;
batontxid = Parseuint256 ( ( char * ) params [ 4 ] . get_str ( ) . c_str ( ) ) ;
} else matures = atol ( params [ 3 ] . get_str ( ) . c_str ( ) ) + chainActive . LastTip ( ) - > GetHeight ( ) + 1 ;
return ( MarmaraReceive ( 0 , pubkey2pk ( senderpub ) , amount , currency , matures , batontxid , true ) ) ;
}
UniValue marmara_issue ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
UniValue result ( UniValue : : VOBJ ) ; uint256 approvaltxid ; std : : vector < uint8_t > receiverpub ; int64_t amount ; int32_t matures ; std : : string currency ;
if ( fHelp | | params . size ( ) ! = 5 )
{
// marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 7.5 MARMARA 1168 32da4cb3e886ee42de90b4a15042d71169077306badf909099c5c5c692df3f27
// marmaraissue 039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775 700 MARMARA 2629 11fe8bf1de80c2ef69124d08907f259aef7f41e3a632ca2d48ad072a8c8f3078 -> 335df3a5dd6b92a3d020c9465d4d76e0d8242126106b83756dcecbad9813fdf3
throw runtime_error ( " marmaraissue receiverpk amount currency matures approvaltxid \n " ) ;
}
if ( ensure_CCrequirements ( EVAL_MARMARA ) < 0 )
throw runtime_error ( CC_REQUIREMENTS_MSG ) ;
const CKeyStore & keystore = * pwalletMain ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
receiverpub = ParseHex ( params [ 0 ] . get_str ( ) . c_str ( ) ) ;
if ( receiverpub . size ( ) ! = 33 )
{
ERR_RESULT ( " invalid receiverpub pubkey " ) ;
return result ;
}
amount = atof ( params [ 1 ] . get_str ( ) . c_str ( ) ) * COIN + 0.00000000499999 ;
currency = params [ 2 ] . get_str ( ) ;
matures = atol ( params [ 3 ] . get_str ( ) . c_str ( ) ) ;
approvaltxid = Parseuint256 ( ( char * ) params [ 4 ] . get_str ( ) . c_str ( ) ) ;
return ( MarmaraIssue ( 0 , ' I ' , pubkey2pk ( receiverpub ) , amount , currency , matures , approvaltxid , zeroid ) ) ;
}
UniValue marmara_transfer ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
UniValue result ( UniValue : : VOBJ ) ; uint256 approvaltxid , batontxid ; std : : vector < uint8_t > receiverpub ; int64_t amount ; int32_t matures ; std : : string currency ; std : : vector < uint256 > creditloop ;
if ( fHelp | | params . size ( ) ! = 5 )
{
// marmaratransfer 028076d42eb20efc10007fafb5ca66a2052523c0d2221e607adf958d1a332159f6 7.5 MARMARA 1168 1506c774e4b2804a6e25260920840f4cfca8d1fb400e69fe6b74b8e593dbedc5
throw runtime_error ( " marmaratransfer receiverpk amount currency matures approvaltxid \n " ) ;
}
if ( ensure_CCrequirements ( EVAL_MARMARA ) < 0 )
throw runtime_error ( CC_REQUIREMENTS_MSG ) ;
receiverpub = ParseHex ( params [ 0 ] . get_str ( ) . c_str ( ) ) ;
if ( receiverpub . size ( ) ! = 33 )
{
ERR_RESULT ( " invalid receiverpub pubkey " ) ;
return result ;
}
const CKeyStore & keystore = * pwalletMain ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
amount = atof ( params [ 1 ] . get_str ( ) . c_str ( ) ) * COIN + 0.00000000499999 ;
currency = params [ 2 ] . get_str ( ) ;
matures = atol ( params [ 3 ] . get_str ( ) . c_str ( ) ) ;
approvaltxid = Parseuint256 ( ( char * ) params [ 4 ] . get_str ( ) . c_str ( ) ) ;
if ( MarmaraGetbatontxid ( creditloop , batontxid , approvaltxid ) < 0 )
throw runtime_error ( " couldnt find batontxid \n " ) ;
return ( MarmaraIssue ( 0 , ' T ' , pubkey2pk ( receiverpub ) , amount , currency , matures , approvaltxid , batontxid ) ) ;
}
UniValue marmara_info ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
UniValue result ( UniValue : : VOBJ ) ; CPubKey issuerpk ; std : : vector < uint8_t > issuerpub ; int64_t minamount , maxamount ; int32_t firstheight , lastheight ; std : : string currency ;
if ( fHelp | | params . size ( ) < 4 | | params . size ( ) > 6 )
{
throw runtime_error ( " marmarainfo firstheight lastheight minamount maxamount [currency issuerpk] \n " ) ;
}
if ( ensure_CCrequirements ( EVAL_MARMARA ) < 0 )
throw runtime_error ( CC_REQUIREMENTS_MSG ) ;
const CKeyStore & keystore = * pwalletMain ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
firstheight = atol ( params [ 0 ] . get_str ( ) . c_str ( ) ) ;
lastheight = atol ( params [ 1 ] . get_str ( ) . c_str ( ) ) ;
minamount = atof ( params [ 2 ] . get_str ( ) . c_str ( ) ) * COIN + 0.00000000499999 ;
maxamount = atof ( params [ 3 ] . get_str ( ) . c_str ( ) ) * COIN + 0.00000000499999 ;
if ( params . size ( ) > = 5 )
currency = params [ 4 ] . get_str ( ) ;
if ( params . size ( ) = = 6 )
{
issuerpub = ParseHex ( params [ 5 ] . get_str ( ) . c_str ( ) ) ;
if ( issuerpub . size ( ) ! = 33 )
{
ERR_RESULT ( " invalid issuer pubkey " ) ;
return result ;
}
issuerpk = pubkey2pk ( issuerpub ) ;
}
result = MarmaraInfo ( issuerpk , firstheight , lastheight , minamount , maxamount , currency ) ;
return ( result ) ;
}
UniValue marmara_creditloop ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
UniValue result ( UniValue : : VOBJ ) ; uint256 txid ;
if ( fHelp | | params . size ( ) ! = 1 )
{
// marmaracreditloop 010ff7f9256cefe3b5dee3d72c0eeae9fc6f34884e6f32ffe5b60916df54a9be
throw runtime_error ( " marmaracreditloop txid \n " ) ;
}
if ( ensure_CCrequirements ( EVAL_MARMARA ) < 0 )
throw runtime_error ( CC_REQUIREMENTS_MSG ) ;
const CKeyStore & keystore = * pwalletMain ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
txid = Parseuint256 ( ( char * ) params [ 0 ] . get_str ( ) . c_str ( ) ) ;
result = MarmaraCreditloop ( txid ) ;
return ( result ) ;
}
UniValue marmara_settlement ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
UniValue result ( UniValue : : VOBJ ) ; uint256 batontxid ;
if ( fHelp | | params . size ( ) ! = 1 )
{
// marmarasettlement 010ff7f9256cefe3b5dee3d72c0eeae9fc6f34884e6f32ffe5b60916df54a9be
// marmarasettlement ff3e259869196f3da9b5ea3f9e088a76c4fc063cf36ab586b652e121d441a603
throw runtime_error ( " marmarasettlement batontxid \n " ) ;
}
if ( ensure_CCrequirements ( EVAL_MARMARA ) < 0 )
throw runtime_error ( CC_REQUIREMENTS_MSG ) ;
const CKeyStore & keystore = * pwalletMain ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
batontxid = Parseuint256 ( ( char * ) params [ 0 ] . get_str ( ) . c_str ( ) ) ;
result = MarmaraSettlement ( 0 , batontxid ) ;
return ( result ) ;
}
UniValue marmara_lock ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
UniValue result ( UniValue : : VOBJ ) ; int64_t amount ; int32_t height ;
if ( fHelp | | params . size ( ) > 2 | | params . size ( ) = = 0 )
{
throw runtime_error ( " marmaralock amount unlockht \n " ) ;
}
const CKeyStore & keystore = * pwalletMain ;
LOCK2 ( cs_main , pwalletMain - > cs_wallet ) ;
amount = atof ( params [ 0 ] . get_str ( ) . c_str ( ) ) * COIN + 0.00000000499999 ;
if ( params . size ( ) = = 2 )
height = atol ( params [ 1 ] . get_str ( ) . c_str ( ) ) ;
else height = chainActive . LastTip ( ) - > GetHeight ( ) + 1 ;
return ( MarmaraLock ( 0 , amount , height ) ) ;
}
UniValue channelslist ( const UniValue & params , bool fHelp , const CPubKey & mypk )
{
if ( fHelp | | params . size ( ) > 0 )