The sERC20 token provides a range of utility designed to help you make smarter investement desions.
The official sERC20 coin
0% Buy Tax | 10% Sell Tax
Curated list of sERC20 token templates
Checkout the awesome utility functions holders of the official sERC20 token have access to!
The sERC20 library provides a range of functions to help secure your contract from malicious activity.
sERC20 protects against taxes being set higher than a threshold amount preconfigured when contract is created, importantly correct implementations do not allow for this threshhold to be changed.
sERC20 protects against the blacklisting of the pair, router and contract address.
sERC20 protects from max buy and wallet limits from being set lower than current limits.
sERC20 protects aginst trading settings being changed once enbaled. Once your token is live it can never be turned off.
1 2// sERC20 Library 3 4function _sercVerifiyTaxes(uint256[] memory _taxes, bool _isBuy) 5 internal 6 view 7{ 8 uint256 total = 0; 9 10 for (uint256 i = 0; i < _taxes.length; i++) {11 total += _taxes[i];12 }13 14 uint256 taxThreshold;15 16 if (_isBuy) {17 taxThreshold = buyTaxThreshold;18 } else {19 taxThreshold = sellTaxThreshold;20 }21 22 require( 23 total <= taxThreshold, 24 string( 25 abi.encodePacked( 26 "sERC20: Tax rate can not be set higher than ", 27 Strings.toString(taxThreshold), 28 "%" 29 ) 30 ) 31 ); 32}33 34function _sercSetTaxes(uint256[] memory _taxes, bool _isBuy) internal {35 _sercVerifiyTaxes(_taxes, _isBuy); 36 37 uint256 total = 0;38 39 if (_isBuy) {40 buyTaxes = _taxes;41 42 for (uint256 i = 0; i < _taxes.length; i++) {43 total += _taxes[i];44 }45 46 buyTotalTax = total;47 } else {48 sellTaxes = _taxes;49 50 for (uint256 i = 0; i < _taxes.length; i++) {51 total += _taxes[i];52 }53 54 sellTotalTax = total;55 }56}
1 2// sERC20 Library 3 4function sercSetBlacklisted(address[] memory _addrList, bool _isBlacklisted) 5 external 6 onlyOwner 7{ 8 _sercSetBlacklisted(_addrList, _isBlacklisted); 9}10 11function _sercSetBlacklisted(address[] memory _addrList, bool _isBlacklisted)12 internal13{14 if (tradingEnabled) { 15 require( 16 block.timestamp <= tradingEnabledAt + 10 minutes, 17 "sERC20: Can not blacklist more than 10 minutes after trading has been enabled" 18 ); 19 } 20 21 for (uint256 i = 0; i < _addrList.length; i++) {22 require( 23 pair != _addrList[i], 24 "sERC20: Can not blacklist the pair address" 25 ); 26 require( 27 address(router) != _addrList[i], 28 "sERC20: Can not blacklist the router address" 29 ); 30 require( 31 address(this) != _addrList[i], 32 "sERC20: Can not blacklist the contract address" 33 ); 34 blacklist[_addrList[i]] = _isBlacklisted; 35 }36}
1 2// sERC20 Library 3 4function sercSetMaxTx(uint256 _maxTx) external onlyOwner { 5 require(_maxTx >= maxTx, "sERC20: Can not lower the max tx amount"); 6 7 require( 8 _maxTx <= maxWallet, 9 "sERC20: Can not set max tx higher than the max wallet" 10 ); 11 12 maxTx = _maxTx;13}14 15function sercSetMaxWallet(uint256 _maxWallet) external onlyOwner {16 require( 17 _maxWallet >= maxWallet, 18 "sERC20: Can not lower the max wallet amount" 19 ); 20 21 require( 22 _maxWallet >= maxTx, 23 "sERC20: Can not set max wallet lower than the max tx" 24 ); 25 26 maxWallet = _maxWallet;27}
1 2// sERC20 Library 3 4function sercSetTradingEnabled() public virtual onlyOwner { 5 require(!tradingEnabled, "sERC20: Trading is already enabled"); 6 require(maxTx != 0, "sERC20: Max transaction must be initilised first."); 7 require(maxWallet != 0, "sERC20: Max wallet must be initilised first."); 8 9 tradingEnabledAt = block.timestamp;10 tradingEnabledBlock = block.number;11 tradingEnabled = true;12}