For some reason, I am not always getting address(0) like in the documentation explained.
Using ether.js to create the instance:
const factory = new ethers.Contract(
this.isAddress(REACT_APP_FACTORY_ADDRESS),
Factory.abi,
signer
);
I deployed a fresh contract and cleared and removed the cache but getting always an address, e.g. "0x1c1Cb37dCe1b1cFF98d798C670D0B2f790141b9a". Is there any other way to find out if the pair address exists or not?
Here is my hardhat.config.ts
import { task } from 'hardhat/config';
import '@nomiclabs/hardhat-waffle';
import { config as dotenvConfig } from 'dotenv';
import { resolve } from 'path';
dotenvConfig({ path: resolve(__dirname, './.env') });
task('accounts', 'Prints the list of accounts', async (args, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
networks: {
localhost: {
url: 'http://127.0.0.1:8545',
chainId: 31337,
},
testnet: {
url: 'https://speedy-nodes-nyc.moralis.io/{key}/bsc/testnet',
chainId: 97,
accounts: [process.env.TEST_NET_KEY],
},
},
solidity: {
version: '0.8.0',
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
paths: {
sources: './src/contracts',
tests: './src/tests',
cache: './cache',
artifacts: './src/abi',
},
mocha: {
timeout: 20000,
},
};
I am currently testing the Uniswap function getPair()
and calling it from UI like this:
For some reason, I am not always getting address(0) like in the documentation explained.
Using ether.js to create the instance:
I deployed a fresh contract and cleared and removed the cache but getting always an address, e.g. "0x1c1Cb37dCe1b1cFF98d798C670D0B2f790141b9a". Is there any other way to find out if the pair address exists or not?
Here is my hardhat.config.ts
Start: npx hardhat node Deploy: npx hardhat run --network localhost src/scripts/deploy.ts