Has anyone used AccessControl to manage token whitelisting within your contract?
For example, I have a swap control that will only interact with pre-defined tokens.
Normally for token whitelisting I set up a mapping of address => bool and have an addToken and removeToken function. Say in my example swap control I am using OZ's AccessControl for general admin stuff, I can also create a role like 'WHITELISTED_TOKEN_ROLE', and replace addToken and removeToken with AccessControl's grantRole and revokeRole, using the above role and token address as respective parameters.
I think the benefits of this are that you are reducing a single storage space with removal of the original whitelist mapping of address => bool, and you are utilizing functions that will already be in the contract anyway from the inherited AccessControl contract.
Does anyone else do this or have you seen examples of this in the wild? Would there be any downside to implementing whitelisting like this?