AccessManager
The AccessManager contract governs the roles and permissions required to manage various aspects of the TermMax protocol. It is built upon OpenZeppelin's AccessControlUpgradeable
and UUPSUpgradeable
modules, enabling role-based access control and upgradeable smart contract functionality.
Roles and Responsibilities
1. DEFAULT_ADMIN_ROLE
Holders of the DEFAULT_ADMIN_ROLE
have the highest level of control. They can:
Set Gearing Token Implementation
Updates the Gearing Token implementation reference in the factory.
Create Market
Deploys a new TermMax market.
Create Market and Whitelist
Deploys a new market and automatically whitelists it in the router.
Transfer Ownership
Transfers ownership of an
IOwnable
contract to another address.
Accept Ownership
Accepts ownership of an
IOwnable
contract once it has been transferred.
Upgrade Sub-Contract (UUPS)
Upgrades a UUPS proxy to a new implementation, optionally calling a function on the new implementation.
Set Market Whitelist
Adds or removes a market from the routerβs whitelist.
Set Adapter Whitelist
Manages adapter whitelisting on the router.
Set the Oracle
Associates an asset with a specific oracle feed.
Remove the Oracle
Removes an existing oracle mapping for an asset.
Note: The
DEFAULT_ADMIN_ROLE
also acts as the admin role for other roles (i.e., it can grant or revokeCONFIGURATOR_ROLE
,PAUSER_ROLE
, andVAULT_ROLE
).
2. CONFIGURATOR_ROLE
The CONFIGURATOR_ROLE
is responsible for adjusting protocol parameters:
Update Market Config
Adjusts key market parameters such as collateral factors, interest rates, etc.
Update Gearing Token Config
Modifies configuration data specific to Gearing Tokens in a particular market.
Set Order Fee Rate
Adjusts fee parameters for specific orders or order types.
3. PAUSER_ROLE
The PAUSER_ROLE
allows pausing and unpausing of contracts that implement the IPausable
interface:
Set Switch (Pause / Unpause)
If
state == true
, callsunpause()
on the target; otherwise, callspause()
.
Pausing functionality is crucial in DeFi for handling emergencies or severe market disruptions.
4. VAULT_ROLE
The VAULT_ROLE
handles vault-specific administrative functions via the ITermMaxVault
interface:
Submit Vault Guardian
Proposes a new guardian for the vault.
Revoke Vault Pending Guardian
Cancels any pending guardian assignments.
Revoke Vault Pending Timelock
Cancels any pending timelock changes in the vault.
Revoke Vault Pending Market
Prevents a newly proposed market from being finalized for use within the vault.
Set Curator for Vault
Assigns or updates the vaultβs curator (user/contract with certain oversight powers).
Set Allocator for Vault
Grants or revokes allocation rights within the vault.
Summary
Each TermMax role comes with specific privileges essential for the secure and efficient functioning of the protocol:
DEFAULT_ADMIN_ROLE
β Master permissions: market creation, proxy upgrades, whitelisting, and system-wide ownership.CONFIGURATOR_ROLE
β Parameter tuning: market and order configurations, Gearing Token updates.PAUSER_ROLE
β Emergency on/off switch for paused contracts.VAULT_ROLE
β Specialized vault governance: guardian, curator, timelocks, and market management within the vault.
By segregating capabilities in this manner, the protocol upholds the principle of least privilege and fosters a more secure, decentralized environment.
Last updated