Browse Source

#66 Possibly finish forcing 1 ETOMIC for ETH/ERC20 trades.

pass-iguana-arg
Artem Pikulin 7 years ago
parent
commit
bfdf9a3265
  1. 16
      iguana/exchanges/LP_ordermatch.c
  2. 4
      iguana/exchanges/LP_swap.c
  3. 2
      iguana/exchanges/LP_utxo.c
  4. 10
      start_BEER_OTHER_trade.sh
  5. 10
      start_BEER_OTHER_trade_inverted.sh

16
iguana/exchanges/LP_ordermatch.c

@ -195,7 +195,7 @@ double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,str
printf("destvalue %.8f destsatoshis %.8f is too small txfee %.8f?\n",dstr(destvalue),dstr(qp->destsatoshis),dstr(qp->desttxfee)); printf("destvalue %.8f destsatoshis %.8f is too small txfee %.8f?\n",dstr(destvalue),dstr(qp->destsatoshis),dstr(qp->desttxfee));
return(-11); return(-11);
} }
if ( butxo != 0 && srcvalue < qp->txfee+qp->satoshis ) if ( strcmp(srccoin, "ETOMIC") != 0 && butxo != 0 && srcvalue < qp->txfee+qp->satoshis )
{ {
printf("srcvalue %.8f [%.8f] satoshis %.8f is too small txfee %.8f?\n",dstr(srcvalue),dstr(srcvalue) - dstr(qp->txfee+qp->satoshis),dstr(qp->satoshis),dstr(qp->txfee)); printf("srcvalue %.8f [%.8f] satoshis %.8f is too small txfee %.8f?\n",dstr(srcvalue),dstr(srcvalue) - dstr(qp->txfee+qp->satoshis),dstr(qp->satoshis),dstr(qp->txfee));
return(-33); return(-33);
@ -213,7 +213,7 @@ double LP_quote_validate(struct LP_utxoinfo *autxo,struct LP_utxoinfo *butxo,str
printf("error -14: txfee %.8f < %.8f or desttxfee %.8f < %.8f\n",dstr(qp->txfee),dstr(LP_REQUIRED_TXFEE*txfee),dstr(qp->desttxfee),dstr(LP_REQUIRED_TXFEE*desttxfee)); printf("error -14: txfee %.8f < %.8f or desttxfee %.8f < %.8f\n",dstr(qp->txfee),dstr(LP_REQUIRED_TXFEE*txfee),dstr(qp->desttxfee),dstr(LP_REQUIRED_TXFEE*desttxfee));
return(-14); return(-14);
} }
if ( butxo != 0 ) if ( butxo != 0 && strcmp(srccoin, "ETOMIC") != 0)
{ {
if ( qp->satoshis < (srcvalue / LP_MINVOL) || srcvalue < qp->txfee*LP_MINSIZE_TXFEEMULT ) if ( qp->satoshis < (srcvalue / LP_MINVOL) || srcvalue < qp->txfee*LP_MINSIZE_TXFEEMULT )
{ {
@ -413,14 +413,22 @@ struct LP_utxoinfo *LP_address_myutxopair(struct LP_utxoinfo *butxo,int32_t iamb
memset(butxo,0,sizeof(*butxo)); memset(butxo,0,sizeof(*butxo));
if ( iambob != 0 ) if ( iambob != 0 )
{ {
if (strcmp(coin->symbol, "ETOMIC") == 0) {
targetval = 100000000 + 3*txfee;
} else {
targetval = LP_basesatoshis(relvolume,price,txfee,desttxfee) + 3*txfee; targetval = LP_basesatoshis(relvolume,price,txfee,desttxfee) + 3*txfee;
}
targetval2 = (targetval / 8) * 9 + 3*txfee; targetval2 = (targetval / 8) * 9 + 3*txfee;
fee = txfee; fee = txfee;
ratio = LP_MINVOL; ratio = LP_MINVOL;
} }
else else
{ {
if (strcmp(coin->symbol, "ETOMIC") == 0) {
targetval = 100000000 + 3*desttxfee;
} else {
targetval = relvolume*SATOSHIDEN + 3*desttxfee; targetval = relvolume*SATOSHIDEN + 3*desttxfee;
}
targetval2 = (targetval / 777) + 3*desttxfee; targetval2 = (targetval / 777) + 3*desttxfee;
fee = desttxfee; fee = desttxfee;
ratio = LP_MINCLIENTVOL; ratio = LP_MINCLIENTVOL;
@ -1009,7 +1017,11 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru
qp->vout = butxo->payment.vout; qp->vout = butxo->payment.vout;
qp->txid2 = butxo->deposit.txid; qp->txid2 = butxo->deposit.txid;
qp->vout2 = butxo->deposit.vout; qp->vout2 = butxo->deposit.vout;
if (coin->etomic[0] == 0) {
qp->satoshis = butxo->swap_satoshis;// + qp->txfee; qp->satoshis = butxo->swap_satoshis;// + qp->txfee;
} else {
qp->satoshis = LP_basesatoshis(dstr(qp->destsatoshis), price, qp->txfee, qp->desttxfee);
}
qp->quotetime = (uint32_t)time(NULL); qp->quotetime = (uint32_t)time(NULL);
} }
else else

4
iguana/exchanges/LP_swap.c

@ -1201,11 +1201,11 @@ struct basilisk_swap *bitcoin_swapinit(bits256 privkey,uint8_t *pubkey33,bits256
#ifndef NOTETOMIC #ifndef NOTETOMIC
if (strcmp(alicestr, "ETOMIC") == 0) { if (strcmp(alicestr, "ETOMIC") == 0) {
swap->I.alicerealsat = swap->I.alicesatoshis; swap->I.alicerealsat = swap->I.alicesatoshis;
//swap->I.alicesatoshis = 100000000; swap->I.alicesatoshis = 100000000;
} }
if (strcmp(bobstr, "ETOMIC") == 0) { if (strcmp(bobstr, "ETOMIC") == 0) {
swap->I.bobrealsat = swap->I.bobsatoshis; swap->I.bobrealsat = swap->I.bobsatoshis;
//swap->I.bobsatoshis = 100000000; swap->I.bobsatoshis = 100000000;
} }
#endif #endif
if ( (swap->I.bobinsurance= (swap->I.bobsatoshis / INSTANTDEX_INSURANCEDIV)) < LP_MIN_TXFEE ) if ( (swap->I.bobinsurance= (swap->I.bobsatoshis / INSTANTDEX_INSURANCEDIV)) < LP_MIN_TXFEE )

2
iguana/exchanges/LP_utxo.c

@ -1192,7 +1192,7 @@ int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol
return(-1); return(-1);
} }
destaddr[0] = destaddr2[0] = 0; destaddr[0] = destaddr2[0] = 0;
if ( coin != 0 && IAMLP != 0 && coin->inactive != 0 ) if ( coin != 0 && (strcmp(coin->symbol, "ETOMIC") == 0 || (coin->inactive != 0 && IAMLP != 0)))
bypass = 1; bypass = 1;
if ( bypass != 0 ) if ( bypass != 0 )
val = satoshis; val = satoshis;

10
start_BEER_OTHER_trade.sh

@ -1,12 +1,8 @@
#!/bin/bash #!/bin/bash
docker-compose exec -T clientnode ./setpassphrase
sleep 5
docker-compose exec -T clientnode ./enable docker-compose exec -T clientnode ./enable
sleep 5 sleep 3
docker-compose exec -T seednode ./setpassphrase
sleep 5
docker-compose exec -T seednode ./enable docker-compose exec -T seednode ./enable
sleep 5 sleep 3
docker-compose exec -T seednode ./sell_BEER_OTHER $1 docker-compose exec -T seednode ./sell_BEER_OTHER $1
sleep 5 sleep 3
docker-compose exec -T clientnode ./buy_BEER_OTHER $1 docker-compose exec -T clientnode ./buy_BEER_OTHER $1

10
start_BEER_OTHER_trade_inverted.sh

@ -1,12 +1,8 @@
#!/bin/bash #!/bin/bash
docker-compose exec -T clientnode ./setpassphrase
sleep 5
docker-compose exec -T clientnode ./enable docker-compose exec -T clientnode ./enable
sleep 5 sleep 3
docker-compose exec -T seednode ./setpassphrase
sleep 5
docker-compose exec -T seednode ./enable docker-compose exec -T seednode ./enable
sleep 5 sleep 3
docker-compose exec -T clientnode ./buy_BEER_OTHER $1 docker-compose exec -T clientnode ./buy_BEER_OTHER $1
sleep 5 sleep 3
docker-compose exec -T seednode ./sell_BEER_OTHER $1 docker-compose exec -T seednode ./sell_BEER_OTHER $1
Loading…
Cancel
Save