Assessment reports>SAX>Discussion>Initial mint sellable

Initial mint sellable

When new tokens are created, an initial supply of 10,000 tokens is minted. When selling tokens, it is not possible to sell tokens when supply would fall below this initial amount:

function getSellPrice(address token, uint256 amount) public view returns (uint256) {
    HashtagData memory data = registeredTokens[token];
    if (data.supply - amount < initialSupply) revert NotAllowed();
    // ...
}

However, the initial mint of 10,000 is allocated to the creator of the token and can be sold as any other:

function createToken(string calldata hashtag, address recipient, uint16 viralityScore) external {
    // ...
    // create the token + mint the inital supply; this contract can mint/burn
    TrendingERC20 token = new TrendingERC20(address(this), hashtag, hashtag);
    token.mint(recipient, initialSupply);
    // ...
}

This means that it is possible for users to buy tokens while later not being able to sell them. If, for example, after the initial creation another 10,000 tokens get sold by the contract to users, and then the creator of the token sells their 10,000 tokens to the contract, then none of the users will be able to sell their token. To avoid this, consider not allocating the initial supply to any user.

Zellic © 2024Back to top ↑