Browse Source

Merge pull request #177 from jl777/dev

Dev
win-cross
jl777 8 years ago
committed by GitHub
parent
commit
d44e9dc23e
  1. BIN
      OSlibs/linux/x86_64/libnanomsg-static.a
  2. 30
      basilisk/basilisk.c
  3. 3
      basilisk/basilisk.h
  4. 2
      basilisk/basilisk_CMD.c
  5. 2
      basilisk/basilisk_DEX.c
  6. 2
      basilisk/basilisk_MSG.c
  7. 2
      basilisk/basilisk_bitcoin.c
  8. 2
      basilisk/basilisk_ping.c
  9. 6
      basilisk/basilisk_swap.c
  10. 110
      basilisk/basilisk_tradebot.c
  11. 1066
      basilisk/tradebots_SVM.h
  12. 1129
      basilisk/tradebots_liquidity.c
  13. 2
      crypto777/OS_nonportable.c
  14. 13
      crypto777/OS_portable.c
  15. 3
      crypto777/OS_portable.h
  16. 2
      crypto777/OS_time.c
  17. 2
      crypto777/SaM.c
  18. 3
      crypto777/bitcoind_RPC.c
  19. 2
      crypto777/cJSON.c
  20. 2
      crypto777/curve25519.c
  21. 2
      crypto777/hmac_sha512.c
  22. 2
      crypto777/iguana_OS.c
  23. 2
      crypto777/iguana_serdes.c
  24. 10
      crypto777/iguana_utils.c
  25. 30
      crypto777/m_LP_StaticNanoMsg
  26. 2
      crypto777/ramcoder.c
  27. 2
      datachain/datachain.c
  28. 2
      deprecated/iguana_instantdex.c
  29. 2
      gecko/gecko.c
  30. 11
      iguana/SuperNET_keys.c
  31. 2
      iguana/dPoW.h
  32. 4
      iguana/dpow/dpow_fsm.c
  33. 6
      iguana/dpow/dpow_network.c
  34. 2
      iguana/dpow/dpow_prices.c
  35. 14
      iguana/dpow/dpow_rpc.c
  36. 19
      iguana/dpow/dpow_tx.c
  37. 2
      iguana/exchanges/bitcoin.c
  38. 2
      iguana/exchanges/bitcoin.h
  39. 2
      iguana/exchanges/bitfinex.c
  40. 2
      iguana/exchanges/bitstamp.c
  41. 9
      iguana/exchanges/bittrex.c
  42. 2
      iguana/exchanges/btc38.c
  43. 2
      iguana/exchanges/btce.c
  44. 2
      iguana/exchanges/coinbase.c
  45. 2
      iguana/exchanges/exchange_supports.h
  46. 2
      iguana/exchanges/exchange_undefs.h
  47. 2
      iguana/exchanges/fxcm.c
  48. 2
      iguana/exchanges/huobi.c
  49. 2
      iguana/exchanges/instaforex.c
  50. 2
      iguana/exchanges/jumblr.c
  51. 2
      iguana/exchanges/lakebtc.c
  52. 2
      iguana/exchanges/nxtae.c
  53. 2
      iguana/exchanges/okcoin.c
  54. 7
      iguana/exchanges/poloniex.c
  55. 2
      iguana/exchanges/quadriga.c
  56. 2
      iguana/exchanges/truefx.c
  57. 2
      iguana/exchanges/unconf.c
  58. 6
      iguana/exchanges777.h
  59. 2
      iguana/iguana777.c
  60. 13
      iguana/iguana777.h
  61. 2
      iguana/iguana_accept.c
  62. 2
      iguana/iguana_bitmap.c
  63. 2
      iguana/iguana_blocks.c
  64. 2
      iguana/iguana_bundles.c
  65. 2
      iguana/iguana_chains.c
  66. 20
      iguana/iguana_exchanges.c
  67. 2
      iguana/iguana_init.c
  68. 2
      iguana/iguana_interpreter.c
  69. 2
      iguana/iguana_json.c
  70. 2
      iguana/iguana_mofn.c
  71. 2
      iguana/iguana_msg.c
  72. 27
      iguana/iguana_notary.c
  73. 61
      iguana/iguana_payments.c
  74. 2
      iguana/iguana_peers.c
  75. 2
      iguana/iguana_ramchain.c
  76. 2
      iguana/iguana_realtime.c
  77. 2
      iguana/iguana_recv.c
  78. 3
      iguana/iguana_rpc.c
  79. 2
      iguana/iguana_scripts.c
  80. 2
      iguana/iguana_secp.c
  81. 2
      iguana/iguana_sign.c
  82. 2
      iguana/iguana_spendvectors.c
  83. 2
      iguana/iguana_tradebots.c
  84. 2
      iguana/iguana_tx.c
  85. 2
      iguana/iguana_txidfind.c
  86. 2
      iguana/iguana_unspents.c
  87. 2
      iguana/iguana_volatiles.c
  88. 4
      iguana/iguana_wallet.c
  89. 6
      iguana/m_LP
  90. 12
      iguana/m_LP_StaticNanoMsg
  91. 8
      iguana/m_notary
  92. 9
      iguana/main.c
  93. 2
      iguana/ramchain_api.c
  94. 75
      iguana/tests/arbinit
  95. 16
      iguana/tests/arbnxt
  96. 3
      iguana/tests/gensvm
  97. 3
      includes/iguana_apideclares.h
  98. 2
      includes/iguana_defines.h
  99. 3
      includes/iguana_funcs.h
  100. 2
      includes/iguana_globals.h

BIN
OSlibs/linux/x86_64/libnanomsg-static.a

Binary file not shown.

30
basilisk/basilisk.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -14,6 +14,7 @@
******************************************************************************/
#include "../iguana/iguana777.h"
#include "../iguana/exchanges777.h"
typedef char *basilisk_servicefunc(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk);
@ -482,6 +483,7 @@ int32_t basilisk_relayid(struct supernet_info *myinfo,uint32_t ipbits)
#include "basilisk_lisk.c"
#include "basilisk_MSG.c"
#include "tradebots_liquidity.c"
#include "basilisk_tradebot.c"
#include "basilisk_swap.c"
#include "basilisk_DEX.c"
@ -875,39 +877,55 @@ void basilisks_loop(void *arg)
if ( relay == 0 )
relay = iguana_coinfind("RELAY");
startmilli = OS_milliseconds();
endmilli = startmilli + 1000;
//fprintf(stderr,"A ");
basilisk_issued_purge(myinfo,600000);
//fprintf(stderr,"B ");
basilisk_p2pQ_process(myinfo,777);
//fprintf(stderr,"C ");
if ( myinfo->IAMNOTARY != 0 )
{
if ( relay != 0 )
{
//fprintf(stderr,"D ");
basilisk_ping_send(myinfo,relay);
}
counter++;
//fprintf(stderr,"E ");
if ( myinfo->numdpows == 1 )
{
iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]);
endmilli = startmilli + 50;
endmilli = startmilli + 100;
}
else if ( myinfo->numdpows > 1 )
{
dp = &myinfo->DPOWS[counter % myinfo->numdpows];
iguana_dPoWupdate(myinfo,dp);
if ( (counter % myinfo->numdpows) != 0 )
{
//fprintf(stderr,"F ");
iguana_dPoWupdate(myinfo,&myinfo->DPOWS[0]);
endmilli = startmilli + 10;
}
endmilli = startmilli + 30;
}
}
else
{
//fprintf(stderr,"G ");
dex_updateclient(myinfo);
if ( myinfo->IAMLP != 0 )
endmilli = startmilli + 1000;
else endmilli = startmilli + 2000;
endmilli = startmilli + 500;
else endmilli = startmilli + 1000;
}
if ( myinfo->expiration != 0 && (myinfo->dexsock >= 0 || myinfo->IAMLP != 0 || myinfo->DEXactive > time(NULL)) )
{
//fprintf(stderr,"H ");
basilisk_requests_poll(myinfo);
//printf("RELAYID.%d endmilli %f vs now %f\n",myinfo->NOTARY.RELAYID,endmilli,OS_milliseconds());
}
//printf("RELAYID.%d endmilli %f vs now %f\n",myinfo->NOTARY.RELAYID,endmilli,startmilli);
while ( OS_milliseconds() < endmilli )
usleep(10000);
//printf("finished waiting numdpow.%d\n",myinfo->numdpows);
iter++;
}
}

3
basilisk/basilisk.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -79,6 +79,7 @@ struct basilisk_swapinfo
struct basilisk_swap
{
struct supernet_info *myinfo; struct iguana_info *bobcoin,*alicecoin;
void (*balancingtrade)(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob);
struct basilisk_swapinfo I;
struct basilisk_rawtx bobdeposit,bobpayment,alicepayment,myfee,otherfee,aliceclaim,alicespend,bobreclaim,bobspend,bobrefund,alicereclaim;
bits256 privkeys[INSTANTDEX_DECKSIZE];

2
basilisk/basilisk_CMD.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
basilisk/basilisk_DEX.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
basilisk/basilisk_MSG.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
basilisk/basilisk_bitcoin.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
basilisk/basilisk_ping.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

6
basilisk/basilisk_swap.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -1558,7 +1558,7 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap
printf("Bob error spending alice payment\n");
else
{
basilisk_swap_balancingtrade(myinfo,swap,1);
tradebot_swap_balancingtrade(myinfo,swap,1);
printf("Bob spends alicepayment\n");
swap->I.statebits |= 0x40000;
while ( basilisk_numconfirms(myinfo,&swap->bobspend) < swap->I.aliceconfirms )
@ -1629,7 +1629,7 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap
if ( basilisk_swapget(myinfo,swap,0x8000,data,maxlen,basilisk_verify_bobpaid) == 0 )
{
printf("got bobpayment\n");
basilisk_swap_balancingtrade(myinfo,swap,0);
tradebot_swap_balancingtrade(myinfo,swap,0);
// verify payment and submit, set confirmed height
swap->I.statebits |= 0x8000;
}

110
basilisk/basilisk_tradebot.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -14,60 +14,6 @@
******************************************************************************/
// included from basilisk.c
void basilisk_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob)
{
// update balance, compare to target balance, issue balancing trade via central exchanges, if needed
double price,volume,srcamount,destamount,profitmargin,dir=0.,dotrade=1.; char base[64],rel[64];
srcamount = swap->I.req.srcamount;
destamount = swap->I.req.destamount;
profitmargin = (double)swap->I.req.profitmargin / 1000000.;
if ( srcamount <= SMALLVAL || destamount <= SMALLVAL )
{
printf("illegal amount for balancing %f %f\n",srcamount,destamount);
return;
}
strcpy(rel,"BTC");
if ( strcmp(swap->I.req.src,"BTC") == 0 )
{
strcpy(base,swap->I.req.dest);
price = (srcamount / destamount);
volume = destamount / SATOSHIDEN;
dir = -1.;
}
else if ( strcmp(swap->I.req.dest,"BTC") == 0 )
{
strcpy(base,swap->I.req.src);
price = (destamount / srcamount);
volume = srcamount / SATOSHIDEN;
dir = 1.;
}
else
{
printf("only BTC trades can be balanced, not (%s/%s)\n",swap->I.req.src,swap->I.req.dest);
return;
}
if ( iambob != 0 )
{
if ( myinfo->IAMLP != 0 )
{
printf("BOB: price %f * vol %f -> %s newprice %f margin %.2f%%\n",price,volume,dir < 0. ? "buy" : "sell",price + dir * price * profitmargin,100*profitmargin);
if ( dir < 0. )
InstantDEX_buy(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade);
else InstantDEX_sell(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade);
}
}
else
{
if ( myinfo->IAMLP != 0 )
{
printf("ALICE: price %f * vol %f -> %s newprice %f margin %.2f%%\n",price,volume,dir > 0. ? "buy" : "sell",price - dir * price * profitmargin,100*profitmargin);
if ( dir > 0. )
InstantDEX_buy(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade);
else InstantDEX_sell(myinfo,0,0,0,"poloniex",base,rel,price,volume,dotrade);
}
}
}
cJSON *basilisk_rawtxobj(struct supernet_info *myinfo,struct basilisk_swap *swap,struct basilisk_rawtx *rawtx)
{
@ -170,12 +116,13 @@ struct basilisk_swap *basilisk_swapstore(struct supernet_info *myinfo,struct bas
struct basilisk_swap *basilisk_swapload(struct supernet_info *myinfo,struct basilisk_swap *swap,uint32_t requestid,uint32_t quoteid)
{
return(swap);
// set swap fields and return it if found
return(0);
}
void basilisk_swapstart(struct supernet_info *myinfo) // scan saved tmpswap, purge if complete, else Q
{
// for resuming pending swaps
}
void basilisk_txlog(struct supernet_info *myinfo,struct basilisk_swap *swap,struct basilisk_rawtx *rawtx,int32_t delay)
@ -329,53 +276,6 @@ int32_t basilisk_request_cmpref(struct basilisk_request *ref,struct basilisk_req
} else return(0);
}
void tradebot_liquidity_command(struct supernet_info *myinfo,char *base,bits256 hash,cJSON *vals)
{
struct liquidity_info li,refli; int32_t i;
memset(&li,0,sizeof(li));
strcpy(li.base,base), strcpy(li.rel,"BTC");
li.profit = jdouble(vals,"profit");
li.refprice = jdouble(vals,"refprice");
for (i=0; i<sizeof(myinfo->linfos)/sizeof(*myinfo->linfos); i++)
{
refli = myinfo->linfos[i];
if ( strcmp(li.rel,refli.base) == 0 && strcmp(li.base,refli.rel) == 0 )
{
strcpy(li.base,refli.base);
strcpy(li.rel,refli.rel);
if ( fabs(li.refprice) > SMALLVAL )
li.refprice = (1. / li.refprice);
else li.refprice = 0.;
printf("Set rev linfo[%d] (%s/%s) %.6f %.8f\n",i,li.base,li.rel,li.profit,li.refprice);
myinfo->linfos[i] = li;
return;
}
else if ( refli.base[0] == 0 || (strcmp(li.base,refli.base) == 0 && strcmp(li.rel,refli.rel) == 0) )
{
myinfo->linfos[i] = li;
printf("Set linfo[%d] (%s/%s) %.6f %.8f\n",i,li.base,li.rel,li.profit,li.refprice);
return;
}
}
printf("ERROR: too many linfos %d\n",i);
}
double tradebot_liquidity_active(struct supernet_info *myinfo,double *refpricep,char *base,char *rel)
{
int32_t i; struct liquidity_info refli;
*refpricep = 0.;
for (i=0; i<sizeof(myinfo->linfos)/sizeof(*myinfo->linfos); i++)
{
refli = myinfo->linfos[i];
if ( (strcmp(base,refli.base) == 0 && strcmp(rel,refli.rel) == 0) || (strcmp(rel,refli.base) == 0 && strcmp(base,refli.rel) == 0 ))
{
*refpricep = refli.refprice;
return(refli.profit);
}
}
return(0.);
}
double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk_request *issueR,struct basilisk_request *list,int32_t n)
{
int32_t i,noquoteflag=0,havequoteflag=0,myrequest=0,maxi=-1; int64_t balance=0,destamount,minamount = 0,maxamount = 0; uint32_t pendingid=0; struct basilisk_swap *active; double metric = 0.;
@ -414,7 +314,7 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk
}
//printf("%s -> %s myrequest.%d pendingid.%u noquoteflag.%d havequoteflag.%d maxi.%d %.8f\n",list[0].src,list[0].dest,myrequest,pendingid,noquoteflag,havequoteflag,maxi,dstr(maxamount));
double retvals[4],refprice,profitmargin,aveprice; cJSON *retjson; char *retstr;
if ( myinfo->IAMLP != 0 && myrequest == 0 && pendingid == 0 && noquoteflag != 0 && (profitmargin= tradebot_liquidity_active(myinfo,&refprice,list[0].src,list[0].dest)) > 0. )
if ( maxi >= 0 && myinfo->IAMLP != 0 && myrequest == 0 && pendingid == 0 && noquoteflag != 0 && (profitmargin= tradebot_liquidity_active(myinfo,&refprice,"DEX",list[maxi].src,list[maxi].dest,(double)maxamount/SATOSHIDEN)) > 0. )
{
if ( (aveprice= instantdex_avehbla(myinfo,retvals,list[0].src,list[0].dest,1.3 * dstr(list[0].srcamount))) == 0. || refprice > aveprice )
aveprice = refprice;

1066
basilisk/tradebots_SVM.h

File diff suppressed because it is too large

1129
basilisk/tradebots_liquidity.c

File diff suppressed because it is too large

2
crypto777/OS_nonportable.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

13
crypto777/OS_portable.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -94,6 +94,17 @@ char *OS_portable_path(char *str)
#endif
}
FILE *OS_appendfile(char *origfname)
{
char fname[1024]; FILE *fp;
strcpy(fname,origfname);
OS_portable_path(fname);
if ( (fp= fopen(fname,"rb+")) == 0 )
fp = fopen(fname,"wb");
else fseek(fp,0,SEEK_END);
return(fp);
}
int32_t OS_portable_renamefile(char *fname,char *newfname)
{
#ifdef _WIN32

3
crypto777/OS_portable.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -219,6 +219,7 @@ uint32_t OS_conv_datenum(int32_t datenum,int32_t hour,int32_t minute,int32_t sec
int32_t OS_conv_unixtime(struct tai *t,int32_t *secondsp,time_t timestamp);
char *OS_compatible_path(char *str);
FILE *OS_appendfile(char *origfname);
int32_t OS_compare_files(char *fname,char *fname2);
int64_t OS_copyfile(char *src,char *dest,int32_t cmpflag);

2
crypto777/OS_time.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
crypto777/SaM.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

3
crypto777/bitcoind_RPC.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -155,6 +155,7 @@ try_again:
curl_easy_setopt(curl_handle,CURLOPT_WRITEDATA, &s); // we pass our 's' struct to the callback
curl_easy_setopt(curl_handle,CURLOPT_NOSIGNAL, 1L); // supposed to fix "Alarm clock" and long jump crash
curl_easy_setopt(curl_handle,CURLOPT_NOPROGRESS, 1L); // no progress callback
//curl_easy_setopt(curl_handle,CURLOPT_TIMEOUT, 60L);
if ( strncmp(url,"https",5) == 0 )
{
curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYPEER,0);

2
crypto777/cJSON.c

@ -634,7 +634,7 @@ void cJSON_Minify(char *json)
// the following written by jl777
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
crypto777/curve25519.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
crypto777/hmac_sha512.c

@ -506,7 +506,7 @@ char *hmac_sha512_str(char *dest,char *key,int32_t key_size,char *message)
hmac_memory(&sha512_desc,(void *)key,key_size,(void *)message,strlen(message),checkbuf,&size);
init_hexbytes_noT(dest,mac,SHA512_DIGEST_SIZE);
init_hexbytes_noT(dest2,checkbuf,SHA512_DIGEST_SIZE);
//if ( memcmp(checkbuf,mac,SHA512_DIGEST_SIZE) != 0 )
if ( memcmp(checkbuf,mac,SHA512_DIGEST_SIZE) != 0 )
printf("hmac_512 : %s vs %s\n",dest,dest2);
return(dest);
}

2
crypto777/iguana_OS.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
crypto777/iguana_serdes.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

10
crypto777/iguana_utils.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -193,6 +193,14 @@ void calc_OP_HASH160(char hexstr[41],uint8_t rmd160[20],char *pubkey)
init_hexbytes_noT(hexstr,rmd160,20);
}
double _xblend(float *destp,double val,double decay)
{
double oldval;
if ( (oldval = *destp) != 0. )
return((oldval * decay) + ((1. - decay) * val));
else return(val);
}
double _dxblend(double *destp,double val,double decay)
{
double oldval;

30
crypto777/m_LP_StaticNanoMsg

@ -0,0 +1,30 @@
# Very basic makefile for compiling iguana in Linux with StaticNanoMsg
# derived from m_LP (used to compile iguana for linux)
# author: fadedreamz
SRCS=$(wildcard *.c)
SRCS+=$(wildcard jpeg/*.c)
SRCS+=$(wildcard jpeg/unix/*.c)
OBJS=$(SRCS:%.c=%.o)
INCLUDE_DIRS+=-I/usr/lib/x86_64-linux-gnu/curl
PREPROCESSORS+=-DLIQUIDITY_PROVIDER=1 -DUSE_STATIC_NANOMSG
CFLAGS+=-O2 $(PREPROCESSORS) $(INCLUDE_DIRS)
update_repo:
git pull
clean:
-rm $(OBJS)
all: update_repo $(OBJS) static
@echo ' ================'
@echo '| crypto777 [OK] |'
@echo ' ================'
static: $(OBJS)
ar rc ../agents/libcrypto777.a $(OBJS)
.PHONY: update_repo clean all static

2
crypto777/ramcoder.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
datachain/datachain.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
deprecated/iguana_instantdex.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
gecko/gecko.c

@ -1,6 +1,6 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

11
iguana/SuperNET_keys.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -84,7 +84,6 @@ bits256 SuperNET_wallet2priv(char *wallet2fname,bits256 wallethash)
wallet2str[i] ^= wallethash.bytes[(i + r) % 32];
vcalc_sha256(0,wallet2priv.bytes,(void *)wallet2str,(int32_t)allocsize);
free(wallet2str);
//char str[65]; printf("wallet2priv.(%s) from.(%s) crc.%u and passphrase r.%d len.%ld\n",bits256_str(str,wallet2priv),wallet2fname,crc,r,allocsize);
} else if ( wallet2fname[0] != 0 )
printf("SuperNET_wallet2priv cant open (%s)\n",wallet2fname);
return(wallet2priv);
@ -248,7 +247,6 @@ cJSON *SuperNET_decryptedjson(char *destfname,char *passphrase,int32_t passsize,
wallethash = SuperNET_linehash(passphrase);
SuperNET_linehash(fname2fa); // maps special chars
wallet2priv = SuperNET_wallet2priv(fname2fa,wallethash);
//char str[65],str2[65]; printf("(%s + %s) -> wallethash.%s 2.(%s)\n",passphrase,fname2fa,bits256_str(str,wallethash),bits256_str(str2,wallet2priv));
}
first = (bits256_nonz(wallethash) != 0 && bits256_cmp(wallethash,GENESIS_PRIVKEY) != 0);
second = (bits256_nonz(wallet2priv) != 0 && bits256_cmp(wallet2priv,GENESIS_PRIVKEY) != 0);
@ -259,7 +257,6 @@ cJSON *SuperNET_decryptedjson(char *destfname,char *passphrase,int32_t passsize,
wallet2shared = SuperNET_wallet2shared(wallethash,wallet2priv);
wallet2pub = curve25519(wallet2shared,curve25519_basepoint9());
sprintf(destfname,"%s/%s",GLOBAL_CONFSDIR,bits256_str(str,wallet2pub));
//printf("fname.(%s) wallet2pub.%s < [%s, %s]\n",destfname,bits256_str(str,wallet2pub),passphrase,fname2fa);
if ( (confstr= OS_filestr(&allocsize,destfname)) != 0 )
{
if ( (filejson= cJSON_Parse(confstr)) != 0 )
@ -305,12 +302,9 @@ int32_t _SuperNET_encryptjson(struct supernet_info *myinfo,char *destfname,char
wallethash = SuperNET_linehash(passphrase);
SuperNET_linehash(fname2fa); // maps special chars
wallet2priv = SuperNET_wallet2priv(fname2fa,wallethash);
//char str2[65]; printf("ENCRYPT.[%s %s] (%s) 2.%s\n",passphrase,fname2fa,bits256_str(str,wallethash),bits256_str(str2,wallet2priv));
wallet2shared = SuperNET_wallet2shared(wallethash,wallet2priv);
wallet2pub = curve25519(wallet2shared,curve25519_basepoint9());
sprintf(destfname,"%s/%s",GLOBAL_CONFSDIR,bits256_str(str,wallet2pub));
//printf("SAVE ARGJSON.(%s) [%s, %s] -> destfname.(%s)\n",jprint(argjson,0),passphrase,fname2fa,destfname);
//printf("shared.%llx -> pub.%s\n",(long long)wallet2shared.txid,bits256_str(str,wallet2pub));
SuperNET_savejsonfile(myinfo,destfname,wallethash,wallet2pub,argjson);
return(0);
}
@ -375,7 +369,6 @@ char *SuperNET_keysinit(struct supernet_info *myinfo,char *argjsonstr)
passphrase[0] = fname2fa[0] = 0;
wallethash = wallet2priv = GENESIS_PRIVKEY;
coinargs = SuperNET_parsemainargs(myinfo,&wallethash,&wallet2priv,argjsonstr);
//printf("wallethash.%s 2.(%s)\n",bits256_str(str,wallethash),bits256_str(str2,wallet2priv));
if ( (msgjson= SuperNET_decryptedjson(destfname,passphrase,sizeof(passphrase),wallethash,fname2fa,sizeof(fname2fa),wallet2priv)) != 0 )
{
SuperNET_parsemyinfo(myinfo,msgjson);
@ -395,9 +388,7 @@ char *SuperNET_keysinit(struct supernet_info *myinfo,char *argjsonstr)
jaddbits256(json,"persistent_pub",myinfo->myaddr.persistent);
OS_randombytes((void *)&r,sizeof(r));
jadd64bits(json,"rand",r);
//printf("call SuperNET_encryptjson\n");
_SuperNET_encryptjson(myinfo,destfname,passphrase,sizeof(passphrase),fname2fa,sizeof(fname2fa),json);
//printf("save.(%s)\n",jprint(json,0));
free_json(json);
}
if ( myinfo->ipaddr[0] == 0 )

2
iguana/dPoW.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

4
iguana/dpow/dpow_fsm.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -412,7 +412,7 @@ void dpow_statemachinestart(void *ptr)
extralen = dpow_paxpending(extras,&bp->paxwdcrc);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
sleep(5);
sleep(13);
if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height )
{
if ( bp->isratify == 0 )

6
iguana/dpow/dpow_network.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -163,7 +163,7 @@ char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32
printf("%d: subscribe connect (%s)\n",myinfo->numdexipbits,str);
}
}
//nn_connect(myinfo->reqsock,nanomsg_tcpname(0,str,ipaddr,REP_SOCK));
nn_connect(myinfo->reqsock,nanomsg_tcpname(0,str,ipaddr,REP_SOCK));
printf("%d: req connect (%s)\n",myinfo->numdexipbits,str);
}
}
@ -1206,7 +1206,7 @@ int32_t dpow_nanomsg_update(struct supernet_info *myinfo)
break;
usleep(1000);
}*/
while ( (size= nn_recv(myinfo->dpowsock,&np,NN_MSG,0)) >= 0 && num < 100 )
while ( (size= nn_recv(myinfo->dpowsock,&np,NN_MSG,0)) >= 0 && num < 1000 )
{
if ( size > 0 )
{

2
iguana/dpow/dpow_prices.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

14
iguana/dpow/dpow_rpc.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -1001,7 +1001,7 @@ int32_t dpow_issuer_block(struct dpow_info *dp,struct iguana_info *coin,int32_t
int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int32_t height,uint32_t *isrealtimep)
{
char *retstr; int32_t i,kmdheight; cJSON *infoobj,*result; uint16_t port = coin->chain->rpcport;
char *retstr; int32_t i,currentheight=0; cJSON *infoobj,*result; uint16_t port = coin->chain->rpcport;
if ( height <= 0 )
height = 1;
*isrealtimep = 0;
@ -1009,9 +1009,9 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3
{
if ( (infoobj= cJSON_Parse(retstr)) != 0 )
{
if ( (result= jobj(infoobj,(char *)"result")) != 0 && (kmdheight= jint(result,(char *)"blocks")) != 0 )
if ( (result= jobj(infoobj,(char *)"result")) != 0 && (currentheight= jint(result,(char *)"blocks")) != 0 )
{
for (i=0; i<1000 && height<=kmdheight; i++,height++)
for (i=0; i<100 && height<=currentheight; i++,height++)
{
/*fprintf(stderr,"%s.%d ",coin->symbol,height);
if ( (height % 10) == 0 )
@ -1028,7 +1028,7 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3
}
usleep(10000);
}
if ( height >= kmdheight )
if ( height >= currentheight )
*isrealtimep = (uint32_t)time(NULL);
}
free_json(infoobj);
@ -1038,8 +1038,8 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3
}
else
{
//printf("error from %s\n",coin->symbol);
sleep(3);
printf("error from %s height.%d currentheight.%d\n",coin->symbol,height,currentheight);
usleep(100000);
}
return(height);
}

19
iguana/dpow/dpow_tx.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -558,7 +558,7 @@ int32_t dpow_signedtxgen(struct supernet_info *myinfo,struct dpow_info *dp,struc
void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,int32_t myind,int32_t src_or_dest,int8_t bestk,uint64_t bestmask,uint8_t pubkeys[64][33],int32_t numratified)
{
bits256 txid,srchash,zero,signedtxid; struct iguana_info *coin; int32_t j,len,numsigs; char *retstr=0,str[65],str2[65]; uint8_t txdata[32768]; uint32_t channel;
bits256 txid,srchash,zero,signedtxid; struct iguana_info *coin; int32_t j,len,numsigs; char *retstr=0,str[65],str2[65]; uint8_t txdata[32768]; uint32_t channel,state;
coin = (src_or_dest != 0) ? bp->destcoin : bp->srccoin;
memset(zero.bytes,0,sizeof(zero));
channel = (src_or_dest != 0) ? DPOW_SIGBTCCHANNEL : DPOW_SIGCHANNEL;
@ -586,11 +586,20 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
decode_hex(txdata+32,len,bp->signedtx);
for (j=0; j<sizeof(srchash); j++)
txdata[j] = txid.bytes[j];
dpow_send(myinfo,dp,bp,txid,bp->hashmsg,(src_or_dest != 0) ? DPOW_BTCTXIDCHANNEL : DPOW_TXIDCHANNEL,bp->height,txdata,len+32);
bp->state = src_or_dest != 0 ? 1000 : 0xffffffff;
printf("complete statemachine.%s ht.%d state.%d (%x %x)\n",coin->symbol,bp->height,bp->state,bp->hashmsg.uints[0],txid.uints[0]);
state = src_or_dest != 0 ? 1000 : 0xffffffff;
if ( bp->state < state )
{
bp->state = state;
dpow_send(myinfo,dp,bp,txid,bp->hashmsg,(src_or_dest != 0) ? DPOW_BTCTXIDCHANNEL : DPOW_TXIDCHANNEL,bp->height,txdata,len+32);
printf("complete statemachine.%s ht.%d state.%d (%x %x)\n",coin->symbol,bp->height,bp->state,bp->hashmsg.uints[0],txid.uints[0]);
}
} else printf("sendtxid mismatch got %s instead of %s\n",bits256_str(str,txid),bits256_str(str2,signedtxid));
}
else
{
bp->state = 0xffffffff;
printf("dpow_sigscheck: mismatched txid.%s vs %s\n",bits256_str(str,txid),retstr);
}
free(retstr);
retstr = 0;
}

2
iguana/exchanges/bitcoin.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/bitcoin.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/bitfinex.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/bitstamp.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

9
iguana/exchanges/bittrex.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -77,7 +77,7 @@ double UPDATE(struct exchange_info *exchange,char *base,char *rel,struct exchang
{
cJSON *json,*obj; char *jsonstr,market[128],url[1024]; double hbla = 0.;
sprintf(market,"%s-%s",rel,base);
sprintf(url,"https://bittrex.com/api/v1.1/public/getorderbook?market=%s&type=both&depth=%d",market,maxdepth);
sprintf(url,"http://bittrex.com/api/v1.1/public/getorderbook?market=%s&type=both&depth=%d",market,maxdepth);
jsonstr = issue_curl(url);
if ( jsonstr != 0 )
{
@ -166,8 +166,11 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha
return(0);
}
sprintf(payload,"https://bittrex.com/api/v1.1/market/%slimit?apikey=%s&nonce=%llu&market=%s&rate=%.8f&quantity=%.8f",dir>0?"buy":"sell",exchange->apikey,(long long)exchange_nonce(exchange),pairstr,price,volume);
if ( CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 && (json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,payload,payload)) != 0 )
if ( //CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 &&
(json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,payload,payload)) != 0 )
{
if ( *retstrp != 0 )
printf("SIGNPOST returned.(%s) %s\n",*retstrp,jprint(json,0));
if ( is_cJSON_True(cJSON_GetObjectItem(json,"success")) != 0 && (resultobj= cJSON_GetObjectItem(json,"result")) != 0 )
{
copy_cJSON(&uuidstr,cJSON_GetObjectItem(resultobj,"uuid"));

2
iguana/exchanges/btc38.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/btce.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/coinbase.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/exchange_supports.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/exchange_undefs.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/fxcm.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/huobi.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/instaforex.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/jumblr.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/lakebtc.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/nxtae.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/okcoin.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

7
iguana/exchanges/poloniex.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -166,10 +166,11 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha
typestr = (dir > 0) ? "marginBuy":"marginSell";
else typestr = (dir > 0) ? "buy":"sell";
sprintf(payload,"command=%s&nonce=%lld&currencyPair=%s&rate=%.8f&amount=%.8f",typestr,(long long)nonce,pairstr,price,volume);
if ( CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 && (json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,EXCHANGE_AUTHURL,payload)) != 0 )
if ( //CHECKBALANCE(retstrp,dotrade,exchange,dir,base,rel,price,volume,argjson) == 0 &&
(json= SIGNPOST(&exchange->cHandle,dotrade,retstrp,exchange,EXCHANGE_AUTHURL,payload)) != 0 )
{
txid = (get_API_nxt64bits(cJSON_GetObjectItem(json,"orderNumber")) << 32) | get_API_nxt64bits(cJSON_GetObjectItem(json,"tradeID"));
printf("poloniex.%llu (%s)\n",(long long)txid,jprint(json,0));
printf("poloniex.%llu (%s) %s\n",(long long)txid,jprint(json,0),*retstrp!=0?*retstrp:"");
free_json(json);
}
return(txid);

2
iguana/exchanges/quadriga.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/truefx.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/exchanges/unconf.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

6
iguana/exchanges777.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -46,7 +46,7 @@
#define EXCHANGES777_MINPOLLGAP 1
#define EXCHANGES777_MAXDEPTH 200
#define EXCHANGES777_DEFAULT_TIMEOUT 30
#define EXCHANGES777_DEFAULT_TIMEOUT 60
typedef void CURL;
struct exchange_info;
struct exchange_quote;
@ -179,7 +179,7 @@ char *exchanges777_Qtrade(struct exchange_info *exchange,char *base,char *rel,in
struct exchange_request *exchanges777_baserelfind(struct exchange_info *exchange,char *base,char *rel,int32_t func);
struct exchange_info *exchanges777_find(char *exchangestr);
void prices777_processprice(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth);
void tradebots_processprices(struct supernet_info *myinfo,struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t numbids,int32_t numasks);
double truefx_price(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert);
double fxcm_price(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert);

2
iguana/iguana777.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

13
iguana/iguana777.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -39,6 +39,9 @@
#endif
#endif
#define LOCKTIME_THRESHOLD 500000000
#define KOMODO_INTEREST ((uint64_t)(0.05 * SATOSHIDEN)) // 5%
//#define BTC2_VERSION
#define BTC2_HARDFORK_HEIGHT 444444
#define BTC2_SIGHASH_FORKID 0xcf
@ -51,7 +54,8 @@
#include "nn.h"
#include "bus.h"
#else*/
#ifdef __APPLE__
//#ifdef __APPLE__
#if defined(__APPLE__) || defined(WIN32) || defined(USE_STATIC_NANOMSG)
#include "../crypto777/nanosrc/nn.h"
#include "../crypto777/nanosrc/bus.h"
#include "../crypto777/nanosrc/pubsub.h"
@ -84,7 +88,7 @@ struct supernet_address
char NXTADDR[32],BTC[64],BTCD[64];
};
struct liquidity_info { char base[64],rel[64]; double profit,refprice; };
struct liquidity_info { char base[16],rel[16],exchange[16]; uint64_t assetid; double profit,refprice; int dir; };
struct message_info { int32_t msgcount; bits256 refhash,msghashes[64]; uint32_t timestamps[64]; };
struct supernet_info
@ -94,6 +98,8 @@ struct supernet_info
uint8_t persistent_pubkey33[33];
char ipaddr[64],NXTAPIURL[512],secret[4096],password[4096],rpcsymbol[64],handle[1024],permanentfile[1024];
char *decryptstr;
void (*liquidity_command)(struct supernet_info *myinfo,char *base,bits256 hash,cJSON *vals);
double (*liquidity_active)(struct supernet_info *myinfo,double *refpricep,char *exchange,char *base,char *rel,double volume);
int32_t maxdelay,IAMRELAY,IAMNOTARY,IAMLP,publicRPC,basilisk_busy,genesisresults,remoteorigin;
uint32_t expiration,dirty,DEXactive,DEXpoll,totalcoins,nanoinit,dexcrcs[1024];
uint16_t argport,rpcport;
@ -124,6 +130,7 @@ struct supernet_info
bits256 pangea_category,instantdex_category;
uint8_t logs[256],exps[510];
struct message_info msgids[8192];
double *svmfeatures;
};
#include "../includes/iguana_funcs.h"

2
iguana/iguana_accept.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_bitmap.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_blocks.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_bundles.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_chains.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

20
iguana/iguana_exchanges.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -184,11 +184,6 @@ double instantdex_avehbla(struct supernet_info *myinfo,double retvals[4],char *_
else return(0);
}
void prices777_processprice(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth)
{
}
cJSON *exchanges777_allpairs(char *baserels[][2],int32_t num)
{
int32_t i; char str[32]; cJSON *json,*item,*array = cJSON_CreateArray();
@ -339,11 +334,11 @@ double exchange_setquote(struct exchange_quote *bidasks,int32_t *numbidsp,int32_
}
if ( commission != 0. )
{
//printf("price %f fee %f -> ",price,prices->commission * price);
printf("price %f fee %f -> ",price,commission * price);
if ( bidask == 0 )
price -= commission * price;
else price += commission * price;
//printf("%f\n",price);
printf("%f\n",price);
}
quote = (bidask == 0) ? &bidasks[(*numbidsp)<<1] : &bidasks[((*numasksp)<<1) + 1];
quote->price = price, quote->volume = volume, quote->timestamp = timestamp, quote->orderid = orderid, quote->offerNXT = offerNXT;
@ -400,6 +395,7 @@ void exchanges777_json_quotes(struct exchange_info *exchange,double commission,c
if ( strcmp(exchange->name,"kraken") == 0 )
timestamp = juint(jitem(item,2),0);
else orderid = j64bits(jitem(item,2),0);
//printf("{%s} (%.8f %.8f) %f\n",jprint(item,0),price,volume,commission);
}
else
{
@ -456,7 +452,7 @@ double exchanges777_standardprices(struct exchange_info *exchange,double commiss
if ( (jsonstr= issue_curl(url)) != 0 )
{
//if ( strcmp(exchangestr,"btc38") == 0 )
//printf("(%s) -> (%s)\n",url,jsonstr);
//printf("%f (%s) -> (%s)\n",commission,url,jsonstr);
if ( (json= cJSON_Parse(jsonstr)) != 0 )
{
hbla = exchanges777_json_orderbook(exchange,commission,base,rel,quotes,maxdepth,json,field,"bids","asks",price,volume,invert);
@ -859,7 +855,7 @@ void exchanges777_loop(void *ptr)
if ( req->bidasks[(i << 1) + 1].price > SMALLVAL )
req->numasks++;
//printf("%-10s %s/%s numbids.%d numasks.%d\n",exchange->name,req->base,req->rel,req->numbids,req->numasks);
prices777_processprice(exchange,req->base,req->rel,req->bidasks,req->depth);
tradebots_processprices(myinfo,exchange,req->base,req->rel,req->bidasks,req->numbids,req->numasks);
}
queue_enqueue("pricesQ",&exchange->pricesQ,&req->DL);
}
@ -954,7 +950,7 @@ char *exchanges777_Qprices(struct exchange_info *exchange,char *base,char *rel,i
}
if ( base[0] == 0 || rel[0] == 0 || (polarity= (*exchange->issue.supports)(exchange,base,rel,argjson)) == 0 )
{
//printf("%s invalid (%s) or (%s)\n",exchange->name,base,rel);
printf("%s invalid (%s) or (%s)\n",exchange->name,base,rel);
return(clonestr("{\"error\":\"invalid base or rel\"}"));
}
if ( depth <= 0 )
@ -977,7 +973,7 @@ char *exchanges777_Qprices(struct exchange_info *exchange,char *base,char *rel,i
req->commission = exchange->commission;
if ( monitor == 0 )
{
printf("%s submit (%s) (%s)\n",exchange->name,base,rel);
//printf("%s submit (%s) (%s)\n",exchange->name,base,rel);
return(exchanges777_submit(exchange,req,'Q',maxseconds));
}
else

2
iguana/iguana_init.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_interpreter.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_json.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_mofn.c

@ -309,7 +309,7 @@ int maingen(int argc,char **argv)
}
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_msg.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

27
iguana/iguana_notary.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -71,12 +71,14 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
else
{
freq = 1;
minsigs = 7;//(komodo_notaries(dp->symbol,pubkeys,height) >> 1) + 1;
//minsigs = 7;//(komodo_notaries(dp->symbol,pubkeys,height) >> 1) + 1;
//if ( minsigs < DPOW_MINSIGS )
// minsigs = DPOW_MINSIGS;
minsigs = DPOW_MINSIGS;
}
printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs);
dpow_fifoupdate(myinfo,dp->srcfifo,dp->last);
if ( dp->SRCREALTIME == 0 && strcmp(dp->dest,"KMD") == 0 )
return;
if ( bits256_nonz(checkpoint.blockhash.hash) != 0 && (checkpoint.blockhash.height % freq) == 0 )
{
ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint));
@ -142,22 +144,23 @@ void dpow_destupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t h
void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp)
{
int32_t i,height,num; uint32_t blocktime; bits256 blockhash; struct iguana_info *src,*dest;
for (i=0; i<3; i++)
int32_t height,num; uint32_t blocktime; bits256 blockhash; struct iguana_info *src,*dest;
if ( strcmp(dp->symbol,"KMD") == 0 )
{
if ( (num= dpow_nanomsg_update(myinfo)) <= 0 )
break;
num = dpow_nanomsg_update(myinfo);
//fprintf(stderr,"%d ",num);
}
src = iguana_coinfind(dp->symbol);
dest = iguana_coinfind(dp->dest);
//fprintf(stderr,"i.%d dp.%p dPoWupdate (%s -> %s)\n",i,dp,dp!=0?dp->symbol:"",dp!=0?dp->dest:"");
//fprintf(stderr,"dp.%p dPoWupdate (%s -> %s)\n",dp,dp!=0?dp->symbol:"",dp!=0?dp->dest:"");
if ( src != 0 && dest != 0 )
{
dp->numdesttx = sizeof(dp->desttx)/sizeof(*dp->desttx);
if ( (height= dpow_getchaintip(myinfo,&blockhash,&blocktime,dp->desttx,&dp->numdesttx,dest)) != dp->destchaintip.blockhash.height && height >= 0 )
{
char str[65]; printf("[%s] %s %s height.%d vs last.%d\n",dp->symbol,dp->dest,bits256_str(str,blockhash),height,dp->destchaintip.blockhash.height);
char str[65];
if ( strcmp(dp->symbol,"KMD") == 0 || height != dp->destchaintip.blockhash.height+1 )
printf("[%s].%d %s %s height.%d vs last.%d\n",dp->symbol,dp->SRCHEIGHT,dp->dest,bits256_str(str,blockhash),height,dp->destchaintip.blockhash.height);
if ( height <= dp->destchaintip.blockhash.height )
{
printf("iguana_dPoWupdate dest.%s reorg detected %d vs %d\n",dp->dest,height,dp->destchaintip.blockhash.height);
@ -169,8 +172,12 @@ void iguana_dPoWupdate(struct supernet_info *myinfo,struct dpow_info *dp)
if ( (height= dpow_getchaintip(myinfo,&blockhash,&blocktime,dp->srctx,&dp->numsrctx,src)) != dp->last.blockhash.height && height >= 0 )
{
if ( strcmp(dp->dest,"KMD") == 0 )
{
//fprintf(stderr,"[I ");
dp->SRCHEIGHT = dpow_issuer_iteration(dp,src,dp->SRCHEIGHT,&dp->SRCREALTIME);
char str[65]; printf("[%s] %s %s height.%d vs last.%d\n",dp->dest,dp->symbol,bits256_str(str,blockhash),height,dp->last.blockhash.height);
//fprintf(stderr," %d] ",dp->SRCHEIGHT);
}
char str[65]; printf("[%s].%d %s %s height.%d vs last.%d\n",dp->dest,dp->SRCHEIGHT,dp->symbol,bits256_str(str,blockhash),height,dp->last.blockhash.height);
if ( dp->lastheight == 0 )
dp->lastheight = height-1;
if ( height < dp->last.blockhash.height )

61
iguana/iguana_payments.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -334,6 +334,63 @@ bits256 iguana_sendrawtransaction(struct supernet_info *myinfo,struct iguana_inf
return(txid);
}
uint64_t iguana_interest(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout,uint64_t value)
{
char *retstr; int32_t height; cJSON *retjson; struct iguana_txid T,*tx;
int32_t minutes; uint64_t numerator,denominator,interest = 0;
if ( coin->FULLNODE < 0 ) // komodod is running
{
if ( (retjson= dpow_gettxout(myinfo,coin,txid,vout)) != 0 )
{
interest = jdouble(retjson,"interest") * SATOSHIDEN;
free_json(retjson);
}
}
else if ( coin->FULLNODE == 0 ) // basilisk mode -> use DEX* API
{
if ( (retstr= _dex_gettxout(myinfo,coin->symbol,txid,vout)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
interest = jdouble(retjson,"interest") * SATOSHIDEN;
free_json(retjson);
}
free(retstr);
}
}
else // we have it local
{
if ( (tx= iguana_txidfind(coin,&height,&T,txid,coin->bundlescount)) != 0 && tx->locktime >LOCKTIME_THRESHOLD )
{
if ( (minutes= ((uint32_t)time(NULL) - 60 - tx->locktime) / 60) >= 60 )
{
numerator = (value * KOMODO_INTEREST);
denominator = (((uint64_t)365 * 24 * 60) / minutes);
if ( denominator == 0 )
denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually!
interest = (numerator / denominator) / SATOSHIDEN;
fprintf(stderr,"komodo_interest %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu)\n",(long long)value,(double)value/SATOSHIDEN,tx->locktime,(uint32_t)time(NULL),minutes,(long long)interest,(double)interest/SATOSHIDEN,(long long)numerator,(long long)denominator);
}
}
}
char str[65]; printf("interest for %s.v%d %.8f %.8f\n",bits256_str(str,txid),vout,dstr(value),dstr(interest));
return(interest);
}
uint64_t iguana_interests(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins)
{
int32_t i,n; cJSON *item; uint64_t interest = 0;
if ( is_cJSON_Array(vins) != 0 && (n= cJSON_GetArraySize(vins)) > 0 )
{
for (i=0; i<n; i++)
{
item = jitem(vins,i);
interest += iguana_interest(myinfo,coin,jbits256(item,"txid"),jint(item,"vout"),jdouble(item,"value")*SATOSHIDEN);
}
}
return(interest);
}
char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJSON **vinsp,cJSON *txobj,int64_t satoshis,char *changeaddr,int64_t txfee,cJSON *addresses,int32_t minconf,uint8_t *opreturn,int32_t oplen,int64_t burnamount,char *remoteaddr,struct vin_info *V,int32_t maxmode)
{
uint8_t addrtype,rmd160[20],spendscript[IGUANA_MAXSCRIPTSIZE]; int32_t allocflag=0,max,num,spendlen; char *rawtx=0; bits256 txid; cJSON *vins=0; uint64_t avail,total,change; struct iguana_outpoint *unspents = 0;
@ -351,6 +408,8 @@ char *iguana_calcrawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJS
{
if ( (vins= iguana_RTinputsjson(myinfo,coin,&total,satoshis + txfee,unspents,num,maxmode)) != 0 )
{
if ( strcmp(coin->symbol,"KMD") == 0 )
total += iguana_interests(myinfo,coin,vins);
if ( total < (satoshis + txfee) )
{
free_json(vins);

2
iguana/iguana_peers.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_ramchain.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_realtime.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_recv.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

3
iguana/iguana_rpc.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -52,7 +52,6 @@ char *sglue(GLUEARGS,char *agent,char *method)
{
if ( (wallet= iguana_walletjson(myinfo)) != 0 )
{
//printf("WALLETSTR.(%s)\n",jprint(wallet,0));
if ( (walletstr= SuperNET_login(myinfo,coin,json,remoteaddr,myinfo->handle,myinfo->secret,myinfo->permanentfile,0)) != 0 )
{
free(walletstr);

2
iguana/iguana_scripts.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_secp.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_sign.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_spendvectors.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_tradebots.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_tx.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_txidfind.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_unspents.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

2
iguana/iguana_volatiles.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

4
iguana/iguana_wallet.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -1505,12 +1505,10 @@ TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan)
{
free(retstr);
retstr = myinfo->decryptstr, myinfo->decryptstr = 0;
//printf("DECRYPT.(%s)\n",retstr);
iguana_waddresscalc(myinfo,coin->chain->pubtype,coin->chain->wiftype,waddr,privkey);
iguana_waccountswitch(myinfo,coin,account,waddr->coinaddr,0);
waddr->privkey = privkey;
retjson = iguana_walletadd(myinfo,0,coin,retstr,account,waddr,0,0);
//printf("AFTERADD.(%s)\n",jprint(retjson,0));
if ( retstr != 0 )
scrubfree(retstr);
return(jprint(retjson,1));

6
iguana/m_LP

@ -4,6 +4,6 @@ rm -f ../agents/iguana *.o
git pull
cd secp256k1; ./m_unix; cd ..
cd ../crypto777; ./m_LP; cd ../iguana
gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c
gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lnanomsg -lcurl -lssl -lcrypto -lpthread -lz -lm
clang -g -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
clang -g -Wno-deprecated -c -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c
clang -g -o ../agents/iguana *.o ../agents/libcrypto777.a /usr/local/lib/libnanomsg.so -lcurl -lssl -lcrypto -lpthread -lz -lm

12
iguana/m_LP_StaticNanoMsg

@ -0,0 +1,12 @@
#!/bin/bash
#./configure --enable-endomorphism --enable-module-ecdh --enable-module-schnorr --enable-module-rangeproof --enable-experimental --enable-module_recovery
rm -f ../agents/iguana *.o
git pull
cd secp256k1; ./m_unix; cd ..
cd ../crypto777; make -f m_LP_StaticNanoMsg all; make -f m_LP_StaticNanoMsg clean; cd ../iguana
clang -g -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 -DUSE_STATIC_NANOMSG *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
clang -g -Wno-deprecated -c -DLIQUIDITY_PROVIDER=1 -DUSE_STATIC_NANOMSG main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c
clang -g -o ../agents/iguana *.o ../agents/libcrypto777.a ../OSlibs/linux/$(uname -m)/libnanomsg-static.a -lcurl -lssl -lcrypto -lpthread -lz -lm -lanl -lrt -lnsl

8
iguana/m_notary

@ -4,9 +4,11 @@ rm -f ../agents/iguana *.o
git pull
cd secp256k1; ./m_unix; cd ..
cd ../crypto777; ./m_LP; cd ../iguana
gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -O2 -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c
gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lnanomsg -lcurl -lssl -lcrypto -lpthread -lz -lm
#gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -O2 -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
clang -g -Wno-deprecated -c -O2 -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
#gcc -g -fno-aggressive-loop-optimizations -Wno-deprecated -c -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c
clang -g -Wno-deprecated -c -DISNOTARYNODE=1 -DLIQUIDITY_PROVIDER=1 main.c iguana777.c iguana_bundles.c ../basilisk/basilisk.c
clang -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lnanomsg -lcurl -lssl -lcrypto -lpthread -lz -lm
../agents/iguana notary & #> iguana.log 2> error.log &

9
iguana/main.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -676,6 +676,8 @@ void iguana_ensuredirs()
sprintf(dirname,"%s/ECB",GLOBAL_DBDIR), OS_ensure_directory(dirname);
sprintf(dirname,"%s/BTC",GLOBAL_VALIDATEDIR), OS_ensure_directory(dirname);
sprintf(dirname,"%s/BTCD",GLOBAL_VALIDATEDIR), OS_ensure_directory(dirname);
sprintf(dirname,"SVM"), OS_ensure_directory(dirname);
sprintf(dirname,"SVM/rawfeatures"), OS_ensure_directory(dirname);
}
void iguana_Qinit()
@ -1558,10 +1560,8 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
if ( (str= SuperNET_encryptjson(myinfo,coin,argjson,remoteaddr,password,myinfo->permanentfile,myinfo->decryptstr == 0 ? "" : myinfo->decryptstr)) != 0 )
free(str);
myinfo->expiration = (uint32_t)(time(NULL) + 3600);
printf("(%s) logged into (%s) %s %s\n",password,myinfo->myaddr.NXTADDR,myinfo->myaddr.BTC,myinfo->myaddr.BTCD);
return(SuperNET_activehandle(IGUANA_CALLARGS));
} else return(clonestr("{\"error\":\"need passphrase\"}"));
printf("(%s) logged into (%s) %s %s\n",password,myinfo->myaddr.NXTADDR,myinfo->myaddr.BTC,myinfo->myaddr.BTCD);
return(SuperNET_activehandle(IGUANA_CALLARGS));
}
@ -1619,9 +1619,10 @@ void iguana_main(void *arg)
portable_mutex_init(&myinfo->dpowmutex);
portable_mutex_init(&myinfo->notarymutex);
#if LIQUIDITY_PROVIDER
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("nxtae"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bitcoin"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("poloniex"),0);
//myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("bittrex"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("btc38"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("huobi"),0);
myinfo->tradingexchanges[myinfo->numexchanges++] = exchange_create(clonestr("coinbase"),0);

2
iguana/ramchain_api.c

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

75
iguana/tests/arbinit

@ -0,0 +1,75 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"amlp\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"coinbase\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"lakebtc\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"quadriga\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"btcd\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"USD\",\"profit\":0.004,\"exchange\":\"bitstamp\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"CNY\",\"profit\":0.004,\"exchange\":\"huobi\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTC\",\"vals\":{\"rel\":\"CNY\",\"profit\":0.004,\"exchange\":\"btc38\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"amlp\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTCD\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTCD\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"CLOAK\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"CLOAK\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"SYS\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"SYS\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"GAME\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"GAME\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"XMR\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"XMR\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"ETH\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"ETH\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"ETC\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"ETC\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"DASH\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"DASH\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"ZEC\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"ZEC\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"FCT\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"FCT\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"STRAT\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"STRAT\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"DGD\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"DGD\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"NAV\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"NAV\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"LTC\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"LTC\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"SDC\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"SDC\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"STEEM\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"STEEM\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"SBD\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"SBD\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"XRP\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"XRP\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"LSK\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"LSK\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"NXT\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"NXT\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"MAID\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"MAID\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BLK\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BLK\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"POT\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"POT\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"XEM\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"XEM\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"VRC\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"VRC\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"VTC\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"VTC\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTS\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BTS\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"NAUT\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"NAUT\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"AUR\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"AUR\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"REP\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"REP\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"AMP\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"AMP\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"

16
iguana/tests/arbnxt

@ -0,0 +1,16 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"amlp\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"NXT\",\"vals\":{\"profit\":0.004,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"NXT\",\"vals\":{\"profit\":0.004,\"exchange\":\"bittrex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"UNITY\",\"vals\":{\"profit\":0.01,\"exchange\":\"poloniex\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"UNITY\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"DEX\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"PANGEA\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"JUMBLR\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BET\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"CRYPTO\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"HODL\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"SHARK\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"BOTS\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"MGW\",\"vals\":{\"rel\":\"NXT\",\"profit\":0.01,\"exchange\":\"nxtae\"}}"

3
iguana/tests/gensvm

@ -0,0 +1,3 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebots\",\"method\":\"gensvm\",\"base\":\"BTC\",\"rel\":\"USD\"}"
#curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebots\",\"method\":\"gensvm\",\"base\":\"BTCD\",\"rel\":\"BTC\"}"

3
includes/iguana_apideclares.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -43,6 +43,7 @@ ZERO_ARGS(pax,start);
HASH_ARRAY_STRING(tradebot,liquidity,hash,vals,targetcoin);
ZERO_ARGS(tradebot,amlp);
ZERO_ARGS(tradebot,notlp);
TWO_STRINGS(tradebots,gensvm,base,rel);
INT_AND_ARRAY(iguana,rates,unused,quotes);
TWO_STRINGS(iguana,rate,base,rel);

2
includes/iguana_defines.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

3
includes/iguana_funcs.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
@ -134,6 +134,7 @@ double PoW_from_compact(uint32_t nBits,uint8_t unitval);
void calc_rmd160(char *hexstr,uint8_t buf[20],uint8_t *msg,int32_t len);
void calc_OP_HASH160(char *hexstr,uint8_t hash160[20],char *msg);
double dxblend(double *destp,double val,double decay);
double _xblend(float *destp,double val,double decay);
// json
int32_t iguana_processjsonQ(struct iguana_info *coin); // reentrant, can be called during any idletime

2
includes/iguana_globals.h

@ -1,5 +1,5 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save