ETH Price: $3,074.50 (-1.91%)
Gas: 8.78 Gwei

Token

RootKit (ROOT)
 

Overview

Max Total Supply

9,853.129166899533533492 ROOT

Holders

420 (0.00%)

Market

Price

$1,318.36 @ 0.428804 ETH

Onchain Market Cap

$12,989,951.03

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
0.261783487017456498 ROOT

Value
$345.12 ( ~0.11225239270624 Eth) [0.0027%]
0xd9c49105b3131b2d8edd36bee09350a4c97fb3df
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Utilizing the combination of the Uniswap pricing mechanism, a fixed-supply currency, and permanently locked liquidity pools, Rootkit creates a price floor that is easy to calculate and ensures a minimum possible price for the token.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
RootKit

Compiler Version
v0.7.4+commit.3f05b770

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity Multiple files format)

File 22 of 34: RootKit.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
RootKit
Because my suggestions of WootKit and GrootKit were overruled
*/

import "./GatedERC20.sol";

contract RootKit is GatedERC20("RootKit", "ROOT")
{
    constructor()
    {
        _mint(msg.sender, 10000 ether);
    }
}

File 1 of 34: Address.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.3._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.3._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 2 of 34: DevSplitter.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IERC20.sol";
import "./SafeMath.sol";
import "./SafeERC20.sol";
import "./Address.sol";

contract DevSplitter
{
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using Address for address;

    mapping (IERC20 => uint256) public totalPaid;
    mapping (IERC20 => mapping(address => uint256)) public totalPaidToPayee;
    
    mapping (address => uint256) public share;
    uint256 immutable public totalShares;

    constructor(address[] memory payees, uint256[] memory shares)
    {
        require (payees.length == shares.length && payees.length > 0);

        uint256 total = 0;
        for (uint256 x=0; x<payees.length; ++x) {
            address payee = payees[x];
            uint256 sh = shares[x];
            require (payee != address(0) && sh > 0 && share[payee] == 0);
            require (!payee.isContract(), "Cannot pay a contract");
            total = total.add(sh);
            share[payee] = sh;
        }
        totalShares = total;
    }

    receive() external payable {}

    function owed(IERC20 token, address payee) public view returns (uint256) {        
        uint256 balance = address(token) == address(0) ? address(this).balance : token.balanceOf(address(this));
        uint256 payeeShare = balance.add(totalPaid[token]).mul(share[payee]) / totalShares;
        uint256 paid = totalPaidToPayee[token][payee];
        return payeeShare > paid ? payeeShare - paid : 0;
    }

    function pay(IERC20 token, address payable payee) public {
        uint256 toPay = owed(token, payee);
        require (toPay > 0, "Nothing to pay");

        totalPaid[token] = totalPaid[token].add(toPay);
        totalPaidToPayee[token][payee] = totalPaidToPayee[token][payee].add(toPay);
                
        if (address(token) == address(0)) {
            (bool success,) = payee.call{ value: toPay }("");
            require (success, "Transfer failed");
        }
        else {
            token.safeTransfer(payee, toPay);
        }
    }
}

File 3 of 34: ERC20.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
Simplified thanks to higher solidity version
But same functionality
*/

import "./IERC20.sol";
import "./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}.
 */
abstract contract ERC20 is IERC20 
{
    using SafeMath for uint256;

    mapping (address => uint256) public override balanceOf;
    mapping (address => mapping (address => uint256)) public override allowance;

    uint256 public override totalSupply;

    string public override name;
    string public override symbol;
    uint8 public override decimals = 18;

    /**
     * @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) 
    {
        name = _name;
        symbol = _symbol;
    }

    /**
     * @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(msg.sender, recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(msg.sender, 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);
        uint256 oldAllowance = allowance[sender][msg.sender];
        if (oldAllowance != uint256(-1)) {
            _approve(sender, msg.sender, oldAllowance.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(msg.sender, spender, allowance[msg.sender][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(msg.sender, spender, allowance[msg.sender][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);

        balanceOf[sender] = balanceOf[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        balanceOf[recipient] = balanceOf[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);
        balanceOf[account] = balanceOf[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);

        balanceOf[account] = balanceOf[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");

        allowance[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 {
        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 4 of 34: ERC31337.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
A wrapped token, where the underlying token can be swept
and used for other purposes
Governed by an installable floor calculator contract
Sweepable by designated sweeper addresses
*/

import "./IERC20.sol";
import "./SafeERC20.sol";
import "./Owned.sol";
import "./IFloorCalculator.sol";
import "./WrappedERC20.sol";
import "./IERC31337.sol";

contract ERC31337 is Owned, WrappedERC20, IERC31337
{
    using SafeERC20 for IERC20;

    IFloorCalculator public override floorCalculator;
    
    mapping (address => bool) public override sweepers;

    constructor(IERC20 _wrappedToken, string memory _name, string memory _symbol)
        WrappedERC20(_wrappedToken, _name, _symbol)
    {
    }

    function setFloorCalculator(IFloorCalculator _floorCalculator) public override ownerOnly()
    {
        floorCalculator = _floorCalculator;
    }

    function setSweeper(address sweeper, bool allow) public override ownerOnly()
    {
        sweepers[sweeper] = allow;
    }

    function sweepFloor(address to) public override returns (uint256 amountSwept)
    {
        require (to != address(0));
        require (sweepers[msg.sender], "Sweepers only");
        amountSwept = floorCalculator.calculateSubFloor(wrappedToken, this);
        if (amountSwept > 0) {
            wrappedToken.safeTransfer(to, amountSwept);
        }
    }
}

File 5 of 34: GatedERC20.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;

/* ROOTKIT:
A standard ERC20 with an extra hook: An installable transfer
gate allowing for token tax and burn on transfer
*/

import "./ERC20.sol";
import "./ITransferGate.sol";
import "./Owned.sol";
import "./SafeMath.sol";
import "./TokensRecoverable.sol";

abstract contract GatedERC20 is ERC20, Owned, TokensRecoverable
{
    using SafeMath for uint256;

    ITransferGate public transferGate;

    constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol)
    {
    }

    function setTransferGate(ITransferGate _transferGate) public ownerOnly()
    {
        transferGate = _transferGate;
    }

    function _transfer(address sender, address recipient, uint256 amount) internal virtual override 
    {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        ITransferGate _transferGate = transferGate;
        uint256 remaining = amount;
        if (address(_transferGate) != address(0)) {
            (uint256 burn, TransferGateTarget[] memory targets) = _transferGate.handleTransfer(msg.sender, sender, recipient, amount);            
            if (burn > 0) {
                amount = remaining = remaining.sub(burn, "Burn too much");
                _burn(sender, burn);
            }
            for (uint256 x = 0; x < targets.length; ++x) {
                (address dest, uint256 amt) = (targets[x].destination, targets[x].amount);
                remaining = remaining.sub(amt, "Transfer too much");
                balanceOf[dest] = balanceOf[dest].add(amt);
            }
        }
        balanceOf[sender] = balanceOf[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        balanceOf[recipient] = balanceOf[recipient].add(remaining);
        emit Transfer(sender, recipient, amount);
    }
}

File 6 of 34: IERC20.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

interface IERC20 
{
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);

    function totalSupply() external view returns (uint256);
    function balanceOf(address _account) external view returns (uint256);
    function transfer(address _recipient, uint256 _amount) external returns (bool);
    function allowance(address _owner, address _spender) external view returns (uint256);
    function approve(address _spender, uint256 _amount) external returns (bool);
    function transferFrom(address _sender, address _recipient, uint256 _amount) external returns (bool);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
}

File 7 of 34: IERC31337.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IWrappedERC20.sol";
import "./IFloorCalculator.sol";

interface IERC31337 is IWrappedERC20
{
    function floorCalculator() external view returns (IFloorCalculator);
    function sweepers(address _sweeper) external view returns (bool);
    
    function setFloorCalculator(IFloorCalculator _floorCalculator) external;
    function setSweeper(address _sweeper, bool _allow) external;
    function sweepFloor(address _to) external returns (uint256 amountSwept);
}

File 8 of 34: IFloorCalculator.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IERC20.sol";

interface IFloorCalculator
{
    function calculateSubFloor(IERC20 wrappedToken, IERC20 backingToken) external view returns (uint256);
}

File 9 of 34: IOwned.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

interface IOwned
{
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    function owner() external view returns (address);

    function transferOwnership(address newOwner) external;
    function claimOwnership() external;
}

File 10 of 34: IRootKitDistribution.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

interface IRootKitDistribution
{
    function distribute() external payable;
    function claim(address _to, uint256 _contribution) external;
}

File 11 of 34: ITokensRecoverable.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IERC20.sol";

interface ITokensRecoverable
{
    function recoverTokens(IERC20 token) external;
}

File 12 of 34: ITransferGate.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;

struct TransferGateTarget
{
    address destination;
    uint256 amount;
}

interface ITransferGate
{
    function handleTransfer(address msgSender, address from, address to, uint256 amount) external
        returns (uint256 burn, TransferGateTarget[] memory targets);
}

File 13 of 34: IUniswapV2Factory.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

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 14 of 34: IUniswapV2Pair.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

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 15 of 34: IUniswapV2Router01.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

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 16 of 34: IUniswapV2Router02.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

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 17 of 34: IWETH.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IERC20.sol";
import "./IWrappedERC20Events.sol";

interface IWETH is IERC20, IWrappedERC20Events
{    
    function deposit() external payable;
    function withdraw(uint256 _amount) external;
}

File 18 of 34: IWrappedERC20.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IERC20.sol";
import "./IWrappedERC20Events.sol";

interface IWrappedERC20 is IERC20, IWrappedERC20Events
{
    function wrappedToken() external view returns (IERC20);
    function depositTokens(uint256 _amount) external;
    function withdrawTokens(uint256 _amount) external;
}

File 19 of 34: IWrappedERC20Events.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

interface IWrappedERC20Events
{
    event Deposit(address indexed from, uint256 amount);
    event Withdrawal(address indexed to, uint256 amount);
}

File 20 of 34: KETH.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
Technically a wrapped WETH
So a wrapped wrapped ethereum
But also accepts raw ETH
Also functions exactly like WETH (deposit/withdraw/direct send)
*/

import "./ERC31337.sol";
import "./IWETH.sol";
import "./SafeMath.sol";

contract KETH is ERC31337, IWETH
{
    using SafeMath for uint256;

    constructor (IWETH _weth)
        ERC31337(_weth, "RootKit [Wrapped ETH]", "RK:ETH")
    {
    }

    receive() external payable
    {
        if (msg.sender != address(wrappedToken)) {
            deposit();
        }
    }

    function deposit() public payable override
    {
        uint256 amount = msg.value;
        IWETH(address(wrappedToken)).deposit{ value: amount }();
        _mint(msg.sender, amount);
        emit Deposit(msg.sender, amount); 
    }

    function withdraw(uint256 _amount) public override
    {
        _burn(msg.sender, _amount);
        IWETH(address(wrappedToken)).withdraw(_amount);
        emit Withdrawal(msg.sender, _amount);
        (bool success,) = msg.sender.call{ value: _amount }("");
        require (success, "Transfer failed");
    }
}

File 21 of 34: Owned.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
Provides ownerOnly() modifier
Allows for ownership transfer but requires the new
owner to claim (accept) ownership
Safer because no accidental transfers or renouncing
*/

import "./IOwned.sol";

abstract contract Owned is IOwned
{
    address public override owner = msg.sender;
    address internal pendingOwner;

    modifier ownerOnly()
    {
        require (msg.sender == owner, "Owner only");
        _;
    }

    function transferOwnership(address newOwner) public override ownerOnly()
    {
        pendingOwner = newOwner;
    }

    function claimOwnership() public override
    {
        require (pendingOwner == msg.sender);
        pendingOwner = address(0);
        emit OwnershipTransferred(owner, msg.sender);
        owner = msg.sender;
    }
}

File 23 of 34: RootKitDistribution.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IRootKitDistribution.sol";
import "./Owned.sol";
import "./RootKit.sol";
import "./RootKitTransferGate.sol";
import "./TokensRecoverable.sol";
import "./SafeMath.sol";
import "./KETH.sol";
import "./IERC20.sol";
import "./IUniswapV2Router02.sol";
import "./IUniswapV2Factory.sol";
import "./IUniswapV2Pair.sol";
import "./IWrappedERC20.sol";

/*
Phases:
    Initializing
        Call setupKethRootKit() and setupWbtcRootKit()
        Call completeSetup()
        
    Call distribute() to:
        Transfer all RootKit to this contract
        Take all ETH + RootKit and create a market
        Play jenga
        Buy RootKit
        Buy wBTC
        Create RootKit/wBTC market
        Buy RootKit for the group
        Distribute funds

    Complete
        Everyone can call claim() to receive their tokens (via the liquidity generation contract)
*/

contract RootKitDistribution is Owned, TokensRecoverable, IRootKitDistribution
{
    using SafeMath for uint256;

    bool public distributionComplete;

    IUniswapV2Router02 immutable uniswapV2Router;
    IUniswapV2Factory immutable uniswapV2Factory;
    RootKit immutable rootKit;
    KETH immutable keth;
    IERC20 immutable weth;
    IERC20 immutable wbtc;
    address immutable vault;

    IUniswapV2Pair kethRootKit;
    IUniswapV2Pair wbtcRootKit;
    IWrappedERC20 wrappedKethRootKit;
    IWrappedERC20 wrappedWbtcRootKit;

    uint256 public totalEthCollected;
    uint256 public totalRootKitBought;
    uint256 public totalWbtcRootKit;
    uint256 public totalKethRootKit;
    address rootKitLiquidityGeneration;
    uint256 recoveryDate = block.timestamp + 2592000; // 1 Month

    uint8 public jengaCount;
    
    // 10000 = 100%
    uint16 constant public vaultPercent = 2500; // Proportionate amount used to seed the vault
    uint16 constant public buyPercent = 2500; // Proportionate amount used to group buy RootKit for distribution to participants
    uint16 constant public wbtcPercent = 2500; // Proportionate amount used to create wBTC/RootKit pool

    constructor(RootKit _rootKit, IUniswapV2Router02 _uniswapV2Router, KETH _keth, IERC20 _wbtc, address _vault)
    {
        require (address(_rootKit) != address(0));
        require (address(_wbtc) != address(0));
        require (address(_vault) != address(0));

        rootKit = _rootKit;
        uniswapV2Router = _uniswapV2Router;
        keth = _keth;
        wbtc = _wbtc;
        vault = _vault;

        uniswapV2Factory = IUniswapV2Factory(_uniswapV2Router.factory());
        weth = _keth.wrappedToken();
    }

    function setupKethRootKit() public
    {
        kethRootKit = IUniswapV2Pair(uniswapV2Factory.getPair(address(keth), address(rootKit)));
        if (address(kethRootKit) == address(0)) {
            kethRootKit = IUniswapV2Pair(uniswapV2Factory.createPair(address(keth), address(rootKit)));
            require (address(kethRootKit) != address(0));
        }
    }
    function setupWbtcRootKit() public
    {
        wbtcRootKit = IUniswapV2Pair(uniswapV2Factory.getPair(address(wbtc), address(rootKit)));
        if (address(wbtcRootKit) == address(0)) {
            wbtcRootKit = IUniswapV2Pair(uniswapV2Factory.createPair(address(wbtc), address(rootKit)));
            require (address(wbtcRootKit) != address(0));
        }
    }
    function completeSetup(IWrappedERC20 _wrappedKethRootKit, IWrappedERC20 _wrappedWbtcRootKit) public ownerOnly()
    {        
        require (address(_wrappedKethRootKit.wrappedToken()) == address(kethRootKit), "Wrong LP Wrapper");
        require (address(_wrappedWbtcRootKit.wrappedToken()) == address(wbtcRootKit), "Wrong LP Wrapper");
        wrappedKethRootKit = _wrappedKethRootKit;
        wrappedWbtcRootKit = _wrappedWbtcRootKit;
        keth.approve(address(uniswapV2Router), uint256(-1));
        rootKit.approve(address(uniswapV2Router), uint256(-1));
        weth.approve(address(keth), uint256(-1));
        weth.approve(address(uniswapV2Router), uint256(-1));
        wbtc.approve(address(uniswapV2Router), uint256(-1));
        kethRootKit.approve(address(wrappedKethRootKit), uint256(-1));
        wbtcRootKit.approve(address(wrappedWbtcRootKit), uint256(-1));
    }

    function setJengaCount(uint8 _jengaCount) public ownerOnly()
    {
        jengaCount = _jengaCount;
    }

    function distribute() public override payable
    {
        require (!distributionComplete, "Distribution complete");
        uint256 totalEth = msg.value;
        require (totalEth > 0, "Nothing to distribute");
        distributionComplete = true;
        totalEthCollected = totalEth;
        rootKitLiquidityGeneration = msg.sender;

        rootKit.transferFrom(msg.sender, address(this), rootKit.totalSupply());
        
        RootKitTransferGate gate = RootKitTransferGate(address(rootKit.transferGate()));
        gate.setUnrestricted(true);

        createKethRootKitLiquidity(totalEth);

        jenga(jengaCount);

        sweepFloorToWeth();
        uint256 wethBalance = weth.balanceOf(address(this));

        createWbtcRootKitLiquidity(wethBalance * wbtcPercent / 10000);
        preBuyForGroup(wethBalance * buyPercent / 10000);

        sweepFloorToWeth();
        weth.transfer(vault, wethBalance * vaultPercent / 10000);
        weth.transfer(owner, weth.balanceOf(address(this)));
        kethRootKit.transfer(owner, kethRootKit.balanceOf(address(this)));

        gate.setUnrestricted(false);
    }

    function sweepFloorToWeth() private
    {
        keth.sweepFloor(address(this));
        keth.withdrawTokens(keth.balanceOf(address(this)));
    }
    function createKethRootKitLiquidity(uint256 totalEth) private
    {
        // Create KETH/ROOT LP 
        keth.deposit{ value: totalEth }();
        (,,totalKethRootKit) = uniswapV2Router.addLiquidity(address(keth), address(rootKit), keth.balanceOf(address(this)), rootKit.totalSupply(), 0, 0, address(this), block.timestamp);
        
        // Wrap the KETH/ROOT LP for distribution
        wrappedKethRootKit.depositTokens(totalKethRootKit);  
    }
    function createWbtcRootKitLiquidity(uint256 wethAmount) private
    {
        // Buy ROOT with 1/2 of the funds
        address[] memory path = new address[](2);
        path[0] = address(keth);
        path[1] = address(rootKit);
        keth.depositTokens(wethAmount / 2);
        uint256[] memory amountsRootKit = uniswapV2Router.swapExactTokensForTokens(wethAmount / 2, 0, path, address(this), block.timestamp);

        // Buy WBTC with the other 1/2 of the funds
        path[0] = address(weth);
        path[1] = address(wbtc);
        uint256[] memory amountsWbtc = uniswapV2Router.swapExactTokensForTokens(wethAmount / 2, 0, path, address(this), block.timestamp);
        (,,totalWbtcRootKit) = uniswapV2Router.addLiquidity(address(wbtc), address(rootKit), amountsWbtc[1], amountsRootKit[1], 0, 0, address(this), block.timestamp);

        // Wrap the WBTC/ROOT LP for distribution        
        wrappedWbtcRootKit.depositTokens(totalWbtcRootKit);
    }
    function preBuyForGroup(uint256 wethAmount) private
    {      
        address[] memory path = new address[](2);
        path[0] = address(keth);
        path[1] = address(rootKit);
        keth.depositTokens(wethAmount);
        uint256[] memory amountsRootKit = uniswapV2Router.swapExactTokensForTokens(wethAmount, 0, path, address(this), block.timestamp);
        totalRootKitBought = amountsRootKit[1];
    }
    
    function jenga(uint8 count) private
    {
        address[] memory path = new address[](2);
        path[0] = address(keth);
        path[1] = address(rootKit);
        for (uint x=0; x<count; ++x) {
            keth.depositTokens(keth.sweepFloor(address(this)));
            uint256[] memory amounts = uniswapV2Router.swapExactTokensForTokens(keth.balanceOf(address(this)) * 2 / 5, 0, path, address(this), block.timestamp);
            keth.depositTokens(keth.sweepFloor(address(this)));
            uniswapV2Router.addLiquidity(address(keth), address(rootKit), keth.balanceOf(address(this)), amounts[1], 0, 0, address(this), block.timestamp);
        }
    }

    function claim(address _to, uint256 _contribution) public override
    {
        require (msg.sender == rootKitLiquidityGeneration, "Unauthorized");
        uint256 totalEth = totalEthCollected;

        // Send KETH/ROOT liquidity tokens
        uint256 share = _contribution.mul(totalKethRootKit) / totalEth;        
        if (share > wrappedKethRootKit.balanceOf(address(this))) {
            share = wrappedKethRootKit.balanceOf(address(this)); // Should never happen, but just being safe.
        }
        wrappedKethRootKit.transfer(_to, share);

        // Send WBTC/ROOT liquidity tokens
        share = _contribution.mul(totalWbtcRootKit) / totalEth;        
        if (share > wrappedWbtcRootKit.balanceOf(address(this))) {
            share = wrappedWbtcRootKit.balanceOf(address(this)); // Should never happen, but just being safe.
        }
        wrappedWbtcRootKit.transfer(_to, share);

        // Send RootKit
        RootKitTransferGate gate = RootKitTransferGate(address(rootKit.transferGate()));
        gate.setUnrestricted(true);

        share = _contribution.mul(totalRootKitBought) / totalEth;
        if (share > rootKit.balanceOf(address(this))) {
            share = rootKit.balanceOf(address(this)); // Should never happen, but just being safe.
        }
        rootKit.transfer(_to, share);

        gate.setUnrestricted(false);
    }

    function canRecoverTokens(IERC20 token) internal override view returns (bool) { 
        return 
            block.timestamp > recoveryDate ||
            (
                token != rootKit && 
                address(token) != address(wrappedKethRootKit) && 
                address(token) != address(wrappedWbtcRootKit)
            );
    }
}

File 24 of 34: RootKitFloorCalculator.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
A floor calculator (to use with ERC31337) for RootKit uniswap pairs
Ensures 100% of accessible funds are backed at all times
*/

import "./IFloorCalculator.sol";
import "./RootKit.sol";
import "./SafeMath.sol";
import "./UniswapV2Library.sol";
import "./IUniswapV2Factory.sol";
import "./TokensRecoverable.sol";

contract RootKitFloorCalculator is IFloorCalculator, TokensRecoverable
{
    using SafeMath for uint256;

    RootKit immutable rootKit;
    IUniswapV2Factory immutable uniswapV2Factory;

    constructor(RootKit _rootKit, IUniswapV2Factory _uniswapV2Factory)
    {
        rootKit = _rootKit;
        uniswapV2Factory = _uniswapV2Factory;
    }

    function calculateSubFloor(IERC20 wrappedToken, IERC20 backingToken) public override view returns (uint256)
    {
        address pair = UniswapV2Library.pairFor(address(uniswapV2Factory), address(rootKit), address(backingToken));
        uint256 freeRootKit = rootKit.totalSupply().sub(rootKit.balanceOf(pair));
        uint256 sellAllProceeds = 0;
        if (freeRootKit > 0) {
            address[] memory path = new address[](2);
            path[0] = address(rootKit);
            path[1] = address(backingToken);
            uint256[] memory amountsOut = UniswapV2Library.getAmountsOut(address(uniswapV2Factory), freeRootKit, path);
            sellAllProceeds = amountsOut[1];
        }
        uint256 backingInPool = backingToken.balanceOf(pair);
        if (backingInPool <= sellAllProceeds) { return 0; }
        uint256 excessInPool = backingInPool - sellAllProceeds;

        uint256 requiredBacking = backingToken.totalSupply().sub(excessInPool);
        uint256 currentBacking = wrappedToken.balanceOf(address(backingToken));
        if (requiredBacking >= currentBacking) { return 0; }
        return currentBacking - requiredBacking;
    }
}

File 25 of 34: RootKitLiquidity.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
A wrapper for liquidity tokens so they can be distributed
but not allowing for removal of liquidity
*/

import "./ERC31337.sol";
import "./IUniswapV2Pair.sol";
import "./IERC20.sol";

contract RootKitLiquidity is ERC31337
{
    constructor(IUniswapV2Pair _pair, string memory _name, string memory _symbol)
        ERC31337(
            IERC20(address(_pair)), 
            _name,
            _symbol)
    {
    }

    function _beforeWithdrawTokens(uint256) internal override pure
    { 
        revert("RootKit liquidity is locked");
    }
}

File 26 of 34: RootKitLiquidityGeneration.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./Owned.sol";
import "./RootKit.sol";
import "./IRootKitDistribution.sol";
import "./TokensRecoverable.sol";

contract RootKitLiquidityGeneration is Owned, TokensRecoverable
{
    mapping (address => uint256) public contribution;
    address[] public contributors;

    bool public isActive;

    RootKit immutable rootKit;
    IRootKitDistribution public rootKitDistribution;
    uint256 refundsAllowedUntil;

    constructor (RootKit _rootKit)
    {
        rootKit = _rootKit;
    }

    modifier active()
    {
        require (isActive, "Distribution not active");
        _;
    }

    function contributorsCount() public view returns (uint256) { return contributors.length; }

    function activate(IRootKitDistribution _rootKitDistribution) public ownerOnly()
    {
        require (!isActive && contributors.length == 0 && block.timestamp >= refundsAllowedUntil, "Already activated");        
        require (rootKit.balanceOf(address(this)) == rootKit.totalSupply(), "Missing supply");
        require (address(_rootKitDistribution) != address(0));
        rootKitDistribution = _rootKitDistribution;
        isActive = true;
    }

    function setRootKitDistribution(IRootKitDistribution _rootKitDistribution) public ownerOnly() active()
    {
        require (address(_rootKitDistribution) != address(0));
        if (_rootKitDistribution == rootKitDistribution) { return; }
        rootKitDistribution = _rootKitDistribution;

        // Give everyone 1 day to claim refunds if they don't approve of the new distributor
        refundsAllowedUntil = block.timestamp + 86400;
    }

    function complete() public ownerOnly() active()
    {
        require (block.timestamp >= refundsAllowedUntil, "Refund period is still active");
        isActive = false;
        if (address(this).balance == 0) { return; }
        rootKit.approve(address(rootKitDistribution), uint256(-1));
        rootKitDistribution.distribute{ value: address(this).balance }();
    }

    function allowRefunds() public ownerOnly() active()
    {
        isActive = false;
        refundsAllowedUntil = uint256(-1);
    }

    function claim() public
    {
        uint256 amount = contribution[msg.sender];
        require (amount > 0, "Nothing to claim");
        contribution[msg.sender] = 0;
        if (refundsAllowedUntil > block.timestamp) {
            (bool success,) = msg.sender.call{ value: amount }("");
            require (success, "Transfer failed");
        }
        else {
            rootKitDistribution.claim(msg.sender, amount);
        }
    }

    receive() external payable active()
    {
        uint256 oldContribution = contribution[msg.sender];
        uint256 newContribution = oldContribution + msg.value;
        if (oldContribution == 0 && newContribution > 0) {
            contributors.push(msg.sender);
        }
        contribution[msg.sender] = newContribution;
    }
}

File 27 of 34: RootKitTransferGate.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;

/* ROOTKIT:
A transfer gate (GatedERC20) for use with RootKit tokens

It:
    Allows customization of tax and burn rates
    Allows transfer to/from approved Uniswap pools
    Disallows transfer to/from non-approved Uniswap pools
    (doesn't interfere with other crappy AMMs)
    Allows transfer to/from anywhere else
    Allows for free transfers if permission granted
    Allows for unrestricted transfers if permission granted
    Provides a safe and tax-free liquidity adding function
*/

import "./ITransferGate.sol";
import "./Owned.sol";
import "./IUniswapV2Factory.sol";
import "./IERC20.sol";
import "./IUniswapV2Pair.sol";
import "./RootKit.sol";
import "./Address.sol";
import "./IUniswapV2Router02.sol";
import "./SafeERC20.sol";
import "./SafeMath.sol";
import "./TokensRecoverable.sol";

struct RootKitTransferGateParameters
{
    address dev;
    uint16 stakeRate; // 10000 = 100%
    uint16 burnRate; // 10000 = 100%
    uint16 devRate;  // 10000 = 100%
    address stake;
}

contract RootKitTransferGate is Owned, TokensRecoverable, ITransferGate
{   
    using Address for address;
    using SafeERC20 for IERC20;
    using SafeMath for uint256;

    RootKitTransferGateParameters public parameters;
    IUniswapV2Router02 immutable uniswapV2Router;
    IUniswapV2Factory immutable uniswapV2Factory;
    RootKit immutable rootKit;

    enum AddressState
    {
        Unknown,
        NotPool,
        DisallowedPool,
        AllowedPool
    }

    mapping (address => AddressState) public addressStates;
    IERC20[] public allowedPoolTokens;
    
    bool public unrestricted;
    mapping (address => bool) public unrestrictedControllers;
    mapping (address => bool) public freeParticipant;

    mapping (address => uint256) public liquiditySupply;
    address public mustUpdate;    

    constructor(RootKit _rootKit, IUniswapV2Router02 _uniswapV2Router)
    {
        rootKit = _rootKit;
        uniswapV2Router = _uniswapV2Router;
        uniswapV2Factory = IUniswapV2Factory(_uniswapV2Router.factory());
    }

    function allowedPoolTokensCount() public view returns (uint256) { return allowedPoolTokens.length; }

    function setUnrestrictedController(address unrestrictedController, bool allow) public ownerOnly()
    {
        unrestrictedControllers[unrestrictedController] = allow;
    }

    function setFreeParticipant(address participant, bool free) public ownerOnly()
    {
        freeParticipant[participant] = free;
    }

    function setUnrestricted(bool _unrestricted) public
    {
        require (unrestrictedControllers[msg.sender], "Not an unrestricted controller");
        unrestricted = _unrestricted;
    }

    function setParameters(address _dev, address _stake, uint16 _stakeRate, uint16 _burnRate, uint16 _devRate) public ownerOnly()
    {
        require (_stakeRate <= 10000 && _burnRate <= 10000 && _devRate <= 10000 && _stakeRate + _burnRate + _devRate <= 10000, "> 100%");
        require (_dev != address(0) && _stake != address(0));
        
        RootKitTransferGateParameters memory _parameters;
        _parameters.dev = _dev;
        _parameters.stakeRate = _stakeRate;
        _parameters.burnRate = _burnRate;
        _parameters.devRate = _devRate;
        _parameters.stake = _stake;
        parameters = _parameters;
    }

    function allowPool(IERC20 token) public ownerOnly()
    {
        address pool = uniswapV2Factory.getPair(address(rootKit), address(token));
        if (pool == address(0)) {
            pool = uniswapV2Factory.createPair(address(rootKit), address(token));
        }
        AddressState state = addressStates[pool];
        require (state != AddressState.AllowedPool, "Already allowed");
        addressStates[pool] = AddressState.AllowedPool;
        allowedPoolTokens.push(token);
        liquiditySupply[pool] = IERC20(pool).totalSupply();
    }

    function safeAddLiquidity(IERC20 token, uint256 tokenAmount, uint256 rootKitAmount, uint256 minTokenAmount, uint256 minRootKitAmount, address to, uint256 deadline) public
        returns (uint256 rootKitUsed, uint256 tokenUsed, uint256 liquidity)
    {
        address pool = uniswapV2Factory.getPair(address(rootKit), address(token));
        require (pool != address(0) && addressStates[pool] == AddressState.AllowedPool, "Pool not approved");
        unrestricted = true;

        uint256 tokenBalance = token.balanceOf(address(this));
        token.safeTransferFrom(msg.sender, address(this), tokenAmount);
        rootKit.transferFrom(msg.sender, address(this), rootKitAmount);
        rootKit.approve(address(uniswapV2Router), rootKitAmount);
        token.safeApprove(address(uniswapV2Router), tokenAmount);
        (rootKitUsed, tokenUsed, liquidity) = uniswapV2Router.addLiquidity(address(rootKit), address(token), rootKitAmount, tokenAmount, minRootKitAmount, minTokenAmount, to, deadline);
        liquiditySupply[pool] = IERC20(pool).totalSupply();
        if (mustUpdate == pool) {
            mustUpdate = address(0);
        }

        if (rootKitUsed < rootKitAmount) {
            rootKit.transfer(msg.sender, rootKitAmount - rootKitUsed);
        }
        tokenBalance = token.balanceOf(address(this)).sub(tokenBalance); // we do it this way in case there's a burn
        if (tokenBalance > 0) {
            token.safeTransfer(msg.sender, tokenBalance);
        }
        
        unrestricted = false;
    }

    function handleTransfer(address, address from, address to, uint256 amount) external override
        returns (uint256 burn, TransferGateTarget[] memory targets)
    {
        address mustUpdateAddress = mustUpdate;
        if (mustUpdateAddress != address(0)) {
            mustUpdate = address(0);
            liquiditySupply[mustUpdateAddress] = IERC20(mustUpdateAddress).totalSupply();
        }
        AddressState fromState = addressStates[from];
        AddressState toState = addressStates[to];
        if (fromState != AddressState.AllowedPool && toState != AddressState.AllowedPool) {
            if (fromState == AddressState.Unknown) { fromState = detectState(from); }
            if (toState == AddressState.Unknown) { toState = detectState(to); }
            require (unrestricted || (fromState != AddressState.DisallowedPool && toState != AddressState.DisallowedPool), "Pool not approved");
        }
        if (toState == AddressState.AllowedPool) {
            mustUpdate = to;
        }
        if (fromState == AddressState.AllowedPool) {
            if (unrestricted) {
                liquiditySupply[from] = IERC20(from).totalSupply();
            }
            require (IERC20(from).totalSupply() >= liquiditySupply[from], "Cannot remove liquidity");            
        }
        if (unrestricted || freeParticipant[from] || freeParticipant[to]) {
            return (0, new TransferGateTarget[](0));
        }
        RootKitTransferGateParameters memory params = parameters;
        // "amount" will never be > totalSupply which is capped at 10k, so these multiplications will never overflow
        burn = amount * params.burnRate / 10000;
        targets = new TransferGateTarget[]((params.devRate > 0 ? 1 : 0) + (params.stakeRate > 0 ? 1 : 0));
        uint256 index = 0;
        if (params.stakeRate > 0) {
            targets[index].destination = params.stake;
            targets[index++].amount = amount * params.stakeRate / 10000;
        }
        if (params.devRate > 0) {
            targets[index].destination = params.dev;
            targets[index].amount = amount * params.devRate / 10000;
        }
    }

    function setAddressState(address a, AddressState state) public ownerOnly()
    {
        addressStates[a] = state;
    }

    function detectState(address a) public returns (AddressState state) 
    {
        state = AddressState.NotPool;
        if (a.isContract()) {
            try this.throwAddressState(a)
            {
                assert(false);
            }
            catch Error(string memory result) {
                // if (bytes(result).length == 1) {
                //     state = AddressState.NotPool;
                // }
                if (bytes(result).length == 2) {
                    state = AddressState.DisallowedPool;
                }
            }
            catch {
            }
        }
        addressStates[a] = state;
        return state;
    }
    
    // Not intended for external consumption
    // Always throws
    // We want to call functions to probe for things, but don't want to open ourselves up to
    // possible state-changes
    // So we return a value by reverting with a message
    function throwAddressState(address a) external view
    {
        try IUniswapV2Pair(a).factory() returns (address factory)
        {
            // don't care if it's some crappy alt-amm
            if (factory == address(uniswapV2Factory)) {
                // these checks for token0/token1 are just for additional
                // certainty that we're interacting with a uniswap pair
                try IUniswapV2Pair(a).token0() returns (address token0)
                {
                    if (token0 == address(rootKit)) {
                        revert("22");
                    }
                    try IUniswapV2Pair(a).token1() returns (address token1)
                    {
                        if (token1 == address(rootKit)) {
                            revert("22");
                        }                        
                    }
                    catch { 
                    }                    
                }
                catch { 
                }
            }
        }
        catch {             
        }
        revert("1");
    }
}

File 28 of 34: RootKitVault.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./Owned.sol";
import "./SafeERC20.sol";
import "./IERC20.sol";

contract RootKitVault is Owned
{
    using SafeERC20 for IERC20;
    
    receive() external payable { }

    function sendEther(address payable _to, uint256 _amount) public ownerOnly()
    {
        (bool success,) = _to.call{ value: _amount }("");
        require (success, "Transfer failed");
    }

    function sendToken(IERC20 _token, address _to, uint256 _amount) public ownerOnly()
    {
        _token.safeTransfer(_to, _amount);
    }
}

File 29 of 34: SafeERC20.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
Modified to remove some junk
Also modified to remove silly restrictions (traps!) within safeApprove
*/

import "./IERC20.sol";
import "./SafeMath.sol";
import "./Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {        
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 30 of 34: SafeMath.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
O wherefore art thou 8 point O
*/

library SafeMath 
{
    function add(uint256 a, uint256 b) internal pure returns (uint256) 
    {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) 
    {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) 
    {
        require(b <= a, errorMessage);
        uint256 c = a - b;
        return c;
    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) 
    {
        // 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 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }
    
    function div(uint256 a, uint256 b) internal pure returns (uint256) 
    {
        return div(a, b, "SafeMath: division by zero");
    }

    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) 
    {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        return c;
    }

    function mod(uint256 a, uint256 b) internal pure returns (uint256) 
    {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) 
    {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 31 of 34: TokensRecoverable.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
Allows recovery of unexpected tokens (airdrops, etc)
Inheriters can customize logic by overriding canRecoverTokens
*/

import "./IERC20.sol";
import "./SafeERC20.sol";
import "./Owned.sol";
import "./ITokensRecoverable.sol";

abstract contract TokensRecoverable is Owned, ITokensRecoverable
{
    using SafeERC20 for IERC20;

    function recoverTokens(IERC20 token) public override ownerOnly() 
    {
        require (canRecoverTokens(token));
        token.safeTransfer(msg.sender, token.balanceOf(address(this)));
    }

    function canRecoverTokens(IERC20 token) internal virtual view returns (bool) 
    { 
        return address(token) != address(this); 
    }
}

File 32 of 34: UniswapV2Library.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IUniswapV2Pair.sol";
import "./SafeMath.sol";

library UniswapV2Library {
    using SafeMath 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'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // 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 33 of 34: WETH9.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

import "./IWETH.sol";

contract WETH9 is IWETH
{
    string public override name     = "Wrapped Ether";
    string public override symbol   = "WETH";
    uint8  public override decimals = 18;

    mapping (address => uint)                       public override balanceOf;
    mapping (address => mapping (address => uint))  public override allowance;

    receive() external payable {
        deposit();
    }
    function deposit() public payable override {
        balanceOf[msg.sender] += msg.value;
        emit Deposit(msg.sender, msg.value);
    }
    function withdraw(uint wad) public override {
        require(balanceOf[msg.sender] >= wad, "weth a: not enough balance");
        balanceOf[msg.sender] -= wad;
        msg.sender.transfer(wad);
        emit Withdrawal(msg.sender, wad);
    }

    function totalSupply() public override view returns (uint) {
        return address(this).balance;
    }

    function approve(address guy, uint wad) public override returns (bool) {
        allowance[msg.sender][guy] = wad;
        emit Approval(msg.sender, guy, wad);
        return true;
    }

    function transfer(address dst, uint wad) public override returns (bool) {
        return transferFrom(msg.sender, dst, wad);
    }

    function transferFrom(address src, address dst, uint wad)
        public
        override
        returns (bool)
    {
        require(balanceOf[src] >= wad, "weth b: not enough balance");

        if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
            require(allowance[src][msg.sender] >= wad, "weth c: not enough allowance");
            allowance[src][msg.sender] -= wad;
        }

        balanceOf[src] -= wad;
        balanceOf[dst] += wad;

        emit Transfer(src, dst, wad);

        return true;
    }
}

File 34 of 34: WrappedERC20.sol
// SPDX-License-Identifier: J-J-J-JENGA!!!
pragma solidity ^0.7.4;

/* ROOTKIT:
Wraps any ERC20
Similar to WETH except for ERC20 tokens instead of ETH
depositTokens/withdrawTokens are like deposit/withdraw in WETH
Inheriters can hook into depositTokens and withdrawTokens
by overriding _beforeDepositTokens and _beforeWithdrawTokens
*/

import "./IERC20.sol";
import "./ERC20.sol";
import "./IWrappedERC20.sol";
import "./TokensRecoverable.sol";
import "./SafeERC20.sol";
import "./SafeMath.sol";

contract WrappedERC20 is ERC20, IWrappedERC20, TokensRecoverable
{
    using SafeERC20 for IERC20;
    using SafeMath for uint256;

    IERC20 public immutable override wrappedToken;

    constructor (IERC20 _wrappedToken, string memory _name, string memory _symbol)
        ERC20(_name, _symbol)
    {        
        if (_wrappedToken.decimals() != 18) {
            _setupDecimals(_wrappedToken.decimals());
        }
        wrappedToken = _wrappedToken;
    }

    function depositTokens(uint256 _amount) public override
    {
        _beforeDepositTokens(_amount);
        uint256 myBalance = wrappedToken.balanceOf(address(this));
        wrappedToken.safeTransferFrom(msg.sender, address(this), _amount);
        uint256 received = wrappedToken.balanceOf(address(this)).sub(myBalance);
        _mint(msg.sender, received);
        emit Deposit(msg.sender, _amount);
    }

    function withdrawTokens(uint256 _amount) public override
    {
        _beforeWithdrawTokens(_amount);
        _burn(msg.sender, _amount);
        uint256 myBalance = wrappedToken.balanceOf(address(this));
        wrappedToken.safeTransfer(msg.sender, _amount);
        require (wrappedToken.balanceOf(address(this)) == myBalance.sub(_amount), "Transfer not exact");
        emit Withdrawal(msg.sender, _amount);
    }

    function canRecoverTokens(IERC20 token) internal virtual override view returns (bool) 
    {
        return token != this && token != wrappedToken;
    }

    function _beforeDepositTokens(uint256 _amount) internal virtual view { }
    function _beforeWithdrawTokens(uint256 _amount) internal virtual view { }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"recoverTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITransferGate","name":"_transferGate","type":"address"}],"name":"setTransferGate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferGate","outputs":[{"internalType":"contract ITransferGate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405260058054601260ff1990911617610100600160a81b03191661010033021790553480156200003157600080fd5b506040805180820182526007815266149bdbdd12da5d60ca1b6020808301918252835180850190945260048452631493d3d560e21b90840152815191929183918391620000819160039162000234565b5080516200009790600490602084019062000234565b5050505050620000b83369021e19e0c9bab2400000620000be60201b60201c565b620002e0565b6001600160a01b0382166200011a576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6200012860008383620001cd565b6200014481600254620001d260201b620008821790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200017791839062000882620001d2821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b6000828201838110156200022d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200026c5760008555620002b7565b82601f106200028757805160ff1916838001178555620002b7565b82800160010185558215620002b7579182015b82811115620002b75782518255916020019190600101906200029a565b50620002c5929150620002c9565b5090565b5b80821115620002c55760008155600101620002ca565b6114f580620002f06000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c806361d8c817116100a2578063a457c2d711610071578063a457c2d71461030f578063a9059cbb1461033b578063b497534314610367578063dd62ed3e1461036f578063f2fde38b1461039d5761010b565b806361d8c8171461029757806370a08231146102bd5780638da5cb5b146102e357806395d89b41146103075761010b565b806323b872dd116100de57806323b872dd1461020f578063313ce5671461024557806339509351146102635780634e71e0c81461028f5761010b565b806306fdde0314610110578063095ea7b31461018d57806316114acd146101cd57806318160ddd146101f5575b600080fd5b6101186103c3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015257818101518382015260200161013a565b50505050905090810190601f16801561017f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b9600480360360408110156101a357600080fd5b506001600160a01b038135169060200135610451565b604080519115158252519081900360200190f35b6101f3600480360360208110156101e357600080fd5b50356001600160a01b0316610467565b005b6101fd61055b565b60408051918252519081900360200190f35b6101b96004803603606081101561022557600080fd5b506001600160a01b03813581169160208101359091169060400135610561565b61024d6105d7565b6040805160ff9092168252519081900360200190f35b6101b96004803603604081101561027957600080fd5b506001600160a01b0381351690602001356105e0565b6101f3610616565b6101f3600480360360208110156102ad57600080fd5b50356001600160a01b0316610693565b6101fd600480360360208110156102d357600080fd5b50356001600160a01b0316610706565b6102eb610718565b604080516001600160a01b039092168252519081900360200190f35b61011861072c565b6101b96004803603604081101561032557600080fd5b506001600160a01b038135169060200135610787565b6101b96004803603604081101561035157600080fd5b506001600160a01b0381351690602001356107d6565b6102eb6107e3565b6101fd6004803603604081101561038557600080fd5b506001600160a01b03813581169160200135166107f2565b6101f3600480360360208110156103b357600080fd5b50356001600160a01b031661080f565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104495780601f1061041e57610100808354040283529160200191610449565b820191906000526020600020905b81548152906001019060200180831161042c57829003601f168201915b505050505081565b600061045e3384846108dc565b50600192915050565b60055461010090046001600160a01b031633146104b8576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b6104c1816109c8565b6104ca57600080fd5b61055833826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561051b57600080fd5b505afa15801561052f573d6000803e3d6000fd5b505050506040513d602081101561054557600080fd5b50516001600160a01b03841691906109da565b50565b60025481565b600061056e848484610a31565b6001600160a01b038416600090815260016020908152604080832033845290915290205460001981146105ca576105ca85336105c58660405180606001604052806028815260200161140460289139869190610d19565b6108dc565b60019150505b9392505050565b60055460ff1681565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161045e9185906105c59086610882565b6006546001600160a01b0316331461062d57600080fd5b600680546001600160a01b0319169055600554604051339161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360058054610100600160a81b0319163361010002179055565b60055461010090046001600160a01b031633146106e4576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60006020819052908152604090205481565b60055461010090046001600160a01b031681565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104495780601f1061041e57610100808354040283529160200191610449565b600061045e33846105c58560405180606001604052806025815260200161149b602591393360009081526001602090815260408083206001600160a01b038d1684529091529020549190610d19565b600061045e338484610a31565b6007546001600160a01b031681565b600160209081526000928352604080842090915290825290205481565b60055461010090046001600160a01b03163314610860576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000828201838110156105d0576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0383166109215760405162461bcd60e51b815260040180806020018281038252602481526020018061144d6024913960400191505060405180910390fd5b6001600160a01b0382166109665760405162461bcd60e51b81526004018080602001828103825260228152602001806113966022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038116301415919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a2c908490610db0565b505050565b6001600160a01b038316610a605760405162461bcd60e51b8152600401610a5790611301565b60405180910390fd5b6001600160a01b038216610a865760405162461bcd60e51b8152600401610a57906112be565b610a91838383610a2c565b6007546001600160a01b0316818115610c4c5760006060836001600160a01b03166395c47d06338989896040518563ffffffff1660e01b8152600401610ada9493929190611294565b600060405180830381600087803b158015610af457600080fd5b505af1158015610b08573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3091908101906111de565b90925090508115610b7b5760408051808201909152600d81526c084eae4dc40e8dede40daeac6d609b1b6020820152610b6c9084908490610d19565b9250829450610b7b8783610e61565b60005b8151811015610c4857600080838381518110610b9657fe5b602002602001015160000151848481518110610bae57fe5b60200260200101516020015191509150610bfc81604051806040016040528060118152602001700a8e4c2dce6cccae440e8dede40daeac6d607b1b81525088610d199092919063ffffffff16565b6001600160a01b038316600090815260208190526040902054909650610c229082610882565b6001600160a01b0390921660009081526020819052604090209190915550600101610b7e565b5050505b610c89836040518060600160405280602681526020016113b8602691396001600160a01b0388166000908152602081905260409020549190610d19565b6001600160a01b038087166000908152602081905260408082209390935590861681522054610cb89082610882565b6001600160a01b0380861660008181526020819052604090819020939093559151908716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d0a908790611346565b60405180910390a35050505050565b60008184841115610da85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d6d578181015183820152602001610d55565b50505050905090810190601f168015610d9a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6060610e05826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610f5d9092919063ffffffff16565b805190915015610a2c57808060200190516020811015610e2457600080fd5b5051610a2c5760405162461bcd60e51b815260040180806020018281038252602a815260200180611471602a913960400191505060405180910390fd5b6001600160a01b038216610ea65760405162461bcd60e51b815260040180806020018281038252602181526020018061142c6021913960400191505060405180910390fd5b610eb282600083610a2c565b610eef81604051806060016040528060228152602001611374602291396001600160a01b0385166000908152602081905260409020549190610d19565b6001600160a01b038316600090815260208190526040902055600254610f159082610f74565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6060610f6c8484600085610fb6565b949350505050565b60006105d083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d19565b606082471015610ff75760405162461bcd60e51b81526004018080602001828103825260268152602001806113de6026913960400191505060405180910390fd5b61100085611112565b611051576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106110905780518252601f199092019160209182019101611071565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146110f2576040519150601f19603f3d011682016040523d82523d6000602084013e6110f7565b606091505b5091509150611107828286611118565b979650505050505050565b3b151590565b606083156111275750816105d0565b8251156111375782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315610d6d578181015183820152602001610d55565b60006040828403121561118f578081fd5b6040516040810181811067ffffffffffffffff821117156111ac57fe5b604052825190915081906001600160a01b03811681146111cb57600080fd5b8152602092830151920191909152919050565b60008060408084860312156111f1578283fd5b8351925060208085015167ffffffffffffffff80821115611210578485fd5b818701915087601f830112611223578485fd5b81518181111561122f57fe5b61123c848583020161134f565b8181528481019250838501868302850186018b1015611259578788fd5b8794505b828510156112835761126f8b8261117e565b84526001949094019392850192860161125d565b508096505050505050509250929050565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561136b57fe5b60405291905056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e0677cab89c65d698c253e1c48f8b36aa1edb6dd79be84632ac841ad15b851f264736f6c63430007040033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806361d8c817116100a2578063a457c2d711610071578063a457c2d71461030f578063a9059cbb1461033b578063b497534314610367578063dd62ed3e1461036f578063f2fde38b1461039d5761010b565b806361d8c8171461029757806370a08231146102bd5780638da5cb5b146102e357806395d89b41146103075761010b565b806323b872dd116100de57806323b872dd1461020f578063313ce5671461024557806339509351146102635780634e71e0c81461028f5761010b565b806306fdde0314610110578063095ea7b31461018d57806316114acd146101cd57806318160ddd146101f5575b600080fd5b6101186103c3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015257818101518382015260200161013a565b50505050905090810190601f16801561017f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b9600480360360408110156101a357600080fd5b506001600160a01b038135169060200135610451565b604080519115158252519081900360200190f35b6101f3600480360360208110156101e357600080fd5b50356001600160a01b0316610467565b005b6101fd61055b565b60408051918252519081900360200190f35b6101b96004803603606081101561022557600080fd5b506001600160a01b03813581169160208101359091169060400135610561565b61024d6105d7565b6040805160ff9092168252519081900360200190f35b6101b96004803603604081101561027957600080fd5b506001600160a01b0381351690602001356105e0565b6101f3610616565b6101f3600480360360208110156102ad57600080fd5b50356001600160a01b0316610693565b6101fd600480360360208110156102d357600080fd5b50356001600160a01b0316610706565b6102eb610718565b604080516001600160a01b039092168252519081900360200190f35b61011861072c565b6101b96004803603604081101561032557600080fd5b506001600160a01b038135169060200135610787565b6101b96004803603604081101561035157600080fd5b506001600160a01b0381351690602001356107d6565b6102eb6107e3565b6101fd6004803603604081101561038557600080fd5b506001600160a01b03813581169160200135166107f2565b6101f3600480360360208110156103b357600080fd5b50356001600160a01b031661080f565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104495780601f1061041e57610100808354040283529160200191610449565b820191906000526020600020905b81548152906001019060200180831161042c57829003601f168201915b505050505081565b600061045e3384846108dc565b50600192915050565b60055461010090046001600160a01b031633146104b8576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b6104c1816109c8565b6104ca57600080fd5b61055833826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561051b57600080fd5b505afa15801561052f573d6000803e3d6000fd5b505050506040513d602081101561054557600080fd5b50516001600160a01b03841691906109da565b50565b60025481565b600061056e848484610a31565b6001600160a01b038416600090815260016020908152604080832033845290915290205460001981146105ca576105ca85336105c58660405180606001604052806028815260200161140460289139869190610d19565b6108dc565b60019150505b9392505050565b60055460ff1681565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161045e9185906105c59086610882565b6006546001600160a01b0316331461062d57600080fd5b600680546001600160a01b0319169055600554604051339161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360058054610100600160a81b0319163361010002179055565b60055461010090046001600160a01b031633146106e4576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60006020819052908152604090205481565b60055461010090046001600160a01b031681565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104495780601f1061041e57610100808354040283529160200191610449565b600061045e33846105c58560405180606001604052806025815260200161149b602591393360009081526001602090815260408083206001600160a01b038d1684529091529020549190610d19565b600061045e338484610a31565b6007546001600160a01b031681565b600160209081526000928352604080842090915290825290205481565b60055461010090046001600160a01b03163314610860576040805162461bcd60e51b815260206004820152600a6024820152694f776e6572206f6e6c7960b01b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000828201838110156105d0576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0383166109215760405162461bcd60e51b815260040180806020018281038252602481526020018061144d6024913960400191505060405180910390fd5b6001600160a01b0382166109665760405162461bcd60e51b81526004018080602001828103825260228152602001806113966022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038116301415919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a2c908490610db0565b505050565b6001600160a01b038316610a605760405162461bcd60e51b8152600401610a5790611301565b60405180910390fd5b6001600160a01b038216610a865760405162461bcd60e51b8152600401610a57906112be565b610a91838383610a2c565b6007546001600160a01b0316818115610c4c5760006060836001600160a01b03166395c47d06338989896040518563ffffffff1660e01b8152600401610ada9493929190611294565b600060405180830381600087803b158015610af457600080fd5b505af1158015610b08573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3091908101906111de565b90925090508115610b7b5760408051808201909152600d81526c084eae4dc40e8dede40daeac6d609b1b6020820152610b6c9084908490610d19565b9250829450610b7b8783610e61565b60005b8151811015610c4857600080838381518110610b9657fe5b602002602001015160000151848481518110610bae57fe5b60200260200101516020015191509150610bfc81604051806040016040528060118152602001700a8e4c2dce6cccae440e8dede40daeac6d607b1b81525088610d199092919063ffffffff16565b6001600160a01b038316600090815260208190526040902054909650610c229082610882565b6001600160a01b0390921660009081526020819052604090209190915550600101610b7e565b5050505b610c89836040518060600160405280602681526020016113b8602691396001600160a01b0388166000908152602081905260409020549190610d19565b6001600160a01b038087166000908152602081905260408082209390935590861681522054610cb89082610882565b6001600160a01b0380861660008181526020819052604090819020939093559151908716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d0a908790611346565b60405180910390a35050505050565b60008184841115610da85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d6d578181015183820152602001610d55565b50505050905090810190601f168015610d9a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6060610e05826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610f5d9092919063ffffffff16565b805190915015610a2c57808060200190516020811015610e2457600080fd5b5051610a2c5760405162461bcd60e51b815260040180806020018281038252602a815260200180611471602a913960400191505060405180910390fd5b6001600160a01b038216610ea65760405162461bcd60e51b815260040180806020018281038252602181526020018061142c6021913960400191505060405180910390fd5b610eb282600083610a2c565b610eef81604051806060016040528060228152602001611374602291396001600160a01b0385166000908152602081905260409020549190610d19565b6001600160a01b038316600090815260208190526040902055600254610f159082610f74565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6060610f6c8484600085610fb6565b949350505050565b60006105d083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d19565b606082471015610ff75760405162461bcd60e51b81526004018080602001828103825260268152602001806113de6026913960400191505060405180910390fd5b61100085611112565b611051576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106110905780518252601f199092019160209182019101611071565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146110f2576040519150601f19603f3d011682016040523d82523d6000602084013e6110f7565b606091505b5091509150611107828286611118565b979650505050505050565b3b151590565b606083156111275750816105d0565b8251156111375782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315610d6d578181015183820152602001610d55565b60006040828403121561118f578081fd5b6040516040810181811067ffffffffffffffff821117156111ac57fe5b604052825190915081906001600160a01b03811681146111cb57600080fd5b8152602092830151920191909152919050565b60008060408084860312156111f1578283fd5b8351925060208085015167ffffffffffffffff80821115611210578485fd5b818701915087601f830112611223578485fd5b81518181111561122f57fe5b61123c848583020161134f565b8181528481019250838501868302850186018b1015611259578788fd5b8794505b828510156112835761126f8b8261117e565b84526001949094019392850192860161125d565b508096505050505050509250929050565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561136b57fe5b60405291905056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e0677cab89c65d698c253e1c48f8b36aa1edb6dd79be84632ac841ad15b851f264736f6c63430007040033

Deployed Bytecode Sourcemap

192:129:21:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1668:27:2;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2761:167;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2761:167:2;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;427:196:30;;;;;;;;;;;;;;;;-1:-1:-1;427:196:30;-1:-1:-1;;;;;427:196:30;;:::i;:::-;;1624:35:2;;;:::i;:::-;;;;;;;;;;;;;;;;3410:420;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;3410:420:2;;;;;;;;;;;;;;;;;:::i;1738:35::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;4239:212;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;4239:212:2;;;;;;;;:::i;652:222:20:-;;;:::i;625:125:4:-;;;;;;;;;;;;;;;;-1:-1:-1;625:125:4;-1:-1:-1;;;;;625:125:4;;:::i;1479:54:2:-;;;;;;;;;;;;;;;;-1:-1:-1;1479:54:2;-1:-1:-1;;;;;1479:54:2;;:::i;329:42:20:-;;;:::i;:::-;;;;-1:-1:-1;;;;;329:42:20;;;;;;;;;;;;;;1702:29:2;;;:::i;4954:263::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;4954:263:2;;;;;;;;:::i;2441:173::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2441:173:2;;;;;;;;:::i;484:33:4:-;;;:::i;1540:75:2:-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1540:75:2;;;;;;;;;;:::i;524:120:20:-;;;;;;;;;;;;;;;;-1:-1:-1;524:120:20;-1:-1:-1;;;;;524:120:20;;:::i;1668:27:2:-;;;;;;;;;;;;;;;-1:-1:-1;;1668:27:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2761:167::-;2844:4;2861:37;2870:10;2882:7;2891:6;2861:8;:37::i;:::-;-1:-1:-1;2916:4:2;2761:167;;;;:::o;427:196:30:-;476:5:20;;;;;-1:-1:-1;;;;;476:5:20;462:10;:19;453:43;;;;;-1:-1:-1;;;453:43:20;;;;;;;;;;;;-1:-1:-1;;;453:43:20;;;;;;;;;;;;;;;518:23:30::1;535:5;518:16;:23::i;:::-;509:33;;;::::0;::::1;;553:62;572:10;584:5;-1:-1:-1::0;;;;;584:15:30::1;;608:4;584:30;;;;;;;;;;;;;-1:-1:-1::0;;;;;584:30:30::1;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;584:30:30;-1:-1:-1;;;;;553:18:30;::::1;::::0;:62;:18:::1;:62::i;:::-;427:196:::0;:::o;1624:35:2:-;;;;:::o;3410:420::-;3516:4;3533:36;3543:6;3551:9;3562:6;3533:9;:36::i;:::-;-1:-1:-1;;;;;3603:17:2;;3580:20;3603:17;;;:9;:17;;;;;;;;3621:10;3603:29;;;;;;;;-1:-1:-1;;3647:27:2;;3643:158;;3691:98;3700:6;3708:10;3720:68;3737:6;3720:68;;;;;;;;;;;;;;;;;:12;;:68;:16;:68::i;:::-;3691:8;:98::i;:::-;3818:4;3811:11;;;3410:420;;;;;;:::o;1738:35::-;;;;;;:::o;4239:212::-;4353:10;4327:4;4374:21;;;:9;:21;;;;;;;;-1:-1:-1;;;;;4374:30:2;;;;;;;;;;4327:4;;4344:77;;4365:7;;4374:46;;4409:10;4374:34;:46::i;652:222:20:-;719:12;;-1:-1:-1;;;;;719:12:20;735:10;719:26;710:36;;;;;;757:12;:25;;-1:-1:-1;;;;;;757:25:20;;;819:5;;798:39;;826:10;;757:25;819:5;;-1:-1:-1;;;;;819:5:20;;798:39;;780:1;;798:39;848:5;:18;;-1:-1:-1;;;;;;848:18:20;856:10;848:18;;;;;652:222::o;625:125:4:-;476:5:20;;;;;-1:-1:-1;;;;;476:5:20;462:10;:19;453:43;;;;;-1:-1:-1;;;453:43:20;;;;;;;;;;;;-1:-1:-1;;;453:43:20;;;;;;;;;;;;;;;714:12:4::1;:28:::0;;-1:-1:-1;;;;;;714:28:4::1;-1:-1:-1::0;;;;;714:28:4;;;::::1;::::0;;;::::1;::::0;;625:125::o;1479:54:2:-;;;;;;;;;;;;;;:::o;329:42:20:-;;;;;;-1:-1:-1;;;;;329:42:20;;:::o;1702:29:2:-;;;;;;;;;;;;;;;-1:-1:-1;;1702:29:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4954:263;5047:4;5064:123;5073:10;5085:7;5094:92;5129:15;5094:92;;;;;;;;;;;;;;;;;5104:10;5094:21;;;;:9;:21;;;;;;;;-1:-1:-1;;;;;5094:30:2;;;;;;;;;;;:92;:34;:92::i;2441:173::-;2527:4;2544:40;2554:10;2566:9;2577:6;2544:9;:40::i;484:33:4:-;;;-1:-1:-1;;;;;484:33:4;;:::o;1540:75:2:-;;;;;;;;;;;;;;;;;;;;;;;;:::o;524:120:20:-;476:5;;;;;-1:-1:-1;;;;;476:5:20;462:10;:19;453:43;;;;;-1:-1:-1;;;453:43:20;;;;;;;;;;;;-1:-1:-1;;;453:43:20;;;;;;;;;;;;;;;613:12:::1;:23:::0;;-1:-1:-1;;;;;;613:23:20::1;-1:-1:-1::0;;;;;613:23:20;;;::::1;::::0;;;::::1;::::0;;524:120::o;148:185:29:-;206:7;244:5;;;268:6;;;;260:46;;;;;-1:-1:-1;;;260:46:29;;;;;;;;;;;;;;;;;;;;;;;;;;;8091:344:2;-1:-1:-1;;;;;8193:19:2;;8185:68;;;;-1:-1:-1;;;8185:68:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;8272:21:2;;8264:68;;;;-1:-1:-1;;;8264:68:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;8345:16:2;;;;;;;:9;:16;;;;;;;;:25;;;;;;;;;;;;;:34;;;8395:32;;;;;;;;;;;;;;;;;8091:344;;;:::o;631:142:30:-;-1:-1:-1;;;;;733:31:30;;759:4;733:31;;631:142;;;:::o;828:177:28:-;938:58;;;-1:-1:-1;;;;;938:58:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;938:58:28;-1:-1:-1;;;938:58:28;;;911:86;;931:5;;911:19;:86::i;:::-;828:177;;;:::o;758:1315:4:-;-1:-1:-1;;;;;879:20:4;;871:70;;;;-1:-1:-1;;;871:70:4;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;960:23:4;;952:71;;;;-1:-1:-1;;;952:71:4;;;;;;;:::i;:::-;1036:47;1057:6;1065:9;1076:6;1036:20;:47::i;:::-;1126:12;;-1:-1:-1;;;;;1126:12:4;1169:6;1190:36;;1186:658;;1244:12;1258:35;1297:13;-1:-1:-1;;;;;1297:28:4;;1326:10;1338:6;1346:9;1357:6;1297:67;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1297:67:4;;;;;;;;;;;;:::i;:::-;1243:121;;-1:-1:-1;1243:121:4;-1:-1:-1;1395:8:4;;1391:144;;1445:36;;;;;;;;;;;;-1:-1:-1;;;1445:36:4;;;;;;:9;;1459:4;;1445:13;:36::i;:::-;1433:48;;;1424:57;;1500:19;1506:6;1514:4;1500:5;:19::i;:::-;1554:9;1549:284;1573:7;:14;1569:1;:18;1549:284;;;1614:12;1628:11;1644:7;1652:1;1644:10;;;;;;;;;;;;;;:22;;;1668:7;1676:1;1668:10;;;;;;;;;;;;;;:17;;;1613:73;;;;1717:39;1731:3;1717:39;;;;;;;;;;;;;-1:-1:-1;;;1717:39:4;;;:9;:13;;:39;;;;;:::i;:::-;-1:-1:-1;;;;;1793:15:4;;:9;:15;;;;;;;;;;;1705:51;;-1:-1:-1;1793:24:4;;1813:3;1793:19;:24::i;:::-;-1:-1:-1;;;;;1775:15:4;;;:9;:15;;;;;;;;;;:42;;;;-1:-1:-1;1589:3:4;;1549:284;;;;1186:658;;;1874:71;1896:6;1874:71;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1874:17:4;;:9;:17;;;;;;;;;;;;:71;:21;:71::i;:::-;-1:-1:-1;;;;;1854:17:4;;;:9;:17;;;;;;;;;;;:91;;;;1979:20;;;;;;;:35;;2004:9;1979:24;:35::i;:::-;-1:-1:-1;;;;;1956:20:4;;;:9;:20;;;;;;;;;;;;:58;;;;2030:35;;;;;;;;;;2058:6;;2030:35;:::i;:::-;;;;;;;;758:1315;;;;;:::o;491:196:29:-;577:7;619:12;611:6;;;;603:29;;;;-1:-1:-1;;;603:29:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;655:5:29;;;491:196::o;2071:761:28:-;2495:23;2521:69;2549:4;2521:69;;;;;;;;;;;;;;;;;2529:5;-1:-1:-1;;;;;2521:27:28;;;:69;;;;;:::i;:::-;2605:17;;2495:95;;-1:-1:-1;2605:21:28;2601:224;;2747:10;2736:30;;;;;;;;;;;;;;;-1:-1:-1;2736:30:28;2728:85;;;;-1:-1:-1;;;2728:85:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7237:416:2;-1:-1:-1;;;;;7321:21:2;;7313:67;;;;-1:-1:-1;;;7313:67:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7393:49;7414:7;7431:1;7435:6;7393:20;:49::i;:::-;7476:68;7499:6;7476:68;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;7476:18:2;;:9;:18;;;;;;;;;;;;:68;:22;:68::i;:::-;-1:-1:-1;;;;;7455:18:2;;:9;:18;;;;;;;;;;:89;7569:11;;:23;;7585:6;7569:15;:23::i;:::-;7555:11;:37;7608;;;;;;;;7634:1;;-1:-1:-1;;;;;7608:37:2;;;;;;;;;;;;7237:416;;:::o;3670:195:0:-;3773:12;3805:52;3827:6;3835:4;3841:1;3844:12;3805:21;:52::i;:::-;3798:59;3670:195;-1:-1:-1;;;;3670:195:0:o;341:142:29:-;399:7;432:43;436:1;439;432:43;;;;;;;;;;;;;;;;;:3;:43::i;4722:530:0:-;4849:12;4907:5;4882:21;:30;;4874:81;;;;-1:-1:-1;;;4874:81:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4974:18;4985:6;4974:10;:18::i;:::-;4966:60;;;;;-1:-1:-1;;;4966:60:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;5100:12;5114:23;5141:6;-1:-1:-1;;;;;5141:11:0;5161:5;5169:4;5141:33;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5141:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5099:75;;;;5192:52;5210:7;5219:10;5231:12;5192:17;:52::i;:::-;5185:59;4722:530;-1:-1:-1;;;;;;;4722:530:0:o;752:422::-;1119:20;1158:8;;;752:422::o;7262:742::-;7377:12;7406:7;7402:595;;;-1:-1:-1;7437:10:0;7430:17;;7402:595;7551:17;;:21;7547:439;;7814:10;7808:17;7875:15;7862:10;7858:2;7854:19;7847:44;7762:148;7950:20;;-1:-1:-1;;;7950:20:0;;;;;;;;;;;;;;;;;7957:12;;7950:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14:600:34;;141:4;129:9;124:3;120:19;116:30;113:2;;;163:5;156;149:20;113:2;200:4;194:11;244:4;236:6;232:17;315:6;303:10;300:22;279:18;267:10;264:34;261:62;258:2;;;326:9;258:2;353:4;346:24;418:16;;388:6;;-1:-1:-1;388:6:34;;-1:-1:-1;;;;;465:33:34;;453:46;;443:2;;513:1;510;503:12;443:2;526:23;;603:2;588:18;;;582:25;565:15;;558:50;;;;103:511;;-1:-1:-1;103:511:34:o;619:1167::-;;;798:2;841;829:9;820:7;816:23;812:32;809:2;;;862:6;854;847:22;809:2;896:9;890:16;880:26;;925:2;971;960:9;956:18;950:25;994:18;1035:2;1027:6;1024:14;1021:2;;;1056:6;1048;1041:22;1021:2;1099:6;1088:9;1084:22;1074:32;;1144:7;1137:4;1133:2;1129:13;1125:27;1115:2;;1171:6;1163;1156:22;1115:2;1209;1203:9;1235:2;1227:6;1224:14;1221:2;;;1241:9;1221:2;1272:40;1308:2;1303;1295:6;1291:15;1287:24;1272:40;:::i;:::-;1346:19;;;1381:12;;;;-1:-1:-1;1413:11:34;;;1451:15;;;1443:24;;1439:33;;1436:46;-1:-1:-1;1433:2:34;;;1500:6;1492;1485:22;1433:2;1527:6;1518:15;;1542:214;1556:6;1553:1;1550:13;1542:214;;;1617:64;1673:7;1668:3;1617:64;:::i;:::-;1605:77;;1578:1;1571:9;;;;;1702:12;;;;1734;;1542:214;;;1546:3;1775:5;1765:15;;;;;;;;778:1008;;;;;:::o;1791:464::-;-1:-1:-1;;;;;2086:15:34;;;2068:34;;2138:15;;;2133:2;2118:18;;2111:43;2190:15;;2185:2;2170:18;;2163:43;2237:2;2222:18;;2215:34;;;;2017:3;2002:19;;1984:271::o;2260:399::-;2462:2;2444:21;;;2501:2;2481:18;;;2474:30;2540:34;2535:2;2520:18;;2513:62;-1:-1:-1;;;2606:2:34;2591:18;;2584:33;2649:3;2634:19;;2434:225::o;2664:401::-;2866:2;2848:21;;;2905:2;2885:18;;;2878:30;2944:34;2939:2;2924:18;;2917:62;-1:-1:-1;;;3010:2:34;2995:18;;2988:35;3055:3;3040:19;;2838:227::o;3070:177::-;3216:25;;;3204:2;3189:18;;3171:76::o;3252:242::-;3322:2;3316:9;3352:17;;;3399:18;3384:34;;3420:22;;;3381:62;3378:2;;;3446:9;3378:2;3473;3466:22;3296:198;;-1:-1:-1;3296:198:34:o

Swarm Source

ipfs://e0677cab89c65d698c253e1c48f8b36aa1edb6dd79be84632ac841ad15b851f2
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.