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

QA Report #122

Open
code423n4 opened this issue Jun 26, 2022 · 0 comments
Open

QA Report #122

code423n4 opened this issue Jun 26, 2022 · 0 comments
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Non-Critical Issues

Missing zero-address checks in Yieldy.sol

In Yieldy.sol, all functions except transferFrom() have zero address checks for address parameters. However, transferFrom() is missing zero address checks for _to and _from, making it inconsistent:

    function transferFrom(
        address _from,
        address _to,
        uint256 _value
    ) public override returns (bool) {
        require(_allowances[_from][msg.sender] >= _value, "Allowance too low");

        uint256 newValue = _allowances[_from][msg.sender] - _value; 
        _allowances[_from][msg.sender] = newValue;
        emit Approval(_from, msg.sender, newValue);

        uint256 creditAmount = creditsForTokenBalance(_value);
        creditBalances[_from] = creditBalances[_from] - creditAmount;
        creditBalances[_to] = creditBalances[_to] + creditAmount;
        emit Transfer(_from, _to, _value);

        return true;
    }

Impact

Tokens would become inaccessible if _to is set to address(0).

Recommended Mitigation

Consider adding zero-address checks to _to and _from. Other than preventing users from sending tokens to address(0), it would also help to save gas should _from be set to address(0).

event is missing indexed fields

Each event should use three indexed fields if there are three or more fields:

src/contracts/Yieldy.sol:
  15:        event LogSupply(
  16:            uint256 indexed epoch,
  17:            uint256 timestamp,
  18:            uint256 totalSupply
  19:        );

  21:        event LogRebase(uint256 indexed epoch, uint256 rebase, uint256 index);

src/contracts/Staking.sol:
  36:        event LogSetCurvePool(address indexed curvePool, int128 to, int128 from);
@code423n4 code423n4 added bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Jun 26, 2022
code423n4 added a commit that referenced this issue Jun 26, 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 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

1 participant