SafeMoonFork - TimeLockFunction

Hello everyone

So I am not the best programmer, but I played around with the SafeMoonFork on BSC (BEP20), and launched my own Token

In this context, I used the TimeLock function [Lock (uint256)] to lock the access to the function for a set period of time in UNIX TIMESTAMP. I used the Unix Time Stamp “1621393167”

By now, the contract should have unlocked, and I should have gotten access to the functions again, but this is not the case - when I try to write any function, the transaction costs approximately 0.3 BNB, which must mean something is wrong

I have the TX# and when I go on Overview - See More → Decode Input Data I see the following;

0 time uint256 1621393167

This means that it should have been unlocked by now. However if I go to logs I see this:

OwnershipTransferred (index_topic_1 address previousOwner, index_topic_2 address newOwner)

  • 1 Dec [0x0000000000000000000000000000000000000000]
  • 2 Dec [0x0000000000000000000000000000000000000000]

Which is a dead address I believe

Please advice. I would like to learn what I did wrong…

Best regards :slight_smile:

If I go to ReadContract for geUnlockTime I read this:

" 3242776064 uint256"

The two functions from the code;

//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
    _previousOwner = _owner;
    _owner = address(0);
    _lockTime = now + time;
    emit OwnershipTransferred(_owner, address(0));

//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
    require(_previousOwner == msg.sender, "You don't have permission to unlock");
    require(now > _lockTime , "Contract is locked until 7 days");
    emit OwnershipTransferred(_owner, _previousOwner);
    _owner = _previousOwner;

The timestamp 3242776064 corresponds to a day in the year 2072.

I think this is what you did wrong:

The parameter to lock is a duration, so the number of seconds from now until you want it to unlock. It is not the timestamp of the moment when you want it to unlock.