> For the complete documentation index, see [llms.txt](https://doc.torch.finance/telegram-usd/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.torch.finance/telegram-usd/how-tgusd-works/architecture/core-components/staking.md).

# Staking

<figure><img src="/files/Mn40El0LEWeslAR6pUBN" alt=""><figcaption><p>Staking contact's workflow</p></figcaption></figure>

The **Staking contract** handles user staking, unstaking, and reward distribution. Its workflow is as follows:

## **Staking tgUSD and Minting stgUSD**

* Users stake **tgUSD** into the Staking contract.
* Based on the current conversion rate between **tgUSD** and **stgUSD**, the contract mints the corresponding amount of **stgUSD** to the user.
* stgUSD represents the user’s share in the pool and appreciates in value over time as rewards are distributed.

## **Unstaking stgUSD**

* Users **burn their stgUSD** to receive the corresponding amount of **tgUSD**, which includes both principal and accumulated rewards.
* Upon receiving the burn notification, the staking contract deploys a **dedicated Unstake Account** to track the request.
* A &#x37;**-day cooldown period** is required before the tgUSD can be claimed.
* If the user initiates another unstake during the cooldown period, the amount is aggregated and the cooldown timer resets.

## **Reward Distribution and Vesting**

* Yield is distributed to the Staking contract every **7 days**.
* If rewards are earned on external chains, USDT is bridged back to TON via **Stargate** or **USDT0**.\
  If rewards are already on TON, no bridging is required.
* The accumulated rewards (USDT) are then sent to the Engine contract, which mints tgUSD and transfers it to the Staking contract as staking rewards.
* Upon receiving the rewards, the Staking contract initiates a **7-day** **linear vesting period**, during which the value of stgUSD gradually increases as the rewards accrue.

## **Purpose of the Cooldown Period**

* The cooldown provides the protocol with sufficient time to return **tgUSD** to the Staking contract.
* In the event of a **price deviation in the tgUSD/USDT pool**, the protocol may temporarily use **tgUSD from the Staking contract** to perform arbitrage. Once arbitrage is complete, the USDT profit is converted into tgUSD and used to repay what was borrowed from the Staking contract.
