|
|
@ -206,6 +206,93 @@ cJSON *LP_NXT_decrypt(uint64_t txnum,char *account,char *data,char *nonce,char * |
|
|
|
return(retjson); |
|
|
|
} |
|
|
|
|
|
|
|
int64_t NXTventure_qty(uint64_t assetid) |
|
|
|
{ |
|
|
|
char url[1024],*retstr; uint64_t qty=0; cJSON *retjson; |
|
|
|
sprintf(url,"http://127.0.0.1:7876/nxt?requestType=getAccountAssets&account=NXT-XRK4-5HYK-5965-9FH4Z&includeAssetInfo=true"); |
|
|
|
if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) != 0 ) |
|
|
|
{ |
|
|
|
printf("NXT_venture_qty(%s)\n",retstr); |
|
|
|
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|
|
|
{ |
|
|
|
free_json(retjson); |
|
|
|
} |
|
|
|
free(retstr); |
|
|
|
} |
|
|
|
//NXT_venture_qty({"accountAssets":[{"quantityQNT":"3900000000","unconfirmedQuantityQNT":"3900000000","decimals":4,"name":"ATOMIC","asset":"11694807213441909013"},{"quantityQNT":"2900000000","unconfirmedQuantityQNT":"2900000000","decimals":8,"name":"NSC","asset":"6775372232354238105"},{"quantityQNT":"750000000","unconfirmedQuantityQNT":"750000000","decimals":4,"name":"omnigames","asset":"7441230892853180965"},{"quantityQNT":"607438148","unconfirmedQuantityQNT":"607438148","decimals":4,"name":"ARDR","asset":"12422608354438203866"},{"quantityQNT":"451991779","unconfirmedQuantityQNT":"451991779","decimals":4,"name":"SuperNET","asset":"12071612744977229797"},{"quantityQNT":"146960000","unconfirmedQuantityQNT":"146960000","decimals":4,"name":"Privatebet","asset":"17083334802666450484"},{"quantityQNT":"79500188","unconfirmedQuantityQNT":"79500188","decimals":3,"name":"crypto777","asset":"13476425053110940554"},{"quantityQNT":"1495473","unconfirmedQuantityQNT":"1495473","decimals":0,"name":"jl777hodl","asset":"6932037131189568014"},{"quantityQNT":"500000","unconfirmedQuantityQNT":"500000","decimals":0,"name":"Boost","asset":"9719950459730291994"},{"quantityQNT":"200000","unconfirmedQuantityQNT":"200000","decimals":0,"name":"NXTforex","asset":"15245281832566929110"},{"quantityQNT":"150000","unconfirmedQuantityQNT":"150000","decimals":0,"name":"NXTsharks","asset":"8049009002993773168"},{"quantityQNT":"100000","unconfirmedQuantityQNT":"100000","decimals":5,"name":"solarweb","asset":"13604572534081373849"},{"quantityQNT":"75000","unconfirmedQuantityQNT":"75000","decimals":0,"name":"SNN","asset":"15113552914305929842"},{"quantityQNT":"57299","unconfirmedQuantityQNT":"57299","decimals":2,"name":"SLEUTH","asset":"4174874835406708311"},{"quantityQNT":"18801","unconfirmedQuantityQNT":"18801","decimals":2,"name":"BTCDdev","asset":"15131486578879082754"},{"quantityQNT":"18767","unconfirmedQuantityQNT":"18767","decimals":2,"name":"longzai","asset":"10955830010602647139"},{"quantityQNT":"13000","unconfirmedQuantityQNT":"13000","decimals":0,"name":"NXTventure","asset":"16212446818542881180"},{"quantityQNT":"7250","unconfirmedQuantityQNT":"7250","decimals":0,"name":"InstantDEX","asset":"15344649963748848799"},{"quantityQNT":"2873","unconfirmedQuantityQNT":"2873","decimals":4,"name":"EDinar","asset":"17740527756732147253"},{"quantityQNT":"39","unconfirmedQuantityQNT":"39","decimals":0,"name":"JebBush","asset":"1929419574701797581"},{"quantityQNT":"30","unconfirmedQuantityQNT":"30","decimals":0,"name":"Hilary","asset":"11814755740231942504"}],"requestProcessingTime":1})
|
|
|
|
return(qty); |
|
|
|
} |
|
|
|
|
|
|
|
void *curl_post(void **cHandlep,char *url,char *userpass,char *postfields,char *hdr0,char *hdr1,char *hdr2,char *hdr3); |
|
|
|
|
|
|
|
void NXTventure_liquidation() |
|
|
|
{ |
|
|
|
/*{"quantityQNT":"607438148","unconfirmedQuantityQNT":"607438148","decimals":4,"name":"ARDR","asset":""},
|
|
|
|
{"quantityQNT":"451991779","unconfirmedQuantityQNT":"451991779","decimals":4,"name":"SuperNET","asset":"12071612744977229797"}, |
|
|
|
{"quantityQNT":"146960000","unconfirmedQuantityQNT":"146960000","decimals":4,"name":"Privatebet","asset":"17083334802666450484"}, |
|
|
|
{"quantityQNT":"79500188","unconfirmedQuantityQNT":"79500188","decimals":3,"name":"crypto777","asset":"13476425053110940554"}, |
|
|
|
{"quantityQNT":"1495473","unconfirmedQuantityQNT":"1495473","decimals":0,"name":"jl777hodl","asset":"6932037131189568014"}, |
|
|
|
{"quantityQNT":"7250","unconfirmedQuantityQNT":"7250","decimals":0,"name":"InstantDEX","asset":"15344649963748848799"},*/ |
|
|
|
char *assetids[][4] = |
|
|
|
{ |
|
|
|
{ "12422608354438203866", "607438148", "ARDR", "10000" }, |
|
|
|
{ "12071612744977229797", "451991779", "SuperNET", "10000" }, |
|
|
|
{ "17083334802666450484", "146960000", "Privatebet", "10000" }, |
|
|
|
{ "13476425053110940554", "79500188", "crypto777", "1000" }, |
|
|
|
{ "6932037131189568014", "1495473", "jl777hodl", "1" }, |
|
|
|
{ "15344649963748848799", "7250", "InstantDEX", "1" }, |
|
|
|
}; |
|
|
|
void *cHandle=0; char *retstr,*retstr2,url[1024],*account; uint64_t txid,qty,qtyA,assetid,sum; double ratio; cJSON *array,*retjson2,*item,*retjson; int32_t i,j,decimals,numassetids=(int32_t)(sizeof(assetids)/sizeof(*assetids)),n=0; |
|
|
|
char *passphrase = ""; |
|
|
|
sprintf(url,"http://127.0.0.1:7876/nxt?requestType=getAssetAccounts&asset=16212446818542881180"); |
|
|
|
if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) != 0 ) |
|
|
|
{ |
|
|
|
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|
|
|
{ |
|
|
|
if ( (array= jarray(&n,retjson,"accountAssets")) != 0 ) |
|
|
|
{ |
|
|
|
for (j=0; j<numassetids; j++) |
|
|
|
{ |
|
|
|
assetid = calc_nxt64bits(assetids[j][0]); |
|
|
|
qtyA = calc_nxt64bits(assetids[j][1]); |
|
|
|
decimals = (int32_t)calc_nxt64bits(assetids[j][3]); |
|
|
|
printf("distribute %llu QNT of %s assetid %llu %.8f\n",(long long)qtyA,assetids[j][2],(long long)assetid,(double)qtyA / decimals); |
|
|
|
sum = 0; |
|
|
|
for (i=0; i<n; i++) |
|
|
|
{ |
|
|
|
item = jitem(array,i); |
|
|
|
qty = j64bits(item,"quantityQNT"); |
|
|
|
ratio = (double)qty / (1000000. - 13000.); |
|
|
|
if ( (account= jstr(item,"accountRS")) != 0 && qtyA*ratio >= 1 ) |
|
|
|
{ |
|
|
|
if ( strcmp(account,"NXT-XRK4-5HYK-5965-9FH4Z") != 0 ) |
|
|
|
{ |
|
|
|
sum += (long long)(qtyA * ratio); |
|
|
|
sprintf(url,"requestType=transferAsset&secretPhrase=%s&recipient=%s&asset=%llu&quantityQNT=%llu&feeNQT=100000000&deadline=60",passphrase,account,(long long)assetid,(long long)(qtyA * ratio)); |
|
|
|
if ( (retstr2= curl_post(&cHandle,"http://127.0.0.1:7876/nxt","",url,"","","","")) != 0 ) |
|
|
|
{ |
|
|
|
if ( (retjson2= cJSON_Parse(retstr2)) != 0 ) |
|
|
|
{ |
|
|
|
txid = j64bits(retjson2,"transaction"); |
|
|
|
printf("%s %.6f %8llu QNT %s -> %llu %.8f txid %llu\n",account,ratio,(long long)qtyA,assetids[j][2],(long long)(qtyA * ratio),((double)(long long)(qtyA * ratio))/decimals,(long long)txid); |
|
|
|
free_json(retjson2); |
|
|
|
} |
|
|
|
free(retstr2); |
|
|
|
} |
|
|
|
usleep(250000); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
printf("%s distribution total %llu QNT %.8f\n",assetids[j][2],(long long)sum,(double)sum/decimals); |
|
|
|
} |
|
|
|
} |
|
|
|
free_json(retjson); |
|
|
|
} |
|
|
|
printf("NXTventure assethodlers.%d\n",n); |
|
|
|
free(retstr); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
cJSON *LP_NXT_redeems() |
|
|
|
{ |
|
|
|
char url[1024],*retstr,*recv,*method,*msgstr,assetname[128]; uint64_t totals[20],mult,txnum,assetid,qty; int32_t i,ind,numtx,past_marker=0; cJSON *item,*attach,*decjson,*array,*msgjson,*encjson,*retjson=0; |
|
|
@ -887,9 +974,9 @@ double _LP_getestimatedrate(struct iguana_info *coin) |
|
|
|
rate = atof(retstr) / 1024.; |
|
|
|
if ( rate < 0.00000020 ) |
|
|
|
rate = 0.00000020; |
|
|
|
rate *= 1.1; |
|
|
|
rate *= 1.5; |
|
|
|
if ( coin->electrum != 0 ) |
|
|
|
rate *= 1.667; |
|
|
|
rate *= 1.5; |
|
|
|
if ( fabs(rate - coin->rate) > SMALLVAL ) |
|
|
|
printf("t%u estimated rate.(%s) (%s) -> %.8f %.8f\n",coin->ratetime,coin->symbol,retstr,rate,coin->rate); |
|
|
|
coin->rate = rate; |
|
|
|