Browse Source

Fix txversion for assetchains, BEER and PIZZA. Fix ETH dexfee addr.

blackjok3r
Artem Pikulin 6 years ago
parent
commit
b3bbcd2026
  1. 1
      .dockerignore
  2. 16
      iguana/exchanges/LP_coins.c
  3. 20
      iguana/exchanges/LP_etomic.c
  4. 1
      iguana/exchanges/LP_include.h

1
.dockerignore

@ -1,3 +1,4 @@
.git
.vscode
cmake-build-debug
target

16
iguana/exchanges/LP_coins.c

@ -385,9 +385,6 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse
char *name2; uint16_t origport = port;
memset(coin,0,sizeof(*coin));
safecopy(coin->symbol,symbol,sizeof(coin->symbol));
if ( strcmp(symbol,"PART") == 0 )
coin->txversion = 160;
else coin->txversion = txversion;
coin->updaterate = (uint32_t)time(NULL);
coin->isPoS = isPoS;
coin->taddr = taddr;
@ -423,7 +420,7 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse
sprintf(coin->serverport,"127.0.0.1:%u",port);
if ( port != origport )
printf("set curl path for %s to %s\n",symbol,coin->serverport);
if ( strcmp(symbol,"KMD") == 0 || coin->isassetchain != 0 || taddr != 0 )
if ( strcmp(symbol,"KMD") == 0 || strcmp(symbol,"BEER") == 0 || strcmp(symbol,"PIZZA") == 0 || coin->isassetchain != 0 || taddr != 0 )
coin->zcash = LP_IS_ZCASHPROTOCOL;
else if ( strcmp(symbol,"BCH") == 0 )
{
@ -443,6 +440,15 @@ uint16_t LP_coininit(struct iguana_info *coin,char *symbol,char *name,char *asse
coin->curl_handle = curl_easy_init();
portable_mutex_init(&coin->curl_mutex);
coin->decimals = decimals;
if ( strcmp(symbol,"PART") == 0 ) {
coin->txversion = 160;
} else if ( coin->isassetchain != 0 && strcmp(symbol,"OOT") != 0 && strcmp(symbol,"ZILLA") != 0 ) {
coin->txversion = 4;
} else if ( strcmp(name,"BEER") == 0 || strcmp("PIZZA",name) == 0 || strcmp("KMD",name) == 0 ) {
coin->txversion = 4;
} else {
coin->txversion = txversion;
}
return(port);
}
@ -541,8 +547,6 @@ struct iguana_info *LP_coincreate(cJSON *item)
{
coin = LP_coinadd(&cdata);
coin->inactive = (uint32_t)time(NULL);
if ( coin->isassetchain != 0 && strcmp(symbol,"OOT") != 0 && strcmp(symbol,"ZILLA") != 0 )
coin->txversion = 4;
} else coin = LP_coinadd(&cdata);
} else if ( symbol != 0 && jobj(item,"rpcport") == 0 )
printf("SKIP %s, missing rpcport field in coins array\n",symbol);

20
iguana/exchanges/LP_etomic.c

@ -31,26 +31,18 @@ int32_t LP_etomic_wait_for_confirmation(char *txId)
return(waitForConfirmation(txId));
}
void LP_etomic_pubkeystr_to_addr(char *pubkey, char *output)
{
char *address = pubKey2Addr(pubkey);
strcpy(output, address);
free(address);
}
char *LP_etomicalice_send_fee(struct basilisk_swap *swap)
{
char amount[100], secretKey[70], dexaddr[50];
char amount[100], secretKey[70];
satoshisToWei(amount, LP_DEXFEE(swap->I.alicerealsat));
swap->myfee.I.eth_amount = LP_DEXFEE(swap->I.alicerealsat);
uint8arrayToHex(secretKey, swap->persistent_privkey.bytes, 32);
LP_etomic_pubkeystr_to_addr(INSTANTDEX_PUBKEY, dexaddr);
if (strcmp(swap->I.alicestr,"ETH") == 0 ) {
return(sendEth(dexaddr, amount, secretKey, 1, 0, 0, 1));
return(sendEth(INSTANTDEX_ETHADDR, amount, secretKey, 1, 0, 0, 1));
} else {
struct iguana_info *alicecoin = LP_coinfind(swap->I.alicestr);
return(sendErc20(swap->I.alicetomic, dexaddr, amount, secretKey, 1, 0, 0, 1, alicecoin->decimals));
return(sendErc20(swap->I.alicetomic, INSTANTDEX_ETHADDR, amount, secretKey, 1, 0, 0, 1, alicecoin->decimals));
}
}
@ -66,10 +58,8 @@ uint8_t LP_etomic_verify_alice_fee(struct basilisk_swap *swap)
return(0);
}
char dexaddr[50];
LP_etomic_pubkeystr_to_addr(INSTANTDEX_PUBKEY, dexaddr);
if ( strcmp(swap->I.alicestr,"ETH") == 0 ) {
if (compareAddresses(data.to, dexaddr) == 0) {
if (compareAddresses(data.to, INSTANTDEX_ETHADDR) == 0) {
printf("Alice fee %s was sent to wrong address %s\n", swap->otherfee.I.ethTxid, data.to);
return(0);
}
@ -88,7 +78,7 @@ uint8_t LP_etomic_verify_alice_fee(struct basilisk_swap *swap)
}
char weiAmount[70];
satoshisToWei(weiAmount, LP_DEXFEE(swap->I.alicerealsat));
return(verifyAliceErc20FeeData(swap->I.alicetomic, dexaddr, weiAmount, data.input, alicecoin->decimals));
return(verifyAliceErc20FeeData(swap->I.alicetomic, INSTANTDEX_ETHADDR, weiAmount, data.input, alicecoin->decimals));
}
}

1
iguana/exchanges/LP_include.h

@ -112,6 +112,7 @@ void emscripten_usleep(int32_t x); // returns immediate, no sense for sleeping
#define INSTANTDEX_LOCKTIME (3600*2 + 300*2)
#define INSTANTDEX_INSURANCEDIV 777
#define INSTANTDEX_PUBKEY "03bc2c7ba671bae4a6fc835244c9762b41647b9827d4780a89a949b984a8ddcc06"
#define INSTANTDEX_ETHADDR "0xd8997941dd1346e9231118d5685d866294f59e5b"
#define INSTANTDEX_RMD160 "ca1e04745e8ca0c60d8c5881531d51bec470743f"
#define JUMBLR_RMD160 "5177f8b427e5f47342a4b8ab5dac770815d4389e"
#define TIERNOLAN_RMD160 "daedddd8dbe7a2439841ced40ba9c3d375f98146"

Loading…
Cancel
Save