From 791b10cfa44bb39c729f6c545ea675d3885f815b Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 8 Apr 2024 21:30:27 +0200 Subject: [PATCH] Inlining math for totalAssets() --- core/contracts/stBTC.sol | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/contracts/stBTC.sol b/core/contracts/stBTC.sol index 8b91845b5..d97aadd8b 100644 --- a/core/contracts/stBTC.sol +++ b/core/contracts/stBTC.sol @@ -175,9 +175,8 @@ contract stBTC is ERC4626Fees, PausableOwnable { /// @notice Returns the total amount of assets held by the vault across all /// allocations and this contract. function totalAssets() public view override returns (uint256) { - uint256 totalAmount = IERC20(asset()).balanceOf(address(this)); - totalAmount += dispatcher.totalAssets(); - return totalAmount; + return + IERC20(asset()).balanceOf(address(this)) + dispatcher.totalAssets(); } /// @notice Mints shares to receiver by depositing exactly amount of