Trying to deploy TokenTimelock.sol and I don't know how to use the releaseTime_ field

Hello again, I'm trying to check out TokenTimelock.sol on Remix just to see how it works, and while I'm on the deployment field, there are 3 things that I need to fill in before I can deploy. The first 2 boxes are the address of the tokens, and the 2nd is the address of who's going to receive some tokens. The 3rd field is the one I'm stuck on, the releaseTime_ field. If I put in a number, the Remix log will spit out the error in the smart contract: "TokenTimelock: release time is before current time". I tried putting 60, thinking that releaseTime_ meant that the tokens would release in 60 seconds. That didn't work. I put 0, thinking, "Oh, maybe the current time needs to be 0 seconds from now." That didn't work either. What value am I supposed to type? The date? The time? A bunch of seconds? Thanks for reading this. :slightly_smiling_face:

Here is a snip of the field and the remix console:

ReleaseTime_ Issue

Release Remix Console

Should be unix timestamp, the seconds from Jan 1 1970, and "60" might not be enough depending on the block mining speed. Should work on ganache.

But it depends on how the contract was written.

Try "2 minutes"

I tried "2 minutes" and then "120" but neither of those things helped. Let me see if I can get this converter to work. Thanks for responding, Annabelle.

OK, I used the converter and the transaction worked! But I don't see the tokens (not that I actually have a token contract but I just wanted to see how TokenTimelock.sol worked). Do I have to have a token contract to really see what's going on?

And one more thing: when the transaction went through, what exactly happened in those 2 minutes (well, it wasn't truly 2 minutes but you get what I'm saying)? Were the tokens locked up for that time and then released, or did I just happen to press the transact button at the right time so that tokens could be released really soon? Especially since the time that I clicked the button wasn't the same time as the Unix time I put in the field. Thanks so much for your help, @Annabelle75 !

out of curiosity, what blockchain are you using and what was the minimum epoch time difference to get it to pass?

I'd need to see the contract(s) you put in, but if it's the standard token, recipient, timelock it depends -- either the next call of the contract past the timelock will release it, or the recipient has to go withdraw them... ...depends on how it's written. Check the tx logs to follow your tokens.

BSC Testnet is super fast (three second block times) for testing real-world functionality Vs. rop/rinkleby.

Sorry for the late response. (1) I'm using Remix with the JavaScript VM (London). (2) As far as the token itself, it's on BSC Testnet. (3) I'm not sure what "minimum epoch time difference" is, is that the Unix time I need to put in the releaseTime_ field? (4) All I deployed in Remix was the TokenTimelock.sol file I found from OpenZeppelin at Github, just to try it out (I also imported SafeERC20.sol, IERC20.sol, and Address.sol so TokenTimelock could be deployed properly). (5) I don't think the recipient will need to withdraw them (but then again, maybe, because I want them to be able to claim their tokens after a time). (6) What are tx logs, is it the remix console? I hate to ask so many questions, but I'm still a newbie, and I appreciate all the help. :grinning_face_with_smiling_eyes:

OK, I found a token contract from GitHub that was demonstrating how to use TokenTimelock, but now I'm not understanding how to give my accounts an allowance for tokens for them to spend. I went in the approve field to give the address of TokenTimelock.sol an approval of 100,000 tokens to spend (thinking that by doing so, 100,000 tokens would go into that account, but that doesn't really make sense). But when I went to the transferFrom field (to give some tokens to another account from the contract account), I put in 2 addresses and a value, but Remix said, "The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance." I was confused because I thought I'd just gave a 100,000 token allowance. Then I called the balanceOf function for the contract address, and it said 0. So, how do I give an account an allowance of tokens to spend, based on these functions from the GitHub token file:

No Allowance

There's no addAllowance button or anything, unless I'm missing something. I clicked on allowance but all I could see were 2 address fields, and I'm not sure what to do with them. It seems like the function would only be able to tell how much each address has to spend, instead of actually giving an allowance.

No Allowance (2)

What should I do? Thanks for helping me out in advance.

I apologize I haven't had the time to look at the contracts.

I doubt the tokentimelock is "mintable", which means from what you've posted you're sending tokens to the contract, with the beneficiary and timelock time duration. Meaning, if there's not tokens on the contract address, it can't send any.

Approve gives permission to spend, like when you're on pancakeswap and it asks you to approve the trading of (whatever) coin. In that case, you're approving permission to swap, not to withdraw from you without you sending them (that'd be a minting function).

Epoch time is just the unix time, but if you were on the java vm any amount of seconds ahead of the current epoch time/seconds from jan 1 1970 should've worked.

Ah, OK! I don't necessarily want a mint function, especially now that I have taken a moment to truly understand what I'm trying to make. And now that you say something, I thought that my token.sol contract had some actual tokens, but I guess not. And the approve function is like the metamask thing that comes up to ask "Approve SuchandSuchSwap to swap your tokens?", gotcha. Thanks, @Annabelle75 !