🛰️Overview

sERC20 is an abstract contract for secure smart contract development. Extend our SERC20 class to secure your code today.

Installation

npm install @serc-20/serc

Usage

// contracts/MyToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "@serc20/contracts/SERC20.sol";

contract MyToken is SERC20 {

    constructor()
        SERC20(
            "SERC20MOCK", // Name
            "SERC20MOCK", // Symbol
            0xFABB0ac9d68B0B445fB7357272Ff202C5651694a, // Router address
            15, // Buy tax threshold
            15 // Sell tax threshold
        )
    {
        uint256[] memory buyTaxes = new uint256[](2);
        // Dev Tax
        buyTaxes[0] = 8;

        // Liq Tax
        buyTaxes[1] = 2;

        uint256[] memory sellTaxes = new uint256[](2);
        // Dev Tax
        sellTaxes[0] = 8;

        // Liq Tax
        sellTaxes[1] = 2;

        _sercSetTaxes(buyTaxes, true); // initilise buy taxes
        _sercSetTaxes(sellTaxes, false); // initilise buy taxes

        /*
            _mint is an internal function in ERC20.sol that is only called here,
            and CANNOT be called ever again
        */
        _mint(msg.sender, 1_000_000_000 * 1e18);
    }
}

To keep your token secure, you should always use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself.

Security

Please report any security issues you find directly to contact@serc20.com

Last updated