0

I deployed a smart contract called Deployer.sol that deploys other NFT smart contracts, when I deploy using the remix London testnet, I got the contract address after the deployment, but cannot get the same output when deploying on the Goerli testnet using the same source code. What did I miss ?

Here is the code:

Deployer.sol version 1

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
 
import "./NFT.sol";
 
contract Deployer  {
    address public TobeDeployed;
    function Deployme(address _addr, address _ourAddress, address _creceiver, string memory _URI, string memory name, string memory symbol, uint256 _price, uint256 _maxsupply,uint256 _totalPerWallet) public returns(address ){
        TobeDeployed = address (new NFT(_addrname, symbol));
        return TobeDeployed;
    }
}

Deployer.sol version 2

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
 
import "./NFT.sol";
 
contract Deployer  {
    NFT public TobeDeployed;
    function Deployme(address _addr, address _ourAddress, address _creceiver, string memory _URI, string memory name, string memory symbol, uint256 _price, uint256 _maxsupply,uint256 _totalPerWallet) public returns(NFT){
        TobeDeployed = new NFT(_addr, name, symbol);
        return TobeDeployed;
    }
}

NFT.sol contract to deploy looks like this

// SPDX-License-Identifier: Opensource
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

contract NFT is ERC721,Pausable,ReentrancyGuard{
     // some codes here
   
    constructor(address _addr, string memory name, string memory symbol) ERC721(name, symbol){
      
        // some codes here
    }

}

1 Answer 1

1

Just solved this by emitting an event after contract deployment :)

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
 
import "./NFT.sol";
 
contract Deployer  {
    NFT public TobeDeployed;
    event logs(address addr);
    function Deployme(address _addr, address _ourAddress, address _creceiver, string memory _URI, string memory name, string memory symbol, uint256 _price, uint256 _maxsupply,uint256 _totalPerWallet) public returns(NFT){
        TobeDeployed = new NFT(_addr, name, symbol);
        emit Logs(address(TobeDeployed));
        return TobeDeployed;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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