Skip to content
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.

8olidity - Logic Error in _decreaseCurrentMinted #85

Closed
sherlock-admin opened this issue Mar 13, 2023 · 0 comments
Closed

8olidity - Logic Error in _decreaseCurrentMinted #85

sherlock-admin opened this issue Mar 13, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 13, 2023

8olidity

high

Logic Error in _decreaseCurrentMinted

Summary

Logic Error in _decreaseCurrentMinted

Vulnerability Detail

In the TAU.sol contract, _decreaseCurrentMinted is used to reduce a user's currentMinted value.

function _decreaseCurrentMinted(address account, uint256 amount) internal virtual {
    // If the burner is a vault, subtract burnt TAU from its currentMinted.
    // This has a few highly unimportant edge cases which can generally be rectified by increasing the relevant vault's mintLimit.
    uint256 accountMinted = currentMinted[account];
    if (accountMinted >= amount) {
        currentMinted[msg.sender] = accountMinted - amount;//@audit
    }
}

In the last line, the code updates the value of currentMinted[msg.sender], which is incorrect. It should update the value of currentMinted[account].

For example, there are two users A and B. When A calls burn(1), the value of currentMinted[A] will be updated. However, when A calls burnFrom(B,1), the value of currentMinted[A] will still be updated, but it should update the value of currentMinted[B].

Impact

Logic Error in _decreaseCurrentMinted

Code Snippet

https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/TAU.sol#L81

Tool used

Manual Review

Recommendation

    function _decreaseCurrentMinted(address account, uint256 amount) internal virtual {
        // If the burner is a vault, subtract burnt TAU from its currentMinted.
        // This has a few highly unimportant edge cases which can generally be rectified by increasing the relevant vault's mintLimit.
        uint256 accountMinted = currentMinted[account];
        if (accountMinted >= amount) {
-           currentMinted[msg.sender] = accountMinted - amount; 
+           currentMinted[account] = accountMinted - amount; 
        }
    }

Duplicate of #149

@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Mar 21, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant