Replies: 1 comment
-
I was calling it wrong. Here's the fixed code: it('Deployer should have admin role', async () => {
const { myNft, deployer } = await loadFixture(deployFixture);
const adminRole = await myNft.read.ADMIN_ROLE();
expect(await myNft.read.hasRole([adminRole, getAddress(deployer.account.address)])).to.equal(true);
});
it('Admin role should be admin of admin role', async () => {
const { myNft } = await loadFixture(deployFixture);
const adminRole = await myNft.read.ADMIN_ROLE();
expect(await myNft.read.getRoleAdmin([adminRole])).to.equal(adminRole);
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm experimenting with Viem in Hardhat for the first time. I'm having an issue on how to handle roles (bytes32) in Viem.
I wrote this simple contract:
And I'm trying to test it with the following:
In the calls for
hasRole
andgetRoleAdmin
in the last two test I'm getting a error:What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions