`pragma solidity ^0.6.6;

contract timeBound{

uint256 timeLocked = 1589026500;

event Transfer(address _from, address _to, uint256);

mapping(address => uint256) private balance;

modifier timeChecker{
    require(block.timestamp >= timeLocked, "ERC20: time locked for certain period");

function lockCall() public timeChecker {
    uint256 value = 10;
    address receiver = 0xDd395D13d892Fb482e5E7392e0f58BC4F55c9d69;

    require(msg.sender != address(0));

    balance[receiver] = balance[receiver] + value;
    emit Transfer(address(msg.sender), address(receiver), value);

//This balanceOf() function not returns the token balance of this contract
function balanceOf(address account) public view returns(uint256){
    return balance[account];


in the above contract timeLocked variable is used for next 15 minutes, and require(block.timestamp >= timestamp) is checking, when i deployed it on ropsten testnet, the receiver gets tokens immediately before the desire time. how to counter this issue?

balanceOf function not returns the contract token balance but the contract has tokens which will transfer in the lockCall function to the given address.

  • Next 15 minutes from when? Your question was already posted 15 minutes ago by now, and I would imagine that you had deployed your contract some time before posting your question. In short, why on earth are you using the constant 1589026500 for a timestamp??? Commented May 12, 2020 at 7:57
  • using 1589026500 uinx time, next 15 minutes when i deploy contract,
    – sultan
    Commented May 12, 2020 at 8:10
  • But your question becomes irrelevant within 15 minutes from that moment, and probably within much less than 15 minutes from when you post it. So what exactly is the point in posting it? Commented May 12, 2020 at 8:17
  • ok, forget it, it was taken as assumption not a fixed, you can take any time to lock tokens, 1 day, 1 week, 1 month and so on
    – sultan
    Commented May 12, 2020 at 9:25

1 Answer 1


So it's not immediately clear from your code exactly what you're trying to achieve. However - one quick comment that might help:

You appear to be hard-coding the timestamp - this could cause you problems unless you remember to change it every time you deploy and test the code. You could add timeLocked = block.timestamp + 15 minutes into a constructor function to at least test that you're in sync with the time of the blockchain you're using

  • This answer is as good as it gets. Commented May 12, 2020 at 7:59

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.