Permalink
695 lines (571 sloc)
25.1 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: SimPL-2.0 | |
| pragma solidity ^0.6.12; | |
| 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); | |
| } | |
| library SafeMath { | |
| function add(uint256 a, uint256 b) internal pure returns (uint256) { | |
| uint256 c = a + b; | |
| require(c >= a, "SafeMath: addition overflow"); | |
| return c; | |
| } | |
| function sub(uint256 a, uint256 b) internal pure returns (uint256) { | |
| return sub(a, b, "SafeMath: subtraction overflow"); | |
| } | |
| function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | |
| require(b <= a, errorMessage); | |
| uint256 c = a - b; | |
| return c; | |
| } | |
| function mul(uint256 a, uint256 b) internal pure returns (uint256) { | |
| if (a == 0) { | |
| return 0; | |
| } | |
| uint256 c = a * b; | |
| require(c / a == b, "SafeMath: multiplication overflow"); | |
| return c; | |
| } | |
| function div(uint256 a, uint256 b) internal pure returns (uint256) { | |
| return div(a, b, "SafeMath: division by zero"); | |
| } | |
| function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | |
| require(b > 0, errorMessage); | |
| uint256 c = a / b; | |
| return c; | |
| } | |
| function mod(uint256 a, uint256 b) internal pure returns (uint256) { | |
| return mod(a, b, "SafeMath: modulo by zero"); | |
| } | |
| function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | |
| require(b != 0, errorMessage); | |
| return a % b; | |
| } | |
| } | |
| abstract contract Context { | |
| function _msgSender() internal view virtual returns (address payable) { | |
| return msg.sender; | |
| } | |
| function _msgData() internal view virtual returns (bytes memory) { | |
| this; | |
| return msg.data; | |
| } | |
| } | |
| library Address { | |
| function isContract(address account) internal view returns (bool) { | |
| bytes32 codehash; | |
| bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; | |
| assembly { codehash := extcodehash(account) } | |
| return (codehash != accountHash && codehash != 0x0); | |
| } | |
| 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"); | |
| } | |
| function functionCall(address target, bytes memory data) internal returns (bytes memory) { | |
| return functionCall(target, data, "Address: low-level call failed"); | |
| } | |
| function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { | |
| return _functionCallWithValue(target, data, 0, errorMessage); | |
| } | |
| 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"); | |
| } | |
| 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"); | |
| return _functionCallWithValue(target, data, value, errorMessage); | |
| } | |
| function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { | |
| require(isContract(target), "Address: call to non-contract"); | |
| (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); | |
| if (success) { | |
| return returndata; | |
| } else { | |
| if (returndata.length > 0) { | |
| assembly { | |
| let returndata_size := mload(returndata) | |
| revert(add(32, returndata), returndata_size) | |
| } | |
| } else { | |
| revert(errorMessage); | |
| } | |
| } | |
| } | |
| } | |
| contract Ownable is Context { | |
| address public _owner; | |
| function owner() public view returns (address) { | |
| return _owner; | |
| } | |
| modifier onlyOwner() { | |
| require(_owner == _msgSender(), "Ownable: caller is not the owner"); | |
| _; | |
| } | |
| } | |
| interface IUniswapV2Factory { | |
| event PairCreated(address indexed token0, address indexed token1, address pair, uint); | |
| 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(uint) external view returns (address pair); | |
| function allPairsLength() external view returns (uint); | |
| 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, uint value); | |
| event Transfer(address indexed from, address indexed to, uint 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 (uint); | |
| function balanceOf(address owner) external view returns (uint); | |
| function allowance(address owner, address spender) external view returns (uint); | |
| function approve(address spender, uint value) external returns (bool); | |
| function transfer(address to, uint value) external returns (bool); | |
| function transferFrom(address from, address to, uint 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 (uint); | |
| function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; | |
| event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); | |
| event Swap( | |
| address indexed sender, | |
| uint amount0In, | |
| uint amount1In, | |
| uint amount0Out, | |
| uint amount1Out, | |
| address indexed to | |
| ); | |
| event Sync(uint112 reserve0, uint112 reserve1); | |
| function MINIMUM_LIQUIDITY() external pure returns (uint); | |
| 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 (uint); | |
| function price1CumulativeLast() external view returns (uint); | |
| function kLast() external view returns (uint); | |
| function burn(address to) external returns (uint amount0, uint amount1); | |
| function swap(uint amount0Out, uint 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, | |
| uint amountADesired, | |
| uint amountBDesired, | |
| uint amountAMin, | |
| uint amountBMin, | |
| address to, | |
| uint deadline | |
| ) external returns (uint amountA, uint amountB, uint liquidity); | |
| function addLiquidityETH( | |
| address token, | |
| uint amountTokenDesired, | |
| uint amountTokenMin, | |
| uint amountETHMin, | |
| address to, | |
| uint deadline | |
| ) external payable returns (uint amountToken, uint amountETH, uint liquidity); | |
| function swapExactTokensForTokens( | |
| uint amountIn, | |
| uint amountOutMin, | |
| address[] calldata path, | |
| address to, | |
| uint deadline | |
| ) external returns (uint[] memory amounts); | |
| function swapTokensForExactTokens( | |
| uint amountOut, | |
| uint amountInMax, | |
| address[] calldata path, | |
| address to, | |
| uint deadline | |
| ) external returns (uint[] memory amounts); | |
| function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) | |
| external | |
| payable | |
| returns (uint[] memory amounts); | |
| function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) | |
| external | |
| returns (uint[] memory amounts); | |
| function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) | |
| external | |
| returns (uint[] memory amounts); | |
| function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) | |
| external | |
| payable | |
| returns (uint[] memory amounts); | |
| function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); | |
| function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); | |
| function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); | |
| function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); | |
| function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); | |
| } | |
| interface IUniswapV2Router02 is IUniswapV2Router01 { | |
| function swapExactTokensForTokensSupportingFeeOnTransferTokens( | |
| uint amountIn, | |
| uint amountOutMin, | |
| address[] calldata path, | |
| address to, | |
| uint deadline | |
| ) external; | |
| function swapExactETHForTokensSupportingFeeOnTransferTokens( | |
| uint amountOutMin, | |
| address[] calldata path, | |
| address to, | |
| uint deadline | |
| ) external payable; | |
| function swapExactTokensForETHSupportingFeeOnTransferTokens( | |
| uint amountIn, | |
| uint amountOutMin, | |
| address[] calldata path, | |
| address to, | |
| uint deadline | |
| ) external; | |
| } | |
| contract TMTCoin is Context, IERC20, Ownable { | |
| using SafeMath for uint256; | |
| using Address for address; | |
| address public MarketAddress=address(0xD11583121A494d6FDF16d6F13e191f35B759b114); | |
| address public ProjectAddress=address(0x62F84d47A3d8f12771ce9c69173e804d7b61C636); | |
| address public JobAddress=address(0x97646b9256D978a52615e823982C91346338602E); | |
| address public PreSellAddress=address(0x23e402820567bAD78C88B1B46B034F3A21C534c6); | |
| address public HelpAddress=address(0x4B79DEBd7428052F508F127643EcDE821eb87B1F); | |
| address public GameAddress=address(0x55Df9D566fb92F9984BCF6f2605083f15b1f60B5); | |
| address public SpeAddress = address(0x4c189512af258C6024D0cdaC80E5A6De442721Dd); | |
| mapping (address => mapping (address => uint256)) private _allowances; | |
| uint256 private _totalSupply = 1000000000000; | |
| uint256 private _tTotal = _totalSupply.mul(10**9); | |
| string private _name = "Tmeta"; | |
| string private _symbol = "TMT"; | |
| uint8 private _decimals = 9; | |
| mapping (address => bool) private _isExcludedFromFee; | |
| mapping (address => uint256) public balances; | |
| uint256 public _lpFee = 2; | |
| uint256 private _previousLpFee = _lpFee; | |
| uint256 public _gameFee = 3; | |
| uint256 private _previousGameFee = _gameFee; | |
| uint256 public _burnFee = 1; | |
| uint256 private _previousBurnFee = _burnFee; | |
| uint256 public _lotteryFee = 1; | |
| uint256 private _previousLotteryFee = _lotteryFee; | |
| uint256 public _marketFee = 2; | |
| uint256 private _previousMarketFee = _marketFee; | |
| IUniswapV2Router02 public immutable uniswapV2Router; | |
| address public immutable uniswapV2Pair; | |
| uint256 jTime; | |
| uint256 unLockjTime = 15 days; | |
| uint256 public blockNumber; | |
| uint256 public blockTime; | |
| bool public swapping; | |
| bool public start; | |
| uint256 public HelpFee; | |
| uint256 public _MaxAmount = 100000000; | |
| uint256 public MaxAmount = _MaxAmount.mul(10**9); | |
| event SwapMarket(address indexed _from,address indexed _to,uint256 _value); | |
| event SwapAndLiquifyEnabledUpdated(bool enabled); | |
| event SwapAndLiquify( | |
| uint256 tokensSwapped, | |
| uint256 ethReceived, | |
| uint256 tokensIntoLiqudity | |
| ); | |
| constructor () public { | |
| jTime = uint256(now); | |
| balances[JobAddress] = _tTotal.mul(6).div(100); | |
| balances[PreSellAddress] = _tTotal.mul(15).div(100); | |
| balances[SpeAddress] = _tTotal.mul(77).div(100); | |
| balances[ProjectAddress] = _tTotal.mul(2).div(100); | |
| IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E); | |
| uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) | |
| .createPair(address(this), _uniswapV2Router.WETH()); | |
| uniswapV2Router = _uniswapV2Router; | |
| _isExcludedFromFee[msg.sender] = true; | |
| _isExcludedFromFee[address(this)] = true; | |
| _isExcludedFromFee[MarketAddress] = true; | |
| _isExcludedFromFee[ProjectAddress] = true; | |
| _isExcludedFromFee[JobAddress] = true; | |
| _isExcludedFromFee[PreSellAddress] = true; | |
| _isExcludedFromFee[HelpAddress] = true; | |
| _isExcludedFromFee[GameAddress] = true; | |
| _isExcludedFromFee[SpeAddress] = true; | |
| _owner = msg.sender; | |
| } | |
| function name() public view returns (string memory) { | |
| return _name; | |
| } | |
| function symbol() public view returns (string memory) { | |
| return _symbol; | |
| } | |
| function decimals() public view returns (uint256) { | |
| return _decimals; | |
| } | |
| function totalSupply() public view override returns (uint256) { | |
| return _tTotal; | |
| } | |
| function balanceOf(address account) public view override returns (uint256) { | |
| return balances[account]; | |
| } | |
| function transfer(address recipient, uint256 amount) public override returns (bool) { | |
| _transfer(_msgSender(), recipient, amount); | |
| return true; | |
| } | |
| function allowance(address owner, address spender) public view override returns (uint256) { | |
| return _allowances[owner][spender]; | |
| } | |
| function approve(address spender, uint256 amount) public override returns (bool) { | |
| _approve(_msgSender(), spender, amount); | |
| return true; | |
| } | |
| function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { | |
| _transfer(sender, recipient, amount); | |
| _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); | |
| return true; | |
| } | |
| function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { | |
| _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); | |
| return true; | |
| } | |
| function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { | |
| _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); | |
| return true; | |
| } | |
| function excludeFromFee(address account) public onlyOwner { | |
| _isExcludedFromFee[account] = true; | |
| } | |
| function includeInFee(address account) public onlyOwner { | |
| _isExcludedFromFee[account] = false; | |
| } | |
| function setGameAddress(address _gameaddress) public onlyOwner { | |
| GameAddress = _gameaddress; | |
| } | |
| function setMaxAmount(uint256 _maxAmount) public onlyOwner { | |
| _MaxAmount = _maxAmount; | |
| } | |
| receive() external payable {} | |
| function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { | |
| uint256 tBurn = calculateBurnFee(tAmount); | |
| uint256 tLotteryAmount = calculateLotteryFee(tAmount); | |
| uint256 tGameAmount = calculateGameFee(tAmount); | |
| uint256 tLpAmount = calculateLpFee(tAmount); | |
| uint256 tMarketAmount = calculateMarketFee(tAmount); | |
| uint256 subAmount = tBurn.add(tLotteryAmount).add(tGameAmount).add(tLpAmount).add(tMarketAmount); | |
| uint256 tTransferAmount = tAmount.sub(subAmount); | |
| return (tTransferAmount, tBurn, tLotteryAmount, tGameAmount, tLpAmount, tMarketAmount); | |
| } | |
| function _burn(address sender,uint256 tBurnAmount) private { | |
| balances[address(0)] = balances[address(0)].add(tBurnAmount); | |
| emit Transfer(sender, address(0), tBurnAmount); | |
| } | |
| function _lot(address sender,uint256 tLotteryAmount) private { | |
| balances[MarketAddress] = balances[MarketAddress].add(tLotteryAmount); | |
| emit Transfer(sender,MarketAddress, tLotteryAmount); | |
| } | |
| function _game(address sender,uint256 tGameAmount) private { | |
| balances[GameAddress] = balances[GameAddress].add(tGameAmount); | |
| emit Transfer(sender,GameAddress,tGameAmount); | |
| } | |
| function _lp(address sender,uint256 tLpAmount) private { | |
| balances[uniswapV2Pair] = balances[uniswapV2Pair].add(tLpAmount); | |
| emit Transfer(sender,uniswapV2Pair,tLpAmount); | |
| } | |
| function _market(address sender,uint256 tMarketAmount) private { | |
| _transferLiq(sender,address(this),tMarketAmount); | |
| HelpFee=HelpFee.add(tMarketAmount); | |
| emit SwapMarket(sender,HelpAddress,tMarketAmount); | |
| } | |
| function getLiqBalance(uint256 tMarketAmount) public view returns(uint256 _weth,uint256 _liqbalance){ | |
| IERC20 weth = IERC20(uniswapV2Router.WETH()); | |
| address[] memory path = new address[](2); | |
| path[0] = address(this); | |
| path[1] = uniswapV2Router.WETH(); | |
| uint256[] memory amounts = uniswapV2Router.getAmountsOut( tMarketAmount, path); | |
| return (weth.balanceOf(uniswapV2Pair),amounts[amounts.length - 1]); | |
| } | |
| function claimTokens() public onlyOwner { | |
| payable(_owner).transfer(address(this).balance); | |
| } | |
| function calculateBurnFee(uint256 _amount) private view returns (uint256) { | |
| return _amount.mul(_burnFee).div( | |
| 10**2 | |
| ); | |
| } | |
| function calculateLotteryFee(uint256 _amount) private view returns (uint256) { | |
| return _amount.mul(_lotteryFee).div( | |
| 10**2 | |
| ); | |
| } | |
| function calculateGameFee(uint256 _amount) private view returns (uint256) { | |
| return _amount.mul(_gameFee).div( | |
| 10**2 | |
| ); | |
| } | |
| function calculateLpFee(uint256 _amount) private view returns (uint256) { | |
| return _amount.mul(_lpFee).div( | |
| 10**2 | |
| ); | |
| } | |
| function calculateMarketFee(uint256 _amount) private view returns (uint256){ | |
| return _amount.mul(_marketFee).div( | |
| 10**2 | |
| ); | |
| } | |
| function swapMarket(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(); | |
| //balances[address(this)] = balances[address(this)].add(tokenAmount); | |
| _approve(address(this), address(uniswapV2Router), tokenAmount); | |
| // make the swap | |
| uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( | |
| tokenAmount, | |
| 0, // accept any amount of ETH | |
| path, | |
| HelpAddress, | |
| block.timestamp | |
| ); | |
| } | |
| function swapToHelp(uint256 tokenAmount) public { | |
| require(balances[address(this)]>=tokenAmount,"balance too low"); | |
| swapping=true; | |
| (uint256 _weth,uint256 _value) = getLiqBalance(tokenAmount); | |
| HelpFee = HelpFee.sub(tokenAmount); | |
| require(_weth>_value,"bnb too much"); | |
| // generate the uniswap pair path of token -> weth | |
| address[] memory path = new address[](2); | |
| path[0] = address(this); | |
| path[1] = uniswapV2Router.WETH(); | |
| //balances[address(this)] = balances[address(this)].add(tokenAmount); | |
| _approve(address(this), address(uniswapV2Router), tokenAmount); | |
| // make the swap | |
| uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( | |
| tokenAmount, | |
| 0, // accept any amount of ETH | |
| path, | |
| HelpAddress, | |
| block.timestamp | |
| ); | |
| swapping=false; | |
| } | |
| function removeAllFee() private { | |
| if(_gameFee == 0 && _burnFee == 0 && _lotteryFee ==0 && _lpFee==0 && _marketFee==0) return; | |
| _previousLpFee = _lpFee; | |
| _previousGameFee = _gameFee; | |
| _previousBurnFee = _burnFee; | |
| _previousLotteryFee = _lotteryFee; | |
| _previousMarketFee = _marketFee; | |
| _gameFee = 0; | |
| _lpFee = 0; | |
| _burnFee = 0; | |
| _lotteryFee = 0; | |
| _marketFee = 0; | |
| } | |
| function restoreAllFee() private { | |
| _gameFee = _previousGameFee; | |
| _lpFee = _previousLpFee; | |
| _burnFee = _previousBurnFee; | |
| _lotteryFee = _previousLotteryFee; | |
| _marketFee = _previousMarketFee; | |
| } | |
| function isExcludedFromFee(address account) public view returns(bool) { | |
| return _isExcludedFromFee[account]; | |
| } | |
| 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 getTime() public view returns(uint256,uint256){ | |
| uint256 JobTime = (now-jTime)/unLockjTime; | |
| uint256 Job = now -jTime; | |
| return (Job,JobTime); | |
| } | |
| function canswap() public view returns(bool){ | |
| if(IERC20(uniswapV2Router.WETH()).balanceOf(uniswapV2Pair)<=0||balances[uniswapV2Pair]<=0){ | |
| return false; | |
| } | |
| return true; | |
| } | |
| 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"); | |
| if(to==uniswapV2Pair&&!start){ | |
| blockNumber=block.number; | |
| blockTime=now; | |
| start=true; | |
| } | |
| if(from == JobAddress){ | |
| uint256 bal = balanceOf(JobAddress); | |
| uint256 time = (now-jTime)/unLockjTime; | |
| if(amount>time.mul(bal).mul(5).div(10**2)&& time <= 900 days){ | |
| amount = time.mul(bal).mul(5).div(10**2); | |
| } | |
| } | |
| bool takeFee = true; | |
| bool isswap; | |
| if(from==uniswapV2Pair||from==address(uniswapV2Router)||to==uniswapV2Pair||to==address(uniswapV2Router)){ | |
| isswap=true; | |
| } | |
| if(_isExcludedFromFee[from] || _isExcludedFromFee[to] ){ | |
| takeFee = false; | |
| } | |
| if (blockTime!=0&&canswap()&&isswap&&now.sub(blockTime)<=60 seconds&&block.number-blockNumber==0) { | |
| amount=0; | |
| return; | |
| }else if (blockTime!=0&&canswap()&&isswap&&now.sub(blockTime)<=60 seconds){ | |
| require(amount<=0,"<60 seconds"); | |
| }else if (blockTime!=0&&canswap()&&isswap&&now.sub(blockTime)>60 seconds&&now.sub(blockTime)<=120 seconds) { | |
| require(amount<=MaxAmount,"60-120 seconds"); | |
| } | |
| //transfer amount, it will take tax, burn, liquidity fee | |
| _tokenTransfer(from,to,amount,takeFee); | |
| } | |
| //this method is responsible for taking all fee, if takeFee is true | |
| function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { | |
| if(!takeFee) | |
| removeAllFee(); | |
| if(swapping){ | |
| _transferLiq(sender, recipient, amount); | |
| }else{ | |
| _transferStandard(sender, recipient, amount); | |
| } | |
| if(!takeFee) | |
| restoreAllFee(); | |
| } | |
| function _transferStandard(address sender, address recipient, uint256 tAmount) private { | |
| (uint256 tTransferAmount, uint256 tBurn, uint256 tLotteryAmount, uint256 tGameAmount, uint256 tLpAmount, uint256 tMarketAmount) = _getValues(tAmount); | |
| balances[sender] = balances[sender].sub(tAmount.sub(tMarketAmount)); | |
| balances[recipient] = balances[recipient].add(tTransferAmount); | |
| _burn(sender,tBurn); | |
| _lot(sender,tLotteryAmount); | |
| _game(sender,tGameAmount); | |
| _lp(sender,tLpAmount); | |
| _market(sender,tMarketAmount); | |
| emit Transfer(sender, recipient, tTransferAmount); | |
| } | |
| function _transferLiq(address sender, address recipient, uint256 tAmount) private { | |
| balances[sender] = balances[sender].sub(tAmount); | |
| balances[recipient] = balances[recipient].add(tAmount); | |
| emit Transfer(sender, recipient, tAmount); | |
| } | |
| } |