diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index d93406d26..094c8e5de 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -993,6 +993,7 @@ void basilisks_init(struct supernet_info *myinfo) portable_mutex_init(&myinfo->bu_mutex); portable_mutex_init(&myinfo->allcoins_mutex); portable_mutex_init(&myinfo->basilisk_mutex); + portable_mutex_init(&myinfo->smart_mutex); portable_mutex_init(&myinfo->DEX_mutex); portable_mutex_init(&myinfo->DEX_swapmutex); portable_mutex_init(&myinfo->DEX_reqmutex); @@ -1363,7 +1364,7 @@ STRING_ARG(jumblr,setpassphrase,passphrase) retjson = cJSON_CreateObject(); jaddstr(retjson,"result","success"); privkey = jumblr_privkey(myinfo,BTCaddr,0,KMDaddr,JUMBLR_DEPOSITPREFIX); - smartaddress_add(myinfo,privkey,"deposit"); + smartaddress_add(myinfo,privkey,"deposit",0.,0.); myinfo->jumblr_depositkey = curve25519(privkey,curve25519_basepoint9()); bitcoin_priv2wif(wifstr,privkey,coin->chain->wiftype); if ( coin->FULLNODE < 0 ) @@ -1378,7 +1379,7 @@ STRING_ARG(jumblr,setpassphrase,passphrase) jaddnum(retjson,"BTCdeposits",dstr(jumblr_balance(myinfo,coinbtc,BTCaddr))); } privkey = jumblr_privkey(myinfo,BTCaddr,0,KMDaddr,""); - smartaddress_add(myinfo,privkey,"jumblr"); + smartaddress_add(myinfo,privkey,"jumblr",0.,0.); myinfo->jumblr_pubkey = curve25519(privkey,curve25519_basepoint9()); jaddstr(retjson,"KMDjumblr",KMDaddr); jaddstr(retjson,"BTCjumblr",BTCaddr); diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index c7bc89b7c..fd047148a 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -239,14 +239,14 @@ int32_t basilisk_request_create(struct basilisk_request *rp,cJSON *valsobj,bits2 char *basilisk_start(struct supernet_info *myinfo,bits256 privkey,struct basilisk_request *_rp,uint32_t statebits,int32_t optionduration) { - cJSON *retjson; bits256 tmpprivkey; struct basilisk_request *rp=0; int32_t i,srcmatch,destmatch; + cJSON *retjson; char typestr[64]; bits256 tmpprivkey; double bidasks[2]; struct basilisk_request *rp=0; int32_t i,srcmatch,destmatch; if ( _rp->requestid == myinfo->lastdexrequestid ) { //printf("filter duplicate r%u\n",_rp->requestid); return(clonestr("{\"error\":\"filter duplicate requestid\"}")); } - srcmatch = smartaddress_pubkey(myinfo,&tmpprivkey,_rp->src,_rp->srchash) >= 0; - destmatch = smartaddress_pubkey(myinfo,&tmpprivkey,_rp->dest,_rp->desthash) >= 0; + srcmatch = smartaddress_pubkey(myinfo,typestr,bidasks,&tmpprivkey,_rp->src,_rp->srchash) >= 0; + destmatch = smartaddress_pubkey(myinfo,typestr,bidasks,&tmpprivkey,_rp->dest,_rp->desthash) >= 0; if ( srcmatch != 0 || destmatch != 0 ) { for (i=0; inumswaps; i++) @@ -284,7 +284,7 @@ char *basilisk_start(struct supernet_info *myinfo,bits256 privkey,struct basilis int32_t basilisk_requests_poll(struct supernet_info *myinfo) { static uint32_t lastpoll; - char *retstr; uint8_t data[32768]; cJSON *outerarray,*retjson; uint32_t msgid,channel; int32_t datalen,i,n,retval = 0; struct basilisk_request issueR; bits256 privkey; double hwm = 0.; + char *retstr,typestr[64]; uint8_t data[32768]; cJSON *outerarray,*retjson; uint32_t msgid,channel; int32_t datalen,i,n,retval = 0; struct basilisk_request issueR; bits256 privkey; double bidasks[2],hwm = 0.; if ( myinfo->IAMNOTARY != 0 || time(NULL) < lastpoll+20 || (myinfo->IAMLP == 0 && myinfo->DEXactive < time(NULL)) ) return(retval); lastpoll = (uint32_t)time(NULL); @@ -310,7 +310,7 @@ int32_t basilisk_requests_poll(struct supernet_info *myinfo) if ( hwm > 0. ) { myinfo->DEXaccept = issueR; - if ( smartaddress_pubkey(myinfo,&privkey,issueR.src,issueR.srchash) >= 0 ) + if ( smartaddress_pubkey(myinfo,typestr,bidasks,&privkey,issueR.src,issueR.srchash) >= 0 ) { printf("matched dex_smartpubkey\n"); dex_channelsend(myinfo,issueR.srchash,issueR.desthash,channel,0x4000000,(void *)&issueR.requestid,sizeof(issueR.requestid)); // 60 diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index 359ebbe12..2111a910a 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -470,7 +470,7 @@ int32_t basilisk_rawtx_sign(struct supernet_info *myinfo,int32_t height,struct b cJSON *basilisk_privkeyarray(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins) { - cJSON *privkeyarray,*item,*sobj; struct iguana_waddress *waddr; struct iguana_waccount *wacct; char coinaddr[64],account[128],wifstr[64],str[65],*hexstr; uint8_t script[1024]; int32_t i,n,len,vout; bits256 txid,privkey; + cJSON *privkeyarray,*item,*sobj; struct iguana_waddress *waddr; struct iguana_waccount *wacct; char coinaddr[64],account[128],wifstr[64],str[65],typestr[64],*hexstr; uint8_t script[1024]; int32_t i,n,len,vout; bits256 txid,privkey; double bidasks[2]; privkeyarray = cJSON_CreateArray(); //printf("%s persistent.(%s) (%s) change.(%s) scriptstr.(%s)\n",coin->symbol,myinfo->myaddr.BTC,coinaddr,coin->changeaddr,scriptstr); if ( (n= cJSON_GetArraySize(vins)) > 0 ) @@ -500,7 +500,7 @@ cJSON *basilisk_privkeyarray(struct supernet_info *myinfo,struct iguana_info *co bitcoin_priv2wif(wifstr,waddr->privkey,coin->chain->wiftype); jaddistr(privkeyarray,waddr->wifstr); } - else if ( smartaddress(myinfo,&privkey,coin->symbol,coinaddr) >= 0 ) + else if ( smartaddress(myinfo,typestr,bidasks,&privkey,coin->symbol,coinaddr) >= 0 ) { bitcoin_priv2wif(wifstr,privkey,coin->chain->wiftype); jaddistr(privkeyarray,wifstr); diff --git a/basilisk/basilisk_tradebot.c b/basilisk/basilisk_tradebot.c index b0156a779..481640038 100755 --- a/basilisk/basilisk_tradebot.c +++ b/basilisk/basilisk_tradebot.c @@ -281,7 +281,7 @@ int32_t basilisk_request_cmpref(struct basilisk_request *ref,struct basilisk_req double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk_request *issueR,struct basilisk_request *list,int32_t n) { - int32_t i,noquoteflag=0,havequoteflag=0,myrequest=0,maxi=-1; int64_t balance=0,destamount,minamount = 0,maxamount = 0; bits256 privkey; uint32_t pendingid=0; struct basilisk_swap *active; double metric = 0.; + int32_t i,noquoteflag=0,havequoteflag=0,myrequest=0,maxi=-1; int64_t balance=0,destamount,minamount = 0,maxamount = 0; bits256 privkey; uint32_t pendingid=0; struct basilisk_swap *active; double metric = 0.,bidasks[2]; char typestr[64]; memset(issueR,0,sizeof(*issueR)); minamount = list[0].minamount; //printf("need to verify null quoteid is list[0] requestid.%u quoteid.%u\n",list[0].requestid,list[0].quoteid); @@ -291,7 +291,7 @@ double basilisk_request_listprocess(struct supernet_info *myinfo,struct basilisk return(0.); pendingid = active->I.req.quoteid; } - if ( smartaddress_pubkey(myinfo,&privkey,list[0].src,list[0].srchash) >= 0 ) + if ( smartaddress_pubkey(myinfo,typestr,bidasks,&privkey,list[0].src,list[0].srchash) >= 0 ) myrequest = 1; for (i=0; i= 0 ) + if ( smartaddress_pubkey(myinfo,typestr,bidasks,&privkey,list[i].dest,list[i].desthash) >= 0 ) myrequest |= 2; havequoteflag++; if ( pendingid == 0 ) diff --git a/basilisk/smartaddress.c b/basilisk/smartaddress.c index e198bba7a..258419a43 100755 --- a/basilisk/smartaddress.c +++ b/basilisk/smartaddress.c @@ -51,38 +51,44 @@ bits256 jumblr_privkey(struct supernet_info *myinfo,char *coinaddr,uint8_t pubty cJSON *smartaddress_json(struct smartaddress *ap) { - char coinaddr[64],*symbol; int32_t j,n; struct iguana_info *coin; cJSON *item = cJSON_CreateObject(); + char coinaddr[64],*symbol; int32_t j,n; struct iguana_info *coin; cJSON *array,*ritem,*item,*retjson = cJSON_CreateObject(); bitcoin_address(coinaddr,60,ap->pubkey33,33); - jaddstr(item,"KMD",coinaddr); + jaddstr(retjson,"KMD",coinaddr); bitcoin_address(coinaddr,0,ap->pubkey33,33); - jaddstr(item,"BTC",coinaddr); + jaddstr(retjson,"BTC",coinaddr); if ( ap->typejson != 0 ) { - jadd(item,"type",ap->typejson); - if ( (n= cJSON_GetArraySize(ap->typejson)) > 1 ) + //jadd(item,"type",ap->typejson); + array = cJSON_CreateArray(); + if ( (n= cJSON_GetArraySize(ap->typejson)) > 0 ) { + jadd(retjson,"type",jitem(ap->typejson,0)); for (j=1; jtypejson,j)) != 0 ) + item = jitem(ap->typejson,j); + if ( (symbol= jstr(item,"s")) != 0 ) { - if ( strcmp(symbol,"KMD") != 0 && strcmp(symbol,"BTC") != 0 ) + if ( (coin= iguana_coinfind(symbol)) != 0 ) { - if ( (coin= iguana_coinfind(symbol)) != 0 ) - { - bitcoin_address(coinaddr,coin->chain->pubtype,ap->pubkey33,33); - jaddstr(item,symbol,coinaddr); - } + bitcoin_address(coinaddr,coin->chain->pubtype,ap->pubkey33,33); + ritem = cJSON_CreateObject(); + jaddstr(ritem,"coin",symbol); + jaddstr(ritem,"address",coinaddr); + jaddnum(ritem,"maxbid",jdouble(item,"b")); + jaddnum(ritem,"minask",jdouble(item,"a")); + jaddi(array,ritem); } } } } + jadd(retjson,"coins",array); } - return(item); + return(retjson); } -int32_t smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *symbol) +int32_t _smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *symbol,double maxbid,double minask) { - char coinaddr[64]; uint8_t addrtype,rmd160[20]; struct smartaddress *ap; int32_t i,j,n; + char coinaddr[64],*jsym; uint8_t addrtype,rmd160[20]; cJSON *item; struct smartaddress *ap; int32_t i,j,n; if ( myinfo->numsmartaddrs < sizeof(myinfo->smartaddrs)/sizeof(*myinfo->smartaddrs) ) { for (i=0; inumsmartaddrs; i++) @@ -96,8 +102,24 @@ int32_t smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *symb n = cJSON_GetArraySize(ap->typejson); for (j=0; jtypejson,j),symbol) == 0 ) + item = jitem(ap->typejson,j); + jsym = jstr(item,"s"); + if ( jsym != 0 && strcmp(jsym,symbol) == 0 ) + { + if ( maxbid != 0. ) + { + if ( jobj(item,"b") != 0 ) + jdelete(item,"b"); + jaddnum(item,"b",maxbid); + } + if ( minask != 0. ) + { + if ( jobj(item,"a") != 0 ) + jdelete(item,"a"); + jaddnum(item,"a",minask); + } return(0); + } } } jaddistr(ap->typejson,symbol); @@ -107,9 +129,9 @@ int32_t smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *symb ap->typejson = cJSON_CreateArray(); if ( smartaddress_type(symbol) < 0 ) return(-1); - jaddistr(ap->typejson,symbol); - jaddistr(ap->typejson,"KMD"); - jaddistr(ap->typejson,"BTC"); + item = cJSON_CreateObject(), jaddstr(item,"type",symbol), jaddi(ap->typejson,item); + item = cJSON_CreateObject(), jaddstr(item,"s","KMD"), jaddi(ap->typejson,item); + item = cJSON_CreateObject(), jaddstr(item,"s","BTC"), jaddi(ap->typejson,item); ap->privkey = privkey; bitcoin_pubkey33(myinfo->ctx,ap->pubkey33,privkey); calc_rmd160_sha256(ap->rmd160,ap->pubkey33,33); @@ -128,70 +150,100 @@ int32_t smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *symb return(-1); } -int32_t smartaddress_symbolmatch(struct smartaddress *ap,char *symbol) +int32_t smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *symbol,double maxbid,double minask) +{ + int32_t retval; + portable_mutex_lock(&myinfo->smart_mutex); + retval = _smartaddress_add(myinfo,privkey,symbol,maxbid,minask); + portable_mutex_unlock(&myinfo->smart_mutex); + return(retval); +} + +int32_t smartaddress_symbolmatch(char *typestr,double *bidaskp,struct smartaddress *ap,char *symbol) { - int32_t j,n; + int32_t j,n; char *str; cJSON *item; if ( ap->typejson != 0 && (n= cJSON_GetArraySize(ap->typejson)) > 0 ) { - for (j=0; jtypejson,0); + if ( (str= jstr(item,"type")) != 0 ) + strncpy(typestr,str,63); + else typestr[0] = 0; + for (j=1; jtypejson,j),symbol) == 0 ) + item = jitem(ap->typejson,j); + str = jstr(item,"s"); + if ( str != 0 && strcmp(str,symbol) == 0 ) + { + bidaskp[0] = jdouble(item,"b"); + bidaskp[1] = jdouble(item,"a"); return(j); + } } } return(-1); } -int32_t smartaddress(struct supernet_info *myinfo,bits256 *privkeyp,char *symbol,char *coinaddr) +int32_t smartaddress(struct supernet_info *myinfo,char *typestr,double *bidaskp,bits256 *privkeyp,char *symbol,char *coinaddr) { - int32_t i,j; uint8_t addrtype,rmd160[20]; struct smartaddress *ap; + int32_t i,j,retval = -1; uint8_t addrtype,rmd160[20]; struct smartaddress *ap; memset(privkeyp,0,sizeof(*privkeyp)); + memset(bidaskp,0,sizeof(*bidaskp) * 2); bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr); + portable_mutex_lock(&myinfo->smart_mutex); for (i=0; inumsmartaddrs; i++) if ( memcmp(myinfo->smartaddrs[i].rmd160,rmd160,20) == 0 ) { ap = &myinfo->smartaddrs[i]; *privkeyp = ap->privkey; - if ( (j= smartaddress_symbolmatch(ap,symbol)) >= 0 ) - return(0); - return(i+1); + if ( (j= smartaddress_symbolmatch(typestr,bidaskp,ap,symbol)) >= 0 ) + retval = 0; + else retval = (i+1); + break; } + portable_mutex_unlock(&myinfo->smart_mutex); for (i=0; i<20; i++) printf("%02x",rmd160[i]); printf(" <- rmd160 smartaddress cant find (%s) of %d\n",coinaddr,myinfo->numsmartaddrs); - return(-1); + return(retval); } -int32_t smartaddress_pubkey(struct supernet_info *myinfo,bits256 *privkeyp,char *symbol,bits256 pubkey) +int32_t smartaddress_pubkey(struct supernet_info *myinfo,char *typestr,double *bidaskp,bits256 *privkeyp,char *symbol,bits256 pubkey) { - int32_t i,j; struct smartaddress *ap; + int32_t i,j,retval = -1; struct smartaddress *ap; memset(privkeyp,0,sizeof(*privkeyp)); + memset(bidaskp,0,sizeof(*bidaskp) * 2); + portable_mutex_lock(&myinfo->smart_mutex); for (i=0; inumsmartaddrs; i++) if ( bits256_cmp(myinfo->smartaddrs[i].pubkey,pubkey) == 0 ) { ap = &myinfo->smartaddrs[i]; - *privkeyp = ap->privkey; - if ( (j= smartaddress_symbolmatch(ap,symbol)) >= 0 ) - return(0); - return(i+1); + if ( (j= smartaddress_symbolmatch(typestr,bidaskp,ap,symbol)) >= 0 ) + retval = 0; + else retval = (i+1); + break; } - return(-1); + portable_mutex_unlock(&myinfo->smart_mutex); + return(retval); } -int32_t smartaddress_pubkey33(struct supernet_info *myinfo,bits256 *privkeyp,char *symbol,uint8_t *pubkey33) +int32_t smartaddress_pubkey33(struct supernet_info *myinfo,char *typestr,double *bidaskp,bits256 *privkeyp,char *symbol,uint8_t *pubkey33) { - int32_t i,j; struct smartaddress *ap; + int32_t i,j,retval = -1; struct smartaddress *ap; memset(privkeyp,0,sizeof(*privkeyp)); + memset(bidaskp,0,sizeof(*bidaskp) * 2); + portable_mutex_lock(&myinfo->smart_mutex); for (i=0; inumsmartaddrs; i++) if ( memcmp(myinfo->smartaddrs[i].pubkey33,pubkey33,33) == 0 ) { ap = &myinfo->smartaddrs[i]; *privkeyp = ap->privkey; - if ( (j= smartaddress_symbolmatch(ap,symbol)) >= 0 ) - return(0); - return(i+1); + if ( (j= smartaddress_symbolmatch(typestr,bidaskp,ap,symbol)) >= 0 ) + retval = 0; + else retval = (i+1); + break; } - return(-1); + portable_mutex_unlock(&myinfo->smart_mutex); + return(retval); } #include "../includes/iguana_apidefs.h" @@ -201,21 +253,23 @@ int32_t smartaddress_pubkey33(struct supernet_info *myinfo,bits256 *privkeyp,cha ZERO_ARGS(InstantDEX,smartaddresses) { int32_t i; cJSON *retjson = cJSON_CreateArray(); + portable_mutex_lock(&myinfo->smart_mutex); for (i=0; inumsmartaddrs; i++) jaddi(retjson,smartaddress_json(&myinfo->smartaddrs[i])); + portable_mutex_unlock(&myinfo->smart_mutex); return(jprint(retjson,1)); } -TWO_STRINGS(InstantDEX,smartaddress,type,symbol) +TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,smartaddress,type,symbol,maxbid,minask) { - char prefix[64],coinaddr[64],KMDaddr[64]; uint8_t pubkey33[33]; bits256 privkey; + char prefix[64],coinaddr[64],KMDaddr[64],typestr[64]; double bidask[2]; uint8_t pubkey33[33]; bits256 privkey; if ( smartaddress_type(type) < 0 ) return(clonestr("{\"error\":\"non-supported smartaddress type\"}")); if ( iguana_coinfind(symbol) == 0 ) return(clonestr("{\"error\":\"non-supported smartaddress symbol\"}")); if ( strcmp(type,"deposit") == 0 || strcmp(type,"jumblr") == 0 ) { - if ( smartaddress_pubkey(myinfo,&privkey,symbol,strcmp(type,"deposit") == 0 ? myinfo->jumblr_depositkey : myinfo->jumblr_pubkey) < 0 ) + if ( smartaddress_pubkey(myinfo,typestr,bidask,&privkey,symbol,strcmp(type,"deposit") == 0 ? myinfo->jumblr_depositkey : myinfo->jumblr_pubkey) < 0 ) return(clonestr("{\"error\":\"unexpected missing smartaddress deposit/jumblr\"}")); } else @@ -231,7 +285,7 @@ TWO_STRINGS(InstantDEX,smartaddress,type,symbol) return(clonestr("{\"error\":\"non-supported smartaddress symbol\"}")); bitcoin_pubkey33(myinfo->ctx,pubkey33,privkey); bitcoin_address(coinaddr,coin->chain->pubtype,pubkey33,33); - smartaddress_add(myinfo,privkey,symbol); + smartaddress_add(myinfo,privkey,symbol,maxbid,minask); return(InstantDEX_smartaddresses(myinfo,0,0,0)); } diff --git a/iguana/iguana777.h b/iguana/iguana777.h index a54d55cd6..ddcac1286 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -142,7 +142,7 @@ struct supernet_info struct exchange_info *tradingexchanges[SUPERNET_MAXEXCHANGES]; int32_t numexchanges; struct iguana_waccount *wallet; struct iguana_info *allcoins; int32_t allcoins_being_added,allcoins_numvirts; - portable_mutex_t bu_mutex,allcoins_mutex,gecko_mutex,basilisk_mutex,DEX_mutex,DEX_reqmutex,DEX_swapmutex; + portable_mutex_t bu_mutex,allcoins_mutex,gecko_mutex,basilisk_mutex,DEX_mutex,DEX_reqmutex,DEX_swapmutex,smart_mutex; struct queueitem *DEX_quotes; cJSON *Cunspents,*Cspends; struct basilisk_swap *swaps[256]; int32_t numswaps; struct basilisk_message *messagetable; portable_mutex_t messagemutex; queue_t msgQ,p2pQ; diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 1f3797e94..d6189ebb0 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -1377,8 +1377,8 @@ TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout) sprintf(jumblr_passphrase,"jumblr %s",password); if ( (jumblrstr= jumblr_setpassphrase(myinfo,0,0,0,jumblr_passphrase)) != 0 ) free(jumblrstr); - smartaddress_add(myinfo,myinfo->persistent_priv,"kmd"); - smartaddress_add(myinfo,myinfo->persistent_priv,"btc"); + smartaddress_add(myinfo,myinfo->persistent_priv,"kmd",0.,0.); + smartaddress_add(myinfo,myinfo->persistent_priv,"btc",0.,0.); } //basilisk_unspents_update(myinfo,coin); return(retstr); diff --git a/iguana/tests/smartadd b/iguana/tests/smartadd new file mode 100755 index 000000000..d39448cde --- /dev/null +++ b/iguana/tests/smartadd @@ -0,0 +1,3 @@ +#!/bin/bash +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"smartaddress\",\"type\":\"coin\",\"symbol\":\"coin\"}" # first time +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"smartaddress\",\"type\":\"coin\",\"symbol\":\"OTHER\",\"maxbid\":0.0002,\"minask\":0.0001}" diff --git a/iguana/tests/smartaddresses b/iguana/tests/smartaddresses new file mode 100755 index 000000000..fbcccbf57 --- /dev/null +++ b/iguana/tests/smartaddresses @@ -0,0 +1,2 @@ +#!/bin/bash +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"smartaddresses\"}" diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index cfe35a6df..161173081 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -227,7 +227,7 @@ THREE_STRINGS(InstantDEX,supports,exchange,base,rel); ZERO_ARGS(InstantDEX,init); ZERO_ARGS(InstantDEX,getswaplist); ZERO_ARGS(InstantDEX,smartaddresses); -TWO_STRINGS(InstantDEX,smartaddress,type,symbol); +TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,smartaddress,type,symbol,maxbid,minask); //THREE_STRINGS(atomic,approve,myorderid,otherid,txname); //THREE_STRINGS(atomic,claim,myorderid,otherid,txname); diff --git a/includes/iguana_funcs.h b/includes/iguana_funcs.h index 0b18bdbe3..9a1469933 100755 --- a/includes/iguana_funcs.h +++ b/includes/iguana_funcs.h @@ -606,10 +606,10 @@ void dpow_nanomsginit(struct supernet_info *myinfo,char *ipaddr); int32_t iguana_datachain_scan(struct supernet_info *myinfo,struct iguana_info *coin,uint8_t rmd160[20]); int32_t basilisk_requests_poll(struct supernet_info *myinfo); void dpow_psockloop(void *_ptr); -int32_t smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *typestr); -int32_t smartaddress(struct supernet_info *myinfo,bits256 *privkeyp,char *symbol,char *coinaddr); -int32_t smartaddress_pubkey(struct supernet_info *myinfo,bits256 *privkeyp,char *symbol,bits256 pubkey); -int32_t smartaddress_pubkey33(struct supernet_info *myinfo,bits256 *privkeyp,char *symbol,uint8_t *pubkey33); +int32_t smartaddress_add(struct supernet_info *myinfo,bits256 privkey,char *typestr,double maxbid,double minask); +int32_t smartaddress(struct supernet_info *myinfo,char *typestr,double *bidaskp,bits256 *privkeyp,char *symbol,char *coinaddr); +int32_t smartaddress_pubkey(struct supernet_info *myinfo,char *typestr,double *bidaskp,bits256 *privkeyp,char *symbol,bits256 pubkey); +int32_t smartaddress_pubkey33(struct supernet_info *myinfo,char *typestr,double *bidaskp,bits256 *privkeyp,char *symbol,uint8_t *pubkey33); void iguana_RTreset(struct iguana_info *coin); void iguana_RTpurge(struct iguana_info *coin,int32_t lastheight);