Ownable Upgradable won't set the deployer as owner

Hi,

I created a ERC721 with the upgrades version as the example below, but the owner of the OwableUpgradeable plugin is the address 0x0, not the deployer. Testing with truffle worked just fine, but deployed to ropsten to run a few tests and noticed that I was not able to execute the addOperator method.

Code Example

import "./IERC721Gog.sol";
import "./OperatorRole.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract GOGAuction is OperatorRole {

 function initialize (
        address _ERC721GogContractAddress,
        address _erc20ContractAddress,
        address _wallet
    ) public initializer
    {   
        __OperatorRole_init();

        ERC721GogContractAddress = _ERC721GogContractAddress;
        ERC721Gog = IERC721Gog(ERC721GogContractAddress);

        ERC20ContractAddress = _erc20ContractAddress;
        ERC20 = IERC20(ERC20ContractAddress);

        gogWallet = payable(_wallet);
    }

The operatorRole Contrate is:

// SPDX-License-Identifier: GOG
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract OperatorRole is OwnableUpgradeable {
    mapping (address => bool) operators;

    function __OperatorRole_init() internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function addOperator(address operator) external onlyOwner {
        operators[operator] = true;
    }

    function removeOperator(address operator) external onlyOwner {
        operators[operator] = false;
    }

    modifier onlyOperator() {
        require(operators[_msgSender()], "OperatorRole: caller is not the operator");
        _;
    }
}

Migrations

const { deployProxy } = require('@openzeppelin/truffle-upgrades');
const GOGAuction = artifacts.require("GOGAuction");
//const GOGERC20 = artifacts.require("GOGERC20");
const GOGERC721 = artifacts.require("GOGERC721");

const usdcDeployedContract = "0x07865c6e87b9f70255377e024ace6630c1eaa37f";
const gogRopsten = "0xEcf705af801bfFee9c7805d7b9981Dd66C0e21F3";


module.exports = async function (deployer, network, accounts) {
    try {
        const GOG721 = await GOGERC721.deployed();
        await deployProxy(GOGAuction, [GOG721.address, usdcDeployedContract, gogRopsten]);
    } catch (error) {
        console.log(error);
    }
};

:computer: Environment

I am using Truffle with the Upgrades Plugin.

I tried everything and already broken the upgrability trying to redeploy... Anyway, I hope this is fixable.

Best,
Rogers

Hi,

I think I found the reason, I was using the implementation address whilst I should be using the TransparentProxy Contract address.

Please correct me if I am wrong.

Yes that sounds like it would be the problem.

1 Like