Skip to content

Latest commit

 

History

History
329 lines (287 loc) · 10.3 KB

ProtoBase.md

File metadata and controls

329 lines (287 loc) · 10.3 KB

ProtoBase.sol

View Source: contracts/core/ProtoBase.sol

↗ Extends: AccessControl, Pausable, Recoverable ↘ Derived Contracts: Protocol

ProtoBase

Functions

function (IStore store) internal nonpayable Recoverable 

Arguments

Name Type Description
store IStore
Source Code
constructor(IStore store) Recoverable(store) {
    _setAccessPolicy();
  }

_setAccessPolicy

function _setAccessPolicy() private nonpayable

Arguments

Name Type Description
Source Code
function _setAccessPolicy() private {
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_ADMIN, AccessControlLibV1.NS_ROLES_ADMIN);
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_COVER_MANAGER, AccessControlLibV1.NS_ROLES_ADMIN);
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_LIQUIDITY_MANAGER, AccessControlLibV1.NS_ROLES_ADMIN);
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_GOVERNANCE_ADMIN, AccessControlLibV1.NS_ROLES_ADMIN);
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_GOVERNANCE_AGENT, AccessControlLibV1.NS_ROLES_GOVERNANCE_ADMIN);
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_UPGRADE_AGENT, AccessControlLibV1.NS_ROLES_ADMIN);
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_RECOVERY_AGENT, AccessControlLibV1.NS_ROLES_ADMIN);
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_PAUSE_AGENT, AccessControlLibV1.NS_ROLES_ADMIN);
    _setRoleAdmin(AccessControlLibV1.NS_ROLES_UNPAUSE_AGENT, AccessControlLibV1.NS_ROLES_ADMIN);

    _setupRole(AccessControlLibV1.NS_ROLES_ADMIN, msg.sender);
  }

setupRole

function setupRole(bytes32 role, bytes32 adminRole, address account) external nonpayable nonReentrant 

Arguments

Name Type Description
role bytes32
adminRole bytes32
account address
Source Code
function setupRole(
    bytes32 role,
    bytes32 adminRole,
    address account
  ) external nonReentrant {
    s.mustNotBePaused();
    AccessControlLibV1.mustBeAdmin(s);

    _setRoleAdmin(role, adminRole);

    if (account != address(0)) {
      _setupRole(role, account);
    }
  }

pause

Pauses this contract. Individual protocol contracts infer to the protocol's "paused state". So, if the protocol is paused, all other contracts are automatically paused without having to do anything special. In Neptune Mutual Protocol, pause and unpause features are considered to have different risk exposures. The pauser role is considered to be low-risk role while the unpauser is believed to be highly critical. In other words, pausing the protocol is believed to be less riskier than unpausing it. The only (private) key that is ever allowed to be programmatically used is the pause agents.

function pause() external nonpayable nonReentrant whenNotPaused 

Arguments

Name Type Description
Source Code
function pause() external nonReentrant whenNotPaused {
    AccessControlLibV1.mustBePauseAgent(s);
    super._pause();
  }

unpause

Unpauses or resumes this contract. Individual protocol contracts infer to the protocol's "paused state". So, if the protocol is paused, all other contracts are automatically paused without having to do anything special. In Neptune Mutual Protocol, pause and unpause features are considered to have different risk exposures. The pauser role is considered to be low-risk role while the unpauser is believed to be highly critical. In other words, pausing the protocol is believed to be less riskier than unpausing it. The only (private) key that is ever allowed to be programmatically used is the pause agents.

function unpause() external nonpayable nonReentrant whenPaused 

Arguments

Name Type Description
Source Code
function unpause() external nonReentrant whenPaused {
    AccessControlLibV1.mustBeUnpauseAgent(s);
    super._unpause();
  }

Contracts