contract TsVesting is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for ERC20;

    mapping(address => Wallet) public wallets;
    ERC20 private _token = ERC20(address(0x8c18D6a985Ef69744b9d57248a45c0861874f244));

    constructor() public {}

    function setToken(ERC20 token) public onlyOwner {
        _token = token;
    }

    /**
     * Bulk Allocation Insertion
     */
    function addAllocations(
        address[] memory addresses,
        uint256[] memory amounts
    ) external onlyOwner {
        require(
            addresses.length == amounts.length,
            "Address and totalAmounts length must be same"
        );

        uint256 addressesLength = addresses.length;

        for (uint256 i = 0; i < addressesLength; i++) {
            address address_ = addresses[i];
            uint256 amount = amounts[i];
            
            wallets[address_] = Wallet(address_, amount);
        }
    }

    /**
     * Redeem Tokens
     */
    function redeemTokens() external {
        address sender = msg.sender;
        require(wallets[sender].amount > 0, "Insufficient token");

        _token.safeTransfer(sender, wallets[sender].amount);
        wallets[sender].amount = 0;
    }

    /**
     * Purge tokens
     */
    function purge() external onlyOwner {
        uint256 totalToken = _token.balanceOf(address(this));
        require(totalToken != 0, "Insufficient token");
        _token.safeTransfer(msg.sender, totalToken);
    }
}
function redeemTokens() external {
    address sender = msg.sender;
    require(wallets[sender].amount > 0, "Insufficient token");

    _token.safeTransfer(sender, wallets[sender].amount);
    wallets[sender].amount = 0;
}

/**
 * Redeem Tokens
 */