Slither

Slither

Community Analyzer

Contract reads its own variable using this SLITHER-W1092

Performance
Major

The contract reads its own variable using this, adding overhead of an unnecessary STATICCALL.

Exploit Scenario

contract C {
    mapping(uint => address) public myMap;
    function test(uint x) external returns(address) {
        return this.myMap(x);
    }
}

Recommendation

Read the variable directly from storage instead of calling the contract.

Learn more

var-read-using-this on Slither's wiki.