roberts / standard

Drew Roberts Contract Standard for ERC-20 Tokens
https://DrewRoberts.com
MIT License
0 stars 1 forks source link

updateSwapTokenAmount() Function #13

Open drewroberts opened 8 months ago

drewroberts commented 8 months ago

This function allows contract owner to update the threshold that the tax swap sells tokens to receive ETH and distribute to tax wallets.

drewroberts commented 8 months ago

Here is that function in my old contract standard:

    function updateSwapTokensAtAmount(uint256 newAmount)
        external
        onlyOwner
        returns (bool)
    {
        require(
            newAmount >= (totalSupply() * 1) / 100000,
            "ERC20: Swap amount cannot be lower than 0.001% total supply."
        );
        require(
            newAmount <= (totalSupply() * 5) / 1000,
            "ERC20: Swap amount cannot be higher than 0.5% total supply."
        );
        swapTokensAtAmount = newAmount;
        return true;
    }