Generated function for role property not visible when deploying to Rinkeby

I get the error MINTER_ROLE is not a function, but only when deploying to a public network.

await MyERC1155.MINTER_ROLE();

Works as expected deploying to ganache but for some reason when I deploy to rinkeby it fails.

:computer: Environment
Solidity: 0.6.12
Truffle: 5.1.42
Openzepplin/contracts: ^3.1.0
Ganache: 2.5.4 (works)
Rinkeby: (doesn’t work)

:1234: Code to reproduce

Writer.sol

contract MyERC1155 is ERC1155PresetMinterPauser  {
    constructor(string memory uri) public ERC1155PresetMinterPauser(uri){
    }
}

1_initial_migration.js

const MyERC1155 = artifacts.require("MyERC1155")
const wp = await deployer.deploy(MyERC1155, "url");
await MyERC1155 .MINTER_ROLE();

This works as expected when deploying to ganache but fails with the error
TypeError: MyERC1155.MINTER_ROLE is not a function
when deploying to Rinkeby

1 Like

I think it should be

const MyERC1155 = artifacts.require("MyERC1155")
await deployer.deploy(MyERC1155, "url");
const wp = await MyERC1155.deployed();
console.log(await wp.MINTER_ROLE());
1 Like