MorphoGovernance
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
Name | Type | Description |
---|---|---|
_positionsManager | IPositionsManager | The positionsManager . |
_interestRatesManager | IInterestRatesManager | The interestRatesManager . |
_comptroller | IComptroller | The comptroller . |
_defaultMaxGasForMatching | Types.MaxGasForMatching | The defaultMaxGasForMatching . |
_dustThreshold | uint256 | The dustThreshold . |
_maxSortedUsers | uint256 | The _maxSortedUsers . |
_cEth | address | The cETH address. |
_wEth | address | The wETH address. |
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 . |
setPositionsManager
Sets the positionsManager
.
function setPositionsManager(IPositionsManager _positionsManager) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_positionsManager | IPositionsManager | The new positionsManager . |
setInterestRatesManager
Sets the interestRatesManager
.
function setInterestRatesManager(IInterestRatesManager _interestRatesManager) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_interestRatesManager | IInterestRatesManager | The new interestRatesManager contract. |
setRewardsManager
Sets the rewardsManager
.
function setRewardsManager(IRewardsManager _rewardsManager) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_rewardsManager | IRewardsManager | The new rewardsManager . |
setTreasuryVault
Sets the treasuryVault
.
function setTreasuryVault(address _treasuryVault) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_treasuryVault | address | The address of the new treasuryVault . |
setDustThreshold
Sets dustThreshold
.
function setDustThreshold(uint256 _dustThreshold) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_dustThreshold | uint256 | The new dustThreshold . |
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. |
setIsClaimRewardsPaused
Sets isClaimRewardsPaused
.
function setIsClaimRewardsPaused(bool _isPaused) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_isPaused | bool | The 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
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 _poolToken, Types.MarketParameters calldata _marketParams) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The pool token address of the given market. |
_marketParams | Types.MarketParameters | The market's parameters to set. |
_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);
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();