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
    
  
  
    
  | import Web3 from "web3"; | |
| import { abi as IUniswapV2Pair } from "@uniswap/v2-core/build/IUniswapV2Pair.json"; | |
| import { BigNumber } from "bignumber.js"; | |
| import { ChainId, Token, WETH, Fetcher, Route } from "@uniswap/sdk"; | |
| // Create a new Web3 Instance | |
| const web3 = new Web3(window.ethereum); | |
| // Replace the addresses to point to your Farming Contract | |
| // and LP Token Contract on the desired network | 
  
    
      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
    
  
  
    
  | require('dotenv').config(); | |
| // initialize mongodb | |
| const Transactions = require('../server/models/history_transactions'); | |
| var configDB = require('../server/config/database'); | |
| const mongoose = require('mongoose'); | |
| console.log( configDB.url ) | |
| mongoose.connect(configDB.url, { | 
  
    
      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
    
  
  
    
  | /* | |
| In this script you can undestand how to compute offchain an address of any pancakeswap pair | |
| given the pair tokens | |
| This script can be used also to compute any pancakeswap similar dex like | |
| uniswap ( ethereum ) | |
| quickswap ( polygon ) | |
| by changing the value of the variables | 
  
    
      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
    
  
  
    
  | let pancakeSwapAbi = [ | |
| {"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"}, | |
| ]; | |
| let tokenAbi = [ | |
| {"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, | |
| ]; | |
| const Web3 = require('web3'); | |
| /* | |
| Required Node.js |