Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add idToMarket getter #278

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Morpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ contract Morpho is IMorpho {
mapping(address => mapping(address => bool)) public isAuthorized;
/// @inheritdoc IMorpho
mapping(address => uint256) public nonce;
/// @inheritdoc IMorpho
mapping(Id => Market) public idToMarket;
MerlinEgalite marked this conversation as resolved.
Show resolved Hide resolved

/* CONSTRUCTOR */

Expand Down Expand Up @@ -148,6 +150,7 @@ contract Morpho is IMorpho {
require(lastUpdate[id] == 0, ErrorsLib.MARKET_CREATED);

lastUpdate[id] = block.timestamp;
idToMarket[id] = market;

emit EventsLib.CreateMarket(id, market);
}
Expand Down
6 changes: 6 additions & 0 deletions src/interfaces/IMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ interface IMorpho is IFlashLender {
/// @notice The `user`'s current nonce. Used to prevent replay attacks with EIP-712 signatures.
function nonce(address user) external view returns (uint256);

/// @notice The market configuration corresponding to `id`.
function idToMarket(Id id)
external
view
returns (address borrowableAsset, address collateralAsset, address oracle, address irm, uint256 lltv);

/// @notice Sets `newOwner` as owner of the contract.
function setOwner(address newOwner) external;

Expand Down