实现“getLiquidity”函数到js代码Getpair Bot for pancakeswap

问题描述

我复制了 Julian 的代码,稍作修改,现在我无法理解如何在此处编写获取流动性函数代码

谁能给点建议?我完全迷路了

enter coconst ethers = require('ethers');

const addresses = {
  WBNB: '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c',factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73',router: '0x10ED43C718714eb63d5aA57B78B54704E256024E',recipient: 'your address'
}

//First address of this mnemonic must have enough BNB to pay for tx fess
const mnemonic = 'your mnemonic';

const provider = new ethers.providers.WebSocketProvider('wss://apis.ankr.com/wss');
const wallet = ethers.Wallet.fromMnemonic(mnemonic);
const account = wallet.connect(provider);
const factory = new ethers.Contract(
  addresses.factory,['event PairCreated(address indexed token0,address indexed token1,address pair,uint)'],account
);



factory.on('PairCreated',async (token0,token1,pairAddress) => {


 console.log(Date.Now() + "\n");
 console.log(`
    New pair detected
    =================
    token0: ${token0}
    token1: ${token1}
    pairAddress: ${pairAddress}
  `);




});

类似这个功能

 const pairBNBvalue = await erc.balanceOf(pairAddressx);
    jmlBnb = await ethers.utils.formatEther(pairBNBvalue);
    console.log(`value BNB : ${jmlBnb}`);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...