> 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/2.1.0/protocol-class/termcontroller.md).

# TermController.sol

## TermController

This contract manages Term Finance protocol permissions and controls

*This contract operates at the protocol level and governs all instances of a Term Repo*

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTION\_ROLE

```solidity
bytes32 AUCTION_ROLE
```

### CONTROLLER\_ADMIN\_ROLE

```solidity
bytes32 CONTROLLER_ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### FACTORY\_DEPLOYER\_ROLE

```solidity
bytes32 FACTORY_DEPLOYER_ROLE
```

### SPECIALIST\_ROLE

```solidity
bytes32 SPECIALIST_ROLE
```

### termContractsPaused

```solidity
bool termContractsPaused
```

Returns whether all Term Finance contracts are currently paused

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |

### treasuryWallet

```solidity
address treasuryWallet
```

### protocolReserveWallet

```solidity
address protocolReserveWallet
```

### termAddresses

```solidity
mapping(address => bool) termAddresses
```

### factoryDeployedAddresses

```solidity
mapping(address => bool) factoryDeployedAddresses
```

### approvedExternalAddresses

```solidity
mapping(address => bool) approvedExternalAddresses
```

### registeredRepoIds

```solidity
mapping(bytes32 => bool) registeredRepoIds
```

External view function which returns if term repo id is registered in Controller

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |

### registeredAuctionIds

```solidity
mapping(bytes32 => bool) registeredAuctionIds
```

External view function which returns if term auction id is registered in Controller

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |

### termAuctionResults

```solidity
mapping(bytes32 => struct TermAuctionResults) termAuctionResults
```

### onlyInitializerOrFactoryDeployer

```solidity
modifier onlyInitializerOrFactoryDeployer()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address treasuryWallet_, address protocolReserveWallet_, address controllerAdminWallet_, address devopsWallet_, address adminWallet_) external
```

### pairInitializer

```solidity
function pairInitializer(address initializer) external
```

### pairFactoryDeployer

```solidity
function pairFactoryDeployer(address factoryDeployer) external
```

### pairAuction

```solidity
function pairAuction(address auction) external
```

Initializer function to pair a new Term Auction with the controller

#### Parameters

| Name    | Type    | Description         |
| ------- | ------- | ------------------- |
| auction | address | new auction address |

### getTreasuryAddress

```solidity
function getTreasuryAddress() external view returns (address)
```

External view function which returns contract address of treasury wallet

### getProtocolReserveAddress

```solidity
function getProtocolReserveAddress() external view returns (address)
```

External view function which returns contract address of protocol reserve

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | address | The protocol reserve address |

### getTermAuctionResults

```solidity
function getTermAuctionResults(bytes32 termRepoId) external view returns (struct AuctionMetadata[] auctionMetadata, uint8 numOfAuctions)
```

Returns history of all completed auctions within a term

#### Parameters

| Name       | Type    | Description             |
| ---------- | ------- | ----------------------- |
| termRepoId | bytes32 | term repo id to look up |

### isTermDeployed

```solidity
function isTermDeployed(address contractAddress) external view returns (bool)
```

External view function which returns whether contract address is deployed by Term Finance Protocol

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| contractAddress | address | The input contract address to query |

#### Return Values

| Name | Type | Description                                                    |
| ---- | ---- | -------------------------------------------------------------- |
| \[0] | bool | Whether the given address is deployed by Term Finance Protocol |

### isFactoryDeployed

```solidity
function isFactoryDeployed(address contractAddress) external view returns (bool)
```

External view function which returns whether contract address is deployed by a Term Finance factory

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| contractAddress | address | The input contract address to query |

#### Return Values

| Name | Type | Description                                                     |
| ---- | ---- | --------------------------------------------------------------- |
| \[0] | bool | Whether the given address is deployed by a Term Finance factory |

### isTermApproved

```solidity
function isTermApproved(address contractAddress) external view returns (bool)
```

External view function which returns whether contract address is approved for integration

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| contractAddress | address | The input contract address to query |

#### Return Values

| Name | Type | Description                                           |
| ---- | ---- | ----------------------------------------------------- |
| \[0] | bool | Whether the given address is approved for integration |

### verifyMintExposureAccess

```solidity
function verifyMintExposureAccess(address authedUser) external view returns (bool)
```

#### Parameters

| Name       | Type    | Description                                           |
| ---------- | ------- | ----------------------------------------------------- |
| authedUser | address | The address of user to check access for mint exposure |

### updateTreasuryAddress

```solidity
function updateTreasuryAddress(address newTreasuryWallet) external
```

Admin function to update the Term Finance treasury wallet address

#### Parameters

| Name              | Type    | Description              |
| ----------------- | ------- | ------------------------ |
| newTreasuryWallet | address | The new treasury address |

### updateProtocolReserveAddress

```solidity
function updateProtocolReserveAddress(address newProtocolReserveWallet) external
```

Admin function to update the Term Finance protocol reserve wallet address

#### Parameters

| Name                     | Type    | Description                             |
| ------------------------ | ------- | --------------------------------------- |
| newProtocolReserveWallet | address | The new protocol reserve wallet address |

### updateControllerAdminWallet

```solidity
function updateControllerAdminWallet(address oldControllerAdminWallet, address newControllerAdminWallet) external
```

Admin function to update the designated controller admin wallet that calls markTermDeployed

#### Parameters

| Name                     | Type    | Description                                                   |
| ------------------------ | ------- | ------------------------------------------------------------- |
| oldControllerAdminWallet | address | The current controller admin wallet to revoke permissions for |
| newControllerAdminWallet | address | The new controller admin wallet to grant permissions for      |

### markTermDeployed

```solidity
function markTermDeployed(address termContract) external
```

Admin function to add a new Term Finance contract to Controller

#### Parameters

| Name         | Type    | Description                   |
| ------------ | ------- | ----------------------------- |
| termContract | address | The new term contract address |

### unmarkTermDeployed

```solidity
function unmarkTermDeployed(address termContract) external
```

Admin function to remove a contract from Controller

#### Parameters

| Name         | Type    | Description                   |
| ------------ | ------- | ----------------------------- |
| termContract | address | The new term contract address |

### markTermFactoryDeployed

```solidity
function markTermFactoryDeployed(address factoryDeployedContract) external
```

Admin function to add a new factory-deployed contract to Controller

#### Parameters

| Name                    | Type    | Description                           |
| ----------------------- | ------- | ------------------------------------- |
| factoryDeployedContract | address | The factory-deployed contract address |

### unmarkTermFactoryDeployed

```solidity
function unmarkTermFactoryDeployed(address factoryDeployedContract) external
```

Admin function to remove a factory-deployed contract from Controller

#### Parameters

| Name                    | Type    | Description                           |
| ----------------------- | ------- | ------------------------------------- |
| factoryDeployedContract | address | The factory-deployed contract address |

### registerRepoId

```solidity
function registerRepoId(bytes32 repoId) external
```

Admin function to add a new term repo id to Controller

#### Parameters

| Name   | Type    | Description          |
| ------ | ------- | -------------------- |
| repoId | bytes32 | The new term repo id |

### registerAuctionId

```solidity
function registerAuctionId(bytes32 auctionId) external
```

Admin function to add a new term auction id to Controller

#### Parameters

| Name      | Type    | Description             |
| --------- | ------- | ----------------------- |
| auctionId | bytes32 | The new term auction id |

### markTermApproved

```solidity
function markTermApproved(address externalContract) external
```

Admin function to add a new external contract to Controller

#### Parameters

| Name             | Type    | Description                       |
| ---------------- | ------- | --------------------------------- |
| externalContract | address | The new external contract address |

### unmarkTermApproved

```solidity
function unmarkTermApproved(address externalContract) external
```

Admin function to remove an external contract from Controller

#### Parameters

| Name             | Type    | Description                       |
| ---------------- | ------- | --------------------------------- |
| externalContract | address | The new external contract address |

### grantMintExposureAccess

```solidity
function grantMintExposureAccess(address authedUser) external
```

#### Parameters

| Name       | Type    | Description                                                |
| ---------- | ------- | ---------------------------------------------------------- |
| authedUser | address | The address of user granted access to create mint exposure |

### revokeMintExposureAccess

```solidity
function revokeMintExposureAccess(address revokedUser) external
```

#### Parameters

| Name        | Type    | Description                                                  |
| ----------- | ------- | ------------------------------------------------------------ |
| revokedUser | address | The address of user to revoke access to create mint exposure |

### pauseTermContracts

```solidity
function pauseTermContracts() external
```

Pauses all Term Finance contracts

*Sets the global pause state to true, halting contract operations*

### unpauseTermContracts

```solidity
function unpauseTermContracts() external
```

Unpauses all Term Finance contracts

*Sets the global pause state to false, resuming contract operations*

### recordAuctionResult

```solidity
function recordAuctionResult(bytes32 termRepoId, bytes32 termAuctionId, uint256 auctionClearingRate) external
```

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*
