Core.sol
Core
contract keeps track of all the StableMaster
contracts associated to the different stablecoins of the protocol. Its main role is to facilitate governance and to allow changes at the level of the protocol (like a change in a governance address) to be propagated across all the underlying contracts of the protocol.Core
which then propagates this change to all the StableMaster
contracts of the protocol. Each StableMaster
then notifies the AgToken
contract it relates to as well as all the PoolManager
.Core
contract is however not linked to all the contracts of the protocol. Among other things, The following functions do not propagate the changes they induce to some bricks of the protocol like the CollateralSettler
, the BondingCurve
, the staking and rewards distribution contracts and the oracle contracts using Uniswap. Governance should be wary when calling these functions and make equivalent changes in these contracts to maintain consistency at the scale of the protocol.ICore
StableMaster
through the setCore
function in governance can call in the Core
contract._governorList
: List of all the governor addresses of Angle's protocol. Initially, only the timelock will be appointed governor but it may not be the only oneguardian
: Address of the guardian of the protocol_stablecoinList
: List of all the stablecoins accepted by the system represented with the address of the corresponding StableMaster
contractgovernorMap
: Map to track the addresses with a GOVERNOR_ROLE
within Angle protocol. It has been defined to facilitate the Access Control logic in the Core
contract.deployedStableMasterMap
: Map to track the addresses of the stableMaster
contracts that have already been deployed. This is used to avoid deploying a revoked stableMaster
contract again and hence potentially creating inconsistencies in the GOVERNOR_ROLE
and GUARDIAN_ROLE
of this stableMaster
.addGovernor
and removeGovernor
functions through grantRole / revokeRole
. Custom modifiers have thus been defined to act as equivalents to OpenZeppelin modifiersCore
contract of the protocol, thus making the current Core
contract useless. The governance of the new Core
contract should be exactly the same of this one.newCore
: Address of the new Core
contractStableMaster
contract corresponding to theAgToken
is automatically retrieved. The StableMaster
receives the reference to the governor and guardian addresses of the protocol.AgToken
and StableMaster
contracts should have previously been initialized with correct references in it, with for the StableMaster
a reference to the Core
contract and for the AgToken
a reference to the StableMaster
agToken
: Address of the new AgToken
contractStableMaster
contract. This function just removes a StableMaster
contract from the stablecoinList
. The consequence is that the StableMaster
contract will no longer be affected by changes in governor or guardian occuring from the protocolstableMaster
: Address of the StableMaster
to revokeCore
contract has the ability to add a new governor or remove a governor from the system and propagate this change across all underlying contracts of the protocol. The two functions existing governors can interact with to do that are:addGovernor
removeGovernor
: there must however always be one remaining governor in the protocolCore
contract. The guardian is indeed able to transfer its power to another address or to revoke itself. Changing or revoking a guardian from the Core
will automatically echo this change across all core modules of the protocol.setGuardian
revokeGuardian
Core
contract implements a getter governorList()
for the _governorList
: this is used in different places of the protocol, notably when a new collateral is deployed, for the StableMaster
to fetch correct info about the governors of the protocol._stablecoinList
: a getter called stablecoinList()
has been implemented.