Keyring Cache
Description
You can read the Keyring Cache directly and create your own permissioning contracts. The Cache effectively operates as a dynamic whitelist.
None of the Keyring Guard safeguards are included in this model (like failsafe mechanisms).
In this model, the permissioning code is self-maintained by you.
Integration
Create an instance of IKeyringGuardAlone and call its isAuthorized
method.
Now, you can either reuse the modifier mentioned in the previous section (Keyring Guard) or directly call Keyring's dynamic whitelist to use it how you see fit.
Integration Example
Let's assume we want to guard an ERC20 transfer function.
Firstly, define the Policy ID in the contract constructor with a pointer to the Keyring Cache.
Then, override ERC20 _update
hook to implement the direct cache lookup.
Make sure to properly address the mint
case (where from
is the null address 0x0000...) and the burn
case (where the to
is the null address), as the address(0)
is always regarded as unauthorised.
Last updated