0

I have developed a contract that deploys another contract (without params in the constructor). The idea is to have the first contract (Platform) as a common storage contract and use the second contract (Registry) to manage different operations, accessing to Platform contract param values.

When I try to verify te contract, in the block explorer of different public networks (BSC and ETH) I can only see write functions.

The Smart Contracts work well, and I cannot verify them again because they are already verified, but in the "Read functions" tab it does not show any public view function. What could be the problem?

The Smart contract have been deployed and verified using HardHat framework.

npx hardhat run scripts/deploy.ts --network testnet
npx hardhat verify --network testnet 0x...

deploy.ts file

import { ethers } from "hardhat";

async function main() {
  
  // Platform contract to deploy
  const Platform = await ethers.getContractFactory("Platform");
  const platform = await Platform.deploy();
  await platform.deployed();

  console.log("Platform deployed to:", platform.address);

}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Platform contract:

// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;

import "./Registry.sol";
import "./interfaces/IPlatform.sol";

contract Platform is IPlatform {

    address public registry;
    address public platformWallet;
    address public admin;

    constructor() {
        admin = msg.sender;
        platformWallet = msg.sender;

        Registry registryContract = new Registry(address(this));
        registry = address(registryContract);

    }

Registry contract

// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;

import "./interfaces/IRegistry.sol";
import "./interfaces/IPlatform.sol";

contract Registry is IRegistry {

    IPlatform public platform;

    address public platformWallet;
    address public admin;

    constructor() {
        platform = IPlatform(msg.sender); //The address of previously deployed Platform contract
    }

UPDATE: After some time (half an hour) the view functions appeared.

1 Answer 1

0

There are no read functions to begin with. I assume you are talking about getter functions to view information such as (found in your contracts): PlatformWallet Address, Admin address etc.

Some IDEs like Remix automatically creates these functions for you but if you want them to show on explorers like Etherscan, then you have to create your own getter functions to return these values.

f.e

function _getplatformWallet() public view returns(address){
return platformwallet;
}
1
  • I was talking about view functions, not about automatically generated getters for public state variables.
    – AlexAcc
    Sep 16 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.