You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The detectors do not understand that the try block declares a variable, initializes it to the return value of the called function, and then makes it available in the try scope.
// SPDX-License-Identifier: unlicensed
pragma solidity ^0.8.0;
interface IContract {
function foo() external returns (uint256);
}
contract Test {
function test(address _contractAddress) external {
IContract _contract = IContract(_contractAddress);
try _contract.foo() returns (uint256 bar) {
uint256 x = bar;
} catch {
revert("Contract does not implement foo()");
}
}
}
INFO:Detectors:
Test.test(address).bar (contracts/LiquidityOcean/Test.sol#12) is a local variable never initialized
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables
INFO:Detectors:
Test.test(address) (contracts/LiquidityOcean/Test.sol#10-17) ignores return value by _contract.foo() (contracts/LiquidityOcean/Test.sol#12-16)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return
INFO:Detectors:
Variable 'Test.test(address).bar (contracts/LiquidityOcean/Test.sol#12)' in Test.test(address) (contracts/LiquidityOcean/Test.sol#10-17) potentially used before declaration: x = bar (contracts/LiquidityOcean/Test.sol#13)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#pre-declaration-usage-of-local-variables
The text was updated successfully, but these errors were encountered:
The detectors do not understand that the try block declares a variable, initializes it to the return value of the called function, and then makes it available in the try scope.
The text was updated successfully, but these errors were encountered: