ETH Price: $1,900.57 (-1.64%)
Gas: 0.41 Gwei
 
Transaction Hash
Method
Block
From
To
Release189283692024-01-03 17:38:35438 days ago1704303515IN
0xCDA3b86c...d8C983056
0 ETH0.0020210134.99045031

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenTimelock

Compiler Version
v0.5.2+commit.1df8f40c

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2019-01-23
*/

pragma solidity ^0.5.2;

// File: contracts/math/SafeMath.sol

/**
 * @title SafeMath
 * @dev Unsigned math operations with safety checks that revert on error
 */
library SafeMath {
    /**
    * @dev Multiplies two unsigned integers, reverts on overflow.
    */
    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-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b);

        return c;
    }

    /**
    * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
    * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a);
        uint256 c = a - b;

        return c;
    }

    /**
    * @dev Adds two unsigned integers, reverts on overflow.
    */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a);

        return c;
    }

    /**
    * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
    * reverts when dividing by zero.
    */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0);
        return a % b;
    }
}

// File: contracts/token/ERC20/IERC20.sol

/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
interface IERC20 {
    function transfer(address to, uint256 value) external returns (bool);

    function approve(address spender, uint256 value) external returns (bool);

    function transferFrom(address from, address to, uint256 value) external returns (bool);

    function totalSupply() external view returns (uint256);

    function balanceOf(address who) external view returns (uint256);

    function allowance(address owner, address spender) external view returns (uint256);

    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(address indexed owner, address indexed spender, uint256 value);
}

// File: contracts/token/ERC20/SafeERC20.sol

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure.
 * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        require(token.transfer(to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        require(token.transferFrom(from, to, value));
    }

    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require((value == 0) || (token.allowance(msg.sender, spender) == 0));
        require(token.approve(spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        require(token.approve(spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value);
        require(token.approve(spender, newAllowance));
    }
}

// File: contracts/token/ERC20/TokenTimelock.sol

/**
 * @title TokenTimelock
 * @dev TokenTimelock is a token holder contract that will allow a
 * beneficiary to extract the tokens after a given release time
 */
contract TokenTimelock {
    using SafeERC20 for IERC20;

    // ERC20 basic token contract being held
    IERC20 private _token;

    // beneficiary of tokens after they are released
    address private _beneficiary;

    // timestamp when token release is enabled
    uint256 private _releaseTime;

    constructor (IERC20 token, address beneficiary, uint256 releaseTime) public {
        // solhint-disable-next-line not-rely-on-time
        require(releaseTime > block.timestamp);
        _token = token;
        _beneficiary = beneficiary;
        _releaseTime = releaseTime;
    }

    /**
     * @return the token being held.
     */
    function token() public view returns (IERC20) {
        return _token;
    }

    /**
     * @return the beneficiary of the tokens.
     */
    function beneficiary() public view returns (address) {
        return _beneficiary;
    }

    /**
     * @return the time when the tokens are released.
     */
    function releaseTime() public view returns (uint256) {
        return _releaseTime;
    }

    /**
     * @notice Transfers tokens held by timelock to beneficiary.
     */
    function release() public {
        // solhint-disable-next-line not-rely-on-time
        require(block.timestamp >= _releaseTime);

        uint256 amount = _token.balanceOf(address(this));
        require(amount > 0);

        _token.safeTransfer(_beneficiary, amount);
    }
    
}

Contract Security Audit

Contract ABI

API
[{"constant":true,"inputs":[],"name":"beneficiary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"release","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"releaseTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"token","type":"address"},{"name":"beneficiary","type":"address"},{"name":"releaseTime","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]

608060405234801561001057600080fd5b506040516060806103298339810180604052606081101561003057600080fd5b508051602082015160409092015190919042811161004d57600080fd5b60008054600160a060020a03948516600160a060020a031991821617909155600180549390941692169190911790915560025561029a8061008f6000396000f3fe608060405234801561001057600080fd5b5060043610610068577c0100000000000000000000000000000000000000000000000000000000600035046338af3eed811461006d57806386d1a69f14610091578063b91d40011461009b578063fc0c546a146100b5575b600080fd5b6100756100bd565b60408051600160a060020a039092168252519081900360200190f35b6100996100cc565b005b6100a36101a1565b60408051918252519081900360200190f35b6100756101a7565b600154600160a060020a031690565b6002544210156100db57600080fd5b60008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a0823191602480820192602092909190829003018186803b15801561014057600080fd5b505afa158015610154573d6000803e3d6000fd5b505050506040513d602081101561016a57600080fd5b505190506000811161017b57600080fd5b60015460005461019e91600160a060020a0391821691168363ffffffff6101b616565b50565b60025490565b600054600160a060020a031690565b82600160a060020a031663a9059cbb83836040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561023257600080fd5b505af1158015610246573d6000803e3d6000fd5b505050506040513d602081101561025c57600080fd5b5051151561026957600080fd5b50505056fea165627a7a72305820bd2971d126ff856ac64f4d581673c9ff42960f38511985a148ee849a45c842c200290000000000000000000000009992ec3cf6a55b00978cddf2b27bc6882d88d1ec00000000000000000000000083f90c20e5bb62971022bee3cb048f649c125441000000000000000000000000000000000000000000000000000000006592a940

Deployed Bytecode

0x608060405234801561001057600080fd5b5060043610610068577c0100000000000000000000000000000000000000000000000000000000600035046338af3eed811461006d57806386d1a69f14610091578063b91d40011461009b578063fc0c546a146100b5575b600080fd5b6100756100bd565b60408051600160a060020a039092168252519081900360200190f35b6100996100cc565b005b6100a36101a1565b60408051918252519081900360200190f35b6100756101a7565b600154600160a060020a031690565b6002544210156100db57600080fd5b60008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a0823191602480820192602092909190829003018186803b15801561014057600080fd5b505afa158015610154573d6000803e3d6000fd5b505050506040513d602081101561016a57600080fd5b505190506000811161017b57600080fd5b60015460005461019e91600160a060020a0391821691168363ffffffff6101b616565b50565b60025490565b600054600160a060020a031690565b82600160a060020a031663a9059cbb83836040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561023257600080fd5b505af1158015610246573d6000803e3d6000fd5b505050506040513d602081101561025c57600080fd5b5051151561026957600080fd5b50505056fea165627a7a72305820bd2971d126ff856ac64f4d581673c9ff42960f38511985a148ee849a45c842c20029

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000009992ec3cf6a55b00978cddf2b27bc6882d88d1ec00000000000000000000000083f90c20e5bb62971022bee3cb048f649c125441000000000000000000000000000000000000000000000000000000006592a940

-----Decoded View---------------
Arg [0] : token (address): 0x9992eC3cF6A55b00978cdDF2b27BC6882d88D1eC
Arg [1] : beneficiary (address): 0x83f90c20e5bB62971022Bee3cB048F649C125441
Arg [2] : releaseTime (uint256): 1704110400

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000009992ec3cf6a55b00978cddf2b27bc6882d88d1ec
Arg [1] : 00000000000000000000000083f90c20e5bb62971022bee3cb048f649c125441
Arg [2] : 000000000000000000000000000000000000000000000000000000006592a940


Swarm Source

bzzr://bd2971d126ff856ac64f4d581673c9ff42960f38511985a148ee849a45c842c2

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.