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

Ruhum - TAU doesn't decrease vault's mint amount when tokens are burned #9

Closed
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

Ruhum

medium

TAU doesn't decrease vault's mint amount when tokens are burned

Summary

The TAU contract keeps track of the number of tokens that are minted to enforce a limit. But, when tokens are burned the value is not decreased.

Vulnerability Detail

Whenever new TAU is minted, the amount is added to currentMinted. For every mint, the contract verifies that currentMinted + amount < mintLimit. When TAU is burned, it's supposed to reduce the caller's currentMinted. But, the contract compares the caller's currentMinted with the value of the account whose TAU is burned. Meaning, it compares the vault's value with that of the end user.

    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;
        }
    }

The end user is not granted the permission to mint any TAU themselves. Thus, their currentMinted will always be 0. Meaning the check accountMinted >= amount is 0 >= X, which will always evaluate to false (we never burn 0 tokens; if we do, that doesn't decrease currentMinted either).

Impact

The vault's currentMinted is never decreased causing the vault to reach its limit which will stop users from taking out new loans.

Code Snippet

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

Tool used

Manual Review

Recommendation

Change _decreaseCurrentMinted() to:

    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[msg.sender];
        if (accountMinted >= amount) {
            currentMinted[msg.sender] = 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