0

I'm trying to make a function that uses unix timestamp for setting a limited time and after the limited time is over I would like to make clients get their token by themselves Does anyone have any idea or help? Thanks!

0

Here's a small example on how it could work:

pragma solidity ^0.4.24;

contract TimedTokenVault {
    uint256 startTime;

    function setStartTime(uint256 _startTime) public {
        // add access restrictions and/or make sure this can be called only once

        startTime = _startTime;
    }

    // Clients can call this after the startTime
    function requestToken() public {
        require(startTime > now, "Sorry, token requests is not open yet");

        // transfer token(s)
    }
}

The example is missing a lot of required code but you should get the idea. After checking the startTime in requestToken you can probably use regular token transfer method to transfer the tokens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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