# Using TokenTimelock with Remix

**URL:** <https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918>\
**Category:** Contracts\
**Tags:** erc20\
**Created:** [June 21, 2019, 11:32pm UTC](https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918 "2019-06-21T23:32:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![btc58](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/btc58/32/1076_2.png) [@btc58](https://forum.openzeppelin.com/u/btc58)\
**Post date:** [June 21, 2019, 11:32pm UTC](https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918/1 "2019-06-21T23:32:18Z")

</div>

Hey, I just launched a token on the main net for fun

I was wondering how to lock any erc20 token into a contract address  
I came to this article but still don’t know how to implement it, Do I use mew, or deploy a new contract with remix Ethereum IDE and send it to the contract address.

> **[ERC 20 · OpenZeppelin](https://docs.openzeppelin.org/v2.3.0/api/token/erc20#tokentimelock)**
>
> This set of interfaces, contracts, and utilities are all related to the ERC20 Token Standard.

Can someone help me go through it step by step if you would.  
Thank you!

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [June 22, 2019, 12:24am UTC](https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918/2 "2019-06-22T00:24:20Z")

</div>

Welcome to the community @btc58

Congratulations on deploying an ERC20 token to mainnet.

The tests are a good place to start for contracts where there isn’t a guide yet.  
[https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/test/token/ERC20/TokenTimelock.test.js](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/test/token/ERC20/TokenTimelock.test.js)

Do you use Truffle?  
Have a look at this similar question in the forum:

> [@How to use TokenTimelock.sol to lock up tokens?](https://forum.openzeppelin.com/t/how-to-use-tokentimelock-sol-to-lock-up-tokens/738):
>
> Hello wonderful people! I am not a developer but I managed to use openzeppelin to create my first erc20 token for my game project! it’s working wonderfully. This is a wonderful project! Many thanks for all contributors blush I want to use TokenTimelock.sol to create a new contract so that I can send some tokens to it to lock them up for a specific time here’s my tokenlockup.sol file: pragma solidity ^0.5.2; import "openzeppelin-solidity/contracts/token/ERC20/TokenTimelock.sol"; contrac…

If you need step by step instructions for Remix I can try to put something together early next week.

---

<div class="post-metadata">

**Author:** ![btc58](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/btc58/32/1076_2.png) [@btc58](https://forum.openzeppelin.com/u/btc58)\
**Post date:** [June 22, 2019, 4:52pm UTC](https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918/3 "2019-06-22T16:52:03Z")

</div>

Hey thanks for the reply, very helpful.  
I use remix not truffle.  
If you don’t mind doing a step by step instruction for remix, that would great.  
Thanks for the help!

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [June 24, 2019, 5:54am UTC](https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918/4 "2019-06-24T05:54:37Z")

</div>

Hi @btc58

You can use the following instructions to deploy OpenZeppelin TokenTimelock with [Remix](https://remix.ethereum.org)

I deployed the [example SimpleToken](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/examples/SimpleToken.sol) ERC20 to Ropsten testnet and then deployed TokenTimelock. I recommend deploying on a testnet first before deploying to mainnet.

## Setup

Remix documentation: [https://remix.readthedocs.io](https://remix.readthedocs.io)

For the new version of Remix you will need to activate some plugins (if you haven’t already).  
Activate “Solidity Compiler” module plugin  
Activate “Deploy & Run Transactions” module plugin

From the home tab, File: “Import From”: GitHub the following files: (TokenTimelock and its dependencies)

- [https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/TokenTimelock.sol](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/TokenTimelock.sol)
- [https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/SafeERC20.sol](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/SafeERC20.sol)
- [https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/IERC20.sol](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/IERC20.sol)
- [https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol)
- [https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/utils/Address.sol](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/utils/Address.sol)

 ![RemixFileExplorerTokenTimelock](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/d35c330303233e289449b9a1ef067e2da3537419.png)

## Compile

In the Remix File Explorer select the smart contract, TokenTimelock.sol

Select the Solidity Compiler module (Activate the module if you haven’t already)  
Choose a compiler e.g. 0.5.9+commit.e560f70d  
Press Compile  
The compiler will advise if you are missing any imported contracts or libraries

 ![RemixCompilerTokenTimelock](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/ebf69727ea422ac01203281a258da5fc3e501560.png)

## Deploy

Select the “Deploy & Run Transactions” module (Activate the module if you haven’t already)  
If using MetaMask, change the Environment to InjectedWeb3.  
Recommend always first deploying to a testnet

Select the contract and specify any constructor values.  
For TokenTimelock specify:  
token address e.g. ERC20 token address  
beneficiary address e.g. External account to release tokens to  
releaseTime (seconds since unix epoch) e.g. 1569925800 (you can use an online converter such as [https://www.epochconvert.com/](https://www.epochconvert.com/))

Press Transact to deploy

 ![RemixDeployTokenTimelock](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/1X/05c4c43d5bf0dfeb7b953da45e42e67ffa3b253a.png)

## Transfer

Transfer the tokens to lock up for the beneficiary to the deployed TokenTimelock contract. I used Remix to transfer the tokens.

## Release

After the releaseTime has passed, anyone can call release on the deployed TokenTimelock contract, which transfers the tokens to the beneficiary.

I used Remix to call release.

* * *

Let me know if you have any problems with the instructions above.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [June 27, 2019, 8:29am UTC](https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918/5 "2019-06-27T08:29:18Z")

</div>

Hi @btc58

Just checking that you were able to deploy using the instructions for Remix?

Let me know if you have any questions.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [July 1, 2019, 12:01am UTC](https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918/6 "2019-07-01T00:01:21Z")

</div>

Housekeeping, marking my reply as the solution.

---

<div class="post-metadata">

**Author:** ![btc58](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/btc58/32/1076_2.png) [@btc58](https://forum.openzeppelin.com/u/btc58)\
**Post date:** [July 2, 2019, 1:40am UTC](https://forum.openzeppelin.com/t/using-tokentimelock-with-remix/918/7 "2019-07-02T01:40:45Z")

</div>

Hey again, thanks for the instruction. Sorry for the late reply but I wasn’t able to comment because of a review of my account. But thanks again, will try it out this weekend.
