Remove in-constructor requirements (#2195)

* Remove isConstructor requirement from _setupRole

* Remove isConstructor requirement from _setupDecimals

* Update contracts/access/AccessControl.sol

Co-Authored-By: Francisco Giordano <frangio.1@gmail.com>

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Nicolás Venturo
2020-04-17 17:00:30 -03:00
committed by GitHub
parent 13e113df81
commit c7705712ba
6 changed files with 10 additions and 30 deletions

View File

@ -164,12 +164,16 @@ abstract contract AccessControl is Context {
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* Requirements:
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* - this function can only be called from a constructor.
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*/
function _setupRole(bytes32 role, address account) internal virtual {
require(!address(this).isContract(), "AccessControl: roles cannot be setup after construction");
_grantRole(role, account);
}