Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange Setter detector in Slitherin doesn't function as expected - Throws False Positives #147

Closed
zaryab2000 opened this issue Apr 4, 2024 · 3 comments 路 Fixed by #152
Closed
Assignees

Comments

@zaryab2000
Copy link

I was running the slitherin tool in a smart contract that had the following constructor 馃憞

constructor(
        string memory name,
        string memory symbol,
        uint256 totalSupply,
        Fees memory fees_,
        address routerAddress,
        address routerAddress2
    ) ERC20(name, symbol) Ownable(msg.sender) {
        fees = fees_;

        uniswapV2Router = IUniswapV2Router02(routerAddress);
        uniswapV2Router2 = IUniswapV2Router02(routerAddress2);
        uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(
            address(this),
            uniswapV2Router.WETH()
        );
        uniswapV2Pair2 = IUniswapV2Factory(uniswapV2Router2.factory())
            .createPair(address(this), uniswapV2Router2.WETH());

        _isExcludedFromFee[BURN_ADDRESS] = true;
        _isExcludedFromFee[address(this)] = true;
        _isExcludedFromFee[owner()] = true;

        _mint(msg.sender, totalSupply);
    }

Slither threw an info-detector that says:

Function Ownable.constructor(address) (flat.sol#491-496) is a strange setter. Nothing is set in constructor or set in a function without using function parameters

This is incorrect as it can clearly be seen that :

  • There are a few state variables that are being updated inside the constructor
  • Additionally, the arguments passed are also being used in the constructor.
@olegggatttor
Copy link
Contributor

I think we missed implementing the check for the call of the base constructor, so name and symbol are considered unused. Feel free to submit a PR with a fix, or we will try to handle it ourselves soon. Thank you in any case!

@olegggatttor
Copy link
Contributor

I'll take it!

@ndkirillov
Copy link
Collaborator

Released with #157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants