arc icon indicating copy to clipboard operation
arc copied to clipboard

Should not attempt to mint if _reputation == 0

Open dkent600 opened this issue 5 years ago • 0 comments

See line 329 of ContributionRewardExt. All the other reward types follow the right pattern except reputation. The idea is to be clear and consistent in the code and to avoid what I am guessing will be a tx when there are 0 reputation to be minted.

        require(
        Controller(
        avatar.owner()).mintReputation(_reputation, _beneficiary, address(avatar)));
        if (_reputation != 0) {
            emit RedeemReputation(address(avatar), _proposalId, _beneficiary, int256(_reputation));
        }
}

should be (note also adding a missing revert string):

        if (_reputation != 0) {

            require(
            Controller(
            avatar.owner()).mintReputation(_reputation, _beneficiary, address(avatar)),
            "with an error message");

            emit RedeemReputation(address(avatar), _proposalId, _beneficiary, int256(_reputation));
        }

dkent600 avatar Jan 15 '20 12:01 dkent600