AccessControl: How to setup DEFAULT_ADMIN_ROLE as msg.sender?

In my program,there is a system manager,who in charge of write smart contract and users identity manage,like grant role or revoke role ,so i want to set my contract’s msg.sender as DEFAUIT_ADMIN_ROLE(in AccessControl.sol)? but i wonder how to realize it ? hope anyone can give me some directions… thank you !!!

1 Like

Hi @wangyuyue,

We need to call _setupRole for DEFAULT_ADMIN_ROLE.

Have a look at how this is done in ERC20PresetMinterPauser


I have deleted the duplicate question: How to set msg.sender as DEFAUIT_ADMIN_ROLE?

Thank you for your quick reply!
Thank you for all you’ve done for this community!
Thank you for always being patient and careful in answering everyone’s questions!!!

2 Likes