Browse Source

Merge pull request #256 from jl777/dev

Dev
win-cross
jl777 8 years ago
committed by GitHub
parent
commit
26410afee2
  1. 70
      .gitignore
  2. 1
      basilisk/basilisk.c
  3. 2
      basilisk/basilisk.h
  4. 21
      basilisk/basilisk_swap.c
  5. 22
      basilisk/tradebots_liquidity.c
  6. 202
      basilisk/tradebots_marketmaker.c
  7. 1
      crypto777/OS_portable.h
  8. 11
      crypto777/bitcoind_RPC.c
  9. 4
      crypto777/cJSON.c
  10. 141
      crypto777/iguana_utils.c
  11. 2
      iguana/dpow/dpow_fsm.c
  12. 4
      iguana/dpow/dpow_network.c
  13. 71
      iguana/dpow/dpow_prices.c
  14. 18
      iguana/exchanges/bittrex.c
  15. 598
      iguana/exchanges/mm.c
  16. 6
      iguana/iguana777.h
  17. 25
      iguana/iguana_exchanges.c
  18. 127
      iguana/iguana_notary.c
  19. 46
      iguana/iguana_payments.c
  20. 17
      iguana/iguana_rpc.c
  21. 4
      iguana/iguana_tradebots.c
  22. 53
      iguana/kmd_lookup.h
  23. 1
      iguana/m_mm
  24. 4
      iguana/m_osx
  25. 11
      iguana/main.c
  26. 164
      iguana/tests/KMD.batch10
  27. 161
      iguana/tests/KMD.batch10.importaddress
  28. 129
      iguana/tests/KMD.batch10.listunspent
  29. 8
      iguana/tests/REVS.batch10
  30. 6
      iguana/tests/REVS.batch10.importaddress
  31. 2
      iguana/tests/amlp
  32. 2
      iguana/tests/dexlisttransactions
  33. 2
      iguana/tests/dexlistunspent
  34. 2
      iguana/tests/dexlistunspent2
  35. 3
      iguana/tests/mm
  36. 346
      includes/iguana_apideclares copy.h
  37. 48
      includes/iguana_apideclares.h
  38. 1
      includes/iguana_funcs.h
  39. 2
      includes/iguana_globals.h

70
.gitignore

@ -67,3 +67,73 @@ iguana/SVM/models/.tmpmarker
SuperNET.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist
SuperNET.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/SuperNET.xcscheme
iguana/DB/BTC/.tmpmarker
*.vouts
iguana/DB/BTC/vouts/.tmpmarker
iguana/DB/BTC/accounts/.tmpmarker
iguana/DB/BTC/spends/.tmpmarker
iguana/DB/BTC/validated/.tmpmarker
iguana/DB/KMD/.tmpmarker
iguana/DB/KMD/accounts/.tmpmarker
iguana/DB/KMD/spends/.tmpmarker
iguana/DB/KMD/validated/.tmpmarker
iguana/DB/KMD/vouts/.tmpmarker
iguana/DB/purgeable/KMD/.tmpmarker
iguana/DB/ro/.tmpmarker
iguana/DB/ro/BTC/.tmpmarker
iguana/DB/ro/KMD/.tmpmarker
iguana/confs/682c279f7b01b96aee50f11b327bf6c0a3d3481a23a9a265f0796e9bb3765b24
iguana/confs/682c279f7b01b96aee50f11b327bf6c0a3d3481a23a9a265f0796e9bb3765b24.old
iguana/confs/83cb074c13289a91a0cd50a8e6932b2237d1533ec1cbff56ab3d9b1d37f8df35
iguana/confs/83cb074c13289a91a0cd50a8e6932b2237d1533ec1cbff56ab3d9b1d37f8df35.old
iguana/tmp/BTC/.tmpmarker
iguana/tmp/BTC/0/.tmpmarker
iguana/tmp/BTC/0/0/.tmpmarker
iguana/tmp/BTC/peers.txt
iguana/tmp/BTC/RT/.tmpmarker
iguana/tmp/KMD/.tmpmarker
iguana/tmp/KMD/0/.tmpmarker
iguana/tmp/KMD/0/0/.tmpmarker
iguana/tmp/KMD/peers.txt
iguana/tmp/KMD/RT/.tmpmarker
*.xcworkspacedata
*.xcuserstate
includes/iguana_apideclares copy.h
iguana/iguana_tx.o-4b5de8fe
iguana/confs/c6faccf6b625bbb826f47b77c3274e985db7b0a47d435f32bea2f7f3724cdd17
iguana/confs/c6faccf6b625bbb826f47b77c3274e985db7b0a47d435f32bea2f7f3724cdd17.old

1
basilisk/basilisk.c

@ -484,6 +484,7 @@ int32_t basilisk_relayid(struct supernet_info *myinfo,uint32_t ipbits)
#include "basilisk_lisk.c"
#include "basilisk_MSG.c"
#include "tradebots_marketmaker.c"
#include "tradebots_liquidity.c"
#include "basilisk_tradebot.c"
#include "basilisk_swap.c"

2
basilisk/basilisk.h

@ -67,7 +67,7 @@ struct basilisk_swapinfo
char bobstr[64],alicestr[64];
bits256 myhash,otherhash,orderhash;
uint32_t statebits,otherstatebits,started,expiration,finished,dead,reftime,putduration,callduration;
int32_t bobconfirms,aliceconfirms,iambob,reclaimed;
int32_t bobconfirms,aliceconfirms,iambob,reclaimed,bobspent,alicespent;
uint64_t alicesatoshis,bobsatoshis,bobinsurance,aliceinsurance;
bits256 myprivs[2],mypubs[2],otherpubs[2],pubA0,pubA1,pubB0,pubB1,privAm,pubAm,privBn,pubBn;

21
basilisk/basilisk_swap.c

@ -570,6 +570,7 @@ int32_t basilisk_verify_bobpaid(struct supernet_info *myinfo,void *ptr,uint8_t *
for (i=0; i<swap->alicespend.I.datalen; i++)
printf("%02x",swap->alicespend.txbytes[i]);
printf(" <- alicespend\n\n");
swap->I.alicespent = 1;
basilisk_txlog(myinfo,swap,&swap->alicespend,-1);
return(retval);
}
@ -587,6 +588,7 @@ int32_t basilisk_alicepayment_spend(struct supernet_info *myinfo,struct basilisk
for (i=0; i<dest->I.datalen; i++)
printf("%02x",dest->txbytes[i]);
printf(" <- msigspend\n\n");
swap->I.bobspent = 1;
basilisk_txlog(myinfo,swap,dest,0); // bobspend or alicereclaim
return(retval);
}
@ -1738,6 +1740,19 @@ int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap
return(retval);
}
int32_t swapcompleted(struct supernet_info *myinfo,struct basilisk_swap *swap)
{
if ( swap->I.iambob != 0 )
return(swap->I.bobspent);
else return(swap->I.alicespent);
}
cJSON *swapjson(struct supernet_info *myinfo,struct basilisk_swap *swap)
{
cJSON *retjson = cJSON_CreateObject();
return(retjson);
}
void basilisk_swaploop(void *_swap)
{
uint8_t *data; uint32_t expiration; uint32_t channel; int32_t retval=0,i,j,datalen,maxlen; struct supernet_info *myinfo; struct basilisk_swap *swap = _swap;
@ -1907,6 +1922,12 @@ void basilisk_swaploop(void *_swap)
basilisk_swapsend(myinfo,swap,0x40000000,data,datalen,0x40000000,swap->I.crcs_mypriv);
}
}
if ( swapcompleted(myinfo,swap) > 0 ) // only if swap completed
{
if ( swap->I.iambob != 0 )
tradebot_pendingadd(myinfo,swapjson(myinfo,swap),swap->I.req.src,dstr(swap->I.req.srcamount),swap->I.req.dest,dstr(swap->I.req.destamount));
else tradebot_pendingadd(myinfo,swapjson(myinfo,swap),swap->I.req.dest,dstr(swap->I.req.destamount),swap->I.req.src,dstr(swap->I.req.srcamount));
}
printf("%s swap finished statebits %x\n",swap->I.iambob!=0?"BOB":"ALICE",swap->I.statebits);
basilisk_swap_purge(myinfo,swap);
free(data);

22
basilisk/tradebots_liquidity.c

@ -982,7 +982,7 @@ void _default_liquidity_command(struct supernet_info *myinfo,char *base,bits256
} else tradebot_monitor(myinfo,0,0,0,li.exchange,li.base,li.rel,0.);
}
myinfo->linfos[i] = li;
printf("Set linfo[%d] %s (%s/%s) profitmargin %.6f bid %.6f ask %.8f maxvol %.f ref %.8f\n",i,li.exchange,li.base,li.rel,li.profit,li.bid,li.ask,li.maxvol,li.refprice);
printf("Set linfo[%d] %s (%s/%s) profitmargin %.6f bid %.8f ask %.8f minvol %.6f maxvol %.6f ref %.8f <- (%s)\n",i,li.exchange,li.base,li.rel,li.profit,li.bid,li.ask,li.minvol,li.maxvol,li.refprice,jprint(vals,0));
return;
}
}
@ -1056,7 +1056,7 @@ struct liquidity_info *_default_lifind(struct supernet_info *myinfo,int32_t *dir
void _default_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
struct liquidity_info *li; double vol,price,volume,srcamount,destamount,profitmargin,dir=0.,dotrade=1.; char base[64],rel[64]; int32_t idir;
struct liquidity_info *li; double vol,price,volume,srcamount,destamount,profitmargin,dir=0.,dotrade=1.; char base[64],rel[64]; int32_t idir; char *tradestr=0; cJSON *tradejson;
srcamount = swap->I.req.srcamount;
destamount = swap->I.req.destamount;
profitmargin = (double)swap->I.req.profitmargin / 1000000.;
@ -1101,8 +1101,8 @@ void _default_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_s
{
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);
tradestr = InstantDEX_buy(myinfo,0,0,0,"bittrex",base,rel,price,volume,dotrade);
else tradestr = InstantDEX_sell(myinfo,0,0,0,"bittrex",base,rel,price,volume,dotrade);
}
}
else
@ -1111,10 +1111,20 @@ void _default_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_s
{
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);
tradestr = InstantDEX_buy(myinfo,0,0,0,"bittrex",base,rel,price,volume,dotrade);
else tradestr = InstantDEX_sell(myinfo,0,0,0,"bittrex",base,rel,price,volume,dotrade);
}
}
if ( tradestr != 0 )
{
if ( (tradejson= cJSON_Parse(tradestr)) != 0 )
{
if ( jobj(tradejson,"error") == 0 ) // balancing is opposite trade
tradebot_pendingadd(myinfo,tradejson,swap->I.req.dest,destamount,swap->I.req.src,srcamount);
else free_json(tradejson);
}
free(tradestr);
}
}
void tradebot_swap_balancingtrade(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t iambob)

202
basilisk/tradebots_marketmaker.c

@ -0,0 +1,202 @@
/******************************************************************************
* 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 *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* SuperNET software, including this file may be copied, modified, propagated *
* or distributed except according to the terms contained in the LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
// included from basilisk.c
// "currency":{"value":%.8f, "pending":%.8f}
cJSON *tradebot_balancediff(cJSON *item,cJSON *anchoritem) // only item might be null
{
double current[2],past[2]; int32_t i; cJSON *diffitem = jduplicate(anchoritem);
memset(current,0,sizeof(current));
memset(past,0,sizeof(past));
if ( jobj(diffitem,"value") != 0 )
jdelete(diffitem,"value");
if ( jobj(diffitem,"pending") != 0 )
jdelete(diffitem,"pending");
for (i=0; i<2; i++)
{
if ( current[i] != 0. || past[i] != 0. )
jaddnum(diffitem,i == 0 ? "value" : "pending",current[i] - past[i]);
}
return(diffitem);
}
cJSON *tradebot_balancesdiff(struct supernet_info *myinfo,cJSON *current,cJSON *anchor)
{
cJSON *item,*anchoritem,*diffitem,*array; int32_t i,n; char *field;
if ( anchor == 0 )
return(jduplicate(current));
array = cJSON_CreateObject();
n = cJSON_GetArraySize(current);
for (i=0; i<n; i++)
{
item = jitem(current,i);
field = jfieldname(item);
if ( (anchoritem= jobj(anchor,field)) != 0 )
diffitem = tradebot_balancediff(item,anchoritem);
else diffitem = jduplicate(item);
jadd(array,field,diffitem);
}
n = cJSON_GetArraySize(anchor);
for (i=0; i<n; i++)
{
item = jitem(current,i);
field = jfieldname(item);
if ( jobj(array,field) == 0 )
jadd(array,field,tradebot_balancediff(0,item));
}
return(array);
}
// get balances from all exchanges, wallets, pending
double tradebot_balance(struct supernet_info *myinfo,char *base)
{
cJSON *json; double value = 0.; int32_t i; struct iguana_info *coin = iguana_coinfind(base);
if ( coin != 0 && (json= iguana_getinfo(myinfo,coin)) != 0 )
{
value = jdouble(json,"balance");
free_json(json);
}
for (i=0; i<myinfo->numexchanges; i++)
{
value += 0;//InstantDEX_balance(myinfo,0,0,0,exchange,base);
}
return(value);
}
void tradebot_pendingadd(struct supernet_info *myinfo,cJSON *tradejson,char *base,double basevolume,char *rel,double relvolume)
{
portable_mutex_lock(&myinfo->pending_mutex);
// add to myinfo->trades
portable_mutex_unlock(&myinfo->pending_mutex);
}
void tradebot_pendingremove(struct supernet_info *myinfo,char *base,double basevolume,char *rel,double relvolume)
{
portable_mutex_lock(&myinfo->pending_mutex);
// remove from myinfo->trades
portable_mutex_unlock(&myinfo->pending_mutex);
}
double tradebot_pending(struct supernet_info *myinfo,char *base)
{
double pending = 0.; struct pending_trade *tp,*tmp;
portable_mutex_lock(&myinfo->pending_mutex);
HASH_ITER(hh,myinfo->trades,tp,tmp)
{
if ( strcmp(base,tp->base) == 0 )
pending += tp->dir * tp->basevolume;
else if ( strcmp(base,tp->rel) == 0 )
pending -= tp->dir * tp->relvolume;
}
portable_mutex_unlock(&myinfo->pending_mutex);
return(pending);
}
#include "../includes/iguana_apidefs.h"
#include "../includes/iguana_apideclares.h"
ZERO_ARGS(tradebot,allbalances)
{
int32_t i,n; double value,pending; char *base; cJSON *item,*balances = cJSON_CreateObject();
if ( myinfo->liquidity_currencies == 0 )
myinfo->liquidity_currencies = cJSON_Parse("[\"KMD\", \"BTC\"]");
if ( myinfo->liquidity_currencies != 0 && (n= cJSON_GetArraySize(myinfo->liquidity_currencies)) > 0 )
{
for (i=0; i<n; i++)
{
base = jstri(myinfo->liquidity_currencies,i);
value = tradebot_balance(myinfo,base);
pending = tradebot_pending(myinfo,base);
item = cJSON_CreateObject();
jaddnum(item,"value",value);
jaddnum(item,"pending",pending);
jadd(balances,base,item);
}
}
return(jprint(balances,1));
}
ZERO_ARGS(tradebot,anchor)
{
FILE *fp; char *anchorstr,fname[512]; cJSON *anchor; int32_t retval = -1;
if ( (anchorstr= tradebot_allbalances(myinfo,0,0,0)) != 0 )
{
if ( (anchor= cJSON_Parse(anchorstr)) != 0 )
{
if ( jobj(anchor,"error") == 0 )
{
sprintf(fname,"%s/anchor",GLOBAL_DBDIR), OS_compatible_path(fname);
if ( (fp= fopen(fname,"wb")) != 0 )
{
if ( fwrite(anchorstr,1,strlen(anchorstr)+1,fp) == strlen(anchorstr)+1 )
retval = 0;
fclose(fp);
}
}
}
free(anchorstr);
}
if ( retval == 0 )
return(clonestr("{\"result\":\"success\"}"));
else return(clonestr("{\"error\":\"couldnt make anchor file\"}"));
}
ZERO_ARGS(tradebot,portfolio)
{
char *currentstr,*anchorstr,fname[512]; long fsize; cJSON *current,*anchor=0,*portfolio=0;
if ( (currentstr= tradebot_allbalances(myinfo,0,0,0)) != 0 )
{
if ( (current= cJSON_Parse(currentstr)) != 0 )
{
sprintf(fname,"%s/anchor",GLOBAL_DBDIR), OS_compatible_path(fname);
if ( (anchorstr= OS_filestr(&fsize,fname)) != 0 )
{
anchor = cJSON_Parse(anchorstr);
free(anchorstr);
}
if ( anchor == 0 )
anchor = cJSON_Parse("{}");
portfolio = tradebot_balancesdiff(myinfo,current,anchor);
free_json(current);
}
free(currentstr);
}
if ( portfolio == 0 )
return(clonestr("{\"result\":\"success\"}"));
else return(jprint(portfolio,1));
}
ARRAY_OBJ_INT(tradebot,goals,currencies,vals,targettime)
{
static bits256 zero; char *targetcoin; int32_t i,n;
if ( currencies != 0 && vals != 0 )
{
// init things so automatically updates refli.bid and refli.ask
// volume range with margin
// currency percentage value in BTC? target distribution, max percentage, min percentage`
// min price to sell, max price to buy, max volume
n = cJSON_GetArraySize(currencies);
for (i=0; i<n; i++)
{
targetcoin = jstri(currencies,i);
tradebot_liquidity_command(myinfo,targetcoin,zero,vals);
}
return(clonestr("{\"result\":\"success\"}"));
} else return(clonestr("{\"error\":\"no currencies or vals\"}"));
}
#include "../includes/iguana_apiundefs.h"

1
crypto777/OS_portable.h

@ -404,6 +404,7 @@ int32_t revsort32(uint32_t *buf,uint32_t num,int32_t size);
bits256 bits256_sha256(bits256 data);
void bits256_rmd160(uint8_t rmd160[20],bits256 data);
void bits256_rmd160_sha256(uint8_t rmd160[20],bits256 data);
double get_theoretical(double *avebidp,double *aveaskp,double *highbidp,double *lowaskp,double *CMC_averagep,double changes[3],char *name,char *base,char *rel);
extern char *Iguana_validcommands[];
extern bits256 GENESIS_PUBKEY,GENESIS_PRIVKEY;

11
crypto777/bitcoind_RPC.c

@ -109,6 +109,8 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char *
*
************************************************************************/
static int32_t USE_JAY;
char *Jay_NXTrequest(char *command,char *params)
{
char *retstr = 0;
@ -127,7 +129,7 @@ char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *
didinit = 1;
curl_global_init(CURL_GLOBAL_ALL); //init the curl session
}
if ( USE_JAY != 0 && (strncmp(url,"http://127.0.0.1:7876/nxt",strlen("http://127.0.0.1:7876/nxt")) == 0 || strncmp(url,"https://127.0.0.1:7876/nxt",strlen("https://127.0.0.1:7876/nxt")) == 0) )
if ( (0) && (USE_JAY != 0 && (strncmp(url,"http://127.0.0.1:7876/nxt",strlen("http://127.0.0.1:7876/nxt")) == 0 || strncmp(url,"https://127.0.0.1:7876/nxt",strlen("https://127.0.0.1:7876/nxt")) == 0)) )
{
if ( (databuf= Jay_NXTrequest(command,params)) != 0 )
return(databuf);
@ -177,9 +179,12 @@ try_again:
bracket0 = (char *)"[";
bracket1 = (char *)"]";
}
char agentstr[64];
databuf = (char *)malloc(256 + strlen(command) + strlen(params));
sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1);
if ( debugstr[0] != 0 )
sprintf(agentstr,"\"agent\":\"%s\",",debugstr);
else agentstr[0] = 0;
sprintf(databuf,"{\"id\":\"jl777\",%s\"method\":\"%s\",\"params\":%s%s%s}",agentstr,command,bracket0,params,bracket1);
//printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf);
//
} //else if ( specialcase != 0 ) fprintf(stderr,"databuf.(%s)\n",params);

4
crypto777/cJSON.c

@ -1092,12 +1092,12 @@ uint64_t calc_nxt64bits(const char *NXTaddr)
c = NXTaddr[i];
if ( c < '0' || c > '9' )
{
printf("calc_nxt64bits: illegal char.(%c %d) in (%s).%d\n",c,c,NXTaddr,(int32_t)i);
//printf("calc_nxt64bits: illegal char.(%c %d) in (%s).%d\n",c,c,NXTaddr,(int32_t)i);
#ifdef __APPLE__
//while ( 1 )
{
//sleep(60);
printf("calc_nxt64bits: illegal char.(%c %d) in (%s).%d\n",c,c,NXTaddr,(int32_t)i);
//printf("calc_nxt64bits: illegal char.(%c %d) in (%s).%d\n",c,c,NXTaddr,(int32_t)i);
}
#endif
return(0);

141
crypto777/iguana_utils.c

@ -1146,3 +1146,144 @@ void calc_rmd160_sha256(uint8_t rmd160[20],uint8_t *data,int32_t datalen)
vcalc_sha256(0,hash.bytes,data,datalen);
calc_rmd160(0,rmd160,hash.bytes,sizeof(hash));
}
char *cmc_ticker(char *base)
{
char url[512];
sprintf(url,"https://api.coinmarketcap.com/v1/ticker/%s/",base);
return(issue_curl(url));
}
char *bittrex_orderbook(char *base,char *rel,int32_t maxdepth)
{
char market[64],url[512];
sprintf(market,"%s-%s",rel,base);
sprintf(url,"http://bittrex.com/api/v1.1/public/getorderbook?market=%s&type=both&depth=%d",market,maxdepth);
return(issue_curl(url));
}
double calc_theoretical(double weighted,double CMC_average,double changes[3])
{
double adjusted = 0.,theoretical = 0.;
if ( weighted > SMALLVAL && CMC_average > SMALLVAL )
{
theoretical = (weighted + CMC_average) * 0.5;
/*if ( changes[0] > SMALLVAL && changes[1] > SMALLVAL && changes[2] > SMALLVAL )
{
if ( changes[0] > changes[1] && changes[1] > changes[2] ) // breakout
{
adjusted = theoretical * (1. - (changes[0] + changes[1]) * .005);
}
}
else if ( changes[0] < -SMALLVAL && changes[1] < -SMALLVAL && changes[2] < -SMALLVAL ) //
{
if ( changes[0] < changes[1] && changes[1] < changes[2] ) // waterfall
{
adjusted = theoretical * (1. - (changes[0] + changes[1]) * .005);
}
}
if ( adjusted != 0. && theoretical != 0. )
theoretical = (theoretical + adjusted) * 0.5;*/
}
printf("adjusted %.8f theoretical %.8f (%.8f + wt %.8f)\n",adjusted,theoretical,CMC_average,weighted);
return(theoretical);
}
double calc_weighted(double *avebidp,double *aveaskp,double *bids,double *bidvols,int32_t numbids,double *asks,double *askvols,int32_t numasks,double limit)
{
int32_t i; double weighted = 0.,bidsum = 0., asksum = 0.,totalbids = 0.,totalasks = 0.;
bidsum = bids[0] * bidvols[0], totalbids = bidvols[0];
asksum = asks[0] * askvols[0], totalasks = askvols[0];
for (i=1; i<numbids; i++)
{
if ( totalbids > limit )
break;
bidsum += bids[i] * bidvols[i];
totalbids += bidvols[i];
}
for (i=1; i<numasks; i++)
{
if ( totalasks > limit )
break;
asksum += asks[i] * askvols[i];
totalasks += askvols[i];
}
if ( totalbids != 0. && totalasks != 0. )
{
*avebidp = (bidsum / totalbids);
*aveaskp = (asksum / totalasks);
weighted = (*avebidp + *aveaskp) * 0.5;
}
//printf("weighted %f\n",weighted);
return(weighted);
}
double weighted_orderbook(double *avebidp,double *aveaskp,double *highbidp,double *lowaskp,char *orderbookstr,double limit)
{
cJSON *bookjson,*bid,*ask,*resobj,*item; int32_t i,numbids,numasks; double bidvols[50],bids[50],askvols[50],asks[50],weighted = 0.;
if ( orderbookstr != 0 )
{
if ( (bookjson= cJSON_Parse(orderbookstr)) != 0 )
{
if ( (resobj= jobj(bookjson,"result")) != 0 )
{
bid = jarray(&numbids,resobj,"buy");
if ( numbids > sizeof(bids)/sizeof(*bids) )
numbids = (int32_t)(sizeof(bids)/sizeof(*bids));
ask = jarray(&numasks,resobj,"sell");
if ( numasks > sizeof(asks)/sizeof(*asks) )
numasks = (int32_t)(sizeof(asks)/sizeof(*asks));
if ( bid != 0 && ask != 0 )
{
for (i=0; i<numbids; i++)
{
item = jitem(bid,i);
bidvols[i] = jdouble(item,"Quantity");
bids[i] = jdouble(item,"Rate");
}
for (i=0; i<numasks; i++)
{
item = jitem(ask,i);
askvols[i] = jdouble(item,"Quantity");
asks[i] = jdouble(item,"Rate");
}
*highbidp = bids[0];
*lowaskp = asks[0];
weighted = calc_weighted(avebidp,aveaskp,bids,bidvols,numbids,asks,askvols,numasks,limit);
//printf("weighted %.8f (%.8f %.8f)\n",weighted,*highbidp,*lowaskp);
}
}
free_json(bookjson);
}
}
return(weighted);
}
double get_theoretical(double *avebidp,double *aveaskp,double *highbidp,double *lowaskp,double *CMC_averagep,double changes[3],char *name,char *base,char *rel)
{
static int32_t counter;
char *cmcstr; cJSON *cmcjson,*item; double weighted,theoretical = 0.;
*avebidp = *aveaskp = *highbidp = *lowaskp = *CMC_averagep = 0.;
if ( (cmcstr= cmc_ticker(name)) != 0 )
{
if ( (cmcjson= cJSON_Parse(cmcstr)) != 0 )
{
if ( is_cJSON_Array(cmcjson) == 0 )
item = cmcjson;
else item = jitem(cmcjson,0);
*CMC_averagep = jdouble(item,"price_btc");
changes[0] = jdouble(item,"percent_change_1h");
changes[1] = jdouble(item,"percent_change_24h");
changes[2] = jdouble(item,"percent_change_7d");
weighted = weighted_orderbook(avebidp,aveaskp,highbidp,lowaskp,bittrex_orderbook(base,rel,25),1./(*CMC_averagep));
if ( *CMC_averagep > SMALLVAL && weighted > SMALLVAL )
theoretical = calc_theoretical(weighted,*CMC_averagep,changes);
if ( counter++ == 0 )
printf("HBLA.[%.8f %.8f] AVE.[%.8f %.8f] (%s) CMC %f %f %f %f\n",*highbidp,*lowaskp,*avebidp,*aveaskp,jprint(item,0),*CMC_averagep,changes[0],changes[1],changes[2]);
free_json(cmcjson);
}
free(cmcstr);
}
return(theoretical);
}

2
iguana/dpow/dpow_fsm.c

@ -126,7 +126,7 @@ int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct
int32_t haveutxo,completed,minutxo,n; bits256 signedtxid; cJSON *addresses; char *rawtx,*sendtx;
if ( strcmp("BTC",coin->symbol) == 0 )
{
minutxo = 49;
minutxo = 499;
n = 50;
}
else

4
iguana/dpow/dpow_network.c

@ -977,7 +977,7 @@ char *_dex_listunspentarg(struct supernet_info *myinfo,char *symbol,char *addres
char *_dex_listunspent(struct supernet_info *myinfo,char *symbol,char *address)
{
return(_dex_listunspentarg(myinfo,symbol,address,'U'));
return(_dex_listunspentarg(myinfo,symbol,address,'u')); // 'U' old variant
}
char *_dex_listunspent2(struct supernet_info *myinfo,char *symbol,char *address)
@ -1018,7 +1018,7 @@ char *_dex_listtransactions(struct supernet_info *myinfo,char *symbol,char *addr
safecopy(dexreq.name,symbol,sizeof(dexreq.name));
dexreq.intarg = skip;
dexreq.shortarg = count;
dexreq.func = 'L';
dexreq.func = '2';//'L';
return(_dex_arrayreturn(_dex_sendrequeststr(myinfo,&dexreq,address,0,1,"")));
}

71
iguana/dpow/dpow_prices.c

@ -1450,7 +1450,7 @@ void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp)
}
if ( 1 )
{
double avebid,aveask,bidvol,askvol; //struct exchange_quote sortbuf[512]; struct supernet_info *myinfo = SuperNET_MYINFO(0); cJSON *argjson = cJSON_Parse("{}");
double avebid,aveask,bidvol,askvol,highbid,lowask,CMC_average,changes[3]; //struct exchange_quote sortbuf[512]; struct supernet_info *myinfo = SuperNET_MYINFO(0); cJSON *argjson = cJSON_Parse("{}");
//aveask = instantdex_aveprice(myinfo,sortbuf,(int32_t)(sizeof(sortbuf)/sizeof(*sortbuf)),&askvol,"KMD","BTC",1,argjson);
//avebid = instantdex_aveprice(myinfo,sortbuf,(int32_t)(sizeof(sortbuf)/sizeof(*sortbuf)),&bidvol,"KMD","BTC",-1,argjson);
if ( 0 && avebid > SMALLVAL && aveask > SMALLVAL )
@ -1460,6 +1460,8 @@ void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp)
printf("set KMD price %f\n",price);
dp->KMDBTC = price;
}
else if ( (dp->KMDBTC= get_theoretical(&avebid,&aveask,&highbid,&lowask,&CMC_average,changes,"komodo","KMD","BTC")) > SMALLVAL )
*kmdbtcp = dp->KMDBTC;
else
{
for (iter=1; iter<2; iter++)
@ -1882,41 +1884,44 @@ int32_t PAX_idle(struct supernet_info *myinfo)//struct PAX_data *argdp,int32_t i
PAX_RTupdate(dp->cryptovols,dp->RTmetals,dp->RTprices,dp);
PAX_emitprices(pvals,dp);
}
PAX_update(dp,&dp->btcusd,&dp->kmdbtc);
timestamp = (uint32_t)time(NULL);
int32_t dispflag = ((rand() % 100) == 0);
for (i=0; i<MAX_CURRENCIES; i++)
int32_t dispflag = ((rand() % 64) == 0);
if ( dp->kmdbtc == 0 || dispflag != 0 )
{
splineval = PAX_splineval(&dp->splines[i],timestamp,0);
pvals[6+i] = PAX_val32(splineval);
PAX_update(dp,&dp->btcusd,&dp->kmdbtc);
for (i=0; i<MAX_CURRENCIES; i++)
{
splineval = PAX_splineval(&dp->splines[i],timestamp,0);
pvals[6+i] = PAX_val32(splineval);
if ( dispflag != 0 )
printf("%u ",pvals[6+i]);
}
if ( pvals[6+CNY] != 0 && pvals[6+USD] != 0 )
dp->CNYUSD = ((double)pvals[6 + CNY] / pvals[6 + USD]) * MINDENOMS[USD] / MINDENOMS[CNY];
pvals[1] = timestamp;
pvals[2] = MAX_CURRENCIES + 3;
pvals[3] = PAX_val32(dp->kmdbtc * 1000);
pvals[4] = PAX_val32(dp->btcusd * .001);
pvals[5] = PAX_val32(dp->CNYUSD);
if ( dispflag != 0 )
printf("%u ",pvals[6+i]);
}
if ( pvals[6+CNY] != 0 && pvals[6+USD] != 0 )
dp->CNYUSD = ((double)pvals[6 + CNY] / pvals[6 + USD]) * MINDENOMS[USD] / MINDENOMS[CNY];
pvals[1] = timestamp;
pvals[2] = MAX_CURRENCIES + 3;
pvals[3] = PAX_val32(dp->kmdbtc * 1000);
pvals[4] = PAX_val32(dp->btcusd * .001);
pvals[5] = PAX_val32(dp->CNYUSD);
if ( dispflag != 0 )
printf("KMD %f BTC %f CNY %f (%f)\n",dp->kmdbtc,dp->btcusd,dp->CNYUSD,1./dp->CNYUSD);
sprintf(fname,"/%s/.komodo/komodofeed",userhome);
if ( (fp= fopen(fname,"wb")) != 0 )
{
for (i=1; i<MAX_CURRENCIES+6; i++)
iguana_rwnum(1,&data[i*sizeof(uint32_t)],sizeof(*pvals),(void *)&pvals[i]);
pvals[0] = calc_crc32(0,(void *)&data[sizeof(uint32_t)],(MAX_CURRENCIES+5)*sizeof(*pvals));
iguana_rwnum(1,data,sizeof(*pvals),(void *)&pvals[0]);
if ( fwrite(data,sizeof(*pvals),MAX_CURRENCIES+6,fp) != MAX_CURRENCIES+6 )
printf("error writing pvals to (%s)\n",fname);
fclose(fp);
}
if ( dispflag != 0 )
{
for (i=0; i<6; i++)
printf("%u ",pvals[i]);
printf("pvals -> %s\n",fname);
printf("KMD %.8f BTC %f CNY %f (%f)\n",dp->kmdbtc,dp->btcusd,dp->CNYUSD,1./dp->CNYUSD);
sprintf(fname,"/%s/.komodo/komodofeed",userhome);
if ( (fp= fopen(fname,"wb")) != 0 )
{
for (i=1; i<MAX_CURRENCIES+6; i++)
iguana_rwnum(1,&data[i*sizeof(uint32_t)],sizeof(*pvals),(void *)&pvals[i]);
pvals[0] = calc_crc32(0,(void *)&data[sizeof(uint32_t)],(MAX_CURRENCIES+5)*sizeof(*pvals));
iguana_rwnum(1,data,sizeof(*pvals),(void *)&pvals[0]);
if ( fwrite(data,sizeof(*pvals),MAX_CURRENCIES+6,fp) != MAX_CURRENCIES+6 )
printf("error writing pvals to (%s)\n",fname);
fclose(fp);
}
if ( dispflag != 0 )
{
for (i=0; i<6; i++)
printf("%u ",pvals[i]);
printf("pvals -> %s\n",fname);
}
}
}
return(0);

18
iguana/exchanges/bittrex.c

@ -194,8 +194,13 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha
char *ORDERSTATUS(struct exchange_info *exchange,uint64_t quoteid,cJSON *argjson)
{
char payload[1024],*retstr = 0; cJSON *json;
sprintf(payload,"https://bittrex.com/api/v1.1/account/getorder?apikey=%s&nonce=%llu&uuid=%llu",exchange->apikey,(long long)exchange_nonce(exchange),(long long)quoteid);
char payload[1024],*orderstr=0,orderbuf[512],*retstr = 0; cJSON *json;
if ( argjson != 0 )
orderstr = jstr(argjson,"uuid");//, printf("status.(%s)\n",jprint(argjson,0));
if ( orderstr == 0 )
sprintf(orderbuf,"%llu",(long long)quoteid);
else strcpy(orderbuf,jstr(argjson,"uuid"));
sprintf(payload,"https://bittrex.com/api/v1.1/account/getorder?apikey=%s&nonce=%llu&uuid=%s",exchange->apikey,(long long)exchange_nonce(exchange),orderbuf);
if ( (json= SIGNPOST(&exchange->cHandle,1,&retstr,exchange,payload,payload)) != 0 )
{
free_json(json);
@ -205,8 +210,13 @@ char *ORDERSTATUS(struct exchange_info *exchange,uint64_t quoteid,cJSON *argjson
char *CANCELORDER(struct exchange_info *exchange,uint64_t quoteid,cJSON *argjson)
{
char payload[1024],*retstr = 0; cJSON *json;
sprintf(payload,"https://bittrex.com/api/v1.1/market/cancel?apikey=%s&nonce=%llu&uuid=%llu",exchange->apikey,(long long)exchange_nonce(exchange),(long long)quoteid);
char payload[1024],*orderstr=0,orderbuf[512],*retstr = 0; cJSON *json;
if ( argjson != 0 )
orderstr = jstr(argjson,"uuid");//, printf("cancel.(%s)\n",jprint(argjson,0));
if ( orderstr == 0 )
sprintf(orderbuf,"%llu",(long long)quoteid);
else strcpy(orderbuf,jstr(argjson,"uuid"));
sprintf(payload,"https://bittrex.com/api/v1.1/market/cancel?apikey=%s&nonce=%llu&uuid=%s",exchange->apikey,(long long)exchange_nonce(exchange),orderbuf);
if ( (json= SIGNPOST(&exchange->cHandle,1,&retstr,exchange,payload,payload)) != 0 )
{
free_json(json);

598
iguana/exchanges/mm.c

@ -0,0 +1,598 @@
/******************************************************************************
* 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 *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* SuperNET software, including this file may be copied, modified, propagated *
* or distributed except according to the terms contained in the LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
//
// main.c
// marketmaker
//
// Copyright © 2017 SuperNET. All rights reserved.
//
#include <stdio.h>
#include <stdint.h>
#include "OS_portable.h"
struct mmpending_order
{
double price,volume;
int32_t dir;
uint32_t pending,completed,canceled,cancelstarted,reported;
cJSON *errorjson;
char exchange[16],base[16],rel[16],orderid[64];
} *Pending_orders;
int32_t Num_Pending;
#define IGUANA_URL "http://127.0.0.1:7778"
char *DEX_amlp(char *blocktrail)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"tradebot\",\"method\":\"amlp\",\"blocktrail\":\"%s\"}",blocktrail);
return(bitcoind_RPC(0,"tradebot",url,0,"amlp",postdata));
}
char *DEX_openorders(char *exchange)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"openorders\",\"exchange\":\"%s\"}",exchange);
return(bitcoind_RPC(0,"InstantDEX",url,0,"openorders",postdata));
}
char *DEX_tradehistory(char *exchange)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"tradehistory\",\"exchange\":\"%s\"}",exchange);
return(bitcoind_RPC(0,"InstantDEX",url,0,"tradehistory",postdata));
}
char *DEX_orderstatus(char *exchange,char *orderid)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"orderstatus\",\"exchange\":\"%s\",\"orderid\":\"%s\"}",exchange,orderid);
return(bitcoind_RPC(0,"InstantDEX",url,0,"orderstatus",postdata));
}
char *DEX_cancelorder(char *exchange,char *orderid)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"cancelorder\",\"exchange\":\"%s\",\"orderid\":\"%s\"}",exchange,orderid);
return(bitcoind_RPC(0,"InstantDEX",url,0,"cancelorder",postdata));
}
char *DEX_balance(char *exchange,char *base,char *coinaddr)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
if ( strcmp(exchange,"DEX") == 0 )
{
sprintf(postdata,"{\"agent\":\"dex\",\"method\":\"getbalance\",\"address\":\"%s\",\"symbol\":\"%s\"}",coinaddr,base);
return(bitcoind_RPC(0,"dex",url,0,"getbalance",postdata));
}
else
{
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"balance\",\"exchange\":\"%s\",\"base\":\"%s\"}",exchange,base);
return(bitcoind_RPC(0,"InstantDEX",url,0,"balance",postdata));
}
}
char *DEX_apikeypair(char *exchange,char *apikey,char *apisecret)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"apikeypair\",\"exchange\":\"%s\",\"apikey\":\"%s\",\"apisecret\":\"%s\"}",exchange,apikey,apisecret);
return(bitcoind_RPC(0,"InstantDEX",url,0,"apikeypair",postdata));
}
char *DEX_setuserid(char *exchange,char *userid,char *tradepassword)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"setuserid\",\"exchange\":\"%s\",\"userid\":\"%s\",\"tradepassword\":\"%s\"}",exchange,userid,tradepassword);
return(bitcoind_RPC(0,"InstantDEX",url,0,"setuserid",postdata));
}
char *DEX_trade(char *exchange,char *base,char *rel,int32_t dir,double price,double volume)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"%s\",\"exchange\":\"%s\",\"base\":\"%s\",\"rel\":\"%s\",\"price\":%.8f,\"volume\":%.8f,\"dotrade\":1}",dir>0?"buy":"sell",exchange,base,rel,price,volume);
//printf("DEX_trade.(%s)\n",postdata);
return(bitcoind_RPC(0,"InstantDEX",url,0,dir>0?"buy":"sell",postdata));
}
char *DEX_withdraw(char *exchange,char *base,char *destaddr,double amount)
{
char url[512],postdata[1024];
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"InstantDEX\",\"method\":\"withdraw\",\"exchange\":\"%s\",\"destaddr\":\"%s\",\"amount\":%.8f}",exchange,destaddr,amount);
return(bitcoind_RPC(0,"InstantDEX",url,0,"withdraw",postdata));
}
char *iguana_walletpassphrase(char *passphrase,int32_t timeout)
{
char url[512],postdata[1024];
sprintf(url,"%s/coin=KMD&agent=bitcoinrpc&method=walletpassphrase?",IGUANA_URL);
sprintf(postdata,"[\"%s\", %d]",passphrase,timeout);
return(bitcoind_RPC(0,"",url,0,"walletpassphrase",postdata));
}
double bittrex_balance(char *base,char *coinaddr)
{
char *retstr; cJSON *retjson; double balance = 0.;
if ( (retstr= DEX_balance("bittrex",base,coinaddr)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
balance = jdouble(retjson,"balance");
free_json(retjson);
}
free(retstr);
}
return(balance);
}
double dex_balance(char *base,char *coinaddr)
{
char *retstr; cJSON *retjson; double balance = 0.;
if ( (retstr= DEX_balance("DEX",base,coinaddr)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
balance = jdouble(retjson,"balance");
free_json(retjson);
}
free(retstr);
}
return(balance);
}
void marketmaker_cancel(struct mmpending_order *ptr)
{
char *retstr; cJSON *retjson;
if ( ptr->pending != 0 && ptr->cancelstarted == 0 )
{
ptr->cancelstarted = (uint32_t)time(NULL);
if ( (retstr= DEX_cancelorder(ptr->exchange,ptr->orderid)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
printf("cancel %s (%s/%s) %.8f vol %.8f dir.%d -> (%s)\n",ptr->exchange,ptr->base,ptr->rel,ptr->price,ptr->volume,ptr->dir,jprint(retjson,0));
free_json(retjson);
ptr->pending = 0;
ptr->canceled = (uint32_t)time(NULL);
}
free(retstr);
}
}
}
void marketmaker_queue(char *exchange,char *base,char *rel,int32_t dir,double price,double volume,cJSON *retjson)
{
struct mmpending_order *ptr; char *orderid;
//DEX_trade.({"success":true,"message":"","result":{"uuid":"d5faa9e4-660d-436f-a257-2c6a40442d8c"},"tag":"11271578410079391025"}
if ( is_cJSON_True(jobj(retjson,"success")) != 0 && jobj(retjson,"result") != 0 )
retjson = jobj(retjson,"result");
printf("QUEUE.%s %s/%s dir.%d %.8f %.6f (%s)\n",exchange,base,rel,dir,price,volume,jprint(retjson,0));
Pending_orders = realloc(Pending_orders,(1 + Num_Pending) * sizeof(*Pending_orders));
ptr = &Pending_orders[Num_Pending++];
memset(ptr,0,sizeof(*ptr));
ptr->price = price;
ptr->volume = volume;
ptr->dir = dir;
ptr->pending = (uint32_t)time(NULL);
strcpy(ptr->exchange,exchange);
strcpy(ptr->base,base);
strcpy(ptr->rel,rel);
if ( (orderid= jstr(retjson,"OrderUuid")) != 0 || (orderid= jstr(retjson,"uuid")) != 0 )
strcpy(ptr->orderid,orderid);
else strcpy(ptr->orderid,"0");
}
void marketmaker_pendingupdate(char *exchange,char *base,char *rel)
{
char *retstr; cJSON *retjson,*obj; int32_t i; struct mmpending_order *ptr;
for (i=0; i<Num_Pending; i++)
{
ptr = &Pending_orders[i];
if ( strcmp(exchange,ptr->exchange) != 0 || strcmp(base,ptr->base) != 0 || strcmp(rel,ptr->rel) != 0 )
continue;
if ( ptr->completed == 0 && (retstr= DEX_orderstatus(exchange,ptr->orderid)) != 0 )
{
//printf("%s status.(%s)\n",ptr->orderid,retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
obj = jobj(retjson,"result");
if ( is_cJSON_Array(obj) != 0 )
obj = jitem(retjson,0);
if ( jdouble(obj,"QuantityRemaining") == 0. || is_cJSON_True(jobj(obj,"IsOpen")) == 0 )
{
//{"Uuid":null,"OrderUuid":"e7b0789c-0c4e-413b-a768-3d5734d9cbe5","Exchange":"BTC-KMD","OrderType":"LIMIT_SELL","Quantity":877.77700000,"QuantityRemaining":462.50512234,"Limit":0.00011770,"CommissionPaid":0.00012219,"Price":0.04887750,"PricePerUnit":0.00011769,"Opened":"2017-02-20T13:16:22.29","Closed":null,"CancelInitiated":false,"ImmediateOrCancel":false,"IsConditional":false,"Condition":"NONE","ConditionTarget":null} printf("uuid.(%s) finished.(%s)\n",ptr->orderid,jprint(retjson,0));
ptr->completed = (uint32_t)time(NULL);
ptr->pending = 0;
}
free_json(retjson);
}
free(retstr);
}
}
}
void marketmaker_pendinginit(char *exchange,char *base,char *rel)
{
char *retstr,*orderid; cJSON *retjson,*array,*item; int32_t i,j,n,dir; struct mmpending_order *ptr;
if ( (retstr= DEX_openorders(exchange)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
//printf("%s\n",jprint(retjson,0));
if ( is_cJSON_True(jobj(retjson,"success")) != 0 && (array= jarray(&n,retjson,"result")) != 0 )
{
for (i=0; i<n; i++)
{
item = jitem(array,i);
//printf("(%s)\n",jprint(item,0));
//{"success":true,"message":"","result":[{"Uuid":null,"OrderUuid":"81ad3e37-65d4-4fee-9c29-03b050f5192b","Exchange":"BTC-KMD","OrderType":"LIMIT_BUY","Quantity":885.19934578,"QuantityRemaining":885.19934578,"Limit":0.00011184,"CommissionPaid":0,"Price":0,"PricePerUnit":null,"Opened":"2017-02-19T19:14:02.94","Closed":null,"CancelInitiated":false,"ImmediateOrCancel":false,"IsConditional":false,"Condition":"NONE","ConditionTarget":null}],"tag":"10056789044100011414"}
if ( (orderid= jstr(item,"OrderUuid")) != 0 && is_cJSON_Null(jobj(item,"Closed")) != 0 && is_cJSON_False(jobj(item,"CancelInitiated")) != 0 )
{
for (j=0; j<Num_Pending; j++)
{
ptr = &Pending_orders[j];
if ( strcmp(exchange,ptr->exchange) != 0 || strcmp(base,ptr->base) != 0 || strcmp(rel,ptr->rel) != 0 )
continue;
if ( strcmp(ptr->orderid,orderid) == 0 )
{
ptr->pending = (uint32_t)time(NULL);
ptr->completed = 0;
printf("%s pending\n",orderid);
break;
}
}
if ( j == Num_Pending )
{
if ( jstr(item,"OrderType") != 0 )
{
if ( strcmp(jstr(item,"OrderType"),"LIMIT_BUY") == 0 )
dir = 1;
else if ( strcmp(jstr(item,"OrderType"),"LIMIT_SELL") == 0 )
dir = -1;
else dir = 0;
if ( dir != 0 )
marketmaker_queue(exchange,base,rel,dir,jdouble(item,"Limit"),jdouble(item,"QuantityRemaining"),item);
else printf("no dir (%s) (%s)\n",jprint(item,0),jstr(item,"OrderType"));
}
}
}
}
}
free_json(retjson);
}
free(retstr);
}
}
double marketmaker_filled(char *exchange,char *base,char *rel,double *buyvolp,double *sellvolp,double *pendingbidsp,double *pendingasksp)
{
double pricesum = 0.,volsum = 0.; struct mmpending_order *ptr; int32_t i;
*pendingbidsp = *pendingasksp = 0.;
for (i=0; i<Num_Pending; i++)
{
ptr = &Pending_orders[i];
if ( strcmp(exchange,ptr->exchange) != 0 || strcmp(base,ptr->base) != 0 || strcmp(rel,ptr->rel) != 0 )
continue;
if ( ptr->completed != 0 )
{
if ( ptr->reported == 0 )
{
if ( ptr->dir > 0 )
(*buyvolp) += ptr->volume;
else if ( ptr->dir < 0 )
(*sellvolp) += ptr->volume;
pricesum += ptr->volume * ptr->price;
volsum += ptr->volume;
ptr->reported = (uint32_t)time(NULL);
printf("REPORT dir.%d vol %.8f\n",ptr->dir,ptr->volume);
}
}
else if ( ptr->pending != 0 ) // alternative is error or cancelled
{
if ( ptr->dir > 0 )
(*pendingbidsp) += ptr->volume;
else if ( ptr->dir < 0 )
(*pendingasksp) += ptr->volume;
}
}
if ( volsum != 0. )
pricesum /= volsum;
return(pricesum);
}
int32_t marketmaker_prune(char *exchange,char *base,char *rel,int32_t polarity,double bid,double ask,double separation)
{
int32_t i,n = 0; struct mmpending_order *ptr;
for (i=0; i<Num_Pending; i++)
{
ptr = &Pending_orders[i];
if ( strcmp(exchange,ptr->exchange) != 0 || strcmp(base,ptr->base) != 0 || strcmp(rel,ptr->rel) != 0 )
continue;
if ( ptr->pending != 0 && ptr->cancelstarted == 0 )
{
if ( polarity != 0 )
{
if ( ((ptr->dir*polarity > 0 && ptr->price < bid-separation) || (ptr->dir*polarity < 0 && ptr->price > ask+separation)) )
{
printf("polarity.%d dir.%d price.%f bid.%f ask.%f\n",polarity,ptr->dir,ptr->price,bid,ask);
marketmaker_cancel(ptr), n++;
}
}
/*else
{,*prunebid=0,*pruneask=0; double lowbid=0.,highask=0.
if ( ptr->dir > 0 && (lowbid == 0. || ptr->price < lowbid) )
{
lowbid = ptr->price;
prunebid = ptr;
}
else if ( ptr->dir < 0 && (highask == 0. || ptr->price > highask) )
{
highask = ptr->price;
pruneask = ptr;
}
}*/
}
}
/*if ( polarity == 0 )
{
if ( prunebid != 0 && fabs(prunebid->price - bid) > separation )
marketmaker_cancel(prunebid), n++;
if ( pruneask != 0 && fabs(pruneask->price - ask) > separation )
marketmaker_cancel(pruneask), n++;
}*/
return(n);
}
void marketmaker_volumeset(double *bidincrp,double *askincrp,double incr,double buyvol,double pendingbids,double sellvol,double pendingasks,double maxexposure)
{
*bidincrp = *askincrp = incr;
//if ( pendingbids >= pendingasks+maxexposure )
// *bidincrp = 0.;
//else if ( pendingasks >= pendingbids+maxexposure )
// *askincrp = 0.;
if ( *bidincrp > 0. && pendingbids + *bidincrp > maxexposure )
*bidincrp = (maxexposure - *bidincrp);
if ( *askincrp > 0. && pendingasks + *askincrp > maxexposure )
*askincrp = (maxexposure - *askincrp);
if ( *bidincrp < 0. )
*bidincrp = 0.;
if ( *askincrp < 0. )
*askincrp = 0.;
}
int32_t marketmaker_spread(char *exchange,char *base,char *rel,double bid,double bidvol,double ask,double askvol,double separation)
{
int32_t nearflags[2],i,n = 0; struct mmpending_order *ptr; cJSON *retjson,*vals; char *retstr,postdata[1024],url[128];
memset(nearflags,0,sizeof(nearflags));
if ( strcmp("DEX",exchange) != 0 )
{
for (i=0; i<Num_Pending; i++)
{
ptr = &Pending_orders[i];
if ( strcmp(exchange,ptr->exchange) != 0 || strcmp(base,ptr->base) != 0 || strcmp(rel,ptr->rel) != 0 )
continue;
if ( ptr->pending != 0 && ptr->cancelstarted == 0 )
{
if ( bid > SMALLVAL && bidvol > SMALLVAL && ptr->dir > 0 && fabs(bid - ptr->price) < separation )
nearflags[0]++;
if ( ask > SMALLVAL && askvol > SMALLVAL && ptr->dir < 0 && fabs(ask - ptr->price) < separation )
nearflags[1]++;
}
}
}
//printf("spread.%s (%.8f %.6f) (%.8f %.6f)\n",exchange,bid,bidvol,ask,askvol);
if ( bid > SMALLVAL && bidvol > SMALLVAL && nearflags[0] == 0 )
{
if ( strcmp("DEX",exchange) == 0 )
{
if ( ask > SMALLVAL && askvol > SMALLVAL )
{
/*li.profit = jdouble(vals,"profit");
li.refprice = jdouble(vals,"refprice");
li.bid = jdouble(vals,"bid");
li.ask = jdouble(vals,"ask");
if ( (li.minvol= jdouble(vals,"minvol")) <= 0. )
li.minvol = (strcmp("BTC",base) == 0) ? 0.0001 : 0.001;
if ( (li.maxvol= jdouble(vals,"maxvol")) < li.minvol )
li.maxvol = li.minvol;*/
//curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"MVP\",\"vals\":{\"rel\":\"USD\",\"bid\":0.09,\"ask\":0.11,\"maxvol\":100}}"
vals = cJSON_CreateObject();
jaddstr(vals,"rel","BTC");
jaddnum(vals,"bid",bid);
jaddnum(vals,"ask",ask);
jaddnum(vals,"maxvol",bidvol > askvol ? askvol : bidvol);
jaddnum(vals,"minvol",(bidvol > askvol ? askvol : bidvol) * 0.1);
sprintf(url,"%s/?",IGUANA_URL);
sprintf(postdata,"{\"agent\":\"tradebot\",\"method\":\"liquidity\",\"targetcoin\":\"%s\",\"vals\":%s}",base,jprint(vals,1));
printf("call liquidity\n");
if ( (retstr= bitcoind_RPC(0,"tradebot",url,0,"liqudity",postdata)) != 0 )
{
//printf("(%s) -> (%s)\n",postdata,retstr);
free(retstr);
}
} else printf("unsupported ask only for DEX %s/%s\n",base,rel);
}
else if ( (retstr= DEX_trade(exchange,base,rel,1,bid,bidvol)) != 0 )
{
//printf("DEX_trade.(%s)\n",retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
marketmaker_queue(exchange,base,rel,1,bid,bidvol,retjson);
free_json(retjson);
}
free(retstr);
}
}
if ( ask > SMALLVAL && askvol > SMALLVAL && nearflags[1] == 0 && strcmp("DEX",exchange) != 0 )
{
if ( (retstr= DEX_trade(exchange,base,rel,-1,ask,askvol)) != 0 )
{
//printf("DEX_trade.(%s)\n",retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
marketmaker_queue(exchange,base,rel,-1,ask,askvol,retjson);
free_json(retjson);
}
free(retstr);
}
}
return(n);
}
void marketmaker(char *baseaddr,char *reladdr,double start_BASE,double start_REL,double profitmargin,double maxexposure,double ratioincr,char *exchange,char *name,char *base,char *rel)
{
double start_DEXbase,start_DEXrel,DEX_base = 0.,DEX_rel = 0.,balance_base=0.,balance_rel=0.,mmbid,mmask,CMC_average,aveprice,incr,pendingbids,pendingasks,buyvol,sellvol,bidincr,askincr,filledprice,avebid=0.,aveask=0.,val,changes[3],highbid=0.,lowask=0.,theoretical = 0.; uint32_t lasttime = 0;
incr = maxexposure * ratioincr;
buyvol = sellvol = 0.;
start_DEXbase = dex_balance(base,baseaddr);
start_DEXrel = dex_balance(rel,reladdr);
while ( 1 )
{
if ( time(NULL) > lasttime+60 )
{
if ( (val= get_theoretical(&avebid,&aveask,&highbid,&lowask,&CMC_average,changes,name,base,rel)) != 0. )
{
if ( theoretical == 0. )
{
theoretical = val;
incr /= theoretical;
maxexposure /= theoretical;
if ( incr > 2 )
{
incr = (int32_t)incr;
incr += 0.777;
}
} else theoretical = (theoretical + val) * 0.5;
}
if ( strcmp(exchange,"bittrex") == 0 )
{
balance_base = bittrex_balance(base,"");
balance_rel = bittrex_balance(rel,"");
DEX_base = dex_balance(base,baseaddr);
DEX_rel = dex_balance(rel,reladdr);
} else printf("add support for %s balance\n",exchange);
lasttime = (uint32_t)time(NULL);
}
marketmaker_pendingupdate(exchange,base,rel);
if ( theoretical > SMALLVAL && avebid > SMALLVAL && aveask > SMALLVAL )
{
aveprice = (avebid + aveask) * 0.5;
// if order is filled, theoretical <- filled (theoretical + price)/2
if ( (filledprice= marketmaker_filled(exchange,base,rel,&buyvol,&sellvol,&pendingbids,&pendingasks)) != 0. )
theoretical = (theoretical + filledprice) * 0.5;
buyvol = sellvol = 0;
if ( (balance_base + DEX_base) < (start_BASE + start_DEXbase) )
sellvol += ((start_BASE + start_DEXbase) - (balance_base + DEX_base));
else buyvol += ((balance_base + DEX_base) - (start_BASE + start_DEXbase));
if ( (balance_rel + DEX_rel) < (start_REL + start_DEXrel) )
buyvol += ((start_REL + start_DEXrel) - (balance_rel + DEX_rel)) / theoretical;
else sellvol += ((balance_rel + DEX_rel) - (start_REL + start_DEXrel)) / theoretical;
mmbid = theoretical - theoretical*profitmargin;
mmask = theoretical + theoretical*profitmargin;
// if any existing order exceeds double margin distance, cancel
marketmaker_prune(exchange,base,rel,1,mmbid - theoretical*profitmargin,mmask + theoretical*profitmargin,0.);
// if new prices crosses existing order, cancel old order first
marketmaker_prune(exchange,base,rel,-1,mmbid,mmask,0.);
printf("(%.8f %.8f) ",mmbid,mmask);
if ( (1) )
{
if ( mmbid >= lowask ) //mmbid < highbid ||
mmbid = 0.;
if ( mmask <= highbid ) // mmask > lowask ||
mmask = 0.;
}
marketmaker_volumeset(&bidincr,&askincr,incr,buyvol,pendingbids,sellvol,pendingasks,maxexposure);
printf("AVE.(%.8f %.8f) hbla %.8f %.8f bid %.8f ask %.8f theory %.8f buys.(%.6f %.6f) sells.(%.6f %.6f) incr.(%.6f %.6f) balances.(%.8f + %.8f, %.8f + %.8f)\n",avebid,aveask,highbid,lowask,mmbid,mmask,theoretical,buyvol,pendingbids,sellvol,pendingasks,bidincr,askincr,balance_base,DEX_base,balance_rel,DEX_rel);
marketmaker_spread("DEX",base,rel,avebid - profitmargin*aveprice,incr,aveask + profitmargin*aveprice,incr,profitmargin*aveprice*0.5);
if ( (pendingbids + buyvol) > (pendingasks + sellvol) )
{
bidincr *= (double)(pendingasks + sellvol) / ((pendingbids + buyvol) + (pendingasks + sellvol));
if ( bidincr > 1. )
bidincr = (int32_t)bidincr + 0.777;
}
if ( (pendingbids + buyvol) < (pendingasks + sellvol) )
{
askincr *= (double)(pendingbids + buyvol) / ((pendingbids + buyvol) + (pendingasks + sellvol));
if ( askincr > 1. )
askincr = (int32_t)askincr + 0.777;
}
marketmaker_spread(exchange,base,rel,mmbid,bidincr,mmask,askincr,profitmargin*aveprice*0.5);
sleep(60);
}
}
}
int main(int argc, const char * argv[])
{
char *base,*rel,*name,*exchange,*apikey,*apisecret,*blocktrail;
double profitmargin,maxexposure,incrratio,start_rel,start_base;
cJSON *retjson,*addrjson; char *retstr,*baseaddr,*reladdr,*passphrase;
if ( argc > 1 && (retjson= cJSON_Parse(argv[1])) != 0 )
{
printf("argc.%d (%s)\n",argc,jprint(retjson,0));
profitmargin = jdouble(retjson,"profitmargin");
maxexposure = jdouble(retjson,"maxexposure");
incrratio = jdouble(retjson,"lotratio");
start_base = jdouble(retjson,"start_base");
start_rel = jdouble(retjson,"start_rel");
passphrase = jstr(retjson,"passphrase");
apikey = jstr(retjson,"apikey");
apisecret = jstr(retjson,"apisecret");
base = jstr(retjson,"base");
name = jstr(retjson,"name");
rel = jstr(retjson,"rel");
blocktrail = jstr(retjson,"blocktrail");
exchange = jstr(retjson,"exchange");
if ( profitmargin < 0. || maxexposure <= 0. || incrratio <= 0. || apikey == 0 || apisecret == 0 || base == 0 || name == 0 || rel == 0 || exchange == 0 || blocktrail == 0 )
{
printf("illegal parameter (%s)\n",jprint(retjson,0));
exit(-1);
}
if ( (retstr= iguana_walletpassphrase(passphrase,999999)) != 0 )
{
printf("%s\n",DEX_apikeypair(exchange,apikey,apisecret));
printf("%s %s\n",base,DEX_balance(exchange,base,""));
printf("%s %s\n",rel,DEX_balance(exchange,rel,""));
marketmaker_pendinginit(exchange,base,rel);
if ( (addrjson= cJSON_Parse(retstr)) != 0 )
{
baseaddr = jstr(addrjson,base);
reladdr = jstr(addrjson,rel);
if ( baseaddr != 0 && reladdr != 0 )
{
printf("%s\n",DEX_amlp(blocktrail));
printf("%s.%s %s\n",base,baseaddr,DEX_balance("DEX",base,baseaddr));
printf("%s.%s %s\n",rel,reladdr,DEX_balance("DEX",rel,reladdr));
// initialize state using DEX_pendingorders, etc.
marketmaker(baseaddr,reladdr,start_base,start_rel,profitmargin,maxexposure,incrratio,exchange,name,base,rel);
}
free_json(addrjson);
}
free(retstr);
}
free_json(retjson);
}
return 0;
}

6
iguana/iguana777.h

@ -88,6 +88,8 @@ struct supernet_address
char NXTADDR[32],BTC[64],BTCD[64];
};
struct pending_trade { UT_hash_handle hh; double basevolume,relvolume,dir; char base[32],rel[32]; };
struct liquidity_info
{
char base[16],rel[16],exchange[16];
@ -125,10 +127,10 @@ struct supernet_info
struct delayedPoW_info dPoW;
struct basilisk_spend *spends; int32_t numspends;
char bindaddr[64];
// fadedreamz
char blocktrail_apikey[256];
struct peggy_info *PEGS;
void *PAXDATA;
struct liquidity_info linfos[512];
struct liquidity_info linfos[512]; cJSON *liquidity_currencies; struct pending_trade *trades; portable_mutex_t pending_mutex;
struct komodo_notaries NOTARY;
char seedipaddr[64]; uint32_t dpowipbits[128]; int32_t numdpowipbits; portable_mutex_t notarymutex,dpowmutex;
char dexseed_ipaddrs[2][64]; uint32_t dexipbits[128]; int32_t numdexipbits; portable_mutex_t dexmutex;

25
iguana/iguana_exchanges.c

@ -995,6 +995,7 @@ char *exchanges777_Qrequest(struct exchange_info *exchange,int32_t func,char *ba
safecopy(req->rel,rel,sizeof(req->rel));
req->retstrp = calloc(1,sizeof(void *));
req->orderid = orderid;
req->argjson = jduplicate(argjson);
//printf("Qrequest\n");
return(exchanges777_submit(exchange,req,func,maxseconds));
}
@ -1244,26 +1245,42 @@ TWO_STRINGS(InstantDEX,balance,exchange,base)
TWO_STRINGS(InstantDEX,orderstatus,exchange,orderid)
{
struct exchange_info *ptr;
struct exchange_info *ptr; cJSON *argjson; char *retstr; uint64_t num = 0;
if ( remoteaddr == 0 )
{
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 )
return(exchanges777_Qrequest(ptr,'P',0,0,juint(json,"maxseconds"),calc_nxt64bits(orderid),0,0,json));
{
argjson = cJSON_CreateObject();
jaddstr(argjson,"uuid",orderid);
if ( is_decimalstr(orderid) != 0 )
num = calc_nxt64bits(orderid);
retstr = exchanges777_Qrequest(ptr,'P',0,0,juint(json,"maxseconds"),num,0,0,argjson);
free_json(argjson);
return(retstr);
}
else return(clonestr("{\"error\":\"cant find or create exchange\"}"));
} else return(clonestr("{\"error\":\"no remote for this API\"}"));
}
TWO_STRINGS(InstantDEX,cancelorder,exchange,orderid)
{
struct exchange_info *ptr;
struct exchange_info *ptr; cJSON *argjson; char *retstr; uint64_t num = 0;
if ( remoteaddr == 0 )
{
if ( myinfo->expiration == 0 )
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
if ( (ptr= exchanges777_info(exchange,1,json,remoteaddr)) != 0 )
return(exchanges777_Qrequest(ptr,'C',0,0,juint(json,"maxseconds"),calc_nxt64bits(orderid),0,0,json));
{
argjson = cJSON_CreateObject();
jaddstr(argjson,"uuid",orderid);
if ( is_decimalstr(orderid) != 0 )
num = calc_nxt64bits(orderid);
retstr = exchanges777_Qrequest(ptr,'C',0,0,juint(json,"maxseconds"),num,0,0,argjson);
free_json(argjson);
return(retstr);
}
else return(clonestr("{\"error\":\"cant find or create exchange\"}"));
} else return(clonestr("{\"error\":\"no remote for this API\"}"));
}

127
iguana/iguana_notary.c

@ -615,11 +615,90 @@ HASH_AND_STRING_AND_INT(dex,gettxout,txid,symbol,vout)
TWO_STRINGS(dex,listunspent,symbol,address)
{
if ( symbol != 0 && strcmp(symbol,"BTC") == 0 && (coin= iguana_coinfind("BTC")) != 0 && coin->FULLNODE == 0 && myinfo->IAMLP != 0 )
{
char url[1024],*retstr,*coinaddr,*script; int32_t i,n,vout; cJSON *retjson,*data,*item,*item3,*data3; bits256 txid; uint64_t val;
sprintf(url,"https://api.blocktrail.com/v1/btc/address/%s/unspent-outputs?api_key=%s",address,myinfo->blocktrail_apikey);
if ( (retstr= issue_curl(url)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
data = jarray(&n,retjson,"data");
data3 = cJSON_CreateArray();
//[{"hash":"e0a40dac21103e92e0dc9311a0233640489afc5beb5ba3b009848a8e9151dc55","time":"2017-02-21T16:48:28+0000","confirmations":1,"is_coinbase":false,"value":4100000,"index":1,"address":"19rjYdJtRN3qoammX3r1gxy9bvh8p8DmRc","type":"pubkeyhash","multisig":null,"script":"OP_DUP OP_HASH160 6128e7459989d35d530bcd4066c9aaf1f925430a OP_EQUALVERIFY OP_CHECKSIG","script_hex":"76a9146128e7459989d35d530bcd4066c9aaf1f925430a88ac"}]
/*{
"txid" : "e95d3083baf733dfda2fcd1110fe2937cb3580f8b1b237aad547528440dfa873",
"vout" : 1,
"address" : "RNgdefRo2iRLWqDXEogJrsTw35MgDPQP4R",
"account" : "",
"scriptPubKey" : "76a91493088c5f3546225e0ef6ba9c9c6a74d4c2df877388ac",
"amount" : 150.00000000,
"interest" : 0.30000000,
"confirmations" : 20599,
"spendable" : true
}*/
for (i=0; i<n; i++)
{
item = jitem(data,i);
txid = jbits256(item,"hash");
vout = jint(item,"index");
val = j64bits(item,"value");
coinaddr = jstr(item,"address");
script = jstr(item,"script_hex");
item3 = cJSON_CreateObject();
jaddbits256(item3,"txid",txid);
jaddnum(item3,"vout",vout);
jaddnum(item3,"amount",dstr(val));
jaddnum(item3,"value",dstr(val));
if ( coinaddr != 0 )
jaddstr(item3,"address",coinaddr);
if ( script != 0 )
jaddstr(item3,"scriptPubKey",script);
jaddnum(item3,"confirmations",jint(item,"confirmations"));
jadd(item3,"spendable",jtrue());
jaddi(data3,item3);
}
free(retstr);
retstr = jprint(data3,1);
free_json(retjson);
}
return(retstr);
}
}
return(_dex_listunspent(myinfo,symbol,address));
}
TWO_STRINGS_AND_TWO_DOUBLES(dex,listtransactions,symbol,address,count,skip)
{
if ( symbol != 0 && strcmp(symbol,"BTC") == 0 && (coin= iguana_coinfind("BTC")) != 0 && coin->FULLNODE == 0 && myinfo->IAMLP != 0 )
{
char url[1024],*retstr,*retstr2; cJSON *retjson,*retjson2,*retjson3,*data,*data2; int32_t i,n;
sprintf(url,"https://api.blocktrail.com/v1/btc/address/%s/transactions?api_key=%s",address,myinfo->blocktrail_apikey);
if ( (retstr= issue_curl(url)) != 0 )
{
sprintf(url,"https://api.blocktrail.com/v1/btc/address/%s/unconfirmed-transactions?api_key=%s",address,myinfo->blocktrail_apikey);
if ( (retstr2= issue_curl(url)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 && (retjson2= cJSON_Parse(retstr2)) != 0 )
{
data = jarray(&n,retjson,"data");
data2 = jarray(&n,retjson2,"data");
retjson3 = jduplicate(data);
if ( n > 0 )
{
for (i=0; i<n; i++)
jaddi(retjson3,jduplicate(jitem(data2,i)));
}
printf("combined (%s) and (%s) -> (%s)\n",retstr,retstr2,jprint(retjson3,0));
free(retstr);
free(retstr2);
free_json(retjson);
free_json(retjson2);
return(jprint(retjson3,1));
}
}
}
}
return(_dex_listtransactions(myinfo,symbol,address,count,skip));
}
@ -771,6 +850,7 @@ TWO_STRINGS(dex,listspent,symbol,address)
TWO_STRINGS(dex,getbalance,symbol,address)
{
char url[512],*retstr; cJSON *retjson; uint64_t val;
if ( myinfo->DEXEXPLORER != 0 )
{
if ( symbol != 0 && address != 0 && (coin= iguana_coinfind(symbol)) != 0 && coin->DEXEXPLORER != 0 )
@ -779,8 +859,53 @@ TWO_STRINGS(dex,getbalance,symbol,address)
coin->DEXEXPLORER = myinfo->DEXEXPLORER * myinfo->IAMNOTARY * (iguana_isnotarychain(coin->symbol) >= 0);
}
if ( symbol != 0 && address != 0 )
{
if ( strcmp(symbol,"BTC") == 0 && myinfo->IAMLP != 0 )
{
sprintf(url,"https://api.blocktrail.com/v1/btc/address/%s?api_key=%s",address,myinfo->blocktrail_apikey);
if ( (retstr= issue_curl(url)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
//printf("balance\n");
if ( (val= j64bits(retjson,"balance")) != 0 )
{
jdelete(retjson,"balance");
jaddnum(retjson,"balance",dstr(val));
}
//printf("sent\n");
if ( (val= j64bits(retjson,"sent")) != 0 )
{
jdelete(retjson,"sent");
jaddnum(retjson,"sent",dstr(val));
}
//printf("received\n");
if ( (val= j64bits(retjson,"received")) != 0 )
{
jdelete(retjson,"received");
jaddnum(retjson,"received",dstr(val));
}
//printf("unconfirmed_sent\n");
if ( (val= j64bits(retjson,"unconfirmed_sent")) != 0 )
{
jdelete(retjson,"unconfirmed_sent");
jaddnum(retjson,"unconfirmed_sent",dstr(val));
}
//printf("unconfirmed_received\n");
if ( (val= j64bits(retjson,"unconfirmed_received")) != 0 )
{
jdelete(retjson,"unconfirmed_received");
jaddnum(retjson,"unconfirmed_received",dstr(val));
}
//printf("(%s) -> (%s)\n",retstr,jprint(retjson,0));
free(retstr);
retstr = jprint(retjson,1);
}
}
return(retstr);
}
return(_dex_getbalance(myinfo,symbol,address));
else return(clonestr("{\"error\":\"dex getbalance null symbol, address or coin\"}"));
} else return(clonestr("{\"error\":\"dex getbalance null symbol, address or coin\"}"));
}
STRING_ARG(dex,explorer,symbol)

46
iguana/iguana_payments.c

@ -341,10 +341,32 @@ 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)
uint64_t _iguana_interest(uint32_t now,int32_t chainheight,uint32_t txlocktime,uint64_t value)
{
char *retstr; int32_t height; cJSON *retjson; struct iguana_txid T,*tx;
int32_t minutes; uint64_t numerator=0,denominator=0,interest = 0;
if ( (minutes= ((uint32_t)time(NULL) - 60 - txlocktime) / 60) >= 60 )
{
denominator = (((uint64_t)365 * 24 * 60) / minutes);
if ( denominator == 0 )
denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually!
if ( value > 25000LL*SATOSHIDEN && chainheight > 155949 )
{
numerator = (value / 20); // assumes 5%!
interest = (numerator / denominator);
}
else if ( value >= 10*SATOSHIDEN )
{
numerator = (value * KOMODO_INTEREST);
interest = (numerator / denominator) / SATOSHIDEN;
}
fprintf(stderr,"komodo_interest.%d %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu)\n",chainheight,(long long)value,(double)value/SATOSHIDEN,txlocktime,now,minutes,(long long)interest,(double)interest/SATOSHIDEN,(long long)numerator,(long long)denominator);
}
return(interest);
}
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; uint64_t interest=0;
if ( coin->FULLNODE < 0 ) // komodod is running
{
if ( (retjson= dpow_gettxout(myinfo,coin,txid,vout)) != 0 )
@ -367,25 +389,9 @@ uint64_t iguana_interest(struct supernet_info *myinfo,struct iguana_info *coin,b
}
else // we have it local
{
if ( (tx= iguana_txidfind(coin,&height,&T,txid,coin->bundlescount)) != 0 && tx->locktime >LOCKTIME_THRESHOLD )
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 )
{
denominator = (((uint64_t)365 * 24 * 60) / minutes);
if ( denominator == 0 )
denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually!
if ( value > 25000LL*SATOSHIDEN && height > 155949 )
{
numerator = (value / 20); // assumes 5%!
interest = (numerator / denominator);
}
else if ( value >= 10*SATOSHIDEN )
{
numerator = (value * KOMODO_INTEREST);
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);
}
interest = _iguana_interest((uint32_t)time(NULL),coin->longestchain,tx->locktime,value);
}
}
char str[65]; printf("interest for %s.v%d %.8f %.8f\n",bits256_str(str,txid),vout,dstr(value),dstr(interest));

17
iguana/iguana_rpc.c

@ -1100,11 +1100,18 @@ char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsiz
}
else
{
//printf("ARGJSON.(%s)\n",jprint(argjson,0));
coin = iguana_coinchoose(myinfo,symbol,argjson,port);
if ( userpass != 0 && jstr(argjson,"userpass") == 0 )
jaddstr(argjson,"userpass",userpass);
retstr = SuperNET_JSON(myinfo,coin,argjson,remoteaddr,port);
cJSON *arg;
if ( jstr(argjson,"agent") != 0 && strcmp(jstr(argjson,"agent"),"bitcoinrpc") != 0 && jobj(argjson,"params") != 0 )
{
arg = jobj(argjson,"params");
if ( is_cJSON_Array(arg) != 0 && cJSON_GetArraySize(arg) == 1 )
arg = jitem(arg,0);
} else arg = argjson;
//printf("ARGJSON.(%s)\n",jprint(arg,0));
coin = iguana_coinchoose(myinfo,symbol,arg,port);
if ( userpass != 0 && jstr(arg,"userpass") == 0 )
jaddstr(arg,"userpass",userpass);
retstr = SuperNET_JSON(myinfo,coin,arg,remoteaddr,port);
}
free_json(argjson);
free_json(json);

4
iguana/iguana_tradebots.c

@ -228,9 +228,11 @@ HASH_ARRAY_STRING(tradebot,liquidity,hash,vals,targetcoin)
return(clonestr("{\"result\":\"targetcoin updated\"}"));
}
ZERO_ARGS(tradebot,amlp)
STRING_ARG(tradebot,amlp,blocktrail)
{
myinfo->IAMLP = 1;
if ( blocktrail != 0 )
safecopy(myinfo->blocktrail_apikey,blocktrail,sizeof(myinfo->blocktrail_apikey));
return(clonestr("{\"result\":\"liquidity provider active\"}"));
}

53
iguana/kmd_lookup.h

@ -304,7 +304,7 @@ cJSON *kmd_transactionjson(int32_t height,struct kmd_transactionhh *ptr,char *ty
return(obj);
}
cJSON *kmd_unspentjson(int32_t height,struct kmd_transaction *tx,int32_t vout)
cJSON *kmd_unspentjson(struct iguana_info *coin,int32_t height,struct kmd_transaction *tx,int32_t vout)
{
cJSON *item = cJSON_CreateObject();
jaddstr(item,"type","received");
@ -313,6 +313,8 @@ cJSON *kmd_unspentjson(int32_t height,struct kmd_transaction *tx,int32_t vout)
jaddbits256(item,"txid",tx->txid);
jaddnum(item,"vout",vout);
jaddnum(item,"amount",dstr(tx->vouts[vout].amount));
if ( strcmp(coin->symbol,"KMD") == 0 )
jaddnum(item,"interest",dstr(_iguana_interest((uint32_t)time(NULL),coin->longestchain,tx->timestamp,tx->vouts[vout].amount)));
return(item);
}
@ -376,9 +378,9 @@ cJSON *kmd_gettxin(struct iguana_info *coin,bits256 txid,int32_t vout)
return(cJSON_Parse("{\"error\":\"txid not found\"}"));
}
cJSON *kmd_listaddress(struct iguana_info *coin,char *coinaddr,int32_t mode,cJSON *array,int32_t fulltx)
cJSON *kmd_listaddress(struct iguana_info *coin,char *coinaddr,int32_t mode,cJSON *array)
{
struct kmd_addresshh *addr; struct kmd_transactionhh *ptr,*spent,*prev=0; uint8_t type_rmd160[21]; int32_t i,flag = 0;
struct kmd_addresshh *addr; struct kmd_transactionhh *ptr=0,*spent,*prev=0; uint8_t type_rmd160[21]; int32_t i;
if ( array == 0 )
array = cJSON_CreateArray();
/*if ( time(NULL) > coin->kmd_lasttime+30 )
@ -407,20 +409,20 @@ cJSON *kmd_listaddress(struct iguana_info *coin,char *coinaddr,int32_t mode,cJSO
// printf("mode.%d [%d] %s ht.%d amount %.8f spent.%p\n",mode,coin->kmd_height,coinaddr,ptr->tx->height,dstr(ptr->tx->vouts[i].amount),spent);
if ( (mode == 0 && spent == 0) || (mode == 1 && spent != 0) || mode == 2 )
{
if ( fulltx == 0 )
//if ( fulltx == 0 )
{
if ( mode == 0 )
jaddi(array,kmd_unspentjson(coin->kmd_height,ptr->tx,i));
jaddi(array,kmd_unspentjson(coin,coin->kmd_height,ptr->tx,i));
else if ( mode == 1 )
jaddi(array,kmd_spentjson(coin->kmd_height,ptr->tx,i,spent));
else if ( mode == 2 )
{
if ( spent != 0 )
jaddi(array,kmd_spentjson(coin->kmd_height,ptr->tx,i,spent));
else jaddi(array,kmd_unspentjson(coin->kmd_height,ptr->tx,i));
else jaddi(array,kmd_unspentjson(coin,coin->kmd_height,ptr->tx,i));
}
}
else if ( flag == 0 )
/*else if ( flag == 0 )
{
if ( mode == 0 )
jaddi(array,kmd_transactionjson(coin->kmd_height,ptr,"received"));
@ -436,7 +438,7 @@ cJSON *kmd_listaddress(struct iguana_info *coin,char *coinaddr,int32_t mode,cJSO
else jaddi(array,kmd_transactionjson(coin->kmd_height,ptr,"received"));
}
flag = 1;
}
}*/
}
if ( ptr->ptrs[i<<1] != 0 )
{
@ -449,18 +451,18 @@ cJSON *kmd_listaddress(struct iguana_info *coin,char *coinaddr,int32_t mode,cJSO
}
ptr = prev;
}
} else printf("no valid entry for (%s)\n",coinaddr);
} else printf("no valid entry for (%s) %p %p\n",coinaddr,addr,ptr);
return(array);
}
cJSON *kmd_listunspent(struct iguana_info *coin,char *coinaddr)
{
return(kmd_listaddress(coin,coinaddr,0,0,0));
return(kmd_listaddress(coin,coinaddr,0,0));
}
cJSON *kmd_listspent(struct iguana_info *coin,char *coinaddr)
{
return(kmd_listaddress(coin,coinaddr,1,0,0));
return(kmd_listaddress(coin,coinaddr,1,0));
}
cJSON *kmd_listtransactions(struct iguana_info *coin,char *coinaddr,int32_t count,int32_t skip)
@ -470,17 +472,17 @@ cJSON *kmd_listtransactions(struct iguana_info *coin,char *coinaddr,int32_t coun
// return(cJSON_Parse("[]"));
if ( count == 0 )
count = 100;
array = kmd_listaddress(coin,coinaddr,0,0,0);
array = kmd_listaddress(coin,coinaddr,1,array,0);
array = kmd_listaddress(coin,coinaddr,0,0);
array = kmd_listaddress(coin,coinaddr,1,array);
return(array);
}
int64_t _kmd_getbalance(struct iguana_info *coin,char *coinaddr,uint64_t *receivedp,uint64_t *sentp)
int64_t _kmd_getbalance(struct iguana_info *coin,char *coinaddr,uint64_t *receivedp,uint64_t *sentp,uint64_t *interestp)
{
int32_t iter,i,n; cJSON *array,*item; uint64_t value;
for (iter=1; iter<=2; iter++)
{
if ( (array= kmd_listaddress(coin,coinaddr,iter,0,0)) != 0 )
if ( (array= kmd_listaddress(coin,coinaddr,iter,0)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 )
{
@ -490,8 +492,10 @@ int64_t _kmd_getbalance(struct iguana_info *coin,char *coinaddr,uint64_t *receiv
if ( (value= jdouble(item,"amount")*SATOSHIDEN) != 0 || (value= jdouble(item,"value")*SATOSHIDEN) != 0 )
{
if ( iter == 2 )
{
*receivedp += value;
else *sentp += value;
*interestp += jdouble(item,"interest") * SATOSHIDEN;
} else *sentp += value;
}
}
}
@ -503,29 +507,31 @@ int64_t _kmd_getbalance(struct iguana_info *coin,char *coinaddr,uint64_t *receiv
cJSON *kmd_getbalance(struct iguana_info *coin,char *coinaddr)
{
cJSON *retjson; double netbalance=0.,fbalance; uint64_t s,r,sent=0,received=0; int64_t balance=0; struct kmd_addresshh *addr,*tmp; char address[64]; int32_t height = coin->kmd_height+1;
cJSON *retjson; double netbalance=0.,fbalance; uint64_t interest,i,s,r,sent=0,received=0; int64_t balance=0; struct kmd_addresshh *addr,*tmp; char address[64]; int32_t height = coin->kmd_height+1;
retjson = cJSON_CreateObject();
fbalance = 0.;
interest = 0;
if ( strcmp(coinaddr,"*") == 0 )
{
HASH_ITER(hh,coin->kmd_addresses,addr,tmp)
{
bitcoin_address(address,addr->type_rmd160[0],&addr->type_rmd160[1],20);
s = r = 0;
balance += _kmd_getbalance(coin,address,&r,&s);
s = r = i = 0;
balance += _kmd_getbalance(coin,address,&r,&s,&i);
netbalance += dstr(r);
netbalance -= dstr(s);
if ( (r - s) > 100000*SATOSHIDEN )
printf("{\"address\":\"%s\",\"received\":%.8f,\"sent\":%.8f,\"balance\":%.8f,\"supply\":%.8f,\"supplyf\":%.8f}\n",address,dstr(r),dstr(s),dstr(r)-dstr(s),dstr(balance),netbalance);
printf("{\"address\":\"%s\",\"received\":%.8f,\"sent\":%.8f,\"balance\":%.8f,\"supply\":%.8f,\"supplyf\":%.8f,\"interest\":%.8f}\n",address,dstr(r),dstr(s),dstr(r)-dstr(s),dstr(balance),netbalance,dstr(interest));
received += r;
sent += s;
interest += i;
}
if ( strcmp("KMD",coin->symbol) == 0 )
jaddnum(retjson,"interestpaid",dstr(balance) - 100000000 - (height*3));
}
else
{
balance = _kmd_getbalance(coin,coinaddr,&received,&sent);
balance = _kmd_getbalance(coin,coinaddr,&received,&sent,&interest);
netbalance = dstr(balance);
}
jaddstr(retjson,"result","success");
@ -534,7 +540,8 @@ cJSON *kmd_getbalance(struct iguana_info *coin,char *coinaddr)
//if ( fabs(netbalance*SATOSHIDEN - balance) > 1 )
jaddnum(retjson,"balancef",netbalance+1./(SATOSHIDEN*2)-SMALLVAL);
//else
jaddnum(retjson,"balance",dstr(balance));
jaddnum(retjson,"balance",dstr(balance));
jaddnum(retjson,"interest",dstr(interest));
jaddnum(retjson,"height",height);
if ( strcmp("KMD",coin->symbol) == 0 )
jaddnum(retjson,"mined",height*3);
@ -550,7 +557,7 @@ char *kmd_bitcoinblockhashstr(char *coinstr,char *serverport,char *userpass,int3
hash2 = bits256_conv(blockhashstr);
if ( blockhashstr == 0 || blockhashstr[0] == 0 || bits256_nonz(hash2) == 0 )
{
printf("couldnt get blockhash for %u, probably curl is disabled\n",height);
printf("%s couldnt get blockhash for %u, probably curl is disabled %p\n",coinstr,height,blockhashstr);
if ( blockhashstr != 0 )
free(blockhashstr);
if ( height == 0 )

1
iguana/m_mm

@ -0,0 +1 @@
gcc -o marketmaker -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c ../agents/libcrypto777.a -lcurl -lpthread -lm

4
iguana/m_osx

@ -3,6 +3,6 @@
rm ../agents/iguana *.o
git pull
cd secp256k1; ./m_unix; cd ..
gcc -g -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
gcc -g -Wno-address-of-packed-member -Wno-deprecated -c -O2 -DLIQUIDITY_PROVIDER=1 *.c ../basilisk/basilisk.c ../gecko/gecko.c ../datachain/datachain.c
gcc -g -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 -lcurl -lssl -lcrypto -lpthread -lz -lm
gcc -g -o ../agents/iguana *.o ../agents/libcrypto777.a -lnanomsg -lcurl -lssl -lcrypto -lpthread -lz -lm

11
iguana/main.c

@ -274,7 +274,7 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin
//char str[65]; printf("processJSON %p %s\n",&myinfo->privkey,bits256_str(str,myinfo->privkey));
if ( json != 0 )
{
if ( (tag= j64bits(json,"tag")) == 0 )
if ( jobj(json,"tag") == 0 || (tag= j64bits(json,"tag")) == 0 )
{
OS_randombytes((uint8_t *)&tag,sizeof(tag));
jadd64bits(json,"tag",tag);
@ -304,7 +304,7 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin
{
if ( is_cJSON_Array(retjson) == 0 )
{
if ( j64bits(retjson,"tag") != tag )
if ( jobj(retjson,"tag") == 0 || j64bits(retjson,"tag") != tag )
{
if ( jobj(retjson,"tag") != 0 )
jdelete(retjson,"tag");
@ -346,7 +346,7 @@ char *SuperNET_JSON(struct supernet_info *myinfo,struct iguana_info *coin,cJSON
timestamp = (uint32_t)time(NULL);
jaddnum(json,"timestamp",timestamp);
}
if ( (tag= j64bits(json,"tag")) == 0 )
if ( jobj(json,"tag") == 0 || (tag= j64bits(json,"tag")) == 0 )
{
OS_randombytes((uint8_t *)&tag,sizeof(tag));
jadd64bits(json,"tag",tag);
@ -1612,7 +1612,7 @@ void komodo_ICO_batch(cJSON *array,int32_t batchid)
printf("# %s KMD %.8f\n",coinaddr,dstr(kmdamount));
if ( (iter & 1) == 0 )
{
if ( (0) )
if ( (1) )
{
printf("curl --url \"http://127.0.0.1:7778\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"importaddress\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"KMD\\\"}\" # %.8f\n",coinaddr,dstr(kmdamount));
printf("sleep 3\n");
@ -1676,7 +1676,7 @@ void iguana_main(void *arg)
else printf("ENDIAN ERROR\n");
mycalloc(0,0,0);
#ifdef __APPLE__
char *batchstr,*batchstr2; cJSON *batchjson; long batchsize; char fname[512],fname2[512]; int32_t batchid = 10;
char *batchstr,*batchstr2; cJSON *batchjson; long batchsize; char fname[512],fname2[512]; int32_t batchid = 11;
sprintf(fname,"REVS.raw"), sprintf(fname2,"REVS.rawtxids");
if ( (0) && (batchstr= OS_filestr(&batchsize,fname)) != 0 && (batchstr2= OS_filestr(&batchsize,fname2)) != 0 )
{
@ -1725,6 +1725,7 @@ void iguana_main(void *arg)
}
strcpy(myinfo->rpcsymbol,"BTCD");
iguana_urlinit(myinfo,ismainnet,usessl);
portable_mutex_init(&myinfo->pending_mutex);
portable_mutex_init(&myinfo->dpowmutex);
portable_mutex_init(&myinfo->notarymutex);
#if LIQUIDITY_PROVIDER

164
iguana/tests/KMD.batch10

@ -0,0 +1,164 @@
# RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d KMD 6266.43352646
./komodo-cli sendtoaddress RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d 6266.43352646
sleep 3
echo "6266.43352646 <- expected amount RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d"
# R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6 KMD 1203.04246569
./komodo-cli sendtoaddress R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6 1203.04246569
sleep 3
echo "1203.04246569 <- expected amount R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6"
# RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j KMD 9683.15249375
./komodo-cli sendtoaddress RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j 9683.15249375
sleep 3
echo "9683.15249375 <- expected amount RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j"
# RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT KMD 306877.42641191
./komodo-cli sendtoaddress RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT 306877.42641191
sleep 3
echo "306877.42641191 <- expected amount RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT"
# RQantoJxT8szwfAqUM3enLPe85YiQtwndH KMD 150.23706901
./komodo-cli sendtoaddress RQantoJxT8szwfAqUM3enLPe85YiQtwndH 150.23706901
sleep 3
echo "150.23706901 <- expected amount RQantoJxT8szwfAqUM3enLPe85YiQtwndH"
# RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY KMD 1985.04626121
./komodo-cli sendtoaddress RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY 1985.04626121
sleep 3
echo "1985.04626121 <- expected amount RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY"
# RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE KMD 1664.32251109
./komodo-cli sendtoaddress RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE 1664.32251109
sleep 3
echo "1664.32251109 <- expected amount RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE"
# RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3 KMD 5.99800973
./komodo-cli sendtoaddress RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3 5.99800973
sleep 3
echo "5.99800973 <- expected amount RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3"
# RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc KMD 9671.53271075
./komodo-cli sendtoaddress RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc 9671.53271075
sleep 3
echo "9671.53271075 <- expected amount RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc"
# RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm KMD 40223.19497203, REVS 101.00000000
# RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm KMD 40223.19497203
./komodo-cli sendtoaddress RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm 40223.19497203
sleep 3
echo "40223.19497203 <- expected amount RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm"
# RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB KMD 72698.53877152
./komodo-cli sendtoaddress RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB 72698.53877152
sleep 3
echo "72698.53877152 <- expected amount RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB"
# RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe KMD 9683.15249375
./komodo-cli sendtoaddress RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe 9683.15249375
sleep 3
echo "9683.15249375 <- expected amount RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe"
# RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB KMD 3532.13792522
./komodo-cli sendtoaddress RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB 3532.13792522
sleep 3
echo "3532.13792522 <- expected amount RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB"
# RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ KMD 309.69366537
./komodo-cli sendtoaddress RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ 309.69366537
sleep 3
echo "309.69366537 <- expected amount RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ"
# RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z KMD 3873.26099750
./komodo-cli sendtoaddress RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z 3873.26099750
sleep 3
echo "3873.26099750 <- expected amount RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z"
# RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut KMD 62053.93460050
./komodo-cli sendtoaddress RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut 62053.93460050
sleep 3
echo "62053.93460050 <- expected amount RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut"
# REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs KMD 6506.14889316
./komodo-cli sendtoaddress REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs 6506.14889316
sleep 3
echo "6506.14889316 <- expected amount REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs"
# RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL KMD 812.78437655
./komodo-cli sendtoaddress RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL 812.78437655
sleep 3
echo "812.78437655 <- expected amount RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL"
# R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8 KMD 1452.47287406
./komodo-cli sendtoaddress R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8 1452.47287406
sleep 3
echo "1452.47287406 <- expected amount R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8"
# RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A KMD 867.82549038
./komodo-cli sendtoaddress RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A 867.82549038
sleep 3
echo "867.82549038 <- expected amount RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A"
# RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv KMD 693.08132289
./komodo-cli sendtoaddress RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv 693.08132289
sleep 3
echo "693.08132289 <- expected amount RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv"
# RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm KMD 8521.17419450
./komodo-cli sendtoaddress RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm 8521.17419450
sleep 3
echo "8521.17419450 <- expected amount RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm"
# RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM KMD 5328.53865807
./komodo-cli sendtoaddress RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM 5328.53865807
sleep 3
echo "5328.53865807 <- expected amount RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM"
# RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1 KMD 29049.45748125
./komodo-cli sendtoaddress RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1 29049.45748125
sleep 3
echo "29049.45748125 <- expected amount RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1"
# RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot KMD 4840.60793162
./komodo-cli sendtoaddress RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot 4840.60793162
sleep 3
echo "4840.60793162 <- expected amount RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot"
# RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct KMD 2420.78812342
./komodo-cli sendtoaddress RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct 2420.78812342
sleep 3
echo "2420.78812342 <- expected amount RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct"
# RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC KMD 137.73071692, REVS 2.73426759
# RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC KMD 137.73071692
./komodo-cli sendtoaddress RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC 137.73071692
sleep 3
echo "137.73071692 <- expected amount RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC"
# RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM KMD 9737.34607711
./komodo-cli sendtoaddress RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM 9737.34607711
sleep 3
echo "9737.34607711 <- expected amount RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM"
# RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga KMD 1903.31162313
./komodo-cli sendtoaddress RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga 1903.31162313
sleep 3
echo "1903.31162313 <- expected amount RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga"
# RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h KMD 99.84182062
./komodo-cli sendtoaddress RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h 99.84182062
sleep 3
echo "99.84182062 <- expected amount RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h"
# RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF KMD 1167.24851677
./komodo-cli sendtoaddress RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF 1167.24851677
sleep 3
echo "1167.24851677 <- expected amount RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF"
# RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD KMD 15095.38306803
./komodo-cli sendtoaddress RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD 15095.38306803
sleep 3
echo "15095.38306803 <- expected amount RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD"
# total KMD 618514.84605397 REVS 0.00000000

161
iguana/tests/KMD.batch10.importaddress

@ -0,0 +1,161 @@
# RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d KMD 6266.43352646
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d\",\"symbol\":\"KMD\"}" # 6266.43352646
sleep 3
echo "6266.43352646 <- expected amount RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d"
# R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6 KMD 1203.04246569
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6\",\"symbol\":\"KMD\"}" # 1203.04246569
sleep 3
echo "1203.04246569 <- expected amount R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6"
# RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j KMD 9683.15249375
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j\",\"symbol\":\"KMD\"}" # 9683.15249375
sleep 3
echo "9683.15249375 <- expected amount RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j"
# RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT KMD 306877.42641191
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT\",\"symbol\":\"KMD\"}" # 306877.42641191
sleep 3
echo "306877.42641191 <- expected amount RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT"
# RQantoJxT8szwfAqUM3enLPe85YiQtwndH KMD 150.23706901
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RQantoJxT8szwfAqUM3enLPe85YiQtwndH\",\"symbol\":\"KMD\"}" # 150.23706901
sleep 3
echo "150.23706901 <- expected amount RQantoJxT8szwfAqUM3enLPe85YiQtwndH"
# RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY KMD 1985.04626121
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY\",\"symbol\":\"KMD\"}" # 1985.04626121
sleep 3
echo "1985.04626121 <- expected amount RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY"
# RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE KMD 1664.32251109
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE\",\"symbol\":\"KMD\"}" # 1664.32251109
sleep 3
echo "1664.32251109 <- expected amount RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE"
# RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3 KMD 5.99800973
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3\",\"symbol\":\"KMD\"}" # 5.99800973
sleep 3
echo "5.99800973 <- expected amount RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3"
# RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc KMD 9671.53271075
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc\",\"symbol\":\"KMD\"}" # 9671.53271075
sleep 3
echo "9671.53271075 <- expected amount RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc"
# RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm KMD 40223.19497203, REVS 101.00000000
# RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm KMD 40223.19497203
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm\",\"symbol\":\"KMD\"}" # 40223.19497203
sleep 3
echo "40223.19497203 <- expected amount RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm"
# RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB KMD 72698.53877152
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB\",\"symbol\":\"KMD\"}" # 72698.53877152
sleep 3
echo "72698.53877152 <- expected amount RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB"
# RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe KMD 9683.15249375
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe\",\"symbol\":\"KMD\"}" # 9683.15249375
sleep 3
echo "9683.15249375 <- expected amount RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe"
# RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB KMD 3532.13792522
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB\",\"symbol\":\"KMD\"}" # 3532.13792522
sleep 3
echo "3532.13792522 <- expected amount RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB"
# RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ KMD 309.69366537
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ\",\"symbol\":\"KMD\"}" # 309.69366537
sleep 3
echo "309.69366537 <- expected amount RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ"
# RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z KMD 3873.26099750
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z\",\"symbol\":\"KMD\"}" # 3873.26099750
sleep 3
echo "3873.26099750 <- expected amount RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z"
# RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut KMD 62053.93460050
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut\",\"symbol\":\"KMD\"}" # 62053.93460050
sleep 3
echo "62053.93460050 <- expected amount RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut"
# REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs KMD 6506.14889316
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs\",\"symbol\":\"KMD\"}" # 6506.14889316
sleep 3
echo "6506.14889316 <- expected amount REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs"
# RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL KMD 812.78437655
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL\",\"symbol\":\"KMD\"}" # 812.78437655
sleep 3
echo "812.78437655 <- expected amount RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL"
# R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8 KMD 1452.47287406
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8\",\"symbol\":\"KMD\"}" # 1452.47287406
sleep 3
echo "1452.47287406 <- expected amount R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8"
# RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A KMD 867.82549038
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A\",\"symbol\":\"KMD\"}" # 867.82549038
sleep 3
echo "867.82549038 <- expected amount RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A"
# RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv KMD 693.08132289
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv\",\"symbol\":\"KMD\"}" # 693.08132289
sleep 3
echo "693.08132289 <- expected amount RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv"
# RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm KMD 8521.17419450
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm\",\"symbol\":\"KMD\"}" # 8521.17419450
sleep 3
echo "8521.17419450 <- expected amount RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm"
# RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM KMD 5328.53865807
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM\",\"symbol\":\"KMD\"}" # 5328.53865807
sleep 3
echo "5328.53865807 <- expected amount RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM"
# RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1 KMD 29049.45748125
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1\",\"symbol\":\"KMD\"}" # 29049.45748125
sleep 3
echo "29049.45748125 <- expected amount RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1"
# RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot KMD 4840.60793162
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot\",\"symbol\":\"KMD\"}" # 4840.60793162
sleep 3
echo "4840.60793162 <- expected amount RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot"
# RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct KMD 2420.78812342
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct\",\"symbol\":\"KMD\"}" # 2420.78812342
sleep 3
echo "2420.78812342 <- expected amount RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct"
# RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC KMD 137.73071692, REVS 2.73426759
# RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC KMD 137.73071692
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC\",\"symbol\":\"KMD\"}" # 137.73071692
sleep 3
echo "137.73071692 <- expected amount RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC"
# RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM KMD 9737.34607711
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM\",\"symbol\":\"KMD\"}" # 9737.34607711
sleep 3
echo "9737.34607711 <- expected amount RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM"
# RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga KMD 1903.31162313
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga\",\"symbol\":\"KMD\"}" # 1903.31162313
sleep 3
echo "1903.31162313 <- expected amount RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga"
# RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h KMD 99.84182062
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h\",\"symbol\":\"KMD\"}" # 99.84182062
sleep 3
echo "99.84182062 <- expected amount RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h"
# RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF KMD 1167.24851677
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF\",\"symbol\":\"KMD\"}" # 1167.24851677
sleep 3
echo "1167.24851677 <- expected amount RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF"
# RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD KMD 15095.38306803
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD\",\"symbol\":\"KMD\"}" # 15095.38306803
sleep 3
echo "15095.38306803 <- expected amount RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD"

129
iguana/tests/KMD.batch10.listunspent

@ -0,0 +1,129 @@
# RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d KMD 6266.43352646
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d\",\"symbol\":\"KMD\"}"
echo "6266.43352646 <- expected amount RQC6A3SKtLb2zmqDDwFvRH6Zz4mZufmp3d"
# R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6 KMD 1203.04246569
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6\",\"symbol\":\"KMD\"}"
echo "1203.04246569 <- expected amount R9SpRcd2KRD45B7SqzuUFhNnsnx7YqgkN6"
# RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j KMD 9683.15249375
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j\",\"symbol\":\"KMD\"}"
echo "9683.15249375 <- expected amount RCA8H1npFPW5pnJRzycF8tFEJmn6XZhD4j"
# RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT KMD 306877.42641191
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT\",\"symbol\":\"KMD\"}"
echo "306877.42641191 <- expected amount RTJXwRhuAH9iyztyuRuGC8G7DamTgSMGvT"
# RQantoJxT8szwfAqUM3enLPe85YiQtwndH KMD 150.23706901
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RQantoJxT8szwfAqUM3enLPe85YiQtwndH\",\"symbol\":\"KMD\"}"
echo "150.23706901 <- expected amount RQantoJxT8szwfAqUM3enLPe85YiQtwndH"
# RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY KMD 1985.04626121
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY\",\"symbol\":\"KMD\"}"
echo "1985.04626121 <- expected amount RLvvwtBUupmGDy81CJNp6RxKbxxbuu3jRY"
# RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE KMD 1664.32251109
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE\",\"symbol\":\"KMD\"}"
echo "1664.32251109 <- expected amount RFdRKqe82MmvSxZQjgtLfzdf8mNHztKpPE"
# RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3 KMD 5.99800973
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3\",\"symbol\":\"KMD\"}"
echo "5.99800973 <- expected amount RE1NYFqFG2vmhhHVY7QFC7sTp7zBxvSSP3"
# RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc KMD 9671.53271075
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc\",\"symbol\":\"KMD\"}"
echo "9671.53271075 <- expected amount RNYMy1joru9gFitzokTSi5qFFc5nS4iFxc"
# RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm KMD 40223.19497203, REVS 101.00000000
# RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm KMD 40223.19497203
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm\",\"symbol\":\"KMD\"}"
echo "40223.19497203 <- expected amount RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm"
# RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB KMD 72698.53877152
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB\",\"symbol\":\"KMD\"}"
echo "72698.53877152 <- expected amount RPqAFgwnB1hjae6Ar4Kms973uS93HbDkoB"
# RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe KMD 9683.15249375
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe\",\"symbol\":\"KMD\"}"
echo "9683.15249375 <- expected amount RVzFdNGRn8Ekr4XaeDSfE9fjqvKdcVicJe"
# RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB KMD 3532.13792522
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB\",\"symbol\":\"KMD\"}"
echo "3532.13792522 <- expected amount RTbTzn7FGJWwrH1E3fMwuZPs3YVH1MvVoB"
# RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ KMD 309.69366537
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ\",\"symbol\":\"KMD\"}"
echo "309.69366537 <- expected amount RDdUQ5t6SYYGZUdAxBk5i7QdTWvzAshxNZ"
# RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z KMD 3873.26099750
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z\",\"symbol\":\"KMD\"}"
echo "3873.26099750 <- expected amount RYYgc5UD7X18E6CrDXCs1cts5WDwaWhm1Z"
# RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut KMD 62053.93460050
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut\",\"symbol\":\"KMD\"}"
echo "62053.93460050 <- expected amount RXdBJ5cWDcS38ykuggEQZh3vSztxwmG3ut"
# REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs KMD 6506.14889316
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs\",\"symbol\":\"KMD\"}"
echo "6506.14889316 <- expected amount REKnBAyZMnhKzRozzcuv6fKRtoBsKTFYjs"
# RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL KMD 812.78437655
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL\",\"symbol\":\"KMD\"}"
echo "812.78437655 <- expected amount RY422uSvkAoZy81uGot5PmXuMrtChhJ3uL"
# R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8 KMD 1452.47287406
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8\",\"symbol\":\"KMD\"}"
echo "1452.47287406 <- expected amount R9o3CQms16CLu63j9WdqsaWB3XsssRXEq8"
# RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A KMD 867.82549038
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A\",\"symbol\":\"KMD\"}"
echo "867.82549038 <- expected amount RWTfFTP7c9WxLhgxd2EXSsKszpDVPXHN8A"
# RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv KMD 693.08132289
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv\",\"symbol\":\"KMD\"}"
echo "693.08132289 <- expected amount RHJ55iWUQNbKcSn8shbv1RbGuip3RSRHFv"
# RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm KMD 8521.17419450
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm\",\"symbol\":\"KMD\"}"
echo "8521.17419450 <- expected amount RCfBinKfJ1wGSxXLPNTmC9bohFRoofUiVm"
# RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM KMD 5328.53865807
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM\",\"symbol\":\"KMD\"}"
echo "5328.53865807 <- expected amount RNEZRHeWE3KgSTUr3qvH7RNvM2JWZZkygM"
# RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1 KMD 29049.45748125
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1\",\"symbol\":\"KMD\"}"
echo "29049.45748125 <- expected amount RH7tsX9PaKECxSEALpu5EWdmEKikY7R2n1"
# RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot KMD 4840.60793162
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot\",\"symbol\":\"KMD\"}"
echo "4840.60793162 <- expected amount RYHxrTNpqrAHRbULboJVYHWqmnmVhzzrot"
# RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct KMD 2420.78812342
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct\",\"symbol\":\"KMD\"}"
echo "2420.78812342 <- expected amount RLCEGw7zmAhZQYtP23Z2TD45gAT9ZuZKct"
# RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC KMD 137.73071692, REVS 2.73426759
# RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC KMD 137.73071692
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC\",\"symbol\":\"KMD\"}"
echo "137.73071692 <- expected amount RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC"
# RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM KMD 9737.34607711
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM\",\"symbol\":\"KMD\"}"
echo "9737.34607711 <- expected amount RRdDD2YoR5cfwktePGGFT5cEyRcWkEjzvM"
# RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga KMD 1903.31162313
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga\",\"symbol\":\"KMD\"}"
echo "1903.31162313 <- expected amount RKbb9NGB3pU2BaByoDwyZDH74E7koR2Lga"
# RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h KMD 99.84182062
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h\",\"symbol\":\"KMD\"}"
echo "99.84182062 <- expected amount RQsSsmpzFagxRaYk6cTMpNHa4eYLihKn8h"
# RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF KMD 1167.24851677
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF\",\"symbol\":\"KMD\"}"
echo "1167.24851677 <- expected amount RKQPNcePppEkV4CMXZrwqEMAvRHbruKVdF"
# RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD KMD 15095.38306803
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD\",\"symbol\":\"KMD\"}"
echo "15095.38306803 <- expected amount RHKuiEoakr9yeWQT9UZzCrqPgR8MPBaGvD"

8
iguana/tests/REVS.batch10

@ -0,0 +1,8 @@
# RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm KMD 40223.19497203, REVS 101.00000000
sleep 1
fiat/revs sendtoaddress RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm 101.00000000
# RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC KMD 137.73071692, REVS 2.73426759
sleep 1
fiat/revs sendtoaddress RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC 2.73426759
# total KMD 0.00000000 REVS 103.73426759

6
iguana/tests/REVS.batch10.importaddress

@ -0,0 +1,6 @@
# RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm KMD 40223.19497203, REVS 101.00000000
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RF4jZsF5BUckQqX5hsS68kjQMYSba8Fypm\",\"symbol\":\"REVS\"}" # 101.00000000
sleep 3
# RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC KMD 137.73071692, REVS 2.73426759
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RGQmMzmUfa6R5dZvvL5wvy2vxPLEcgkkyC\",\"symbol\":\"REVS\"}" # 2.73426759
sleep 3

2
iguana/tests/amlp

@ -1,2 +1,2 @@
#!/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\":\"amlp\",\"blocktrail\":\"blocktrail_apikey\"}"

2
iguana/tests/dexlisttransactions

@ -1,5 +1,5 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listtransactions\",\"address\":\"RDobQ77wnMY8Me7RAL9oiFqVNvwkqqgPRF\",\"count\":100,\"skip\":0,\"symbol\":\"KMD\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listtransactions\",\"address\":\"1Pc27firvEwPoDzPzYdJKZ5hoZK4T1tf6z\",\"count\":100,\"skip\":0,\"symbol\":\"BTC\"}"
#curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listtransactions\",\"address\":\"RRyBxbrAPRUBCUpiJgJZYrkxqrh8x5ta9Z\",\"count\":100,\"skip\":0,\"symbol\":\"MVP\"}"
#curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listtransactions\",\"address\":\"RMGpGoX82M1ZUUbHxZ3JKHacxY9NYVakqr\",\"count\":100,\"skip\":0,\"symbol\":\"USD\"}"
#curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listtransactions\",\"address\":\"RMGpGoX82M1ZUUbHxZ3JKHacxY9NYVakqr\",\"count\":100,\"skip\":0,\"symbol\":\"MVP\"}"

2
iguana/tests/dexlistunspent

@ -1,2 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"RW3gz9fEadohRLZerK9r8zXkugk5swWHrf\",\"symbol\":\"KMD\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"19rjYdJtRN3qoammX3r1gxy9bvh8p8DmRc\",\"symbol\":\"BTC\"}"

2
iguana/tests/dexlistunspent2

@ -1,2 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent2\",\"address\":\"RW3gz9fEadohRLZerK9r8zXkugk5swWHrf\",\"symbol\":\"KMD\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent2\",\"address\":\"RNJmgYaFF5DbnrNUX6pMYz9rcnDKC2tuAc\",\"symbol\":\"KMD\"}"

3
iguana/tests/mm

@ -0,0 +1,3 @@
../../coins/basilisk/btc
../../coins/basilisk/kmd
../marketmaker '{"blocktrail":"<get apikey from blocktrail.com>","passphrase":"<iguana passphrase>","base":"KMD","rel":"BTC","name":"komodo","exchange":"bittrex","apikey":"<yourbittrexapikey>","apisecret":"<yourbittrexapisecret>","profitmargin":0.001,"maxexposure":0.1,"lotratio":0.02,"start_rel":0.1,"start_base":1000}'

346
includes/iguana_apideclares copy.h

@ -1,346 +0,0 @@
/******************************************************************************
* 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 *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* SuperNET software, including this file may be copied, modified, propagated *
* or distributed except according to the terms contained in the LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
STRING_ARG(dpow,pending,fiat);
TWO_STRINGS(iguana,dpow,symbol,pubkey);
STRING_ARG(dpow,active,maskhex);
TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified);
ZERO_ARGS(dpow,cancelratify);
THREE_STRINGS(iguana,passthru,asset,function,hex);
STRING_ARG(dpow,bindaddr,ipaddr);
STRING_AND_INT(dpow,fundnotaries,symbol,numblocks);
ZERO_ARGS(dpow,notarychains);
INT_ARG(passthru,paxfiats,mask);
INT_ARG(basilisk,paxfiats,mask);
INT_ARG(iguana,paxfiats,mask);
STRING_AND_INT(iguana,snapshot,symbol,height);
INT_ARRAY_STRING(iguana,dividends,height,vals,symbol);
TWO_STRINGS(dex,send,hex,handler);
HASH_AND_STRING(dex,gettransaction,txid,symbol);
STRING_ARG(dex,getinfo,symbol);
STRING_ARG(dex,getnotaries,symbol);
STRING_ARG(dex,alladdresses,symbol);
STRING_ARG(dex,getbestblockhash,symbol);
STRING_AND_INT(dex,getblockhash,symbol,height);
HASH_AND_STRING(dex,getblock,hash,symbol);
TWO_STRINGS(dex,sendrawtransaction,symbol,signedtx);
HASH_AND_STRING_AND_INT(dex,gettxout,txid,symbol,vout);
TWO_STRINGS(dex,importaddress,symbol,address);
TWO_STRINGS(dex,checkaddress,symbol,address);
TWO_STRINGS(dex,validateaddress,symbol,address);
TWO_STRINGS(dex,listunspent,symbol,address);
TWO_STRINGS_AND_TWO_DOUBLES(dex,listtransactions,symbol,address,count,skip);
TWO_STRINGS(zcash,passthru,function,hex);
TWO_STRINGS(komodo,passthru,function,hex);
ZERO_ARGS(pax,start);
HASH_ARRAY_STRING(tradebot,liquidity,hash,vals,targetcoin);
ZERO_ARGS(tradebot,amlp);
ZERO_ARGS(tradebot,notlp);
TWO_STRINGS(tradebot,gensvm,base,rel);
ZERO_ARGS(tradebot,openliquidity);
INT_AND_ARRAY(iguana,rates,unused,quotes);
TWO_STRINGS(iguana,rate,base,rel);
THREE_STRINGS_AND_THREE_INTS(iguana,prices,exchange,base,rel,period,start,end);
ZERO_ARGS(InstantDEX,allcoins);
STRING_ARG(InstantDEX,available,source);
HASH_ARRAY_STRING(InstantDEX,request,hash,vals,hexstr);
INT_ARG(InstantDEX,incoming,requestid);
INT_ARG(InstantDEX,automatched,requestid);
TWO_INTS(InstantDEX,accept,requestid,quoteid);
//TWO_INTS(InstantDEX,swapstatus,requestid,quoteid);
HASH_ARRAY_STRING(basilisk,genesis_opreturn,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,value,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,rawtx,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,geckoheaders,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,geckoblock,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,geckotx,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,geckoget,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,addrelay,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,dispatch,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,publish,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,subscribe,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,forward,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,mailbox,hash,vals,hexstr);
/*HASH_ARRAY_STRING(basilisk,VPNcreate,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,VPNjoin,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,VPNmessage,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,VPNbroadcast,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,VPNreceive,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,VPNlogout,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,vote,hash,vals,hexstr);*/
ZERO_ARGS(bitcoinrpc,getinfo);
ZERO_ARGS(bitcoinrpc,getblockcount);
ZERO_ARGS(bitcoinrpc,getdifficulty);
ZERO_ARGS(bitcoinrpc,getbestblockhash);
INT_ARG(bitcoinrpc,getblockhash,height);
HASH_AND_TWOINTS(bitcoinrpc,getblock,blockhash,verbose,remoteonly);
HASH_AND_INT(bitcoinrpc,getrawtransaction,txid,verbose);
HASH_ARG(bitcoinrpc,gettransaction,txid);
HASH_AND_TWOINTS(bitcoinrpc,gettxout,txid,vout,mempool);
TWOINTS_AND_ARRAY(bitcoinrpc,listunspent,minconf,maxconf,array);
STRING_ARG(bitcoinrpc,decodescript,scriptstr);
//STRING_ARG(bitcoinrpc,decoderawtransaction,rawtx);
STRING_AND_INT(bitcoinrpc,decoderawtransaction,rawtx,suppress);
STRING_AND_INT(bitcoinrpc,validaterawtransaction,rawtx,suppress);
ARRAY_OBJ_INT(bitcoinrpc,createrawtransaction,vins,vouts,locktime);
ZERO_ARGS(iguana,makekeypair);
STRING_ARG(bitcoinrpc,validatepubkey,pubkey);
STRING_ARG(bitcoinrpc,validateaddress,address);
THREE_INTS(iguana,splitfunds,satoshis,duplicates,sendflag);
ZERO_ARGS(bitcoinrpc,walletlock);
TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout);
THREE_STRINGS(bitcoinrpc,encryptwallet,passphrase,password,permanentfile);
FOUR_STRINGS(bitcoinrpc,walletpassphrasechange,oldpassword,newpassword,oldpermanentfile,permanentfile);
STRING_ARG(bitcoinrpc,dumpwallet,filename);
STRING_ARG(bitcoinrpc,backupwallet,filename);
STRING_ARG(bitcoinrpc,importwallet,filename);
STRING_ARG(bitcoinrpc,getnewaddress,account);
TWOSTRINGS_AND_INT(bitcoinrpc,importprivkey,wif,account,rescan);
STRING_ARG(bitcoinrpc,dumpprivkey,address);
STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatchonly);
THREE_INTS(bitcoinrpc,listreceivedbyaddress,minconf,includeempty,flag);
THREE_INTS(bitcoinrpc,listreceivedbyaccount,confirmations,includeempty,watchonly);
TWO_INTS(bitcoinrpc,listaccounts,minconf,includewatchonly);
ZERO_ARGS(bitcoinrpc,listaddressgroupings);
STRING_AND_INT(bitcoinrpc,getreceivedbyaddress,address,minconf);
STRING_AND_INT(bitcoinrpc,getreceivedbyaccount,account,includeempty);
STRING_AND_THREEINTS(bitcoinrpc,getbalance,account,confirmations,includeempty,lastheight);
STRING_ARG(bitcoinrpc,getaddressesbyaccount,account);
STRING_ARG(bitcoinrpc,getaccount,address);
STRING_ARG(bitcoinrpc,getaccountaddress,account);
TWO_STRINGS(bitcoinrpc,setaccount,address,account);
INT_ARRAY_STRING(bitcoinrpc,createmultisig,M,pubkeys,ignore);
INT_ARRAY_STRING(bitcoinrpc,addmultisigaddress,M,pubkeys,account);
DOUBLE_ARG(bitcoinrpc,settxfee,amount);
ZERO_ARGS(bitcoinrpc,checkwallet);
ZERO_ARGS(bitcoinrpc,repairwallet);
STRING_ARRAY_OBJ_STRING(bitcoinrpc,signrawtransaction,rawtx,vins,privkeys,sighash);
TWO_STRINGS(bitcoinrpc,signmessage,address,message);
THREE_STRINGS(bitcoinrpc,verifymessage,address,sig,message);
STRING_AND_INT(bitcoinrpc,sendrawtransaction,rawtx,allowhighfees);
SS_D_I_SS(bitcoinrpc,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2);
S_A_I_S(bitcoinrpc,sendmany,fromaccount,payments,minconf,comment);
S_D_SS(bitcoinrpc,sendtoaddress,address,amount,comment,comment2);
INT_AND_ARRAY(bitcoinrpc,lockunspent,flag,array); //
ZERO_ARGS(bitcoinrpc,listlockunspent); //
STRING_ARG(bitcoinrpc,submitblock,rawbytes); //
// maybe later
HASH_AND_TWOINTS(bitcoinrpc,listsinceblock,blockhash,target,flag);
ZERO_ARGS(bitcoinrpc,gettxoutsetinfo);
ZERO_ARGS(bitcoinrpc,getrawchangeaddress);
SS_D_I_S(bitcoinrpc,move,fromaccount,toaccount,amount,minconf,comment);
STRING_ARG(iguana,initfastfind,activecoin);
STRING_ARG(iguana,peers,activecoin);
STRING_AND_INT(iguana,maxpeers,activecoin,max);
STRING_ARG(iguana,getconnectioncount,activecoin);
STRING_ARG(iguana,addcoin,newcoin);
STRING_ARG(iguana,validate,activecoin);
STRING_ARG(iguana,removecoin,activecoin);
STRING_ARG(iguana,startcoin,activecoin);
STRING_ARG(iguana,pausecoin,activecoin);
STRING_ARG(iguana,stopcoin,activecoin);
TWO_STRINGS(iguana,addnode,activecoin,ipaddr);
STRING_ARG(iguana,addnotary,ipaddr);
TWO_STRINGS(iguana,persistent,activecoin,ipaddr);
TWO_STRINGS(iguana,removenode,activecoin,ipaddr);
TWO_STRINGS(iguana,oneshot,activecoin,ipaddr);
TWO_STRINGS(iguana,nodestatus,activecoin,ipaddr);
TWO_STRINGS_AND_TWO_DOUBLES(iguana,balance,activecoin,address,heightd,minconfd);
P2SH_SPENDAPI(iguana,spendmsig,activecoin,vintxid,vinvout,destaddress,destamount,destaddress2,destamount2,M,N,pubA,wifA,pubB,wifB,pubC,wifC);
STRING_AND_INT(iguana,bundleaddresses,activecoin,height);
STRING_AND_INT(iguana,bundlehashes,activecoin,height);
STRING_AND_INT(iguana,PoSweights,activecoin,height);
STRING_ARG(iguana,stakers,activecoin);
//TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,minaccept,base,rel,minprice,basevolume);
//TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,maxaccept,base,rel,maxprice,basevolume);
THREE_STRINGS_AND_THREE_DOUBLES(InstantDEX,buy,exchange,base,rel,price,volume,dotrade);
THREE_STRINGS_AND_THREE_DOUBLES(InstantDEX,sell,exchange,base,rel,price,volume,dotrade);
THREE_STRINGS_AND_DOUBLE(InstantDEX,withdraw,exchange,base,destaddr,amount);
THREE_STRINGS(InstantDEX,apikeypair,exchange,apikey,apisecret);
THREE_STRINGS(InstantDEX,setuserid,exchange,userid,tradepassword);
TWO_STRINGS(InstantDEX,balance,exchange,base);
TWO_STRINGS(InstantDEX,orderstatus,exchange,orderid);
TWO_STRINGS(InstantDEX,cancelorder,exchange,orderid);
STRING_ARG(InstantDEX,openorders,exchange);
STRING_ARG(InstantDEX,tradehistory,exchange);
THREE_STRINGS_AND_THREE_INTS(InstantDEX,orderbook,exchange,base,rel,depth,allfields,ignore);
STRING_AND_INT(InstantDEX,pollgap,exchange,pollgap);
//TWO_STRINGS(InstantDEX,events,base,rel);
ZERO_ARGS(InstantDEX,allexchanges);
STRING_ARG(InstantDEX,allpairs,exchange);
THREE_STRINGS(InstantDEX,supports,exchange,base,rel);
//THREE_STRINGS(atomic,approve,myorderid,otherid,txname);
//THREE_STRINGS(atomic,claim,myorderid,otherid,txname);
//TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(InstantDEX,proposal,reference,message,basetxid,reltxid,duration,flags);
//TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(InstantDEX,accept,reference,message,basetxid,reltxid,duration,flags);
//TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(InstantDEX,confirm,reference,message,basetxid,reltxid,baseheight,relheight);
THREE_STRINGS_AND_DOUBLE(tradebot,aveprice,comment,base,rel,basevolume);
THREE_STRINGS_AND_DOUBLE(tradebot,monitor,exchange,base,rel,commission);
STRING_AND_DOUBLE(tradebot,monitorall,exchange,commission);
THREE_STRINGS(tradebot,unmonitor,exchange,base,rel);
THREE_STRINGS_AND_THREE_DOUBLES(tradebot,accumulate,exchange,base,rel,price,volume,duration);
THREE_STRINGS_AND_THREE_DOUBLES(tradebot,divest,exchange,base,rel,price,volume,duration);
STRING_ARG(tradebot,activebots,exchange);
TWO_STRINGS(tradebot,status,exchange,botid);
TWO_STRINGS(tradebot,pause,exchange,botid);
TWO_STRINGS(tradebot,stop,exchange,botid);
TWO_STRINGS(tradebot,resume,exchange,botid);
#ifndef WIN32
/*HASH_ARG(pangea,call,tablehash);
HASH_AND_INT(pangea,raise,tablehash,numchips);
HASH_AND_INT(pangea,bet,tablehash,numchips);
HASH_ARG(pangea,check,tablehash);
HASH_ARG(pangea,fold,tablehash);
HASH_ARG(pangea,allin,tablehash);
HASH_ARG(pangea,status,tablehash);
HASH_AND_STRING(pangea,mode,tablehash,params);
HASH_ARG(pangea,history,tablehash);
HASH_AND_INT(pangea,handhistory,tablehash,hand);
INT_AND_ARRAY(pangea,host,minplayers,params);
ZERO_ARGS(pangea,lobby);
HASH_AND_STRING(pangea,join,tablehash,handle);
HASH_AND_INT(pangea,buyin,tablehash,numchips);
HASH_ARG(pangea,start,tablehash);*/
#endif
ZERO_ARGS(SuperNET,help);
STRING_ARG(SuperNET,utime2utc,utime);
INT_ARG(SuperNET,utc2utime,utc);
STRING_ARG(SuperNET,getpeers,activecoin);
TWO_ARRAYS(SuperNET,mypeers,supernet,rawpeers);
ZERO_ARGS(SuperNET,stop);
HASH_AND_STRING(SuperNET,saveconf,wallethash,confjsonstr);
HASH_ARRAY_STRING(SuperNET,layer,mypriv,otherpubs,str);
STRING_ARG(SuperNET,bitcoinrpc,setcoin);
STRING_ARG(SuperNET,myipaddr,ipaddr);
STRING_ARG(SuperNET,setmyipaddr,ipaddr);
FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase);
ZERO_ARGS(SuperNET,logout);
ZERO_ARGS(SuperNET,activehandle);
THREE_STRINGS(SuperNET,encryptjson,password,permanentfile,payload);
TWO_STRINGS(SuperNET,decryptjson,password,permanentfile);
TWO_STRINGS(SuperNET,html,agentform,htmlfile);
//TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(SuperNET,DHT,hexmsg,destip,categoryhash,subhash,maxdelay,broadcast);
THREE_STRINGS(SuperNET,rosetta,passphrase,pin,showprivkey);
ZERO_ARGS(SuperNET,keypair);
HASH_AND_INT(SuperNET,priv2pub,privkey,addrtype);
STRING_ARG(SuperNET,wif2priv,wif);
STRING_ARG(SuperNET,priv2wif,priv);
STRING_ARG(SuperNET,addr2rmd160,address);
STRING_ARG(SuperNET,rmd160conv,rmd160);
TWOHASHES_AND_STRING(SuperNET,cipher,privkey,destpubkey,message);
TWOHASHES_AND_STRING(SuperNET,decipher,privkey,srcpubkey,cipherstr);
STRING_ARG(SuperNET,broadcastcipher,message);
STRING_ARG(SuperNET,broadcastdecipher,message);
HASH_AND_STRING(SuperNET,multicastcipher,pubkey,message);
HASH_AND_STRING(SuperNET,multicastdecipher,privkey,cipherstr);
/*TWO_STRINGS(SuperNET,subscribe,category,subcategory);
TWO_STRINGS(SuperNET,gethexmsg,category,subcategory);
THREE_STRINGS(SuperNET,posthexmsg,category,subcategory,hexmsg);
THREE_STRINGS(SuperNET,announce,category,subcategory,message);
THREE_STRINGS(SuperNET,survey,category,subcategory,message);
TWO_STRINGS(SuperNET,categoryhashes,category,subcategory);*/
STRING_AND_TWOINTS(mouse,image,name,x,y);
STRING_AND_TWOINTS(mouse,change,name,x,y);
STRING_AND_TWOINTS(mouse,click,name,x,y);
STRING_ARG(mouse,close,name);
STRING_ARG(mouse,leave,name);
STRING_AND_INT(keyboard,key,name,c);
STRING_ARG(hash,hex,message);
STRING_ARG(hash,unhex,hexmsg);
TWO_HASHES(hash,curve25519_pair,element,scalar);
STRING_ARG(hash,NXT,passphrase);
STRING_ARG(hash,curve25519,pubkey);
STRING_ARG(hash,crc32,message);
STRING_ARG(hash,base64_encode,message);
STRING_ARG(hash,base64_decode,message);
STRING_ARG(hash,rmd160_sha256,message);
STRING_ARG(hash,sha256_sha256,message);
STRING_ARG(hash,sha224,message);
STRING_ARG(hash,sha256,message);
STRING_ARG(hash,sha384,message);
STRING_ARG(hash,sha512,message);
STRING_ARG(hash,rmd128,message);
STRING_ARG(hash,rmd160,message);
STRING_ARG(hash,rmd256,message);
STRING_ARG(hash,rmd320,message);
STRING_ARG(hash,sha1,message);
STRING_ARG(hash,md2,message);
STRING_ARG(hash,md4,message);
STRING_ARG(hash,md5,message);
STRING_ARG(hash,tiger192_3,message);
STRING_ARG(hash,whirlpool,message);
TWO_STRINGS(hmac,sha224,message,passphrase);
TWO_STRINGS(hmac,sha256,message,passphrase);
TWO_STRINGS(hmac,sha384,message,passphrase);
TWO_STRINGS(hmac,sha512,message,passphrase);
TWO_STRINGS(hmac,rmd128,message,passphrase);
TWO_STRINGS(hmac,rmd160,message,passphrase);
TWO_STRINGS(hmac,rmd256,message,passphrase);
TWO_STRINGS(hmac,rmd320,message,passphrase);
TWO_STRINGS(hmac,sha1,message,passphrase);
TWO_STRINGS(hmac,md2,message,passphrase);
TWO_STRINGS(hmac,md4,message,passphrase);
TWO_STRINGS(hmac,md5,message,passphrase);
TWO_STRINGS(hmac,tiger192_3,message,passphrase);
TWO_STRINGS(hmac,whirlpool,message,passphrase);

48
includes/iguana_apideclares.h

@ -21,9 +21,12 @@ ZERO_ARGS(dpow,cancelratify);
STRING_ARG(dpow,bindaddr,ipaddr);
STRING_AND_INT(dpow,fundnotaries,symbol,numblocks);
ZERO_ARGS(pax,start);
INT_ARG(passthru,paxfiats,mask);
TWO_STRINGS(zcash,passthru,function,hex);
TWO_STRINGS(komodo,passthru,function,hex);
TWO_STRINGS(dex,kvsearch,symbol,key);
THREE_STRINGS_AND_THREE_INTS(dex,kvupdate,symbol,key,value,flags,unused,unusedb);
TWO_STRINGS(dex,send,hex,handler);
HASH_AND_STRING(dex,gettransaction,txid,symbol);
@ -40,8 +43,6 @@ TWO_STRINGS(dex,validateaddress,symbol,address);
TWO_STRINGS(dex,checkaddress,symbol,address);
TWO_STRINGS(dex,listunspent,symbol,address);
TWO_STRINGS_AND_TWO_DOUBLES(dex,listtransactions,symbol,address,count,skip);
TWO_STRINGS(dex,kvsearch,symbol,key);
THREE_STRINGS_AND_THREE_INTS(dex,kvupdate,symbol,key,value,flags,unused,unusedb);
TWO_STRINGS(dex,listunspent2,symbol,address);
TWO_STRINGS_AND_TWO_DOUBLES(dex,listtransactions2,symbol,address,count,skip);
HASH_AND_STRING_AND_INT(dex,gettxin,txid,symbol,vout);
@ -49,27 +50,6 @@ TWO_STRINGS(dex,listspent,symbol,address);
TWO_STRINGS(dex,getbalance,symbol,address);
STRING_ARG(dex,explorer,symbol);
TWO_STRINGS(zcash,passthru,function,hex);
TWO_STRINGS(komodo,passthru,function,hex);
ZERO_ARGS(pax,start);
HASH_ARRAY_STRING(tradebot,liquidity,hash,vals,targetcoin);
ZERO_ARGS(tradebot,amlp);
ZERO_ARGS(tradebot,notlp);
TWO_STRINGS(tradebot,gensvm,base,rel);
ZERO_ARGS(tradebot,openliquidity);
ZERO_ARGS(InstantDEX,allcoins);
STRING_ARG(InstantDEX,available,source);
HASH_ARRAY_STRING(InstantDEX,request,hash,vals,hexstr);
INT_ARG(InstantDEX,incoming,requestid);
INT_ARG(InstantDEX,automatched,requestid);
TWO_INTS(InstantDEX,accept,requestid,quoteid);
//TWO_INTS(InstantDEX,swapstatus,requestid,quoteid);
HASH_ARRAY_STRING(basilisk,genesis_opreturn,hash,vals,hexstr);
HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr);
INT_ARG(basilisk,paxfiats,mask);
@ -174,7 +154,6 @@ ZERO_ARGS(bitcoinrpc,gettxoutsetinfo);
ZERO_ARGS(bitcoinrpc,getrawchangeaddress);
SS_D_I_S(bitcoinrpc,move,fromaccount,toaccount,amount,minconf,comment);
THREE_INTS(iguana,splitfunds,satoshis,duplicates,sendflag);
ZERO_ARGS(iguana,makekeypair);
INT_AND_ARRAY(iguana,rates,unused,quotes);
@ -207,6 +186,13 @@ STRING_AND_INT(iguana,bundlehashes,activecoin,height);
STRING_AND_INT(iguana,PoSweights,activecoin,height);
STRING_ARG(iguana,stakers,activecoin);
ZERO_ARGS(InstantDEX,allcoins);
STRING_ARG(InstantDEX,available,source);
HASH_ARRAY_STRING(InstantDEX,request,hash,vals,hexstr);
INT_ARG(InstantDEX,incoming,requestid);
INT_ARG(InstantDEX,automatched,requestid);
TWO_INTS(InstantDEX,accept,requestid,quoteid);
//TWO_INTS(InstantDEX,swapstatus,requestid,quoteid);
//TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,minaccept,base,rel,minprice,basevolume);
//TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,maxaccept,base,rel,maxprice,basevolume);
THREE_STRINGS_AND_THREE_DOUBLES(InstantDEX,buy,exchange,base,rel,price,volume,dotrade);
@ -219,7 +205,6 @@ TWO_STRINGS(InstantDEX,orderstatus,exchange,orderid);
TWO_STRINGS(InstantDEX,cancelorder,exchange,orderid);
STRING_ARG(InstantDEX,openorders,exchange);
STRING_ARG(InstantDEX,tradehistory,exchange);
THREE_STRINGS_AND_THREE_INTS(InstantDEX,orderbook,exchange,base,rel,depth,allfields,ignore);
STRING_AND_INT(InstantDEX,pollgap,exchange,pollgap);
//TWO_STRINGS(InstantDEX,events,base,rel);
@ -234,6 +219,11 @@ THREE_STRINGS(InstantDEX,supports,exchange,base,rel);
//TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(InstantDEX,accept,reference,message,basetxid,reltxid,duration,flags);
//TWOSTRINGS_AND_TWOHASHES_AND_TWOINTS(InstantDEX,confirm,reference,message,basetxid,reltxid,baseheight,relheight);
HASH_ARRAY_STRING(tradebot,liquidity,hash,vals,targetcoin);
STRING_ARG(tradebot,amlp,blocktrail);
ZERO_ARGS(tradebot,notlp);
TWO_STRINGS(tradebot,gensvm,base,rel);
ZERO_ARGS(tradebot,openliquidity);
THREE_STRINGS_AND_DOUBLE(tradebot,aveprice,comment,base,rel,basevolume);
THREE_STRINGS_AND_DOUBLE(tradebot,monitor,exchange,base,rel,commission);
STRING_AND_DOUBLE(tradebot,monitorall,exchange,commission);
@ -245,6 +235,10 @@ TWO_STRINGS(tradebot,status,exchange,botid);
TWO_STRINGS(tradebot,pause,exchange,botid);
TWO_STRINGS(tradebot,stop,exchange,botid);
TWO_STRINGS(tradebot,resume,exchange,botid);
ZERO_ARGS(tradebot,allbalances);
ZERO_ARGS(tradebot,anchor);
ZERO_ARGS(tradebot,portfolio);
ARRAY_OBJ_INT(tradebot,goals,currencies,vals,targettime);
#ifndef WIN32
/*HASH_ARG(pangea,call,tablehash);

1
includes/iguana_funcs.h

@ -641,6 +641,7 @@ void iguana_fixsecp(struct supernet_info *myinfo);
int32_t bitcoin_timelockspend(uint8_t *script,int32_t n,uint8_t rmd160[20],uint32_t timestamp);
char *iguana_calcutxorawtx(struct supernet_info *myinfo,struct iguana_info *coin,cJSON **vinsp,cJSON *txobj,int64_t satoshis,char *changeaddr,int64_t txfee,cJSON *utxos,char *remoteaddr,struct vin_info *V,int32_t maxmode);
uint64_t _iguana_interest(uint32_t now,int32_t height,uint32_t txlocktime,uint64_t value);
#include "../includes/iguana_api.h"

2
includes/iguana_globals.h

@ -64,7 +64,7 @@ CONDEXTERN int32_t Showmode,Autofold,PANGEA_MAXTHREADS,QUEUEITEMS;
CONDEXTERN struct gecko_chain *Categories;
//CONDEXTERN struct iguana_info *Allcoins;
CONDEXTERN char Userhome[512];
CONDEXTERN int32_t USE_JAY,FIRST_EXTERNAL,IGUANA_disableNXT,Debuglevel,IGUANA_BIGENDIAN;
CONDEXTERN int32_t FIRST_EXTERNAL,IGUANA_disableNXT,Debuglevel,IGUANA_BIGENDIAN;
CONDEXTERN uint32_t prices777_NXTBLOCK;
CONDEXTERN queue_t helperQ,JSON_Q,FINISHED_Q,bundlesQ,emitQ;
CONDEXTERN struct supernet_info MYINFO,**MYINFOS;

Loading…
Cancel
Save