Newbie here. Really excited to be joining the community.

I've been trying to compile a basic timelock contract. I've finally managed to deploy it but I can only set the release time to 100000000000000 seconds. Anything under that I get this error message. enter image description here

I've tried varius networks, including Mainnet and i still get the same error message.

I also tried altering the block.timestamp in the construtor to +1 and -1 to see if that would help... No joy.

Any advice or help would be greatly appreciated. Thank you

PS I'm using remix

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./SafeERC20.sol";

 * @dev A token holder contract that will allow a beneficiary to extract the
 * tokens after a given release time.
 * Useful for simple vesting schedules like "advisors get all of their tokens
 * after 1 year".
contract TokenTimelock {
    using SafeERC20 for IERC20;

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

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

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

    constructor (IERC20 token_, address beneficiary_, uint256 releaseTime_) {
        // solhint-disable-next-line not-rely-on-time
        require(releaseTime_ > block.timestamp, "TokenTimelock: release time is before current time");
        _token = token_;
        _beneficiary = beneficiary_;
        _releaseTime = releaseTime_;

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

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

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

     * @notice Transfers tokens held by timelock to beneficiary.
    function release() public virtual {
        // solhint-disable-next-line not-rely-on-time
        require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time");

        uint256 amount = token().balanceOf(address(this));
        require(amount > 0, "TokenTimelock: no tokens to release");

        token().safeTransfer(beneficiary(), amount);

1 Answer 1


According to Solidity Docs block.timestamp returns the timestamp of current block in seconds since the epoch. That means how many seconds passed since January 1, 1970.

So, if you want to release your token after 1 years from now, you have to add 1 year to the current timestamp and pass that value.

You can manually add 31556926 * YEARS seconds to the today's timestamp, or you can use a app to make it.

For your error, I think this error happens because 100000000000000 seconds is approximately 3 million years, and that's a HUGE number.

  • Thanks so much! This worked. Really appreciate it :) Commented Jun 7, 2021 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.