Contract 0x1d5a5061fa9bd120576aa8062856bf161c94089b 9

 
Txn Hash Method
Block
From
To
Value
0x981a94132bd45bc9110dceb5a9d6a5609eb8de3a460483e43c3f98f8616b3234Convert1160610712024-02-12 6:55:1946 days 4 hrs ago0xb4a16728a270c0a9d57521926fbfb52da28fb28d IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000412209920.002369428
0x5c61e1efaa7dde1686e36ba9afc91c058356c0aae9d8a24c262332d7e5220946Convert Multiple1156442292024-02-02 15:20:3555 days 20 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000590802720.011531056
0x85877cbadb91c3a48c4173c1dee36a26bf3e7e325d6f726a0ee76ba4a3622ad3Convert Multiple1139705862023-12-25 21:32:2994 days 14 hrs ago0xb4a16728a270c0a9d57521926fbfb52da28fb28d IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000379772750.006111401
0x7d9e62b948c563836446a7ed1f650be73671878d1189bc226ef0d05fee3bc2a6Convert Multiple1139134082023-12-24 13:46:3395 days 22 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000498877170.004924569
0xe50ad3cca73a9be05c218bb6c9ec615f54623afd27e28e747e6320a2adad05bfConvert Multiple1138567752023-12-23 6:18:4797 days 5 hrs ago0xb4a16728a270c0a9d57521926fbfb52da28fb28d IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000447248990.003565816
0xd4f81b92a2842e25d4c8b7e91d17e886d128c5096cee7df5483d1c8ff18a03a5Convert Multiple1133727972023-12-12 1:26:11108 days 10 hrs ago0xb4a16728a270c0a9d57521926fbfb52da28fb28d IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000681055370.010544942
0x83d5e17269b26a8dd4ae822d664de3ead13376ad8a10bd3b9003a53071936c02Convert Multiple1133482772023-12-11 11:48:51109 days 3 mins ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000559364930.012160437
0x13a332547882f1d99e0d2ad5d64d04e02ad702103f5b40bebbbb6f8787518781Convert Multiple1127011952023-11-26 12:19:27123 days 23 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000462903490.007222383
0x7940810057744e16927a04ca53382683305da85ccef5761f3e59e54f71ec1ebfConvert Multiple1119971432023-11-10 5:11:03140 days 6 hrs ago0xb4a16728a270c0a9d57521926fbfb52da28fb28d IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.000081973960.01377173
0x4c816f555ec6d5bdbbf1eb1ec7f92cceda4173a7895ece86c581b848b141ad7bConvert Multiple1113701172023-10-26 16:50:11154 days 19 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000932333090.19980666
0x639b3d7cfc409330ca667934b6ec453a4a0efb785ea9734c6632f3cdd47abdf6Convert Multiple1113509632023-10-26 6:11:43155 days 5 hrs ago0xb4a16728a270c0a9d57521926fbfb52da28fb28d IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000460518710.012765064
0x976c68da5b9b7f03b141f67c036ff1aa515dca4be3c21b90331b8ac0512357e5Burn X1113509232023-10-26 6:10:23155 days 5 hrs ago0xb4a16728a270c0a9d57521926fbfb52da28fb28d IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000306684980.017072898
0x947cb800f6a1a7ee4683a373d9bb5d02f9d860758074c53a159963d119557818Convert Multiple1106266512023-10-09 11:47:59172 days 4 mins ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.000056936890.208140656
0x8226f6f87f9d964d8404418cf0193b5d5edc6cb8856b26aaf842af464dc964b5Convert Multiple1106266452023-10-09 11:47:47172 days 4 mins ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000210399120.02784748
0x082af17f43ace72901b9325995cfc793b5b0be630f1498e2c177b0e78c0bdf22Convert Multiple1089452672023-08-31 13:41:51210 days 22 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000572810950.080000003
0x5968faf196c45955d0faad2384fcb3484f51d6a735915091287b340d2eee5b3fConvert Multiple1083976122023-08-18 21:26:41223 days 14 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000477356820.02822523
0x04a8211ae554ce711524730e127184133a5be70986ade52fb55b344aba4bd31cConvert Multiple1083976002023-08-18 21:26:17223 days 14 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000524908030.053249392
0x8b4a8825f2609aceeed5a73c9ba254bf27b5268ca0cb95e557f4732098dae795Convert Multiple1080563522023-08-10 23:51:21231 days 12 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.000032201220.000000162
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b73Convert Multiple1073072642023-07-24 15:41:45248 days 20 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0001588803490.132404576
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e65Convert Multiple1061632492023-06-28 4:07:55275 days 7 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000379598880.040000072
0xd72780127b081eccb235021fbf2a524af6bf70e5a10971df1684eaf2f160de4eConvert Multiple1054600982023-06-11 21:29:33291 days 14 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000344105950.000000864
0xcea81b18919dd17bb24f5a9aabb045d3c446cf7fcaed8ee08b5c2e33fe2b31aeConvert Multiple1054086702023-06-10 16:55:17292 days 18 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000341894570.001050001
0xc93ee25a2c460d0f57c8f910e23388e2ac309b7072f944873c23c978a956e5b3Convert Multiple1052572652023-06-07 4:48:27296 days 7 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000579122220.002
0xbaa997d8c4d5fed19f7ab72b934836e96e17be09dd5b1b5e268c65274be1beebConvert Multiple1052572042023-06-07 4:46:25296 days 7 hrs ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0000449134350.002001004
0x86fa4cc856f7023f7c4a3e0a21d97f1a108780da1407ae406a40e6d7182d554fConvert Multiple1035374912023-06-01 10:38:15302 days 1 hr ago0xfc8367ef6bcfc10746e5b9b034314812db8d7213 IN  0x1d5a5061fa9bd120576aa8062856bf161c94089b0 ETH0.0001348791480.001
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b OpenXSwap: OpenX Token0 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b OpenXSwap: OpenX Token0 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b Optimism: OP Token0 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0xf3c7978ddd70b4158b53e897f980093183ca5c520 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b OpenXSwap: OpenX Token0 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b OpenXSwap: OpenX Token0 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0xae43994209b8200c201869c6bda16abcf1606f6228625d4e2f6999919a845b731073072642023-07-24 15:41:45248 days 20 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0xf3c7978ddd70b4158b53e897f980093183ca5c520 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b OpenXSwap: OpenX Token0 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b OpenXSwap: OpenX Token0 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b Optimism: OP Token0 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0xf3c7978ddd70b4158b53e897f980093183ca5c520 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b OpenXSwap: OpenX Token0 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b OpenXSwap: OpenX Token0 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
0x708f7718dd6c49bb61e0441c8028402b71d2eb81b0a5c1a880031b2a866b8e651061632492023-06-28 4:07:55275 days 7 hrs ago 0x1d5a5061fa9bd120576aa8062856bf161c94089b 0x442659a6d04b907c879032da1ef634548110dd370 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OpenXMaker

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 33 : dummyToken.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract xPool is ERC20 {
    constructor(
        string memory name,
        string memory symbol,
        uint8 decimals
    ) public ERC20(name, symbol) {
        _setupDecimals(decimals);
        _mint(msg.sender, 1*10**18);
    }
}

File 2 of 33 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    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;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    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");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

File 3 of 33 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 4 of 33 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 5 of 33 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @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");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    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;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 6 of 33 : testnetToken.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";


contract testnetToken is ERC20 {


	mapping(address => bool) public didMint;
	uint256 public mintAmount;

    constructor(
        string memory name,
        string memory symbol,
        uint8 decimals,
        uint256 _mintAmount
    ) public ERC20(name, symbol) {
        _setupDecimals(decimals);
        mintAmount = _mintAmount;
        _mint(msg.sender, mintAmount);
    }

    function mint() public{
    	require(!didMint[msg.sender], "Sorry bruh...");
    	didMint[msg.sender] = true;
    	_mint(msg.sender, mintAmount);
    }

}

File 7 of 33 : dummyOP.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";


contract DummyOP is ERC20 {

	mapping(address => bool) public didMint;

    constructor(
        string memory name,
        string memory symbol,
        uint8 decimals
    ) public ERC20(name, symbol) {
        _setupDecimals(decimals);
        _mint(msg.sender, 30000*10**18);
    }

    function mint() public{
    	require(!didMint[msg.sender], "Once per account...");
    	didMint[msg.sender] = true;
    	_mint(msg.sender, 20000*10**18);
    }

}

File 8 of 33 : token.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract test0netERC20 is ERC20 {
    constructor(
        string memory name,
        string memory symbol,
        uint8 decimals
    ) public ERC20(name, symbol) {
        _setupDecimals(decimals);
    }

    function mint(uint256 _amount, address _to) public{
        _mint(_to, _amount);
    }
}

File 9 of 33 : OpenXToken.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract OpenX is ERC20 {
    constructor() public ERC20("OpenX Optimism", "OpenX") {
        _setupDecimals(18);
        _mint(msg.sender, 16624999990000000000000000);
    }


    function burn(uint256 _amount) public {
    	_burn(msg.sender, _amount);
    }
}

File 10 of 33 : ERC20Snapshot.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../math/SafeMath.sol";
import "../../utils/Arrays.sol";
import "../../utils/Counters.sol";
import "./ERC20.sol";

/**
 * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and
 * total supply at the time are recorded for later access.
 *
 * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.
 * In naive implementations it's possible to perform a "double spend" attack by reusing the same balance from different
 * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be
 * used to create an efficient ERC20 forking mechanism.
 *
 * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a
 * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot
 * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id
 * and the account address.
 *
 * ==== Gas Costs
 *
 * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log
 * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much
 * smaller since identical balances in subsequent snapshots are stored as a single entry.
 *
 * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is
 * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent
 * transfers will have normal cost until the next snapshot, and so on.
 */
abstract contract ERC20Snapshot is ERC20 {
    // Inspired by Jordi Baylina's MiniMeToken to record historical balances:
    // https://github.com/Giveth/minimd/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol

    using SafeMath for uint256;
    using Arrays for uint256[];
    using Counters for Counters.Counter;

    // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a
    // Snapshot struct, but that would impede usage of functions that work on an array.
    struct Snapshots {
        uint256[] ids;
        uint256[] values;
    }

    mapping (address => Snapshots) private _accountBalanceSnapshots;
    Snapshots private _totalSupplySnapshots;

    // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.
    Counters.Counter private _currentSnapshotId;

    /**
     * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.
     */
    event Snapshot(uint256 id);

    /**
     * @dev Creates a new snapshot and returns its snapshot id.
     *
     * Emits a {Snapshot} event that contains the same id.
     *
     * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a
     * set of accounts, for example using {AccessControl}, or it may be open to the public.
     *
     * [WARNING]
     * ====
     * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,
     * you must consider that it can potentially be used by attackers in two ways.
     *
     * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow
     * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target
     * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs
     * section above.
     *
     * We haven't measured the actual numbers; if this is something you're interested in please reach out to us.
     * ====
     */
    function _snapshot() internal virtual returns (uint256) {
        _currentSnapshotId.increment();

        uint256 currentId = _currentSnapshotId.current();
        emit Snapshot(currentId);
        return currentId;
    }

    /**
     * @dev Retrieves the balance of `account` at the time `snapshotId` was created.
     */
    function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {
        (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);

        return snapshotted ? value : balanceOf(account);
    }

    /**
     * @dev Retrieves the total supply at the time `snapshotId` was created.
     */
    function totalSupplyAt(uint256 snapshotId) public view virtual returns(uint256) {
        (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);

        return snapshotted ? value : totalSupply();
    }


    // Update balance and/or total supply snapshots before the values are modified. This is implemented
    // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
      super._beforeTokenTransfer(from, to, amount);

      if (from == address(0)) {
        // mint
        _updateAccountSnapshot(to);
        _updateTotalSupplySnapshot();
      } else if (to == address(0)) {
        // burn
        _updateAccountSnapshot(from);
        _updateTotalSupplySnapshot();
      } else {
        // transfer
        _updateAccountSnapshot(from);
        _updateAccountSnapshot(to);
      }
    }

    function _valueAt(uint256 snapshotId, Snapshots storage snapshots)
        private view returns (bool, uint256)
    {
        require(snapshotId > 0, "ERC20Snapshot: id is 0");
        // solhint-disable-next-line max-line-length
        require(snapshotId <= _currentSnapshotId.current(), "ERC20Snapshot: nonexistent id");

        // When a valid snapshot is queried, there are three possibilities:
        //  a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never
        //  created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds
        //  to this id is the current one.
        //  b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the
        //  requested id, and its value is the one to return.
        //  c) More snapshots were created after the requested one, and the queried value was later modified. There will be
        //  no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is
        //  larger than the requested one.
        //
        // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if
        // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does
        // exactly this.

        uint256 index = snapshots.ids.findUpperBound(snapshotId);

        if (index == snapshots.ids.length) {
            return (false, 0);
        } else {
            return (true, snapshots.values[index]);
        }
    }

    function _updateAccountSnapshot(address account) private {
        _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));
    }

    function _updateTotalSupplySnapshot() private {
        _updateSnapshot(_totalSupplySnapshots, totalSupply());
    }

    function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {
        uint256 currentId = _currentSnapshotId.current();
        if (_lastSnapshotId(snapshots.ids) < currentId) {
            snapshots.ids.push(currentId);
            snapshots.values.push(currentValue);
        }
    }

    function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {
        if (ids.length == 0) {
            return 0;
        } else {
            return ids[ids.length - 1];
        }
    }
}

File 11 of 33 : Arrays.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../math/Math.sol";

/**
 * @dev Collection of functions related to array types.
 */
library Arrays {
   /**
     * @dev Searches a sorted `array` and returns the first index that contains
     * a value greater or equal to `element`. If no such index exists (i.e. all
     * values in the array are strictly less than `element`), the array length is
     * returned. Time complexity O(log n).
     *
     * `array` is expected to be sorted in ascending order, and to contain no
     * repeated elements.
     */
    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        if (array.length == 0) {
            return 0;
        }

        uint256 low = 0;
        uint256 high = array.length;

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds down (it does integer division with truncation).
            if (array[mid] > element) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
        if (low > 0 && array[low - 1] == element) {
            return low - 1;
        } else {
            return low;
        }
    }
}

File 12 of 33 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../math/SafeMath.sol";

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}

File 13 of 33 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

File 14 of 33 : lpHelper.sol
// SPDX-License-Identifier: UNLICENCED
pragma solidity 0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";


library Babylonian {
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
        // else z = 0
    }
}



contract lpHelper {
    using SafeMath for uint256;

    function calculateSwapInAmount(uint256 reserveIn, uint256 userIn)
    public
    pure
    returns (uint256)
    {
        return
        Babylonian
        .sqrt(
            reserveIn.mul(userIn.mul(3988000) + reserveIn.mul(3988009))
        )
        .sub(reserveIn.mul(1997)) / 1994;
    }
}

File 15 of 33 : OpenXmaker.sol
// SPDX-License-Identifier: MIT
// P1 - P3: OK
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "./uniswapv2/interfaces/IUniswapV2ERC20.sol";
import "./uniswapv2/interfaces/IUniswapV2Pair.sol";
import "./uniswapv2/interfaces/IUniswapV2Factory.sol";
// OpenXMaker is MasterChef's left hand and kinda a wizard. He can cook up OpenX from pretty much anything!
// This contract handles "serving up" rewards for xOpenX holders by trading tokens collected from fees for OpenX.
interface IERC20BURNABLE{
    function burn(uint256 _amount) external;
}
// T1 - T4: OK
contract OpenXMaker {
    using SafeMath for uint256;

    // V1 - V5: OK
    IUniswapV2Factory public immutable factory;
    
    address public admin;
    // V1 - V5: OK
    address private immutable openx;
    // V1 - V5: OK
    address private immutable weth;

    address private immutable bar;
    // V1 - V5: OK
    mapping(address => address) internal _bridges;

    // E1: OK
    event LogBridgeSet(address indexed token, address indexed bridge);
    // E1: OK
    event LogConvert(address indexed server, address indexed token0, address indexed token1, uint256 amount0, uint256 amount1, uint256 amountSUSHI);


    constructor (address _factory, address _openx, address _weth, address _bar) public {
       factory = IUniswapV2Factory(_factory);
       openx = _openx;
       weth = _weth;
       admin = msg.sender;
       bar = _bar;
    }

    function setAdmin(address _admin) public {
        require(msg.sender == admin, "Unauthorized");
        admin = _admin;
    }

    // F1 - F10: OK
    // C1 - C24: OK
    function bridgeFor(address token) public view returns (address bridge) {
        bridge = _bridges[token];
        if (bridge == address(0)) {
            bridge = weth;
        }
    }

    // F1 - F10: OK
    // C1 - C24: OK
    function setBridge(address token, address bridge) external {
        require(msg.sender == admin, "Unauthorized");
        // Checks
        require(token != openx && token != weth && token != bridge, "OpenSwap Maker: Invalid bridge");

        // Effects
        _bridges[token] = bridge;
        emit LogBridgeSet(token, bridge);
    }

    // M1 - M5: OK
    // C1 - C24: OK
    // C6: It's not a fool proof solution, but it prevents flash loans, so here it's ok to use tx.origin
    modifier onlyEOA() {
        // Try to make flash-loan exploit harder to do by only allowing externally owned addresses.
        require(msg.sender == tx.origin, "OpenSwap Maker: must use EOA");
        _;
    }

    // F1 - F10: OK
    // F3: _convert is separate to save gas by only checking the 'onlyEOA' modifier once in case of convertMultiple
    // F6: There is an exploit to add lots of SUSHI to the bar, run convert, then remove the SUSHI again.
    //     As the size of the OpenXBar has grown, this requires large amounts of funds and isn't super profitable anymore
    //     The onlyEOA modifier prevents this being done with a flash loan.
    // C1 - C24: OK
    function convert(address token0, address token1) external onlyEOA() {
        _convert(token0, token1);
    }

    // F1 - F10: OK, see convert
    // C1 - C24: OK
    // C3: Loop is under control of the caller
    function convertMultiple(address[] calldata token0, address[] calldata token1) external onlyEOA() {
        // TODO: This can be optimized a fair bit, but this is safer and simpler for now
        uint256 len = token0.length;
        for(uint256 i=0; i < len; i++) {
            _convert(token0[i], token1[i]);
        }
    }

    function burnX() public {
        uint256 balance = IERC20(openx).balanceOf(address(this));
        IERC20BURNABLE(openx).burn(balance);
    }

    // F1 - F10: OK
    // C1- C24: OK
    function _convert(address token0, address token1) internal {
        // Interactions
        // S1 - S4: OK
        IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(token0, token1));
        require(address(pair) != address(0), "OpenSwap Maker: Invalid pair");
        // balanceOf: S1 - S4: OK
        // transfer: X1 - X5: OK
        IERC20(address(pair)).transfer(address(pair), pair.balanceOf(address(this)));
        // X1 - X5: OK
        (uint256 amount0, uint256 amount1) = pair.burn(address(this));
        if (token0 != pair.token0()) {
            (amount0, amount1) = (amount1, amount0);
        }
        emit LogConvert(msg.sender, token0, token1, amount0, amount1, _convertStep(token0, token1, amount0, amount1));
    }

    // F1 - F10: OK
    // C1 - C24: OK
    // All transfer, _swap, _toOPENX, _convertStep: X1 - X5: OK
    function _convertStep(address token0, address token1, uint256 amount0, uint256 amount1) internal returns(uint256 openXOut) {
        // Interactions
        if (token0 == token1) {
            uint256 amount = amount0.add(amount1);
            if (token0 == openx) {
                IERC20BURNABLE(openx).burn(amount.div(3).mul(2)); //burn
                IERC20(openx).transfer(bar, amount.div(3)); //send to bar
                openXOut = amount;
            } else if (token0 == weth) {
                openXOut = _toOPENX(weth, amount);
            } else {
                address bridge = bridgeFor(token0);
                amount = _swap(token0, bridge, amount, address(this));
                openXOut = _convertStep(bridge, bridge, amount, 0);
            }
        } else if (token0 == openx) { // eg. SUSHI - ETH
            IERC20BURNABLE(openx).burn(amount0.div(3).mul(2)); //BURN
            IERC20(openx).transfer(bar, amount0.div(3)); //BAR

            openXOut = _toOPENX(token1, amount1).add(amount0);
        } else if (token1 == openx) { // eg. USDT - SUSHI
            IERC20BURNABLE(openx).burn(amount1.div(3).mul(2)); //BURN
            IERC20(openx).transfer(bar, amount1.div(3)); //BAR
            openXOut = _toOPENX(token0, amount0).add(amount1); 
        } else if (token0 == weth) { // eg. ETH - USDC
            openXOut = _toOPENX(weth, _swap(token1, weth, amount1, address(this)).add(amount0));
        } else if (token1 == weth) { // eg. USDT - ETH
            openXOut = _toOPENX(weth, _swap(token0, weth, amount0, address(this)).add(amount1));
        } else { // eg. MIC - USDT
            address bridge0 = bridgeFor(token0);
            address bridge1 = bridgeFor(token1);
            if (bridge0 == token1) { // eg. MIC - USDT - and bridgeFor(MIC) = USDT
                openXOut = _convertStep(bridge0, token1,
                    _swap(token0, bridge0, amount0, address(this)),
                    amount1
                );
            } else if (bridge1 == token0) { // eg. WBTC - DSD - and bridgeFor(DSD) = WBTC
                openXOut = _convertStep(token0, bridge1,
                    amount0,
                    _swap(token1, bridge1, amount1, address(this))
                );
            } else {
                openXOut = _convertStep(bridge0, bridge1, // eg. USDT - DSD - and bridgeFor(DSD) = WBTC
                    _swap(token0, bridge0, amount0, address(this)),
                    _swap(token1, bridge1, amount1, address(this))
                );
            }
        }
    }

    // F1 - F10: OK
    // C1 - C24: OK
    // All transfer, swap: X1 - X5: OK
    function _swap(address fromToken, address toToken, uint256 amountIn, address to) internal returns (uint256 amountOut) {
        // Checks
        // X1 - X5: OK
        IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(fromToken, toToken));
        require(address(pair) != address(0), "OpenSwap Maker: Cannot convert");

        // Interactions
        // X1 - X5: OK
        (uint256 reserve0, uint256 reserve1,) = pair.getReserves();
        uint256 amountInWithFee = amountIn.mul(997);
        if (fromToken == pair.token0()) {
            amountOut = amountIn.mul(997).mul(reserve1) / reserve0.mul(1000).add(amountInWithFee);
            IERC20(fromToken).transfer(address(pair), amountIn);
            pair.swap(0, amountOut, to, new bytes(0));
            // TODO: Add maximum slippage?
        } else {
            amountOut = amountIn.mul(997).mul(reserve0) / reserve1.mul(1000).add(amountInWithFee);
            IERC20(fromToken).transfer(address(pair), amountIn);
            pair.swap(amountOut, 0, to, new bytes(0));
            // TODO: Add maximum slippage?
        }
    }

    // F1 - F10: OK
    // C1 - C24: OK
    function _toOPENX(address token, uint256 amountIn) internal returns(uint256 amountOut) {
        // X1 - X5: OK
        amountOut = _swap(token, openx, amountIn, address(this));
        IERC20BURNABLE(openx).burn(amountOut.div(3).mul(2)); //BAR
        IERC20(openx).transfer(bar, amountOut.div(3));
    }
}

File 16 of 33 : IUniswapV2ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

interface IUniswapV2ERC20 {
    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;
}

File 17 of 33 : IUniswapV2Pair.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

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 Mint(address indexed sender, uint amount0, uint amount1);
    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 mint(address to) external returns (uint liquidity);
    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;
}

File 18 of 33 : IUniswapV2Factory.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

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;
}

File 19 of 33 : UniswapV2Router02.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.6.12;


import './libraries/UniswapV2Library.sol';
import './libraries/SafeMath.sol';
import './libraries/TransferHelper.sol';
import './interfaces/IUniswapV2Router02.sol';
import './interfaces/IUniswapV2Factory.sol';
import './interfaces/IERC20.sol';
import './interfaces/IWETH.sol';

contract UniswapV2Router02 is IUniswapV2Router02 {
    using SafeMathUniswap for uint;

    address public immutable override factory;
    address public immutable override WETH;

    modifier ensure(uint deadline) {
        require(deadline >= block.timestamp, 'OpenSwap EXPIRED');
        _;
    }

    constructor(address _factory, address _WETH) public {
        factory = _factory;
        WETH = _WETH;
    }

    receive() external payable {
        assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract
    }

    // **** ADD LIQUIDITY ****
    function _addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin
    ) internal virtual returns (uint amountA, uint amountB) {
        // create the pair if it doesn't exist yet
        if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {
            IUniswapV2Factory(factory).createPair(tokenA, tokenB);
        }
        (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);
        if (reserveA == 0 && reserveB == 0) {
            (amountA, amountB) = (amountADesired, amountBDesired);
        } else {
            uint amountBOptimal = UniswapV2Library.quote(amountADesired, reserveA, reserveB);
            if (amountBOptimal <= amountBDesired) {
                require(amountBOptimal >= amountBMin, 'OpenSwap INSUFFICIENT_B_AMOUNT');
                (amountA, amountB) = (amountADesired, amountBOptimal);
            } else {
                uint amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA);
                assert(amountAOptimal <= amountADesired);
                require(amountAOptimal >= amountAMin, 'OpenSwap INSUFFICIENT_A_AMOUNT');
                (amountA, amountB) = (amountAOptimal, amountBDesired);
            }
        }
    }
    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
        (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);
        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
        TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);
        TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);
        liquidity = IUniswapV2Pair(pair).mint(to);
    }
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
        (amountToken, amountETH) = _addLiquidity(
            token,
            WETH,
            amountTokenDesired,
            msg.value,
            amountTokenMin,
            amountETHMin
        );
        address pair = UniswapV2Library.pairFor(factory, token, WETH);
        TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);
        IWETH(WETH).deposit{value: amountETH}();
        assert(IWETH(WETH).transfer(pair, amountETH));
        liquidity = IUniswapV2Pair(pair).mint(to);
        // refund dust eth, if any
        if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);
    }

    // **** REMOVE LIQUIDITY ****
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
        IUniswapV2Pair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair
        (uint amount0, uint amount1) = IUniswapV2Pair(pair).burn(to);
        (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB);
        (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);
        require(amountA >= amountAMin, 'OpenSwap INSUFFICIENT_A_AMOUNT');
        require(amountB >= amountBMin, 'OpenSwap INSUFFICIENT_B_AMOUNT');
    }
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) {
        (amountToken, amountETH) = removeLiquidity(
            token,
            WETH,
            liquidity,
            amountTokenMin,
            amountETHMin,
            address(this),
            deadline
        );
        TransferHelper.safeTransfer(token, to, amountToken);
        IWETH(WETH).withdraw(amountETH);
        TransferHelper.safeTransferETH(to, amountETH);
    }
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountA, uint amountB) {
        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
        uint value = approveMax ? uint(-1) : liquidity;
        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        (amountA, amountB) = removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);
    }
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountToken, uint amountETH) {
        address pair = UniswapV2Library.pairFor(factory, token, WETH);
        uint value = approveMax ? uint(-1) : liquidity;
        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        (amountToken, amountETH) = removeLiquidityETH(token, liquidity, amountTokenMin, amountETHMin, to, deadline);
    }

    // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) ****
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountETH) {
        (, amountETH) = removeLiquidity(
            token,
            WETH,
            liquidity,
            amountTokenMin,
            amountETHMin,
            address(this),
            deadline
        );
        TransferHelper.safeTransfer(token, to, IERC20Uniswap(token).balanceOf(address(this)));
        IWETH(WETH).withdraw(amountETH);
        TransferHelper.safeTransferETH(to, amountETH);
    }
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountETH) {
        address pair = UniswapV2Library.pairFor(factory, token, WETH);
        uint value = approveMax ? uint(-1) : liquidity;
        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        amountETH = removeLiquidityETHSupportingFeeOnTransferTokens(
            token, liquidity, amountTokenMin, amountETHMin, to, deadline
        );
    }

    // **** SWAP ****
    // requires the initial amount to have already been sent to the first pair
    function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
        for (uint i; i < path.length - 1; i++) {
            (address input, address output) = (path[i], path[i + 1]);
            (address token0,) = UniswapV2Library.sortTokens(input, output);
            uint amountOut = amounts[i + 1];
            (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));
            address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;
            IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(
                amount0Out, amount1Out, to, new bytes(0)
            );
        }
    }
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
        amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'OpenSwap INSUFFICIENT_OUTPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, to);
    }
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
        require(amounts[0] <= amountInMax, 'OpenSwap EXCESSIVE_INPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, to);
    }
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        payable
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[0] == WETH, 'OpenSwap INVALID_PATH');
        amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'OpenSwap INSUFFICIENT_OUTPUT_AMOUNT');
        IWETH(WETH).deposit{value: amounts[0]}();
        assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));
        _swap(amounts, path, to);
    }
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[path.length - 1] == WETH, 'OpenSwap INVALID_PATH');
        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
        require(amounts[0] <= amountInMax, 'OpenSwap EXCESSIVE_INPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, address(this));
        IWETH(WETH).withdraw(amounts[amounts.length - 1]);
        TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
    }
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[path.length - 1] == WETH, 'OpenSwap INVALID_PATH');
        amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'OpenSwap INSUFFICIENT_OUTPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, address(this));
        IWETH(WETH).withdraw(amounts[amounts.length - 1]);
        TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
    }
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        payable
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[0] == WETH, 'OpenSwap INVALID_PATH');
        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
        require(amounts[0] <= msg.value, 'OpenSwap EXCESSIVE_INPUT_AMOUNT');
        IWETH(WETH).deposit{value: amounts[0]}();
        assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));
        _swap(amounts, path, to);
        // refund dust eth, if any
        if (msg.value > amounts[0]) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0]);
    }

    // **** SWAP (supporting fee-on-transfer tokens) ****
    // requires the initial amount to have already been sent to the first pair
    function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
        for (uint i; i < path.length - 1; i++) {
            (address input, address output) = (path[i], path[i + 1]);
            (address token0,) = UniswapV2Library.sortTokens(input, output);
            IUniswapV2Pair pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output));
            uint amountInput;
            uint amountOutput;
            { // scope to avoid stack too deep errors
            (uint reserve0, uint reserve1,) = pair.getReserves();
            (uint reserveInput, uint reserveOutput) = input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
            amountInput = IERC20Uniswap(input).balanceOf(address(pair)).sub(reserveInput);
            amountOutput = UniswapV2Library.getAmountOut(amountInput, reserveInput, reserveOutput);
            }
            (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOutput) : (amountOutput, uint(0));
            address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;
            pair.swap(amount0Out, amount1Out, to, new bytes(0));
        }
    }
    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) {
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn
        );
        uint balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);
        _swapSupportingFeeOnTransferTokens(path, to);
        require(
            IERC20Uniswap(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
            'OpenSwap INSUFFICIENT_OUTPUT_AMOUNT'
        );
    }
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    )
        external
        virtual
        override
        payable
        ensure(deadline)
    {
        require(path[0] == WETH, 'OpenSwap INVALID_PATH');
        uint amountIn = msg.value;
        IWETH(WETH).deposit{value: amountIn}();
        assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn));
        uint balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);
        _swapSupportingFeeOnTransferTokens(path, to);
        require(
            IERC20Uniswap(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
            'OpenSwap INSUFFICIENT_OUTPUT_AMOUNT'
        );
    }
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    )
        external
        virtual
        override
        ensure(deadline)
    {
        require(path[path.length - 1] == WETH, 'OpenSwap INVALID_PATH');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn
        );
        _swapSupportingFeeOnTransferTokens(path, address(this));
        uint amountOut = IERC20Uniswap(WETH).balanceOf(address(this));
        require(amountOut >= amountOutMin, 'OpenSwap INSUFFICIENT_OUTPUT_AMOUNT');
        IWETH(WETH).withdraw(amountOut);
        TransferHelper.safeTransferETH(to, amountOut);
    }

    // **** LIBRARY FUNCTIONS ****
    function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
        return UniswapV2Library.quote(amountA, reserveA, reserveB);
    }

    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
        public
        pure
        virtual
        override
        returns (uint amountOut)
    {
        return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);
    }

    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
        public
        pure
        virtual
        override
        returns (uint amountIn)
    {
        return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);
    }

    function getAmountsOut(uint amountIn, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        return UniswapV2Library.getAmountsOut(factory, amountIn, path);
    }

    function getAmountsIn(uint amountOut, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        return UniswapV2Library.getAmountsIn(factory, amountOut, path);
    }
}

File 20 of 33 : UniswapV2Library.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

import '../interfaces/IUniswapV2Pair.sol';

import "./SafeMath.sol";

library UniswapV2Library {
    using SafeMathUniswap for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'b8e25c7c292760c2b31f651189d7ec6943cbc24cc061640b5e40b9e244b78df4' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        amountB = amountA.mul(reserveB) / reserveA;
    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn.mul(997);
        uint numerator = amountInWithFee.mul(reserveOut);
        uint denominator = reserveIn.mul(1000).add(amountInWithFee);
        amountOut = numerator / denominator;
    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
        require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint numerator = reserveIn.mul(amountOut).mul(1000);
        uint denominator = reserveOut.sub(amountOut).mul(997);
        amountIn = (numerator / denominator).add(1);
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
        }
    }

    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
        }
    }
}

File 21 of 33 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.6.12;

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMathUniswap {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, 'ds-math-add-overflow');
    }

    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'ds-math-sub-underflow');
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
    }
}

File 22 of 33 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address token, address from, address to, uint value) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

File 23 of 33 : IUniswapV2Router02.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    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;
}

File 24 of 33 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

interface IERC20Uniswap {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view 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);
}

File 25 of 33 : IWETH.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

File 26 of 33 : IUniswapV2Router01.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2;

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 removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    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);
}

File 27 of 33 : UniswapV2Pair.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.6.12;

import './UniswapV2ERC20.sol';
import './libraries/Math.sol';
import './libraries/UQ112x112.sol';
import './interfaces/IERC20.sol';

import './interfaces/IUniswapV2Factory.sol';
import './interfaces/IUniswapV2Callee.sol';




contract UniswapV2Pair is UniswapV2ERC20 {
    using SafeMathUniswap  for uint;
    using UQ112x112 for uint224;

    uint public constant MINIMUM_LIQUIDITY = 10**3;
    bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));

    address public factory;
    string public symbol;
    address public token0;
    address public token1;

    uint112 private reserve0;           // uses single storage slot, accessible via getReserves
    uint112 private reserve1;           // uses single storage slot, accessible via getReserves
    uint32  private blockTimestampLast; // uses single storage slot, accessible via getReserves

    uint public price0CumulativeLast;
    uint public price1CumulativeLast;
    uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event

    uint private unlocked = 1;
    modifier lock() {
        require(unlocked == 1, 'OpenSwapV2 LOCKED');
        unlocked = 0;
        _;
        unlocked = 1;
    }

    function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
        _reserve0 = reserve0;
        _reserve1 = reserve1;
        _blockTimestampLast = blockTimestampLast;
    }

    function _safeTransfer(address token, address to, uint value) private {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'OpenSwapV2 TRANSFER_FAILED');
    }

    event Mint(address indexed sender, uint amount0, uint amount1);
    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);

    constructor() public {
        factory = msg.sender;
    }

    // called once by the factory at time of deployment
    function initialize(address _token0, address _token1) external {
        require(msg.sender == factory, 'OpenSwapV2 FORBIDDEN'); // sufficient check
        token0 = _token0;
        token1 = _token1;
        string memory name0 = IERC20Uniswap(token0).symbol();
        string memory name1 = IERC20Uniswap(token1).symbol();
        symbol = concat(name0, "-", name1);
    }

    function concat(string memory a, string memory b, string memory c) internal pure returns (string memory) {
        return string(abi.encodePacked(a, b, c));
    }

    // update reserves and, on the first call per block, price accumulators
    function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
        require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'OpenSwapV2 OVERFLOW');
        uint32 blockTimestamp = uint32(block.timestamp % 2**32);
        uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
        if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
            // * never overflows, and + overflow is desired
            price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
            price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
        }
        reserve0 = uint112(balance0);
        reserve1 = uint112(balance1);
        blockTimestampLast = blockTimestamp;
        emit Sync(reserve0, reserve1);
    }

    // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
    function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
        address feeTo = IUniswapV2Factory(factory).feeTo();
        feeOn = feeTo != address(0);
        uint _kLast = kLast; // gas savings
        if (feeOn) {
            if (_kLast != 0) {
                uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
                uint rootKLast = Math.sqrt(_kLast);
                if (rootK > rootKLast) {
                    uint numerator = totalSupply.mul(rootK.sub(rootKLast));
                    uint denominator = rootK.add(rootKLast); // 1/2 of fee
                    uint liquidity = numerator / denominator;
                    if (liquidity > 0) _mint(feeTo, liquidity);
                }
            }
        } else if (_kLast != 0) {
            kLast = 0;
        }
    }

    // this low-level function should be called from a contract which performs important safety checks
    function mint(address to) external lock returns (uint liquidity) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        uint balance0 = IERC20Uniswap(token0).balanceOf(address(this));
        uint balance1 = IERC20Uniswap(token1).balanceOf(address(this));
        uint amount0 = balance0.sub(_reserve0);
        uint amount1 = balance1.sub(_reserve1);

        bool feeOn = _mintFee(_reserve0, _reserve1);
        uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
        if (_totalSupply == 0) {
            liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
            _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens 
        } else {
            liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
        }
        require(liquidity > 0, 'OpenSwapV2 INSUFFICIENT_LIQUIDITY_MINTED');
        _mint(to, liquidity);

        _update(balance0, balance1, _reserve0, _reserve1);
        if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
        emit Mint(msg.sender, amount0, amount1);
    }

    // this low-level function should be called from a contract which performs important safety checks
    function burn(address to) external lock returns (uint amount0, uint amount1) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        address _token0 = token0;                                // gas savings
        address _token1 = token1;                                // gas savings
        uint balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
        uint balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
        uint liquidity = balanceOf[address(this)];

        bool feeOn = _mintFee(_reserve0, _reserve1);
        uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
        amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
        amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
        require(amount0 > 0 && amount1 > 0, 'OpenSwapV2 INSUFFICIENT_LIQUIDITY_BURNED');
        _burn(address(this), liquidity);
        _safeTransfer(_token0, to, amount0);
        _safeTransfer(_token1, to, amount1);
        balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
        balance1 = IERC20Uniswap(_token1).balanceOf(address(this));

        _update(balance0, balance1, _reserve0, _reserve1);
        if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
        emit Burn(msg.sender, amount0, amount1, to);
    }

    // this low-level function should be called from a contract which performs important safety checks
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
        require(amount0Out > 0 || amount1Out > 0, 'OpenSwapV2 INSUFFICIENT_OUTPUT_AMOUNT');
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        require(amount0Out < _reserve0 && amount1Out < _reserve1, 'OpenSwapV2 INSUFFICIENT_LIQUIDITY');

        uint balance0;
        uint balance1;
        { // scope for _token{0,1}, avoids stack too deep errors
        address _token0 = token0;
        address _token1 = token1;
        require(to != _token0 && to != _token1, 'OpenSwapV2 INVALID_TO');
        if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
        if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
        if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
        balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
        balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
        }
        uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
        uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
        require(amount0In > 0 || amount1In > 0, 'OpenSwapV2 INSUFFICIENT_INPUT_AMOUNT');
        { // scope for reserve{0,1}Adjusted, avoids stack too deep errors
        uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
        uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
        require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'OpenSwapV2 K');
        }

        _update(balance0, balance1, _reserve0, _reserve1);
        emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
    }

    // force balances to match reserves
    function skim(address to) external lock {
        address _token0 = token0; // gas savings
        address _token1 = token1; // gas savings
        _safeTransfer(_token0, to, IERC20Uniswap(_token0).balanceOf(address(this)).sub(reserve0));
        _safeTransfer(_token1, to, IERC20Uniswap(_token1).balanceOf(address(this)).sub(reserve1));
    }

    // force reserves to match balances
    function sync() external lock {
        _update(IERC20Uniswap(token0).balanceOf(address(this)), IERC20Uniswap(token1).balanceOf(address(this)), reserve0, reserve1);
    }
}

File 28 of 33 : UniswapV2ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.6.12;

import './libraries/SafeMath.sol';

contract UniswapV2ERC20 {
    using SafeMathUniswap for uint;

    string public constant name = 'OpenSwap LP Token';
    
    uint8 public constant decimals = 18;
    uint  public totalSupply;
    mapping(address => uint) public balanceOf;
    mapping(address => mapping(address => uint)) public allowance;

    bytes32 public DOMAIN_SEPARATOR;
    // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
    mapping(address => uint) public nonces;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor() public {
        uint chainId;
        assembly {
            chainId := chainid()
        }
        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
                keccak256(bytes(name)),
                keccak256(bytes('1')),
                chainId,
                address(this)
            )
        );
    }

    function _mint(address to, uint value) internal {
        totalSupply = totalSupply.add(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint value) internal {
        balanceOf[from] = balanceOf[from].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(from, address(0), value);
    }

    function _approve(address owner, address spender, uint value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) private {
        balanceOf[from] = balanceOf[from].sub(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint value) external returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
        require(deadline >= block.timestamp, 'OpenSwap: EXPIRED');
        bytes32 digest = keccak256(
            abi.encodePacked(
                '\x19\x01',
                DOMAIN_SEPARATOR,
                keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
            )
        );
        address recoveredAddress = ecrecover(digest, v, r, s);
        require(recoveredAddress != address(0) && recoveredAddress == owner, 'OpenSwap: INVALID_SIGNATURE');
        _approve(owner, spender, value);
    }
}

File 29 of 33 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.6.12;

// a library for performing various math operations

library Math {
    function min(uint x, uint y) internal pure returns (uint z) {
        z = x < y ? x : y;
    }

    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
}

File 30 of 33 : UQ112x112.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.6.12;

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))

// range: [0, 2**112 - 1]
// resolution: 1 / 2**112

library UQ112x112 {
    uint224 constant Q112 = 2**112;

    // encode a uint112 as a UQ112x112
    function encode(uint112 y) internal pure returns (uint224 z) {
        z = uint224(y) * Q112; // never overflows
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
        z = x / uint224(y);
    }
}

File 31 of 33 : IUniswapV2Callee.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.0;

interface IUniswapV2Callee {
    function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}

File 32 of 33 : UniswapV2Factory.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.6.12;

import './interfaces/IUniswapV2Factory.sol';
import './UniswapV2Pair.sol';

contract UniswapV2Factory is IUniswapV2Factory {
    address public override feeTo;
    address public override feeToSetter;

    mapping(address => mapping(address => address)) public override getPair;
    address[] public override allPairs;

    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    constructor(address _feeToSetter) public {
        feeToSetter = _feeToSetter;
    }

    function allPairsLength() external override view returns (uint) {
        return allPairs.length;
    }

    function pairCodeHash() external pure returns (bytes32) {
        return keccak256(type(UniswapV2Pair).creationCode);
    }

    function createPair(address tokenA, address tokenB) external override returns (address pair) {
        require(tokenA != tokenB, 'OpenSwap IDENTICAL_ADDRESSES');
        (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'OpenSwap ZERO_ADDRESS');
        require(getPair[token0][token1] == address(0), 'OpenSwap PAIR_EXISTS'); // single check is sufficient
        bytes memory bytecode = type(UniswapV2Pair).creationCode;
        bytes32 salt = keccak256(abi.encodePacked(token0, token1));
        assembly {
            pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }
        
        UniswapV2Pair(pair).initialize(token0, token1);
        getPair[token0][token1] = pair;
        getPair[token1][token0] = pair; // populate mapping in the reverse direction
        allPairs.push(pair);
        emit PairCreated(token0, token1, pair, allPairs.length);
    }

    function setFeeTo(address _feeTo) external override {
        require(msg.sender == feeToSetter, 'OpenSwap FORBIDDEN');
        feeTo = _feeTo;
    }

    function setFeeToSetter(address _feeToSetter) external override {
        require(msg.sender == feeToSetter, 'OpenSwap FORBIDDEN');
        feeToSetter = _feeToSetter;
    }

}

File 33 of 33 : OpenXbar.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol";

interface IMC{
	function deposit(uint256 _pid, uint256 _amount,address _to) external;
    function harvest(uint256 pid, address to) external;
}

// OpenXBar is the second coolest bar in town (after Sushi (mad respect)). You come in with some OpenX, and leave with more! The longer you stay, the more OpenX you get.
//
// This contract handles swapping to and from xOpenX, OpenXSwap's staking token.
contract OpenXGov is ERC20("OpenXSwap Gov Token", "xOpenX"), ERC20Snapshot{
    using SafeMath for uint256;
    IERC20 public OpenX;
    IMC public masterchef;
    IERC20 dummyToken;
    address public snapAdmin;
    uint256 public lockEnd;

    // Define the OpenX token contract
    constructor(IERC20 _OpenX, IERC20 _dummyToken) public {
        OpenX = _OpenX;
        dummyToken = _dummyToken;
       	snapAdmin = msg.sender;
        lockEnd = block.timestamp + 180 days;
    }

    function changeSnapshotAdmin(address _admin) public {
    	require(msg.sender == snapAdmin, "Unauthorized");
    	snapAdmin = _admin;
    }

    function snapshot() public {
    	require(msg.sender == snapAdmin, "Unauthorized");
        _snapshot();
    }

    uint private unlocked = 1;
    //reentrancy guard for deposit/withdraw
    modifier lock() {
        require(unlocked == 1, 'OpenX LOCKED');
        unlocked = 0;
        _;
        unlocked = 1;
    }

    // Enter the bar. Pay some OPENXs. Earn some shares.
    // Locks OpenX and mints xOpenX
    function enter(uint256 _amount) public lock {
        require(address(masterchef) != address(0));
    	_harvestOpenX();
        // Gets the amount of OpenX locked in the contract
        uint256 totalOpenX = OpenX.balanceOf(address(this));
        // Gets the amount of xOpenX in existence
        uint256 totalShares = totalSupply();
        // If no xOpenX exists, mint it 1:1 to the amount put in
        if (totalShares == 0 || totalOpenX == 0) {
            _mint(msg.sender, _amount);
        }
        // Calculate and mint the amount of xOpenX the OpenX is worth. The ratio will change overtime, as xOpenX is burned/minted and OpenX deposited + gained from fees / withdrawn.
        else {
            uint256 what = _amount.mul(totalShares).div(totalOpenX);
            _mint(msg.sender, what);
        }
        // Lock the OpenX in the contract
        OpenX.transferFrom(msg.sender, address(this), _amount);
    }

    function _harvestOpenX() internal {
	    masterchef.harvest(0, address(this));
    }

    function init(IMC _masterchef) public {
        require(address(masterchef) == address(0));
        //To set same ratio old token to refund Masterchef Bug.
        _mint(msg.sender, 62643 * 10 ** 18);
        OpenX.transferFrom(msg.sender, address(this), 285889 * 10 ** 18);
        
        masterchef = _masterchef;
        uint256 balance = dummyToken.balanceOf(msg.sender);
        require(balance != 0, "Balance must exceed 0");
        dummyToken.transferFrom(msg.sender, address(this), balance);
        dummyToken.approve(address(masterchef), balance);
        masterchef.deposit(0, balance, address(this));
    }

    // Leave the bar. Claim back your OPENXs.
    // Unlocks the staked + gained OpenX and burns xOpenX
    function leave(uint256 _share) public lock {
        require(block.timestamp >= lockEnd, "Tokens still locked.");
    	_harvestOpenX();
        // Gets the amount of xOpenX in existence
        uint256 totalShares = totalSupply();
        // Calculates the amount of OpenX the xOpenX is worth
        uint256 what = _share.mul(OpenX.balanceOf(address(this))).div(totalShares);
        _burn(msg.sender, _share);
        OpenX.transfer(msg.sender, what);
    }

    // The following functions are overrides required by Solidity.

    function _beforeTokenTransfer(address from, address to, uint256 amount)
        internal
        override(ERC20, ERC20Snapshot)
    {
        super._beforeTokenTransfer(from, to, amount);
    }

}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_openx","type":"address"},{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_bar","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"bridge","type":"address"}],"name":"LogBridgeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"server","type":"address"},{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSUSHI","type":"uint256"}],"name":"LogConvert","type":"event"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"bridgeFor","outputs":[{"internalType":"address","name":"bridge","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burnX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"convert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"token0","type":"address[]"},{"internalType":"address[]","name":"token1","type":"address[]"}],"name":"convertMultiple","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IUniswapV2Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"bridge","type":"address"}],"name":"setBridge","outputs":[],"stateMutability":"nonpayable","type":"function"}]

61010060405234801561001157600080fd5b506040516121593803806121598339818101604052608081101561003457600080fd5b508051602082015160408301516060938401516001600160601b031993851b841660805291841b831660a052831b821660c052600080546001600160a01b0319163317905590911b1660e05260805160601c60a05160601c60c05160601c60e05160601c61200c61014d60003980610ec4528061115c528061134f52806118b952508061066052806107fe5280610f795280610fd052806114095280611460528061148952806114b6528061150d5280611536525080610356528061045152806106095280610d925280610dfb5280610e995280611030528061109952806111315280611223528061128c528061132452806117b752806117f6528061188e5250806108a152806108e3528061196e525061200c6000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063a761a9391161005b578063a761a939146101c7578063bd1b820c14610223578063c45a01551461025e578063f851a4401461026657610088565b8063303e6aa41461008d57806367ad00b514610151578063704b6c02146101595780639d22ae8c1461018c575b600080fd5b61014f600480360360408110156100a357600080fd5b8101906020810181356401000000008111156100be57600080fd5b8201836020820111156100d057600080fd5b803590602001918460208302840111640100000000831117156100f257600080fd5b91939092909160208101903564010000000081111561011057600080fd5b82018360208201111561012257600080fd5b8035906020019184602083028401116401000000008311171561014457600080fd5b50909250905061026e565b005b61014f610352565b61014f6004803603602081101561016f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104b4565b61014f600480360360408110156101a257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610581565b6101fa600480360360208110156101dd57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166107ce565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61014f6004803603604081101561023957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610823565b6101fa61089f565b6101fa6108c3565b3332146102dc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4f70656e53776170204d616b65723a206d7573742075736520454f4100000000604482015290519081900360640190fd5b8260005b8181101561034a576103428686838181106102f757fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1685858481811061032057fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff166108df565b6001016102e0565b505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156103db57600080fd5b505afa1580156103ef573d6000803e3d6000fd5b505050506040513d602081101561040557600080fd5b5051604080517f42966c6800000000000000000000000000000000000000000000000000000000815260048101839052905191925073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016916342966c689160248082019260009290919082900301818387803b15801561049957600080fd5b505af11580156104ad573d6000803e3d6000fd5b5050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461053a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff16331461060757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156106af57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156106e757508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b61075257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f70656e53776170204d616b65723a20496e76616c6964206272696467650000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82811660008181526001602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517f2e103aa707acc565f9a1547341914802b2bfe977fd79c595209f248ae4b006139190a35050565b73ffffffffffffffffffffffffffffffffffffffff808216600090815260016020526040902054168061081e57507f00000000000000000000000000000000000000000000000000000000000000005b919050565b33321461089157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4f70656e53776170204d616b65723a206d7573742075736520454f4100000000604482015290519081900360640190fd5b61089b82826108df565b5050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e6a4390584846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561098657600080fd5b505afa15801561099a573d6000803e3d6000fd5b505050506040513d60208110156109b057600080fd5b5051905073ffffffffffffffffffffffffffffffffffffffff8116610a3657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4f70656e53776170204d616b65723a20496e76616c6964207061697200000000604482015290519081900360640190fd5b8073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb828373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610aba57600080fd5b505afa158015610ace573d6000803e3d6000fd5b505050506040513d6020811015610ae457600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff909316600484015260248301919091525160448083019260209291908290030181600087803b158015610b5a57600080fd5b505af1158015610b6e573d6000803e3d6000fd5b505050506040513d6020811015610b8457600080fd5b5050604080517f89afcb440000000000000000000000000000000000000000000000000000000081523060048201528151600092839273ffffffffffffffffffffffffffffffffffffffff8616926389afcb449260248084019391929182900301818787803b158015610bf657600080fd5b505af1158015610c0a573d6000803e3d6000fd5b505050506040513d6040811015610c2057600080fd5b508051602091820151604080517f0dfe1681000000000000000000000000000000000000000000000000000000008152905192955090935073ffffffffffffffffffffffffffffffffffffffff861692630dfe168192600480840193829003018186803b158015610c9057600080fd5b505afa158015610ca4573d6000803e3d6000fd5b505050506040513d6020811015610cba57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff868116911614610cdd57905b73ffffffffffffffffffffffffffffffffffffffff808516908616337fd06b1d7ed79b664d17472c6f6997b929f1abe463ccccb4e5b6a0038f2f730c158585610d288b8b8484610d4c565b60408051938452602084019290925282820152519081900360600190a45050505050565b60008373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561102e576000610d8e848461163e565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610f775773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166342966c68610e366002610e308560036116bb565b9061173c565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015610e6c57600080fd5b505af1158015610e80573d6000803e3d6000fd5b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016915063a9059cbb90507f0000000000000000000000000000000000000000000000000000000000000000610eee8460036116bb565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f4157600080fd5b505af1158015610f55573d6000803e3d6000fd5b505050506040513d6020811015610f6b57600080fd5b50909150819050611028565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610ffc57610ff57f0000000000000000000000000000000000000000000000000000000000000000826117af565b9150611028565b6000611007876107ce565b905061101587828430611969565b91506110248182846000610d4c565b9250505b50611636565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156112215773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166342966c686110ce6002610e308760036116bb565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561110457600080fd5b505af1158015611118573d6000803e3d6000fd5b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016915063a9059cbb90507f00000000000000000000000000000000000000000000000000000000000000006111868660036116bb565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156111d957600080fd5b505af11580156111ed573d6000803e3d6000fd5b505050506040513d602081101561120357600080fd5b5061121a90508361121486856117af565b9061163e565b9050611636565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156114075773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166342966c686112c16002610e308660036116bb565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156112f757600080fd5b505af115801561130b573d6000803e3d6000fd5b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016915063a9059cbb90507f00000000000000000000000000000000000000000000000000000000000000006113798560036116bb565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156113cc57600080fd5b505af11580156113e0573d6000803e3d6000fd5b505050506040513d60208110156113f657600080fd5b5061121a90508261121487866117af565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156114b45761121a7f00000000000000000000000000000000000000000000000000000000000000006114af85611214887f00000000000000000000000000000000000000000000000000000000000000008830611969565b6117af565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561155c5761121a7f00000000000000000000000000000000000000000000000000000000000000006114af84611214897f00000000000000000000000000000000000000000000000000000000000000008930611969565b6000611567866107ce565b90506000611574866107ce565b90508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115c8576115c182876115bb8a868a30611969565b87610d4c565b9250611633565b8673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611613576115c187828761160e8a868a30611969565b610d4c565b61163082826116248a868a30611969565b61160e8a868a30611969565b92505b50505b949350505050565b6000828201838110156116b257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b600080821161172b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161173457fe5b049392505050565b60008261174b575060006116b5565b8282028284828161175857fe5b04146116b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611fb66021913960400191505060405180910390fd5b60006117dd837f00000000000000000000000000000000000000000000000000000000000000008430611969565b905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166342966c6861182b6002610e308560036116bb565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561186157600080fd5b505af1158015611875573d6000803e3d6000fd5b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016915063a9059cbb90507f00000000000000000000000000000000000000000000000000000000000000006118e38460036116bb565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561193657600080fd5b505af115801561194a573d6000803e3d6000fd5b505050506040513d602081101561196057600080fd5b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663e6a4390587876040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611a1157600080fd5b505afa158015611a25573d6000803e3d6000fd5b505050506040513d6020811015611a3b57600080fd5b5051905073ffffffffffffffffffffffffffffffffffffffff8116611ac157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f70656e53776170204d616b65723a2043616e6e6f7420636f6e766572740000604482015290519081900360640190fd5b6000808273ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611b0a57600080fd5b505afa158015611b1e573d6000803e3d6000fd5b505050506040513d6060811015611b3457600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506000611b62876103e561173c565b90508373ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611baa57600080fd5b505afa158015611bbe573d6000803e3d6000fd5b505050506040513d6020811015611bd457600080fd5b505173ffffffffffffffffffffffffffffffffffffffff8a811691161415611dd157611c0681611214856103e861173c565b611c1683610e308a6103e561173c565b81611c1d57fe5b0494508873ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85896040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611c9157600080fd5b505af1158015611ca5573d6000803e3d6000fd5b505050506040513d6020811015611cbb57600080fd5b505060408051600080825260208201928390527f022c0d9f000000000000000000000000000000000000000000000000000000008352602482018181526044830189905273ffffffffffffffffffffffffffffffffffffffff8a81166064850152608060848501908152845160a48601819052918a169563022c0d9f958c948e9491939092909160c4850191908083838b5b83811015611d65578181015183820152602001611d4d565b50505050905090810190601f168015611d925780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611db457600080fd5b505af1158015611dc8573d6000803e3d6000fd5b50505050611fa9565b611de181611214846103e861173c565b611df184610e308a6103e561173c565b81611df857fe5b0494508873ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85896040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e6c57600080fd5b505af1158015611e80573d6000803e3d6000fd5b505050506040513d6020811015611e9657600080fd5b505060408051600080825260208201928390527f022c0d9f000000000000000000000000000000000000000000000000000000008352602482018881526044830182905273ffffffffffffffffffffffffffffffffffffffff8a81166064850152608060848501908152845160a48601819052918a169563022c0d9f958c95948e9491939092909160c4850191908083838a5b83811015611f41578181015183820152602001611f29565b50505050905090810190601f168015611f6e5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611f9057600080fd5b505af1158015611fa4573d6000803e3d6000fd5b505050505b5050505094935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220966c568c681a62eceef16596c9e13c225c46eea904952b241b959c2ab7bd859064736f6c634300060c0033000000000000000000000000f3c7978ddd70b4158b53e897f980093183ca5c52000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e900000000000000000000000042000000000000000000000000000000000000060000000000000000000000002513486f18eee1498d7b6281f668b955181dd0d9

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063a761a9391161005b578063a761a939146101c7578063bd1b820c14610223578063c45a01551461025e578063f851a4401461026657610088565b8063303e6aa41461008d57806367ad00b514610151578063704b6c02146101595780639d22ae8c1461018c575b600080fd5b61014f600480360360408110156100a357600080fd5b8101906020810181356401000000008111156100be57600080fd5b8201836020820111156100d057600080fd5b803590602001918460208302840111640100000000831117156100f257600080fd5b91939092909160208101903564010000000081111561011057600080fd5b82018360208201111561012257600080fd5b8035906020019184602083028401116401000000008311171561014457600080fd5b50909250905061026e565b005b61014f610352565b61014f6004803603602081101561016f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104b4565b61014f600480360360408110156101a257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610581565b6101fa600480360360208110156101dd57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166107ce565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61014f6004803603604081101561023957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610823565b6101fa61089f565b6101fa6108c3565b3332146102dc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4f70656e53776170204d616b65723a206d7573742075736520454f4100000000604482015290519081900360640190fd5b8260005b8181101561034a576103428686838181106102f757fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1685858481811061032057fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff166108df565b6001016102e0565b505050505050565b60007f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156103db57600080fd5b505afa1580156103ef573d6000803e3d6000fd5b505050506040513d602081101561040557600080fd5b5051604080517f42966c6800000000000000000000000000000000000000000000000000000000815260048101839052905191925073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e916916342966c689160248082019260009290919082900301818387803b15801561049957600080fd5b505af11580156104ad573d6000803e3d6000fd5b5050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461053a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff16331461060757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e973ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156106af57507f000000000000000000000000420000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156106e757508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b61075257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f70656e53776170204d616b65723a20496e76616c6964206272696467650000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82811660008181526001602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169486169485179055517f2e103aa707acc565f9a1547341914802b2bfe977fd79c595209f248ae4b006139190a35050565b73ffffffffffffffffffffffffffffffffffffffff808216600090815260016020526040902054168061081e57507f00000000000000000000000042000000000000000000000000000000000000065b919050565b33321461089157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4f70656e53776170204d616b65723a206d7573742075736520454f4100000000604482015290519081900360640190fd5b61089b82826108df565b5050565b7f000000000000000000000000f3c7978ddd70b4158b53e897f980093183ca5c5281565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60007f000000000000000000000000f3c7978ddd70b4158b53e897f980093183ca5c5273ffffffffffffffffffffffffffffffffffffffff1663e6a4390584846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561098657600080fd5b505afa15801561099a573d6000803e3d6000fd5b505050506040513d60208110156109b057600080fd5b5051905073ffffffffffffffffffffffffffffffffffffffff8116610a3657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4f70656e53776170204d616b65723a20496e76616c6964207061697200000000604482015290519081900360640190fd5b8073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb828373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610aba57600080fd5b505afa158015610ace573d6000803e3d6000fd5b505050506040513d6020811015610ae457600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff909316600484015260248301919091525160448083019260209291908290030181600087803b158015610b5a57600080fd5b505af1158015610b6e573d6000803e3d6000fd5b505050506040513d6020811015610b8457600080fd5b5050604080517f89afcb440000000000000000000000000000000000000000000000000000000081523060048201528151600092839273ffffffffffffffffffffffffffffffffffffffff8616926389afcb449260248084019391929182900301818787803b158015610bf657600080fd5b505af1158015610c0a573d6000803e3d6000fd5b505050506040513d6040811015610c2057600080fd5b508051602091820151604080517f0dfe1681000000000000000000000000000000000000000000000000000000008152905192955090935073ffffffffffffffffffffffffffffffffffffffff861692630dfe168192600480840193829003018186803b158015610c9057600080fd5b505afa158015610ca4573d6000803e3d6000fd5b505050506040513d6020811015610cba57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff868116911614610cdd57905b73ffffffffffffffffffffffffffffffffffffffff808516908616337fd06b1d7ed79b664d17472c6f6997b929f1abe463ccccb4e5b6a0038f2f730c158585610d288b8b8484610d4c565b60408051938452602084019290925282820152519081900360600190a45050505050565b60008373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561102e576000610d8e848461163e565b90507f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e973ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610f775773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e9166342966c68610e366002610e308560036116bb565b9061173c565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015610e6c57600080fd5b505af1158015610e80573d6000803e3d6000fd5b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e916915063a9059cbb90507f0000000000000000000000002513486f18eee1498d7b6281f668b955181dd0d9610eee8460036116bb565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f4157600080fd5b505af1158015610f55573d6000803e3d6000fd5b505050506040513d6020811015610f6b57600080fd5b50909150819050611028565b7f000000000000000000000000420000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610ffc57610ff57f0000000000000000000000004200000000000000000000000000000000000006826117af565b9150611028565b6000611007876107ce565b905061101587828430611969565b91506110248182846000610d4c565b9250505b50611636565b7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e973ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156112215773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e9166342966c686110ce6002610e308760036116bb565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561110457600080fd5b505af1158015611118573d6000803e3d6000fd5b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e916915063a9059cbb90507f0000000000000000000000002513486f18eee1498d7b6281f668b955181dd0d96111868660036116bb565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156111d957600080fd5b505af11580156111ed573d6000803e3d6000fd5b505050506040513d602081101561120357600080fd5b5061121a90508361121486856117af565b9061163e565b9050611636565b7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e973ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156114075773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e9166342966c686112c16002610e308660036116bb565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156112f757600080fd5b505af115801561130b573d6000803e3d6000fd5b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e916915063a9059cbb90507f0000000000000000000000002513486f18eee1498d7b6281f668b955181dd0d96113798560036116bb565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156113cc57600080fd5b505af11580156113e0573d6000803e3d6000fd5b505050506040513d60208110156113f657600080fd5b5061121a90508261121487866117af565b7f000000000000000000000000420000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156114b45761121a7f00000000000000000000000042000000000000000000000000000000000000066114af85611214887f00000000000000000000000042000000000000000000000000000000000000068830611969565b6117af565b7f000000000000000000000000420000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561155c5761121a7f00000000000000000000000042000000000000000000000000000000000000066114af84611214897f00000000000000000000000042000000000000000000000000000000000000068930611969565b6000611567866107ce565b90506000611574866107ce565b90508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115c8576115c182876115bb8a868a30611969565b87610d4c565b9250611633565b8673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611613576115c187828761160e8a868a30611969565b610d4c565b61163082826116248a868a30611969565b61160e8a868a30611969565b92505b50505b949350505050565b6000828201838110156116b257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b600080821161172b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161173457fe5b049392505050565b60008261174b575060006116b5565b8282028284828161175857fe5b04146116b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611fb66021913960400191505060405180910390fd5b60006117dd837f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e98430611969565b905073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e9166342966c6861182b6002610e308560036116bb565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561186157600080fd5b505af1158015611875573d6000803e3d6000fd5b505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e916915063a9059cbb90507f0000000000000000000000002513486f18eee1498d7b6281f668b955181dd0d96118e38460036116bb565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561193657600080fd5b505af115801561194a573d6000803e3d6000fd5b505050506040513d602081101561196057600080fd5b50909392505050565b6000807f000000000000000000000000f3c7978ddd70b4158b53e897f980093183ca5c5273ffffffffffffffffffffffffffffffffffffffff1663e6a4390587876040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611a1157600080fd5b505afa158015611a25573d6000803e3d6000fd5b505050506040513d6020811015611a3b57600080fd5b5051905073ffffffffffffffffffffffffffffffffffffffff8116611ac157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4f70656e53776170204d616b65723a2043616e6e6f7420636f6e766572740000604482015290519081900360640190fd5b6000808273ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611b0a57600080fd5b505afa158015611b1e573d6000803e3d6000fd5b505050506040513d6060811015611b3457600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506000611b62876103e561173c565b90508373ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611baa57600080fd5b505afa158015611bbe573d6000803e3d6000fd5b505050506040513d6020811015611bd457600080fd5b505173ffffffffffffffffffffffffffffffffffffffff8a811691161415611dd157611c0681611214856103e861173c565b611c1683610e308a6103e561173c565b81611c1d57fe5b0494508873ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85896040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611c9157600080fd5b505af1158015611ca5573d6000803e3d6000fd5b505050506040513d6020811015611cbb57600080fd5b505060408051600080825260208201928390527f022c0d9f000000000000000000000000000000000000000000000000000000008352602482018181526044830189905273ffffffffffffffffffffffffffffffffffffffff8a81166064850152608060848501908152845160a48601819052918a169563022c0d9f958c948e9491939092909160c4850191908083838b5b83811015611d65578181015183820152602001611d4d565b50505050905090810190601f168015611d925780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611db457600080fd5b505af1158015611dc8573d6000803e3d6000fd5b50505050611fa9565b611de181611214846103e861173c565b611df184610e308a6103e561173c565b81611df857fe5b0494508873ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85896040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e6c57600080fd5b505af1158015611e80573d6000803e3d6000fd5b505050506040513d6020811015611e9657600080fd5b505060408051600080825260208201928390527f022c0d9f000000000000000000000000000000000000000000000000000000008352602482018881526044830182905273ffffffffffffffffffffffffffffffffffffffff8a81166064850152608060848501908152845160a48601819052918a169563022c0d9f958c95948e9491939092909160c4850191908083838a5b83811015611f41578181015183820152602001611f29565b50505050905090810190601f168015611f6e5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611f9057600080fd5b505af1158015611fa4573d6000803e3d6000fd5b505050505b5050505094935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220966c568c681a62eceef16596c9e13c225c46eea904952b241b959c2ab7bd859064736f6c634300060c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000f3c7978ddd70b4158b53e897f980093183ca5c52000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e900000000000000000000000042000000000000000000000000000000000000060000000000000000000000002513486f18eee1498d7b6281f668b955181dd0d9

-----Decoded View---------------
Arg [0] : _factory (address): 0xf3C7978Ddd70B4158b53e897f980093183cA5c52
Arg [1] : _openx (address): 0xc3864f98f2a61A7cAeb95b039D031b4E2f55e0e9
Arg [2] : _weth (address): 0x4200000000000000000000000000000000000006
Arg [3] : _bar (address): 0x2513486f18eeE1498D7b6281f668B955181Dd0D9

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000f3c7978ddd70b4158b53e897f980093183ca5c52
Arg [1] : 000000000000000000000000c3864f98f2a61a7caeb95b039d031b4e2f55e0e9
Arg [2] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [3] : 0000000000000000000000002513486f18eee1498d7b6281f668b955181dd0d9


Deployed ByteCode Sourcemap

651:8073:10:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3290:326;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3290:326:10;;-1:-1:-1;3290:326:10;-1:-1:-1;3290:326:10;:::i;:::-;;3622:142;;;:::i;1508:126::-;;;;;;;;;;;;;;;;-1:-1:-1;1508:126:10;;;;:::i;1911:337::-;;;;;;;;;;;;;;;;-1:-1:-1;1911:337:10;;;;;;;;;;;:::i;1680:185::-;;;;;;;;;;;;;;;;-1:-1:-1;1680:185:10;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;3075:109;;;;;;;;;;;;;;;;-1:-1:-1;3075:109:10;;;;;;;;;;;:::i;729:42::-;;;:::i;782:20::-;;;:::i;3290:326::-;2535:10;2549:9;2535:23;2527:64;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3501:6;3487:11:::1;3524:86;3545:3;3541:1;:7;3524:86;;;3569:30;3578:6;;3585:1;3578:9;;;;;;;;;;;;;;;3589:6;;3596:1;3589:9;;;;;;;;;;;;;;;3569:8;:30::i;:::-;3550:3;;3524:86;;;;2601:1;3290:326:::0;;;;:::o;3622:142::-;3656:15;3681:5;3674:23;;;3706:4;3674:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3674:38:10;3722:35;;;;;;;;;;;;;;3674:38;;-1:-1:-1;3722:26:10;3737:5;3722:26;;;;:35;;;;;-1:-1:-1;;3722:35:10;;;;;;;;-1:-1:-1;3722:26:10;:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3622:142;:::o;1508:126::-;1581:5;;;;1567:10;:19;1559:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1613:5;:14;;;;;;;;;;;;;;;1508:126::o;1911:337::-;2002:5;;;;1988:10;:19;1980:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2069:5;2060:14;;:5;:14;;;;:31;;;;;2087:4;2078:13;;:5;:13;;;;2060:31;:50;;;;;2104:6;2095:15;;:5;:15;;;;2060:50;2052:93;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2175:15;;;;;;;;:8;:15;;;;;;:24;;;;;;;;;;;;2214:27;;;2175:15;2214:27;1911:337;;:::o;1680:185::-;1770:15;;;;1735:14;1770:15;;;:8;:15;;;;;;;1799:20;1795:64;;-1:-1:-1;1844:4:10;1795:64;1680:185;;;:::o;3075:109::-;2535:10;2549:9;2535:23;2527:64;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3153:24:::1;3162:6;3170;3153:8;:24::i;:::-;3075:109:::0;;:::o;729:42::-;;;:::o;782:20::-;;;;;;:::o;3809:738::-;3925:19;3962:7;:15;;;3978:6;3986;3962:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3962:31:10;;-1:-1:-1;4012:27:10;;;4004:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4164:4;4149:30;;;4188:4;4195;:14;;;4218:4;4195:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4195:29:10;4149:76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4195:29;;4149:76;;;;;;;-1:-1:-1;4149:76:10;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;4295:24:10;;;;;;4313:4;4295:24;;;;;;4259:15;;;;4295:9;;;;;;:24;;;;;;;;;;;;;4259:15;4295:9;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4295:24:10;;;;;;;;4343:13;;;;;;;4295:24;;-1:-1:-1;4295:24:10;;-1:-1:-1;4343:11:10;;;;;;:13;;;;;;;;;;:11;:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4343:13:10;4333:23;;;;;;;4329:93;;4394:7;4329:93;4436:104;;;;;;;4447:10;4436:104;4475:7;4484;4493:46;4459:6;4467;4475:7;4484;4493:12;:46::i;:::-;4436:104;;;;;;;;;;;;;;;;;;;;;;;;;;3809:738;;;;;:::o;4657:2538::-;4762:16;4828:6;4818:16;;:6;:16;;;4814:2375;;;4850:14;4867:20;:7;4879;4867:11;:20::i;:::-;4850:37;;4915:5;4905:15;;:6;:15;;;4901:522;;;4940:26;4955:5;4940:26;;4967:20;4985:1;4967:13;:6;4978:1;4967:10;:13::i;:::-;:17;;:20::i;:::-;4940:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5013:22:10;5020:5;5013:22;;-1:-1:-1;5013:22:10;;-1:-1:-1;5036:3:10;5041:13;:6;5052:1;5041:10;:13::i;:::-;5013:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5098:6:10;;-1:-1:-1;5098:6:10;;-1:-1:-1;4901:522:10;;;5139:4;5129:14;;:6;:14;;;5125:298;;;5174:22;5183:4;5189:6;5174:8;:22::i;:::-;5163:33;;5125:298;;;5235:14;5252:17;5262:6;5252:9;:17::i;:::-;5235:34;;5296:44;5302:6;5310;5318;5334:4;5296:5;:44::i;:::-;5287:53;;5369:39;5382:6;5390;5398;5406:1;5369:12;:39::i;:::-;5358:50;;5125:298;;4814:2375;;;;5453:5;5443:15;;:6;:15;;;5439:1750;;;5493:26;5508:5;5493:26;;5520:21;5539:1;5520:14;:7;5532:1;5520:11;:14::i;:21::-;5493:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5563:22:10;5570:5;5563:22;;-1:-1:-1;5563:22:10;;-1:-1:-1;5586:3:10;5591:14;:7;5603:1;5591:11;:14::i;:::-;5563:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5638:38:10;;-1:-1:-1;5668:7:10;5638:25;5647:6;5655:7;5638:8;:25::i;:::-;:29;;:38::i;:::-;5627:49;;5439:1750;;;5707:5;5697:15;;:6;:15;;;5693:1496;;;5748:26;5763:5;5748:26;;5775:21;5794:1;5775:14;:7;5787:1;5775:11;:14::i;:21::-;5748:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5818:22:10;5825:5;5818:22;;-1:-1:-1;5818:22:10;;-1:-1:-1;5841:3:10;5846:14;:7;5858:1;5846:11;:14::i;:::-;5818:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5892:38:10;;-1:-1:-1;5922:7:10;5892:25;5901:6;5909:7;5892:8;:25::i;5693:1496::-;5962:4;5952:14;;:6;:14;;;5948:1241;;;6011:72;6020:4;6026:56;6074:7;6026:43;6032:6;6040:4;6046:7;6063:4;6026:5;:43::i;:56::-;6011:8;:72::i;5948:1241::-;6114:4;6104:14;;:6;:14;;;6100:1089;;;6163:72;6172:4;6178:56;6226:7;6178:43;6184:6;6192:4;6198:7;6215:4;6178:5;:43::i;6100:1089::-;6284:15;6302:17;6312:6;6302:9;:17::i;:::-;6284:35;;6333:15;6351:17;6361:6;6351:9;:17::i;:::-;6333:35;;6397:6;6386:17;;:7;:17;;;6382:797;;;6480:143;6493:7;6502:6;6530:46;6536:6;6544:7;6553;6570:4;6530:5;:46::i;:::-;6598:7;6480:12;:143::i;:::-;6469:154;;6382:797;;;6659:6;6648:17;;:7;:17;;;6644:535;;;6742:143;6755:6;6763:7;6792;6821:46;6827:6;6835:7;6844;6861:4;6821:5;:46::i;:::-;6742:12;:143::i;6644:535::-;6935:229;6948:7;6957;7032:46;7038:6;7046:7;7055;7072:4;7032:5;:46::i;:::-;7100;7106:6;7114:7;7123;7140:4;7100:5;:46::i;6935:229::-;6924:240;;6644:535;6100:1089;;;4657:2538;;;;;;:::o;2690:175:1:-;2748:7;2779:5;;;2802:6;;;;2794:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2857:1;-1:-1:-1;2690:175:1;;;;;:::o;4217:150::-;4275:7;4306:1;4302;:5;4294:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4359:1;4355;:5;;;;;;;4217:150;-1:-1:-1;;;4217:150:1:o;3538:215::-;3596:7;3619:6;3615:20;;-1:-1:-1;3634:1:1;3627:8;;3615:20;3657:5;;;3661:1;3657;:5;:1;3680:5;;;;;:10;3672:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8417:305:10;8485:17;8549:44;8555:5;8562;8569:8;8587:4;8549:5;:44::i;:::-;8537:56;-1:-1:-1;8603:26:10;8618:5;8603:26;;8630:23;8651:1;8630:16;8537:56;8644:1;8630:13;:16::i;:23::-;8603:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;8670:22:10;8677:5;8670:22;;-1:-1:-1;8670:22:10;;-1:-1:-1;8693:3:10;8698:16;:9;8712:1;8698:13;:16::i;:::-;8670:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8417:305:10;;;-1:-1:-1;;;8417:305:10:o;7280:1091::-;7379:17;7449:19;7486:7;:15;;;7502:9;7513:7;7486:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7486:35:10;;-1:-1:-1;7540:27:10;;;7532:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7661:16;7679;7700:4;:16;;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7700:18:10;;;;;;;7660:58;;;;;-1:-1:-1;7660:58:10;;-1:-1:-1;7728:23:10;7754:17;:8;7767:3;7754:12;:17::i;:::-;7728:43;;7798:4;:11;;;:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7798:13:10;7785:26;;;;;;;7781:584;;;7873:39;7896:15;7873:18;:8;7886:4;7873:12;:18::i;:39::-;7839:31;7861:8;7839:17;:8;7852:3;7839:12;:17::i;:31::-;:73;;;;;;7827:85;;7933:9;7926:26;;;7961:4;7968:8;7926:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;8019:12:10;;;8001:1;8019:12;;;;;;;;;;7991:41;;;;;;;;;;;;;;;:9;:41;;;;;;;;;;;;;;;;;;;;;;:9;;;;;;8004;;8015:2;;8019:12;;7991:41;;;;;;;;8019:12;7991:41;;8019:12;8001:1;7991:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7781:584;;;8152:39;8175:15;8152:18;:8;8165:4;8152:12;:18::i;:39::-;8118:31;8140:8;8118:17;:8;8131:3;8118:12;:17::i;:31::-;:73;;;;;;8106:85;;8212:9;8205:26;;;8240:4;8247:8;8205:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;8298:12:10;;;8291:1;8298:12;;;;;;;;;;8270:41;;;;;;;;;;;;;;;:9;:41;;;;;;;;;;;;;;;;;;;;;;:9;;;;;;8280;;8291:1;8294:2;;8298:12;;8270:41;;;;;;;;8298:12;8270:41;;8298:12;8291:1;8270:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7781:584;7280:1091;;;;;;;;;;:::o

Swarm Source

ipfs://966c568c681a62eceef16596c9e13c225c46eea904952b241b959c2ab7bd8590
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.