diff --git a/src/metamorpho/MetamorphoSnippets.sol b/src/metamorpho/MetamorphoSnippets.sol index b617417..d2b542f 100644 --- a/src/metamorpho/MetamorphoSnippets.sol +++ b/src/metamorpho/MetamorphoSnippets.sol @@ -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; } } diff --git a/test/forge/metamorpho/TestMetamorphoSnippets.sol b/test/forge/metamorpho/TestMetamorphoSnippets.sol index c7640ee..079e580 100644 --- a/test/forge/metamorpho/TestMetamorphoSnippets.sol +++ b/test/forge/metamorpho/TestMetamorphoSnippets.sol @@ -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"; @@ -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" ); }