-
-
Save BlockmanCodes/61810d1ff788d9d79f3e5643f58e6f9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INFURA_URL_TESTNET=<your_url_and_key> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ethers } = require('ethers') | |
const { abi: UniswapV3Factory } = require('@uniswap/v3-core/artifacts/contracts/UniswapV3Factory.sol/UniswapV3Factory.json') | |
require('dotenv').config() | |
const INFURA_URL_TESTNET = process.env.INFURA_URL_TESTNET | |
const address0 = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984' | |
const address1 = '0xc778417e063141139fce010982780140aa0cd5ab' | |
const factoryAddress = '0x1F98431c8aD98523631AE4a59f267346ea31F984' | |
async function main() { | |
const provider = new ethers.providers.JsonRpcProvider(INFURA_URL_TESTNET) | |
const factoryContract = new ethers.Contract( | |
factoryAddress, | |
UniswapV3Factory, | |
provider | |
) | |
const poolAddress = await factoryContract.getPool(address0, address1, 500) | |
console.log('poolAddress', poolAddress) | |
} | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "findpooluniswap", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"@uniswap/sdk-core": "^3.0.1", | |
"dotenv": "^16.0.0", | |
"ethers": "^5.6.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment