// File: src/Interfaces.sol



// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.0;

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

interface IERC20 {
    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);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval (address indexed owner, address indexed spender, uint256 value);
}

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

}

contract Ownable is Context {
    address private _owner;
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    constructor () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    function owner() public view returns (address) {
        return _owner;
    }

    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

}

interface IUniswapV2Factory {
    function createPair(address tokenA, address tokenB) external returns (address pair);
}

interface IUniswapV2Router02 {
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function factory() external pure returns (address);
    function WETH() external pure returns (address);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}

// File: src/ShadowLinkVault.sol



// ShadowLink Corporation Vault

// Website: https://thepunklist.com
// Twitter: https://twitter.com/cypherpunk_eth
// Telegram: https://t.me/thepunklist

// SPDX-License-Identifier:MIT
pragma solidity ^0.8.18;

import "./Interfaces.sol";

// @title ShadowLinkVault - Used to prove your membership. Soulbound Vault.
contract ShadowLinkVault {
    bool private _reentrancyGuard;

    IERC20 public immutable TOKEN;
    // @dev - number of tokens we accept in the vault
    uint public immutable TOKEN_AMOUNT;

    // @dev - This is the ceiling of deposits.
    uint16 public immutable LIMIT = 220;
    uint16 public remaining = 220;

    // User -> token -> deposit balance
    mapping (address => uint256) public tokenBalancesByUser;

    event TokensDeposited(address indexed sender, uint256 amount, uint256 block);

    // @param tokenAmount_ the amount in wei of the tokens we need for deposit
    constructor( IERC20 token_, uint256 tokenAmount_) {
        TOKEN = token_;
        TOKEN_AMOUNT = tokenAmount_;
    }

    // Prevents reentrancy attacks via tokens with callback mechanisms.
    modifier nonReentrant() {
        require(!_reentrancyGuard, 'no reentrancy');
        _reentrancyGuard = true;
        _;
        _reentrancyGuard = false;
    }

    function hasDeposit(address depositor) public view returns (bool isDepositor) {
        isDepositor = tokenBalancesByUser[depositor] == TOKEN_AMOUNT;
    }

    // @notice - you need to deposit the exact amount of tokens or this will fail.
    function deposit(
        uint256 amount
    ) external nonReentrant {
        // require amount
        require(amount == TOKEN_AMOUNT, "INCORRECT TOKEN AMOUNT");
        require(remaining > 0, "VAULT IS CLOSED");
        require(tokenBalancesByUser[msg.sender] == 0, "User has already deposited tokens");
        // decrement the spotsRemaining
        remaining -= 1;
        // transfer in
        TOKEN.transferFrom(msg.sender, address(this), amount);
        // Credit the caller.
        tokenBalancesByUser[msg.sender] += amount;
        emit TokensDeposited(msg.sender, amount, block.number);
    }

}