Created
April 26, 2023 11:51
-
-
Save BlockmanCodes/44da7c32d8bf916d7fd0eccafdb2e52a to your computer and use it in GitHub Desktop.
SushiSwap: find pair addresses on sushi and uni
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 factoryArtifact = require('@uniswap/v2-core/build/UniswapV2Factory.json') | |
const provider = new ethers.JsonRpcProvider('https://mainnet.infura.io/v3/abc') | |
const SUSHI_FACTORY = '0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac' | |
const UNI_FACTORY = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f' | |
const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' | |
const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' | |
const sushiFactory = new ethers.Contract(SUSHI_FACTORY, factoryArtifact.abi, provider) | |
const uniFactory = new ethers.Contract(UNI_FACTORY, factoryArtifact.abi, provider) | |
const main = async () => { | |
const sushiPair = await sushiFactory.getPair(USDC, WETH) | |
const uniPair = await uniFactory.getPair(USDC, WETH) | |
console.log('sushiPair', sushiPair) | |
console.log('uniPair', uniPair) | |
} | |
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": "01", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"@uniswap/v2-periphery": "^1.1.0-beta.0", | |
"@uniswap/v3-core": "^1.0.1", | |
"ethers": "^6.3.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment