diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index d79b3b5ce..cf4b2e548 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -81,7 +81,7 @@ cJSON *instantdex_defaultprocess(struct supernet_info *myinfo,struct exchange_in } return(newjson); } - +//({"agent":"iguana","method":"addcoin","newcoin":"PPC","active":1,"maxpeers":128,"services":0,"poll":1,"RAM":4,"minoutput":100000,"minconfirms":3,"estblocktime":600,"path":"/data/ppcoin","conf":"/data/.ppcoin","txfee_satoshis":100000,"useaddmultisig":1,"hastimestamp":0,"userhome":"/data/SuperNET/iguana","pubval":"37","scriptval":"75","wiftype":"b7","netmagic":"e6e8e9e5","genesishash":"00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6","genesis":{"hashalgo":"sha256","version":1,"timestamp":1345084287,"nbits":"1d00ffff","nonce":2179302059,"merkleroot":"3c2d8f85fab4d17aac558cc648a1a58acff0de6deb890c29985690052c5993c2"},"p2p":9901,"rpc":9902}) cJSON *instantdex_defaulttimeout(struct supernet_info *myinfo,struct exchange_info *exchange,struct instantdex_accept *A,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) { uint8_t *serdata = *serdatap; int32_t serdatalen = *serdatalenp; @@ -179,6 +179,9 @@ struct instantdex_event *instantdex_addevent(struct instantdex_stateinfo *states } else { + int32_t i; + for (i=0; i %s) without existing state and nextstate\n",statename,nextstatename); exit(-1); return(0); @@ -672,7 +675,7 @@ struct instantdex_accept *instantdex_offerfind(struct supernet_info *myinfo,stru { if ( now < ap->offer.expiration && ap->dead == 0 ) { - //printf("find cmps %d %d %d %d %d %d\n",strcmp(base,"*") == 0,strcmp(base,ap->offer.base) == 0,strcmp(rel,"*") == 0,strcmp(rel,ap->offer.rel) == 0,orderid == 0,orderid == ap->orderid); + printf("%d find cmps %d %d %d %d %d %d me.%llu vs %llu o.%llu\n",ap->offer.expiration-now,strcmp(base,"*") == 0,strcmp(base,ap->offer.base) == 0,strcmp(rel,"*") == 0,strcmp(rel,ap->offer.rel) == 0,orderid == 0,orderid == ap->orderid,(long long)myinfo->myaddr.persistent.txid,(long long)ap->offer.offer64,(long long)ap->orderid); if ( (strcmp(base,"*") == 0 || strcmp(base,ap->offer.base) == 0) && (strcmp(rel,"*") == 0 || strcmp(rel,ap->offer.rel) == 0) && (orderid == 0 || orderid == ap->orderid) ) { if ( requeue == 0 && retap != 0 ) @@ -713,15 +716,15 @@ struct instantdex_accept *instantdex_acceptable(struct supernet_info *myinfo,str minvol = A->offer.basevolume64 * minperc * .01; while ( (ap= queue_dequeue(&exchange->acceptableQ,0)) != 0 && ap != &PAD ) { - //printf("check offerbits.%llu vs %llu: %d %d %d %d %d %d %d %d\n",(long long)offerbits,(long long)ap->offer.offer64,A->offer.basevolume64 > 0.,strcmp(A->offer.base,"*") == 0 ,strcmp(A->offer.base,ap->offer.base) == 0, strcmp(A->offer.rel,"*") == 0 ,strcmp(A->offer.rel,ap->offer.rel) == 0,A->offer.basevolume64 <= (ap->offer.basevolume64 - ap->pendingvolume64),offerdir,instantdex_bidaskdir(ap)); + printf("check offerbits.%llu vs %llu: %d %d %d %d %d %d %d %d\n",(long long)offerbits,(long long)ap->offer.offer64,A->offer.basevolume64 > 0.,strcmp(A->offer.base,"*") == 0 ,strcmp(A->offer.base,ap->offer.base) == 0, strcmp(A->offer.rel,"*") == 0 ,strcmp(A->offer.rel,ap->offer.rel) == 0,A->offer.basevolume64 <= (ap->offer.basevolume64 - ap->pendingvolume64),offerdir,instantdex_bidaskdir(&ap->offer)); if ( now < ap->offer.expiration && ap->dead == 0 && (offerbits == 0 || offerbits != ap->offer.offer64) ) { if ( A->offer.basevolume64 > 0. && (strcmp(A->offer.base,"*") == 0 || strcmp(A->offer.base,ap->offer.base) == 0) && (strcmp(A->offer.rel,"*") == 0 || strcmp(A->offer.rel,ap->offer.rel) == 0) && minvol <= (ap->offer.basevolume64 - ap->pendingvolume64) && offerdir*instantdex_bidaskdir(&ap->offer) < 0 ) { - //printf("aveprice %.8f %.8f offerdir.%d first cmp: %d %d %d\n",aveprice,dstr(ap->offer.price64),offerdir,A->offer.price64 == 0,(offerdir > 0 && ap->offer.price64 >= A->offer.price64),(offerdir < 0 && ap->offer.price64 <= A->offer.price64)); + printf("aveprice %.8f %.8f offerdir.%d first cmp: %d %d %d\n",aveprice,dstr(ap->offer.price64),offerdir,A->offer.price64 == 0,(offerdir > 0 && ap->offer.price64 >= A->offer.price64),(offerdir < 0 && ap->offer.price64 <= A->offer.price64)); if ( offerdir == 0 || A->offer.price64 == 0 || ((offerdir < 0 && ap->offer.price64 >= A->offer.price64) || (offerdir > 0 && ap->offer.price64 <= A->offer.price64)) ) { - //printf("passed second cmp: offerdir.%d best %.8f ap %.8f\n",offerdir,dstr(bestprice64),dstr(ap->offer.price64)); + printf("passed second cmp: offerdir.%d best %.8f ap %.8f\n",offerdir,dstr(bestprice64),dstr(ap->offer.price64)); if ( bestprice64 == 0 || (offerdir < 0 && ap->offer.price64 < bestprice64) || (offerdir > 0 && ap->offer.price64 > bestprice64) ) { printf("found better price %f vs %f\n",dstr(ap->offer.price64),dstr(bestprice64)); @@ -1283,5 +1286,38 @@ TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,minaccept,base,rel,minprice,basevolume) return(instantdex_queueaccept(myinfo,&ap,exchanges777_find("bitcoin"),base,rel,minprice,basevolume,1,base,INSTANTDEX_OFFERDURATION,myinfo->myaddr.nxt64bits,1)); else return(clonestr("{\"error\":\"InstantDEX API request only local usage!\"}")); } + +THREE_STRINGS_AND_DOUBLE(atomic,offer,base,rel,orderid,basevolume) +{ + if ( remoteaddr == 0 ) + { + return(clonestr("{\"result\":\"atomic API request is not yet\"}")); + } else return(clonestr("{\"error\":\"atomic API request only local usage!\"}")); +} + +TWO_STRINGS(atomic,accept,myorderid,otherid) +{ + if ( remoteaddr == 0 ) + { + return(clonestr("{\"result\":\"atomic API request is not yet\"}")); + } else return(clonestr("{\"error\":\"atomic API request only local usage!\"}")); +} + +THREE_STRINGS(atomic,approve,myorderid,otherid,txname) +{ + if ( remoteaddr == 0 ) + { + return(clonestr("{\"result\":\"atomic API request is not yet\"}")); + } else return(clonestr("{\"error\":\"atomic API request only local usage!\"}")); +} + +THREE_STRINGS(atomic,claim,myorderid,otherid,txname) +{ + if ( remoteaddr == 0 ) + { + return(clonestr("{\"result\":\"atomic API request is not yet\"}")); + } else return(clonestr("{\"error\":\"atomic API request only local usage!\"}")); +} + #include "../includes/iguana_apiundefs.h" diff --git a/iguana/main.c b/iguana/main.c index ac96f5876..6261c6a37 100644 --- a/iguana/main.c +++ b/iguana/main.c @@ -193,10 +193,9 @@ int32_t iguana_jsonQ() } if ( (ptr= queue_dequeue(&jsonQ,0)) != 0 ) { - char str[65]; printf("ptr %p %s\n",&ptr->myinfo->privkey,bits256_str(str,ptr->myinfo->privkey)); if ( *ptr->retjsonstrp != 0 && (*ptr->retjsonstrp= SuperNET_jsonstr(ptr->myinfo,ptr->jsonstr,ptr->remoteaddr)) == 0 ) *ptr->retjsonstrp = clonestr("{\"error\":\"null return from iguana_jsonstr\"}"); - //printf("finished.(%s) -> (%s)\n",ptr->jsonstr,*ptr->retjsonstrp!=0?*ptr->retjsonstrp:"null return"); + printf("finished.(%s) -> (%s)\n",ptr->jsonstr,*ptr->retjsonstrp!=0?*ptr->retjsonstrp:"null return"); queue_enqueue("finishedQ",&finishedQ,&ptr->DL,0); return(1); } diff --git a/iguana/swaps/iguana_BTCswap.c b/iguana/swaps/iguana_BTCswap.c index 16ec855f0..d62126216 100755 --- a/iguana/swaps/iguana_BTCswap.c +++ b/iguana/swaps/iguana_BTCswap.c @@ -307,6 +307,14 @@ cJSON *BOB_reclaimfunc(struct supernet_info *myinfo,struct exchange_info *exchan return(newjson); } +cJSON *BOB_feereclaimfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct instantdex_accept *ap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) +{ + *serdatap = 0, *serdatalenp = 0; struct bitcoin_swapinfo *swap = ap->info; + printf("reclaim fee.(%s)\n",swap->deposit); + // reclaim deposit + return(newjson); +} + cJSON *BOB_claimaltfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct instantdex_accept *ap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) { *serdatap = 0, *serdatalenp = 0; struct bitcoin_swapinfo *swap = ap->info; char altcoinaddr[64]; @@ -323,6 +331,22 @@ cJSON *ALICE_reclaimfunc(struct supernet_info *myinfo,struct exchange_info *exch return(newjson); } +cJSON *ALICE_feereclaimfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct instantdex_accept *ap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) +{ + *serdatap = 0, *serdatalenp = 0; struct bitcoin_swapinfo *swap = ap->info; + // reclaim fee + printf("reclaim fee.(%s)\n",swap->myfeetx); + return(newjson); +} + +cJSON *ALICE_claimdepositfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct instantdex_accept *ap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) +{ + *serdatap = 0, *serdatalenp = 0; struct bitcoin_swapinfo *swap = ap->info; + printf("reclaim deposit.(%s)\n",swap->deposit); + // reclaim deposit + return(newjson); +} + cJSON *ALICE_claimbtcfunc(struct supernet_info *myinfo,struct exchange_info *exchange,struct instantdex_accept *ap,cJSON *argjson,cJSON *newjson,uint8_t **serdatap,int32_t *serdatalenp) { *serdatap = 0, *serdatalenp = 0; struct bitcoin_swapinfo *swap = ap->info; @@ -713,47 +737,71 @@ struct instantdex_stateinfo *BTC_initFSM(int32_t *n) { struct instantdex_stateinfo *s = 0; // Four initial states are BOB_sentoffer, ALICE_gotoffer, ALICE_sentoffer, BOB_gotoffer - // the initiator includes signed feetx and deck of INSTANTDEX_DECKSIZE keypairs + // Inconvenient to start statemachines before this as typically after posting something in the orderbook, it is possible for multiple offers to come in. In that case the user or designated tradebot will need to choose among the acceptable offers and also to determine how much longer to wait. Also, an orderbook entry is technically a state, but there is no assurance it will ever proceed beyond the initial state and not just expire. Once an incoming offer is accepted, then the statemachine is created to push the swap toward completion. + + // the initiator includes a deck of INSTANTDEX_DECKSIZE keypairs // - // "BTCabcde are message events from other party (message events capped at length 8) - // "lowercas" are special events, types: , osit, payment, is altcoin claim + // "BTC are message events from other party (message events capped at length 8) + // "" are special events + // types: , osit, payment, is altcoin claim, claim and claim are bob's and alice's reclaiming of their payments, and claim are bob's and alice's reclaim of fee for failed trade, is alice claiming the deposit // "found" means the other party's is confirmed at user specified confidence level + // BTC_cleanup state just unwinds pending swap as nothing has been committed yet // states instantdex_statecreate(s,n,,handlerfunc,errorhandler,, // a given state has a couple of handlers and custom events, with timeouts and errors invoking a bypass + // events instantdex_addevent(s,*n,,,,) *n = 2; s = instantdex_statecreate(s,n,"BTC_cleanup",BTC_cleanupfunc,0,0,0,-1); // from states without any commits memset(s,0,sizeof(*s) * 2); - s = instantdex_statecreate(s,n,"BOB_reclaim",BOB_reclaimfunc,0,0,0,0); // Bob's gets his deposit back - instantdex_addevent(s,*n,"BOB_reclaim","brcfound","poll","BTC_cleanup"); - instantdex_addevent(s,*n,"BOB_reclaim","poll","poll","BOB_reclaim"); - - s = instantdex_statecreate(s,n,"ALICE_reclaim",ALICE_reclaimfunc,0,0,0,0); // Alice retrieves alt payment - instantdex_addevent(s,*n,"ALICE_reclaim","arcfound","poll","BTC_cleanup"); - instantdex_addevent(s,*n,"ALICE_reclaim","poll","poll","ALICE_reclaim"); - - s = instantdex_statecreate(s,n,"ALICE_claimedbtc",ALICE_claimbtcfunc,0,0,0,0); // mainstream cases + // terminal [BLOCKING] states for the corresponding transaction + // if all goes well both alice and bob get to claim the other's payments + s = instantdex_statecreate(s,n,"ALICE_claimedbtc",ALICE_claimbtcfunc,0,0,0,0); instantdex_addevent(s,*n,"ALICE_claimedbtc","aclfound","poll","BTC_cleanup"); instantdex_addevent(s,*n,"ALICE_claimedbtc","poll","poll","ALICE_claimedbtc"); + s = instantdex_statecreate(s,n,"BOB_depclaimed",BOB_reclaimfunc,0,0,0,0); // deposit back + instantdex_addevent(s,*n,"BOB_depclaimed","brefound","poll","BTC_cleanup"); + instantdex_addevent(s,*n,"BOB_depclaimed","poll","poll","BOB_depclaimed"); + s = instantdex_statecreate(s,n,"BOB_claimedalt",BOB_claimaltfunc,0,0,0,0); - instantdex_addevent(s,*n,"BOB_claimedalt","bclfound","poll","BTC_cleanup"); + instantdex_addevent(s,*n,"BOB_claimedalt","bclfound","poll","BOB_depclaimed"); instantdex_addevent(s,*n,"BOB_claimedalt","poll","poll","BOB_claimedalt"); - + + // if things go wrong, bob gets his deposit and fee back + s = instantdex_statecreate(s,n,"BOB_feereclaimed",BOB_feereclaimfunc,0,0,0,0); + instantdex_addevent(s,*n,"BOB_feereclaimed","bfrfound","poll","BTC_cleanup"); + instantdex_addevent(s,*n,"BOB_feereclaimed","poll","poll","BOB_feereclaimed"); + + s = instantdex_statecreate(s,n,"BOB_reclaimed",BOB_reclaimfunc,0,0,0,0); // deposit back + instantdex_addevent(s,*n,"BOB_reclaimed","brefound","poll","BOB_feereclaimed"); + instantdex_addevent(s,*n,"BOB_reclaimed","poll","poll","BOB_reclaimed"); + + // if things go wrong, alice reclaims her altpayment or claims the deposit and then fee + s = instantdex_statecreate(s,n,"ALICE_feereclaimed",ALICE_feereclaimfunc,0,0,0,0); + instantdex_addevent(s,*n,"ALICE_feereclaimed","afrfound","poll","BTC_cleanup"); + instantdex_addevent(s,*n,"ALICE_feereclaimed","poll","poll","ALICE_feereclaimed"); + + s = instantdex_statecreate(s,n,"ALICE_reclaimed",ALICE_reclaimfunc,0,0,0,0); // altpayment + instantdex_addevent(s,*n,"ALICE_reclaimed","arefound","poll","ALICE_feereclaimed"); + instantdex_addevent(s,*n,"ALICE_reclaimed","poll","poll","ALICE_reclaimed"); + s = instantdex_statecreate(s,n,"ALICE_depositclaimed",ALICE_claimdepositfunc,0,0,0,0); // altpayment + instantdex_addevent(s,*n,"ALICE_depositclaimed","adpfound","poll","ALICE_feereclaimed"); + instantdex_addevent(s,*n,"ALICE_depositclaimed","poll","poll","ALICE_depositclaimed"); + // end terminal [BLOCKING] states + // need to create states before they can be referred to, that way a one pass FSM compile is possible s = instantdex_statecreate(s,n,"BOB_sentprivs",BTC_waitprivsfunc,0,"BTC_cleanup",0,0); s = instantdex_statecreate(s,n,"BOB_waitfee",BOB_waitfeefunc,0,"BTC_cleanup",0,0); - s = instantdex_statecreate(s,n,"BOB_sentdeposit",BOB_waitBTCalttxfunc,0,"BOB_reclaim",0,0); - s = instantdex_statecreate(s,n,"BOB_altconfirm",BOB_waitaltconfirmfunc,0,"BOB_reclaim",0,0); - s = instantdex_statecreate(s,n,"BOB_sentpayment",BOB_waitprivMfunc,0,"BOB_reclaim",0,0); + s = instantdex_statecreate(s,n,"BOB_sentdeposit",BOB_waitBTCalttxfunc,0,"BOB_reclaimed",0,0); + s = instantdex_statecreate(s,n,"BOB_altconfirm",BOB_waitaltconfirmfunc,0,"BOB_reclaimed",0,0); + s = instantdex_statecreate(s,n,"BOB_sentpayment",BOB_waitprivMfunc,0,"BOB_reclaimed",0,0); s = instantdex_statecreate(s,n,"ALICE_sentprivs",BTC_waitprivsfunc,0,"BTC_cleanup",0,0); s = instantdex_statecreate(s,n,"Alice_waitfee",ALICE_waitfeefunc,0,"BTC_cleanup",0,0); s = instantdex_statecreate(s,n,"ALICE_waitdeposit",ALICE_waitdepositfunc,0,"BTC_cleanup",0,0); - s = instantdex_statecreate(s,n,"ALICE_sentalt",ALICE_waitBTCpaytxfunc,0,"ALICE_reclaim",0,0); - s = instantdex_statecreate(s,n,"ALICE_waitconfirms",ALICE_waitpayconf_or_bobreclaimfunc,0,"ALICE_reclaim",0,0); + s = instantdex_statecreate(s,n,"ALICE_sentalt",ALICE_waitBTCpaytxfunc,0,"ALICE_reclaimed",0,0); + s = instantdex_statecreate(s,n,"ALICE_waitconfirms",ALICE_waitpayconf_or_bobreclaimfunc,0,"ALICE_reclaimed",0,0); - // events instantdex_addevent(s,*n,,,,) if ( 0 ) // following are implicit states and events handled externally to setup datastructures { //s = instantdex_statecreate(s,n,"BOB_idle",BTC_idlefunc,0,0,0); @@ -782,12 +830,12 @@ struct instantdex_stateinfo *BTC_initFSM(int32_t *n) s = instantdex_statecreate(s,n,"ALICE_sentprivs",BTC_waitprivsfunc,0,"BTC_cleanup",0,0); instantdex_addevent(s,*n,"ALICE_sentprivs","BTCprivs","poll","Alice_waitfee"); - // Bob waits for fee and sends deposit when it appears + // [BLOCKING: fee] Bob waits for fee and sends deposit when it appears s = instantdex_statecreate(s,n,"BOB_waitfee",BOB_waitfeefunc,0,"BTC_cleanup",0,0); instantdex_addevent(s,*n,"BOB_waitfee","feefound","BTCdeptx","BOB_sentdeposit"); instantdex_addevent(s,*n,"BOB_waitfee","poll","poll","BOB_waitfee"); - // Alice waits for fee and then waits for deposit to confirm and sends altpayment + // [BLOCKING: fee and deposit] Alice waits for fee and then waits for deposit to confirm and sends altpayment s = instantdex_statecreate(s,n,"Alice_waitfee",ALICE_waitfeefunc,0,"BTC_cleanup",0,0); instantdex_addevent(s,*n,"Alice_waitfee","feefound","poll","ALICE_waitdeposit"); instantdex_addevent(s,*n,"Alice_waitfee","poll","poll","Alice_waitfee"); @@ -796,25 +844,25 @@ struct instantdex_stateinfo *BTC_initFSM(int32_t *n) instantdex_addevent(s,*n,"ALICE_waitdeposit","depfound","BTCalttx","ALICE_sentalt"); instantdex_addevent(s,*n,"ALICE_waitdeposit","poll","poll","ALICE_waitdeposit"); - // now Bob's turn to make sure altpayment is confirmed and send real payment - s = instantdex_statecreate(s,n,"BOB_sentdeposit",BOB_waitBTCalttxfunc,0,"BOB_reclaim",0,0); + // [BLOCKING: BTCalttx and altfound] now Bob's turn to make sure altpayment is confirmed and send real payment + s = instantdex_statecreate(s,n,"BOB_sentdeposit",BOB_waitBTCalttxfunc,0,"BOB_reclaimed",0,0); instantdex_addevent(s,*n,"BOB_sentdeposit","BTCalttx","poll","BOB_altconfirm"); - s = instantdex_statecreate(s,n,"BOB_altconfirm",BOB_waitaltconfirmfunc,0,"BOB_reclaim",0,0); + s = instantdex_statecreate(s,n,"BOB_altconfirm",BOB_waitaltconfirmfunc,0,"BOB_reclaimed",0,0); instantdex_addevent(s,*n,"BOB_altconfirm","altfound","BTCpaytx","BOB_sentpayment"); instantdex_addevent(s,*n,"BOB_altconfirm","poll","poll","BOB_altconfirm"); - // now Alice's turn to make sure payment is confrmed and send in claim or see bob's reclaim and reclaim - s = instantdex_statecreate(s,n,"ALICE_sentalt",ALICE_waitBTCpaytxfunc,0,"ALICE_reclaim",0,0); + // [BLOCKING: BTCpaytx] now Alice's turn to make sure payment is confrmed and send in claim or see bob's reclaim and reclaim + s = instantdex_statecreate(s,n,"ALICE_sentalt",ALICE_waitBTCpaytxfunc,0,"ALICE_reclaimed",0,0); instantdex_addevent(s,*n,"ALICE_sentalt","BTCpaytx","poll","ALICE_waitconfirms"); - s = instantdex_statecreate(s,n,"ALICE_waitconfirms",ALICE_waitpayconf_or_bobreclaimfunc,0,"ALICE_reclaim",0,0); - instantdex_addevent(s,*n,"ALICE_waitconfirms","bobfound","poll","ALICE_reclaim"); + s = instantdex_statecreate(s,n,"ALICE_waitconfirms",ALICE_waitpayconf_or_bobreclaimfunc,0,"ALICE_reclaimed",0,0); + instantdex_addevent(s,*n,"ALICE_waitconfirms","bobfound","poll","ALICE_reclaimed"); instantdex_addevent(s,*n,"ALICE_waitconfirms","payfound","BTCprivM","ALICE_claimedbtc"); instantdex_addevent(s,*n,"ALICE_waitconfirms","poll","poll","ALICE_waitconfirms"); - // Bob waits for privM either from Alice or alt blockchain - s = instantdex_statecreate(s,n,"BOB_sentpayment",BOB_waitprivMfunc,0,"BOB_reclaim",0,0); + // [BLOCKING: privM] Bob waits for privM either from Alice or alt blockchain + s = instantdex_statecreate(s,n,"BOB_sentpayment",BOB_waitprivMfunc,0,"BOB_reclaimed",0,0); instantdex_addevent(s,*n,"BOB_sentpayment","btcfound","BTCdone","BOB_claimedalt"); instantdex_addevent(s,*n,"BOB_sentpayment","BTCprivM","BTCdone","BOB_claimedalt"); instantdex_addevent(s,*n,"BOB_sentpayment","poll","poll","BOB_sentpayment"); @@ -1121,7 +1169,7 @@ char *instantdex_BTCswap(struct supernet_info *myinfo,struct exchange_info *exch } else { - printf("no matching trade.(%s)\n",jprint(argjson,0)); + printf("Ano matching trade.(%s)\n",jprint(argjson,0)); if ( (str= InstantDEX_minaccept(myinfo,0,argjson,0,A->offer.base,"BTC",dstr(A->offer.price64),dstr(A->offer.basevolume64))) != 0 ) free(str); } diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index 740ab7ce0..08988375b 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -53,6 +53,11 @@ STRING_AND_INT(InstantDEX,pollgap,exchange,pollgap); ZERO_ARGS(InstantDEX,allexchanges); STRING_ARG(InstantDEX,allpairs,exchange); +THREE_STRINGS_AND_DOUBLE(atomic,offer,base,rel,orderid,basevolume); +TWO_STRINGS(atomic,accept,myorderid,otherid); +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);