Browse Source

Merge branch 'master' into etomic

# Conflicts:
#	.gitignore
#	iguana/exchanges/LP_commands.c
#	iguana/exchanges/LP_include.h
#	iguana/exchanges/LP_nativeDEX.c
#	iguana/exchanges/LP_ordermatch.c
#	iguana/exchanges/LP_prices.c
#	iguana/exchanges/LP_socket.c
#	iguana/exchanges/LP_swap.c
#	iguana/exchanges/coins
#	iguana/exchanges/mm.c
patch-3
jl777 7 years ago
parent
commit
fcddb21b60
  1. 4
      .gitignore
  2. BIN
      OSlibs/win/x64/pthread_lib.lib
  3. 10
      iguana/dexscripts.win32/1-client.cmd
  4. 16
      iguana/dexscripts.win32/2-getuserpass.cmd
  5. 70
      iguana/dpow/dpow_fsm.c
  6. 2
      iguana/dpow/dpow_prices.c
  7. 2
      iguana/dpow/dpow_rpc.c
  8. 16
      iguana/exchanges/LP_commands.c
  9. 8
      iguana/exchanges/LP_include.h
  10. 2
      iguana/exchanges/LP_instantdex.c
  11. 77
      iguana/exchanges/LP_nativeDEX.c
  12. 2
      iguana/exchanges/LP_ordermatch.c
  13. 2
      iguana/exchanges/LP_peers.c
  14. 8
      iguana/exchanges/LP_portfolio.c
  15. 14
      iguana/exchanges/LP_prices.c
  16. 19
      iguana/exchanges/LP_remember.c
  17. 31
      iguana/exchanges/LP_rpc.c
  18. 2
      iguana/exchanges/LP_secp.c
  19. 22
      iguana/exchanges/LP_socket.c
  20. 59
      iguana/exchanges/LP_swap.c
  21. 2
      iguana/exchanges/auto_chipsbtc
  22. 2
      iguana/exchanges/auto_chipskmd
  23. 3
      iguana/exchanges/calcaddress
  24. 3
      iguana/exchanges/coins
  25. 91
      iguana/exchanges/mm.c
  26. 2
      iguana/exchanges/mshark
  27. 4
      iguana/exchanges/prices/bet
  28. 2
      iguana/exchanges/run
  29. 24
      iguana/iguana_notary.c
  30. 13
      iguana/m_mm
  31. 89
      marketmaker_build_depends.cmd

4
.gitignore

@ -53,7 +53,6 @@ iguana/help.json
iguana/autoAPI.md
iguana/basilisk.o-2ad8cb38
=======
*.pbxproj
iguana/tmp/.tmpmarker
@ -258,4 +257,5 @@ iguana/DB/instantdex_RQ4z6KrMZeEnCSCsChv1ZoR9ExQitHjbpg.json
build
.idea
.idea
Release/*

BIN
OSlibs/win/x64/pthread_lib.lib

Binary file not shown.

10
iguana/dexscripts.win32/1-client.cmd

@ -6,10 +6,16 @@ rem set COINS=[{\"coin\":\"REVS\",\"active\":1,\"asset\":\"REVS\",\"rpcport\":10
rem marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"mypassphrase\", \"coins\":%COINS%}"
set COINS=\"\"
set /p PASSPHRASE=<passphrase
rem set /p PASSPHRASE=<passphrase
rem , \"canbind\":1
rem marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"%PASSPHRASE%\"}" 1> marketmaker.log 2>&1
marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"%PASSPHRASE%\"}"
rem marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"%PASSPHRASE%\"}" 1> marketmaker.log 2>&1
rem echo "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"%PASSPHRASE%\"}"
rem marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\", \"passphrase\":\"%PASSPHRASE%\"}"
marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"%USERHOME%\",\"passphrase\":\"default\"}"

16
iguana/dexscripts.win32/2-getuserpass.cmd

@ -1,7 +1,17 @@
@echo off
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":null,\"method\":\"enable\",\"coin\":\" \"}" -s > userpass.json
for /f "tokens=2 delims=:," %%a in (' find "userpass" "userpass.json" ') do (
rem first time call to any method after started markemaker will return default userpass 1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f
rem by-default userpass is 1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f from "default" passphrase
rem first time call to marketmaker don't return anything now, so we disable it
rem curl --url "http://127.0.0.1:7783" --data "{\"userpass\":null,\"method\":\"enable\",\"coin\":\"\"}" -s > default_userpass.json
rem curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f\",\"method\":\"hello\"}" -s > default_userpass.json
rem echo - First time call to MM API finished, default userpass received
set /p PASSPHRASE=<passphrase
echo - Pushing passphrase to login
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f\",\"method\":\"passphrase\",\"passphrase\":\"%PASSPHRASE%\",\"gui\":\"nogui\"}" -s > userpass.json
echo Getting userpass related to your passphrase finished
for /f "tokens=4 delims=:," %%a in (' find "userpass" "userpass.json" ') do (
echo UserPass: %%~a
echo %%~a > userpass
)
del userpass.json

70
iguana/dpow/dpow_fsm.c

@ -91,25 +91,25 @@ int32_t dpow_datahandler(struct supernet_info *myinfo,struct dpow_info *dp,struc
{
//printf("verify (%s) it is properly signed! set ht.%d signedtxid to %s\n",coin->symbol,height,bits256_str(str,txid));
/*if ( channel == DPOW_BTCTXIDCHANNEL )
{
if ( bp->state < 1000 )
{
bp->desttxid = txid;
bp->state = 1000;
dp->destupdated = 0;
dpow_signedtxgen(myinfo,dp,bp->srccoin,bp,bp->bestk,bp->bestmask,myind,DPOW_SIGCHANNEL,0,bp->isratify);
//dpow_sigscheck(myinfo,dp,bp,DPOW_SIGCHANNEL,myind,0);
}
}
else
{
if ( bp->state != 0xffffffff )
{
bp->srctxid = txid;
printf("set state elapsed %d COMPLETED %s.(%s) %s.(%s)\n",(int32_t)(time(NULL) - bp->starttime),dp->symbol,bits256_str(str,bp->desttxid),dp->dest,bits256_str(str2,txid));
bp->state = 0xffffffff;
}
}*/
{
if ( bp->state < 1000 )
{
bp->desttxid = txid;
bp->state = 1000;
dp->destupdated = 0;
dpow_signedtxgen(myinfo,dp,bp->srccoin,bp,bp->bestk,bp->bestmask,myind,DPOW_SIGCHANNEL,0,bp->isratify);
//dpow_sigscheck(myinfo,dp,bp,DPOW_SIGCHANNEL,myind,0);
}
}
else
{
if ( bp->state != 0xffffffff )
{
bp->srctxid = txid;
printf("set state elapsed %d COMPLETED %s.(%s) %s.(%s)\n",(int32_t)(time(NULL) - bp->starttime),dp->symbol,bits256_str(str,bp->desttxid),dp->dest,bits256_str(str2,txid));
bp->state = 0xffffffff;
}
}*/
}
else
{
@ -155,6 +155,8 @@ int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct
return(haveutxo);
}
uint32_t Numallocated;
void dpow_statemachinestart(void *ptr)
{
void **ptrs = ptr;
@ -177,6 +179,7 @@ void dpow_statemachinestart(void *ptr)
if ( src == 0 || dest == 0 )
{
printf("null coin ptr? (%s %p or %s %p)\n",dp->symbol,src,dp->dest,dest);
free(ptr);
return;
}
if ( strcmp(src->symbol,"KMD") == 0 )
@ -186,6 +189,7 @@ void dpow_statemachinestart(void *ptr)
if ( (bp= dp->blocks[checkpoint.blockhash.height]) == 0 )
{
bp = calloc(1,sizeof(*bp));
Numallocated++;
bp->minsigs = minsigs;
bp->duration = duration;
bp->srccoin = src;
@ -200,6 +204,8 @@ void dpow_statemachinestart(void *ptr)
if ( numratified > 64 )
{
fprintf(stderr,"cant ratify more than 64 notaries ratified has %d\n",numratified);
free(ptr);
free_json(ratified);
return;
}
for (i=0; i<numratified; i++)
@ -238,24 +244,14 @@ void dpow_statemachinestart(void *ptr)
bp->numratified = numratified;
bp->ratified = ratified;
printf("numratified.%d %s\n",numratified,jprint(ratified,0));
}
else
{
printf("i.%d numratified.%d\n",i,numratified);
free_json(ratified);
}
} else printf("i.%d numratified.%d\n",i,numratified);
}
free_json(ratified);
}
bp->bestk = -1;
dp->blocks[checkpoint.blockhash.height] = bp;
bp->beacon = rand256(0);
vcalc_sha256(0,bp->commit.bytes,bp->beacon.bytes,sizeof(bp->beacon));
/*if ( checkpoint.blockhash.height >= DPOW_FIRSTRATIFY && dp->blocks[checkpoint.blockhash.height - DPOW_FIRSTRATIFY] != 0 )
{
printf("purge %s.%d\n",dp->dest,checkpoint.blockhash.height - DPOW_FIRSTRATIFY);
free(dp->blocks[checkpoint.blockhash.height - DPOW_FIRSTRATIFY]);
dp->blocks[checkpoint.blockhash.height - DPOW_FIRSTRATIFY] = 0;
}*/
}
if ( bp->isratify != 0 && dp->ratifying != 0 )
{
@ -336,6 +332,7 @@ void dpow_statemachinestart(void *ptr)
printf("%02x",bp->ratified_pubkeys[0][i]);
printf(" new, cant change notary0\n");
dp->ratifying -= bp->isratify;
free(ptr);
return;
}
//printf(" myind.%d myaddr.(%s %s)\n",myind,srcaddr,destaddr);
@ -356,15 +353,15 @@ void dpow_statemachinestart(void *ptr)
if ( dpow_checkutxo(myinfo,dp,bp,bp->destcoin,&ep->dest.prev_hash,&ep->dest.prev_vout,destaddr) < 0 )
{
printf("dont have %s %s utxo, please send funds\n",dp->dest,destaddr);
free(ptr);
dp->ratifying -= bp->isratify;
free(ptr);
return;
}
if ( dpow_checkutxo(myinfo,dp,bp,bp->srccoin,&ep->src.prev_hash,&ep->src.prev_vout,srcaddr) < 0 )
{
printf("dont have %s %s utxo, please send funds\n",dp->symbol,srcaddr);
free(ptr);
dp->ratifying -= bp->isratify;
free(ptr);
return;
}
if ( bp->isratify != 0 )
@ -388,6 +385,7 @@ void dpow_statemachinestart(void *ptr)
{
printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
dp->ratifying -= bp->isratify;
free(ptr);
return;
}
sleep(1);
@ -396,7 +394,7 @@ void dpow_statemachinestart(void *ptr)
if ( bp->isratify == 0 )
{
//if ( (starttime= checkpoint.timestamp) == 0 )
bp->starttime = starttime;
bp->starttime = starttime;
extralen = dpow_paxpending(extras,&bp->paxwdcrc);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
@ -458,11 +456,11 @@ void dpow_statemachinestart(void *ptr)
break;
}
}
printf("END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest);
printf("[%d] END isratify.%d:%d bestk.%d %llx sigs.%llx state.%x machine ht.%d completed state.%x %s.%s %s.%s recvmask.%llx paxwdcrc.%x %p %p\n",Numallocated,bp->isratify,dp->ratifying,bp->bestk,(long long)bp->bestmask,(long long)(bp->bestk>=0?bp->destsigsmasks[bp->bestk]:0),bp->state,bp->height,bp->state,dp->dest,bits256_str(str,bp->desttxid),dp->symbol,bits256_str(str2,bp->srctxid),(long long)bp->recvmask,bp->paxwdcrc,src,dest);
bp->state = 0xffffffff;
dp->lastrecvmask = bp->recvmask;
dp->ratifying -= bp->isratify;
dp->blocks[bp->height] = 0;
// dp->blocks[bp->height] = 0;
free(ptr);
}

2
iguana/dpow/dpow_prices.c

@ -1839,7 +1839,7 @@ int32_t PAX_idle(struct supernet_info *myinfo)//struct PAX_data *argdp,int32_t i
{
static double lastupdate,lastdayupdate; static uint32_t didinit; static char *userhome; int32_t idlegap = 10;
FILE *fp; long filesize; char fname[512]; double splineval; uint32_t pvals[128],timestamp; int32_t i,datenum,seconds,c; struct tai t; struct PAX_data *dp; uint8_t data[512];
if ( Currencymasks[0] == 0 )
if ( 1 || Currencymasks[0] == 0 ) // disable pax price gatherings
return(0);
if ( time(NULL) > didinit+12*3600 )
{

2
iguana/dpow/dpow_rpc.c

@ -569,7 +569,7 @@ char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *c
jaddistr(array,signedtx);
paramstr = jprint(array,1);
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"sendrawtransaction",paramstr);
printf(">>>>>>>>>>> %s dpow_sendrawtransaction.(%s) -> (%s)\n",coin->symbol,paramstr,retstr);
printf(">>>>>>>>>>> %s dpow_sendrawtransaction (%s)\n",coin->symbol,retstr);
free(paramstr);
return(retstr);
}

16
iguana/exchanges/LP_commands.c

@ -176,18 +176,8 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
{
if ( G.USERPASS_COUNTER == 0 )
{
char pub33str[67];
G.USERPASS_COUNTER = 1;
retjson = cJSON_CreateObject();
jaddstr(retjson,"userpass",G.USERPASS);
jaddbits256(retjson,"mypubkey",G.LP_mypub25519);
init_hexbytes_noT(pub33str,G.LP_pubsecp,33);
jaddstr(retjson,"pubsecp",pub33str);
jadd(retjson,"coins",LP_coinsjson(LP_showwif));
LP_cmdcount++;
free_json(retjson);
retjson = 0;
//return(jprint(retjson,1));
}
// if passphrase api and passphrase is right, ignore userpass, use hass of passphrase
if ( strcmp(method,"passphrase") == 0 && (passphrase= jstr(argjson,"passphrase")) != 0 )
@ -198,7 +188,8 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
authenticated = 1;
else printf("passhash %s != G %s\n",bits256_str(str,passhash),bits256_str(str2,G.LP_passhash));
}
if ( authenticated == 0 && ((userpass= jstr(argjson,"userpass")) == 0 || strcmp(userpass,G.USERPASS) != 0) )
char passhashstr[65]; bits256_str(passhashstr,G.LP_passhash);
if ( authenticated == 0 && ((userpass= jstr(argjson,"userpass")) == 0 || (strcmp(userpass,G.USERPASS) != 0 && strcmp(userpass,passhashstr) != 0)) )
return(clonestr("{\"error\":\"authentication error you need to make sure userpass is set\"}"));
if ( jobj(argjson,"userpass") != 0 )
jdelete(argjson,"userpass");
@ -309,6 +300,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
if ( (passphrase= jstr(argjson,"passphrase")) != 0 )
{
conv_NXTpassword(privkey.bytes,pub.bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase));
privkey.bytes[0] &= 248, privkey.bytes[31] &= 127, privkey.bytes[31] |= 64;
bitcoin_priv2pub(ctx,"KMD",pubkey33,coinaddr,privkey,0,60);
retjson = cJSON_CreateObject();
jaddstr(retjson,"passphrase",passphrase);
@ -341,7 +333,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
return(basilisk_swapentries(coin,0,jint(argjson,"limit")));
else if ( base[0] != 0 && rel[0] != 0 )
return(basilisk_swapentries(base,rel,jint(argjson,"limit")));
else return(basilisk_swaplist(0,0,0,jint(argjson,"pending")));
else return(basilisk_swaplist(0,0,1,jint(argjson,"pending")));
}
else if ( strcmp(method,"dynamictrust") == 0 )
{

8
iguana/exchanges/LP_include.h

@ -22,7 +22,7 @@
#define LP_INCLUDE_H
#ifndef LP_TECHSUPPORT
#define LP_TECHSUPPORT 1
#define LP_TECHSUPPORT 0
#endif
#define LP_DONT_CMDCHANNEL
@ -35,7 +35,7 @@ voind dontprintf(char *formatstr,...) {}
#define LP_MAJOR_VERSION "0"
#define LP_MINOR_VERSION "1"
#define LP_BUILD_NUMBER "17769"
#define LP_BUILD_NUMBER "17770"
#define LP_BARTERDEX_VERSION 1
#define LP_MAGICBITS 1
@ -305,7 +305,7 @@ struct iguana_info
int32_t numutxos,notarized,longestchain,firstrefht,firstscanht,lastscanht,height; uint16_t busport,did_addrutxo_reset;
uint32_t txversion,dPoWtime,lastresetutxo,loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime;
uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms;
char symbol[128],smartaddr[64],etomic[64],userpass[1024],serverport[128],instantdex_address[64];
char symbol[128],smartaddr[64],userpass[1024],serverport[128],instantdex_address[64],estimatefeestr[32],etomic[64];
// portfolio
double price_kmd,force,perc,goal,goalperc,relvolume,rate;
void *electrum; void *ctx;
@ -507,9 +507,11 @@ char *LP_pricepings(void *ctx,char *myipaddr,int32_t pubsock,char *base,char *re
int32_t LP_merkleproof(struct iguana_info *coin,char *coinaddr,struct electrum_info *ep,bits256 txid,int32_t height);
cJSON *electrum_address_gethistory(char *symbol,struct electrum_info *ep,cJSON **retjsonp,char *addr,bits256 reftxid);
cJSON *LP_myzdebits();
void LP_pendswap_add(uint32_t expiration,uint32_t requestid,uint32_t quoteid);
int32_t _LP_utxos_remove(bits256 txid,int32_t vout);
int32_t LP_utxos_remove(bits256 txid,int32_t vout);
struct LP_transaction *LP_transactionadd(struct iguana_info *coin,bits256 txid,int32_t height,int32_t numvouts,int32_t numvins);
char *bitcoin_address(char *symbol,char *coinaddr,uint8_t taddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len);
void LP_tradebot_finished(uint32_t tradeid,uint32_t requestid,uint32_t quoteid);
uint64_t LP_txfeecalc(struct iguana_info *coin,uint64_t txfee,int32_t txlen);
struct LP_address *_LP_address(struct iguana_info *coin,char *coinaddr);

2
iguana/exchanges/LP_instantdex.c

@ -100,7 +100,7 @@ void LP_instantdex_filescreate(char *coinaddr)
free_json(txobj);
else
{
char str[65]; printf("%s/v%d is already spent\n",bits256_str(str,txid),0);
//char str[65]; printf("%s/v%d is already spent\n",bits256_str(str,txid),0);
continue;
}
jaddibits256(newarray,txid);

77
iguana/exchanges/LP_nativeDEX.c

@ -85,7 +85,7 @@ void LP_millistats_update(struct LP_millistats *mp)
}
#include "LP_include.h"
portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex,LP_tradebotsmutex,LP_gcmutex,LP_inusemutex,LP_cJSONmutex,LP_logmutex,LP_statslogmutex,LP_tradesmutex,LP_commandQmutex,LP_blockinit_mutex;
portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex,LP_tradebotsmutex,LP_gcmutex,LP_inusemutex,LP_cJSONmutex,LP_logmutex,LP_statslogmutex,LP_tradesmutex,LP_commandQmutex,LP_blockinit_mutex,LP_pendswap_mutex;
int32_t LP_canbind;
char *Broadcaststr,*Reserved_msgs[2][1000];
int32_t num_Reserved_msgs[2],max_Reserved_msgs[2];
@ -531,11 +531,6 @@ void LP_coinsloop(void *_coins)
sleep(1);
continue;
}
if ( strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") == 0 )
{
sleep(10);
continue;
}
if ( strcmp("BTC",coins) == 0 )
LP_millistats_update(&LP_coinsloopBTC_stats);
else if ( strcmp("KMD",coins) == 0 )
@ -559,7 +554,7 @@ void LP_coinsloop(void *_coins)
}
if ( coin->smartaddr[0] == 0 )
{
printf("%s has no smartaddress??\n",coin->symbol);
//printf("%s has no smartaddress??\n",coin->symbol);
continue;
}
memset(&zero,0,sizeof(zero));
@ -925,7 +920,6 @@ void LP_pubkeysloop(void *ctx)
sleep(1);
continue;
}
if ( strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") != 0 )
{
LP_millistats_update(&LP_pubkeysloop_stats);
if ( time(NULL) > lasttime+100 )
@ -939,12 +933,41 @@ void LP_pubkeysloop(void *ctx)
}
}
struct LP_pendswap
{
struct LP_pendswap *next,*prev;
uint32_t expiration,requestid,quoteid,finished;
};
struct LP_pendswap *LP_pendingswaps;
void LP_pendswap_add(uint32_t expiration,uint32_t requestid,uint32_t quoteid)
{
struct LP_pendswap *sp;
printf("LP_pendswap_add expiration.%u %u-%u\n",expiration,requestid,quoteid);
portable_mutex_lock(&LP_pendswap_mutex);
sp = calloc(1,sizeof(*sp));
sp->expiration = expiration;
sp->requestid = requestid;
sp->quoteid = quoteid;
DL_APPEND(LP_pendingswaps,sp);
portable_mutex_unlock(&LP_pendswap_mutex);
}
void LP_swapsloop(void *ctx)
{
char *retstr;
char *retstr; cJSON *retjson; uint32_t requestid,quoteid; int32_t nonz; struct LP_pendswap *sp,*tmp;
strcpy(LP_swapsloop_stats.name,"LP_swapsloop");
LP_swapsloop_stats.threshold = 605000.;
sleep(50);
if ( (retstr= basilisk_swapentry(0,0,1)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (requestid= juint(retjson,"requestid")) != 0 && (quoteid= juint(retjson,"quoteid")) != 0 && jobj(retjson,"error") == 0 )
LP_pendswap_add(0,requestid,quoteid);
}
free(retstr);
}
while ( LP_STOP_RECEIVED == 0 )
{
if ( G.initializing != 0 )
@ -952,13 +975,20 @@ void LP_swapsloop(void *ctx)
sleep(1);
continue;
}
if ( strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") != 0 )
LP_millistats_update(&LP_swapsloop_stats);
nonz = 0;
DL_FOREACH_SAFE(LP_pendingswaps,sp,tmp)
{
LP_millistats_update(&LP_swapsloop_stats);
if ( (retstr= basilisk_swapentry(0,0,0)) != 0 )
free(retstr);
sleep(600);
} else sleep(10);
if ( sp->finished == 0 )
{
nonz++;
if ( (sp->finished= LP_swapwait(0,sp->requestid,sp->quoteid,-1,0)) != 0 )
{
}
}
}
if ( nonz == 0 )
sleep(60);
}
}
@ -1189,8 +1219,8 @@ int32_t LP_reserved_msg(int32_t priority,char *base,char *rel,bits256 pubkey,cha
}
if ( skip != 0 )
return(-1);
if ( strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") == 0 )
return(-1);
//if ( strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") == 0 )
// return(-1);
if ( priority > 0 && bits256_nonz(pubkey) != 0 )
{
if ( (pubp= LP_pubkeyfind(pubkey)) != 0 )
@ -1309,6 +1339,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
portable_mutex_init(&LP_tradesmutex);
portable_mutex_init(&LP_commandQmutex);
portable_mutex_init(&LP_blockinit_mutex);
portable_mutex_init(&LP_pendswap_mutex);
myipaddr = clonestr("127.0.0.1");
#ifndef _WIN32
#ifndef FROM_JS
@ -1444,14 +1475,14 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
printf("error launching LP_tradessloop for ctx.%p\n",ctx);
exit(-1);
}
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_swapsloop,ctx) != 0 )
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_commandQ_loop,ctx) != 0 )
{
printf("error launching LP_swapsloop for ctx.%p\n",ctx);
printf("error launching LP_commandQ_loop for ctx.%p\n",ctx);
exit(-1);
}
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_commandQ_loop,ctx) != 0 )
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_swapsloop,ctx) != 0 )
{
printf("error launching LP_commandQ_loop for ctx.%p\n",ctx);
printf("error launching LP_swapsloop for ctx.%p\n",ctx);
exit(-1);
}
int32_t nonz,didremote=0;
@ -1461,7 +1492,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
{
nonz = 0;
G.waiting = 1;
while ( G.initializing != 0 && strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") == 0 )
while ( G.initializing != 0 ) //&& strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") == 0 )
{
//fprintf(stderr,".");
sleep(3);

2
iguana/exchanges/LP_ordermatch.c

@ -443,7 +443,7 @@ struct LP_utxoinfo *LP_address_myutxopair(struct LP_utxoinfo *butxo,int32_t iamb
return(butxo);
} else printf("cant find utxos[mini %d]\n",mini);
} //else printf("cant find targetval2 %.8f\n",dstr(targetval2));
} else printf("failed ratio test %.8f\n",(double)up->U.value/targetval);
} //else printf("failed ratio test %.8f\n",(double)up->U.value/targetval);
} else if ( targetval != 0 && mini >= 0 )
printf("targetval %.8f mini.%d\n",dstr(targetval),mini);
if ( targetval == 0 || mini < 0 )

2
iguana/exchanges/LP_peers.c

@ -63,7 +63,7 @@ void LP_cmdchannel(struct LP_peerinfo *peer)
#ifdef LP_DONT_CMDCHANNEL
return;
#endif
if ( bits256_nonz(G.LP_mypub25519) == 0 || strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") == 0 )
if ( bits256_nonz(G.LP_mypub25519) == 0 ) //|| strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") == 0 )
return;
if ( (cmdport= LP_psock_get(connectaddr,publicaddr,1,1,peer->ipaddr)) != 0 )
{

8
iguana/exchanges/LP_portfolio.c

@ -540,7 +540,15 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
{
price = (bidprice + askprice) * 0.5;
bidprice = (1. / price * (1. + buymargin));
if ( LP_autorefs[i].lastbid < SMALLVAL )
LP_autorefs[i].lastbid = bidprice;
else LP_autorefs[i].lastbid = (LP_autorefs[i].lastbid * 0.9) + (0.1 * bidprice);
bidprice = LP_autorefs[i].lastbid;
askprice = price * (1. + sellmargin);
if ( LP_autorefs[i].lastask < SMALLVAL )
LP_autorefs[i].lastask = askprice;
else LP_autorefs[i].lastask = (LP_autorefs[i].lastask * 0.9) + (0.1 * askprice);
askprice = LP_autorefs[i].lastask;
LP_mypriceset(&changed,rel,base,bidprice);
LP_pricepings(ctx,LP_myipaddr,LP_mypubsock,rel,base,bidprice);
LP_mypriceset(&changed,base,rel,askprice);

14
iguana/exchanges/LP_prices.c

@ -512,7 +512,7 @@ char *LP_myprices()
int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
{
struct LP_priceinfo *basepp=0,*relpp=0; struct LP_pubkey_info *pubp; double minprice,maxprice;
struct LP_priceinfo *basepp=0,*relpp=0; struct LP_pubkey_info *pubp; double minprice,maxprice,margin,buymargin,sellmargin;
*changedp = 0;
//if ( strcmp("DEX",base) == 0 || strcmp("DEX",rel) == 0 )
// printf("%s/%s setprice %.8f\n",base,rel,price);
@ -521,6 +521,9 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
if ( price == 0. || fabs(basepp->myprices[relpp->ind] - price)/price > 0.001 )
*changedp = 1;
sellmargin = relpp->sellmargins[basepp->ind];
buymargin = relpp->buymargins[basepp->ind];
margin = (sellmargin + buymargin) * 0.5;
if ( price == 0. )
{
relpp->minprices[basepp->ind] = 0.;
@ -529,18 +532,19 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price)
relpp->sellmargins[basepp->ind] = 0.;
relpp->offsets[basepp->ind] = 0.;
relpp->factors[basepp->ind] = 0.;
margin = 0.;
}
else if ( (minprice= basepp->minprices[relpp->ind]) > SMALLVAL && price < minprice )
{
printf("%s/%s price %.8f less than minprice %.8f\n",base,rel,price,minprice);
price = minprice;
//printf("%s/%s price %.8f less than minprice %.8f\n",base,rel,price,minprice);
price = minprice * (1. - margin);
}
else if ( (maxprice= relpp->minprices[basepp->ind]) > SMALLVAL )
{
if ( price > (1. / maxprice) )
{
printf("%s/%s price %.8f less than maxprice %.8f, more than %.8f\n",base,rel,price,maxprice,1./maxprice);
price = (1. / maxprice);
//printf("%s/%s price %.8f less than maxprice %.8f, more than %.8f\n",base,rel,price,maxprice,1./maxprice);
price = (1. / maxprice) * (1. + margin);
}
}
/*else if ( basepp->myprices[relpp->ind] > SMALLVAL )

19
iguana/exchanges/LP_remember.c

@ -410,7 +410,7 @@ int32_t basilisk_isbobcoin(int32_t iambob,int32_t ind)
}
}
int32_t basilisk_swap_isfinished(uint32_t expiration,int32_t iambob,bits256 *txids,int32_t *sentflags,bits256 paymentspent,bits256 Apaymentspent,bits256 depositspent)
int32_t basilisk_swap_isfinished(uint32_t requestid,uint32_t quoteid,uint32_t expiration,int32_t iambob,bits256 *txids,int32_t *sentflags,bits256 paymentspent,bits256 Apaymentspent,bits256 depositspent)
{
int32_t i,n = 0; uint32_t now = (uint32_t)time(NULL);
if ( bits256_nonz(paymentspent) != 0 && bits256_nonz(Apaymentspent) != 0 && bits256_nonz(depositspent) != 0 )
@ -419,7 +419,7 @@ int32_t basilisk_swap_isfinished(uint32_t expiration,int32_t iambob,bits256 *txi
{
if ( sentflags[BASILISK_ALICECLAIM] != 0 )
{
printf("edge case unspendable alicepayment\n");
printf("edge case unspendable alicepayment %u-%u\n",requestid,quoteid);
return(1);
}
else if ( iambob != 0 && sentflags[BASILISK_ALICECLAIM] != 0 )
@ -462,7 +462,7 @@ int32_t basilisk_swap_isfinished(uint32_t expiration,int32_t iambob,bits256 *txi
if ( bits256_nonz(depositspent) != 0 )
{
if ( bits256_nonz(Apaymentspent) == 0 && sentflags[BASILISK_BOBREFUND] == 0 )
printf("bob was too late in claiming bobrefund\n");
printf("bob was too late in claiming bobrefund %u-%u\n",requestid,quoteid);
return(1);
}
}
@ -781,7 +781,7 @@ int32_t LP_rswap_init(struct LP_swap_remember *rswap,uint32_t requestid,uint32_t
}
free_json(txobj);
}
rswap->origfinishedflag = basilisk_swap_isfinished(rswap->expiration,rswap->iambob,rswap->txids,rswap->sentflags,rswap->paymentspent,rswap->Apaymentspent,rswap->depositspent);
rswap->origfinishedflag = basilisk_swap_isfinished(requestid,quoteid,rswap->expiration,rswap->iambob,rswap->txids,rswap->sentflags,rswap->paymentspent,rswap->Apaymentspent,rswap->depositspent);
rswap->finishedflag = rswap->origfinishedflag;
if ( forceflag != 0 )
rswap->finishedflag = rswap->origfinishedflag = 0;
@ -1034,6 +1034,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
if ( (retjson= cJSON_Parse(fstr)) != 0 )
{
free(fstr);
if ( pendingonly != 0 )
free_json(retjson), retjson = 0;
return(retjson);
}
free(fstr);
@ -1059,6 +1061,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
//printf("legacy r%u-q%u DB SWAPS.(%u %u) %llu files BOB.(%s) Alice.(%s) src.(%s) dest.(%s)\n",requestid,quoteid,rswap.requestid,rswap.quoteid,(long long)rswap.aliceid,rswap.bobcoin,rswap.alicecoin,rswap.src,rswap.dest);
cJSON *retjson = cJSON_CreateObject();
jaddstr(retjson,"error","swap never started");
jaddstr(retjson,"status","finished");
jaddstr(retjson,"bob",rswap.bobcoin);
jaddstr(retjson,"src",rswap.src);
jaddstr(retjson,"alice",rswap.alicecoin);
@ -1172,7 +1175,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
rswap.paymentspent = basilisk_swap_spendupdate(rswap.iambob,rswap.bobcoin,rswap.bobpaymentaddr,rswap.sentflags,rswap.txids,BASILISK_BOBPAYMENT,BASILISK_ALICESPEND,BASILISK_BOBRECLAIM,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr);
rswap.Apaymentspent = basilisk_swap_spendupdate(rswap.iambob,rswap.alicecoin,rswap.alicepaymentaddr,rswap.sentflags,rswap.txids,BASILISK_ALICEPAYMENT,BASILISK_ALICERECLAIM,BASILISK_BOBSPEND,0,destAdest,destBdest,rswap.Adestaddr,rswap.destaddr);
rswap.depositspent = basilisk_swap_spendupdate(rswap.iambob,rswap.bobcoin,rswap.bobdepositaddr,rswap.sentflags,rswap.txids,BASILISK_BOBDEPOSIT,BASILISK_ALICECLAIM,BASILISK_BOBREFUND,0,srcAdest,srcBdest,rswap.Adestaddr,rswap.destaddr);
rswap.finishedflag = basilisk_swap_isfinished(rswap.expiration,rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent);
rswap.finishedflag = basilisk_swap_isfinished(requestid,quoteid,rswap.expiration,rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent);
LP_spends_set(&rswap);
if ( rswap.iambob == 0 )
{
@ -1324,7 +1327,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
free_json(txoutobj), flag = 0;
else flag = -1, rswap.paymentspent = deadtxid;
}
if ( flag == 0 && time(NULL) > rswap.expiration+777 )
if ( flag == 0 && time(NULL) > rswap.plocktime+777 )
{
// bobreclaim
redeemlen = basilisk_swap_bobredeemscript(0,&secretstart,redeemscript,rswap.plocktime,rswap.pubA0,rswap.pubB0,rswap.pubB1,zero,rswap.privBn,rswap.secretAm,rswap.secretAm256,rswap.secretBn,rswap.secretBn256);
@ -1360,7 +1363,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
free_json(txoutobj), flag = 0;
else flag = -1, rswap.depositspent = deadtxid;
}
if ( flag == 0 && (bits256_nonz(rswap.paymentspent) != 0 || time(NULL) > rswap.plocktime+777+120) )
if ( flag == 0 && (bits256_nonz(rswap.Apaymentspent) != 0 || time(NULL) > rswap.dlocktime-777 || (bits256_nonz(rswap.txids[BASILISK_ALICEPAYMENT]) == 0 && time(NULL) > rswap.dlocktime-2*INSTANTDEX_LOCKTIME+777) || (bits256_nonz(rswap.txids[BASILISK_BOBPAYMENT]) == 0 && time(NULL) > rswap.dlocktime-3*INSTANTDEX_LOCKTIME/2)) )
{
//printf("do the refund! paymentspent.%s now.%u vs expiration.%u\n",bits256_str(str,rswap.paymentspent),(uint32_t)time(NULL),rswap.expiration);
//if ( txbytes[BASILISK_BOBREFUND] == 0 )
@ -1404,7 +1407,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
LP_totals_update(rswap.iambob,rswap.alicecoin,rswap.bobcoin,KMDtotals,BTCtotals,rswap.sentflags,rswap.values);
if ( (numspent= LP_spends_set(&rswap)) == 3 )
rswap.finishedflag = 1;
else rswap.finishedflag = basilisk_swap_isfinished(rswap.expiration,rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent);
else rswap.finishedflag = basilisk_swap_isfinished(requestid,quoteid,rswap.expiration,rswap.iambob,rswap.txids,rswap.sentflags,rswap.paymentspent,rswap.Apaymentspent,rswap.depositspent);
if ( rswap.origfinishedflag == 0 && rswap.finishedflag != 0 )
{
char fname[1024],*itemstr; FILE *fp;

31
iguana/exchanges/LP_rpc.c

@ -601,14 +601,17 @@ cJSON *LP_importprivkey(char *symbol,char *wifstr,char *label,int32_t flag)
double _LP_getestimatedrate(struct iguana_info *coin)
{
char buf[512],*retstr=0; int32_t numblocks; cJSON *errjson,*retjson; double rate = 0.00000020;
char buf[512],*retstr=0; int32_t numblocks,err=0; cJSON *errjson,*retjson; double rate = 0.00000020;
if ( coin->rate < 0. || time(NULL) > coin->ratetime+30 )
{
if ( coin->estimatefeestr[0] == 0 )
strcpy(coin->estimatefeestr,"estimatefee");
numblocks = strcmp(coin->symbol,"BTC") == 0 ? 6 : 2;
again:
if ( coin->electrum == 0 )
{
sprintf(buf,"[%d]",numblocks);
retstr = LP_apicall(coin,"estimatefee",buf);
retstr = LP_apicall(coin,coin->estimatefeestr,buf);
}
else
{
@ -620,13 +623,27 @@ double _LP_getestimatedrate(struct iguana_info *coin)
if ( retstr[0] == '{' && (errjson= cJSON_Parse(retstr)) != 0 )
{
if ( jobj(errjson,"error") != 0 )
{
rate = 0.;
err++;
}
if ( strcmp(coin->estimatefeestr,"estimatesmartfee") == 0 && (rate= jdouble(errjson,"feerate")) != 0 )
{
printf("extracted feerate %.8f from estimatesmartfee\n",rate);
rate /= 1024.;
}
free_json(errjson);
}
else if ( retstr[0] != '-' )
{
rate = atof(retstr) / 1024.;
if ( rate < 0.00000020 )
if ( rate != 0. )
{
if ( strcmp("BTC",coin->symbol) == 0 )
{
if ( rate < 0.00000100 )
rate = 0.00000100;
}
else if ( rate < 0.00000020 )
rate = 0.00000020;
rate *= 1.5;
if ( coin->electrum != 0 )
@ -637,6 +654,12 @@ double _LP_getestimatedrate(struct iguana_info *coin)
coin->ratetime = (uint32_t)time(NULL);
}
free(retstr);
if ( err == 1 && coin->electrum == 0 && strcmp("BTC",coin->symbol) == 0 )
{
strcpy(coin->estimatefeestr,"estimatesmartfee");
err = 2;
goto again;
}
} else rate = coin->rate;
} else rate = coin->rate;
return(rate);

2
iguana/exchanges/LP_secp.c

@ -99,7 +99,7 @@ int32_t bitcoin_sign(void *ctx,char *symbol,uint8_t *sig,bits256 txhash2,bits256
}
if ( strcmp(symbol,"BCH") == 0 || strcmp(symbol,"BTG") == 0 )
{
char str[65]; printf("BCH/BTG deterministic signature %s\n",bits256_str(str,txhash2));
//char str[65]; printf("BCH/BTG deterministic signature %s\n",bits256_str(str,txhash2));
funcp = 0;
entropy = 0;
} else entropy = extra_entropy.bytes;

22
iguana/exchanges/LP_socket.c

@ -527,12 +527,14 @@ cJSON *electrum_address_subscribe(char *symbol,struct electrum_info *ep,cJSON **
cJSON *electrum_scripthash_cmd(char *symbol,uint8_t taddr,struct electrum_info *ep,cJSON **retjsonp,char *cmd,char *coinaddr)
{
uint8_t addrtype,rmd160[20]; char scripthash[51],rmdstr[41],cmdbuf[128];
uint8_t addrtype,rmd160[20]; char btcaddr[64],cmdbuf[128]; //char scripthash[51],rmdstr[41],;
bitcoin_addr2rmd160(symbol,taddr,&addrtype,rmd160,coinaddr);
init_hexbytes_noT(rmdstr,rmd160,20);
sprintf(scripthash,"%s",rmdstr);
sprintf(cmdbuf,"blockchain.scripthash.%s",cmd);
return(electrum_strarg(symbol,ep,retjsonp,cmdbuf,scripthash,ELECTRUM_TIMEOUT));
bitcoin_address("BTC",btcaddr,0,addrtype,rmd160,20);
//init_hexbytes_noT(rmdstr,rmd160,20);
//sprintf(scripthash,"%s",rmdstr);
//sprintf(cmdbuf,"blockchain.scripthash.%s",cmd);
sprintf(cmdbuf,"blockchain.address.%s",cmd);
return(electrum_strarg(symbol,ep,retjsonp,cmdbuf,btcaddr,ELECTRUM_TIMEOUT));
}
cJSON *electrum_address_gethistory(char *symbol,struct electrum_info *ep,cJSON **retjsonp,char *addr,bits256 reftxid)
@ -637,17 +639,17 @@ cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON
retstr = jprint(retjson,0);
LP_unspents_cache(coin->symbol,addr,retstr,1);
free(retstr);
if ( ap != 0 )
{
ap->unspenttime = (uint32_t)time(NULL);
ap->unspentheight = height;
}
}
else
{
free_json(retjson);
retjson = 0;
}
if ( ap != 0 )
{
ap->unspenttime = (uint32_t)time(NULL);
ap->unspentheight = height;
}
}
}
if ( retjson == 0 )

59
iguana/exchanges/LP_swap.c

@ -750,14 +750,15 @@ uint32_t LP_swapdata_rawtxsend(int32_t pairsock,struct basilisk_swap *swap,uint3
return(0);
}
int32_t LP_swapwait(struct basilisk_swap *swap,uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t sleeptime)
uint32_t LP_swapwait(uint32_t expiration,uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t sleeptime)
{
char *retstr; cJSON *retjson=0; uint32_t expiration = (uint32_t)(time(NULL) + duration);
printf("wait %d:%d for SWAP.(r%u/q%u) to complete\n",duration,sleeptime,requestid,quoteid);
sleep(sleeptime/3);
//if ( sleeptime < divisor*60 )
// sleeptime = divisor * 60;
while ( time(NULL) < expiration )
char *retstr; uint32_t finished = 0; cJSON *retjson=0;
if ( sleeptime != 0 )
{
printf("wait %d:%d for SWAP.(r%u/q%u) to complete\n",duration,sleeptime,requestid,quoteid);
sleep(sleeptime/3);
}
while ( expiration == 0 || time(NULL) < expiration )
{
if ( (retstr= basilisk_swapentry(requestid,quoteid,1)) != 0 )
{
@ -765,31 +766,40 @@ int32_t LP_swapwait(struct basilisk_swap *swap,uint32_t requestid,uint32_t quote
{
if ( jstr(retjson,"status") != 0 && strcmp(jstr(retjson,"status"),"finished") == 0 )
{
swap->I.finished = (uint32_t)time(NULL);
finished = (uint32_t)time(NULL);
free(retstr);
break;
}
//else printf("NOT FINISHED.(%s)\n",jprint(retjson,0));
else if ( expiration != 0 && time(NULL) > expiration )
printf("NOT FINISHED.(%s)\n",jprint(retjson,0));
free_json(retjson);
retjson = 0;
}
free(retstr);
}
sleep(sleeptime);
//sleep(sleeptime/divisor);
//if ( divisor > 1 )
// divisor--;
if ( sleeptime != 0 )
sleep(sleeptime);
if ( duration < 0 )
break;
}
if ( retjson != 0 )
{
printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>\nSWAP completed! %u-%u %s\n",requestid,quoteid,jprint(retjson,0));
free_json(retjson);
if ( 0 && (retstr= basilisk_swapentry(requestid,quoteid,1)) != 0 )
if ( (retstr= basilisk_swapentry(requestid,quoteid,1)) != 0 )
{
printf("second call.(%s)\n",retstr);
printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>\nSWAP completed! %u-%u %s\n",requestid,quoteid,retstr);
free(retstr);
}
return(finished);
}
else
{
if ( expiration != 0 && time(NULL) > expiration )
printf("\nSWAP did not complete! %u-%u %s\n",requestid,quoteid,jprint(retjson,0));
if ( duration > 0 )
LP_pendswap_add(expiration,requestid,quoteid);
return(0);
} else return(-1);
}
}
void LP_bobloop(void *_swap)
@ -867,16 +877,17 @@ void LP_bobloop(void *_swap)
basilisk_bobpayment_reclaim(swap,swap->I.callduration);
if ( swap->N.pair >= 0 )
nn_close(swap->N.pair), swap->N.pair = -1;
LP_swap_endcritical = (uint32_t)time(NULL);
LP_swapwait(swap,swap->I.req.requestid,swap->I.req.quoteid,LP_atomic_locktime(bobstr,alicestr)*2,swap->I.aliceconfirms == 0 ? 3 : 30);
}
}
}
} else printf("swap timed out\n");
G.LP_pendingswaps--;
LP_swap_endcritical = (uint32_t)time(NULL);
LP_pendswap_add(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid);
//swap->I.finished = LP_swapwait(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid,LP_atomic_locktime(swap->I.bobstr,swap->I.alicestr)*3,swap->I.aliceconfirms == 0 ? 3 : 30);
basilisk_swap_finished(swap);
free(swap);
free(data);
G.LP_pendingswaps--;
}
void LP_aliceloop(void *_swap)
@ -945,17 +956,17 @@ void LP_aliceloop(void *_swap)
}
if ( swap->N.pair >= 0 )
nn_close(swap->N.pair), swap->N.pair = -1;
LP_swap_endcritical = (uint32_t)time(NULL);
// spending is done in LP_remember.c
LP_swapwait(swap,swap->I.req.requestid,swap->I.req.quoteid,LP_atomic_locktime(bobstr,alicestr)*2,swap->I.aliceconfirms == 0 ? 3 : 30);
}
}
}
}
}
free(data);
LP_swap_endcritical = (uint32_t)time(NULL);
LP_pendswap_add(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid);
//swap->I.finished = LP_swapwait(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid,LP_atomic_locktime(swap->I.bobstr,swap->I.alicestr)*3,swap->I.aliceconfirms == 0 ? 3 : 30);
basilisk_swap_finished(swap);
free(swap);
free(data);
G.LP_pendingswaps--;
}

2
iguana/exchanges/auto_chipsbtc

@ -1,2 +1,2 @@
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"minprice\":0.00002,\"maxprice\":0.0001,\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"CHIPS\",\"rel\":\"BTC\",\"margin\":0.05,\"refbase\":\"chips\",\"refrel\":\"coinmarketcap\"}"
curl --url "http://127.0.0.1:7783" --data "{\"minprice\":0.0001,\"maxprice\":0.0002,\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"CHIPS\",\"rel\":\"BTC\",\"margin\":0.05,\"refbase\":\"chips\",\"refrel\":\"coinmarketcap\"}"

2
iguana/exchanges/auto_chipskmd

@ -1,2 +1,2 @@
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"minprice\":0.04,\"maxprice\":0.1,\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"CHIPS\",\"rel\":\"KMD\",\"margin\":0.05,\"refbase\":\"chips\",\"refrel\":\"coinmarketcap\"}"
curl --url "http://127.0.0.1:7783" --data "{\"minprice\":0.2,\"maxprice\":0.4,\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"CHIPS\",\"rel\":\"KMD\",\"margin\":0.05,\"refbase\":\"chips\",\"refrel\":\"coinmarketcap\"}"

3
iguana/exchanges/calcaddress

@ -0,0 +1,3 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"calcaddress\",\"passphrase\":\"default\"}"

3
iguana/exchanges/coins

File diff suppressed because one or more lines are too long

91
iguana/exchanges/mm.c

@ -112,28 +112,53 @@ void LP_main(void *ptr)
}
}
void ETH_test()
int32_t ensure_writable(char *dirname)
{
BasicTxData txData; char* ethSignedTx;
strcpy(txData.amount, "1000000000000000000");
strcpy(txData.from, "0xA7EF3f65714AE266414C9E58bB4bAa4E6FB82B41");
strcpy(txData.to, "0x9387Fd3a016bB0205e4e131Dde886B9d2BC000A2");
strcpy(txData.secretKey, getenv("BOB_PK"));
BobSendsEthDepositInput input = {
.aliceAddress = "0x485d2cc2d13a9e12E4b53D606DB1c8adc884fB8a",
.depositId = "0x28c5a7c25911ef59a577ddf811d0e58edb827efb0646a8a38df6e921ba53f431",
.bobHash = "0xd66ca5295806fb95ead3f2be1d193a206a376371"
};
ethSignedTx = bobSendsEthDeposit(input, txData);
printf("ETH_test (%s)\n", ethSignedTx);
free(ethSignedTx);
char fname[512],str[65],str2[65]; bits256 r,check; FILE *fp;
OS_randombytes(r.bytes,sizeof(r));
sprintf(fname,"%s/checkval",dirname), OS_compatible_path(fname);
if ( (fp= fopen(fname,"wb")) == 0 )
{
printf("FATAL ERROR cant create %s\n",fname);
fprintf(stderr,"FATAL ERROR cant create %s\n",fname);
return(-1);
}
else if ( fwrite(r.bytes,1,sizeof(r),fp) != sizeof(r) )
{
printf("FATAL ERROR error writing %s\n",fname);
fprintf(stderr,"FATAL ERROR writing %s\n",fname);
return(-1);
}
else
{
fclose(fp);
if ( (fp= fopen(fname,"rb")) == 0 )
{
printf("FATAL ERROR cant open %s\n",fname);
fprintf(stderr,"FATAL ERROR cant open %s\n",fname);
return(-1);
}
else if ( fread(check.bytes,1,sizeof(check),fp) != sizeof(check) )
{
printf("FATAL ERROR error reading %s\n",fname);
fprintf(stderr,"FATAL ERROR reading %s\n",fname);
return(-1);
}
else if ( memcmp(check.bytes,r.bytes,sizeof(r)) != 0 )
{
printf("FATAL ERROR error comparint %s %s vs %s\n",fname,bits256_str(str,r),bits256_str(str2,check));
fprintf(stderr,"FATAL ERROR error comparint %s %s vs %s\n",fname,bits256_str(str,r),bits256_str(str2,check));
return(-1);
}
fclose(fp);
}
return(0);
}
int main(int argc, const char * argv[])
{
char dirname[512],*passphrase; double incr; cJSON *retjson;
char dirname[512]; double incr; cJSON *retjson;
OS_init();
//ETH_test();
if ( strstr(argv[0],"btc2kmd") != 0 && argv[1] != 0 )
{
uint8_t addrtype,rmd160[20],rmd160b[20]; char coinaddr[64],coinaddr2[64];
@ -211,7 +236,7 @@ int main(int argc, const char * argv[])
}
else if ( argv[1] != 0 && strcmp(argv[1],"airdropH") == 0 && argv[2] != 0 )
{
FILE *fp; double val,total = 0.; uint8_t checktype,addrtype,rmd160[21],checkrmd160[21]; char buf[256],checkaddr[64],coinaddr[64],manystrs[64][128],cmd[64*128]; int32_t n,i,num; char *flag;
FILE *fp; double val,total = 0.; uint8_t checktype,addrtype,rmd160[21],checkrmd160[21]; char *floatstr,*addrstr,buf[256],checkaddr[64],coinaddr[64],manystrs[64][128],cmd[64*128]; int32_t n,i,num; char *flag;
if ( (fp= fopen(argv[2],"rb")) != 0 )
{
num = 0;
@ -231,24 +256,26 @@ int main(int argc, const char * argv[])
}
if ( flag != 0 )
{
addrstr = flag, floatstr = buf;
//addrstr = buf, floatstr = flag;
//bitcoin_addr2rmd160("HUSH",28,&addrtype,rmd160,buf);
bitcoin_addr2rmd160("BTC",0,&addrtype,rmd160,buf);
bitcoin_address("KMD",coinaddr,0,addrtype == 184 ? 60 : 85,rmd160,20);
bitcoin_addr2rmd160("BTC",0,&addrtype,rmd160,addrstr);
bitcoin_address("KMD",coinaddr,0,addrtype == 0 ? 60 : 85,rmd160,20);
bitcoin_addr2rmd160("KMD",0,&checktype,checkrmd160,coinaddr);
//bitcoin_address("HUSH",checkaddr,28,checktype == 60 ? 184 : 189,checkrmd160,20);
bitcoin_address("BTC",checkaddr,0,checktype == 60 ? 0 : 5,checkrmd160,20);
if ( memcmp(rmd160,checkrmd160,20) != 0 || strcmp(buf,checkaddr) != 0 )
if ( memcmp(rmd160,checkrmd160,20) != 0 || strcmp(addrstr,checkaddr) != 0 )
{
for (i=0; i<20; i++)
printf("%02x",rmd160[i]);
printf(" vs. ");
for (i=0; i<20; i++)
printf("%02x",checkrmd160[i]);
printf(" address calc error (%s).%d -> (%s).%d -> (%s) %.8f?\n",buf,addrtype,coinaddr,checktype,checkaddr,atof(flag));
printf(" address calc error (%s).%d -> (%s).%d -> (%s) %.8f?\n",addrstr,addrtype,coinaddr,checktype,checkaddr,atof(floatstr));
}
else
{
val = atof(flag);
val = atof(floatstr);
sprintf(manystrs[num++],"\\\"%s\\\":%0.8f",coinaddr,val);
if ( num >= sizeof(manystrs)/sizeof(*manystrs) )
{
@ -256,12 +283,12 @@ int main(int argc, const char * argv[])
for (i=0; i<num; i++)
sprintf(cmd + strlen(cmd),"%s%s",manystrs[i],i<num-1?",":"");
strcat(cmd,"}\" 0");
printf("%s\n",cmd);
printf("%s\nsleep 3\n",cmd);
num = 0;
memset(manystrs,0,sizeof(manystrs));
}
total += val;
//printf("(%s).%d (%s) <- %.8f total %.8f\n",buf,addrtype,coinaddr,val,total);
//printf("(%s).%d (%s) <- %.8f (%s) total %.8f\n",addrstr,addrtype,coinaddr,val,floatstr,total);
}
} else printf("parse error for (%s)\n",buf);
}
@ -281,9 +308,17 @@ int main(int argc, const char * argv[])
exit(0);
}
sprintf(dirname,"%s",GLOBAL_DBDIR), OS_ensure_directory(dirname);
if ( ensure_writable(dirname) < 0 )
exit(0);
sprintf(dirname,"%s/SWAPS",GLOBAL_DBDIR), OS_ensure_directory(dirname);
if ( ensure_writable(dirname) < 0 )
exit(0);
sprintf(dirname,"%s/PRICES",GLOBAL_DBDIR), OS_ensure_directory(dirname);
if ( ensure_writable(dirname) < 0 )
exit(0);
sprintf(dirname,"%s/UNSPENTS",GLOBAL_DBDIR), OS_ensure_directory(dirname);
if ( ensure_writable(dirname) < 0 )
exit(0);
#ifdef FROM_JS
argc = 2;
retjson = cJSON_Parse("{\"client\":1,\"passphrase\":\"test\"}");
@ -304,10 +339,10 @@ int main(int argc, const char * argv[])
DOCKERFLAG = 1;
else if ( jstr(retjson,"docker") != 0 )
DOCKERFLAG = (uint32_t)calc_ipbits(jstr(retjson,"docker"));
if ( jobj(retjson,"passphrase") != 0 )
jdelete(retjson,"passphrase");
if ( (passphrase= jstr(retjson,"passphrase")) == 0 )
jaddstr(retjson,"passphrase","default");
//if ( jobj(retjson,"passphrase") != 0 )
// jdelete(retjson,"passphrase");
//if ( (passphrase= jstr(retjson,"passphrase")) == 0 )
// jaddstr(retjson,"passphrase","default");
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_main,(void *)retjson) != 0 )
{
printf("error launching LP_main (%s)\n",jprint(retjson,0));

2
iguana/exchanges/mshark

@ -1,4 +1,4 @@
#!/bin/bash
source userpass
# this will only work for watchonly addresses that have been rescanned and with active coins
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}, {\"coin\":\"bitcoin\",\"balance\":145}],\"divisor\":1400000}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"fundvalue\",\"address\":\"RTu3JZZKLJTcfNwBa19dWRagEfQq49STqC\",\"holdings\":[{\"coin\":\"iota\",\"balance\":1500000}, {\"coin\":\"bitcoin-cash\",\"balance\":1200}, {\"coin\":\"bitcoin\",\"balance\":137}, {\"coin\":\"chips\",\"balance\":100000}],\"divisor\":1400000}"

4
iguana/exchanges/prices/bet

@ -1,3 +1,3 @@
coin=BET
price=0.0005
invprice=2000
price=0.00075
invprice=1333.33

2
iguana/exchanges/run

@ -6,4 +6,4 @@ git pull;
cd ..;
./m_mm;
pkill -15 marketmaker;
$1 ./marketmaker "{\"gui\":\"nogui\", \"profitmargin\":0.01, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" &
stdbuf -oL $1 ./marketmaker "{\"gui\":\"nogui\", \"profitmargin\":0.01, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" &

24
iguana/iguana_notary.c

@ -135,7 +135,7 @@ int32_t dpow_hasnotarization(struct supernet_info *myinfo,struct iguana_info *co
void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime)
{
void **ptrs; char str[65]; cJSON *blockjson; struct iguana_info *coin; struct dpow_checkpoint checkpoint; int32_t freq,minsigs; //uint8_t pubkeys[64][33];
void **ptrs; char str[65]; cJSON *blockjson; struct iguana_info *coin; struct dpow_checkpoint checkpoint; int32_t freq,minsigs,i,ht; struct dpow_block *bp;
dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime);
checkpoint = dp->srcfifo[dp->srcconfirms];
if ( strcmp("BTC",dp->dest) == 0 )
@ -193,7 +193,7 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
{
//printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs);
dpow_heightfind(myinfo,dp,checkpoint.blockhash.height + 1000);
ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint));
ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint) + sizeof(pthread_t));
ptrs[0] = (void *)myinfo;
ptrs[1] = (void *)dp;
ptrs[2] = (void *)(uint64_t)minsigs;
@ -203,9 +203,22 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
ptrs[4] = 0;
memcpy(&ptrs[5],&checkpoint,sizeof(checkpoint));
dp->activehash = checkpoint.blockhash.hash;
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)dpow_statemachinestart,(void *)ptrs) != 0 )
ht = checkpoint.blockhash.height;
if ( OS_thread_create((void *)((uint64_t)&ptrs[5] + sizeof(struct dpow_checkpoint)),NULL,(void *)dpow_statemachinestart,(void *)ptrs) != 0 )
{
}
if ( ht > 100 )
{
for (i=ht-100; i>=0; i--)
{
if ( (bp= dp->blocks[i]) != 0 )
{
dp->blocks[i] = 0;
Numallocated--;
free(bp);
}
}
}
}
}
@ -556,9 +569,8 @@ STRING_ARG(iguana,addnotary,ipaddr)
return(clonestr("{\"result\":\"notary node added\"}"));
}
char NOTARY_CURRENCIES[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD",
"CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK",
"REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH" }; // "LTC",
char NOTARY_CURRENCIES[][16] = {
"REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH", "CHAIN" }; // "LTC", "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK",
void _iguana_notarystats(char *fname,int32_t totals[64],int32_t dispflag)
{

13
iguana/m_mm

@ -1,14 +1,11 @@
#!/bin/bash
cd secp256k1; ./m_unix; cd ..
cd ../crypto777; ./m_LP; cd ../iguana
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "Linux"
# Default is dynamic nanomsg for linux using this script
nanomsg_lib="-lnanomsg"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
echo "Mac OSX"
# on osx this script generates static libnanomsg and uses it to compile static marketmaker binary
nanomsg_lib="-lnanomsg"
# Build static libnanomsg on macOS
if [[ "$OSTYPE" == "darwin"* ]]; then
./build_static_nanomsg.sh
nanomsg_lib="../OSlibs/osx/$(uname -m)/libnanomsg-static.a"
fi

89
marketmaker_build_depends.cmd

@ -0,0 +1,89 @@
@echo off
rem [ Decker] Automatically download and build depends script for marketmaker.
rem
rem 1. Requires installed CMake for Windows (!)
rem 2. Currently build only 64-bit release versions of .lib and .dll
rem 3. Libraries available: pthreads, nanomsg, curl
@REM Check for Visual Studio
call set "VSPATH="
if defined VS140COMNTOOLS ( if not defined VSPATH (
call set "VSPATH=%%VS140COMNTOOLS%%"
) )
@REM check if we already have the tools in the environment
if exist "%VCINSTALLDIR%" (
goto compile
)
if not defined VSPATH (
echo You need Microsoft Visual Studio 15 installed
pause
exit
)
@REM set up the environment
if exist "%VSPATH%..\..\vc\vcvarsall.bat" (
call "%%VSPATH%%..\..\vc\vcvarsall.bat" amd64
goto compile
)
echo Unable to set up the environment
pause
exit
:compile
rem MSBuild /help
echo.
echo Decker will automatically download and build all needed *.dll and *.lib for you ;)
timeout /t 5 /nobreak
mkdir marketmaker_depends
mkdir x64\Release
rem --- pthreads ---
:compile_pthreads
cd marketmaker_depends
git clone https://github.com/DeckerSU/pthread-win32
cd pthread-win32
MSBuild pthread.2015.sln /t:Rebuild /p:Configuration=Release /p:Platform=Win32
MSBuild pthread.2015.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64
cd ../..
copy marketmaker_depends\pthread-win32\bin\x64_MSVC2015.Release\pthread_lib.lib OSlibs\win\x64\pthread_lib.lib
rem --- nanomsg ---
:compile_nanomsg
cd marketmaker_depends
git clone https://github.com/nanomsg/nanomsg
cd nanomsg
mkdir build_msvc_2015_win32
mkdir build_msvc_2015_win64
cd build_msvc_2015_win64
cmake -G "Visual Studio 14 2015 Win64" ..
cmake --build . --config Release --target nanomsg
cd ../../..
copy marketmaker_depends\nanomsg\build_msvc_2015_win64\Release\nanomsg.lib OSlibs\win\x64\release\nanomsg.lib
copy marketmaker_depends\nanomsg\build_msvc_2015_win64\Release\nanomsg.exp OSlibs\win\x64\release\nanomsg.exp
copy marketmaker_depends\nanomsg\build_msvc_2015_win64\Release\nanomsg.dll x64\Release\nanomsg.dll
rem --- curl ---
:compile_curl
cd marketmaker_depends
git clone https://github.com/curl/curl
cd curl
mkdir build_msvc_2015_win32
mkdir build_msvc_2015_win64
cd build_msvc_2015_win64
cmake -G "Visual Studio 14 2015 Win64" ..
cmake --build . --config Release --target libcurl
rem cmake .. -G"Visual Studio 14 2015 Win64" -DCURL_STATICLIB=ON -DCURL_DISABLE_LDAP=ON -DCURL_STATIC_CRT=ON
rem cmake .. -G"Visual Studio 14 2015 Win64" -DCURL_STATICLIB:BOOL=ON -DCURL_STATIC_CRT:BOOL=ON -DHTTP_ONLY:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=RELEASE ..
rem cmake --build . --config Release
rem cmake --build . --config Release --target libcurl
cd ../../..
copy marketmaker_depends\curl\build_msvc_2015_win64\lib\Release\libcurl_imp.lib OSlibs\win\x64\release\libcurl.lib
copy marketmaker_depends\curl\build_msvc_2015_win64\lib\Release\libcurl_imp.exp OSlibs\win\x64\release\libcurl.exp
copy marketmaker_depends\curl\build_msvc_2015_win64\lib\Release\libcurl.dll x64\Release\libcurl.dll
Loading…
Cancel
Save