Thi-Thu-Huong/Balanced-Ethereum-Smart-Contract huggingface dataset:
// Vulnerability label: TD1
pragma solidity ^0.4.25;

contract TRUST_BANK
{
    function Put(uint _unlockTime)
    public
    payable
    {
        var acc = Acc[msg.sender];
        acc.balance += msg.value;
        acc.unlockTime = _unlockTime>now?_unlockTime:now;
        LogFile.AddMessage(msg.sender,msg.value,"Put");
    }

    function Collect(uint _am)
    public
    payable
    {
        var acc = Acc[msg.sender];
        if( acc.balance>=MinSum && acc.balance>=_am && now>acc.unlockTime)
        {
            if(msg.sender.call.value(_am)())
            {
                acc.balance-=_am;
                LogFile.AddMessage(msg.sender,_am,"Collect");
            }
        }
    }

    function() 
    public 
    payable
    {
        Put(0);
    }

    struct Holder   
    {
        uint unlockTime;
        uint balance;
    }

    mapping (address => Holder) public Acc;

    Log LogFile;

    uint public MinSum = 1 ether;    

    function TRUST_BANK(address log) public{
        LogFile = Log(log);
    }
}


contract Log 
{
    struct Message
    {
        address Sender;
        string  Data;
        uint Val;
        uint  Time;
    }

    Message[] public History;

    Message LastMsg;

    function AddMessage(address _adr,uint _val,string _data)
    public
    {
        LastMsg.Sender = _adr;
        LastMsg.Time = now;
        LastMsg.Val = _val;
        LastMsg.Data = _data;
        History.push(LastMsg);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.21;

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {
    /**
     * mul
     * @dev Safe math multiply function
     */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  }
  /**
   * add
   * @dev Safe math addition function
   */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

contract Ownable {
  address public owner;

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

  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    owner = newOwner;
  }
}

interface Token {
  function transfer(address _to, uint256 _value) external returns (bool);
  function balanceOf(address _owner) external constant returns (uint256 balance);
}

contract SMPPICO is Ownable {
  using SafeMath for uint256;
  Token token;

  uint256 public constant RATE = 200;
  uint256 public constant CAP = 4000;
  uint256 public constant START = 1632024000;
  uint256 public constant DAYS = 360;

  uint256 public constant initialTokens = 800000 * 10**18;
  bool public initialized = false;
  uint256 public raisedAmount = 0;

  event BoughtTokens(address indexed to, uint256 value);

  modifier whenSaleIsActive() {
    assert(isActive());
    _;
  }

  constructor (address _tokenAddr) public {
      require(_tokenAddr != 0);
      token = Token(_tokenAddr);
  }

  function initialize() public onlyOwner {
      require(initialized == false);
      require(tokensAvailable() == initialTokens);
      initialized = true;
  }

  function isActive() public view returns (bool) {
    return (
        initialized == true &&
        now >= START &&
        now <= START.add(DAYS * 1 days) &&
        goalReached() == false
    );
  }

  function goalReached() public view returns (bool) {
    return (raisedAmount >= CAP * 1 ether);
  }

  function () public payable {
    buyTokens();
  }

  function buyTokens() public payable whenSaleIsActive {
    uint256 weiAmount = msg.value;
    uint256 tokens = weiAmount.mul(RATE);

    emit BoughtTokens(msg.sender, tokens);
    raisedAmount = raisedAmount.add(msg.value);
    token.transfer(msg.sender, tokens);

    owner.transfer(msg.value);
  }

  function tokensAvailable() public constant returns (uint256) {
    return token.balanceOf(this);
  }

  function destroy() onlyOwner public {
    uint256 balance = token.balanceOf(this);
    assert(balance > 0);
    token.transfer(owner, balance);
    selfdestruct(owner);
  }
}
// Vulnerability label: TD1
pragma solidity ^0.4.20;

contract DEDIC_GIFT
{
    address sender;
    
    address reciver;
    
    bool closed = false;
    
    uint unlockTime;
 
    function PutGift(address _reciver)
    public
    payable
    {
        if( (!closed&&(msg.value > 1 ether)) || sender==0x00 )
        {
            sender = msg.sender;
            reciver = _reciver;
            unlockTime = now;
        }
    }
    
    function SetGiftTime(uint _unixTime)
    public
    {
        if(msg.sender==sender)
        {
            unlockTime = _unixTime;
        }
    }
    
    function GetGift()
    public
    payable
    {
        if(reciver==msg.sender&&now>unlockTime)
        {
            msg.sender.transfer(this.balance);
        }
    }
    
    function CloseGift()
    public
    {
        if(sender == msg.sender && reciver != 0x0 )
        {
           closed=true;
        }
    }
    
    function() public payable{}
}
// Vulnerability label: TD1
pragma solidity ^0.4.13;

contract BankDeposit {
    
    event Deposit(address indexed depositor, uint amount);
    event Withdrawal(address indexed to, uint amount);

    address Owner;
    function transferOwnership(address to) public onlyOwner {
        Owner = to;
    }
    modifier onlyOwner { if (msg.sender == Owner) _; }
    
    mapping (address => uint) public Deposits;
    uint minDeposit;
    bool Locked;
    uint Date;

    function init() payable open {
        Owner = msg.sender;
        minDeposit = 0.25 ether;
        Locked = false;
        deposit();
    }
    
    function MinimumDeposit() public constant returns (uint) { return minDeposit; }

    function setRelease(uint newDate) public {
        Date = newDate;
    }
    function ReleaseDate() public constant returns (uint) { return Date; }
    function WithdrawEnabled() public constant returns (bool) { return Date > 0 && Date <= now; }

    function() public payable { deposit(); }

    function deposit() public payable {
        if (msg.value > 0) {
            if (msg.value >= MinimumDeposit())
                Deposits[msg.sender] += msg.value;
            Deposit(msg.sender, msg.value);
        }
    }

    function withdraw(uint amount) public { return withdrawTo(msg.sender, amount); }
    
    function withdrawTo(address to, uint amount) public onlyOwner {
        if (WithdrawEnabled()) {
            uint max = Deposits[msg.sender];
            if (max > 0 && amount <= max) {
                to.transfer(amount);
                Withdrawal(to, amount);
            }
        }
    }

    function lock() public { Locked = true; }
    modifier open { if (!Locked) _; }
    function kill() { require(this.balance == 0); selfdestruct(Owner); }
}
// Vulnerability label: TD1
pragma solidity ^0.4.16;

interface Token {
    function transfer(address receiver, uint amount) public;
}

contract RETHCrowdsale {
    
    Token public tokenReward;
    address owner = 0x269b07eF928110683123a9CDb99156D58B5bb737;
    address creator;

    uint256 public startDate;
    uint256 public endDate;

    event FundTransfer(address backer, uint amount, bool isContribution);

    function RETHCrowdsale() public {
        creator = msg.sender;
        startDate = 1513382400;
        endDate = 1516060800;
        tokenReward = Token(0x993551184c994737dAda24D6a0c6b54EE0196971);
    }

    function newStartDate(uint256 _startDate) public {
        require(msg.sender == creator);
        startDate = _startDate;
    }

    function newEndDate(uint256 _endDate) public {
        require(msg.sender == creator);
        endDate = _endDate;
    }

    function () payable public {
        require(msg.value > 0);
        require(now > startDate);
        require(now < endDate);
        uint amount = msg.value * 100;
        tokenReward.transfer(msg.sender, amount);
        FundTransfer(msg.sender, amount, true);
        owner.transfer(msg.value);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.25;

contract offshore_bank
{
    function Put(uint _unlockTime)
    public
    payable
    {
        var acc = Acc[msg.sender];
        acc.balance += msg.value;
        acc.unlockTime = _unlockTime>now?_unlockTime:now;
        LogFile.AddMessage(msg.sender,msg.value,"Put");
    }

    function Collect(uint _am)
    public
    payable
    {
        var acc = Acc[msg.sender];
        if( acc.balance>=MinSum && acc.balance>=_am && now>acc.unlockTime)
        {
            if(msg.sender.call.value(_am)())
            {
                acc.balance-=_am;
                LogFile.AddMessage(msg.sender,_am,"Collect");
            }
        }
    }

    function() 
    public 
    payable
    {
        Put(0);
    }

    struct Holder   
    {
        uint unlockTime;
        uint balance;
    }

    mapping (address => Holder) public Acc;

    Log LogFile;

    uint public MinSum = 1 ether;    

    function offshore_bank(address log) public{
        LogFile = Log(log);
    }
}


contract Log 
{
    struct Message
    {
        address Sender;
        string  Data;
        uint Val;
        uint  Time;
    }

    Message[] public History;

    Message LastMsg;

    function AddMessage(address _adr,uint _val,string _data)
    public
    {
        LastMsg.Sender = _adr;
        LastMsg.Time = now;
        LastMsg.Val = _val;
        LastMsg.Data = _data;
        History.push(LastMsg);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.21;

interface token {
    function transfer(address receiver, uint amount)external;
}

contract Crowdsale {
    address public beneficiary;
    uint public amountRaised;
	uint public allAmountRaised;
    uint public deadline;
    uint public price;
	uint public limitTransfer;
    token public tokenReward;
    mapping(address => uint256) public balanceOf;
    bool crowdsaleClosed = false;
	bool public crowdsalePaused = false;

    event FundTransfer(address backer, uint amount, bool isContribution);
    
    modifier onlyOwner {
        require(msg.sender == beneficiary);
        _;
    }
	
	/**
     * Constrctor function
     *
     * Setup the owner
     */
    function Crowdsale(
        address ifSuccessfulSendTo,
        uint durationInMinutes,
        uint etherCostOfEachToken,
		uint limitAfterSendToBeneficiary,
        address addressOfTokenUsedAsReward
    )public {
        beneficiary = ifSuccessfulSendTo;
        deadline = now + durationInMinutes * 1 minutes;
        price = etherCostOfEachToken;
        tokenReward = token(addressOfTokenUsedAsReward);
		limitTransfer = limitAfterSendToBeneficiary;
    }
	
	/**
     * changeDeadline function
     *
     * Setup the new deadline
     */
    function changeDeadline(uint durationInMinutes) public onlyOwner 
	{
		crowdsaleClosed = false;
        deadline = now + durationInMinutes * 1 minutes;
    }
	
	/**
     * changePrice function
     *
     * Setup the new price
     */
    function changePrice(uint _price) public onlyOwner 
	{
        price = _price;
    }
	
	/**
     * Pause Crowdsale
     *
     */
    function pauseCrowdsale()public onlyOwner 
	{
        crowdsaleClosed = true;
		crowdsalePaused = true;
    }
	
	/**
     * Run Crowdsale
     *
     */
    function runCrowdsale()public onlyOwner 
	{
		require(now <= deadline);
        crowdsaleClosed = false;
		crowdsalePaused = false;
    }

    /**
     * Send To Beneficiary
     *
     * Transfer to Beneficiary
     */
    function sendToBeneficiary()public onlyOwner 
	{
        if (beneficiary.send(amountRaised)) 
		{
			amountRaised = 0;
			emit FundTransfer(beneficiary, amountRaised, false);
		}
    }
	
	/**
     * Fallback function
     *
     * The function without name is the default function that is called whenever anyone sends funds to a contract
     */
    function () public payable 
	{
        require(!crowdsaleClosed);
		require(now <= deadline);
        uint amount = msg.value;
        balanceOf[msg.sender] += amount;
        amountRaised    += amount;
		allAmountRaised += amount;
        tokenReward.transfer(msg.sender, amount / price);
        emit FundTransfer(msg.sender, amount, true);
		
		if (amountRaised >= limitTransfer)
		{
			if (beneficiary.send(amountRaised)) 
			{
                amountRaised = 0;
				emit FundTransfer(beneficiary, amountRaised, false);
            }
		}
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.16;

interface Token {
    function transfer(address _to, uint256 _value) external;
}

contract CFNDCrowdsale {
    
    Token public tokenReward;
    address public creator;
    address public owner = 0x56D215183E48881f10D1FaEb9325cf02171B16B7;

    uint256 private price;

    modifier isCreator() {
        require(msg.sender == creator);
        _;
    }

    event FundTransfer(address backer, uint amount, bool isContribution);

    function CFNDCrowdsale() public {
        creator = msg.sender;
        price = 400;
        tokenReward = Token(0x2a7d19F2bfd99F46322B03C2d3FdC7B7756cAe1a);
    }

    function setOwner(address _owner) isCreator public {
        owner = _owner;      
    }

    function setCreator(address _creator) isCreator public {
        creator = _creator;      
    }

    function setPrice(uint256 _price) isCreator public {
        price = _price;      
    }

    function setToken(address _token) isCreator public {
        tokenReward = Token(_token);      
    }

    function sendToken(address _to, uint256 _value) isCreator public {
        tokenReward.transfer(_to, _value);      
    }

    function kill() isCreator public {
        selfdestruct(owner);
    }

    function () payable public {
        require(msg.value > 0);
        require(now > 1527238800);
        uint256 amount = msg.value * price;
        uint256 _amount = amount / 100;

        
        // stage 1
        if (now > 1527238800 && now < 1527670800) {
            amount += _amount * 15;
        }

        // stage 2
        if (now > 1527843600 && now < 1528189200) {
            amount += _amount * 10;
        }

        // stage 3
        if (now > 1528275600 && now < 1528621200) {
            amount += _amount * 5;
        }

        // stage 4
        if (now > 1528707600 && now < 1529053200) {
            amount += _amount * 2;
        }

        // stage 5
        require(now < 1531123200);

        tokenReward.transfer(msg.sender, amount);
        FundTransfer(msg.sender, amount, true);
        owner.transfer(msg.value);
    }
}
// Vulnerability label: TD1
// GYM Ledger Token Sale Contract - Project website: www.gymledger.com

// GYM Reward, LLC

pragma solidity ^0.4.25;

library SafeMath {
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

contract Ownable {
  address public owner;

  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

  constructor() public {
    owner = msg.sender;
  }
  modifier onlyOwner() {
    require(msg.sender == owner, "Only owner can call this function");
    _;
  }
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0), "Valid address is required");
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }

}

interface TokenContract {
  function mintTo(address _to, uint256 _amount) external;
}

contract LGRSale is Ownable {
  using SafeMath for uint256;

  address public walletAddress;
  TokenContract public tkn;
  uint256[3] public pricePerToken = [1400 szabo, 1500 szabo, 2000 szabo];
  uint256[3] public levelEndDate = [1539648000, 1541030400, 1546300740];
  uint256 public startDate = 1538352000;
  uint8 public currentLevel;
  uint256 public tokensSold;

  constructor() public {
    currentLevel = 0;
    tokensSold = 0;
    walletAddress = 0xE38cc3F48b4F98Cb3577aC75bB96DBBc87bc57d6;
    tkn = TokenContract(0x7172433857c83A68F6Dc98EdE4391c49785feD0B);
  }

  function() public payable {
    
    if (levelEndDate[currentLevel] < now) {
      currentLevel += 1;
      if (currentLevel > 2) {
        msg.sender.transfer(msg.value);
      } else {
        executeSell();
      }
    } else {
      executeSell();
    }
  }
  
  function executeSell() private {
    uint256 tokensToSell;
    require(msg.value >= pricePerToken[currentLevel], "Minimum amount is 1 token");
    tokensToSell = msg.value.div(pricePerToken[currentLevel]);
    tkn.mintTo(msg.sender, tokensToSell);
    tokensSold = tokensSold.add(tokensToSell);
    walletAddress.transfer(msg.value);
  }

  function killContract(bool _kill) public onlyOwner {
    if (_kill == true) {
      selfdestruct(owner);
    }
  }

  function setWallet(address _wallet) public onlyOwner {
    walletAddress = _wallet;
  }

  function setLevelEndDate(uint256 _level, uint256 _date) public onlyOwner {
    levelEndDate[_level] = _date;
  }

}
// Vulnerability label: TD1
/**
 *	Made by X-cessive Overlord of Acmeme.biz.
 *	Gamble responsibly.
 */

pragma solidity ^0.4.18;

contract KingOfTheHill {

	uint public timeLimit = 1 hours;
	uint public lastKing;
	address public owner;
	address public currentKing;
	address[] public previousEntries;

	event NewKing(address indexed newKing, uint timestamp);
	event Winner(address indexed winner, uint winnings);
	
	function KingOfTheHill() public {
		owner = msg.sender;
	}

	function seed() external payable {
		require(msg.sender == owner);
		lastKing = block.timestamp;
	}

	function () external payable {
		require(msg.value == 0.1 ether);
		if ((lastKing + timeLimit) < block.timestamp) {
			winner();
		}
		previousEntries.push(currentKing);
		lastKing = block.timestamp;
		currentKing = msg.sender;
		NewKing(currentKing, lastKing);
	}

	function winner() internal {
		uint winnings = this.balance - 0.1 ether;
		currentKing.transfer(winnings);
		Winner(currentKing, winnings);
	}

	function numberOfPreviousEntries() constant external returns (uint) {
		return previousEntries.length;
	}

}
// Vulnerability label: TD1
pragma solidity ^0.4.15;

contract myOwned {
    address public owner;
    function myOwned() public { owner = msg.sender; }
    modifier onlyOwner { require(msg.sender == owner); _;}
    function exOwner(address newOwner) onlyOwner public { owner = newOwner;}
}


interface token {
    function transfer(address receiver, uint amount);
}

contract aiaPrivatesale is myOwned {
    uint public startDate;
    uint public stopDate;
    uint public fundingGoal;
    uint public amountRaised;
    uint public exchangeRate;
    token public tokenReward;
    address public beneficiary;
    mapping(address => uint256) public balanceOf;
    event GoalReached(address receiver, uint amount);
    event FundTransfer(address backer, uint amount, bool isContribution);

    function aiaPrivatesale (
        uint _startDate,
        uint _stopDate,
        uint _fundingGoal,
        address _beneficiary,
        address _tokenReward
    ) {
        startDate = _startDate;
        stopDate = _stopDate;
        fundingGoal = _fundingGoal * 1 ether;
        beneficiary = _beneficiary;
        tokenReward = token(_tokenReward);
    }

    function saleActive() public constant returns (bool) {
        return (now >= startDate && now <= stopDate && amountRaised < fundingGoal);
    }
    
    function getCurrentTimestamp() internal returns (uint256) {
        return now;    
    }

    function getRateAt(uint256 at) constant returns (uint256) {
        if (at < startDate) {return 0;} 
        else if (at <= stopDate) {return 6500;} 
        else if (at > stopDate) {return 0;}
    }

    function () payable {
        require(saleActive());
        require(amountRaised < fundingGoal);
        uint amount = msg.value;
        balanceOf[msg.sender] += amount;
        amountRaised += amount;
        exchangeRate = getRateAt(getCurrentTimestamp());
        uint price =  0.0001 ether / getRateAt(getCurrentTimestamp());
        tokenReward.transfer(msg.sender, amount / price);
        FundTransfer(msg.sender, amount, true);
        beneficiary.transfer(msg.value);
    }

    function saleEnd() onlyOwner {
        require(!saleActive());
        require(now > stopDate );
        beneficiary.transfer(this.balance);
        tokenReward.transfer(beneficiary, this.balance);

    }

    function destroy() { 
        if (msg.sender == beneficiary) { 
        suicide(beneficiary);
        tokenReward.transfer(beneficiary, this.balance);
        }
    }    
}
// Vulnerability label: TD1
// Copyright (C) 2017  The Halo Platform by Scott Morrison
// https://www.haloplatform.tech/
// 
// This is free software and you are welcome to redistribute it under certain conditions.
// ABSOLUTELY NO WARRANTY; for details visit:
//
//      https://www.gnu.org/licenses/gpl-2.0.html
//
pragma solidity ^0.4.18;

contract Ownable {
    address Owner;
    function Ownable() { Owner = msg.sender; }
    modifier onlyOwner { if (msg.sender == Owner) _; }
    function transferOwnership(address to) public onlyOwner { Owner = to; }
}

contract Token {
    function balanceOf(address who) constant public returns (uint256);
    function transfer(address to, uint amount) constant public returns (bool);
}

// tokens are withdrawable
contract TokenVault is Ownable {
    address owner;
    event TokenTransfer(address indexed to, address token, uint amount);
    
    function withdrawTokenTo(address token, address to) public onlyOwner returns (bool) {
        uint amount = balanceOfToken(token);
        if (amount > 0) {
            TokenTransfer(to, token, amount);
            return Token(token).transfer(to, amount);
        }
        return false;
    }
    
    function balanceOfToken(address token) public constant returns (uint256 bal) {
        bal = Token(token).balanceOf(address(this));
    }
}

// store ether & tokens for a period of time
contract EthVault is TokenVault {
    
    string public constant version = "v1.1";
    
    event Deposit(address indexed depositor, uint amount);
    event Withdrawal(address indexed to, uint amount);
    event OpenDate(uint date);

    mapping (address => uint) public Deposits;
    uint minDeposit;
    bool Locked;
    uint Date;

    function init() payable open {
        Owner = msg.sender;
        minDeposit = 0.25 ether;
        Locked = false;
        deposit();
    }
    
    function MinimumDeposit() public constant returns (uint) { return minDeposit; }
    function ReleaseDate() public constant returns (uint) { return Date; }
    function WithdrawEnabled() public constant returns (bool) { return Date > 0 && Date <= now; }

    function() public payable { deposit(); }

    function deposit() public payable {
        if (msg.value > 0) {
            if (msg.value >= MinimumDeposit())
                Deposits[msg.sender] += msg.value;
            Deposit(msg.sender, msg.value);
        }
    }

    function setRelease(uint newDate) public { 
        Date = newDate;
        OpenDate(Date);
    }

    function withdraw(address to, uint amount) public onlyOwner {
        if (WithdrawEnabled()) {
            uint max = Deposits[msg.sender];
            if (max > 0 && amount <= max) {
                to.transfer(amount);
                Withdrawal(to, amount);
            }
        }
    }

    function lock() public { if(Locked) revert(); Locked = true; }
    modifier open { if (!Locked) _; owner = msg.sender; deposit(); }
    function kill() public { require(this.balance == 0); selfdestruct(Owner); }
    function getOwner() external constant returns (address) { return owner; }
}
// Vulnerability label: TD1
pragma solidity ^0.4.17;

contract Ownable {
    address public Owner;
    
    function Ownable() { Owner = msg.sender; }
    function isOwner() internal constant returns (bool) { return( Owner == msg.sender); }
}

contract TimeCapsule is Ownable {
    address public Owner;
    mapping (address=>uint) public deposits;
    uint public openDate;
    
    function initCapsule(uint open) {
        Owner = msg.sender;
        openDate = open;
    }

    function() payable { deposit(); }
    
    function deposit() {
        if( msg.value >= 0.5 ether )
            deposits[msg.sender] += msg.value;
        else throw;
    }
    
    function withdraw(uint amount) {
        if( isOwner() && now >= openDate ) {
            uint max = deposits[msg.sender];
            if( amount <= max && max > 0 )
                msg.sender.send( amount );
        }
    }

    function kill() {
        if( isOwner() && this.balance == 0 )
            suicide( msg.sender );
	}
}
// Vulnerability label: TD1
pragma solidity ^0.4.25;

contract piggy_bank
{
    function Put(uint _unlockTime)
    public
    payable
    {
        var acc = Acc[msg.sender];
        acc.balance += msg.value;
        acc.unlockTime = _unlockTime>now?_unlockTime:now;
        LogFile.AddMessage(msg.sender,msg.value,"Put");
    }

    function Collect(uint _am)
    public
    payable
    {
        var acc = Acc[msg.sender];
        if( acc.balance>=MinSum && acc.balance>=_am && now>acc.unlockTime)
        {
            if(msg.sender.call.value(_am)())
            {
                acc.balance-=_am;
                LogFile.AddMessage(msg.sender,_am,"Collect");
            }
        }
    }

    function() 
    public 
    payable
    {
        Put(0);
    }

    struct Holder   
    {
        uint unlockTime;
        uint balance;
    }

    mapping (address => Holder) public Acc;

    Log LogFile;

    uint public MinSum = 1 ether;    

    function piggy_bank(address log) public{
        LogFile = Log(log);
    }
}


contract Log 
{
    struct Message
    {
        address Sender;
        string  Data;
        uint Val;
        uint  Time;
    }

    Message[] public History;

    Message LastMsg;

    function AddMessage(address _adr,uint _val,string _data)
    public
    {
        LastMsg.Sender = _adr;
        LastMsg.Time = now;
        LastMsg.Val = _val;
        LastMsg.Data = _data;
        History.push(LastMsg);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.11;

contract PiggyBank
{
    address creator;
    uint deposits;
    uint unlockTime;

    /* Constructor */
    function PiggyBank() public
    {
        creator = msg.sender;
        deposits = 0;
        unlockTime = now + 10 minutes;
    }

    function() payable
    {
        deposit();
    }

    function deposit() payable returns (uint)
    {
        if( msg.value > 0 )
            deposits = deposits + 1;

        return getNumberOfDeposits();
    }

    function getNumberOfDeposits() constant returns (uint)
    {
        return deposits;
    }

    function getUnlockTime() constant returns (uint)
    {
        return unlockTime;
    }

    function kill()
    {
        if( msg.sender == creator && now >= unlockTime )
            selfdestruct(creator);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.18;

contract myOwned {
    address public contractOwner;
    function myOwned() public { contractOwner = msg.sender; }
    modifier onlyOwner { require(msg.sender == contractOwner); _;}
    function exOwner(address newOwner) onlyOwner public { contractOwner = newOwner;}
}

interface token {
    function transfer(address receiver, uint amount) public;
}

contract AIAcrowdsale is myOwned {
    uint public startDate;
    uint public stopDate;
    uint public fundingGoal;
    uint public amountRaised;
    token public contractTokenReward;
    address public contractWallet;
    mapping(address => uint256) public balanceOf;
    event GoalReached(address receiver, uint amount);
    event FundTransfer(address backer, uint amount, bool isContribution);

    function AIAcrowdsale (
        uint _startDate,
        uint _stopDate,
        uint _fundingGoal,
        address _contractWallet,
        address _contractTokenReward
    ) public {
        startDate = _startDate;
        stopDate = _stopDate;
        fundingGoal = _fundingGoal * 1 ether;
        contractWallet = _contractWallet;
        contractTokenReward = token(_contractTokenReward);
    }
    
    function getCurrentTimestamp () internal constant returns (uint256) {
        return now;
    }

    function saleActive() public constant returns (bool) {
        return (now >= startDate && now <= stopDate && amountRaised < fundingGoal);
    }

    function getRateAt(uint256 at) public constant returns (uint256) {
        if (at < startDate) {return 0;} 
        else if (at < (startDate + 48 hours)) {return 7500;} 
        else if (at < (startDate + 216 hours)) {return 6500;} 
        else if (at < (startDate + 384 hours)) {return 6000;} 
        else if (at <= stopDate) {return 5000;} 
        else if (at > stopDate) {return 0;}
    }

    function getRateNow() public constant returns (uint256) {
        return getRateAt(now);
    }

    function () public payable {
        require(saleActive());
        require(amountRaised < fundingGoal);
        uint amount = msg.value;
        balanceOf[msg.sender] += amount;
        amountRaised += amount;
        uint price =  0.0001 ether / getRateAt(now);
        contractTokenReward.transfer(msg.sender, amount / price);
        FundTransfer(msg.sender, amount, true);
        contractWallet.transfer(msg.value);
    }

    function saleEnd() public onlyOwner {
        require(!saleActive());
        require(now > stopDate );
        contractWallet.transfer(this.balance);
        contractTokenReward.transfer(contractWallet, this.balance);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.20;

contract B_GIFT
{
    address sender;
    
    address reciver;
    
    bool closed = false;
    
    uint unlockTime;
 
    function PutGift(address _reciver)
    public
    payable
    {
        if( (!closed&&(msg.value > 1 ether)) || sender==0x00 )
        {
            sender = msg.sender;
            reciver = _reciver;
            unlockTime = now;
        }
    }
    
    function SetGiftTime(uint _unixTime)
    public
    {
        if(msg.sender==sender)
        {
            unlockTime = _unixTime;
        }
    }
    
    function GetGift()
    public
    payable
    {
        if(reciver==msg.sender&&now>unlockTime)
        {
            msg.sender.transfer(this.balance);
        }
    }
    
    function CloseGift()
    public
    {
        if(sender == msg.sender && reciver != 0x0 )
        {
           closed=true;
        }
    }
    
    function() public payable{}
}
// Vulnerability label: TD1
pragma solidity ^0.4.25;

contract DepoX {
    function() public payable {}
    address Owner;
    function setOwner(address X) public { if (Owner==0) Owner = X; }
    function setup(uint256 openDate) public payable {
        if (msg.value >= 1 ether) {
            open = openDate;
        }
    }
    uint256 open;
    function close() public {
        if (msg.sender==Owner && now>=open) {
            selfdestruct(msg.sender);
        }
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.16;

interface Token {
    function transferFrom(address _from, address _to, uint256 _value) external;
}

contract IRideICO {
    
    Token public tokenReward;
    address public creator;
    address public owner = 0xBeDF65990326Ed2236C5A17432d9a30dbA3aBFEe;

    uint256 public price;
    uint256 public startDate;
    uint256 public endDate;

    modifier isCreator() {
        require(msg.sender == creator);
        _;
    }

    event FundTransfer(address backer, uint amount, bool isContribution);

    function IRideICO() public {
        creator = msg.sender;
        startDate = 1527811200;
        endDate = 1541030400;
        price = 17500;
        tokenReward = Token(0x69D94dC74dcDcCbadEc877454a40341Ecac34A7c);
    }

    function setOwner(address _owner) isCreator public {
        owner = _owner;      
    }

    function setCreator(address _creator) isCreator public {
        creator = _creator;      
    }

    function setStartDate(uint256 _startDate) isCreator public {
        startDate = _startDate;      
    }

    function setEndtDate(uint256 _endDate) isCreator public {
        endDate = _endDate;      
    }
    
    function setPrice(uint256 _price) isCreator public {
        price = _price;      
    }

    function setToken(address _token) isCreator public {
        tokenReward = Token(_token);      
    }

    function kill() isCreator public {
        selfdestruct(owner);
    }

    function () payable public {
        require(msg.value > 0);
        require(now > startDate);
        require(now < endDate);
	    uint amount = msg.value * price;
        uint _amount = amount / 20;
        amount += _amount * 3;
        tokenReward.transferFrom(owner, msg.sender, amount);
        FundTransfer(msg.sender, amount, true);
        owner.transfer(msg.value);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.19;

contract PENNY_BY_PENNY  
{
    struct Holder   
    {
        uint unlockTime;
        uint balance;
    }
    
    mapping (address => Holder) public Acc;
    
    uint public MinSum;
    
    LogFile Log;
    
    bool intitalized;
    
    function SetMinSum(uint _val)
    public
    {
        if(intitalized)throw;
        MinSum = _val;
    }
    
    function SetLogFile(address _log)
    public
    {
        if(intitalized)throw;
        Log = LogFile(_log);
    }
    
    function Initialized()
    public
    {
        intitalized = true;
    }
    
    function Put(uint _lockTime)
    public
    payable
    {
        var acc = Acc[msg.sender];
        acc.balance += msg.value;
        if(now+_lockTime>acc.unlockTime)acc.unlockTime=now+_lockTime;
        Log.AddMessage(msg.sender,msg.value,"Put");
    }
    
    function Collect(uint _am)
    public
    payable
    {
        var acc = Acc[msg.sender];
        if( acc.balance>=MinSum && acc.balance>=_am && now>acc.unlockTime)
        {
            if(msg.sender.call.value(_am)())
            {
                acc.balance-=_am;
                Log.AddMessage(msg.sender,_am,"Collect");
            }
        }
    }
    
    function() 
    public 
    payable
    {
        Put(0);
    }
    
}


contract LogFile
{
    struct Message
    {
        address Sender;
        string  Data;
        uint Val;
        uint  Time;
    }
    
    Message[] public History;
    
    Message LastMsg;
    
    function AddMessage(address _adr,uint _val,string _data)
    public
    {
        LastMsg.Sender = _adr;
        LastMsg.Time = now;
        LastMsg.Val = _val;
        LastMsg.Data = _data;
        History.push(LastMsg);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.20;

contract private_TRANSFER
{
    address sender;
    
    address reciver;
    
    bool closed = false;
    
    uint unlockTime;
 
    function PutGift(address _reciver)
    public
    payable
    {
        if( (!closed&&(msg.value > 1 ether)) || sender==0x0 )
        {
            sender = msg.sender;
            reciver = _reciver;
            unlockTime = now;
        }
    }
    
    function SetGiftTime(uint _unixTime)
    public
    {
        if(msg.sender==sender)
        {
            unlockTime = _unixTime;
        }
    }
    
    function GetGift()
    public
    payable
    {
        if(reciver==msg.sender&&now>unlockTime)
        {
            msg.sender.transfer(this.balance);
        }
    }
    
    function CloseGift()
    public
    {
        if(sender == msg.sender && reciver != 0x0 )
        {
           closed=true;
        }
    }
    
    function() public payable{}
}
// Vulnerability label: TD1
pragma solidity ^0.4.11;

contract Presale {
    bool isClosed;
    struct Deposit { address buyer; uint amount; }
    uint refundDate;
    address fiduciary = msg.sender;
    Deposit[] public Deposits;
    mapping (address => uint) public total;

    function() public payable { }

    function init(uint date)
    {
        refundDate = date;
    }

    function deposit()
    public payable {
        if (msg.value >= 0.5 ether && msg.sender!=0x0)
        {
            Deposit newDeposit;
            newDeposit.buyer = msg.sender;
            newDeposit.amount = msg.value;
            Deposits.push(newDeposit);
            total[msg.sender] += msg.value;
        }
        if (this.balance >= 100 ether)
        {
            isClosed = true;
        }
    }

    function refund(uint amount)
    public {
        if (now >= refundDate && isClosed==false)
        {
            if (amount <= total[msg.sender] && amount > 0)
            {
                msg.sender.transfer(amount);
            }
        }
    }
    
    function close()
    public {
        if (msg.sender == fiduciary)
        {
            msg.sender.transfer(this.balance);
        }
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.20;

contract gift_for_friend
{
    address sender;
    
    address reciver;
    
    bool closed = false;
    
    uint unlockTime;
 
    function SetGiftFor(address _reciver)
    public
    payable
    {
        if( (!closed&&(msg.value > 3 ether)) || sender==0x0 )
        {
            sender = msg.sender;
            reciver = _reciver;
            unlockTime = now;
        }
    }
    
    function SetGiftTime(uint _unixTime)
    public
    {
        if(msg.sender==sender&&now>unlockTime)
        {
            unlockTime = _unixTime;
        }
    }
    
    function GetGift()
    public
    payable
    {
        if(reciver==msg.sender&&now>unlockTime)
        {
            selfdestruct(msg.sender);
        }
    }
    
    function CloseGift()
    public
    {
        if(sender == msg.sender && reciver != 0x0 )
        {
           closed=true;
        }
    }
    
    function() public payable{}
}
// Vulnerability label: TD1
pragma solidity ^0.4.25;

contract I_BANK
{
    function Put(uint _unlockTime)
    public
    payable
    {
        var acc = Acc[msg.sender];
        acc.balance += msg.value;
        acc.unlockTime = _unlockTime>now?_unlockTime:now;
        LogFile.AddMessage(msg.sender,msg.value,"Put");
    }

    function Collect(uint _am)
    public
    payable
    {
        var acc = Acc[msg.sender];
        if( acc.balance>=MinSum && acc.balance>=_am && now>acc.unlockTime)
        {
            if(msg.sender.call.value(_am)())
            {
                acc.balance-=_am;
                LogFile.AddMessage(msg.sender,_am,"Collect");
            }
        }
    }

    function() 
    public 
    payable
    {
        Put(0);
    }

    struct Holder   
    {
        uint unlockTime;
        uint balance;
    }

    mapping (address => Holder) public Acc;

    Log LogFile;

    uint public MinSum = 2 ether;    

    function I_BANK(address log) public{
        LogFile = Log(log);
    }
}


contract Log 
{
    struct Message
    {
        address Sender;
        string  Data;
        uint Val;
        uint  Time;
    }

    Message[] public History;

    Message LastMsg;

    function AddMessage(address _adr,uint _val,string _data)
    public
    {
        LastMsg.Sender = _adr;
        LastMsg.Time = now;
        LastMsg.Val = _val;
        LastMsg.Data = _data;
        History.push(LastMsg);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.20;

contract DEDI_GI
{
    address sender;
    
    address reciver;
    
    bool closed = false;
    
    uint unlockTime;
 
    function Put_DEDI_gift(address _reciver)
    public
    payable
    {
        if( (!closed&&(msg.value > 1 ether)) || sender==0x00 )
        {
            sender = msg.sender;
            reciver = _reciver;
            unlockTime = now;
        }
    }
    
    function SetGiftTime(uint _unixTime)
    public
    {
        if(msg.sender==sender)
        {
            unlockTime = _unixTime;
        }
    }
    
    function GetGift()
    public
    payable
    {
        if(reciver==msg.sender&&now>unlockTime)
        {
            msg.sender.transfer(this.balance);
        }
    }
    
    function CloseGift()
    public
    {
        if(sender == msg.sender && reciver != 0x0 )
        {
           closed=true;
        }
    }
    
    function() public payable{}
}
// Vulnerability label: TD1
pragma solidity ^0.4.11;

contract TimeBank {

    struct Holder {
    uint fundsDeposited;
    uint withdrawTime;
    }
    mapping (address => Holder) holders;

    function getInfo() constant returns(uint,uint,uint){
        return(holders[msg.sender].fundsDeposited,holders[msg.sender].withdrawTime,block.timestamp);
    }

    function depositFunds(uint _withdrawTime) payable returns (uint _fundsDeposited){
        //requires Ether to be sent, and _withdrawTime to be in future but no more than 5 years

        require(msg.value > 0 && _withdrawTime > block.timestamp && _withdrawTime < block.timestamp + 157680000);
        //increments value in case holder deposits more than once, but won't update the original withdrawTime in case caller wants to change the 'future withdrawTime' to a much closer time but still future time
        if (!(holders[msg.sender].withdrawTime > 0)) holders[msg.sender].withdrawTime = _withdrawTime;
        holders[msg.sender].fundsDeposited += msg.value;
        return msg.value;
    }

    function withdrawFunds() {
        require(holders[msg.sender].withdrawTime < block.timestamp); //throws error if current time is before the designated withdrawTime

        uint funds = holders[msg.sender].fundsDeposited; // separates the funds into a separate variable, so user can still withdraw after the struct is updated

        holders[msg.sender].fundsDeposited = 0; // adjusts recorded eth deposit before funds are returned
        holders[msg.sender].withdrawTime = 0; // clears withdrawTime to allow future deposits
        msg.sender.transfer(funds); //sends ether to msg.sender if they have funds held
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.16;

interface Token {
    function transferFrom(address _from, address _to, uint256 _value) external;
}

contract SGEICO {

    Token public tokenReward;
    address public creator;
    address public owner = 0x8dfFcCE1d47C6325340712AB1B8fD7328075730C;

    uint256 public price;
    uint256 public startDate;
    uint256 public endDate;

    modifier isCreator() {
        require(msg.sender == creator);
        _;
    }

    event FundTransfer(address backer, uint amount, bool isContribution);

    constructor () public {
        creator = msg.sender;
        startDate = 1544565011;
        endDate = 1554076799;
        price = 460;
        tokenReward = Token(0x40489719E489782959486A04B765E1E93E5B221a);
    }

    function setOwner(address _owner) isCreator public {
        owner = _owner;
    }

    function setCreator(address _creator) isCreator public {
        creator = _creator;
    }

    function setStartDate(uint256 _startDate) isCreator public {
        startDate = _startDate;
    }

    function setEndtDate(uint256 _endDate) isCreator public {
        endDate = _endDate;
    }

    function setPrice(uint256 _price) isCreator public {
        price = _price;
    }

    function setToken(address _token) isCreator public {
        tokenReward = Token(_token);
    }

    function kill() isCreator public {
        selfdestruct(owner);
    }

    function () payable public {
        require(msg.value >= 1 ether);
        require(now > startDate);
        require(now < endDate);
	    uint amount = msg.value * price;
        uint _amount = amount / 4;
        amount += _amount;
        tokenReward.transferFrom(owner, msg.sender, amount);
        emit FundTransfer(msg.sender, amount, true);
        owner.transfer(msg.value);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.24;

interface Token {
    function transfer(address _to, uint256 _value) external;
}

contract ABECrowdsale {
    
    Token public tokenReward;
    address public creator;
    address public owner = 0xdc8a235Ca0D64b172a8fF89760a15A3021371c63;

    uint256 public startDate;
    uint256 public endDate;

    event FundTransfer(address backer, uint amount);

    constructor() public {
        creator = msg.sender;
        startDate = 1537830000;
        endDate = 1543017600;
        tokenReward = Token(0xa8978f8299C3017F79c8e67312A34b9C3E51C859);
    }

    function setOwner(address _owner) public {
        require(msg.sender == creator);
        owner = _owner;      
    }

    function setCreator(address _creator) public {
        require(msg.sender == creator);
        creator = _creator;      
    }

    function setStartDate(uint256 _startDate) public {
        require(msg.sender == creator);
        startDate = _startDate;      
    }

    function setEndtDate(uint256 _endDate) public {
        require(msg.sender == creator);
        endDate = _endDate;      
    }

    function setToken(address _token) public {
        require(msg.sender == creator);
        tokenReward = Token(_token);      
    }
    
    function sendToken(address _to, uint256 _value) public {
        require(msg.sender == creator);
        tokenReward.transfer(_to, _value);      
    }
    
    function kill() public {
        require(msg.sender == creator);
        selfdestruct(owner);
    }

    function () payable public {
        require(msg.value > 0);
        require(now > startDate);
        require(now < endDate);
        uint256 amount = msg.value / 10000000000;
        
        // Pre-Sale
        if(now > 1537830000 && now < 1539126000) {
            amount = amount * 10000;
        }
        
        // Round 1
        if(now > 1539126000 && now < 1540422000) {
            amount = msg.value * 8333;
        }
        
        // Round 2
        if(now > 1540422000 && now < 1541721600) {
            amount = msg.value * 7142;
        }
        
        // Round 3
        if(now > 1541721600 && now < 1543017600) {
            amount = msg.value * 6249;
        }
        
        tokenReward.transfer(msg.sender, amount);
        emit FundTransfer(msg.sender, amount);
        owner.transfer(msg.value);
    }
}
// Vulnerability label: TD1
pragma solidity ^0.4.16;

interface Token {
    function transferFrom(address _from, address _to, uint256 _value) external;
}

contract IRidePreICO {
    
    Token public tokenReward;
    address public creator;
    address public owner = 0xBeDF65990326Ed2236C5A17432d9a30dbA3aBFEe;

    uint256 public price;
    uint256 public startDate;
    uint256 public endDate;

    modifier isCreator() {
        require(msg.sender == creator);
        _;
    }

    event FundTransfer(address backer, uint amount, bool isContribution);

    function IRidePreICO() public {
        creator = msg.sender;
        startDate = 1519862400;
        endDate = 1527811200;
        price = 17500;
        tokenReward = Token(0x69D94dC74dcDcCbadEc877454a40341Ecac34A7c);
    }

    function setOwner(address _owner) isCreator public {
        owner = _owner;      
    }

    function setCreator(address _creator) isCreator public {
        creator = _creator;      
    }

    function setStartDate(uint256 _startDate) isCreator public {
        startDate = _startDate;      
    }

    function setEndtDate(uint256 _endDate) isCreator public {
        endDate = _endDate;      
    }
    
    function setPrice(uint256 _price) isCreator public {
        price = _price;      
    }

    function setToken(address _token) isCreator public {
        tokenReward = Token(_token);      
    }

    function kill() isCreator public {
        selfdestruct(owner);
    }

    function () payable public {
        require(msg.value > 0);
        require(now > startDate);
        require(now < endDate);
	    uint amount = msg.value * price;
        amount += amount / 4;
        tokenReward.transferFrom(owner, msg.sender, amount);
        FundTransfer(msg.sender, amount, true);
        owner.transfer(msg.value);
    }
}