Static Analyzer for Solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
slither/tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol

39 lines
1.1 KiB

contract VarReadUsingThis {
address public erc20;
mapping(uint => address) public myMap;
function bad1(uint x) external returns(address) {
return this.myMap(x);
}
function bad2() external returns(address) {
return this.erc20();
}
function bad3() external returns(address) {
if (this.erc20() == address(0)) revert();
}
function bad4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = this.erc20();
}
}
function good1(uint x) external returns(address) {
return myMap[x];
}
function good2() external returns(address) {
return erc20;
}
function good3() external returns(address) {
if (erc20 == address(0)) revert();
}
function good4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = erc20;
}
}
function mapExternal(uint x) external view returns(address) {
return myMap[x];
}
function good5(uint x) external returns(address) {
this.mapExternal(x);
}
}