# Sample ERC20 protected by Timekeeper

You haven't created your token yet and want to protect it from being transferred when your market is closed with the Woken Exchange's Timekeeper?&#x20;

We provide a free ERC20 template that allows you to protect your token from being transferred when your market is closed on the DEX.

<details>

<summary><mark style="color:blue;">modifier tradingMustBeOpen</mark></summary>

{% code title="exampletoken.sol" %}

```solidity
modifier tradingMustBeOpen() { //to check the trading status on the Woken Exchange
        if (timekeeperEnabled) {
            require(IWokenFactory(wokenFactory).isTradingOpen(pairAddress), "WokenExchange : Trading / Transfer is Closed");
        }
```

{% endcode %}

</details>

\
Of course, you can customize it with the functions you want: name, supply, mint, burn, buy or sell taxes, etc...

{% hint style="success" %}
The WKN, the erc20 token of Woken Exchange, is protected in the same way.
{% endhint %}

### Benefits

* [x] Your **ERC20 is protected** and guaranteed non-transferable (wallet to wallet for example) if your LP's market is closed on the DEX.<br>
* [x] Your **ERC20 is scalable** with its trading hours if you wish to create a new LP on another DEX<br>
* [x] You manage the trading hours on the Woken Exchange [Timekeeper](https://woken-exchange.gitbook.io/wokenexchange/woken-v1-our-solution/timekeeper) page, your ERC20 token can only be traded (transferred) at the time you have set, wherever it is.

## How to setup the ERC20 Timekeeper ?

You just have to set your pair address and enable the erc20 timekeeper

### Step 1 : find your pair address

At the creation of your liquidity on Woken Exchange.\
Once you've created your LP, go to Arbiscan and find your Tx.

<figure><img src="https://1024955971-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FucapM7ajIRHbhMUaNv7T%2Fuploads%2FAwnci1nbWwqycXgAKdob%2Fhowto1.jpg?alt=media&#x26;token=3b6696df-0dbd-486b-9702-3ecfbcb05669" alt=""><figcaption><p>Your Tx after pair creation (example with the WKN token)</p></figcaption></figure>

and click on Woken LP Token (WLP) to open the WLP token details page on Arbiscan to get your pair address

<figure><img src="https://1024955971-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FucapM7ajIRHbhMUaNv7T%2Fuploads%2FGjERGGLjw8hWVPjSKMyn%2Fhowto2.jpg?alt=media&#x26;token=9e2297dd-6bad-4886-a6e1-950e45cea7bf" alt=""><figcaption><p>Pair Address (example with the pair address of the WKN token)</p></figcaption></figure>

### Step 2 : set the pair address on your erc20 token

Now that you have your pair address, go to Arbiscan to set it on your erc20 token

<figure><img src="https://1024955971-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FucapM7ajIRHbhMUaNv7T%2Fuploads%2FmJ6TEG4570w49AkYjxWH%2Fhowto3.png?alt=media&#x26;token=63fcc255-0a76-4789-a7dd-5e61c0a6eb8a" alt=""><figcaption><p>add your pair address</p></figcaption></figure>

On your contract token address, go to "contract", "white contract" and "setPairAddress"\
Past here your pair address you get on the step 1 and click on "write" \
(be sure to be connected to your contract address on Arbiscan with the deployer address of your erc20 token)

### Step 3 : enable the erc20 timekeeper

<figure><img src="https://1024955971-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FucapM7ajIRHbhMUaNv7T%2Fuploads%2Fdab17JLDM5hOoWzGZmGI%2Fhowto4.png?alt=media&#x26;token=b6f83400-72b5-4d39-b330-c46022886316" alt=""><figcaption><p>write true</p></figcaption></figure>

Once the pair address has been set on your erc20 token, open "enableTimkeeper" and write "true".\
And click on "Write"

\
**Your erc20 token is now protected by the WokenExchange Timekeeper** \
\
\&#xNAN;*\*the woken factory address is already set to the exampletoken contract constructor, so you don't have to set it.*\
\
If you need some help, do not hesitate to contact the Team on the Discord server, we will help you !

{% embed url="<https://github.com/WokenExchange/example-erc20-token>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://woken-exchange.gitbook.io/wokenexchange/tools/sample-erc20-protected-by-timekeeper.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
