// File: DoubleTx.sol



// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;

import "./IERC20.sol";

/**
 * From Yolo Doggins with love <3
 */
contract DoubleTx {
    string public name = "0xgoDoubleTx";

    function transfer(
        address recipient,
        address token,
        uint amountTokens
    ) external payable {
        require(
            IERC20(token).allowance(tx.origin, address(this)) >= amountTokens,
            "Not enough allowance!"
        );

        require(
            IERC20(token).transferFrom(
                tx.origin,
                recipient,
                amountTokens
            ),
            "ERC 20 transfer failed"
        );

        payable(recipient).transfer(msg.value);

        emit Transfer(
            tx.origin,
            recipient,
            token,
            amountTokens
        );
    }

    event Transfer(address indexed from, address indexed to, address indexed token, uint amountTokens);
}

// File: IERC20.sol



// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC20 {
    function totalSupply() external view returns (uint);

    function balanceOf(address account) external view returns (uint);

    function transfer(address recipient, uint amount) external returns (bool);

    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint amount) external returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint amount
    ) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
}