How to deploy Upgradable smart contract on Binance smart chain?

Hi,can anyone suggest me a docs regarding
How to develop and deploy upgradable smart contract on binance smart chain testnet using openzeppelin upgradable plugin like hardhat.
Thanks in advance…

1 Like

I think the BSC chain just forks the mainnet of the ethereum, just like the testnet Kovan, so when you deploy your contracts, you should change the chainId , as for other things, I think it’s the same as you do on the mainnet.

2 Likes

Hi @Skyge thanks for your response, i already tried to deploy upgradable contract on BSC testnet using openzeppelin plugin ,but whenever i deploy my contract on bscscan testnet ,i didn’t find proxy contract…
In ethereum whenever we deploy our upgradable contract in rinkeby etherscan testnet our proxy contract is automaticallly verified …but in bscscan i didnt find such kind of proxy contract code…so how do we verify proxy code on bscscan testnet…
this was my config file for binance smart chain:
// hardhat.config.js

const {mnemonic} = require('./secrets.json');

require("@nomiclabs/hardhat-ethers");

require('@openzeppelin/hardhat-upgrades');

/**

 * @type import('hardhat/config').HardhatUserConfig

 */

module.exports = {

  solidity: "0.7.0",

  networks: {

    testnet: {

      url: `https://data-seed-prebsc-1-s1.binance.org:8545`,

      accounts: {mnemonic: mnemonic},

      network_id: 97,

      confirmations: 10,

      timeoutBlocks: 200,

      skipDryRun: true

  }

  },

  

};
1 Like

I think the contracts can be verified automatically on the rinkeby, cause someone has verified the proxy contracts, maybe no one has not verified the proxy contracts on the BSC chain.
As for verifying contracts, you can have a look at this one: Error verifying proxy with plugin @nomiclabs/hardhat-etherscan

2 Likes

thanks @Skyge i will check it out…

1 Like

Hi @Prabhakaran,

I used the following tutorial: OpenZeppelin Upgrades: Step by Step Tutorial for Hardhat

I obtained Binance Smart Chain test Ether from the Faucet: https://testnet.binance.org/faucet-smart

I added the network to my Hardhat configuration

// hardhat.config.js
const { alchemyApiKey, mnemonic } = require('./secrets.json');

require("@nomiclabs/hardhat-ethers");
require('@openzeppelin/hardhat-upgrades');

/**
 * @type import('hardhat/config').HardhatUserConfig
 */
module.exports = {
  solidity: "0.7.3",
  networks: {
    rinkeby: {
      url: `https://eth-rinkeby.alchemyapi.io/v2/${alchemyApiKey}`,
      accounts: {mnemonic: mnemonic}
    },
    bsctestnet: {
      url: `https://data-seed-prebsc-1-s1.binance.org:8545`,
      accounts: {mnemonic: mnemonic}
    }
  }
};

I then deployed:

$ npx hardhat run --network bsctestnet scripts/deploy.js
Deploying Box...
Box deployed to: 0xBC67463898F41259d7acaC96cCD85a42c3bbe4c2

The proxy contract is:

I could then interact via the proxy using the console

$ npx hardhat console --network bsctestnet
> const Box = await ethers.getContractFactory("Box")
undefined
> const box = await Box.attach("0xBC67463898F41259d7acaC96cCD85a42c3bbe4c2")
undefined
> (await box.retrieve()).toString()
'42'

A post was merged into an existing topic: Unable to verify contract on Binance smart chain testnet (BSC testnet)