Contract Overview | TheAbyssLockedTokens
Balance: 0 Ether
Ether Value: $0
Transactions: 1 txn
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Similar Match)
Note: Displaying Similar Match Verified Source Code At Contract 0x038758e98f3a764f928ea82e39b7ac78db333fad(Excluding Constructor Arguments if_any)
Contract Name: LockedTokens
Compiler Text: v0.4.21+commit.dfe3193c
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.21;

// File: contracts/math/SafeMath.sol

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
contract SafeMath {
    /**
    * @dev constructor
    */
    function SafeMath() public {
    }

    function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a * b;
        assert(a == 0 || c / a == b);
        return c;
    }

    function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a / b;
        return c;
    }

    function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(a >= b);
        return a - b;
    }

    function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }
}

// File: contracts/token/IERC20Token.sol

/**
 * @title IERC20Token - ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract IERC20Token {
    string public name;
    string public symbol;
    uint8 public decimals;
    uint256 public totalSupply;

    function balanceOf(address _owner) public constant returns (uint256 balance);
    function transfer(address _to, uint256 _value)  public returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value)  public returns (bool success);
    function approve(address _spender, uint256 _value)  public returns (bool success);
    function allowance(address _owner, address _spender)  public constant returns (uint256 remaining);

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}

// File: contracts/token/LockedTokens.sol

/**
 * @title LockedTokens
 * @dev Lock tokens for certain period of time
 */
contract LockedTokens is SafeMath {
    struct Tokens {
        uint256 amount;
        uint256 lockEndTime;
        bool released;
    }

    event TokensUnlocked(address _to, uint256 _value);

    IERC20Token public token;
    address public crowdsaleAddress;
    mapping(address => Tokens[]) public walletTokens;

    /**
     * @dev LockedTokens constructor
     * @param _token ERC20 compatible token contract
     * @param _crowdsaleAddress Crowdsale contract address
     */
    function LockedTokens(IERC20Token _token, address _crowdsaleAddress) public {
        token = _token;
        crowdsaleAddress = _crowdsaleAddress;
    }

    /**
     * @dev Functions locks tokens
     * @param _to Wallet address to transfer tokens after _lockEndTime
     * @param _amount Amount of tokens to lock
     * @param _lockEndTime End of lock period
     */
    function addTokens(address _to, uint256 _amount, uint256 _lockEndTime) external {
        require(msg.sender == crowdsaleAddress);
        walletTokens[_to].push(Tokens({amount: _amount, lockEndTime: _lockEndTime, released: false}));
    }

    /**
     * @dev Called by owner of locked tokens to release them
     */
    function releaseTokens() public {
        require(walletTokens[msg.sender].length > 0);

        for(uint256 i = 0; i < walletTokens[msg.sender].length; i++) {
            if(!walletTokens[msg.sender][i].released && now >= walletTokens[msg.sender][i].lockEndTime) {
                walletTokens[msg.sender][i].released = true;
                token.transfer(msg.sender, walletTokens[msg.sender][i].amount);
                TokensUnlocked(msg.sender, walletTokens[msg.sender][i].amount);
            }
        }
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"crowdsaleAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"walletTokens","outputs":[{"name":"amount","type":"uint256"},{"name":"lockEndTime","type":"uint256"},{"name":"released","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"releaseTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_lockEndTime","type":"uint256"}],"name":"addTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_crowdsaleAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"TokensUnlocked","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6060604052341561000f57600080fd5b60405160408061058b833981016040528080519190602001805160008054600160a060020a03958616600160a060020a031991821617909155600180549590921694169390931790925550506105218061006a6000396000f30060606040526004361061006c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166331d2f891811461007157806375090b67146100a0578063a96f8668146100e8578063ca056aed146100fd578063fc0c546a14610122575b600080fd5b341561007c57600080fd5b610084610135565b604051600160a060020a03909116815260200160405180910390f35b34156100ab57600080fd5b6100c2600160a060020a0360043516602435610144565b604051928352602083019190915215156040808301919091526060909101905180910390f35b34156100f357600080fd5b6100fb610188565b005b341561010857600080fd5b6100fb600160a060020a03600435166024356044356103e0565b341561012d57600080fd5b610084610482565b600154600160a060020a031681565b60026020528160005260406000208181548110151561015f57fe5b600091825260209091206003909102018054600182015460029092015490935090915060ff1683565b600160a060020a0333166000908152600260205260408120548190116101ad57600080fd5b5060005b600160a060020a0333166000908152600260205260409020548110156103dd57600160a060020a03331660009081526002602052604090208054829081106101f557fe5b600091825260209091206002600390920201015460ff1615801561024e5750600160a060020a033316600090815260026020526040902080548290811061023857fe5b9060005260206000209060030201600101544210155b156103d557600160a060020a03331660009081526002602052604090208054600191908390811061027b57fe5b6000918252602080832060026003909302018201805494151560ff1990951694909417909355815433600160a060020a0381811685529290945260409092208054919092169263a9059cbb929091859081106102d357fe5b9060005260206000209060030201600001546040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561034157600080fd5b5af1151561034e57600080fd5b5050506040518051505033600160a060020a038116600090815260026020526040902080547fe7b379c6c1fa169e9079c25e9143b127637eef8ec8c9d5c06ddb4ab3e1195888929190849081106103a157fe5b906000526020600020906003020160000154604051600160a060020a03909216825260208201526040908101905180910390a15b6001016101b1565b50565b60015433600160a060020a039081169116146103fb57600080fd5b600160a060020a03831660009081526002602052604090208054600181016104238382610491565b91600052602060002090600302016000606060405190810160409081528682526020820186905260009082015291905081518155602082015181600101556040820151600291909101805460ff19169115159190911790555050505050565b600054600160a060020a031681565b8154818355818115116104bd576003028160030283600052602060002091820191016104bd91906104c2565b505050565b6104f291905b808211156104ee576000808255600182015560028101805460ff191690556003016104c8565b5090565b905600a165627a7a72305820ac3041b85c9f75c4e1ed1a4d49fb4b9c44790b956ed3371d86c330f29355432200290000000000000000000000006a546617fd8c74555a2cb63b7b064331de82f68d000000000000000000000000770b05bec95bbfdd90a9e46c48fcb101e70ebf9b

   Swarm Source:
bzzr://ac3041b85c9f75c4e1ed1a4d49fb4b9c44790b956ed3371d86c330f293554322

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.