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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue strange_setter #158

Closed
VuKhuongDuy opened this issue May 9, 2024 · 2 comments · Fixed by #166
Closed

Issue strange_setter #158

VuKhuongDuy opened this issue May 9, 2024 · 2 comments · Fixed by #166
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@VuKhuongDuy
Copy link

I have a smart contract like this, I don't understand why it receive error strange_setter
This is my contract

// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Token is ERC20 {
    constructor(
        string memory name,
        string memory symbol,
        uint256 supply
    ) ERC20(name, symbol) {
        _mint(msg.sender, supply);
    }
}

This is error:

Function Token.constructor(string,string,uint256) (contracts/Token.sol#8-14) is a strange setter. Nothing is set in constructor or set in a function without using function parameters
Reference: https://github.com/pessimistic-io/slitherin/blob/master/docs/strange_setter.md

@ndkirillov
Copy link
Collaborator

ndkirillov commented May 13, 2024

The pess-strange-setter detector examines whether any changes are made to state variables using function parameters. In your case, if nothing is set to state variables in either the constructor function or the _mint function, the detector will indicate that something might be wrong and you'd better double-check it.

However, it is worth improving as it's obviously a FP in your case.
We'll do that, thanks for pointing out.

@ndkirillov ndkirillov added the enhancement New feature or request label May 13, 2024
@ndkirillov ndkirillov added this to the 0.7.1 version milestone Jun 6, 2024
@ndkirillov ndkirillov linked a pull request Jun 6, 2024 that will close this issue
@ndkirillov ndkirillov mentioned this issue Jun 7, 2024
@ndkirillov
Copy link
Collaborator

Merged fixes with #170.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants