Browse Source

Test

etomic
jl777 8 years ago
parent
commit
e04ebf4868
  1. 2
      .gitignore
  2. 21
      basilisk/jumblr.c

2
.gitignore

@ -230,3 +230,5 @@ iguana/DB/SWAPS/2465996447-4202128826
iguana/DB/SWAPS/3078036996-3700749298
iguana/DB/SWAPS/1061498231-3266306388
iguana/DB/SWAPS/1060082251-3390546616

21
basilisk/jumblr.c

@ -726,7 +726,7 @@ void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coin)
double minbtc,btcavail; char *retstr; cJSON *vals; bits256 hash;
minbtc = (kmdcoin->DEXinfo.btcprice * 1.2) * (JUMBLR_INCR + 3*(JUMBLR_INCR * JUMBLR_FEE + JUMBLR_TXFEE));
btcavail = dstr(jumblr_balance(myinfo,coinbtc,kmdcoin->DEXinfo.depositaddr));
if ( coinbtc != 0 && btcavail > minbtc+kmdcoin->DEXinfo.DEXpending )
if ( 0 && coinbtc != 0 && btcavail > minbtc+kmdcoin->DEXinfo.DEXpending )
{
printf("BTC deposits %.8f, min %.8f\n",btcavail,minbtc);
@ -746,6 +746,25 @@ void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coin)
free_json(vals);
// curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"request\",\"vals\":{\"source\":\"KMD\",\"amount\":20,\"dest\":\"USD\",\"minprice\":0.08}}"
} //else printf("btcavail %.8f pending %.8f\n",btcavail,pending);
if ( coinbtc != 0 && kmdcoin->DEXinfo.avail > JUMBLR_INCR+kmdcoin->DEXinfo.DEXpending )
{
printf("KMD deposits %.8f, min %.8f\n",kmdcoin->DEXinfo.avail,JUMBLR_INCR);
vals = cJSON_CreateObject();
jaddstr(vals,"source","KMD");
jaddstr(vals,"dest","BTC");
jaddnum(vals,"amount",JUMBLR_INCR);
jaddnum(vals,"minprice",1./kmdcoin->DEXinfo.btcprice*1.01);
jaddnum(vals,"usejumblr",1);
memset(hash.bytes,0,sizeof(hash));
kmdcoin->DEXinfo.DEXpending += btcavail;
if ( (retstr= InstantDEX_request(myinfo,coinbtc,0,0,hash,vals,"")) != 0 )
{
printf("request.(%s) -> (%s)\n",jprint(vals,0),retstr);
free(retstr);
}
free_json(vals);
// curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"request\",\"vals\":{\"source\":\"KMD\",\"amount\":20,\"dest\":\"USD\",\"minprice\":0.08}}"
} //else printf("btcavail %.8f pending %.8f\n",btcavail,pending);
} //else printf("notlp.%d kmdprice %.8f\n",myinfo->IAMLP,kmdcoin->DEXinfo.btcprice);
}

Loading…
Cancel
Save