Developers Forum for XinFin XDC Network

Deepan Chakkravarthy
Deepan Chakkravarthy

Posted on • Updated on

[Closed]How to Deploy proxy contract ?

I want to integrate my token contract with proxy contract ..Can I get any sample reference for the proxy contract integration And I need to know how to verify and publish my integrated proxy token contract..

Discussion (4)

ivan_blocksscan profile image

Check out the below Proxy Contract

You can verify your contract here:

Once verified, email your Contract details like Contract Name, Symbol, Contract Address and Contract Code to BlocksScan Support ( )

menezesphill profile image
Phill Menezes • Edited on

Hi @deepan_chakkravarthy_bfbe I believe the best environment to deploy proxy contracts is Hardhat. You can start a new Hardhat project (See this tutorial for more details on how to do that). Then install the following dependencies:

npm install @nomicfoundation/hardhat-toolbox
npm install @openzeppelin/contracts-upgradeable
npm install @openzeppelin/hardhat-upgrades
Enter fullscreen mode Exit fullscreen mode

You can change your hardhat.config.js file to include the dependencies:


module.exports = {
  solidity: "0.8.16",
  networks: {
    xinfin: {
      url: process.env.XINFIN_NETWORK_URL,
      accounts: [process.env.PRIVATE_KEY],
     apothem: {
      url: process.env.APOTHEM_NETWORK_URL,
      accounts: [process.env.PRIVATE_KEY]
Enter fullscreen mode Exit fullscreen mode

And make your Smart Contract Initializable. The code below is based on the Pizza.sol contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

// Open Zeppelin libraries for controlling upgradability and access.
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract Pizza is Initializable, UUPSUpgradeable, OwnableUpgradeable {
   uint256 public slices;

      ///@dev no constructor in upgradable contracts. Instead we have initializers
    ///@param _sliceCount initial number of slices for the pizza
   function initialize(uint256 _sliceCount) public initializer {
       slices = _sliceCount;

      ///@dev as there is no constructor, we need to initialise the OwnableUpgradeable explicitly

   ///@dev required by the OZ UUPS module
   function _authorizeUpgrade(address) internal override onlyOwner {}

   ///@dev decrements the slices when called
   function eatSlice() external {
       require(slices > 1, "no slices left");
       slices -= 1;
Enter fullscreen mode Exit fullscreen mode

To deploy this contract along with its upgradable proxy, create a deployment script deploy.js:

const { ethers, upgrades } = require("hardhat");

const SLICES = 8;

async function main() {
 const Pizza = await ethers.getContractFactory("Pizza");

 console.log("Deploying Pizza...");

 const pizza = await upgrades.deployProxy(Pizza, [SLICES], {
   initializer: "initialize",
 await pizza.deployed();

 console.log("Pizza deployed to:", pizza.address);

Enter fullscreen mode Exit fullscreen mode

And proceed to deploy the contract:

npx hardhat run scripts/deploy.js --network xinfin
Enter fullscreen mode Exit fullscreen mode
jay_kulkarni_842b41d81b23 profile image

Hello @deepan_chakkravarthy_bfbe

Since we haven’t received any response from your side , we are closing the issue as it appears to be resolved. If you still have the issue, please feel free to reopen it.

Thank you!

mitali_blocksscan profile image


We hope that the above issue is resolved, if the issue is still persist then please let us know about it so that the team can resolve it on priority. It will be grateful to get an update within 72 hours or else it will be considered resolved.

Thank You