> For the complete documentation index, see [llms.txt](https://docs.tenderize.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tenderize.me/staking/technical-documentation.md).

# Technical documentation

### Liquid Delegation Implementation

#### Overview

Liquid Delegation Tokens (LDTs) are elastic supply ERC-20 tokens that represent staked positions with specific validators. They implement both standard ERC-20 functionality and EIP-2612 for permits, with additional features for handling staking rewards and slashing events.

***

### Core Functions

**Staking**&#x20;

```solidity
function deposit(address receiver, uint256 assets) external returns (uint256)
```

* **Purpose:** Deposits assets and mints tTokens.
* **Returns:** Amount of tTokens minted.
* **Additional Details:** Triggers a rebase before the operation.

**Unstaking**&#x20;

```solidity
unlock(uint256 assets) external returns (uint256 unlockID)
```

* **Purpose:** Initiates the unstaking process.
* **Details:**
  * Burns tTokens.
  * Creates an unlock position.
* **Returns:** Unique unlock identifier.

**Withdraw**

```solidity
withdraw(address receiver, uint256 unlockID) external returns (uint256 amount)
```

* **Purpose:** Completes the unstaking process.
* **Details:**
  * Transfers underlying assets to the specified receiver.
  * Requires the unlock position to mature.

**Conversion Functions**

```solidity
convertToAssets(uint256 shares) public view returns (uint256)
function convertToShares(uint256 assets) public view returns (uint256)
```

* **Purpose:** Handle conversion between shares (tTokens) and assets (underlying tokens).
* **Details:** Accounts for changes in the elastic supply.

***

### Integration Guide **For DeFi Protocols**

**Token Implementation**

* Implements the standard ERC-20 interface.
* Includes an additional rebase mechanism.
* Use `convertToAssets()` for accurate balance calculations.

**Handling Rebases**

* Rebases occur automatically before token transfers.
* External calls should account for supply changes.
* Monitor `Rebase` events for updates to supply.

**Safety Considerations**

* Always check return values for all operations.
* Account for potential slashing events that may affect balances.
* Handle failed operations gracefully to ensure robust integrations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.tenderize.me/staking/technical-documentation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
