lightrao / reading-data-pancakeswap-v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reading Data from PancakeSwap V2

Initialising Pancake Project

cd reading-data-pancakeswap-v2
npm init -y
npm install
mkdir client
cd client
touch GetPrices.js

Installing Ethers JS

npm install ethers@5.6.4

Getting Contract Addresses

Create AddressList.js in ./client/

Setting Up ABI Variables

Create AbiList.js in ./client/

  • Find source code from BscScan by contract address
  • Get ABI from the source code or documentation of PancakeSwap

Connecting to Our First Smart Contract

Edit GetPrices.js

Run:

node client/GetPrices.js

Reading Price Information From PancakeSwap

  • Use getAmountsOut function

About


Languages

Language:JavaScript 100.0%