# RepoTokenUtils.sol#RepoTokenUtils

[Git Source](https://github.com/term-finance/yearn-v3-term-vault/blob/fdab68ac51eb0929f23686f72922fed45a3d7d1d/src/RepoTokenUtils.sol)

## State Variables

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 internal constant THREESIXTY_DAYCOUNT_SECONDS = 360 days;
```

### RATE\_PRECISION

```solidity
uint256 internal constant RATE_PRECISION = 1e18;
```

## Functions

### calculatePresentValue

Calculate the present value of a repoToken

```solidity
function calculatePresentValue(
    uint256 repoTokenAmountInBaseAssetPrecision,
    uint256 purchaseTokenPrecision,
    uint256 redemptionTimestamp,
    uint256 discountRate
) internal view returns (uint256 presentValue);
```

**Parameters**

| Name                                  | Type      | Description                                     |
| ------------------------------------- | --------- | ----------------------------------------------- |
| `repoTokenAmountInBaseAssetPrecision` | `uint256` | The amount of repoToken in base asset precision |
| `purchaseTokenPrecision`              | `uint256` | The precision of the purchase token             |
| `redemptionTimestamp`                 | `uint256` | The redemption timestamp of the repoToken       |
| `discountRate`                        | `uint256` | The auction rate                                |

**Returns**

| Name           | Type      | Description                        |
| -------------- | --------- | ---------------------------------- |
| `presentValue` | `uint256` | The present value of the repoToken |

### getNormalizedRepoTokenAmount

Get the normalized amount of a repoToken in base asset precision

```solidity
function getNormalizedRepoTokenAmount(
    address repoToken,
    uint256 repoTokenAmount,
    uint256 purchaseTokenPrecision,
    uint256 repoRedemptionHaircut
) internal view returns (uint256 repoTokenAmountInBaseAssetPrecision);
```

**Parameters**

| Name                     | Type      | Description                                             |
| ------------------------ | --------- | ------------------------------------------------------- |
| `repoToken`              | `address` | The address of the repoToken                            |
| `repoTokenAmount`        | `uint256` | The amount of the repoToken                             |
| `purchaseTokenPrecision` | `uint256` | The precision of the purchase token                     |
| `repoRedemptionHaircut`  | `uint256` | The haircut to be applied to the repoToken for bad debt |

**Returns**

| Name                                  | Type      | Description                                                    |
| ------------------------------------- | --------- | -------------------------------------------------------------- |
| `repoTokenAmountInBaseAssetPrecision` | `uint256` | The normalized amount of the repoToken in base asset precision |


---

# 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://developers.term.finance/periphery-contracts/curated-vaults/solidity-api-latest/repotokenutils.sol-repotokenutils.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.
