You can use the _grantRole
function instead. _setupRole
was removed in 5.0 and was previously already marked as deprecated.
Note that 5.0 contains a number of breaking changes. Please see the release notes at https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.0 if you encounter other similar errors.
The current recommended best practice is also to not use msg.sender
for the role assignment, but to pass in addresses for the roles in the constructor arguments. See https://wizard.openzeppelin.com/ for an example.