/** *Submitted for verification at BscScan.com on 2022-10-27 */ /** *Submitted for verification at BscScan.com on 2022-07-14 */ /* Website: https://www.1amd.co/ Contract Name: Free Speech Instagram: https://www.instagram.com/1amdtoken Twitter: https://twitter.com/1amdtoken Telegram: https://t.me/FreeSpeechToken Contract Supply: 100,000,000 Contract Tokenomics: 2% Team. 1% Liquidity. 2% Marketing. 5% Total Tax */ //SPDX-License-Identifier:Unlicensed pragma solidity 0.8.17; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require( address(this).balance >= amount, "Address: insufficient balance" ); (bool success, ) = recipient.call{value: amount}(""); require( success, "Address: unable to send value, recipient may have reverted" ); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue( target, data, 0, "Address: low-level call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue( target, data, value, "Address: low-level call with value failed" ); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require( address(this).balance >= value, "Address: insufficient balance for call" ); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}( data ); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall( target, data, "Address: low-level static call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall( target, data, "Address: low-level delegate call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() external virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) external virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } interface IUniswapV2Factory { event PairCreated( address indexed token0, address indexed token1, address pair, uint256 ); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint256) external view returns (address pair); function allPairsLength() external view returns (uint256); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval( address indexed owner, address indexed spender, uint256 value ); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address owner) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint256); function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; event Burn( address indexed sender, uint256 amount0, uint256 amount1, address indexed to ); event Swap( address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint256); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns ( uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast ); function price0CumulativeLast() external view returns (uint256); function price1CumulativeLast() external view returns (uint256); function kLast() external view returns (uint256); function burn(address to) external returns (uint256 amount0, uint256 amount1); function swap( uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } contract FreeSpeech is Context, IERC20, Ownable { using Address for address; address payable public marketingWalletAddress = payable(0x3A8606DCfbe8a1f60C15C476f09B87937FD5D26b); // Marketing Wallet Address address payable public teamWalletAddress = payable(0x00EeedF49f6069b6dD2753477dA9Ac48dFE9679b); // team Wallet Address address public constant deadWallet = 0x000000000000000000000000000000000000dEaD; address private freespeechDeployer = 0x90D4B9B60e27AE270BE4bDD42BdBd76b262EB2A4; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; event Log(string, uint256); event AuditLog(string, address); mapping(address => bool) private _isExcludedFromFee; mapping(address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 100_000_000 gwei; uint256 private _tFeeTotal; string private constant _name = "Free Speech"; string private constant _symbol = "test3"; uint8 private constant _decimals = 9; uint256 public _liquidityFee = 1; uint256 private _previousLiquidityFee = _liquidityFee; uint256 public _marketingFee = 2; uint256 private _previousMarketingFee = _marketingFee; uint256 public _teamFee = 2; uint256 private _previousteamFee = _teamFee; uint256 public totalSwapableFee = _liquidityFee + _marketingFee + _teamFee; uint256 public liquidityTokensCollected = 0; uint256 public marketingTokensCollected = 0; uint256 public teamTokensCollected = 0; uint256 private liquidityTokensToSell = 0; uint256 private marketingTokensToSell = 0; uint256 private teamTokensToSell = 0; uint256 private tokensToSell = 10_000 gwei; IUniswapV2Router02 public immutable uniswapV2Router; address public currentRouter; address public immutable uniswapV2Pair; bool public inSwapAndLiquify; bool public swapAndLiquifyEnabled = false; event RewardLiquidityProviders(uint256 tokenAmount); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); event SwapTokensForETH(uint256 amountIn, address[] path); event UsernameSet(address indexed _user, bytes32 indexed _username); modifier lockTheSwap() { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor() { require(msg.sender == freespeechDeployer, "Your not the deployer of this contract"); _tOwned[_msgSender()] = _tTotal; //Adding Variables for all the routers for easier deployment for our customers. if (block.chainid == 56) { currentRouter = 0x10ED43C718714eb63d5aA57B78B54704E256024E; // PCS Router } else if (block.chainid == 97) { currentRouter = 0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3; // PCS Testnet } else if (block.chainid == 43114) { currentRouter = 0x60aE616a2155Ee3d9A68541Ba4544862310933d4; //Avax Mainnet } else if (block.chainid == 137) { currentRouter = 0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff; //Polygon Ropsten } else if (block.chainid == 250) { currentRouter = 0xF491e7B69E4244ad4002BC14e878a34207E38c29; //SpookySwap FTM } else if (block.chainid == 3) { currentRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; //Ropsten } else if (block.chainid == 1 || block.chainid == 4) { currentRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; //Mainnet } else { revert(); } //End of Router Variables. IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(currentRouter); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router = _uniswapV2Router; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() external pure returns (string memory) { return _name; } function symbol() external pure returns (string memory) { return _symbol; } function decimals() external pure returns (uint8) { return _decimals; } function totalSupply() external view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _tOwned[account]; } function transfer(address recipient, uint256 amount) external override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) external view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) external override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) external override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()] - amount ); return true; } function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender] + addedValue ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) external virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue ); return true; } function tokensToSellAmount() external view returns (uint256) { return tokensToSell; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); uint256 contractTokenBalance = balanceOf(address(this)); bool overMinimumTokenBalance = contractTokenBalance >= tokensToSell; if ( !inSwapAndLiquify && swapAndLiquifyEnabled && from != uniswapV2Pair && from != owner() ) { if (overMinimumTokenBalance) { swapAndLiquify(); } } bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } _tokenTransfer(from, to, amount, takeFee); } function swapAndLiquify() public lockTheSwap { uint256 initialBalance = address(this).balance; liquidityTokensToSell = (tokensToSell * 2) / 10; if(liquidityTokensCollected <= liquidityTokensToSell ){ liquidityTokensToSell = liquidityTokensCollected; liquidityTokensCollected = 0; } if(liquidityTokensCollected > liquidityTokensToSell){ liquidityTokensCollected = liquidityTokensCollected - liquidityTokensToSell; } marketingTokensToSell = (tokensToSell * 4) / 10; if(marketingTokensCollected <= marketingTokensToSell){ marketingTokensToSell = marketingTokensCollected; marketingTokensCollected = 0; } if(marketingTokensCollected > marketingTokensToSell){ marketingTokensCollected = marketingTokensCollected - marketingTokensToSell; } teamTokensToSell = (tokensToSell * 4) / 10; if(teamTokensCollected <= teamTokensToSell){ teamTokensToSell = teamTokensCollected; teamTokensCollected = 0; } if(teamTokensCollected > teamTokensToSell){ teamTokensCollected = teamTokensCollected - teamTokensToSell; } uint256 halfLiquidityTokensToSell = liquidityTokensToSell / 2; swapTokensForEth(halfLiquidityTokensToSell); uint256 newBalance = address(this).balance - initialBalance; addLiquidity(halfLiquidityTokensToSell, newBalance); emit SwapAndLiquify( halfLiquidityTokensToSell, newBalance, halfLiquidityTokensToSell ); uint256 remainingTokensToSell = marketingTokensToSell + teamTokensToSell; swapTokensForEth(remainingTokensToSell); newBalance = address(this).balance; uint256 ethForMarketing = newBalance / 2; uint256 ethForteam = newBalance / 2; transferToAddressETH(marketingWalletAddress, ethForMarketing); transferToAddressETH(teamWalletAddress, ethForteam); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH //testing 1 from 0 path, address(this), // The contract block.timestamp ); emit SwapTokensForETH(tokenAmount, path); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable address(this), //changed as requested by audit block.timestamp ); } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) { removeAllFee(); } countUpFeeShare(amount); _transferBothExcluded(sender, recipient, amount); restoreAllFee(); } function countUpFeeShare(uint256 amount) private { if (totalSwapableFee == 0) { return; } liquidityTokensCollected += (amount * _liquidityFee) / 100; marketingTokensCollected += (amount * _marketingFee) / 100; teamTokensCollected += (amount * _teamFee) / 100; } function _transferBothExcluded( address sender, address recipient, uint256 tAmount ) private { (uint256 tTransferAmount, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender] - tAmount; _tOwned[recipient] = _tOwned[recipient] + tTransferAmount; _takeLiquidity(tLiquidity); emit Transfer(sender, recipient, tTransferAmount); } function _getValues(uint256 tAmount) private view returns (uint256, uint256) { (uint256 tTransferAmount, uint256 tLiquidity) = _getTValues(tAmount); return (tTransferAmount, tLiquidity); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256) { uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = (tAmount) - tLiquidity; return (tTransferAmount, tLiquidity); } function _takeLiquidity(uint256 tLiquidity) private { _tOwned[address(this)] = _tOwned[address(this)] + tLiquidity; } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return (_amount * totalSwapableFee) / 100; } function removeAllFee() private { _liquidityFee = 0; _marketingFee = 0; _teamFee = 0; totalSwapableFee = 0; } function restoreAllFee() private { _liquidityFee = _previousLiquidityFee; _marketingFee = _previousMarketingFee; _teamFee = _previousteamFee; totalSwapableFee = _liquidityFee + _marketingFee + _teamFee; } function isExcludedFromFee(address account) external view returns (bool) { return _isExcludedFromFee[account]; } function excludeFromFee(address account) external onlyOwner { _isExcludedFromFee[account] = true; emit AuditLog( "We have excluded the following walled in fees:", account ); } function includeInFee(address account) external onlyOwner { _isExcludedFromFee[account] = false; emit AuditLog("We have include the following walled in fees:", account); } function setTokensToSell(uint256 _tokensToSell) external onlyOwner { tokensToSell = _tokensToSell; emit Log( "We have updated minimunTokensBeforeSwap to:", tokensToSell ); } function setMarketingWalletAddress(address _marketingWallet) external onlyOwner { require( _marketingWallet != address(0), "setMarketingWalletAddress: ZERO" ); marketingWalletAddress = payable(_marketingWallet); emit AuditLog( "We have Updated the MarketingWallet:", marketingWalletAddress ); } function setTeamWalletAddress(address _teamWallet) external onlyOwner { require(_teamWallet != address(0), "setteamWalletAddress: ZERO"); teamWalletAddress = payable(_teamWallet); emit AuditLog("We have Updated the teamWallet:", teamWalletAddress); } function setSwapAndLiquifyEnabled(bool _enabled) external onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } function transferToAddressETH(address payable recipient, uint256 amount) private { recipient.transfer(amount); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} /////---dev----//// event SwapETHForTokens(uint256 amountIn, address[] path); function withdraw() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); emit AuditLog("We have withdraw eth from contract.", msg.sender); } // Withdraw ETH that's potentially stuck in the Contract function recoverETHfromContract() public virtual onlyOwner { payable(marketingWalletAddress).transfer(address(this).balance); emit AuditLog( "We have recover the stock eth from contract.", marketingWalletAddress ); } // Withdraw ERC20 tokens that are potentially stuck in Contract function recoverTokensFromContract(address _tokenAddress, uint256 _amount) external onlyOwner { require(_tokenAddress != address(this) , "use recoverContractTokens to recover this contract's tokens"); IERC20(_tokenAddress).transfer(marketingWalletAddress, _amount); emit Log("We have recovered tokens from contract:", _amount); } function recoverContractTokens(uint256 _amount) external onlyOwner{ uint256 liquidityTokensToRecover = (_amount * 2) / 10; uint256 marketingTokensToRecover = (_amount * 4) / 10; uint256 teamTokensToRecover = (_amount * 4) / 10; if(liquidityTokensCollected <= liquidityTokensToRecover){ liquidityTokensCollected = 0; } if(liquidityTokensCollected > liquidityTokensToRecover){ liquidityTokensCollected = liquidityTokensCollected - liquidityTokensToRecover; } if(marketingTokensCollected <= marketingTokensToRecover){ marketingTokensCollected = 0; } if(marketingTokensCollected > marketingTokensToRecover){ marketingTokensCollected = marketingTokensCollected - marketingTokensToRecover; } if(teamTokensCollected <= teamTokensToRecover){ teamTokensCollected = 0; } if(teamTokensCollected > teamTokensToRecover){ teamTokensCollected = teamTokensCollected - teamTokensToRecover; } IERC20(address(this)).transfer(marketingWalletAddress, _amount); emit Log("We have recovered tokens from contract:", _amount); } function cleanUpCollectedTokens() external onlyOwner{ liquidityTokensCollected = 0; marketingTokensCollected = 0; teamTokensCollected = 0; } }
0.4.18