forked from TheCryptoFarm/txPoolSniper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getPair.js
32 lines (30 loc) · 865 Bytes
/
getPair.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"use strict";
const env = require("./env.json");
Object.assign(process.env, env);
const ethers = require("ethers");
const provider = new ethers.providers.WebSocketProvider(
process.env.BSC_NODE_WSS
);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY);
const account = wallet.connect(provider);
var args = process.argv.slice(2);
const run = async () => {
const factory = new ethers.Contract(
"0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73",
[
"function getPair(address tokenA, address tokenB) external view returns (address pair)",
],
account
);
const pairAddress = await factory.getPair(
"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", // wbnb
args[0]
);
console.log("pairAddress: " + pairAddress);
process.exit();
};
if (!args[0]) {
console.log("Usage: node getPair [token contract]");
process.exit();
}
run();