diff --git a/iguana/exchanges/LP_etomic.c b/iguana/exchanges/LP_etomic.c index 0086b47d3..c6f135a42 100644 --- a/iguana/exchanges/LP_etomic.c +++ b/iguana/exchanges/LP_etomic.c @@ -28,15 +28,23 @@ 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]; + char amount[100], secretKey[70], dexaddr[50]; satoshisToWei(amount, swap->myfee.I.amount); uint8arrayToHex(secretKey, swap->persistent_privkey.bytes, 32); + LP_etomic_pubkeystr_to_addr(INSTANTDEX_PUBKEY, dexaddr); if (strcmp(swap->I.alicestr,"ETH") == 0 ) { - return(sendEth(ETH_FEE_ACCEPTOR, amount, secretKey, 1)); + return(sendEth(dexaddr, amount, secretKey, 1)); } else { - return(sendErc20(swap->I.alicetomic, ETH_FEE_ACCEPTOR, amount, secretKey, 1)); + return(sendErc20(swap->I.alicetomic, dexaddr, amount, secretKey, 1)); } } @@ -52,8 +60,10 @@ 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 (strcmp(data.to, ETH_FEE_ACCEPTOR) != 0) { + if (strcmp(data.to, dexaddr) != 0) { printf("Alice fee %s was sent to wrong address %s\n", swap->otherfee.I.ethTxid, data.to); return(0); } @@ -70,7 +80,7 @@ uint8_t LP_etomic_verify_alice_fee(struct basilisk_swap *swap) } char weiAmount[70]; satoshisToWei(weiAmount, swap->otherfee.I.amount); - return(verifyAliceErc20FeeData(swap->I.alicetomic, ETH_FEE_ACCEPTOR, weiAmount, data.input)); + return(verifyAliceErc20FeeData(swap->I.alicetomic, dexaddr, weiAmount, data.input)); } } diff --git a/iguana/exchanges/etomicswap/bob.c b/iguana/exchanges/etomicswap/bob.c index 794b0b533..6b3f28261 100644 --- a/iguana/exchanges/etomicswap/bob.c +++ b/iguana/exchanges/etomicswap/bob.c @@ -330,11 +330,14 @@ int main(int argc, char** argv) default: return 1; } - /* char *pubkey = getPubKeyFromPriv(getenv("BOB_PK")); printf("pubkey: %s\n", pubkey); free(pubkey); + char *address = pubKey2Addr("03bc2c7ba671bae4a6fc835244c9762b41647b9827d4780a89a949b984a8ddcc06"); + printf("address: %s\n", address); + free(address); + uint64_t satoshis = 100000000; char weiBuffer[100]; satoshisToWei(weiBuffer, satoshis); @@ -346,16 +349,15 @@ int main(int argc, char** argv) uint64_t tokenAllowance = getErc20Allowance(bobAddress, bobContractAddress, tokenAddress); printf("allowance: %" PRIu64 "\n", tokenAllowance); - char *sendEthTx = sendEth(bobAddress, "100000000000000", getenv("BOB_PK")); + char *sendEthTx = sendEth(bobAddress, "100000000000000", getenv("BOB_PK"), 0); printf("sent ETH: %s\n", sendEthTx); free(sendEthTx); - char *sendErc20Tx = sendErc20(tokenAddress, bobAddress, "100000000000000", getenv("BOB_PK")); + char *sendErc20Tx = sendErc20(tokenAddress, bobAddress, "100000000000000", getenv("BOB_PK"), 0); printf("sent Erc20: %s\n", sendErc20Tx); free(sendErc20Tx); uint64_t gasPrice = getGasPriceFromStation(); printf("gasPrice: %" PRIu64 "\n", gasPrice); - */ return 0; } diff --git a/iguana/exchanges/etomicswap/etomiclib.h b/iguana/exchanges/etomicswap/etomiclib.h index cc5ccebfc..c7b846ddb 100644 --- a/iguana/exchanges/etomicswap/etomiclib.h +++ b/iguana/exchanges/etomicswap/etomiclib.h @@ -16,7 +16,6 @@ extern "C" { #endif #define EMPTY_ETH_TX_ID "0x0000000000000000000000000000000000000000000000000000000000000000" -#define ETH_FEE_ACCEPTOR "0x485d2cc2d13a9e12e4b53d606db1c8adc884fb8a" typedef struct { char from[65];