Skip to content

Commit

Permalink
fix: apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Grimal committed Dec 1, 2023
1 parent b897f87 commit 0dee1fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/metamorpho/MetamorphoSnippets.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ contract MetaMorphoSnippets {
/// @notice Returns the sum of the supply caps of markets with the same collateral `token` on a MetaMorpho `vault`.
/// @dev This is a way to visualize exposure to this token.
/// @param vault The address of the MetaMorpho vault.
/// @param token The collateral token.
function totalCapAsset(address vault, address token) public view returns (uint192 totalCap) {
/// @param asset The collateral asset.
function totalCapCollateral(address vault, address asset) public view returns (uint192 totalCap) {
uint256 queueLength = IMetaMorpho(vault).withdrawQueueLength();

for (uint256 i; i < queueLength; ++i) {
Id idMarket = IMetaMorpho(vault).withdrawQueue(i);
MarketParams memory marketParams = morpho.idToMarketParams(idMarket);

if (marketParams.collateralToken == token) {
if (marketParams.collateralToken == asset) {
totalCap += IMetaMorpho(vault).config(idMarket).cap;
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/forge/metamorpho/TestMetamorphoSnippets.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.0;

import {MetaMorphoSnippets} from "@snippets/metamorpho/MetamorphoSnippets.sol";
import {MetaMorphoSnippets} from "@snippets/metamorpho/MetaMorphoSnippets.sol";
import "@metamorpho-test/helpers/IntegrationTest.sol";

import {SafeCast} from "@openzeppelin/utils/math/SafeCast.sol";
Expand Down Expand Up @@ -130,8 +130,8 @@ contract TestIntegrationSnippets is IntegrationTest {

assertEq(
capMarket1 + capMarket2 + capMarket3,
snippets.totalCapAsset(address(vault), address(collateralToken)),
"cap per market"
snippets.totalCapCollateral(address(vault), address(collateralToken)),
"total collateral cap"
);
}

Expand Down

0 comments on commit 0dee1fd

Please sign in to comment.