Skip to content

Commit

Permalink
docs: natspec in interface
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD committed Feb 28, 2024
1 parent 23259f8 commit 73f9975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/fixed-rate-irm/FixedRateIrm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,14 @@ string constant RATE_ZERO = "rate zero";
contract FixedRateIrm is IFixedRateIrm {
using MarketParamsLib for MarketParams;

/* EVENTS */

/// @notice Emitted when a borrow rate is set.
event SetBorrowRate(Id indexed id, uint256 newBorrowRate);

/* STORAGE */

/// @notice Borrow rates.
/// @inheritdoc IFixedRateIrm
mapping(Id => uint256) public borrowRateStored;

/* SETTER */

/// @notice Sets the borrow rate for a market.
/// @dev A rate can be set by anybody, but only once.
/// @dev `borrowRate` reverts on rate not set, so the rate needs to be set before the market creation.
/// @inheritdoc IFixedRateIrm
function setBorrowRate(Id id, uint256 newBorrowRate) external {
require(borrowRateStored[id] == 0, RATE_SET);
require(newBorrowRate != 0, RATE_ZERO);
Expand Down
12 changes: 12 additions & 0 deletions src/fixed-rate-irm/interfaces/IFixedRateIrm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ import {Id} from "../../../lib/morpho-blue/src/interfaces/IMorpho.sol";
/// @author Morpho Labs
/// @custom:contact [email protected]
interface IFixedRateIrm is IIrm {
/* EVENTS */

/// @notice Emitted when a borrow rate is set.
event SetBorrowRate(Id indexed id, uint256 newBorrowRate);

/* EXTERNAL */

/// @notice Borrow rates.
function borrowRateStored(Id id) external returns (uint256);

/// @notice Sets the borrow rate for a market.
/// @dev A rate can be set by anybody, but only once.
/// @dev `borrowRate` reverts on rate not set, so the rate needs to be set before the market creation.
function setBorrowRate(Id id, uint256 newBorrowRate) external;
}

0 comments on commit 73f9975

Please sign in to comment.