Hi everyone,
I launched this token on binance smart chain testnet. I'm trying to call changeAdmin function of this contract using etherjs but getting an error.
the command that I execute
yarn hardhat run --network testnet scripts/bypass.js
hardhat.config.js
.....testnet: {
url: "https://data-seed-prebsc-1-s1.binance.org:8545",
chainId: 97,
gasPrice: 20000000000,
},......
the script
const ethers = require('ethers')
async function main() {
let network = 'https://data-seed-prebsc-1-s1.binance.org:8545/'
let provider = ethers.getDefaultProvider(network)let privKey = PRIVATE_KEY_OF_THE_CREATOR_OF_THE_CONTRACT let wallet = new ethers.Wallet(privKey, provider) let contractAddr = ADDRESS_OF_THE_CONTRACT let contractABI = ABI_OF_THE_CONTRACT let contract = new ethers.Contract(contractAddr, contractABI, wallet) let newOwnerAddr = "0xCc2c513ef320db14f......" let txResponse= await contract.estimateGas.changeAdmin(newOwnerAddr) let txReceipt = await txResponse.wait() console.log(txReceipt)
}
main()
.catch((error) => {
console.error(error)
process.exit(1)
})
errors I got multiple times
**reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',**
code: 'UNPREDICTABLE_GAS_LIMIT',
error: Error: processing response error (body="{\"jsonrpc\":\"2.0\",\"id\":44,\"error\":{\"code\":-32000,\"message\":\"execution reverted\"}}\n", error={"code":-32000}, requestBody="{\"method\":\"eth_estimateGas\",\"params\":[{\"gas\":\"0xf423f\",\"from\":\"0xa9c8f32bb529cac9639402a05f6324087855f515\",\"to\":\"0x066229c2d5e3673186b756a6c1f3c8689560b474\",\"data\":\"0x8f283970000000000000000000000000cc2c513ef320db14fc01b4a828ef548daff51429\"}],\"id\":44,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://data-seed-prebsc-1-s1.binance.org:8545/", code=SERVER_ERROR, version=web/5.6.0)
**reason: 'processing response error',**
code: 'SERVER_ERROR',
body: '{"jsonrpc":"2.0","id":44,"error":{"code":-32000,"message":"execution reverted"}}\n',
error: Error: execution reverted