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

### SPECIALIST\_ROLE

```solidity
bytes32 SPECIALIST_ROLE
```

### treasuryWallet

```solidity
address treasuryWallet
```

### protocolReserveWallet

```solidity
address protocolReserveWallet
```

### termAddresses

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

### termAuctionResults

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

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

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

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

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

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


---

# 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/latest/protocol-class/termcontroller.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.
