MorphoGovernance
Inherits: MorphoUtils
Author: Morpho Labs.
Governance functions for Morpho.
Functions
initialize
UPGRADE ///
Initializes the Morpho contract.
function initialize(
IEntryPositionsManager _entryPositionsManager,
IExitPositionsManager _exitPositionsManager,
IInterestRatesManager _interestRatesManager,
ILendingPoolAddressesProvider _lendingPoolAddressesProvider,
Types.MaxGasForMatching memory _defaultMaxGasForMatching,
uint256 _maxSortedUsers
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
_entryPositionsManager | IEntryPositionsManager | The entryPositionsManager . |
_exitPositionsManager | IExitPositionsManager | The exitPositionsManager . |
_interestRatesManager | IInterestRatesManager | The interestRatesManager . |
_lendingPoolAddressesProvider | ILendingPoolAddressesProvider | The addressesProvider . |
_defaultMaxGasForMatching | Types.MaxGasForMatching | The defaultMaxGasForMatching . |
_maxSortedUsers | uint256 | The _maxSortedUsers . |
setMaxSortedUsers
GOVERNANCE ///
Sets maxSortedUsers
.
function setMaxSortedUsers(uint256 _newMaxSortedUsers) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_newMaxSortedUsers | uint256 | The new maxSortedUsers value. |
setDefaultMaxGasForMatching
Sets defaultMaxGasForMatching
.
function setDefaultMaxGasForMatching(Types.MaxGasForMatching memory _defaultMaxGasForMatching) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_defaultMaxGasForMatching | Types.MaxGasForMatching | The new defaultMaxGasForMatching . |
setEntryPositionsManager
Sets the entryPositionsManager
.
function setEntryPositionsManager(IEntryPositionsManager _entryPositionsManager) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_entryPositionsManager | IEntryPositionsManager | The new entryPositionsManager . |
setExitPositionsManager
Sets the exitPositionsManager
.
function setExitPositionsManager(IExitPositionsManager _exitPositionsManager) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_exitPositionsManager | IExitPositionsManager | The new exitPositionsManager . |
setInterestRatesManager
Sets the interestRatesManager
.
function setInterestRatesManager(IInterestRatesManager _interestRatesManager) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_interestRatesManager | IInterestRatesManager | The new interestRatesManager contract. |
setTreasuryVault
Sets the treasuryVault
.
function setTreasuryVault(address _treasuryVault) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_treasuryVault | address | The address of the new treasuryVault . |
setReserveFactor
Sets the reserveFactor
.
function setReserveFactor(address _poolToken, uint16 _newReserveFactor)
external
onlyOwner
isMarketCreated(_poolToken);
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The market on which to set the _newReserveFactor . |
_newReserveFactor | uint16 | The 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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_p2pIndexCursor | uint16 | The new peer-to-peer cursor. |
setIsSupplyPaused
Sets isSupplyPaused
for a given market.
function setIsSupplyPaused(address _poolToken, bool _isPaused) external onlyOwner isMarketCreated(_poolToken);
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_isPaused | bool | The 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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_isPaused | bool | The 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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_isPaused | bool | The 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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_isPaused | bool | The 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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_isPaused | bool | The 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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_isPaused | bool | The new pause status, true to pause the mechanism. |
setIsPausedForAllMarkets
Sets the pause status for all markets.
function setIsPausedForAllMarkets(bool _isPaused) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_isPaused | bool | The 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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market of which to enable/disable peer-to-peer matching. |
_isP2PDisabled | bool | True to disable the peer-to-peer market. |
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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_isDeprecated | bool | The 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
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market on which to increase deltas. |
_amount | uint256 | The 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
Name | Type | Description |
---|---|---|
_poolTokens | address[] | The addresses of the pool token addresses on which to claim the reserve fee. |
_amounts | uint256[] | The list of amounts of underlying tokens to claim on each market. |
createMarket
Creates a new market to borrow/supply in.
function createMarket(address _underlyingToken, uint16 _reserveFactor, uint16 _p2pIndexCursor) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_underlyingToken | address | The underlying token address. |
_reserveFactor | uint16 | The reserve factor to set on this market. |
_p2pIndexCursor | uint16 | The peer-to-peer index cursor to set on this market. |
_setPauseStatus
INTERNAL ///
Sets all pause statuses for a given market.
function _setPauseStatus(address _poolToken, bool _isPaused) internal;
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market to update. |
_isPaused | bool | The 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);
EntryPositionsManagerSet
Emitted when the entryPositionsManager
is set.
event EntryPositionsManagerSet(address indexed _entryPositionsManager);
ExitPositionsManagerSet
Emitted when the exitPositionsManager
is set.
event ExitPositionsManagerSet(address indexed _exitPositionsManager);
InterestRatesSet
Emitted when the interestRatesManager
is set.
event InterestRatesSet(address indexed _interestRatesManager);
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);
MarketCreated
Emitted when a new market is created.
event MarketCreated(address indexed _poolToken, uint16 _reserveFactor, uint16 _p2pIndexCursor);
Errors
MarketIsNotListedOnAave
ERRORS ///
Thrown when the market is not listed on Aave.
error MarketIsNotListedOnAave();
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();
MaxSortedUsersCannotBeZero
Thrown when trying to set the max sorted users to 0.
error MaxSortedUsersCannotBeZero();
MaxNumberOfMarkets
Thrown when the number of markets will exceed the bitmask's capacity.
error MaxNumberOfMarkets();
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();