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

Fail to set bool to false #29

Closed
charles-liu opened this issue Mar 17, 2022 · 1 comment
Closed

Fail to set bool to false #29

charles-liu opened this issue Mar 17, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@charles-liu
Copy link
Contributor

pragma soliditypp ^0.8.0;
contract TestBool{

    mapping(address => bool) public adminMap;

    function setAdmin(address _addr, bool _state) external {
        adminMap[_addr] = _state;
    }
}

setAdmin(_addr, 0) won’t work.

@charles-liu charles-liu added the bug Something isn't working label Mar 17, 2022
@charles-liu charles-liu self-assigned this Mar 17, 2022
@charles-liu
Copy link
Contributor Author

Cause

It passes a string literal 'false' rather than a boolean literal false as the parameter to the ABI encoder.

How to fix

Convert the literal from string to boolean if the type of the parameter is bool.

@charles-liu charles-liu changed the title Can't set bool to false Fail to set bool to false Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant