# Timekeeper

When a project owner creates his liquidity pair on Woken, **it is by default tradable 24-7**, as on any AMM.

Timekeeper is an option that a Project Owner/Builder (PairAdmin) enable/disable if he wants to customize the trading hours of his pair on the DEX, according to his needs.

<details>

<summary><mark style="color:blue;">function setEnable</mark></summary>

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

```solidity
function setEnable(address _pair, bool _enable) public isPairAdmin(_pair) {
        isTimekeeperEnabledLP[_pair] = _enable;
        emit TimekeeperEnable(_pair);
```

{% endcode %}

</details>

<figure><img src="https://1024955971-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FucapM7ajIRHbhMUaNv7T%2Fuploads%2Fy6RLXkdQHRzBwXpWSq8A%2FCapture%20d%E2%80%99e%CC%81cran%202023-09-06%20a%CC%80%2013.25.27.png?alt=media&#x26;token=c456b9e3-ffa4-4cfe-b72a-a3be1a42f5e0" alt=""><figcaption><p>Timekeeper Page : Timekeeper is not enabled for this pair</p></figcaption></figure>

Once enabled\*, he can switch from 24-7 to custom trading hours for his pair. \
Timekeeper management is facilitated by a dedicated, intuitive and easy-to-use interface.

<figure><img src="https://1024955971-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FucapM7ajIRHbhMUaNv7T%2Fuploads%2FkAY4wmPIQCeqxrdLleJP%2Ftkpage.jpg?alt=media&#x26;token=08ac3839-7f6f-439a-8400-50a902b257eb" alt=""><figcaption><p>Timekeeper Page : Timekeeper is enabled for this pair</p></figcaption></figure>

{% hint style="info" %}
When the PairAdmin enables his pair's Timekeeper for the very first time, the default settings is: open every day from Monday to Friday without interruption, closed from Saturday at 00:00 UTC 0 and Sunday before reopening the following Monday at 00:00 UTC 0 (24h/Day option enabled).

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

```solidity
TimekeeperPerLp[pair]= pairTimekeeper(0, 0, 23, 59, [0,0,0,0,0,1,1], 0, true);
```

{% endcode %}
{% endhint %}

***

## How Timekeeper works?

Timekeeper is the smart contract that controls the LPs trading hours.&#x20;

Whenever a user initiates a transfer, LP will request the Timekeeper for the current trading status. The Timekeeper retrieves the actual time from the blockchain, computes the status of the transactions and sends it back.

<figure><img src="https://1024955971-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FucapM7ajIRHbhMUaNv7T%2Fuploads%2FjA1XsKnoJP8rfJka4PDw%2Ftimekeeperhow.jpg?alt=media&#x26;token=ec0beb22-b133-4c76-8c07-70d53dbdf47d" alt="" width="563"><figcaption><p>Timekeeper</p></figcaption></figure>

{% embed url="<https://github.com/WokenExchange/Contracts/blob/master/Timekeeper.sol>" %}
