Protocol Token Authority
1. Summary
The ProtocolTokenAuthority
allows governance to specify which addresses are allowed to mint
or burn
protocol tokens. This is done by either setting an address as the root
of the contract, the owner
of the contract or by whitelisting an address in the authorizedAccounts
mapping.
2. Contract Variables & Functions
Variables
root
- contract's root controlling address.owner
- the second most powerful address controlling the contract. It cannot set theroot
but it can set anotherowner
.authorizedAccounts[account: address]
- mapping of addresses that are allowed to print protocol tokens.
Modifiers
isRootCalling
- modifier checking if themsg.sender
is theroot
isRootOrOwnerCalling
- modifier checking if themsg.sender
is theroot
or theowner
Functions
setRoot(usr: address)
- sets a new rootsetOwner(usr: address)
- sets a new owneraddAuthorization(usr: address)
- authorize a new address to print tokensremoveAuthorization(usr: address)
- de-authorize an address from printing tokenscanCall(src: address, address, sig: bytes4)
- checks whether an address can callmint
,burn
orburnFrom
inside the protocol token
3. Walkthrough
auth
ed accounts, owner
and root
are the ones who pass the canCall
check and thus, are able mint
, burn
and burnFrom
. root
and owner
can add or remove authorized addresses. owner
cannot set a new root
but can only change the owner
. root
has complete power and can change both the root
and the owner
.