Summary
The contract is making unnecessary external calls to fetch data, even though internal getter functions are available. This results in higher gas costs and potential security risks. The issue needs optimization to ensure internal getters are used whenever possible.
Vulnerability Details
StrategyArb.sol::_freeFunds();
function _freeFunds(uint256 _amount) internal override {
- uint256 totalAvailabe = transmuter.getUnexchangedBalance(address(this));
+ uint256 totalAvailable = unexchangedBalance();
if (_amount > totalAvailable) {
transmuter.withdraw(totalAvailable, address(this));
} else {
transmuter.withdraw(_amount, address(this));
}
}
StrategyArb::balanceDeployed()
function balanceDeployed() public view returns (uint256) {
return transmuter.getUnexchangedBalance(address(this)) + underlying.balanceOf(address(this)) + asset.balanceOf(address(this));
}
StrategyArb::_harvestAndReport();
function _harvestAndReport()
internal
override view
returns (uint256 _totalAssets)
{
- uint256 claimable = transmuter.getClaimableBalance(address(this));
+ uint256 claimable = claimableBalance();
if (claimable > 0) {
}
- uint256 unexchanged = transmuter.getUnexchangedBalance(address(this));
+ uint256 unexchanged = unexchangedBalance();
uint256 underlyingBalance = underlying.balanceOf(address(this));
_totalAssets = unexchanged + asset.balanceOf(address(this)) + underlyingBalance;
}
StrategyArb::availableWithdrawLimit()
function availableWithdrawLimit(
address
) public view override returns (uint256) {
return asset.balanceOf(address(this)) + transmuter.getUnexchangedBalance(address(this));
}
Impact
The bug leads to unnecessary external calls, which increases gas costs and may cause inefficiencies in the contract. This also introduces potential security risks by relying on external contracts when internal functions could be used instead.
Tools Used
Manual Review
Recommendations
Use internal function, instead of external calls