# TermRepoToken.sol

## TermRepoToken

This is an ERC-20 contract to track claims to the aggregate repurchase obligations due on the repurchase date across all borrowers to a Term Repo

*This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment*

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### MINTER\_ROLE

```solidity
bytes32 MINTER_ROLE
```

### BURNER\_ROLE

```solidity
bytes32 BURNER_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### decimalPlaces

```solidity
uint8 decimalPlaces
```

### termContractPaired

```solidity
bool termContractPaired
```

### mintingPaused

```solidity
bool mintingPaused
```

### burningPaused

```solidity
bool burningPaused
```

### redemptionValue

```solidity
uint256 redemptionValue
```

The number of purchase tokens redeemable

### termRepoId

```solidity
bytes32 termRepoId
```

### mintExposureCap

```solidity
uint256 mintExposureCap
```

### config

```solidity
struct TermRepoTokenConfig config
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### whileMintingNotPaused

```solidity
modifier whileMintingNotPaused()
```

### whileBurningNotPaused

```solidity
modifier whileBurningNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string name_, string symbol_, uint8 decimalPlaces_, uint256 redemptionValue_, uint256 mintExposureCap_, address termInitializer_, struct TermRepoTokenConfig config_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoServicer_, contract ITermEventEmitter emitter_, address devopsMultisig_, address adminWallet_) external
```

### resetMintExposureCap

```solidity
function resetMintExposureCap(uint256 mintExposureCap_) external
```

### totalRedemptionValue

```solidity
function totalRedemptionValue() external view returns (uint256)
```

Calculates the total USD redemption value of all outstanding TermRepoTokens

#### Return Values

| Name | Type    | Description                                                              |
| ---- | ------- | ------------------------------------------------------------------------ |
| \[0] | uint256 | totalRedemptionValue The total redemption value of TermRepoTokens in USD |

### burn

```solidity
function burn(address account, uint256 amount) external
```

Burns TermRepoTokens held by an account Reverts if caller does not have BURNER\_ROLE

#### Parameters

| Name    | Type    | Description                                                 |
| ------- | ------- | ----------------------------------------------------------- |
| account | address | The address of account holding TermRepoTokens to burn       |
| amount  | uint256 | The amount of TermRepoTokens to burn without decimal factor |

### burnAndReturnValue

```solidity
function burnAndReturnValue(address account, uint256 amount) external returns (uint256)
```

Burns TermRepoTokens held by an account and returns purchase redemption value of tokens burned Reverts if caller does not have BURNER\_ROLE

#### Parameters

| Name    | Type    | Description                                                 |
| ------- | ------- | ----------------------------------------------------------- |
| account | address | The address of account holding TermRepoTokens to burn       |
| amount  | uint256 | The amount of TermRepoTokens to burn without decimal factor |

#### Return Values

| Name | Type    | Description                                                          |
| ---- | ------- | -------------------------------------------------------------------- |
| \[0] | uint256 | totalRedemptionValue Total redemption value of TermRepoTokens burned |

### mintRedemptionValue

```solidity
function mintRedemptionValue(address account, uint256 redemptionAmount) external returns (uint256)
```

Mints TermRepoTokens in an amount equal to caller specified target redemption amount The redemptionValue is the amount of purchase tokens redeemable per unit of TermRepoToken Reverts if caller does not have MINTER\_ROLE

#### Parameters

| Name             | Type    | Description                                            |
| ---------------- | ------- | ------------------------------------------------------ |
| account          | address | The address of account to mint TermRepoTokens to       |
| redemptionAmount | uint256 | The target redemption amount to mint in TermRepoTokens |

#### Return Values

| Name | Type    | Description                                     |
| ---- | ------- | ----------------------------------------------- |
| \[0] | uint256 | numTokens The amount of Term Repo Tokens minted |

### mintTokens

```solidity
function mintTokens(address account, uint256 numTokens) external returns (uint256)
```

Mints an exact amount of TermRepoTokens Reverts if caller does not have MINTER\_ROLE

#### Parameters

| Name      | Type    | Description                                      |
| --------- | ------- | ------------------------------------------------ |
| account   | address | The address of account to mint TermRepoTokens to |
| numTokens | uint256 | The exact number of term repo tokens to mint     |

### decrementMintExposureCap

```solidity
function decrementMintExposureCap(uint256 supplyMinted) external
```

Decrements the mintExposureCap Reverts if caller does not have MINTER\_ROLE

#### Parameters

| Name         | Type    | Description                 |
| ------------ | ------- | --------------------------- |
| supplyMinted | uint256 | The number of Tokens Minted |

### decimals

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

#### Return Values

| Name | Type  | Description                                                      |
| ---- | ----- | ---------------------------------------------------------------- |
| \[0] | uint8 | uint8 A uint8 that specifies how many decimal places a token has |

### pauseMinting

```solidity
function pauseMinting() external
```

### unpauseMinting

```solidity
function unpauseMinting() external
```

### pauseBurning

```solidity
function pauseBurning() external
```

### unpauseBurning

```solidity
function unpauseBurning() external
```

### \_authorizeUpgrade

```solidity
function _authorizeUpgrade(address impl) internal
```

*required override by the OpenZeppelin UUPS module*

#### Parameters

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| impl | address | new impl address for proxy upgrade |
