acl:grant
Grant a role on an AccessControl contract (string roles, hashed with keccak256) or an AccessManager (numeric role ids).
Syntax
Section titled “Syntax”acl:grant <role> <on> <target> <to> <account>Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
role | number | string | Role name (e.g. MINTER_ROLE), bytes32 value, or AccessManager role id |
on | command | Keyword on |
target | address | AccessControl contract or AccessManager address |
to | command | Keyword to |
account | address | Account to grant to |
Options
Section titled “Options”| Name | Type | Description |
|---|---|---|
--delay | number | Execution delay for the grantee, in time units (e.g. 1d; AccessManager role ids only) |
Examples
Section titled “Examples”load acl
set $token 0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdbset $manager 0xc0dbDcA66a0636236fAbe1B3C16B1bD4C84bB1E1
# AccessControl: role names are hashed with keccak256acl:grant MINTER_ROLE on $token to @meacl:grant DEFAULT_ADMIN_ROLE on $token to 0x4F2083f5fBede34C2714aFfb3105539775f7FE64
# AccessManager: numeric role ids, optionally with an execution delayacl:grant 1 on $manager to @meacl:grant 42 on $manager to 0x4F2083f5fBede34C2714aFfb3105539775f7FE64 --delay 1d- String roles target AccessControl
grantRole(bytes32,address): the name is hashed with keccak256 (soMINTER_ROLEbecomes@id(MINTER_ROLE)),DEFAULT_ADMIN_ROLEmaps to0x00…00, and a0x…bytes32 value passes through untouched. - Numeric roles target AccessManager
grantRole(uint64,address,uint32).ADMIN_ROLEandPUBLIC_ROLEare accepted as aliases for0and2^64-1.--delaysets the grantee's execution delay and is only valid here. - The sender must hold the role's admin role.
See Also
Section titled “See Also”- acl:revoke — remove a role
- acl:renounce — give up one of your own roles
- @acl:hasRole — check membership
- @acl:roleAdmin — find the admin role