From c2d500708e8795d3cf848c27a6793af747a3d1e7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 19 Feb 2018 21:14:01 +0200 Subject: [PATCH] Mainnet toggle --- iguana/exchanges/LP_etomic.c | 4 ---- iguana/exchanges/LP_prices.c | 2 +- iguana/exchanges/etomicswap/etomiccurl.c | 2 +- iguana/exchanges/etomicswap/etomiccurl.h | 10 +++++++++- iguana/exchanges/etomicswap/etomiclib.cpp | 4 ++-- iguana/exchanges/etomicswap/etomiclib.h | 14 ++++++++++++++ 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/iguana/exchanges/LP_etomic.c b/iguana/exchanges/LP_etomic.c index e9f153da3..c263738de 100644 --- a/iguana/exchanges/LP_etomic.c +++ b/iguana/exchanges/LP_etomic.c @@ -25,10 +25,6 @@ #include "etomicswap/etomiccurl.h" #include -#define ETOMIC_ALICECONTRACT "0xe1D4236C5774D35Dc47dcc2E5E0CcFc463A3289c" -#define ETOMIC_BOBCONTRACT "0x9387Fd3a016bB0205e4e131Dde886B9d2BC000A2" -#define ETOMIC_SATOSHICAT "0000000000" - char *LP_etomicalice_send_payment(struct basilisk_swap *swap) { AliceSendsEthPaymentInput input; AliceSendsErc20PaymentInput input20; BasicTxData txData; diff --git a/iguana/exchanges/LP_prices.c b/iguana/exchanges/LP_prices.c index b04d062fb..603faab5c 100644 --- a/iguana/exchanges/LP_prices.c +++ b/iguana/exchanges/LP_prices.c @@ -515,7 +515,7 @@ int32_t LP_mypriceset(int32_t *changedp,char *base,char *rel,double price) struct LP_priceinfo *basepp,*relpp; struct LP_pubkey_info *pubp; double minprice,maxprice; *changedp = 0; //if ( strcmp("DEX",base) == 0 || strcmp("DEX",rel) == 0 ) - // printf("%s/%s setprice %.8f\n",base,rel,price); + printf("%s/%s setprice %.8f\n",base,rel,price); if ( base != 0 && rel != 0 && (basepp= LP_priceinfofind(base)) != 0 && (relpp= LP_priceinfofind(rel)) != 0 ) { diff --git a/iguana/exchanges/etomicswap/etomiccurl.c b/iguana/exchanges/etomicswap/etomiccurl.c index 4212e7614..f80e87d3e 100644 --- a/iguana/exchanges/etomicswap/etomiccurl.c +++ b/iguana/exchanges/etomicswap/etomiccurl.c @@ -4,7 +4,7 @@ #include #include "../../../includes/cJSON.h" -static char *ethRpcUrl = "https://ropsten.infura.io/y07GHxUyTgeN2mdfOonu"; +static char *ethRpcUrl = ETOMIC_URL; struct string { char *ptr; diff --git a/iguana/exchanges/etomicswap/etomiccurl.h b/iguana/exchanges/etomicswap/etomiccurl.h index a158c3060..3a0a9be1e 100644 --- a/iguana/exchanges/etomicswap/etomiccurl.h +++ b/iguana/exchanges/etomicswap/etomiccurl.h @@ -3,6 +3,14 @@ #ifdef __cplusplus extern "C"{ #endif + +#define ETOMIC_TESTNET +#ifdef ETOMIC_TESTNET +#define ETOMIC_URL "https://ropsten.infura.io/y07GHxUyTgeN2mdfOonu" +#else +#define ETOMIC_URL "https://mainnet.infura.io/y07GHxUyTgeN2mdfOonu" +#endif + typedef struct { uint64_t blockNumber; @@ -17,4 +25,4 @@ EthTxReceipt getEthTxReceipt(char *txId); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/iguana/exchanges/etomicswap/etomiclib.cpp b/iguana/exchanges/etomicswap/etomiclib.cpp index 9b4130a80..dfe0695ec 100644 --- a/iguana/exchanges/etomicswap/etomiclib.cpp +++ b/iguana/exchanges/etomicswap/etomiclib.cpp @@ -27,7 +27,7 @@ TransactionSkeleton txDataToSkeleton(BasicTxData txData) tx.to = jsToAddress(txData.to); tx.value = jsToU256(txData.amount); tx.gas = 300000; - tx.gasPrice = 100 * exp10<9>(); + tx.gasPrice = ETOMIC_GASMULT * exp10<9>(); tx.nonce = getNonce(txData.from); return tx; } @@ -50,7 +50,7 @@ char* approveErc20(char* amount, char* from, char* secret) tx.to = jsToAddress("0xc0eb7AeD740E1796992A08962c15661bDEB58003"); tx.value = 0; // exp10<18>(); tx.gas = 300000; - tx.gasPrice = 100 * exp10<9>(); + tx.gasPrice = ETOMIC_GASMULT * exp10<9>(); tx.nonce = getNonce(from); std::stringstream ss; ss << "0x095ea7b3" diff --git a/iguana/exchanges/etomicswap/etomiclib.h b/iguana/exchanges/etomicswap/etomiclib.h index a8c594007..fba03e4e1 100644 --- a/iguana/exchanges/etomicswap/etomiclib.h +++ b/iguana/exchanges/etomicswap/etomiclib.h @@ -6,6 +6,20 @@ #ifdef __cplusplus extern "C" { #endif + +#define ETOMIC_TESTNET +#ifdef ETOMIC_TESTNET +#define ETOMIC_ALICECONTRACT "0xe1D4236C5774D35Dc47dcc2E5E0CcFc463A3289c" +#define ETOMIC_BOBCONTRACT "0x9387Fd3a016bB0205e4e131Dde886B9d2BC000A2" +#define ETOMIC_GASMULT 100 +#else +#define ETOMIC_ALICECONTRACT "0x9bC5418CEdED51dB08467fc4b62F32C5D9EBdA55" +#define ETOMIC_BOBCONTRACT "0xB1Ad803ea4F57401639c123000C75F5B66E4D123" +#define ETOMIC_GASMULT 4 +#endif + +#define ETOMIC_SATOSHICAT "0000000000" + typedef struct { char from[65]; char to[65];