Localhost testing proxy contract

I am able to deploy the contract to testnet (ropsten) but I cannot test the contract on localhost.
roles.address shows undefined
What am I missing in order to test?

const AccessRole = await ethers.getContractFactory("AccessRole");
    console.log("Deploying AccessRole...");
    const roles = await upgrades.deployProxy(AccessRole,{
      initializer: 'initialize',
    await roles.deployed();
    console.log("Contract deployed to:", roles.addres); 

and the contract

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts/access/IAccessControl.sol";

contract AccessRole is Initializable, AccessControlUpgradeable {
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");
bytes32 public constant COMPLIANCE_ROLE = keccak256("COMPLIANCE");
bytes32 public constant USER_ROLE = keccak256("USER");

function initialize() public initializer {
        _setupRole(ADMIN_ROLE, msg.sender);
        _setRoleAdmin(USER_ROLE, COMPLIANCE_ROLE);


That looks like a typo in roles.addres

1 Like