Merge pull request #97 from TrooperCrypto/master

enable uniswap mainnet feed for goerli
This commit is contained in:
Trooper
2022-08-12 12:03:56 +02:00
committed by GitHub
2 changed files with 9 additions and 6 deletions

View File

@@ -44,7 +44,7 @@ node marketmaker.js
## Configuration Via Environment Variables ## Configuration Via Environment Variables
It is __recommended__ to use environment variables to set your private keys. You can set `ETH_PRIVKEY`, `CRYPTOWATCH_API_KEY` and `INFURA_URL` using them. You can set them using `ETH_PRIVKEY=0x____`. For more informations on private keys read [this](https://linuxize.com/post/how-to-set-and-list-environment-variables-in-linux/). It is __recommended__ to use environment variables to set your private keys. You can set `ETH_PRIVKEY`, `CRYPTOWATCH_API_KEY` and `INFURA` using them. You can set them using `ETH_PRIVKEY=0x____`. For more informations on private keys read [this](https://linuxize.com/post/how-to-set-and-list-environment-variables-in-linux/).
If your hosting service requires you to pass in configs via environment variables you can compress `config.json`: If your hosting service requires you to pass in configs via environment variables you can compress `config.json`:

View File

@@ -46,12 +46,15 @@ console.log("ACTIVE PAIRS", activePairs);
// Connect to zksync // Connect to zksync
const CHAIN_ID = parseInt(MM_CONFIG.zigzagChainId); const CHAIN_ID = parseInt(MM_CONFIG.zigzagChainId);
const ETH_NETWORK = (CHAIN_ID === 1) ? "mainnet" : "goerli"; const ETH_NETWORK = (CHAIN_ID === 1) ? "mainnet" : "goerli";
let ethersProvider; const infureKey = (process.env.infura || MM_CONFIG.infura);
const providerUrl = (process.env.INFURA_URL || MM_CONFIG.infuraUrl); let ethersProvider = null;
if(providerUrl && ETH_NETWORK=="mainnet") { if (infureKey) {
ethersProvider = ethers.getDefaultProvider(providerUrl); ethersProvider = new ethers.providers.InfuraProvider(
"mainnet",
infureKey
);
} else { } else {
ethersProvider = ethers.getDefaultProvider(ETH_NETWORK); ethersProvider = new ethers.getDefaultProvider("mainnet");
} }
// Start price feeds // Start price feeds