If you’re using OpenZeppelin smart contract code with access control, you will encounter a function called grantRole
(see red box) depicted below on Remix on how to assign a role to a wallet address.
The question you might ask is what should I fill in the role
parameter. You actually have to fill in the role such as MINTER_ROLE
to assign the minting privilege to an address, or DEFAULT_ADMIN_ROLE
to assign a wallet to be the admin of the contract.
But the parameter only accepts bytes32 input. Thus, to obtain the bytes32 data, scroll down on the list of functions you have and find the variable MINTER_ROLE
or DEFAULT_ADMIN_ROLE
and click on them, as shown below, in red boxes.
And you will get the bytes32 version such as 0x0000000000000000000000000000000000000000000000000000000000000000
for DEFAULT_ADMIN_ROLE
and 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6
for MINTER_ROLE
.
You then just have to copy these data types and paste them on the role parameter in the grantRole
function and also include a wallet address. Then, hit the call button.