Verifying contract on bsc testnet using truffle plugin verify fails

I have a project that compiles and deploys successfully on binance smart chain testnet. I am trying to verify the contract using **

truffle run verify NiftRouter --network bscTestnet --debug

** command but it gives me the following error. This is strange because the TransferHelper.sol does exist in that folder. My truffle version is 5.1.49. Any idea what is the issue.

Hi @Maham_Zaidi,

:warning: Please don’t share secrets in the forum. Your screenshot included an API key, I recommend disabling this BSCscan API key and creating a new one.

The following are the BSC guides:

@abcoathup it still didn't solve my issue. Truffle verify plugin raises the same error on imports of different node module files. Its a nuisance verifying multiple library contracts manually and I don't want to use truffle flattener. These are the imports of my MasterChef solidity file

pragma solidity 0.6.12;

import '@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol';

import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol';

import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol';

import '@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol';

import "./CakeToken.sol";

import "./SyrupBar.sol";

And I get the following error on truffle plugin verify even though i have given the corrent bscscan api key

PS E:\pancakeswap\pancake-farm> truffle run verify MasterChef@0x1843b9184C3677706215147b8e482c038c9b8ec3 --network bscTestnet
Verifying MasterChef@0x1843b9184C3677706215147b8e482c038c9b8ec3
Cannot find module '@pancakeswap/pancake-swap-lib/contracts/GSN/Context.sol'
Require stack:

  • C:\Users\DELL\node_modules\truffle-plugin-verify\verify.js
  • C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\node_modules\original-require\index.js
  • C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js
    Failed to verify 1 contract(s): MasterChef@0x1843b9184C3677706215147b8e482c038c9b8ec3

This the screenshot which clearly shows I do have Context.sol

image

Hi,I am not sure, could you please show your full folders.

And maybe you can remove the node_modules and reinstall to have a try.

Im having a very similar issue, would love to know if anyone solved this

No, I wasn't able to solve it

For future purpose;

follow this guide: https://docs.bnbchain.org/docs/truffle-new