> For the complete documentation index, see [llms.txt](https://developers.term.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.term.finance/periphery-contracts/curated-vaults/solidity-api-latest/repotokenutils.sol-repotokenutils.md).

# 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 |
