# Yield Token

The YT ([Yield Token](https://dev.spectra.finance/glossary#yield-token)) represents the yield that is accrued by an [IBT](https://dev.spectra.finance/glossary#ibt) (Interest Bearing Token). It is created when an IBT or an underlying asset is deposited into a [PrincipalToken](https://dev.spectra.finance/technical-reference/contract-functions/principal-token), and the interest bearing token is split into [PT](https://dev.spectra.finance/glossary#principal-token) and [YT](https://dev.spectra.finance/glossary#yield-token).

The YT can be traded with other users to hedge or speculate on yields. A user holding a YT can claim his yield by calling [`claimYield`](https://dev.spectra.finance/technical-reference/principal-token#claimyield) or [`claimYieldInIBT`](https://dev.spectra.finance/technical-reference/principal-token#claimyieldinibt) on the Principal Token contract.

For more information, see [Tokenising Yield](https://dev.spectra.finance/guides/tokenizing-yield).

YT.sol code can be found on [GitHub](https://github.com/perspectivefi/spectra-core/blob/main/src/tokens/YieldToken.sol).

## Methods

### transfer

```solidity
function transfer(
    address to,
    uint256 value
) public returns (bool success)
```

Standard ERC20 `transfer` function with a pre-transfer yield update.

<table><thead><tr><th width="190.33333333333331">Input Parameter</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>to</code></td><td>address</td><td>The address to send the YT <code>to</code></td></tr><tr><td><code>value</code></td><td>uint256</td><td>The amount of the YT to send</td></tr></tbody></table>

<table><thead><tr><th width="189.33333333333331">Return Parameter</th><th width="121">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td>bool</td><td>A boolean value indicating whether the transfer was successful</td></tr></tbody></table>

### transferFrom

```solidity
function transferFrom(
    address from,
    address to,
    uint256 value
) public returns (bool success)
```

Standard ERC20 `transfer` function with a pre-transfer yield update.&#x20;

{% hint style="warning" %}
`from` must have previously approved `msg.sender` to transfer `value` using the standard ERC20 approval process.
{% endhint %}

<table><thead><tr><th width="190.33333333333331">Input Parameter</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>from</code></td><td>address</td><td>The address to send the YT <code>from</code></td></tr><tr><td><code>to</code></td><td>address</td><td>The address to send the YT <code>to</code></td></tr><tr><td><code>value</code></td><td>uint256</td><td>The amount of the YT to send</td></tr></tbody></table>

<table><thead><tr><th width="189.33333333333331">Return Parameter</th><th width="121">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>success</code></td><td>bool</td><td>A boolean value indicating whether the transfer was successful</td></tr></tbody></table>

## View Methods

### getPT

```solidity
function getPT() public view returns (address)
```

Get the [Principal Token](https://dev.spectra.finance/technical-reference/contract-functions/principal-token) associated with the yield token.

### decimals

```solidity
function decimals() public view returns (uint8)
```

Returns the number of decimals of the YT (same as the PrincipalToken's decimals). See [`decimals()`](https://dev.spectra.finance/technical-reference/principal-token#decimals)

### balanceOf

```solidity
function balanceOf(address account) public view returns (uint256)
```

Returns the  balance of YT before[ expiry of the principal token](https://dev.spectra.finance/technical-reference/principal-token#maturity) and return 0 after the expiry of the principal token.&#x20;

### actualBalanceOf

```solidity
function actualBalanceOf(address account) public view returns (uint256)
```

Returns the real balance of YT as defined in the balanceOf from ERC20 standard&#x20;

i.e the sum of incoming YT to the `account` minus the outgoing balance of YT tokens.&#x20;


---

# 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://dev.spectra.finance/technical-reference/contract-functions/yield-token.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.
