Browse Source

Test

etomic
jl777 8 years ago
parent
commit
cc2a65e46e
  1. 7
      basilisk/basilisk.c
  2. 8
      basilisk/basilisk_swap.c
  3. 6
      basilisk/smartaddress.c
  4. 1
      iguana/iguana777.h
  5. 1
      includes/iguana_apideclares.h

7
basilisk/basilisk.c

@ -1972,4 +1972,11 @@ ZERO_ARGS(InstantDEX,getswaplist)
return(basilisk_swaplist(myinfo));
}
DOUBLE_ARG(InstantDEX,DEXratio,ratio)
{
if ( ratio < 0.95 || ratio > 1.01 )
return(clonestr("{\"result\":\"error\",\"description\":\"DEXratio must be between 0.95 and 1.01\"}"));
myinfo->DEXratio = ratio;
return(clonestr("{\"result\":\"success\"}"));
}
#include "../includes/iguana_apiundefs.h"

8
basilisk/basilisk_swap.c

@ -2769,18 +2769,18 @@ struct basilisk_swap *basilisk_thread_start(struct supernet_info *myinfo,bits256
m = n = 0;
if ( bitcoin_swapinit(myinfo,privkey,pubkey33,pubkey25519,swap,optionduration,statebits,reinit) != 0 )
{
for (iter=0; iter<3; iter++)
for (iter=0; iter<1; iter++)
{
basilisk_psockinit(myinfo,swap,statebits == 0);
sleep(3);
if ( swap->connected <= 0 )
continue;
sleep(13);
basilisk_sendstate(myinfo,swap,data,sizeof(data));
sleep(30);
/*basilisk_sendstate(myinfo,swap,data,sizeof(data));
basilisk_swapget(myinfo,swap,0x80000000,data,sizeof(data),basilisk_verify_statebits);
if ( swap->connected > 0 )
break;
printf("loopback didntwork with %d %d\n",swap->pushsock,swap->subsock);
printf("loopback didntwork with %d %d\n",swap->pushsock,swap->subsock);*/
}
if ( reinit != 0 )
{

6
basilisk/smartaddress.c

@ -336,6 +336,8 @@ void smartaddress_dex(struct supernet_info *myinfo,int32_t selector,struct iguan
minamount = price = 0.;
if ( basebtc < SMALLVAL && relbtc < SMALLVAL )
return;
if ( myinfo->DEXratio < .95 || myinfo->DEXratio > 1.01 )
myinfo->DEXratio = 0.995;
if ( basebtc < SMALLVAL || relbtc < SMALLVAL )
{
if ( (price= maxbid) > SMALLVAL )
@ -345,11 +347,11 @@ void smartaddress_dex(struct supernet_info *myinfo,int32_t selector,struct iguan
else if ( relbtc < SMALLVAL )
relbtc = basebtc / price, printf("calculated relbtc %.8f from (%.8f / %.8f)\n",relbtc,basebtc,price); // price * relbtc == basebtc
}
} else price = 0.985 * (basebtc / relbtc);
} else price = myinfo->DEXratio * (basebtc / relbtc);
minbtc = btc2kmd * (JUMBLR_INCR + 3*(JUMBLR_INCR * JUMBLR_FEE + JUMBLR_TXFEE));
if ( minamount == 0. && basebtc > SMALLVAL )
minamount = (minbtc / basebtc);
printf("%s/%s minbtc %.8f btcprice %.8f -> minamount %.8f price %.8f vs maxbid %.8f\n",basecoin->symbol,relcoin->symbol,minbtc,basecoin->DEXinfo.btcprice,minamount,price,maxbid);
printf("%s/%s minbtc %.8f btcprice %.8f -> minamount %.8f price %.8f vs maxbid %.8f DEXratio %.5f\n",basecoin->symbol,relcoin->symbol,minbtc,basecoin->DEXinfo.btcprice,minamount,price,maxbid,myinfo->DEXratio);
if ( minamount > SMALLVAL && maxavail > minamount + basecoin->DEXinfo.DEXpending && (maxbid == 0. || price <= maxbid) )
{
avail = (maxavail - (minamount + basecoin->DEXinfo.DEXpending));

1
iguana/iguana777.h

@ -173,6 +173,7 @@ struct supernet_info
uint16_t psockport,numpsocks; struct psock *PSOCKS; portable_mutex_t psockmutex;
uint8_t notaries[64][33]; int32_t numnotaries,DEXEXPLORER;
FILE *swapsfp;
double DEXratio;
struct smartaddress smartaddrs[64]; int32_t numsmartaddrs,cancelrefresh,runsilent,DEXtrades;
};

1
includes/iguana_apideclares.h

@ -230,6 +230,7 @@ ZERO_ARGS(InstantDEX,init);
ZERO_ARGS(InstantDEX,getswaplist);
ZERO_ARGS(InstantDEX,smartaddresses);
TWO_STRINGS_AND_TWO_DOUBLES(InstantDEX,smartaddress,type,symbol,maxbid,minask);
DOUBLE_ARG(InstantDEX,DEXratio,ratio);
//THREE_STRINGS(atomic,approve,myorderid,otherid,txname);
//THREE_STRINGS(atomic,claim,myorderid,otherid,txname);

Loading…
Cancel
Save