# Swap open/closed

Our **Swap page** lets you swap a Token A for a Token B.

Woken Exchange gives to Project owners/Builders (PairAdmin) the option of enabling their pair's Timekeeper (Token A + Token B) to customize trading hours (swap).

So, if the Timekeeper is enabled for a pair, swaps are only allowed if its market is open.

<details>

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

<pre class="language-solidity" data-title="WokenPair.sol" data-overflow="wrap" data-full-width="false"><code class="lang-solidity">modifier <a data-footnote-ref href="#user-content-fn-1">tradingMustbeOpen</a>() { 
        if (_WokenFactory.isTKEnabled(address(this)) == true) {
            require(_WokenFactory.isTradingOpen(address(this)) == true, 'blocktime is outside trading hours' );
        }  
</code></pre>

<pre class="language-solidity" data-title="WokenPair.sol" data-overflow="wrap"><code class="lang-solidity">function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock <a data-footnote-ref href="#user-content-fn-2">tradingMustbeOpen</a>

</code></pre>

</details>

## Dynamic Open/Closed module

\
We have developed a dynamic "open/closed" module that listens our smart contracts to display 3 different states in real time on our interface: Timekeeper Disabled, Timekeeper Enabled, No Liquidity.\
\
This lets you know whether a pair is tradable or not.

### **Timekeeper Disabled**&#x20;

\
:green\_circle: **The module displays that the pair is tradable 24-7** : just like any AMM, you can swap Token A for Token B at any time.

<figure><img src="/files/5fkawFjaIDMxgUDrY4E3" alt=""><figcaption><p>Timekeeper is not Enabled : this pair is tradable 24-7</p></figcaption></figure>

### **Timekeeper Enabled**&#x20;

\
:red\_circle: **The module displays that the market for the pair is closed** : you cannot swap Token A for Token B until the market opens, which will be done automatically on our interface. \
A countdown warns you of the time remaining before the market opens for this pair. \
The pair's settings (trading days and hours) are also displayed.

<figure><img src="/files/HXPrVu0d3uCXPnNpwFCS" alt=""><figcaption><p>Timekeeper is enabled : market is closed for this pair</p></figcaption></figure>

***

:green\_circle: **The module displays that the market for the pair is open** : you can swap Token A for Token B until the market closes, which will be done automatically on our interface. \
A countdown warns you of the time remaining before the market closed for this pair. \
The pair's settings (trading days and times) are also displayed.

<figure><img src="/files/g3XXwJmUqmRDhH1Gq7I1" alt=""><figcaption><p>Timekeeper is enabled : market is open for this pair</p></figcaption></figure>

### The module settings display&#x20;

Timekeeper settings for a pair :

* market opening days
* market opening time
* market closing time
* UTC (timezone)
* 24h/day is enabled: true or false\
  When 24h/day is enabled (true), then the pair's settings no longer consider the specified hours (which become grayed out/inactive), but only the working days according to UTC.<br>

  *In the screenshot example above, the opening market for Pair WKN-WSDQ would then be, if the 24h/Day option has been enabled (true):* \
  *Opening on Monday at 00:00 UTC +2 without interruption until closing on Thursday at 00:00 UTC+2. Then reopening on Friday at 00:00 UTC+2.*
* If the Force Open function has been enabled

{% hint style="success" %}
The countdown is always there to alert you to the exact time before the market opens/closes.
{% endhint %}

### **No Liquidity**

\
:red\_circle: Swap impossible for a pair without liquidity

<figure><img src="/files/uaziRmyNWvxQmaWGXPge" alt=""><figcaption><p>No liquidity for this pair</p></figcaption></figure>

{% hint style="info" %}
The UTC displayed for a pair represents its configuration on the blockchain and not your computer's configuration. The countdown is there to notify you about opening or closing trading time for a pair.
{% endhint %}

[^1]: tradingmustbeopen

[^2]: trading must be open to swap


---

# 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/woken-v1-our-solution/swap-open-closed.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.
