MorphoGovernance

Git Source

Inherits: MorphoUtils

Author: Morpho Labs.

Governance functions for Morpho.

Functions

initialize

UPGRADE ///

Initializes the Morpho contract.

function initialize(
    IPositionsManager _positionsManager,
    IInterestRatesManager _interestRatesManager,
    IComptroller _comptroller,
    Types.MaxGasForMatching memory _defaultMaxGasForMatching,
    uint256 _dustThreshold,
    uint256 _maxSortedUsers,
    address _cEth,
    address _wEth
) external initializer;

Parameters

NameTypeDescription
_positionsManagerIPositionsManagerThe positionsManager.
_interestRatesManagerIInterestRatesManagerThe interestRatesManager.
_comptrollerIComptrollerThe comptroller.
_defaultMaxGasForMatchingTypes.MaxGasForMatchingThe defaultMaxGasForMatching.
_dustThresholduint256The dustThreshold.
_maxSortedUsersuint256The _maxSortedUsers.
_cEthaddressThe cETH address.
_wEthaddressThe wETH address.

setMaxSortedUsers

GOVERNANCE ///

Sets maxSortedUsers.

function setMaxSortedUsers(uint256 _newMaxSortedUsers) external onlyOwner;

Parameters

NameTypeDescription
_newMaxSortedUsersuint256The new maxSortedUsers value.

setDefaultMaxGasForMatching

Sets defaultMaxGasForMatching.

function setDefaultMaxGasForMatching(Types.MaxGasForMatching memory _defaultMaxGasForMatching) external onlyOwner;

Parameters

NameTypeDescription
_defaultMaxGasForMatchingTypes.MaxGasForMatchingThe new defaultMaxGasForMatching.

setPositionsManager

Sets the positionsManager.

function setPositionsManager(IPositionsManager _positionsManager) external onlyOwner;

Parameters

NameTypeDescription
_positionsManagerIPositionsManagerThe new positionsManager.

setInterestRatesManager

Sets the interestRatesManager.

function setInterestRatesManager(IInterestRatesManager _interestRatesManager) external onlyOwner;

Parameters

NameTypeDescription
_interestRatesManagerIInterestRatesManagerThe new interestRatesManager contract.

setRewardsManager

Sets the rewardsManager.

function setRewardsManager(IRewardsManager _rewardsManager) external onlyOwner;

Parameters

NameTypeDescription
_rewardsManagerIRewardsManagerThe new rewardsManager.

setTreasuryVault

Sets the treasuryVault.

function setTreasuryVault(address _treasuryVault) external onlyOwner;

Parameters

NameTypeDescription
_treasuryVaultaddressThe address of the new treasuryVault.

setDustThreshold

Sets dustThreshold.

function setDustThreshold(uint256 _dustThreshold) external onlyOwner;

Parameters

NameTypeDescription
_dustThresholduint256The new dustThreshold.

setReserveFactor

Sets the reserveFactor.

function setReserveFactor(address _poolToken, uint16 _newReserveFactor)
    external
    onlyOwner
    isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe market on which to set the _newReserveFactor.
_newReserveFactoruint16The proportion of the interest earned by users sent to the DAO, in basis point.

setP2PIndexCursor

Sets a new peer-to-peer cursor.

function setP2PIndexCursor(address _poolToken, uint16 _p2pIndexCursor) external onlyOwner isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_p2pIndexCursoruint16The new peer-to-peer cursor.

setIsSupplyPaused

Sets isSupplyPaused for a given market.

function setIsSupplyPaused(address _poolToken, bool _isPaused) external onlyOwner isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_isPausedboolThe new pause status, true to pause the mechanism.

setIsBorrowPaused

Sets isBorrowPaused for a given market.

function setIsBorrowPaused(address _poolToken, bool _isPaused) external onlyOwner isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_isPausedboolThe new pause status, true to pause the mechanism.

setIsWithdrawPaused

Sets isWithdrawPaused for a given market.

function setIsWithdrawPaused(address _poolToken, bool _isPaused) external onlyOwner isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_isPausedboolThe new pause status, true to pause the mechanism.

setIsRepayPaused

Sets isRepayPaused for a given market.

function setIsRepayPaused(address _poolToken, bool _isPaused) external onlyOwner isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_isPausedboolThe new pause status, true to pause the mechanism.

setIsLiquidateCollateralPaused

Sets isLiquidateCollateralPaused for a given market.

function setIsLiquidateCollateralPaused(address _poolToken, bool _isPaused)
    external
    onlyOwner
    isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_isPausedboolThe new pause status, true to pause the mechanism.

setIsLiquidateBorrowPaused

Sets isLiquidateBorrowPaused for a given market.

function setIsLiquidateBorrowPaused(address _poolToken, bool _isPaused)
    external
    onlyOwner
    isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_isPausedboolThe new pause status, true to pause the mechanism.

setIsPausedForAllMarkets

Sets the pause status for all markets.

function setIsPausedForAllMarkets(bool _isPaused) external onlyOwner;

Parameters

NameTypeDescription
_isPausedboolThe new pause status, true to pause the mechanism.

setIsP2PDisabled

Sets isP2PDisabled for a given market.

function setIsP2PDisabled(address _poolToken, bool _isP2PDisabled) external onlyOwner isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market of which to enable/disable peer-to-peer matching.
_isP2PDisabledboolTrue to disable the peer-to-peer market.

setIsClaimRewardsPaused

Sets isClaimRewardsPaused.

function setIsClaimRewardsPaused(bool _isPaused) external onlyOwner;

Parameters

NameTypeDescription
_isPausedboolThe new pause status, true to pause the mechanism.

setIsDeprecated

Sets a market as deprecated (allows liquidation of every position on this market).

function setIsDeprecated(address _poolToken, bool _isDeprecated) external onlyOwner isMarketCreated(_poolToken);

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_isDeprecatedboolThe new deprecated status, true to deprecate the market.

increaseP2PDeltas

Increases peer-to-peer deltas, to put some liquidity back on the pool.

The current Morpho supply on the pool might not be enough to borrow _amount before resuppling it. In this case, consider calling multiple times this function.

function increaseP2PDeltas(address _poolToken, uint256 _amount) external onlyOwner;

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market on which to increase deltas.
_amountuint256The maximum amount to add to the deltas (in underlying).

claimToTreasury

Transfers the protocol reserve fee to the DAO.

function claimToTreasury(address[] calldata _poolTokens, uint256[] calldata _amounts) external onlyOwner;

Parameters

NameTypeDescription
_poolTokensaddress[]The addresses of the pool token addresses on which to claim the reserve fee.
_amountsuint256[]The list of amounts of underlying tokens to claim on each market.

createMarket

Creates a new market to borrow/supply in.

function createMarket(address _poolToken, Types.MarketParameters calldata _marketParams) external onlyOwner;

Parameters

NameTypeDescription
_poolTokenaddressThe pool token address of the given market.
_marketParamsTypes.MarketParametersThe market's parameters to set.

_setPauseStatus

INTERNAL ///

Sets all pause statuses for a given market.

function _setPauseStatus(address _poolToken, bool _isPaused) internal;

Parameters

NameTypeDescription
_poolTokenaddressThe address of the market to update.
_isPausedboolThe new pause status, true to pause the mechanism.

Events

DefaultMaxGasForMatchingSet

EVENTS ///

Emitted when a new defaultMaxGasForMatching is set.

event DefaultMaxGasForMatchingSet(Types.MaxGasForMatching _defaultMaxGasForMatching);

MaxSortedUsersSet

Emitted when a new value for maxSortedUsers is set.

event MaxSortedUsersSet(uint256 _newValue);

TreasuryVaultSet

Emitted when the address of the treasuryVault is set.

event TreasuryVaultSet(address indexed _newTreasuryVaultAddress);

PositionsManagerSet

Emitted when the positionsManager is set.

event PositionsManagerSet(address indexed _positionsManager);

RewardsManagerSet

Emitted when the rewardsManager is set.

event RewardsManagerSet(address indexed _newRewardsManagerAddress);

InterestRatesSet

Emitted when the interestRatesManager is set.

event InterestRatesSet(address indexed _interestRatesManager);

DustThresholdSet

Emitted when a new dustThreshold is set.

event DustThresholdSet(uint256 _dustThreshold);

ReserveFactorSet

Emitted when the reserveFactor is set.

event ReserveFactorSet(address indexed _poolToken, uint16 _newValue);

P2PIndexCursorSet

Emitted when the p2pIndexCursor is set.

event P2PIndexCursorSet(address indexed _poolToken, uint16 _newValue);

ReserveFeeClaimed

Emitted when a reserve fee is claimed.

event ReserveFeeClaimed(address indexed _poolToken, uint256 _amountClaimed);

P2PStatusSet

Emitted when the value of isP2PDisabled is set.

event P2PStatusSet(address indexed _poolToken, bool _isP2PDisabled);

IsSupplyPausedSet

Emitted when supplying is paused or unpaused.

event IsSupplyPausedSet(address indexed _poolToken, bool _isPaused);

IsBorrowPausedSet

Emitted when borrowing is paused or unpaused.

event IsBorrowPausedSet(address indexed _poolToken, bool _isPaused);

IsWithdrawPausedSet

Emitted when withdrawing is paused or unpaused.

event IsWithdrawPausedSet(address indexed _poolToken, bool _isPaused);

IsRepayPausedSet

Emitted when repaying is paused or unpaused.

event IsRepayPausedSet(address indexed _poolToken, bool _isPaused);

IsLiquidateCollateralPausedSet

Emitted when liquidating on this market as collateral is paused or unpaused.

event IsLiquidateCollateralPausedSet(address indexed _poolToken, bool _isPaused);

IsLiquidateBorrowPausedSet

Emitted when liquidating on this market as borrow is paused or unpaused.

event IsLiquidateBorrowPausedSet(address indexed _poolToken, bool _isPaused);

IsDeprecatedSet

Emitted when a market is set as deprecated or not.

event IsDeprecatedSet(address indexed _poolToken, bool _isDeprecated);

ClaimRewardsPauseStatusSet

Emitted when claiming rewards is paused or unpaused.

event ClaimRewardsPauseStatusSet(bool _isPaused);

MarketCreated

Emitted when a new market is created.

event MarketCreated(address indexed _poolToken, uint16 _reserveFactor, uint16 _p2pIndexCursor);

Errors

MarketCreationFailedOnCompound

ERRORS ///

Thrown when the creation of a market failed on Compound and kicks back Compound error code.

error MarketCreationFailedOnCompound(uint256 errorCode);

ExceedsMaxBasisPoints

Thrown when the input is above the max basis points value (100%).

error ExceedsMaxBasisPoints();

MarketAlreadyCreated

Thrown when the market is already created.

error MarketAlreadyCreated();

AmountIsZero

Thrown when the amount is equal to 0.

error AmountIsZero();

ZeroAddress

Thrown when the address is the zero address.

error ZeroAddress();

BorrowNotPaused

Thrown when market borrow is not paused.

error BorrowNotPaused();

MarketIsDeprecated

Thrown when market is deprecated.

error MarketIsDeprecated();