# Overview

### Auction Based Volume Matching

Term Finance is a noncustodial fixed-rate liquidity protocol modeled on tri-party repo arrangements common in traditional finance (TradFi). Liquidity suppliers and takers are matched through a unique weekly auction process where liquidity takers submit bids and suppliers submit offers to the protocol. These bids and offers are aggregated at the close of an auction to determine a "market clearing rate". Bidders who bid more than the clearing rate receive loans and lenders asking less than the clearing rate, supply. All other participants’ bids and offers are said to be “left on the table.”

### Conservative Collateral Management

Collateral backing Term loans sit in isolated noncustodial smart contracts (each, a "[repoLocker](/latest/term-repo-class/term-servicer-group/termrepolocker#termrepolocker)") throughout the term of a loan. These assets are ineligible for rehypothecation, ensuring they cannot be lent out to other borrowers. This approach not only prevents contagion risk between different collateral types but also significantly reduces risk for both lenders and borrowers.

### Protocol Security

<table data-header-hidden><thead><tr><th width="148"></th><th></th><th data-hidden></th><th data-hidden></th></tr></thead><tbody><tr><td><img src="https://3704574223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2Fgit-blob-1d859b54c767cc3125a7d95792ff24d4328ede28%2Fchrome_I94vHF7lHR.png?alt=media" alt=""></td><td>The Term Finance Protocol adheres to DeFi principles, with an emphasis on transparency, auditability and robust security in design. The protocol has undergone multiple <a href="/deployed-contracts/smart-contract-audits">smart contract audits</a> and extensive protocol review by DeFiSafety. A detailed report can be found by clicking on the link below.</td><td></td><td></td></tr></tbody></table>

{% embed url="<https://defisafety.com/app/pqrs/576>" fullWidth="false" %}


# Term Finance Protocol

The contracts that make up the Term Finance Protocol are broadly divided into two classes: (i) "evergreen" Protocol Contracts that govern at the protocol level; and (ii) "serial" Term Repos that are instances of Term Finance Protocol's implementation of tri-party repo on-chain. This second class of "single-use" serial contracts are necessarily finite in nature given that each Term Repo is limited to a fixed-term and has a fixed maturity or [repurchase date](/term-finance-protocol/terminology#repurchase-date).

### Protocol Contract Class

Protocol contracts are evergreen contracts at the protocol level that govern and apply across all Term Repos. The following contracts belong to this class and handle protocol level authentication, security controls, event logging and manage centralized price feeds.

* `TermEventEmitter.sol`
* `TermController.sol`
* `TermInitializer.sol`
* `TermPriceConsumerV3.sol`

<figure><img src="https://3704574223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2Fgit-blob-825e98387c5b0555d762c94e553fdf41062fcee2%2FBlank%20diagram%20-%20Page%201.svg?alt=media" alt=""><figcaption><p>Protocol Contracts are "evergreen" contracts that are deployed once and govern the entire Protocol</p></figcaption></figure>

### Term Repo Class

The Term Repo Class are a class of smart contracts that are serially deployed. Each repo maturity (and corresponding set of key terms) require the deployment of a separate instance of the entire class and are governed by the Protocol Contracts. The class of smart contracts belonging to the Term Repo Class can be further split into three subclasses or groups.

#### Term Servicer Group

The Term Servicer group of contracts enforce the terms of a Term Repo arrangement and automate the settlement and collateral management functions handled by the collateral agent in the TradFi context. The relationship between each contract within the Term Servicer Group is always 1:1 and a new instance of the entire set is deployed for each Term Repo arrangement.

* `TermRepoCollateralManager.sol`
* `TermRepoServicer.sol`
* `TermRepoRolloverManager.sol`
* `TermRepoLocker.sol`

#### Term Repo Token

The Term (Repo) Token is an ERC-20 contract that registers claims of lenders to a Term Repo arrangement against the total aggregate [repurchase price](/term-finance-protocol/terminology#repurchase-price) due on the [repurchase date](/term-finance-protocol/terminology#repurchase-date) (Total Outstanding Repurchase Exposure) from all borrowers to the same. A new instance of the Repo Token is deployed for each Term Repo arrangement.

* `TermRepoToken.sol`

<figure><img src="https://3704574223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2Fgit-blob-2dc9916d47f5403445de52d75591c163aae34b3b%2FBlank%20diagram%20-%20Page%201%20(5).svg?alt=media" alt=""><figcaption><p>Contracts within the Term Auction Group are "serially" deployed in sets</p></figcaption></figure>

#### Term Auction Group

The Term Auction group of contracts contain the logic to handle and process bid and offer submissions, determine an auction clearing price, and to settle and clear a Term Auction. The relationship between each contract in the Term Auction Group is always 1:1 and a new instance of the entire set is deployed for each Term Auction.

* `TermAuction.sol`
* `TermAuctionBidLocker.sol`
* `TermAuctionOfferLocker.sol`

<figure><img src="https://3704574223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2Fgit-blob-01717ed959c81353bc0902b99c7781a2ee9f80e5%2FBlank%20diagram%20-%20Page%201%20(4).svg?alt=media" alt=""><figcaption><p>Contracts within the Term Auction Group are "serially" deployed in sets</p></figcaption></figure>

The relationship between the Term Auction Group and the Term Repo Group ***can be*** many to one (but is typically 1:1). Where a new instance of the Term Auction Group is deployed and paired with a previously auctioned Term Repo, this is known as a "re-opening" auction.

<figure><img src="https://3704574223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2Fgit-blob-176e02e8808b9145dedb9c3853aea3ae7e2ffca8%2FBlank%20diagram%20-%20Page%201%20(6).svg?alt=media" alt=""><figcaption><p>The relationship between each instance of a Term Auction and a Term Repo can be many to one</p></figcaption></figure>

### Putting it together

To review, the Protocol Contracts govern all instances of the Term Repo Group contracts. Within the Term Repo Group, each Term Repo instance is comprised of a unique set of Term Servicer Group contracts + Term Repo Token deployments. Positions within each Term Repo arrangement are "opened" by a Term Auction, which is comprised of a unique set of Term Auction Group deployments, and multiple Term Auctions can be deployed to open positions in the same Term Repo.

<figure><img src="https://3704574223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2Fgit-blob-48e21d864949766ff960ec8adf2681fc3ca1429f%2FBlank%20diagram%20-%20Page%201%20(7).svg?alt=media" alt=""><figcaption></figcaption></figure>


# Term Repo

Each deployment of a Term Repo is comprised of a set of smart contracts broadly divided into three groups: (i) the Term Auction Group, (ii) the Term Servicer Group and (iii) the Term Repo Token. It's key economic parameters are set out in the table below:

| Parameter                | Method                  | Description                                                                                                                                                                                                                                                                                                             |
| ------------------------ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Purchase Token           | Initialized by Deployer | Address of the [purchase token](/term-finance-protocol/terminology#purchase-token) or token that is borrowed                                                                                                                                                                                                            |
| Collateral Token(s)      | Initialized by Deployer | Address(es) of [collateral token(s)](/term-finance-protocol/terminology#collateral-token) eligible to be pledged as collateral                                                                                                                                                                                          |
| Repurchase Date          | Initialized by Deployer | Timestamp of the date and time on which [repurchase ](/term-finance-protocol/terminology#repurchase-price)is due                                                                                                                                                                                                        |
| Repurchase Window        | Initialized by Deployer | Time delta (typically 12-24 hours) that specifies the grace period during which repurchase payments may be submitted without default                                                                                                                                                                                    |
| Initial Margin Ratio     | Initialized by Deployer | The ratio of the market value of [collateral tokens](/term-finance-protocol/terminology#collateral-token) and the amount tendered in a Term Auction bid required for a bid to be confirmed                                                                                                                              |
| Maintenance Margin Ratio | Initialized by Deployer | The ratio of the market value of [collateral tokens](/term-finance-protocol/terminology#collateral-token) to the [repurchase price](/term-finance-protocol/terminology#repurchase-price) (the amount due at maturity) required to avoid a [margin deficit](/term-finance-protocol/terminology#margin-deficit) (default) |
| Price Feed               | Initialized by Deployer | Address of the oracle price feed used to value [collateral tokens](/term-finance-protocol/terminology#collateral-token)                                                                                                                                                                                                 |
| Repo Rate                | Determined by Auction   | The [pricing rate](/term-finance-protocol/terminology#pricing-rate-repo-rate) that determines the [repurchase price](/term-finance-protocol/terminology#repurchase-price) (principal plus interest) due on the repurchase date                                                                                          |

Other relevant economic parameters include:

| Parameter          | Method                  | Description                                                                                                                                                                                                                                                                                                      |
| ------------------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Servicing Fee      | Initialized by Deployer | An annualized rate applied to accepted bid amounts and charged to borrowers who receive a loan in auction                                                                                                                                                                                                        |
| Liquidated Damages | Initialized by Deployer | The additional amount of [collateral tokens](/term-finance-protocol/terminology#collateral-token) forfeited by a borrower in liquidation, due to a failure to repurchase or margin deficiency, expressed as an annualized percentage rate. Liquidated damages are split between the liquidator and the Protocol. |


# Term Auction Group

The Term Auction group of contracts contain the logic to handle and process bid and offer submissions, determine an auction clearing price, and to settle and clear a Term Auction. The relationship between the Term Auction Group and the Term Servicer group is many to one. There can be multiple Term Auctions that settle into a single set of contracts belonging to the same Term Servicer Group with the same terms and conditions.

{% content-ref url="/pages/7QPq97l187m3Zrh7mGvo" %}
[Initialization Parameters](/term-finance-protocol/term-repo/term-auction-group/initialization-parameters)
{% endcontent-ref %}

{% content-ref url="/pages/deauiUmcrggiBKhitrMD" %}
[Administrative Functions](/term-finance-protocol/term-repo/term-auction-group/administrative-functions)
{% endcontent-ref %}

<table><thead><tr><th width="324.3333333333333">Contract</th><th>Key Functions</th><th data-hidden></th></tr></thead><tbody><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermAuction.sol"><mark style="color:yellow;"><code>TermAuction.sol</code></mark></a></td><td><mark style="color:yellow;">Manages the clearing, settlement and minting of Term Tokens at the conclusion of a Term Auction</mark></td><td></td></tr><tr><td></td><td><a href="/0.5.32/term-repo-class/term-auction-group/termauction#completeauction"><code>completeAuction</code></a>: public function that settles and clears an auction and mints term repo tokens to lenders who are assigned a loan in auction given a clearing rate and arrays of validly submitted bids and offers</td><td></td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermAuctionBidLocker.sol"><mark style="color:yellow;"><code>TermAuctionBidLocker.sol</code></mark></a></td><td><mark style="color:yellow;">Manages Term Auction bid submissions (to borrow)</mark></td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionbidlocker#lockbids"><code>lockBids</code></a>: callable by participants to tender or submit sealed or hashed auction bids</td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionbidlocker#unlockbids"><code>unlockBids</code></a>: callable by participants to cancel sealed or hashed auction bids</td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionbidlocker#revealbids"><code>revealBids</code></a>: public function to reveal sealed or hashed bid prices</td><td></td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermAuctionOfferLocker.sol"><mark style="color:yellow;"><code>TermAuctionOfferLocker.sol</code></mark></a></td><td><mark style="color:yellow;">Manages Term Auction offer submissions (to lend)</mark></td><td></td></tr><tr><td></td><td><a href="/latest/term-repo-class/term-auction-group/termauctionofferlocker#lockoffers"><code>lockOffers</code></a>: callable by participants to tender or submit a sealed or hashed auction offer</td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionofferlocker#unlockoffers"><code>unlockOffers</code></a>: callable by participants to cancel a sealed or hashed auction offer</td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionofferlocker#revealoffers"><code>revealOffers</code></a>: public function to reveal sealed or hashed offer prices</td><td></td></tr></tbody></table>


# Initialization Parameters

The relationship between a Term Auction to a Term Repo is a many to one relationship. A Term Repo previously deployed and auctioned can be "re-opened" through a subsequent auction. The key parameters to a Term Auction are as follows:

| Parameter             | Method                  | Description                                                                                                             |
| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| Minimum Tender Amount | Initialized by Deployer | Minimum bid or offer amount accepted in auction                                                                         |
| Auction Start Time    | Initialized by Deployer | Timestamp defining the beginning of the auction window where bids and offers are accepted                               |
| Auction End Time      | Initialized by Deployer | Timestamp defining the end of the auction window where bids and offers are accepted                                     |
| Tender Reveal Time    | Initialized by Deployer | Timestamp where bids and offers may be revealed for auction clearing                                                    |
| Clearing Price Offset | Initialized by Deployer | The number of price groups by which the best bid and offers are offset in determining the clearing rate, must be 0 or 1 |


# Administrative Functions

<table><thead><tr><th width="324.3333333333333">Contract</th><th>Key Functions</th><th data-hidden></th></tr></thead><tbody><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermAuction.sol"><mark style="color:yellow;"><code>TermAuction.sol</code></mark></a></td><td><mark style="color:yellow;">Manages the clearing, settlement and minting of Term Tokens at the conclusion of a Term Auction</mark></td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.32/term-repo-class/term-auction-group/termauction#cancelauction">cancelAuction</a>: prevents an auction from clearing and returns all tokens to participants</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.32/term-repo-class/term-auction-group/termauction#cancelauctionforwithdrawal">cancelAuctionForWithdrawal</a>: prevents an auction from clearing and allows participants to claim tokens by cancelling bids and offers via the Bid Locker and Offer Locker contracts, respectively</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.32/term-repo-class/term-auction-group/termauction#pausecompleteauction">pauseCompleteAuction</a>: triggers a revert on completeAuction when paused</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.32/term-repo-class/term-auction-group/termauction#unpausecompleteauction">unpauseCompleteAuction</a>: returns Term Auction contract to normal operations</td><td></td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermAuctionBidLocker.sol"><mark style="color:yellow;"><code>TermAuctionBidLocker.sol</code></mark></a></td><td><mark style="color:yellow;">Manages Term Auction bid submissions (to borrow)</mark></td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/latest/term-repo-class/term-auction-group/termauctionbidlocker#pauselocking">pauseLocking</a>: triggers a revert when user tries to submit a bid</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionbidlocker#unpauselocking">unpauseLocking</a>: switch off pauseLocking</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionbidlocker#pauseunlocking">pauseUnlocking</a>: triggers a revert when user tries to cancel a bid</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionbidlocker#unpauseunlocking">unpauseUnlocking</a>: switch off pauseUnlocking</td><td></td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermAuctionOfferLocker.sol"><mark style="color:yellow;"><code>TermAuctionOfferLocker.sol</code></mark></a></td><td><mark style="color:yellow;">Manages Term Auction offer submissions (to lend)</mark></td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionofferlocker#pauselocking">pauseLocking</a>: triggers a revert when user tries to submit an offer</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionofferlocker#unpauselocking">unpauseLocking</a>: switch off pauseLocking</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionofferlocker#pauseunlocking">pauseUnlocking</a>: triggers a revert when user tries to cancel an offer</td><td></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.31/term-repo-class/term-auction-group/termauctionofferlocker#unpauseunlocking">unpauseUnlocking</a>: switch off pauseUnlocking</td><td></td></tr></tbody></table>


# Term Servicer Group

The Term Servicer group of contracts maintain records, enforce the terms of a Term Repo arrangement and automate the settlement and collateral management functions handled by the collateral agent in the traditional tri-party repo context. Each Term Repo arrangement requires the deployment of every single contract within this group and the relationship between each contract within this group is always 1:1.

{% content-ref url="/pages/Wa1XTSMZ3ZSJF3WUpAgv" %}
[Initialization Parameters](/term-finance-protocol/term-repo/term-servicer-group/initialization-parameters)
{% endcontent-ref %}

{% content-ref url="/pages/N0vsGkcOaMCtWv7AqgTJ" %}
[Administrative Functions](/term-finance-protocol/term-repo/term-servicer-group/administrative-functions)
{% endcontent-ref %}

<table><thead><tr><th width="352.3333333333333">Contract</th><th>Description and Key External Functions</th></tr></thead><tbody><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoCollateralManager.sol"><mark style="color:yellow;"><code>TermRepoCollateralManager.sol</code></mark></a></td><td><mark style="color:yellow;">Enforces margin maintenance rules for adding/withdrawing, repurchasing and liquidating collateral</mark></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/term-servicer-group/termrepocollateralmanager#externallockcollateral"><code>externalLockCollateral</code></a> - callable by borrower to add to their collateral balance</td></tr><tr><td></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termrepocollateralmanager#externalunlockcollateral"><code>externalUnlockCollateral</code></a> - callable by borrower to withdraw excess collateral balance</td></tr><tr><td></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termrepocollateralmanager#batchliquidation"><code>batchLiquidation</code></a> - callable by public to liquidate one or more collateral tokens belonging to a borrower in margin deficit</td></tr><tr><td></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termrepocollateralmanager#batchliquidationwithrepotoken"><code>batchLiquidationWithRepoToken</code> </a>- callable by public to liquidate one or more collateral tokens belonging to a borrower in margin deficit using Repo Tokens in lieu of purchase token to pay down repo exposure</td></tr><tr><td></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termrepocollateralmanager#batchdefault"><code>batchDefault</code></a>- callable by public to liquidate one or more collateral tokens belonging to a borrower in default due to a failure to repurchase</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoServicer.sol"><mark style="color:yellow;"><code>TermRepoServicer.sol</code></mark></a></td><td><mark style="color:yellow;">Maintains records, collects and disburse repurchase payments</mark></td></tr><tr><td></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termreposervicer#submitrepurchasepayment"><code>submitRepurchasePayment</code></a> - callable by borrower to submit repurchase payment</td></tr><tr><td></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termreposervicer#redeemtermrepotokens"><code>redeemTermRepoTokens</code></a> - callable by liquidity supplier to receive repurchase payment</td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">SPECIALIST_ROLE
</code></pre></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termreposervicer#mintopenexposure"><code>mintOpenExposure</code></a> - callable by users with <code>SPECIALIST_ROLE</code> to mint Term Repo Tokens and open offsetting repurchase obligation exposure (subject to servicing fee and mint cap) by depositing collateral</td></tr><tr><td></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termreposervicer#burncollapseexposure"><code>burnCollapseExposure</code></a> - callable by borrower to burn Term Repo Tokens against outstanding repurchase obligations</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoRolloverManager.sol"><mark style="color:yellow;"><code>TermRepoRolloverManager.sol</code></mark></a></td><td><mark style="color:yellow;">Accepts and carries out borrower rollover instructions</mark></td></tr><tr><td></td><td><a href="/latest/term-repo-class/term-servicer-group/termreporollovermanager#electrollover"><code>electRollover</code></a> - callable by borrower to elect to rollover or extend into a new Term Repo using collateral from existing Term Repo</td></tr><tr><td></td><td><a href="/latest/term-repo-class/term-servicer-group/termreporollovermanager#cancelrollover"><code>cancelRollover</code></a>- callable by borrower to cancel a rollover election</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoLocker.sol"><mark style="color:yellow;"><code>TermRepoLocker.sol</code></mark></a></td><td><mark style="color:yellow;">Contract in which Term Servicer locks collateral and purchase tokens</mark></td></tr><tr><td></td><td><code>&#x3C;no public functions></code></td></tr></tbody></table>


# Initialization Parameters

<table><thead><tr><th width="285.3333333333333">Parameter</th><th width="219">Method</th><th>Description</th></tr></thead><tbody><tr><td>netExposureCapOnLiquidation</td><td>Initialized By Deployer</td><td>A cap on the amount of net exposure (collateral market value less the initial margin requirement) over the remaining repurchase obligation outstanding from that borrower post-liquidation</td></tr><tr><td>deMinimisMarginThreshold</td><td>Initialized By Deployer</td><td>The difference between collateral market value and a borrower's repurchase obligation denominated in dollars where the <code>netExposureCapOnLiquidation</code> no longer applies</td></tr></tbody></table>


# Administrative Functions

<table><thead><tr><th width="352.3333333333333">Contract</th><th>Description and Key External Functions</th></tr></thead><tbody><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoCollateralManager.sol"><mark style="color:yellow;"><code>TermRepoCollateralManager.sol</code></mark></a></td><td><mark style="color:yellow;">Enforces margin maintenance rules for adding/withdrawing, repurchasing and liquidating collateral</mark></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termrepocollateralmanager#pauseliquidations">pauseLiquidations </a>- triggers revert on any calls to <code>batchLiquidation</code> , <code>batchLiquidationWithRepoToken</code>, and <code>batchDefault</code></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termrepocollateralmanager#unpauseliquidations">unpauseLiquidations</a> - returns Collateral Manager contract to normal operations</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoServicer.sol"><mark style="color:yellow;"><code>TermRepoServicer.sol</code></mark></a></td><td><mark style="color:yellow;">Maintains records, collects and disburse repurchase payments</mark></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/0.5.32/term-repo-class/term-servicer-group/termreposervicer#grantmintexposureaccess">grantMintExposureAccess </a>- grants MINTER_ROLE access to specified wallet adress, required to mint repo tokens against collateral</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoRolloverManager.sol"><mark style="color:yellow;"><code>TermRepoRolloverManager.sol</code></mark></a></td><td><mark style="color:yellow;">Accepts and carries out borrower rollover instructions</mark></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/latest/term-repo-class/term-servicer-group/termreporollovermanager#approvedrolloverauctionbidlockers">approveRolloverAuctionBidlocker </a>- grants required protocol roles to enable borrower rollovers</td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/latest/term-repo-class/term-servicer-group/termreporollovermanager#revokerolloverapproval">revokeRolloverApproval</a> - removes specified Bid Locker from the approved rollover auctions list</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoLocker.sol"><mark style="color:yellow;"><code>TermRepoLocker.sol</code></mark></a></td><td><mark style="color:yellow;">Contract in which Term Servicer locks collateral and purchase tokens</mark></td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/latest/term-repo-class/term-servicer-group/termrepolocker#pausetransfers">pauseTransfers </a>- triggers revert on any calls to transferTokenToWallet and transferTokenFromWallet</td></tr><tr><td><pre class="language-solidity"><code class="lang-solidity">ADMIN_ROLE
</code></pre></td><td><a href="/latest/term-repo-class/term-servicer-group/termrepolocker#unpausetransfers">unpauseTransfers</a> - returns Term Repo Locker contract to normal operations</td></tr></tbody></table>


# Term Repo Token

The Term Repo Token is an implementation of the ERC-20 smart contract standard that track claims to the aggregate repurchase price due on the repurchase date (the total amount due at maturity) across all borrowers to a Term Repo deployment. The Term Repo Token is typically normalized to be redeemable 1:1 for the purchase token in which a Term Repo deployment is denominated on or after the Repurchase Date (subject to a [repurchase window ](/term-finance-protocol/terminology#repurchase-window)that typically lasts 12-24 hours).

{% content-ref url="/pages/JU3xgCE4Rv68Oy61aEuc" %}
[Initialization Parameters](/term-finance-protocol/term-repo/term-repo-token/initialization-parameters)
{% endcontent-ref %}

{% content-ref url="/pages/5nfXeq54vq2QwvzO8B2y" %}
[Administrative Functions](/term-finance-protocol/term-repo/term-repo-token/administrative-functions)
{% endcontent-ref %}

| Contract                                                                                                                                               | Description and Key External Functions                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [<mark style="color:yellow;">`TermRepoToken.sol`</mark>](https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoToken.sol) | <mark style="color:yellow;">ERC-20 contract to track claims to the aggregate repurchase obligations due on the repurchase date across all borrowers</mark> |
|                                                                                                                                                        | `<no public functions>`                                                                                                                                    |
|                                                                                                                                                        | `totalRedemptionValue` - total purchase tokens redeemable at maturity                                                                                      |


# Initialization Parameters

| Parameter       | Method                  | Description                                                                                                                                           |
| --------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| mintExposureCap | Initialized By Deployer | A uint256 number setting the limit on the amount of tokens that can be minted by users with `MINTER_ROLE` outside of a Term Auction                   |
| redemptionValue | Initialized by Deployer | A uint256 number setting the Term Repo Token to purchase token redemption ratio (typically 1:1)                                                       |
| decimalPlaces   | Initialized by Deployer | A uint8 number specifying the number of decimal places the Term Repo Token will be intialized with (typically set equal to underlying purchase token) |


# Administrative Functions

<table><thead><tr><th>Contract</th><th>Description and Key External Functions</th></tr></thead><tbody><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermRepoToken.sol"><mark style="color:yellow;"><code>TermRepoToken.sol</code></mark></a></td><td><mark style="color:yellow;">ERC-20 contract to track claims to the aggregate repurchase obligations due on the repurchase date across all borrowers</mark></td></tr><tr><td><pre><code>ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/termrepotoken#resetmintexposurecap">resetMintExposureCap </a>- resets the maximum amount of repo tokens that can be minted against collateral back to default amount specified on initialization</td></tr><tr><td><pre><code>ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/termrepotoken#pauseminting">pauseMinting </a>- triggers revert on any call to <code>mintTokens</code> and <code>mintRedemptionValue</code></td></tr><tr><td><pre><code>ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/termrepotoken#unpauseminting">unpauseMinting </a>- returns Repo Token contract to normal minting operations</td></tr><tr><td><pre><code>ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/termrepotoken#pauseburning">pauseBurning </a>- triggers revert on any call to <code>burn</code> and <code>burnAndReturnValue</code></td></tr><tr><td><pre><code>ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/term-repo-class/termrepotoken#unpauseburning">unpauseBurning </a>- returns Repo Token contract to normal burning operations</td></tr></tbody></table>


# Protocol Contracts

Protocol contracts are evergreen contracts at the protocol level that govern and apply across all Term Repos. The following contracts belong to this class and handle protocol level authentication, security controls, event logging and manage centralized price feeds.

<table><thead><tr><th>Contract</th><th>Description and Key Functions</th></tr></thead><tbody><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermInitializer.sol"><mark style="color:yellow;"><code>TermInitializer.sol</code></mark></a></td><td><mark style="color:yellow;">Initializes a Term Repo</mark></td></tr><tr><td><pre><code>INITIALIZER_APPROVAL_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/protocol-class/terminitializer#setupterm"><code>setupTerm</code></a>: Validates Term Repo contracts against the Term Controller contract, emits initialization events during deployment and pairs validated Term Repo contracts with Protocol Contracts</td></tr><tr><td><pre><code>INITIALIZER_APPROVAL_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/protocol-class/terminitializer#setupauction">setupAuction</a>: Validates Term Auction contracts against the Term Controller contract, emits initialization events during deployment and pairs Term Auction contracts with Protocol Contracts and Term Repo contracts</td></tr><tr><td><pre><code>ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/protocol-class/terminitializer#pausedeploying">pauseDeploying</a>: Triggers revert when trying to call setupTerm or setupAuction</td></tr><tr><td><pre><code>ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.5.31/protocol-class/terminitializer#unpausedeploying">unpauseDeploying</a>: Resumes Term Initializer for regular deployment</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermController.sol"><mark style="color:yellow;"><code>TermController.sol</code></mark></a></td><td><mark style="color:yellow;">Designates the Protocol treasury and reserve wallet address as well as maintain a ledger of validly deployed Protocol contracts</mark></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termcontroller#gettreasuryaddress">getTreasuryAddress</a>: External view function that returns the Treasury wallet address</td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termcontroller#getprotocolreserveaddress">getProtocolReserveAddress</a>: External view function that returns the Protocol Reserve allet address</td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termcontroller#istermdeployed">isTermDeployed</a>: External view function that returns a boolean indicating whether a given contract address was validly deployed by the Protocol</td></tr><tr><td><pre><code>DEVOPS_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termcontroller#updatetreasuryaddress"><code>updateTreasuryAddress</code></a>: Updates or changes treasury address where servicing fees are collected</td></tr><tr><td><pre><code>DEVOPS_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termcontroller#updateprotocolreserveaddress"><code>updateProtocolReserveAddress</code></a>: Updates or changes reserve address where protocol liquidated damages are collected</td></tr><tr><td><pre><code>ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termcontroller#updatecontrolleradminwallet">updateControllerAdminWallet</a>: Updates or changes Controller Admin wallet</td></tr><tr><td><pre><code>CONTROLLER_ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termcontroller#marktermdeployed"><code>markTermDeployed</code></a>: Marks a smart contract as a valid Protocol deployment and adds address to Term Controller contract</td></tr><tr><td><pre><code>CONTROLLER_ADMIN_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termcontroller#unmarktermdeployed">unmarkTermDeployed</a>: Removes a previously validated smart contract address from the Term Controller contract</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermPriceConsumerV3.sol"><mark style="color:yellow;"><code>TermPriceConsumerV3.sol</code></mark></a></td><td><mark style="color:yellow;">A centralized price oracle contract that feeds pricing data to Term Repo contracts</mark></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termpriceconsumerv3#usdvalueoftokens"><code>usdValueOfTokens</code></a>: External function, returns value of tokens denominated in USD given an amount and a token address</td></tr><tr><td><pre><code>DEVOPS_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termpriceconsumerv3#addnewtokenpricefeed"><code>addNewTokenPriceFeed</code></a>: Callable by Admin, adds/subscribes to a new price feed</td></tr><tr><td><pre><code>DEVOPS_ROLE
</code></pre></td><td></td></tr><tr><td></td><td><a href="/0.6.0/protocol-class/termpriceconsumerv3#removetokenpricefeed"><code>removeTokenPriceFeed</code></a>: Callable by Admin, removes/unsubscribes from a previously added price feed</td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/contracts/TermEventEmitter.sol"><mark style="color:yellow;"><code>TermEventEmitter.sol</code></mark></a></td><td><mark style="color:yellow;">A centralized event emitter that records various important Protocol events to the blockchain</mark></td></tr><tr><td></td><td><code>&#x3C;internal only></code></td></tr></tbody></table>


# Price Feeds

Term Finance relies on the [<mark style="color:yellow;">`TermPriceConsumerV3.sol`</mark>](https://github.com/term-finance/term-finance-developer-docs/blob/main/term-finance-protocol/protocol-contracts/broken-reference/README.md) to serve as an oracle to monitor the health of active borrows on the Protocol in [<mark style="color:yellow;">`TermRepoCollateralManager.sol`</mark>](/0.6.0/term-repo-class/term-servicer-group/termrepocollateralmanager) and the sufficiency of collateral associated with bids placed auction in [<mark style="color:yellow;">`TermAuctionBidlocker.sol`</mark>](/0.5.32/term-repo-class/term-auction-group/termauctionbidlocker) This oracle inherits Chainlink's [`AggregatorV3Interface`](https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol) to retrieve data from Chainlink or Chainlink compatible price aggregators/price feeds. Below, we provide a list of feeds currently subscribed to by the Protocol.

{% hint style="info" %}
This list is subject to change as new tokens and networks are added to the Protocol.
{% endhint %}

### Data Feed Categories

* 🟢 **Chainlink Feed**: follows standard Chainlink price feeds workflow that integrates three layers of aggregation (at the data source, node operator, and oracle network layers)
* 🔵 **Combination/Custom Feed**: custom feed for wrapped tokens, 4626 vault tokens etc. that typically combine multiple Chainlink price feeds and/or other on-chain data

{% tabs %}
{% tab title="Ethereum" %}

### Ethereum Network

<table><thead><tr><th width="213">Pair</th><th width="253">Primary</th><th width="232">Fallback</th></tr></thead><tbody><tr><td>🟢 USDC/USD</td><td><a href="https://data.chain.link/ethereum/mainnet/stablecoins/usdc-usd"><code>0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6</code></a></td><td><a href="https://chroniclelabs.org/dashboard/data-feeds/USDC-USD?start_date=2026-07-06&#x26;end_date=2026-08-05&#x26;blockchain=ETH&#x26;contract=0xCe701340261a3dc3541C5f8A6d2bE689381C8fCC&#x26;txn=0x94681c1e3a329f571b3c27a941564bddc5fe8108e9d546ef9d70e87de1f84b30"><code>0x04e48a5274cBd953eA3846C4d4AB5dFE4cDe89c6</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.25%</td><td>Source: Chronicle<br>Heartbeat: 12 hours / 1%</td></tr><tr><td>🟢 USDT/USD</td><td><a href="https://data.chain.link/ethereum/mainnet/stablecoins/usdt-usd"><code>0x3E7d1eAB13ad0104d2750B8863b489D65364e32d</code></a></td><td><a href="https://chroniclelabs.org/dashboard/data-feeds/USDT-USD?start_date=2026-07-06&#x26;end_date=2026-08-05&#x26;blockchain=ETH&#x26;contract=0x7084a627a22b2de99E18733DC5aAF40993FA405C&#x26;txn=0x94681c1e3a329f571b3c27a941564bddc5fe8108e9d546ef9d70e87de1f84b30"><code>0x6864CDC8E48F32ff626766b9b19B6a700450135D</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.25%</td><td>Source: Chronicle<br>Heartbeat: 12 hours / 1%</td></tr><tr><td>🟢 DAI/USD</td><td><a href="https://data.chain.link/ethereum/mainnet/stablecoins/dai-usd"><code>0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 1 hour / 0.25%</td><td></td></tr><tr><td>🟢 ETH/USD</td><td><a href="https://data.chain.link/ethereum/mainnet/crypto-usd/eth-usd"><code>0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><code>0x46ef0071b1e2ff6b42d36e5a177ea43ae5917f4e</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle<br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 WBTC/USD</td><td><a href="https://etherscan.io/address/0x442fa169F9c5271722E8854c75ee005922b1Cc34#readContract"><code>0x442fa169F9c5271722E8854c75ee005922b1Cc34</code></a></td><td><a href="https://etherscan.io/address/0x1f6ce69a355a4592743Bb01F4cC3aD14C2ec3e7C#code"><code>0x1f6ce69a355a4592743Bb01F4cC3aD14C2ec3e7C</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/btc-usd"><em>BTC/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD?blockchain=ETH&#x26;txn=0xfab44c8778443dd6db852d05af2dd4893226913cb759e64b1c259fdc3ce449c4&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><em>BTC/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/wbtc-btc"><em>WBTC/BTC</em></a><br>Heartbeat: 24 hours / 2.00%</td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/wbtc-btc"><em>WBTC/BTC</em></a><br>Heartbeat: 24 hours / 2.00%</td></tr><tr><td>🔵 WSTETH/USD</td><td><a href="https://etherscan.io/address/0xA64a0A25de00c7cEd3cCaa1F7EC51c3c8e3E899d#code"><code>0xA64a0A25de00c7cEd3cCaa1F7EC51c3c8e3E899d</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/WSTETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0xA770582353b573CbfdCC948751750EeB3Ccf23CF"><code>0xA770582353b573CbfdCC948751750EeB3Ccf23CF</code></a></td></tr><tr><td></td><td>Read contract: <a href="https://etherscan.io/token/0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0#readContract#F10"><code>stEthPerToken</code></a></td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/WSTETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0xA770582353b573CbfdCC948751750EeB3Ccf23CF"><em>WSTETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td></td><td><p>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/steth-eth"><em>STETH/ETH</em></a></p><p>Heartbeat: 24 hour / 0.50%</p></td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td></td></tr><tr><td>🔵 SDAI/USD</td><td><a href="https://etherscan.io/address/0xAd67b3d95354A0eF001458E0e328BA37628A9327#code"><code>0xAd67b3d95354A0eF001458E0e328BA37628A9327</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink <em>DAI/USD</em><br>Heartbeat: 1 hour / 0.25%</td><td></td></tr><tr><td></td><td>Read contract: <a href="https://etherscan.io/address/0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7#readContract#F2"><code>chi</code></a></td><td></td></tr><tr><td>🔵 CBETH/USD</td><td><a href="https://etherscan.io/address/0xd2ce1D33fCABEDF785a2F5c90d0E0913c46c7BfD#code"><code>0xd2ce1D33fCABEDF785a2F5c90d0E0913c46c7BfD</code></a></td><td><a href="https://etherscan.io/address/0x2465f23218b62485482e72ab2ec5e18d7b873bef"><code>0x2465f23218b62485482e72ab2ec5e18d7b873bef</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/cbeth-eth"><em>CBETH/ETH</em></a><br>Heartbeat: 24 hours / 1.00%</td><td>Source: <a href="https://etherscan.io/address/0xBe9895146f7AF43049ca1c1AE358B0541Ea49704">Coinbase cbEth.exchangeRate()</a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><em>ETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 WSTBT/USD</td><td><a href="https://etherscan.io/address/0x2d41692b3a1bc453fc0fc2e82c5ab79f8aef0494#readContract"><code>0x2D41692b3A1Bc453fC0fC2e82c5ab79F8aeF0494</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/stbt-por"><em>STBT POR</em></a><br>Heartbeat: 24 hours / 0.001%</td><td></td></tr><tr><td></td><td>Read contract: <a href="https://etherscan.io/address/0x288A8005C53632d920045b7C7c2e54A3f1Bc4C83#readContract#F6"><code>getStbtByWstbt</code></a></td><td></td></tr><tr><td>🔵 WEETH/USD</td><td><a href="https://etherscan.io/token/0xd599c45B9A783CCdE283B12a5172181acB4EA596#code"><code>0xd599c45B9A783CCdE283B12a5172181acB4EA596</code></a></td><td><a href="https://etherscan.io/address/0xb56c656C7A809944188d1e4f904a57769e1D8Ab0#code"><code>0xb56c656C7A809944188d1e4f904a57769e1D8Ab0</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/weeth-eth"><em>WEETH/ETH</em></a><br>Heartbeat: 24 hours / 0.50%</td><td>Source: Redstone <a href="https://etherscan.io/address/0x8751F736E94F6CD167e8C5B97E245680FbD9CC36#readProxyContract"><em>WEETH/ETH</em></a><br>Heartbeat: 24 hours / 0.50%</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><em>ETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 EZETH/USD</td><td><a href="https://etherscan.io/address/0xcC267b34a98869C6B029E85c3EAF701bf6844b6a#code"><code>0xcC267b34a98869C6B029E85c3EAF701bf6844b6a</code></a></td><td><a href="https://etherscan.io/address/0x1f03bd53b080493cA228fBd290500538C92e8Bfd#code"><code>0x1f03bd53b080493cA228fBd290500538C92e8Bfd</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/ezeth-eth">EZETH/ETH</a><br>Heartbeat: 24 hours / 0.50%</td><td>Source: Redstone <a href="https://etherscan.io/address/0xf4a3e183f59d2599ee3df213ff78b1b3b1923696#code"><em>EZETH/ETH</em></a><br>Heartbeat: 24 hours / 0.50%</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><em>ETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 APXETH/USD</td><td><a href="https://etherscan.io/address/0xc2b07c73431c9FCbD27Ad32fa93932D1913AeE43#readContract"><code>0xc2b07c73431c9FCbD27Ad32fa93932D1913AeE43</code></a></td><td></td></tr><tr><td></td><td><p>Source: Redstone</p><p><a href="https://etherscan.io/address/0x19219BC90F48DeE4d5cF202E09c438FAacFd8Bea#readProxyContract"><em>APXETH/ETH</em></a><br>Heartbeat: 24 hours / 1.00%</p></td><td></td></tr><tr><td></td><td>Source: Chainlink<br><a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td></td></tr><tr><td>🔵 SUSDE/USD</td><td><a href="https://etherscan.io/address/0x7286466DaEDc0Ae531c56734ceC4625681d4d2c6#readContract"><code>0x7286466DaEDc0Ae531c56734ceC4625681d4d2c6</code></a></td><td><a href="https://etherscan.io/address/0xb99D174ED06c83588Af997c8859F93E83dD4733f#readProxyContract"><code>0xb99d174ed06c83588af997c8859f93e83dd4733f</code></a></td></tr><tr><td></td><td>Source: Chainlink<br><a href="https://data.chain.link/feeds/ethereum/mainnet/usde-usd"><em>USDE/USD</em></a><br>Heartbeat: 24 hours / 0.50%</td><td>Source: Redstone<br><a href="https://docs.redstone.finance/docs/get-started/price-feeds">SUSDE/USD</a><br>Heartbeat: 24 hours / 0.20%</td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x9D39A5DE30e57443BfF2A8307A4256c8797A3497#readContract#F7"><code>convertToAssets</code></a></td><td></td></tr><tr><td>🔵 USD0++/USD</td><td><a href="https://etherscan.io/address/0x978bC6c3F25B0729d78FdA046B4aBB87EDC75EBB#readContract"><code>0x978bC6c3F25B0729d78FdA046B4aBB87EDC75EBB</code></a></td><td></td></tr><tr><td></td><td>Source: Usual Token Map<br><a href="https://etherscan.io/address/0x43882C864a406D55411b8C166bCA604709fDF624#readProxyContract#F2">getAllUsd0Rwa</a></td><td></td></tr><tr><td></td><td>Source: Usual Protocol<br><a href="https://etherscan.io/address/0xb97e163cE6A8296F36112b042891CFe1E23C35BF#readProxyContract#F3">getPrice</a></td><td></td></tr><tr><td></td><td>Source: Usual Treasury<br><a href="https://etherscan.io/address/0xdd82875f0840aad58a455a70b88eed9f59cec7c7#code">balanceOf()</a></td><td></td></tr><tr><td></td><td>Source: Total Supply<br><a href="https://etherscan.io/address/0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5#readProxyContract#F12">totalSupply</a></td><td></td></tr><tr><td>🟢 DEUSD/USD</td><td><a href="https://etherscan.io/address/0x89F48f6671Ec1B1C4f6abE964EBdd21F4eb7076f#readProxyContract"><code>0x89f48f6671ec1b1c4f6abe964ebdd21f4eb7076f</code></a></td><td></td></tr><tr><td></td><td>Source: Redstone<br>Heartbeat: 12 hours / 0.1%</td><td></td></tr><tr><td>🔵 LBTC/USD</td><td><a href="https://etherscan.io/address/0x16d35bb3bf5ca76c8fb54853910094e51fc56520"><code>0x16d35bb3bf5ca76c8fb54853910094e51fc56520</code></a></td><td><a href="https://etherscan.io/address/0x8c9afd4e356959f44aed4bb422bd54dc0147b67e"><code>0x8c9afd4e356959f44aed4bb422bd54dc0147b67e</code></a></td></tr><tr><td></td><td>Source: <a href="https://etherscan.io/address/0xb415eAA355D8440ac7eCB602D3fb67ccC1f0bc81#readProxyContract">Redstone Reserve</a></td><td>Source: <a href="https://etherscan.io/address/0xb415eAA355D8440ac7eCB602D3fb67ccC1f0bc81#readProxyContract">Redstone Reserve</a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/btc-usd"><em>BTC/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD?blockchain=ETH&#x26;txn=0xfab44c8778443dd6db852d05af2dd4893226913cb759e64b1c259fdc3ce449c4&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><em>BTC/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 uniBTC/USD</td><td><a href="https://etherscan.io/address/0x442fa169F9c5271722E8854c75ee005922b1Cc34#readContract"><code>0x442fa169F9c5271722E8854c75ee005922b1Cc34</code></a></td><td><a href="https://etherscan.io/address/0x1f6ce69a355a4592743Bb01F4cC3aD14C2ec3e7C#code"><code>0x1f6ce69a355a4592743Bb01F4cC3aD14C2ec3e7C</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/btc-usd"><em>BTC/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD?blockchain=ETH&#x26;txn=0xfab44c8778443dd6db852d05af2dd4893226913cb759e64b1c259fdc3ce449c4&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><em>BTC/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/wbtc-btc"><em>WBTC/BTC</em></a><br>Heartbeat: 24 hours / 2.00%</td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/wbtc-btc"><em>WBTC/BTC</em></a><br>Heartbeat: 24 hours / 2.00%</td></tr><tr><td>🔵 RSETH/USD</td><td><a href="https://etherscan.io/address/0x17f838f759aca7a18e2090da25397394b4aa6798"><code>0x17f838f759aca7a18e2090da25397394b4aa6798</code></a></td><td><a href="https://etherscan.io/address/0x9385cd242534995de664875bd0ebc8ff6e5541f4"><code>0x9385cd242534995de664875bd0ebc8ff6e5541f4</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://etherscan.io/address/0x03c68933f7a3F76875C0bc670a58e69294cDFD01">RSETH/ETH</a><br>Heartbeat: 24 hours / 0.50%</td><td>Source: Redstone <a href="https://etherscan.io/address/0xa736eae8805ddeffba40cab8c99bcb309deabd9b">RSETH/ETH</a><br>Heartbeat: 24 hours / 0.50%</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><em>ETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 PUFETH/USD</td><td><a href="https://etherscan.io/address/0xaa562b8f109c90fd32d6829f054c35dedd123eff"><code>0xaa562b8f109c90fd32d6829f054c35dedd123eff</code></a></td><td></td></tr><tr><td></td><td>Source: Redstone <a href="https://etherscan.io/address/0x76A495b0bFfb53ef3F0E94ef0763e03cE410835C">PUFETH/ETH</a><br>Heartbeat: 24 hours / 1.00%</td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td></td></tr><tr><td>🟢 SOL/USD</td><td><a href="https://data.chain.link/feeds/ethereum/mainnet/sol-usd"><code>0x4ffC43a60e009B551865A93d232E33Fce9f01507</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hour / 2.00%</td><td></td></tr><tr><td>🟢 cbBTC/USD</td><td><a href="https://data.chain.link/feeds/ethereum/mainnet/btc-usd"><code>0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD?blockchain=ETH&#x26;txn=0x403c72ea6c1c65ad2a9b116a7c09650fb1729a6cdc631c6981206de5cbe407bd&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><code>0x24C392CDbF32Cf911B258981a66d5541d85269ce</code></a></td></tr><tr><td></td><td>Source: Chainlink BTC/USD<br>Heartbeat: 1 hour / 0.5%</td><td>Source: Chronicle BTC/USD<br>Heartbeat: 12 hour / 1.00%</td></tr><tr><td>🟢 TRYB/USD</td><td><a href="https://data.chain.link/feeds/ethereum/mainnet/try-usd"><code>0xB09fC5fD3f11Cf9eb5E1C5Dba43114e3C9f477b5</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink TRY/USD<br>Heartbeat: 24 hour / 0.5%</td><td></td></tr><tr><td>🔵 PT-sUSDE-27MAR2025/USD</td><td><a href="https://etherscan.io/address/0x153E9808e57273D88c9F01F342A6bB30a17F3ce3#code"><code>0x153E9808e57273D88c9F01F342A6bB30a17F3ce3</code></a></td><td><a href="https://etherscan.io/address/0x971Bc84Eb1FbBf52372e0FDcde36725FFC56DeB1#code"><code>0x971Bc84Eb1FbBf52372e0FDcde36725FFC56DeB1</code></a></td></tr><tr><td></td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usde-usd">USDE/USD</a></td><td>Source: Redstone <a href="https://app.redstone.finance/app/token/USDe/">USDE/USD</a></td></tr><tr><td>🔵 tETH/USD</td><td><a href="https://etherscan.io/address/0x4B24cCe36bce862b16DB35D4Ade14CA7c200121D"><code>0x4B24cCe36bce862b16DB35D4Ade14CA7c200121D</code></a></td><td><a href="https://etherscan.io/address/0x67ec80c1f91725736e13ae034ea15412e2adfbf9"><code>0x67ec80C1F91725736e13aE034EA15412E2adfBF9</code></a></td></tr><tr><td></td><td>Source: Term/Chainlink <a href="https://etherscan.io/address/0x81dcb824f31bd145544A5B30976bE50C5ac492Ad#code">WSTETH/USD</a></td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/WSTETH/USD?blockchain=ETH&#x26;txn=0xf2ad3effe16d1c76157267d3a081cf59a6d3140bf1537814fb2e1498dd21777d&#x26;contract=0xA770582353b573CbfdCC948751750EeB3Ccf23CF">WSTETH/USD</a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8"><code>convertToAssets</code></a></td><td>Read contract:<br><a href="https://etherscan.io/address/0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8"><code>convertToAssets</code></a></td></tr><tr><td>🔵 ETH+/USD</td><td><a href="https://etherscan.io/address/0xD3526265FCd3fc1e887FC8aC454440ff941082D5"><code>0xD3526265FCd3fc1e887FC8aC454440ff941082D5</code></a></td><td><a href="https://etherscan.io/address/0x723614640c10A3052359B9094b3bDa75d10c7371"><code>0x723614640c10A3052359B9094b3bDa75d10c7371</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd">ETH/USD</a></td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0x972d03fcdc364b8a3a5fccd43d88b32c4be9fe6f05fffb238613617fc3b2298c&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E">ETH/USD</a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x56f40A33e3a3fE2F1614bf82CBeb35987ac10194#readProxyContract#F18"><code>quote</code></a></td><td>Read contract:<br><a href="https://etherscan.io/address/0x56f40A33e3a3fE2F1614bf82CBeb35987ac10194#readProxyContract#F18"><code>quote</code></a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0xf526f058858E4cD060cFDD775077999562b31bE0#readProxyContract#F11"><code>toColl</code></a><br>to get collateral adapter for each LST</td><td>Read contract:<br><a href="https://etherscan.io/address/0xf526f058858E4cD060cFDD775077999562b31bE0#readProxyContract#F11"><code>toColl</code></a><br>to get collateral adapter for each LST</td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x73a36258E6A48D0095D1997Fec7F51e191B4Ec81#readContract#F18"><code>refPerTok</code></a><br>for each underlying LST collateral adapter</td><td>Read contract:<br><a href="https://etherscan.io/address/0x73a36258E6A48D0095D1997Fec7F51e191B4Ec81#readContract#F18"><code>refPerTok</code></a><br>for each underlying LST collateral adapter</td></tr><tr><td>🟢 USDS/USD</td><td><a href="https://data.chain.link/feeds/ethereum/mainnet/usds-usd"><code>0xfF30586cD0F29eD462364C7e81375FC0C71219b1</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hour / 0.30%</td><td></td></tr><tr><td>🔵 PT-ysUSDC-17APR2025/USD</td><td><a href="https://etherscan.io/address/0x950387718825781E981Fa2dC8a1981a7b16a7DBa#code"><code>0x950387718825781E981Fa2dC8a1981a7b16a7DBa</code></a></td><td></td></tr><tr><td></td><td>PT_price = <a href="https://data.chain.link/feeds/ethereum/mainnet/usdc-usd">USDC_price</a> / (1+0.20*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>USDC Source: Chainlink<br>Heartbeat: 24 hours / 0.25%</td><td></td></tr><tr><td>🔵 PT-sUSDE-29MAY2025/USD</td><td><a href="https://etherscan.io/address/0xfC1C3cBa7793F7AAC107f2b6e418D1BC71C6D887#code"><code>0xfC1C3cBa7793F7AAC107f2b6e418D1BC71C6D887</code></a></td><td><a href="https://etherscan.io/address/0x38A334f659EC9b89A225d52d3617425ad8230110#code"><code>0x38A334f659EC9b89A225d52d3617425ad8230110</code></a></td></tr><tr><td></td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usde-usd">USDE/USD</a></td><td>Source: Redstone <a href="https://app.redstone.finance/app/token/USDe/">USDE/USD</a></td></tr><tr><td>🔵 lvlUSD/USD</td><td><a href="https://etherscan.io/address/0x3D27eFb2C5CDFE28447F1973AFDbb3c4fB9ce060#readProxyContract"><code>0x3D27eFb2C5CDFE28447F1973AFDbb3c4fB9ce060</code></a></td><td></td></tr><tr><td></td><td>Source: Level ReserveLens</td><td></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x29759944834e08acE755dcEA71491413f7e2CBAD#readProxyContract"><code>getReservePrice</code></a></td><td></td></tr><tr><td>🔵 PT-ysUSDC-31JUL2025/USD</td><td><a href="https://etherscan.io/address/0xC336B55254dAAa9C77df953864bd107c027e48A0#code"><code>0xC336B55254dAAa9C77df953864bd107c027e48A0</code></a></td><td></td></tr><tr><td></td><td>PT_price = <a href="https://data.chain.link/feeds/ethereum/mainnet/usdc-usd">USDC_price</a> / (1+0.20*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>USDC Source: Chainlink<br>Heartbeat: 24 hours / 0.25%</td><td></td></tr><tr><td>🔵 SuperETH/USD</td><td><a href="https://etherscan.io/address/0xf04d1a22e4c804119ded24e28a8b5b3242f46f43#code"><code>0xf04d1a22e4C804119DeD24E28a8b5b3242F46F43</code></a></td><td><a href="https://etherscan.io/address/0x0ef80293c8120b61ea49b0f9fb0ca435a05bbb0e#code"><code>0x0eF80293c8120b61Ea49b0f9fB0ca435a05bBb0e</code></a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0xeF101508bf4DC6CF0f0a0C135f39a41faB4E4389#readProxyContract#F8"><code>convertToAssets</code></a></td><td>Read contract:<br><a href="https://etherscan.io/address/0xeF101508bf4DC6CF0f0a0C135f39a41faB4E4389#readProxyContract#F8"><code>convertToAssets</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><em>ETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 PT-sUSDE-31JUL2025/USD</td><td><a href="https://etherscan.io/address/0xfb24CA7281F0044E1fc4088B076243f53832983F#code"><code>0xfb24CA7281F0044E1fc4088B076243f53832983F</code></a></td><td><a href="https://etherscan.io/address/0xcA4F7F7e9ecEeD73DC52ce894153098815Ddcd94#code"><code>0xcA4F7F7e9ecEeD73DC52ce894153098815Ddcd94</code></a></td></tr><tr><td></td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usde-usd">USDE/USD</a></td><td>Source: Redstone <a href="https://app.redstone.finance/app/token/USDe/">USDE/USD</a></td></tr><tr><td>🔵 hETH/USD</td><td><a href="https://etherscan.io/address/0xE924648A8251d65bAfd376189a8dfabAAFdf0FB0#code"><code>0xE924648A8251d65bAfd376189a8dfabAAFdf0FB0</code></a></td><td><a href="https://etherscan.io/address/0x016572AaCd1BCb1FCa8C495488742A66D5fa4Dab#code"><code>0x016572AaCd1BCb1FCa8C495488742A66D5fa4Dab</code></a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x0Bc5D46b202EfCaAed5b8cf10bDBBA9E036CCf53#readContract#F1"><code>exchangeRate</code></a></td><td>Read contract:<br><a href="https://etherscan.io/address/0x0Bc5D46b202EfCaAed5b8cf10bDBBA9E036CCf53#readContract#F1"><code>exchangeRate</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Redstone <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><em>ETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🟢 RLUSD/USD</td><td><a href="https://data.chain.link/feeds/ethereum/mainnet/rlusd-usd"><code>0x26C46B7aD0012cA71F2298ada567dC9Af14E7f2A</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hour / 0.30%</td><td></td></tr><tr><td>🔵 ynETHx/USD</td><td><a href="https://etherscan.io/address/0x1d213B5ac3ea9f33DCB4Bd4b92735d2a4eb4d61d#code"><code>0x1d213B5ac3ea9f33DCB4Bd4b92735d2a4eb4d61d</code></a></td><td><a href="https://etherscan.io/address/0x044BE1e7a26Ec4Ac8Ac9A0c8D05115FCf57Cc119#code"><code>0x044BE1e7a26Ec4Ac8Ac9A0c8D05115FCf57Cc119</code></a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x657d9ABA1DBb59e53f9F3eCAA878447dCfC96dCb#readProxyContract#F21"><code>convertToAssets</code></a></td><td>Read contract:<br><a href="https://etherscan.io/address/0x657d9ABA1DBb59e53f9F3eCAA878447dCfC96dCb#readProxyContract#F21"><code>convertToAssets</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Redstone <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><em>ETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 PT-cUSDO-19JUN2025/USD</td><td><a href="https://etherscan.io/address/0x7979370298b0D368D612dfb665501f02A3bbc8E1#code"><code>0x7979370298b0D368D612dfb665501f02A3bbc8E1</code></a></td><td><a href="https://etherscan.io/address/0x87177f9D3AffF0F5023eC6ccEc1Bde4DD7cC31FE#code"><code>0x87177f9D3AffF0F5023eC6ccEc1Bde4DD7cC31FE</code></a></td></tr><tr><td></td><td>PT_price = USDC_price / (1+0.20*days_to_maturity/360)</td><td>PT_price = USDC_price / (1+0.20*days_to_maturity/360)</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usdc-usd">USDC/USD</a><br>Heartbeat: 24 hours / 0.25%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/USDC/USD#blockchain=ETH&#x26;contract=0xCe701340261a3dc3541C5f8A6d2bE689381C8fCC&#x26;txn=0xb7b3d4e0b6652bd01e6a4d5add3d455cb79b27c4154070abbc8ea924b119112a">USDC/USD</a><br>Heartbeat: 12 hours / 1%</td></tr><tr><td>🟢 RLP/USD</td><td><a href="https://etherscan.io/address/0xAdb2c15Fde49D1A4294740aCb650de94184E66b2#code"><code>0xAdb2c15Fde49D1A4294740aCb650de94184E66b2</code></a></td><td></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0xAe2364579d6CB4bbD6695846c1d595ca9aF3574D#readProxyContract#F9"><code>lastPrice</code></a></td><td></td></tr><tr><td></td><td>Source: Resolv</td><td></td></tr><tr><td>🟢 UNI/USD</td><td><a href="https://data.chain.link/feeds/ethereum/mainnet/uni-usd"><code>0x553303d460EE0afB37EdFf9bE42922D8FF63220e</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 1 hours / 1%</td><td></td></tr><tr><td>🔵 PT-ysWETH-31JUL2025/USD</td><td><a href="https://etherscan.io/address/0x7443464Aa2e730680844F3008E3EF991F4bD0c0d#code"><code>0x7443464Aa2e730680844F3008E3EF991F4bD0c0d</code></a></td><td></td></tr><tr><td></td><td>PT_price = <a href="https://etherscan.io/address/0xf04d1a22e4c804119ded24e28a8b5b3242f46f43#code">SuperETH_price</a> / (1+0.10*days_to_maturity/360)</td><td></td></tr><tr><td>🟢 reUSD/USD</td><td><a href="https://etherscan.io/address/0x72B5760cFBE437DD01409f44055fDfB8f8121B46#code"><code>0x72B5760cFBE437DD01409f44055fDfB8f8121B46</code></a></td><td></td></tr><tr><td></td><td>Source: RE NAV Consumer<br><a href="https://etherscan.io/address/0x84d4eaeb10f9E57b67622f667C6c13E22fA4b2B6#readContract#F13"><code>getCurrentNAV</code></a></td><td></td></tr><tr><td>🟢 reUSDe/USD</td><td><a href="https://etherscan.io/address/0x7844441f13c61cbd3d297f5d2d7fcabf17f0b843"><code>0x7844441f13C61CBD3d297F5d2D7fcaBf17f0b843</code></a></td><td></td></tr><tr><td></td><td>Source: RE NAV Consumer<br><a href="https://etherscan.io/address/0x105f7f110ed2293b3d34fc8871204d20a631d717#readContract#F12"><code>getCurrentNAV</code></a></td><td></td></tr><tr><td>🔵 mF-ONE/USD</td><td><a href="https://etherscan.io/address/0x8D51DBC85cEef637c97D02bdaAbb5E274850e68C#code"><code>0x8D51DBC85cEef637c97D02bdaAbb5E274850e68C</code></a></td><td></td></tr><tr><td></td><td>Source: Fasanara <a href="https://dune.com/steakhouse/mf-one">NAV</a></td><td></td></tr><tr><td>🔵 imoreXRP/USD</td><td><a href="https://etherscan.io/address/0xB57B90477e24bdAbE5F60Fbae3E9F0FDAcd22A15#code"><code>0xB57B90477e24bdAbE5F60Fbae3E9F0FDAcd22A15</code></a></td><td></td></tr><tr><td></td><td>Source: Pyth <a href="https://insights.pyth.network/price-feeds/Crypto.XRP%2FUSD">XRP/USD</a></td><td></td></tr><tr><td>🔵 moreXRP/USD</td><td><a href="https://etherscan.io/address/0x492926C8AaAea044e74ED0e22130B3Aa8EA4766F#code"><code>0x492926C8AaAea044e74ED0e22130B3Aa8EA4766F</code></a></td><td></td></tr><tr><td></td><td>Source: Pyth <a href="https://insights.pyth.network/price-feeds/Crypto.XRP%2FUSD">XRP/USD</a></td><td></td></tr><tr><td>🔵 PT-sUSDE-25SEP2025/USD</td><td><a href="https://etherscan.io/address/0x54638677CC61281c30ca479a4Cad5f700BFe7381#code"><code>0x54638677CC61281c30ca479a4Cad5f700BFe7381</code></a></td><td><a href="https://etherscan.io/address/0x0Dc7C89151e9E8394077D373A54A4FB83fAE4CBA#code"><code>0x0Dc7C89151e9E8394077D373A54A4FB83fAE4CBA</code></a></td></tr><tr><td></td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usde-usd">USDE/USD</a></td><td>Source: Redstone <a href="https://app.redstone.finance/app/token/USDe/">USDE/USD</a></td></tr><tr><td>🔵 PT-USDE-25SEP2025/USD</td><td><a href="https://etherscan.io/address/0x311FE8721544185a817533a6207236175D66C406#code"><code>0x311FE8721544185a817533a6207236175D66C406</code></a></td><td><a href="https://etherscan.io/address/0xfa1C32825DA76A2F6aA1B0Ef003e36DF7C3b29c9#code"><code>0xfa1C32825DA76A2F6aA1B0Ef003e36DF7C3b29c9</code></a></td></tr><tr><td></td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usde-usd">USDE/USD</a></td><td>Source: Redstone <a href="https://app.redstone.finance/app/token/USDe/">USDE/USD</a></td></tr><tr><td>🔵 wOETH/USD</td><td><a href="https://etherscan.io/address/0xe33304fc0464002F200b91dc45028835CDC2bA55#code"><code>0xe33304fc0464002F200b91dc45028835CDC2bA55</code></a></td><td><a href="https://etherscan.io/address/0x98aa477EF02499A79A21e8aE2a4C1F4c20b611F1#code"><code>0x98aa477EF02499A79A21e8aE2a4C1F4c20b611F1</code></a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/token/0xDcEe70654261AF21C44c093C300eD3Bb97b78192#readProxyContract#F17"><code>previewRedeem</code></a></td><td>Read contract:<br><a href="https://etherscan.io/token/0xDcEe70654261AF21C44c093C300eD3Bb97b78192#readProxyContract#F17"><code>previewRedeem</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/oeth-eth">OETH/ETH</a></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/oeth-eth">OETH/ETH</a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd">ETH/USD</a></td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD#blockchain=ETH&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E&#x26;txn=0x9f7d152b46d7f909772c7f0ff303b674cc6e3461751b3b8c71332641a01875b0">ETH/USD</a></td></tr><tr><td>🟢 fxSAVE/USD</td><td><a href="https://etherscan.io/address/0x9dd65b6d956e31f4dc093372d975275986695827#code"><code>0x9dd65b6d956e31f4dc093372d975275986695827</code></a></td><td></td></tr><tr><td></td><td>Source: f(x)protocol <a href="https://etherscan.io/address/0x7743e50F534a7f9F1791DdE7dCD89F7783Eefc39#readProxyContract#F25"><code>nav</code></a></td><td></td></tr><tr><td>🟢 AA_FalconXUSDC/USD</td><td><a href="https://etherscan.io/address/0x50449B3D1f5931d568A1951Ee506A9534e7f7dFf#code"><code>0x50449B3D1f5931d568A1951Ee506A9534e7f7dFf</code></a></td><td></td></tr><tr><td></td><td>Source: Idle.finance <a href="https://etherscan.io/address/0x433D5B175148dA32Ffe1e1A37a939E1b7e79be4d#readProxyContract#F72"><code>virtualPrice</code></a></td><td></td></tr><tr><td>🟢 enzoBTC/USD</td><td><a href="https://etherscan.io/address/0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c#code"><code>0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD#blockchain=ETH&#x26;txn=0xa49c962b722fc3f40e89ceafd82b7b55698a27b8c18e6847527db14144a21c82&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><code>0xaE215049Af8E039B8Ab40eE510549BA5E1B0dACE</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/btc-usd"><em>BTC/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD?blockchain=ETH&#x26;txn=0xfab44c8778443dd6db852d05af2dd4893226913cb759e64b1c259fdc3ce449c4&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><em>BTC/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🔵 yvUSDC-1/USD</td><td><a href="https://etherscan.io/address/0x2791988391D78f8e4AC8c62A3de16318EcA215e7"><code>0x2791988391D78f8e4AC8c62A3de16318EcA215e7</code></a></td><td><a href="https://etherscan.io/address/0x96e076d7c56176898c208c53bf4a41e814e78a54#code"><code>0x96e076d7c56176898c208c53bf4a41e814e78a54</code></a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0xBe53A109B494E5c9f97b9Cd39Fe969BE68BF6204#readContract#F13"><code>convertToAssets</code></a></td><td>Read contract:<br><a href="https://etherscan.io/address/0xBe53A109B494E5c9f97b9Cd39Fe969BE68BF6204#readContract#F13"><code>convertToAssets</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usdc-usd">USDC/USD</a><br>Heartbeat: 24 hours / 0.25%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/USDC/USD#blockchain=ETH&#x26;contract=0xCe701340261a3dc3541C5f8A6d2bE689381C8fCC&#x26;txn=0x39440e4ae31c700522b771316618f5ca0c83338325775c192fb308ef21bd0cf8">USDC/USD</a><br>Heartbeat: 12 hours / 1%</td></tr><tr><td>🔵 yvWETH-1/USD</td><td><a href="https://etherscan.io/address/0x00359e8ac909ae0ce8caed35bbe9582700e4ceb7#code"><code>0x00359e8ac909ae0ce8caed35bbe9582700e4ceb7</code></a></td><td><a href="https://etherscan.io/address/0x1c849b92d061aa5bc9fcb16a806fac09502ef97a#code"><code>0x1c849b92d061aa5bc9fcb16a806fac09502ef97a</code></a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0xc56413869c6CDf96496f2b1eF801fEDBdFA7dDB0#readContract#F13"><code>convertToAssets</code></a></td><td>Read contract:<br><a href="https://etherscan.io/address/0xc56413869c6CDf96496f2b1eF801fEDBdFA7dDB0#readContract#F13"><code>convertToAssets</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd">ETH/USD</a><br>Heartbeat: 1 hour / 0.5%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD#blockchain=ETH&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E&#x26;txn=0x9f7d152b46d7f909772c7f0ff303b674cc6e3461751b3b8c71332641a01875b0">ETH/USD</a><br>Heartbeat: 12 hours / 1%</td></tr><tr><td>🔵 yvUSDT-1/USD</td><td><a href="https://etherscan.io/address/0xc0aac45a662393f2ce40680899fde1ee902e64c9#code"><code>0xc0aac45a662393f2ce40680899fde1ee902e64c9</code></a></td><td><a href="https://etherscan.io/address/0xc40f31368e99790c44748cb0eb2a6a254e439281#code"><code>0xc40f31368e99790c44748cb0eb2a6a254e439281</code></a></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x310B7Ea7475A0B449Cfd73bE81522F1B88eFAFaa#readContract#F13"><code>convertToAssets</code></a></td><td>Read contract:<br><a href="https://etherscan.io/address/0x310B7Ea7475A0B449Cfd73bE81522F1B88eFAFaa#readContract#F13"><code>convertToAssets</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usdt-usd">USDT/USD</a><br>Heartbeat: 24 hours / 0.25%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/USDT/USD#blockchain=ETH&#x26;contract=0x7084a627a22b2de99E18733DC5aAF40993FA405C&#x26;txn=0x56911cb5fb5a3ec93e51815f5f78303e723e02012960a071c3a58fed7218e1cf">USDT/USD</a><br>Heartbeat: 12 hours / 1%</td></tr><tr><td>🟢 BGBTC/USD</td><td><a href="https://etherscan.io/address/0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c#code"><code>0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD#blockchain=ETH&#x26;txn=0xa49c962b722fc3f40e89ceafd82b7b55698a27b8c18e6847527db14144a21c82&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><code>0xaE215049Af8E039B8Ab40eE510549BA5E1B0dAC</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/btc-usd"><em>BTC/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD?blockchain=ETH&#x26;txn=0xfab44c8778443dd6db852d05af2dd4893226913cb759e64b1c259fdc3ce449c4&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><em>BTC/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🟢 cUSD/USD</td><td><a href="https://app.redstone.finance/app/feeds/ethereum-mainnet/cusd_fundamental/"><code>0x9A5a3c3Ed0361505cC1D4e824B3854De5724434A</code></a></td><td></td></tr><tr><td></td><td>Source: Redstone<br>Heartbeat: 24 hour / 0.05%</td><td></td></tr><tr><td>🔵 PT-cUSD-29JAN2026/USD</td><td><a href="https://etherscan.io/address/0x783a188aa0AA150493980BfeF818E29FaF198CAa#readContract"><code>0x783a188aa0AA150493980BfeF818E29FaF198CAa</code></a></td><td></td></tr><tr><td></td><td>PT_price = cUSD_price / (1+0.20*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: Redstone <a href="https://app.redstone.finance/app/feeds/ethereum-mainnet/cusd_fundamental/">cUSD/USD</a><br>Heartbeat: 24 hour / 0.05%</td><td></td></tr><tr><td>🔵 rETH/USD</td><td><a href="https://etherscan.io/address/0xb4AB7dE010859831625F139C6088c284DAbF032e#code"><code>0xb4AB7dE010859831625F139C6088c284DAbF032e</code></a></td><td><a href="https://etherscan.io/address/0x67c88a85CFdDABb8229cB8853cF40A2c5D9B9f8C#code"><code>0x67c88a85CFdDABb8229cB8853cF40A2c5D9B9f8C</code></a></td></tr><tr><td></td><td>Source: rETH <a href="https://etherscan.io/address/0xae78736Cd615f374D3085123A210448E74Fc6393#readContract#F6">getExchangeRate</a></td><td>Source: rETH <a href="https://etherscan.io/address/0xae78736Cd615f374D3085123A210448E74Fc6393#readContract#F6">getExchangeRate</a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/eth-usd"><em>ETH/USD</em></a><br>Heartbeat: 1 hour / 0.50%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD?blockchain=ETH&#x26;txn=0xe1c84a1f08779bfdcf2f52aabdceb57ff1c276c77806bce1e64e821ad401ba21&#x26;contract=0x46ef0071b1E2fF6B42d36e5A177EA43Ae5917f4E"><em>ETH/USD</em></a><br>Heartbeat: 12 hours / 1.00%</td></tr><tr><td>🟢 USDG/USD</td><td><a href="https://etherscan.io/address/0x14f0737d6b705259e521EA6E9E3506AC78dBd311#code"><code>0x14f0737d6b705259e521EA6E9E3506AC78dBd311</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hour / 0.25%</td><td></td></tr><tr><td>🔵 PT-USDG-28MAY2026/USD</td><td><a href="https://etherscan.io/address/0xE97199AE7E530D0297FcF434498D0Fc55b83b3dD#readContract"><code>0xE97199AE7E530D0297FcF434498D0Fc55b83b3dD</code></a></td><td></td></tr><tr><td></td><td>PT_price = USDG_price / (1+0.10*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usdg-usd">USDG/USD</a><br>Heartbeat: 24 hour / 0.25%</td><td></td></tr><tr><td>🔵 PT-reUSD-25JUN2026/USD</td><td><a href="https://etherscan.io/address/0x795a36CE793256C2449bA971F68e8885B04496d0#code"><code>0x795a36CE793256C2449bA971F68e8885B04496d0</code></a></td><td></td></tr><tr><td></td><td>PT_price = (RE NAV / currentPYIndex) / (1+0.20*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: RE NAV Consumer<br><a href="https://etherscan.io/address/0x84d4eaeb10f9E57b67622f667C6c13E22fA4b2B6#readContract#F13"><code>getCurrentNAV</code></a></td><td></td></tr><tr><td>🔵 PT-apxUSD-18JUN2026/USD</td><td><a href="https://etherscan.io/address/0x7E68719F24ef0938449dAa9Ed134769190098928#readContract"><code>0x7E68719F24ef0938449dAa9Ed134769190098928</code></a></td><td></td></tr><tr><td></td><td>PT_price = APXUSD_price / (1+0.25*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/apxusd-usd-exchange-rate">APXUSD/USD</a><br>Heartbeat: 24 hour / 0.5%</td><td></td></tr><tr><td>🔵 tBTC/USD</td><td><a href="https://etherscan.io/address/0xfe2297527ed4e6a6255e176098302474f6f32936#code"><code>0xfe2297527ed4e6a6255e176098302474f6f32936</code></a></td><td></td></tr><tr><td></td><td>tBTC_price = min(Chainlink BTC Feed, Chainlink TBTC Feed)</td><td></td></tr><tr><td></td><td>Source: <a href="https://data.chain.link/feeds/ethereum/mainnet/btc-usd">Chainlink BTC/USD</a><br>Heartbeat: 1 hour / 0.5%</td><td></td></tr><tr><td></td><td>Source: <a href="https://data.chain.link/feeds/ethereum/mainnet/tbtc-usd">Chainlink tBTC/USD</a><br>Heartbeat: 24 hour / 2%</td><td></td></tr><tr><td>🔵 iUSD/USD</td><td><a href="https://etherscan.io/address/0xfDFaaA5eF2e31843e36e64b66c9De93fF579A8AC#code"><code>0xfDFaaA5eF2e31843e36e64b66c9De93fF579A8AC</code></a></td><td></td></tr><tr><td></td><td>Source: infiniFi <a href="https://etherscan.io/address/0xF81Aa28A4F68124683AfadA81e8EBBf6e2867067#code">iUSD/USDC</a></td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/usdc-usd">USDC/<br>USD</a><br>Heartbeat: 24 hours / 0.25%</td><td></td></tr><tr><td>🔵 siUSD/USD</td><td><a href="https://etherscan.io/address/0x26289df02E3Fa6aC90D00c9235a254B848FE21e2#readContract"><code>0x26289df02E3Fa6aC90D00c9235a254B848FE21e2</code></a></td><td></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x310B7Ea7475A0B449Cfd73bE81522F1B88eFAFaa#readContract#F13"><code>convertToAssets</code></a></td><td></td></tr><tr><td></td><td>Source: iUSD/USD</td><td></td></tr><tr><td>🟢 FDUSD/USD</td><td><a href="https://data.chain.link/feeds/ethereum/mainnet/fdusd-usd"><code>0xfAA9147190c2C2cc5B8387B4f49016bDB3380572</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hour / 0.3%</td><td></td></tr><tr><td>🔵 PT-reUSD-10DEC2026/USD</td><td><a href="https://etherscan.io/address/0xbB65c9085a749ff5d00E11804E3947417f89261c#code"><code>0xbB65c9085a749ff5d00E11804E3947417f89261c</code></a></td><td></td></tr><tr><td></td><td>PT_price = (RE NAV / currentPYIndex) / (1+0.20*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: RE NAV Consumer<br><a href="https://etherscan.io/address/0x84d4eaeb10f9E57b67622f667C6c13E22fA4b2B6#readContract#F13"><code>getCurrentNAV</code></a></td><td></td></tr><tr><td>🟢 XAUt/USD</td><td><a href="https://data.chain.link/feeds/ethereum/mainnet/xau-usd"><code>0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hour / 0.3%</td><td></td></tr><tr><td>🟢 trUSD/USD</td><td><a href="https://app.redstone.finance/push-feeds/trUSD_FUNDAMENTAL/ethereumMultiFeed"><code>0x33c6F75916Db4267e52209A8E6B270b22d983B53</code></a></td><td></td></tr><tr><td></td><td>Source: Redstone<br>Heartbeat: 12 hour / 0.5%</td><td></td></tr><tr><td>🔵 strUSD/USD</td><td><a href="https://etherscan.io/address/0xF6c44F69C7996e9b2162061a3F4fE1ee3E138345#readContract"><code>0xF6c44F69C7996e9b2162061a3F4fE1ee3E138345</code></a></td><td></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x280839980a7eD0D7717F64125fE241012E5F5815#readProxyContract#F8"><code>convertToAssets</code></a></td><td></td></tr><tr><td></td><td>Source: trUSD/USD</td><td></td></tr><tr><td>🔵 PT-trUSD-26NOV2026/USD</td><td><a href="https://etherscan.io/address/0xE7b498629eA47Ad8231F0d5Ab33bB555cbF8f62e#readContract"><code>0xE7b498629eA47Ad8231F0d5Ab33bB555cbF8f62e</code></a></td><td></td></tr><tr><td></td><td>PT_price = trUSD_price / (1+0.225*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: trUSD/USD</td><td></td></tr><tr><td>🔵 PT-strUSD-26NOV2026/USD</td><td><a href="https://etherscan.io/address/0xf0c6205103c0969ad85209628678c513cd7bf373"><code>0xF0c6205103C0969Ad85209628678C513cd7Bf373</code></a></td><td></td></tr><tr><td></td><td>PT_price = trUSD_price / (1+0.235*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: trUSD/USD</td><td></td></tr><tr><td>🔵 USD3/USD</td><td><a href="https://etherscan.io/address/0x4827F798a55f39db4324385Cd30e8342f7f57f47#readContract"><code>0x4827F798a55f39db4324385Cd30e8342f7f57f47</code></a></td><td><a href="https://etherscan.io/address/0x17E33A37F5D7965C590b3a910df2BCc5b92A9C24#readContract"><code>0x17E33A37F5D7965C590b3a910df2BCc5b92A9C24</code></a></td></tr><tr><td></td><td>Read contract:<br><code>convertToAssets</code></td><td>Read contract:<br><code>convertToAssets</code></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/ethereum/mainnet/stablecoins/usdc-usd">USDC/USD</a></td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/data-feeds/USDC-USD?start_date=2026-07-06&#x26;end_date=2026-08-05&#x26;blockchain=ETH&#x26;contract=0xCe701340261a3dc3541C5f8A6d2bE689381C8fCC&#x26;txn=0x94681c1e3a329f571b3c27a941564bddc5fe8108e9d546ef9d70e87de1f84b30">USDC/USD</a></td></tr><tr><td>🔵 APYUSD/USD</td><td><a href="https://etherscan.io/address/0x7b417fbbfa3f246f2c5e3ff882753f7e4f7c04db#readContract"><code>0x7B417FBbFa3F246f2C5E3FF882753f7E4f7C04DB</code></a></td><td></td></tr><tr><td></td><td>Read contract:<br><a href="https://etherscan.io/address/0x38EEb52F0771140d10c4E9A9a72349A329Fe8a6A#readProxyContract#F7"><code>convertToAssets</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/apxusd-usd-exchange-rate">APXUSD/USD</a><br>Heartbeat: 24 hour / 0.5%</td><td></td></tr><tr><td>🔵 PT-USD3-17DEC2026/USD</td><td><a href="https://etherscan.io/address/0x70FE33bD3503429b3c2cba2e58b128F1A5D17716#readContract"><code>0x70FE33bD3503429b3c2cba2e58b128F1A5D17716</code></a></td><td></td></tr><tr><td></td><td>PT_price = USDC_price / (1+0.30*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.25%</td><td></td></tr><tr><td>🟢 APXUSD/USD</td><td><a href="https://etherscan.io/address/0x651b101f72F82630cf59c68E6EE4305aFBd3B1F5"><code>0x651b101f72F82630cf59c68E6EE4305aFBd3B1F5</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.5%</td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="Avalanche" %}

### Avalanche Network

<table><thead><tr><th width="264">Pair</th><th width="590">Address</th></tr></thead><tbody><tr><td>🟢 USDC/USD</td><td><a href="https://data.chain.link/feeds/avalanche/mainnet/usdc-usd"><code>0xF096872672F44d6EBA71458D74fe67F9a77a23B9</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.1%</td></tr><tr><td>🟢 AVAX/USD</td><td><a href="https://data.chain.link/feeds/avalanche/mainnet/avax-usd"><code>0x0A77230d17318075983913bC2145DB16C7366156</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 2 minutes / 0.1%</td></tr><tr><td>🟢 SAVAX/USD</td><td><a href="https://data.chain.link/feeds/avalanche/mainnet/calculated-savax-usd"><code>0x2854Ca10a54800e15A2a25cFa52567166434Ff0a</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 2 minutes / 0.1%</td></tr><tr><td>🟢 BTC.B/USD</td><td><a href="https://data.chain.link/feeds/avalanche/mainnet/btc-usd"><code>0x2779D32d5166BAaa2B2b658333bA7e6Ec0C65743</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.1%</td></tr><tr><td>🟢 USDT/USD</td><td><a href="https://snowtrace.io/address/0xEBE676ee90Fe1112671f19b6B7459bC678B67e8a/contract/43114/code"><code>0xEBE676ee90Fe1112671f19b6B7459bC678B67e8a</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.1%</td></tr><tr><td>🟢 deUSD/USD</td><td><a href="https://snowtrace.io/address/0x7E77D9F06056017334e26bEd92176222169DE6C1/contract/43114/code"><code>0x7E77D9F06056017334e26bEd92176222169DE6C1</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.5%</td></tr><tr><td>🔵 sdeUSD/USD</td><td><a href="https://snowtrace.io/address/0x27b1dE4dabAc4B57f5e3092f589b1D810b002DA4/contract/43114/code"><code>0x27b1dE4dabAc4B57f5e3092f589b1D810b002DA4</code></a></td></tr><tr><td></td><td>Read contract: <a href="https://snowtrace.io/address/0x68088C91446c7bEa49ea7Dbd3B96Ce62B272DC96/contract/43114/readProxyContract?chainid=43114#F8"><code>convertToAssets</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/avalanche/mainnet/deusd-usd">deUSD/USD</a><br>Heartbeat: 24 hours / 0.5%</td></tr><tr><td>🔵 weETH/USD</td><td><a href="https://snowtrace.io/address/0xd8Af43a8165b7f67815b94a5fbdA321122F80ceA/contract/43114/code"><code>0xd8Af43a8165b7f67815b94a5fbdA321122F80ceA</code></a></td></tr><tr><td></td><td>Source: Redstone <a href="https://app.redstone.finance/app/feeds/avalanche/weeth_fundamental/">weETH/ETH</a><br>Heartbeat: 24 hours / 0.5%</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/avalanche/mainnet/eth-usd">ETH/USD</a><br>Heartbeat: 24 hours / 0.1%</td></tr><tr><td>🔵 solvBTC/USD</td><td><a href="https://snowtrace.io/address/0x2bf2DE52EDBbD1F95cfa147FfC59eF7D9216a3E4/contract/43114/code"><code>0x2bf2DE52EDBbD1F95cfa147FfC59eF7D9216a3E4</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/avalanche/mainnet/solvbtc-btc">solvBTC/BTC</a><br>Heartbeat: 24 hours / 1.0%</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/avalanche/mainnet/btc-usd">BTC/USD</a><br>Heartbeat: 24 hours / 0.1%</td></tr></tbody></table>
{% endtab %}

{% tab title="Base" %}

### Base Network

<table><thead><tr><th width="213">Pair</th><th width="253">Primary</th><th width="232">Fallback</th></tr></thead><tbody><tr><td>🟢 USDC/USD</td><td><a href="https://data.chain.link/feeds/base/base/usdc-usd"><code>0x7e860098F58bBFC8648a4311b374B1D669a2bc6B</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/USDC/USD#blockchain=ETH&#x26;contract=0xCe701340261a3dc3541C5f8A6d2bE689381C8fCC&#x26;txn=0xd7a9b26a35b415f0ea37176bffcb2dc784aaa5076b9b5e3aef4fbde5869db01f"><code>0x9bDd6962aD460a31672f8266852BD1b8805F9efe</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.30%</td><td>Source: Chronicle<br>Heartbeat: 30 min / 0.15%</td></tr><tr><td>🟢 USDS/USD</td><td><a href="https://data.chain.link/feeds/base/base/usds-usd"><code>0x2330aaE3bca5F05169d5f4597964D44522F62930</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/USDS/USD#blockchain=BASE&#x26;contract=0xc64fBAB77e1B9B07302b96b6F0E7D39aFf3bb9D4"><code>0xb2363E532E986BE0cEd039410155f0b0425D8cF7</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.50%</td><td>Source: Chronicle<br>Heartbeat: 30 min / 0.15%</td></tr><tr><td>🟢 ETH/USD</td><td><a href="https://data.chain.link/feeds/base/base/eth-usd"><code>0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/ETH/USD#blockchain=BASE&#x26;contract=0x152598809FB59db55cA76f89a192Fb23555531D8"><code>0xD792B87E7517D8a6BEE1b82C7B9Cef6c9b371C13</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 20 min / 0.15%</td><td>Source: Chronicle<br>Heartbeat: 30 min / 0.15%</td></tr><tr><td>🔵 CBBTC/USD</td><td><a href="https://data.chain.link/streams/btc-usd"><code>0x64c911996D3c6aC71f9b455B1E8E7266BcbD848F</code></a></td><td><a href="https://chroniclelabs.org/dashboard/oracle/CBBTC/USD#blockchain=BASE&#x26;txn=0xfa116d6bb512f1b08f49e169847918fda04d9958dffd831858053549a6db001f&#x26;contract=0x5a631155dF276F0c02d19953BC8B67fbbCb35e01"><code>0x88E97455675854BE3767aFB51daE5788431D5972</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/ethereum/mainnet/btc-usd"><em>BTC/USD</em></a><br>Heartbeat: 20 min / 0.10%</td><td>Source: Chronicle <a href="https://chroniclelabs.org/dashboard/oracle/BTC/USD?blockchain=ETH&#x26;txn=0xfab44c8778443dd6db852d05af2dd4893226913cb759e64b1c259fdc3ce449c4&#x26;contract=0x24C392CDbF32Cf911B258981a66d5541d85269ce"><em>CBBTC/USD</em></a><br>Heartbeat: 30 min / 0.15%</td></tr><tr><td>🟢 cbXRP/USD</td><td><a href="https://data.chain.link/feeds/base/base/xrp-usd"><code>0x9f0C1dD78C4CBdF5b9cf923a549A201EdC676D34</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.50%</td><td></td></tr><tr><td>🔵 WSTETH/USD</td><td><a href="https://basescan.org/address/0xc336b55254daaa9c77df953864bd107c027e48a0#code"><code>0xC336B55254dAAa9C77df953864bd107c027e48A0</code></a></td><td></td></tr><tr><td></td><td><p>Source: Chainlink <a href="https://data.chain.link/feeds/base/mainnet/wsteth-eth">wstETH/ETH</a></p><p>Heartbeat: 24 hour / 0.50%</p></td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/base/mainnet/eth-usd">ETH/USD</a> Heartbeat: 20 min / 0.15%</td><td></td></tr><tr><td>🔵 sUSDS/USD</td><td><a href="https://chroniclelabs.org/dashboard/oracle/SUSDS/USD#blockchain=BASE&#x26;contract=0x556f25321026f024Db4302347710514da4049a5F&#x26;txn=0xffd162eb53dfc084427d30db007bea8fec683749f44f0b4e24ce00c05ebeab59"><code>0x556f25321026f024Db4302347710514da4049a5F</code></a></td><td><a href="https://basescan.org/address/0x74d3E7Ab48724BB3a48f38B88845ee00da6a108C#code"><code>0x74d3E7Ab48724BB3a48f38B88845ee00da6a108C</code></a></td></tr><tr><td></td><td>Source: Chronicle<br>Heartbeat: 30 min / 0.15%</td><td><p>Source: Chainlink <a href="https://data.chain.link/feeds/base/mainnet/susds-usds-exchange-rate">sUSDS/USDS</a></p><p>Heartbeat: 24 hours / 0.05%</p></td></tr><tr><td></td><td></td><td><p>Source: Chainlink <a href="https://data.chain.link/feeds/base/mainnet/usds-usd">USDS/USD</a></p><p>Heartbeat: 24 hours / 0.50%</p></td></tr><tr><td>🔵 weETH/USD</td><td><a href="https://basescan.org/address/0xf04d1a22e4C804119DeD24E28a8b5b3242F46F43#code"><code>0xf04d1a22e4C804119DeD24E28a8b5b3242F46F43</code></a></td><td></td></tr><tr><td></td><td><p>Source: Chainlink <a href="https://data.chain.link/feeds/base/mainnet/weeth-eth">weETH/ETH</a></p><p>Heartbeat: 24 hours / 0.5%</p></td><td></td></tr><tr><td></td><td><p>Source: Chainlink <a href="https://data.chain.link/feeds/base/mainnet/eth-usd">ETH/USD</a></p><p>Heartbeat: 20 min / 0.15%</p></td><td></td></tr><tr><td>🔵 cbETH/USD</td><td><a href="https://basescan.org/address/0x9f0C1dD78C4CBdF5b9cf923a549A201EdC676D34#code"><code>0x9f0C1dD78C4CBdF5b9cf923a549A201EdC676D34</code></a></td><td></td></tr><tr><td></td><td><p>Source: Chainlink <a href="https://data.chain.link/feeds/base/mainnet/cbeth-eth">cbETH/ETH</a></p><p>Heartbeat: 24 hours / 0.5%</p></td><td></td></tr><tr><td></td><td><p>Source: Chainlink <a href="https://data.chain.link/feeds/base/mainnet/eth-usd">ETH/USD</a></p><p>Heartbeat: 20 min / 0.15%</p></td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="Binance" %}

### Binance Smart Chain

<table><thead><tr><th width="213">Pair</th><th width="253">Primary</th><th width="232">Fallback</th></tr></thead><tbody><tr><td>🟢 USDC/USD</td><td><a href="https://data.chain.link/feeds/bsc/mainnet/usdc-usd"><code>0x51597f405303C4377E36123cBc172b13269EA163</code></a></td><td><a href="https://app.redstone.finance/app/feeds/bnb-chain/usdc/"><code>0xeA2511205b959548459A01e358E0A30424dc0B70</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 15 min / 0.10%</td><td>Source: Redstone<br>Heartbeat: 6 hours / 0.50%</td></tr><tr><td>🟢 USDT/USD</td><td><a href="https://data.chain.link/feeds/bsc/mainnet/usdt-usd"><code>0xB97Ad0E74fa7d920791E90258A6E2085088b4320</code></a></td><td><a href="https://app.redstone.finance/app/feeds/bnb-chain/usdt/"><code>0xf57bA29437C130e155Ca4b65128630777638F05D</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 15 min / 0.10%</td><td>Source: Redstone<br>Heartbeat: 6 hours / 0.50%</td></tr><tr><td>🟢 WBNB/USD</td><td><a href="https://data.chain.link/feeds/bsc/mainnet/bnb-usd"><code>0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE</code></a></td><td><a href="https://app.redstone.finance/app/feeds/bnb-chain/bnb/"><code>0x8dd2D85C7c28F43F965AE4d9545189C7D022ED0e</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 30 sec / 0.10%</td><td>Source: Redstone<br>Heartbeat: 1 min / 0.10%</td></tr><tr><td>🟢 ETH/USD</td><td><a href="https://data.chain.link/feeds/bsc/mainnet/eth-usd"><code>0x9ef1B8c0E4F7dc8bF5719Ea496883DC6401d5b2e</code></a></td><td><a href="https://app.redstone.finance/app/feeds/bnb-chain/eth/"><code>0x9cF19D284862A66378c304ACAcB0E857EBc3F856</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 1 min / 0.10%</td><td>Source: Redstone<br>Heartbeat: 6 hours / 0.50%</td></tr><tr><td>🟢 BTCB/USD</td><td><a href="https://data.chain.link/feeds/bsc/mainnet/btc-usd"><code>0x264990fbd0A4796A3E3d8E37C4d5F87a3aCa5Ebf</code></a></td><td><a href="https://app.redstone.finance/app/feeds/bnb-chain/btc/"><code>0xa51738d1937FFc553d5070f43300B385AA2D9F55</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 1 min / 0.10%</td><td>Source: Redstone<br>Heartbeat: 1 min / 0.10%</td></tr><tr><td>🟢 FDUSD/USD</td><td><a href="https://data.chain.link/feeds/bsc/mainnet/fdusd-usd"><code>0x390180e80058A8499930F0c13963AD3E0d86Bfc9</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24 hours / 0.30%</td><td></td></tr><tr><td>🟢 satUSD/USD</td><td><a href="https://bscscan.com/address/0x9cabd9ce2d0c6332458c9f6a3b14de3b1ce060e5#code"><code>0x9cabd9ce2d0c6332458c9f6a3b14de3b1ce060e5</code></a></td><td></td></tr><tr><td></td><td>Source: DIA<br>Heartbeat: 24 hours / 0.50%</td><td></td></tr><tr><td>🔵 satUSD+/USD</td><td><a href="https://bscscan.com/address/0x88e97455675854be3767afb51dae5788431d5972#code"><code>0x88e97455675854be3767afb51dae5788431d5972</code></a></td><td></td></tr><tr><td></td><td>Read contract:<br><a href="https://bscscan.com/address/0x03d9C4E4BC5D3678A9076caC50dB0251D8676872#readProxyContract#F26"><code>previewRedeem</code></a></td><td></td></tr><tr><td></td><td>Source: DIA <a href="https://bscscan.com/address/0x9cabd9ce2d0c6332458c9f6a3b14de3b1ce060e5#code">satUSD/USD</a><br>Heartbeat: 24 hour / 0.50%</td><td></td></tr><tr><td>🟢 enzoBTC/USD</td><td><a href="https://bscscan.com/address/0x264990fbd0A4796A3E3d8E37C4d5F87a3aCa5Ebf"><code>0x264990fbd0A4796A3E3d8E37C4d5F87a3aCa5Ebf</code></a></td><td><a href="https://bscscan.com/address/0xa51738d1937ffc553d5070f43300b385aa2d9f55#code"><code>0xa51738d1937FFc553d5070f43300B385AA2D9F55</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 1 min / 0.10%</td><td>Source: Redstone<br>Heartbeat: 1 min / 0.10%</td></tr><tr><td>🔵 PT-satUSD+-18DEC2025/USD</td><td><a href="https://bscscan.com/address/0xA3e573AAeF9FEB29e28CD4CdF450C1a46B4E7534#code"><code>0xA3e573AAeF9FEB29e28CD4CdF450C1a46B4E7534</code></a></td><td></td></tr><tr><td></td><td>PT_price = satUSD_price / (1+0.20*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: DIA <a href="https://bscscan.com/address/0x9cabd9ce2d0c6332458c9f6a3b14de3b1ce060e5#code">satUSD/USD</a><br>Heartbeat: 24 hours / 0.50%</td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="Plasma" %}

### Plasma

<table><thead><tr><th width="213">Pair</th><th width="253">Primary</th><th width="232">Fallback</th></tr></thead><tbody><tr><td>🟢 USDT0/USD</td><td><a href="https://plasmascan.to/address/0x70b77FcdbE2293423e41AdD2FB599808396807BC/contract/9745/readContract"><code>0x70b77FcdbE2293423e41AdD2FB599808396807BC</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 15 min / 0.10%</td><td></td></tr><tr><td>🟢 WETH/USD</td><td><a href="https://plasmascan.to/address/0x70b77FcdbE2293423e41AdD2FB599808396807BC/contract/9745/code"><code>0x43A7dd2125266c5c4c26EB86cd61241132426Fe7</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 15 min / 0.10%</td><td></td></tr><tr><td>🟢 XAUT0/USD</td><td><a href="https://plasmascan.to/address/0x354Df1ca4AE838A45405B3486ED0161AA7f01191/contract/9745/readContract"><code>0x354Df1ca4AE838A45405B3486ED0161AA7f01191</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 30 sec / 0.10%</td><td></td></tr><tr><td>🟢 SUSDE/USD</td><td><a href="mailto:undefined"><code>0x0ca32ed285ADDf84E8491f5EDB835E10635945A2</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 1 min / 0.10%</td><td></td></tr><tr><td>🟢 USDE/USD</td><td><a href="https://plasmascan.to/address/0x0DFdCF9AF39Be41E40a52A80fa86e23A69a69C3B/contract/9745/readContract"><code>0x0DFdCF9AF39Be41E40a52A80fa86e23A69a69C3B</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 1 min / 0.10%</td><td></td></tr><tr><td>🟢 USR/USD</td><td><a href="https://plasmascan.to/address/0x91483536aa6BC2d335cbEEa53fDe368656F75Cb9/contract/9745/code"><code>0x91483536aa6BC2d335cbEEa53fDe368656F75Cb9</code></a></td><td></td></tr><tr><td></td><td>Source: Resolv<br>Heartbeat: 24 hr / 0.50%</td><td></td></tr><tr><td>🟢 RLP/USD</td><td><a href="https://plasmascan.to/address/0xf16FA59b32bB1fcDfBA0afa473f361dD57E6d215/contract/9745/code"><code>0xf16fa59b32bb1fcdfba0afa473f361dd57e6d215</code></a></td><td></td></tr><tr><td></td><td>Source: Resolv<br>Heartbeat: 24 hr / 0.05%</td><td></td></tr><tr><td>🟢 xUSD/USD</td><td><a href="https://plasmascan.to/address/0x51d947B18f546696c31d9a1c81B55d84e6d8e959/contract/9745/readContract"><code>0x51d947B18f546696c31d9a1c81B55d84e6d8e959</code></a></td><td></td></tr><tr><td></td><td><p>Source: <a href="https://docs.eo.app/docs/eprice/feeds-addresses/price-feed-addresses/plasma">EO</a></p><p>Heartbeat: 24 hr / 1.0%</p></td><td></td></tr><tr><td>🔵 wstUSR/USD</td><td><a href="https://plasmascan.to/address/0xCef45b465078f08EB1cc1400b138286aA5f8E1fe/contract/9745/code"><code>0xcef45b465078f08eb1cc1400b138286aa5f8e1fe</code></a></td><td></td></tr><tr><td></td><td>Source: Resolv <a href="https://plasmascan.to/address/0x565d165Ff5D21335DFc82Db8851F5cacb926c613/contract/9745/readContract#F10">wstUSR/stUSR</a><br>Heartbeat: 24 hr / 0.05%</td><td></td></tr><tr><td></td><td>Source: Resolv <a href="https://plasmascan.to/address/0x91483536aa6BC2d335cbEEa53fDe368656F75Cb9/contract/9745/code">USR/USD</a><br>Heartbeat: 24 hr / 0.50%</td><td></td></tr><tr><td>🔵 PT-USDe-15JAN2026/USD</td><td><a href="https://plasmascan.to/address/0x07835F147352e54ca0Ea630755A9c485A8B183f9/contract/9745/code"><code>0x07835F147352e54ca0Ea630755A9c485A8B183f9</code></a></td><td></td></tr><tr><td></td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/plasma/plasma/usde-usd">USDE/USD</a></td><td></td></tr><tr><td>🔵 PT-sUSDE-15JAN2026/USD</td><td><a href="https://plasmascan.to/address/0xD38226132c3B4aE1f8ec2cb946856ae09ef42a33/contract/9745/code"><code>0xD38226132c3B4aE1f8ec2cb946856ae09ef42a33</code></a></td><td></td></tr><tr><td></td><td>PT_price = USDE_price / (1+0.20*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/plasma/plasma/usde-usd">USDE/USD</a></td><td></td></tr><tr><td>🔵 USDai/USD</td><td><a href="https://plasmascan.to/address/0x970f1a76391F6A6793dE1965A74e05deaA345494/contract/9745/code"><code>0x970f1a76391F6A6793dE1965A74e05deaA345494</code></a></td><td></td></tr><tr><td></td><td>Price = Min(1, Chainlink Price)</td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/plasma/plasma/usdai-usd">USDai/USD</a></td><td></td></tr><tr><td>🔵 sUSDai/USD</td><td><a href="https://plasmascan.to/address/0x18019dFD4aCc9560Cd16776457E2Be4180F4f123/contract/9745/code"><code>0x18019dFD4aCc9560Cd16776457E2Be4180F4f123</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/plasma/plasma/susdai-usdai">sUSDAI/USDai</a></td><td></td></tr><tr><td></td><td>Source: <a href="https://plasmascan.to/address/0x970f1a76391F6A6793dE1965A74e05deaA345494/contract/9745/code">USDai/USD</a></td><td></td></tr><tr><td>🔵 PT-USDai-19MAR2026/USD</td><td><a href="https://plasmascan.to/address/0x196E81349528BF03d33b9568e4dAfb6cCc1834f3/contract/9745/code"><code>0x196e81349528bf03d33b9568e4dafb6ccc1834f3</code></a></td><td></td></tr><tr><td></td><td>PT_price = USDai_price / (1+0.45*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: <a href="https://plasmascan.to/address/0x970f1a76391F6A6793dE1965A74e05deaA345494/contract/9745/code">USDai/USD</a></td><td></td></tr><tr><td>🔵 PT-sUSDai-19MAR2026/USD</td><td><a href="https://plasmascan.to/address/0x33C5d1b7e85946Ec71CB170eEC7E52C0EdCA3880/contract/9745/code"><code>0x33c5d1b7e85946ec71cb170eec7e52c0edca3880</code></a></td><td></td></tr><tr><td></td><td>PT_price = USDai_price / (1+0.45*days_to_maturity/360)</td><td></td></tr><tr><td></td><td>Source: <a href="https://plasmascan.to/address/0x970f1a76391F6A6793dE1965A74e05deaA345494/contract/9745/code">USDai/USD</a></td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="MegaETH" %}

### MegaETH

<table><thead><tr><th width="213">Pair</th><th width="253">Primary</th><th width="232">Fallback</th></tr></thead><tbody><tr><td>🟢 USDM/USD</td><td><a href="https://data.chain.link/feeds/megaeth/megaeth/usdm-usd"><code>0xdFe0063491d9DeD8F8abCdd7AE04238A1e70D270</code></a></td><td><a href="https://app.redstone.finance/push-feeds/USDm-TWAP-60/megaEthMultiFeed"><code>0x90196F6D52fce394C79D1614265d36D3F0033Ccf</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24hr / 0.5%</td><td>Source: Redstone<br>Heartbeat: 6hr / 0.1%</td></tr><tr><td>🟢 BTC.B/USD</td><td><a href="https://data.chain.link/feeds/megaeth/megaeth/btc-usd"><code>0xc6E3007B597f6F5a6330d43053D1EF73cCbbE721</code></a></td><td><a href="https://app.redstone.finance/push-feeds/BTC/megaEthMultiFeed"><code>0xf0DEbDAE819b354D076b0D162e399BE013A856d3</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24hr / 0.5%</td><td>Source: Redstone<br>Heartbeat: 6hr / 0.1%</td></tr><tr><td>🟢 WETH/USD</td><td><a href="https://data.chain.link/feeds/megaeth/megaeth/eth-usd"><code>0xcA4e254D95637DE95E2a2F79244b03380d697feD</code></a></td><td><a href="https://app.redstone.finance/push-feeds/ETH/megaEthMultiFeed"><code>0xc555c100DB24dF36D406243642C169CC5A937f09</code></a></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24hr / 0.5%</td><td>Source: Redstone<br>Heartbeat: 6hr / 0.1%</td></tr><tr><td>🟢 USDE/USD</td><td><a href="https://data.chain.link/feeds/megaeth/megaeth/usde-usd"><code>0x4F2A91150D5D6B91B5F0b0DF6F109C4BCeCefA61</code></a></td><td></td></tr><tr><td></td><td>Source: Chainlink<br>Heartbeat: 24hr / 0.5%</td><td></td></tr><tr><td>🟢 reUSD/USD</td><td><a href="https://mega.etherscan.io/address/0x9fa87bdca3d28163bdeb14abcea4fc3cbe2a380f#code"><code>0x9fa87bdca3d28163bdeb14abcea4fc3cbe2a380f</code></a></td><td><a href="https://mega.etherscan.io/address/0x7cbeb68f3c257D310418fef27d0d3E67C55f1043#readContract"><code>0x7cbeb68f3c257D310418fef27d0d3E67C55f1043</code></a></td></tr><tr><td></td><td>Source: Re - 18 Decimal<br>Heartbeat: 24hr</td><td>Source: Re - 8 Decimal<br>Heartbeat: 24hr</td></tr><tr><td>🟢 AA_FalconXUSDC/USD</td><td><a href="https://mega.etherscan.io/address/0x0eF80293c8120b61Ea49b0f9fB0ca435a05bBb0e#code"><code>0x0eF80293c8120b61Ea49b0f9fB0ca435a05bBb0e</code></a></td><td></td></tr><tr><td></td><td>Source: Redstone <a href="https://app.redstone.finance/push-feeds/AA_FalconXUSDC/megaEthMultiFeed">AA_FalconXUSDC/USD</a><br>Heartbeat: 24hr / 0.1%</td><td></td></tr><tr><td>🔵 wstETH/USD</td><td><a href="https://mega.etherscan.io/address/0x2b50E07B0dBB6f165D6c590d86F76dd99D9a0071#code"><code>0x2b50E07B0dBB6f165D6c590d86F76dd99D9a0071</code></a></td><td><a href="https://mega.etherscan.io/address/0xC336B55254dAAa9C77df953864bd107c027e48A0#readContract"><code>0xC336B55254dAAa9C77df953864bd107c027e48A0</code></a></td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/megaeth/megaeth/wsteth-steth-exchange-rate">wstETH/stETH</a><br>Heartbeat: 24 hr / 0.5%</td><td>Source: Redstone <a href="https://app.redstone.finance/push-feeds/wstETH%2FETH/megaEthMultiFeed">wstETH/ETH</a><br>Heartbeat: 24 hr / 0.5%</td></tr><tr><td></td><td>Source: Chainlink <a href="https://data.chain.link/feeds/megaeth/megaeth/eth-usd">ETH/USD</a><br>Heartbeat: 24 hr / 0.50%</td><td>Source: Redstone <a href="https://app.redstone.finance/push-feeds/ETH/megaEthMultiFeed">ETH/USD</a><br>Heartbeat: 6 hr / 0.1%</td></tr><tr><td>🔵 stcUSD/USD</td><td><a href="https://mega.etherscan.io/address/0x91b3ba993ba7699a0Ec818a745C180706A4036c1#readContract"><code>0x91b3ba993ba7699a0Ec818a745C180706A4036c1</code></a></td><td></td></tr><tr><td></td><td>Source: AAVE <a href="https://mega.etherscan.io/address/0xBBC579Ee0A3fD6E9240965C5f57b7e5b3e3809A8#readContract">stcUSD/USD</a></td><td></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
No Flashloan Attacks - A flashloan is a type of loan where a user can borrow assets with no upfront collateral so long as they return the borrowed assets *within the same blockchain transaction* (atomically). Given that loans through Term Protocol can be assigned only after (i) a bid a placed, (ii) the bid is revealed (in a separate transaction), and (iii) the bid is fulfilled in `completeAuction`(a third transaction), it is not possible to open a loan atomically and therefore not subject to flashloan attacks.
{% endhint %}


# Conventions

### Day-count convention

In calculating servicing fees and the repurchase price due at maturity based on the market clearing repo rate, we follow an Actual/360 day count convention.

$$
\text{DayCountFactor} = \frac{\text{Days}(\text{AuctionDate},\text{ MaturityDate})}{360}
$$

### Repurchase Price

The Repurchase Price, given the Purchase Price and any given repo rate is calculated as follows:

$$
\text{RepurchasePrice} = \text{PurchasePrice} \left(1+ \text{RepoRate}\*\text{DayCountFactor}\right)\
$$


# Terminology

### Seller

The seller of collateral assets in exchange for [purchase tokens](#purchase-token) who is required to repurchase those same tokens at a fixed date (the [repurchase date](#purchase-date)) at a pre-determined [repurchase price](#repurchase-price). Economically equivalent to a borrower.

### Buyer

The buyer of collateral assets

### Purchase Price

The price at which collateral tokens are transferred by a borrower to a lender in a repo transaction and can be thought of as the amount borrowed in a repo agreement.

### Repurchase Price

The price at which collateral tokens are to be transferred back to a borrower upon maturity or termination of a repo transaction. The difference between the repurchase price and the purchase price reflects the interest earned by the lender/owed by the borrower and is calculated by applying the pricing rate over the term of a repo transaction. The formula for determination of the repurchase price can be found in [Conventions ](https://github.com/term-finance/term-finance-developer-docs/tree/main/term-finance-protocol/broken-reference/README.md)section.

### Price Differential

The price differential is the difference between the [repurchase price ](#repurchase-price)and [purchase price ](#purchase-price)in a repo transaction and can be viewed as the interest earned by the lender/owed by the borrower over the term of a repo transaction.

### Pricing Rate (Repo Rate)

The per annum percentage rate for determination of the repurchase price, also known as the "repo rate".

### Purchase Date

The purchase date is the date on which the purchased tokens are to be transferred by borrower to the lender.

### Repurchase Date

The date on which the borrower is to repurchase the collateral tokens from lender.

### Repurchase Window

A window of time beginning on the repurchase date and typically lasting 12 to 24 hours during which repurchase must occur.

### Purchase Token

The base digital currency in which the [purchase price ](#purchase-price)and repurchase price are de-nominated.

### Collateral Token

The digital asset "sold" to the lender as part of a repo transaction that serves a collateral for a borrower's loan.

### Initial Margin Ratio

The ratio of the value of [collateral tokens ](#collateral-token)to the [purchase price ](#purchase-price)required to bid in a Term auction, quoted as a percentage rate. This is a function of the purchase price because the [pricing rate ](#pricing-rate-repo-rate)is not known until after all bids have been submitted and an auction has been cleared. The initial margin requirement is typically higher than the [maintenance margin requirement ](#maintenance-margin-requirement)to maintain a buffer against liquidation.

### Maintenance Margin Ratio

The ratio of the value of [collateral tokens](#collateral-token) to the [repurchase price](#repurchase-price) required to avoid liquidation.

### Market Value of Collateral

The market value with respect to any [collateral tokens ](#collateral-token)as of any point in time based on the price for such collateral tokens obtained via real-time Chainlink oracle feeds.

### Transaction Exposure

Transaction exposure measures the margin deficit or excess of an account. We apply the maintenance margin ratio to the current market value of collateral based on Chainlink oracle feeds and compare that to the repurchase price as shown [here](https://github.com/term-finance/term-finance-developer-docs/tree/main/term-finance-protocol/broken-reference/README.md). Where an account is in margin deficit (negative transaction exposure) its collateral is eligible for liquidation.

### Margin Excess

Where the [market value of collateral](#market-value-of-collateral) of a borrower exceeds the [maintenance margin ratio ](#maintenance-margin-ratio)multiplied by the [repurchase price ](#repurchase-price)owed by such borrower, the borrower is said to be in margin excess.

### Margin Deficit

Where the [market value of collateral](#market-value-of-collateral) of a borrower is less than the [maintenance margin ratio ](#maintenance-margin-ratio)multiplied by the [repurchase price ](#repurchase-price)owed by such borrower, the borrower is said to be in margin deficit.

### Liquidated Damages

Liquidated damages are a surcharge to the amount of collateral seized in liquidations when valued at fair market value measured as a percentage rate. The surcharge is split between the portion that goes to the liquidator ([liquidation incentive](#liquidation-incentive)) and the portion that accrues to the protocol ([protocol seize share](#protocol-seize-share)) such that:

$$\text{liquidatedDamages} = \text{liquidatorIncentive} +\text{protocolSeizeShare}$$

### Liquidator Incentive

The liquidation incentive is the portion of the [liquidation penalty ](#liquidation-penalty)that accrues to the liquidator.

### Protocol Seize Share

The protocol seize share is the portion of the [liquidation penalty ](#liquidation-penalty)that accrues to the protocol.

### Recovery Rate

The rate at which all lenders to a term pool recover in the event that after all repurchases and liquidations are accounted for, there is insufficient purchase tokens to allow for 1:1 redmption of repo tokens.


# Access Controls

Term Finance Protocol contracts inherit from OpenZeppelin's [AccessControlUpgradeable.sol ](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/master/contracts/access/AccessControlUpgradeable.sol)contract, an upgradeable variant of [AccessControl.sol](https://docs.openzeppelin.com/contracts/3.x/access-control). This allows Protocol contracts to define multiple roles, each with access to perform different sets of actions. The table below documents all roles, their multi-signature wallets and modules, and accessible methods assigned within the Protocol.

{% tabs %}
{% tab title="Ethereum" %}

<table><thead><tr><th width="466.53873659118">Role and Addresses</th><th>Contracts and Methods</th></tr></thead><tbody><tr><td>DEVOPS_ROLE<br><br><a href="https://app.safe.global/home?safe=eth:0xb8A1dF43c1c88b13937C0c5CEBbAd15830cAeC03">"Ownerless" Gnosis Safe</a> with 24-hour <a href="https://etherscan.io/address/0x0C19d8A404079d71E5CA3e32fE3f758Ab543ACdf">Zodiac Delay Modifier </a>and <a href="https://etherscan.io/address/0x87D3C4Aa89f121c2D24C4F4A74C3C95c07088eA1">Zodiac Roles Modifier</a> providing <a href="https://app.safe.global/home?safe=eth:0xd5E12854A3Dba99deF295A7635D3Ba16427d2A28">DevOps-Proposer Gnosis Safe (5/11)</a> with an invalidator role</td><td><p><mark style="color:yellow;"><code>All Contracts</code></mark>:</p><ul><li>_authorizeUpgrade</li><li>e.g. <a href="/0.5.31/term-repo-class/term-auction-group/termauction#_authorizeupgrade"><code>_authorizeUpgrade</code></a></li></ul><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#pausedeploying"><code>pauseDeploying</code></a></li><li><a href="/latest/protocol-class/terminitializer#unpausedeploying"><code>unpauseDeploying</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#updatetreasuryaddress"><code>updateTreasuryAddress</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#updateprotocolreserveaddress"><code>updateProtocolReserveAddress</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermPriceConsumerV3.sol</code></mark></a>:</p><ul><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#addnewtokenpricefeed"><code>addNewTokenPriceFeed</code></a></li><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#removetokenpricefeed"><code>removeTokenPriceFeed</code></a></li></ul></td></tr><tr><td>ADMIN_ROLE<br><br><a href="https://app.safe.global/home?safe=eth:0x73d1C7dc9CEb14660Cf1E9BB29F80ECF9E97D774">Admin Gnosis Safe (4/10)</a></td><td><p>Access to various admin actions for each contract group, documented below:</p><ul><li><a href="/term-finance-protocol/term-repo/term-auction-group/administrative-functions">Term Auction Group</a></li><li><a href="/term-finance-protocol/term-repo/term-servicer-group/administrative-functions">Term Servicer Group</a></li><li><a href="/term-finance-protocol/term-repo/term-repo-token/administrative-functions">Term Repo Token</a></li><li><a href="/term-finance-protocol/protocol-contracts">Protocol Contracts</a></li></ul></td></tr><tr><td>INITIALIZER_APPROVER_ROLE<br><br><a href="https://app.safe.global/home?safe=eth:0xD03a6771b64E9A759523af3a89Fc982b2dd38591">Setup Approver Gnosis Safe (3/6)</a></td><td><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#setupterm"><code>setupTerm</code></a></li><li><a href="/latest/protocol-class/terminitializer#setupauction"><code>setupAuction</code></a></li></ul></td></tr><tr><td>CONTROLLER_ADMIN_ROLE<br><br><a href="https://etherscan.io/address/0x2AB21222953A63f29Df48573A1c7E89D9f296685">Deploy Tools EOA</a> stored in AWS Parameters managed by AWS <a href="https://aws.amazon.com/kms/">Key Management Service (KMS)</a></td><td><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#marktermdeployed"><code>markTermDeployed</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#unmarktermdeployed"><code>unmarkTermDeployed</code></a></li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="Avalanche" %}

<table><thead><tr><th width="466.53873659118">Role and Addresses</th><th>Contracts and Methods</th></tr></thead><tbody><tr><td>DEVOPS_ROLE<br><br><a href="https://app.safe.global/settings/setup?safe=base:0xb8A1dF43c1c88b13937C0c5CEBbAd15830cAeC03">"Ownerless" Gnosis Safe</a> with 24-hour <a href="https://snowtrace.io/address/0x7E8CdF62F0Aa78901B0A45907B00380E182698aa">Zodiac Delay Modifier </a>and <a href="https://etherscan.io/address/0x87D3C4Aa89f121c2D24C4F4A74C3C95c07088eA1">Zodiac Roles Modifier</a> providing <a href="https://app.safe.global/settings/setup?safe=base:0xd5E12854A3Dba99deF295A7635D3Ba16427d2A28">DevOps-Proposer Gnosis Safe (5/9)</a> with an invalidator role</td><td><p><mark style="color:yellow;"><code>All Contracts</code></mark>:</p><ul><li>_authorizeUpgrade</li><li>e.g. <a href="/0.5.31/term-repo-class/term-auction-group/termauction#_authorizeupgrade"><code>_authorizeUpgrade</code></a></li></ul><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#pausedeploying"><code>pauseDeploying</code></a></li><li><a href="/latest/protocol-class/terminitializer#unpausedeploying"><code>unpauseDeploying</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#updatetreasuryaddress"><code>updateTreasuryAddress</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#updateprotocolreserveaddress"><code>updateProtocolReserveAddress</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermPriceConsumerV3.sol</code></mark></a>:</p><ul><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#addnewtokenpricefeed"><code>addNewTokenPriceFeed</code></a></li><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#removetokenpricefeed"><code>removeTokenPriceFeed</code></a></li></ul></td></tr><tr><td>ADMIN_ROLE<br><br><a href="https://app.safe.global/settings/setup?safe=base:0x73d1C7dc9CEb14660Cf1E9BB29F80ECF9E97D774">Admin Gnosis Safe (4/9)</a></td><td><p>Access to various admin actions for each contract group, documented below:</p><ul><li><a href="/term-finance-protocol/term-repo/term-auction-group/administrative-functions">Term Auction Group</a></li><li><a href="/term-finance-protocol/term-repo/term-servicer-group/administrative-functions">Term Servicer Group</a></li><li><a href="/term-finance-protocol/term-repo/term-repo-token/administrative-functions">Term Repo Token</a></li><li><a href="/term-finance-protocol/protocol-contracts">Protocol Contracts</a></li></ul></td></tr><tr><td>INITIALIZER_APPROVER_ROLE<br><br><a href="https://app.safe.global/settings/setup?safe=base:0xD03a6771b64E9A759523af3a89Fc982b2dd38591">Setup Approver Gnosis Safe (3/9)</a></td><td><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#setupterm"><code>setupTerm</code></a></li><li><a href="/latest/protocol-class/terminitializer#setupauction"><code>setupAuction</code></a></li></ul></td></tr><tr><td>CONTROLLER_ADMIN_ROLE<br><br><a href="https://etherscan.io/address/0x2AB21222953A63f29Df48573A1c7E89D9f296685">Deploy Tools EOA</a> stored in AWS Parameters managed by AWS <a href="https://aws.amazon.com/kms/">Key Management Service (KMS)</a></td><td><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#marktermdeployed"><code>markTermDeployed</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#unmarktermdeployed"><code>unmarkTermDeployed</code></a></li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="Base" %}

<table><thead><tr><th width="466.53873659118">Role and Addresses</th><th>Contracts and Methods</th></tr></thead><tbody><tr><td>DEVOPS_ROLE<br><br><a href="https://app.safe.global/home?safe=base:0xb8A1dF43c1c88b13937C0c5CEBbAd15830cAeC03">"Ownerless" Gnosis Safe</a> with 24-hour <a href="https://basescan.org/address/0xb64C32D6B44BD0f48c6a0B834e7fdB416d834a67">Zodiac Delay Modifier </a>and <a href="https://basescan.org/address/0x8eF51A946b939eEd46552770D0D6511a72033b50">Zodiac Roles Modifier</a> providing <a href="https://app.safe.global/home?safe=base:0xd5E12854A3Dba99deF295A7635D3Ba16427d2A28">DevOps-Proposer Gnosis Safe (5/11)</a> with an invalidator role</td><td><p><mark style="color:yellow;"><code>All Contracts</code></mark>:</p><ul><li>_authorizeUpgrade</li><li>e.g. <a href="/0.5.31/term-repo-class/term-auction-group/termauction#_authorizeupgrade"><code>_authorizeUpgrade</code></a></li></ul><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#pausedeploying"><code>pauseDeploying</code></a></li><li><a href="/latest/protocol-class/terminitializer#unpausedeploying"><code>unpauseDeploying</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#updatetreasuryaddress"><code>updateTreasuryAddress</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#updateprotocolreserveaddress"><code>updateProtocolReserveAddress</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermPriceConsumerV3.sol</code></mark></a>:</p><ul><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#addnewtokenpricefeed"><code>addNewTokenPriceFeed</code></a></li><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#removetokenpricefeed"><code>removeTokenPriceFeed</code></a></li></ul></td></tr><tr><td>ADMIN_ROLE<br><br><a href="https://app.safe.global/home?safe=base:0x73d1C7dc9CEb14660Cf1E9BB29F80ECF9E97D774">Admin Gnosis Safe (4/10)</a></td><td><p>Access to various admin actions for each contract group, documented below:</p><ul><li><a href="/term-finance-protocol/term-repo/term-auction-group/administrative-functions">Term Auction Group</a></li><li><a href="/term-finance-protocol/term-repo/term-servicer-group/administrative-functions">Term Servicer Group</a></li><li><a href="/term-finance-protocol/term-repo/term-repo-token/administrative-functions">Term Repo Token</a></li><li><a href="/term-finance-protocol/protocol-contracts">Protocol Contracts</a></li></ul></td></tr><tr><td>INITIALIZER_APPROVER_ROLE<br><br><a href="https://app.safe.global/home?safe=base:0xD03a6771b64E9A759523af3a89Fc982b2dd38591">Setup Approver Gnosis Safe (3/6)</a></td><td><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#setupterm"><code>setupTerm</code></a></li><li><a href="/latest/protocol-class/terminitializer#setupauction"><code>setupAuction</code></a></li></ul></td></tr><tr><td>CONTROLLER_ADMIN_ROLE<br><br><a href="https://etherscan.io/address/0x2AB21222953A63f29Df48573A1c7E89D9f296685">Deploy Tools EOA</a> stored in AWS Parameters managed by AWS <a href="https://aws.amazon.com/kms/">Key Management Service (KMS)</a></td><td><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#marktermdeployed"><code>markTermDeployed</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#unmarktermdeployed"><code>unmarkTermDeployed</code></a></li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="BNB" %}

<table><thead><tr><th width="466.53873659118">Role and Addresses</th><th>Contracts and Methods</th></tr></thead><tbody><tr><td>DEVOPS_ROLE<br><br><a href="https://app.safe.global/home?safe=bnb:0xb8A1dF43c1c88b13937C0c5CEBbAd15830cAeC03">"Ownerless" Gnosis Safe</a> with 24-hour <a href="https://bscscan.com/address/0x0613507855562DB48390E19077028B8538a369AA">Zodiac Delay Modifier </a>and <a href="https://bscscan.com/address/0x67B6eB2bdAE054265E83c98C8e0d207013D6C7C1">Zodiac Roles Modifier</a> providing <a href="https://app.safe.global/home?safe=bnb:0xd5E12854A3Dba99deF295A7635D3Ba16427d2A28">DevOps-Proposer Gnosis Safe (5/11)</a> with an invalidator role</td><td><p><mark style="color:yellow;"><code>All Contracts</code></mark>:</p><ul><li>_authorizeUpgrade</li><li>e.g. <a href="/0.5.31/term-repo-class/term-auction-group/termauction#_authorizeupgrade"><code>_authorizeUpgrade</code></a></li></ul><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#pausedeploying"><code>pauseDeploying</code></a></li><li><a href="/latest/protocol-class/terminitializer#unpausedeploying"><code>unpauseDeploying</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#updatetreasuryaddress"><code>updateTreasuryAddress</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#updateprotocolreserveaddress"><code>updateProtocolReserveAddress</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermPriceConsumerV3.sol</code></mark></a>:</p><ul><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#addnewtokenpricefeed"><code>addNewTokenPriceFeed</code></a></li><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#removetokenpricefeed"><code>removeTokenPriceFeed</code></a></li></ul></td></tr><tr><td>ADMIN_ROLE<br><br><a href="https://app.safe.global/home?safe=bnb:0x73d1C7dc9CEb14660Cf1E9BB29F80ECF9E97D774">Admin Gnosis Safe (4/10)</a></td><td><p>Access to various admin actions for each contract group, documented below:</p><ul><li><a href="/term-finance-protocol/term-repo/term-auction-group/administrative-functions">Term Auction Group</a></li><li><a href="/term-finance-protocol/term-repo/term-servicer-group/administrative-functions">Term Servicer Group</a></li><li><a href="/term-finance-protocol/term-repo/term-repo-token/administrative-functions">Term Repo Token</a></li><li><a href="/term-finance-protocol/protocol-contracts">Protocol Contracts</a></li></ul></td></tr><tr><td>INITIALIZER_APPROVER_ROLE<br><br><a href="https://app.safe.global/home?safe=bnb:0xD03a6771b64E9A759523af3a89Fc982b2dd38591">Setup Approver Gnosis Safe (3/6)</a></td><td><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#setupterm"><code>setupTerm</code></a></li><li><a href="/latest/protocol-class/terminitializer#setupauction"><code>setupAuction</code></a></li></ul></td></tr><tr><td>CONTROLLER_ADMIN_ROLE<br><br><a href="https://etherscan.io/address/0x2AB21222953A63f29Df48573A1c7E89D9f296685">Deploy Tools EOA</a> stored in AWS Parameters managed by AWS <a href="https://aws.amazon.com/kms/">Key Management Service (KMS)</a></td><td><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#marktermdeployed"><code>markTermDeployed</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#unmarktermdeployed"><code>unmarkTermDeployed</code></a></li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="Plasma" %}

<table><thead><tr><th width="466.53873659118">Role and Addresses</th><th>Contracts and Methods</th></tr></thead><tbody><tr><td>DEVOPS_ROLE<br><br><a href="https://app.safe.global/settings/setup?safe=plasma:0xEF091234249846493F63E5042C9b030ab9A2aEB3">"Ownerless" Gnosis Safe</a> with 24-hour <a href="https://plasmascan.to/address/0xe1b116efaB0fc6f46e24C398c7B129DBc7f82c4c">Zodiac Delay Modifier </a>and <a href="https://plasmascan.to/address/0xe44445B8F43C351ea6DD9b038eEd2Bf5C93D0E19">Zodiac Roles Modifier</a> providing <a href="https://app.safe.global/transactions/history?safe=plasma:0xA40D49E49A306e22d9144351c994EE82FBaBDEEC">DevOps-Proposer Gnosis Safe (5/11)</a> with an invalidator role</td><td><p><mark style="color:yellow;"><code>All Contracts</code></mark>:</p><ul><li>_authorizeUpgrade</li><li>e.g. <a href="/0.5.31/term-repo-class/term-auction-group/termauction#_authorizeupgrade"><code>_authorizeUpgrade</code></a></li></ul><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#pausedeploying"><code>pauseDeploying</code></a></li><li><a href="/latest/protocol-class/terminitializer#unpausedeploying"><code>unpauseDeploying</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#updatetreasuryaddress"><code>updateTreasuryAddress</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#updateprotocolreserveaddress"><code>updateProtocolReserveAddress</code></a></li></ul><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermPriceConsumerV3.sol</code></mark></a>:</p><ul><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#addnewtokenpricefeed"><code>addNewTokenPriceFeed</code></a></li><li><a href="/0.5.32/protocol-class/termpriceconsumerv3#removetokenpricefeed"><code>removeTokenPriceFeed</code></a></li></ul></td></tr><tr><td>ADMIN_ROLE<br><br><a href="https://app.safe.global/transactions/history?safe=plasma:0xD33ea17aB17A79818a8dF682e9A50f667Fa67Fc7">Admin Gnosis Safe (4/10)</a></td><td><p>Access to various admin actions for each contract group, documented below:</p><ul><li><a href="/term-finance-protocol/term-repo/term-auction-group/administrative-functions">Term Auction Group</a></li><li><a href="/term-finance-protocol/term-repo/term-servicer-group/administrative-functions">Term Servicer Group</a></li><li><a href="/term-finance-protocol/term-repo/term-repo-token/administrative-functions">Term Repo Token</a></li><li><a href="/term-finance-protocol/protocol-contracts">Protocol Contracts</a></li></ul></td></tr><tr><td>INITIALIZER_APPROVER_ROLE<br><br><a href="https://app.safe.global/settings/setup?safe=plasma:0x97E476445a0a7433f6C2C1ea7C1E7938CFD57cEc">Setup Approver Gnosis Safe (3/6)</a></td><td><p><mark style="color:yellow;"><code>TermInitializer.sol</code></mark>:</p><ul><li><a href="/latest/protocol-class/terminitializer#setupterm"><code>setupTerm</code></a></li><li><a href="/latest/protocol-class/terminitializer#setupauction"><code>setupAuction</code></a></li></ul></td></tr><tr><td>CONTROLLER_ADMIN_ROLE<br><br><a href="https://etherscan.io/address/0x2AB21222953A63f29Df48573A1c7E89D9f296685">Deploy Tools EOA</a> stored in AWS Parameters managed by AWS <a href="https://aws.amazon.com/kms/">Key Management Service (KMS)</a></td><td><p><a href="https://github.com/term-finance/term-finance-developer-docs/tree/main/access-controls/broken-reference/README.md"><mark style="color:yellow;"><code>TermController.sol</code></mark></a> :</p><ul><li><a href="/0.5.32/protocol-class/termcontroller#marktermdeployed"><code>markTermDeployed</code></a></li><li><a href="/0.5.32/protocol-class/termcontroller#unmarktermdeployed"><code>unmarkTermDeployed</code></a></li></ul></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
Signers of the DevOps-Proposer Gnosis Safes and Admin Gnosis Safes are required to abide by the Signer Compliance Policy viewable [here](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2FH076wEUfpUyXvSN97Hms%2FTerm%20Labs%20-%20Signer%20Compliance%20Policy%20231113.pdf?alt=media\&token=f4e793da-5314-4c97-8c9e-a629e58630da).
{% endhint %}


# Upgradeability

Smart contract code can't be modified after being deployed to the blockchain. In order to facilitate potential upgrades, bug fixes or security updates, Term Finance smart contracts adopt OpenZeppelin's implementation of the [UUPS Proxy Pattern](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) to facilitate necessary updates, with the intent to gradually remove upgradeability altogether over time.

Consistent with OpenZeppelin's recommendation for smart contracts that adopt the UUPS proxy pattern, the [\_authorizeUpgrade](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable-_authorizeUpgrade-address-) function is overridden to restrict access to an address set to the DEVOPS\_ROLE. The Protocol assigns the DEVOPS\_ROLE to an "ownerless" Gnosis Safe with a 24-hour timelock restriction and invalidator controls to override unintentional or malicious upgrades. More details on the architecture is detailed below.

### DEVOPS\_ROLE Contract Architecture

The DEVOPS\_ROLE is reserved for the most sensitive Protocol admin actions (including upgrades) and is assigned to the DevOps "Ownerless" Safe. Transactions through the DevOps "Ownerless" Safe can only be executed via the Zodiac Delay Modifier. Specifically, the [DevOps-Proposer Gnosis Safe (5/9)](https://app.safe.global/home?safe=eth:0xd5E12854A3Dba99deF295A7635D3Ba16427d2A28) may initiate actions via the Zodiac Delay Modifier that imposes a 24-hour time-lock with a 24-hour expiration period. The [DevOps-Proposer Gnosis Safe (5/9)](https://app.safe.global/home?safe=eth:0xd5E12854A3Dba99deF295A7635D3Ba16427d2A28) is also able to invalidate any malicious or unintended transactions pending in queue during the 24-hour time-lock period.

<figure><img src="https://3704574223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2Fgit-blob-71acfa2cfbb857b5e01bf535ea05a36e49b63848%2FBlank%20diagram%20-%20Page%201%20(9).svg?alt=media" alt=""><figcaption><p>DEVOPS_ROLE transactions secured by 24-hour timelock with the ability to invalidate any transactions as a fail-safe</p></figcaption></figure>


# Deployed Contracts

As described in the [Upgradeability](/access-controls/further-details) section, Term Finance smart contracts are deployed following the UUPS Proxy Pattern. With proxy contracts, calls are delegated to "implementation contracts" where contract logic is stored. Below we provide links to tables detailing addresses to the implementation contracts deployed by the Protocol and a table mapping "releases" to these addresses across each chain on which Term is deployed. New features and upgrades are deployed and tagged to a new release.

{% content-ref url="/pages/ywXe9r130NoUC7vrjpHi" %}
[\[Ethereum\]](/deployed-contracts/deployed-contracts)
{% endcontent-ref %}

{% content-ref url="/pages/Mb1zwY0QnlOa7PVCZiy2" %}
[\[Avalanche\]](/deployed-contracts/deployed-contracts-1)
{% endcontent-ref %}

{% content-ref url="/pages/1ktRlvkHnLxYXeIBXj3g" %}
[\[Base\]](/deployed-contracts/deployed-contracts-1-1)
{% endcontent-ref %}

{% content-ref url="/pages/qu6UnO1KaU3tSs4i1E9g" %}
[\[Binance Smart Chain\]](/deployed-contracts/deployed-contracts-1-2)
{% endcontent-ref %}

{% content-ref url="/pages/dSuPjZ7SajP02BvhdB2m" %}
[\[Plasma\]](/deployed-contracts/plasma)
{% endcontent-ref %}

{% content-ref url="/pages/4o1uh6Kpx55AiS56dRqy" %}
[\[MegaETH\]](/deployed-contracts/megaeth)
{% endcontent-ref %}


# Smart Contract Audits

<table><thead><tr><th width="230.33333333333331">Auditor</th><th width="166">Audit Type</th><th width="174">Date</th><th width="92">Release</th><th>Commit</th></tr></thead><tbody><tr><td><a href="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5pvpy8IqtxZOybRubGkj%2Fuploads%2Fs0QmaveRMVxhPIkIsTPV%2FSmart%20Contract%20Security%20Assessment%20-%20Sigma%20Prime%20-%201.0.pdf?alt=media&#x26;token=1f337436-2659-4f9b-8dd2-4cb76a0f30ca">Sigma Prime</a></td><td>Initial Review</td><td>April 2023</td><td><a href="/pages/c4lnlkfKTqJRdu97tCrv#0.2.4">0.1.0</a></td><td>---</td></tr><tr><td><a href="https://runtimeverification.com/blog/how-audits-can-optimize-code-base-term-finance-clearing-price-algorithm">Runtime Verification</a></td><td>Algorithm</td><td>May 2023</td><td><a href="/pages/c4lnlkfKTqJRdu97tCrv#0.2.4">0.1.0</a></td><td>---</td></tr><tr><td><a href="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5pvpy8IqtxZOybRubGkj%2Fuploads%2FxN8cb7EOgehny20c6mK9%2FSmart%20Contract%20Security%20Assessment%20-%20Sigma%20Prime%20-%202.0.pdf?alt=media&#x26;token=f7855870-c638-46f4-a8ce-c09155fddd61">Sigma Prime</a></td><td>Changes</td><td>May 2023</td><td><a href="/pages/c4lnlkfKTqJRdu97tCrv#0.2.4">0.2.0</a></td><td>---</td></tr><tr><td><a href="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5pvpy8IqtxZOybRubGkj%2Fuploads%2FZ8RA1ZMbq6QNEBIiBStl%2FSmart%20Contract%20Security%20Assessment%20-%20Dedaub.pdf?alt=media&#x26;token=5e981b61-7502-4a21-ab74-c0e0f29ac60b">Dedaub</a></td><td>Changes</td><td>June 2023</td><td><a href="/pages/c4lnlkfKTqJRdu97tCrv#0.4.4">0.4.0</a></td><td>---</td></tr><tr><td><a href="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5pvpy8IqtxZOybRubGkj%2Fuploads%2FBC0IcGcm0CE9hmYAMIfx%2FSmart%20Contract%20Security%20Assessment%20-%20Sigma%20Prime%20-%203.0.pdf?alt=media&#x26;token=6895e9dc-e434-4f28-a454-ec47c1089b87">Sigma Prime</a></td><td>Changes</td><td>November 2023</td><td><a href="/pages/ywXe9r130NoUC7vrjpHi#id-0.6.0">0.6.0</a></td><td><a href="https://github.com/term-finance/term-finance-contracts/releases/tag/0.6.0">public</a></td></tr><tr><td><a href="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg2unsUVhFxcxuJwNIofz%2Fuploads%2FZHRvJR2hizM1g6bId0lc%2FSigma_Prime_Term_Finance_Smart_contract_Changes_May_2024_Security.pdf?alt=media&#x26;token=f760f264-9e19-4888-a7f2-1899e78d2085">Sigma Prime</a></td><td>Changes</td><td>May 2024</td><td><a href="/pages/ywXe9r130NoUC7vrjpHi#id-0.9.0">0.9.0</a></td><td><a href="https://github.com/term-finance/term-finance-contracts/releases/tag/0.9.0">public</a></td></tr><tr><td><a href="https://github.com/term-finance/term-finance-contracts/blob/main/audits/sigma-prime/v2/Sigma_Prime_Term_Finance_Consolidated_Security_Assessment_Report.pdf">Sigma Prime</a></td><td>Changes</td><td>May 2026</td><td><a href="/pages/ywXe9r130NoUC7vrjpHi#id-2.1.0">2.1.0</a></td><td><a href="https://github.com/term-finance/term-finance-contracts/releases/tag/2.1.0">public</a></td></tr></tbody></table>


# Formal Verification

## Summary

This report represents work and conclusions based on Term Labs using Certora’s Prover tool to formally verify security properties of Term's smart contracts. Term finalized formal verification of the protocol's smart contracts using Certora's Prover solutions with guidance and technical support provided by the Certora team. The work was undertaken from Dec. 1, 2023 to Mar. 23, 2024. Some of these tests were verified using beta and staging versions of Certora's Prover, which are scheduled to be deployed to their production service in the near future. The latest commit that was reviewed and ran through the Certora Prover was [831292726cdc22e9d4d2953d59051fa00fbd4f72](https://github.com/term-finance/term-finance-contracts/commit/831292726cdc22e9d4d2953d59051fa00fbd4f72).

The scope of this verification includes all [Term Servicer](https://developers.term.finance/term-finance-protocol/term-repo/term-servicer-group) contracts within Term Protocol. This includes the following.

* `TermRepoToken.sol`
* `TermRepoLocker.sol`
* `TermRepoServicer.sol`
* `TermRepoCollateralManager.sol`
* `TermRepoRolloverManager.sol`

[Auction Contracts](https://developers.term.finance/term-finance-protocol/term-repo/term-auction-group) within Term Protocol were partially verified, with coverage on all functions except for those related to auction clearing, whose loop complexity is too elevated for formal verification. Runtime Verification was previously engaged to focus specifically on auditing and manually verifying this small but critical part of the codebase, see [here](https://runtimeverification.com/blog/how-audits-can-optimize-code-base-term-finance-clearing-price-algorithm). Contracts with partial coverage include:

* `TermAuction.sol`
* `TermAuctionBidLocker.sol`
* `TermAuctionOfferLocker.sol`

The Certora Prover proved the implementation of the protocol is correct with respect to formal specifications written by the Term Labs team.

## List of Main Issues Discovered

**Severity: Low**

| Issue:          | Zero Max Repayment Allowed in burnCollapseExposure                                                                                                                                                                                                                                                                                                                                                   |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Description:    | In the case where a borrower (i) has an outstanding repurchase exposure that (ii) has also been submitted as an open rollover such that (iii) the amount they are able to collapse is 0, the burnCollapseExposure function nevertheless executes, calling 0 transfers and adding 0 to accounting for a burn collapse exposure . Although there is no harm done, this is a waste of gas for the user. |
| Mitigation/Fix: | Add a revert condition to burnCollapseExposure to revert execution if the max repayment a borrower can make is 0.                                                                                                                                                                                                                                                                                    |
| Rule coverage:  | burnCollapseExposureIntegrity burnCollapseExposureRevertConditions                                                                                                                                                                                                                                                                                                                                   |

## Disclaimer

The Certora Prover takes as input a contract and a specification and formally proves that the contract satisfies the specification in all scenarios. Importantly, the guarantees of the Certora Prover are scoped to the provided specification, and the Certora Prover does not check any cases not covered by the specification.

We hope that this information is useful, but provide no warranty of any kind, explicit or implied. The contents of this report should not be construed as a complete guarantee that the contract is secure in all dimensions. In no event shall Term, Certora or any of its or their respective employees be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the results reported here.

## Overview of the verification

### Description of the system

The Term Finance Protocol enables noncustodial fixed-rate collateralized lending on-chain ([Term Repos](https://www.notion.so/protocol/term-repos)) modeled on tri-party repo arrangements common in TradFi. Borrowers and lenders are matched through a unique recurring auction process ([Term Auctions](https://www.notion.so/protocol/term-auctions)) where borrowers submit sealed bids and lenders submit sealed offers that are used to determine an interest rate that clears the market for participants of that auction. Participants who bid more than the clearing rate receive loans and participants willing to lend below the clearing rate make loans, in each case at the market-clearing rate. All other participants’ bids and offers are said to be “left on the table.” At the conclusion of an auction, borrowers receive loan proceeds and lenders receive ERC-20 tokens ([Term Repo Tokens](https://www.notion.so/protocol/term-repo-tokens)), which are receipts that lenders will burn to redeem for principal plus interest at maturity. Protocol smart contracts service these transactions by ledgering repayments and monitoring collateral health and liquidations.

### Description of the specification files

For each contract, spec rules are divided into separate spec files per business logic function type (separate spec for state variable rules), but during runtime are compiled together in a `rules.spec` file. For the termRepoCollateralManager, the `rules.spec` is further divided into a `rules.spec` and other spec files for liquidations and state variables, due to the nature of high verification fun times for those functions.

### Assumptions and Simplifications

* Some loops were run with a fixed size of 1 in able to enable formal verification. Verifying beyond a 1st loop would have cause formal verification to time out.
* Token prices are fetched from a constant mapping in CVL instead of a live price feed. This enables easier comparison of expected calculations and actual token amounts.
* Some of the multiplications and divisions in liquidation functions in the smart contracts inherit a contract called `ExponentialNoError`, which scales and truncates multiplications and divisions in Solidity in a way that precision is not lost. The calculations in these functions were replaced with CVL equivalents in order to prevent timeouts of FV rules.

## Contract Invariants and Rules

### Common Rules

Applied to every contract in the protocol.

1. **Rule:** `pairTermContractsRevertsWhenAlreadyPaired` - constrain input space to only include contracts that have already been paired.

{% code fullWidth="false" %}

```solidity
    require isTermContractPaired();

    pairTermContracts@withrevert(e, args);
    assert lastReverted,
        "pairTermContracts(...) should revert when calling it on an already paired contract";

    assert isTermContractPaired(),
        "termContractPaired should not change when calling pairTermContracts(...) on an already paired contract";
}
```

{% endcode %}

2. **Rule:** `onlyPairTermContractsChangesIsTermContractPairedRule` - ensures that only pairTermContracts(...) can change state of `termContractPaired`

```solidity
bool isTermContractPairedBefore = isTermContractPaired();

    f(e, args);

    bool isTermContractPairedAfter = isTermContractPaired();

    assert isTermContractPairedBefore == isTermContractPairedAfter,
        "termContractPaired should not change when calling methods other than pairTermContracts(...)";
```

### **TermRepoToken.sol**

1. **Invariant** `totalSupplyIsSumOfBalances` - ensures that the total supply of tokens always equals the sum of individual account balances, maintaining the principle of token conservation.

```solidity
to_mathint(totalSupply()) == sumOfBalances
```

2. **Rule:** `totalSupplyNeverOverflow` - guarantees that the total supply of tokens cannot exceed the maximum value allowed by the system, preventing overflow errors.

```solidity
assert totalSupplyBefore <= totalSupplyAfter;
```

3. **Rule:** `noMethodChangesMoreThanTwoBalances` - ensures that no single operation can alter more than two account balances at once.

```solidity
assert numberOfChangesOfBalancesAfter <= numberOfChangesOfBalancesBefore + 2;
```

4. **Rule:** `onlyAllowedMethodsMayChangeAllowance` - verifies that changes to token allowances are restricted to approved methods, ensuring that delegated spending limits are securely managed.

```solidity
definition canIncreaseAllowance(method f) returns bool = 
	f.selector == sig:approve(address,uint256).selector || 
    f.selector == sig:increaseAllowance(address,uint256).selector;
    

definition canDecreaseAllowance(method f) returns bool = 
	f.selector == sig:approve(address,uint256).selector ||
    f.selector == sig:decreaseAllowance(address,uint256).selector || 
	f.selector == sig:transferFrom(address,address,uint256).selector;

assert allowanceAfter > allowanceBefore => canIncreaseAllowance(f), "should not increase allowance";
assert allowanceAfter < allowanceBefore => canDecreaseAllowance(f), "should not decrease allowance";
```

5. **Rule:** `onlyAllowedMethodsMayChangeBalance` - verifies that token balance changes within accounts can only be done through approved methods, preventing unauthorized modifications.

```solidity
definition canIncreaseBalance(method f) returns bool = 
	f.selector == sig:mintRedemptionValue(address,uint256).selector || 
    f.selector == sig:mintTokens(address,uint256).selector || 
	f.selector == sig:transfer(address,uint256).selector ||
	f.selector == sig:transferFrom(address,address,uint256).selector;

definition canDecreaseBalance(method f) returns bool = 
	f.selector == sig:burn(address,uint256).selector || 
    f.selector == sig:burnAndReturnValue(address,uint256).selector || 
	f.selector == sig:transfer(address,uint256).selector ||
	f.selector == sig:transferFrom(address,address,uint256).selector;

assert balanceAfter > balanceBefore => canIncreaseBalance(f);
assert balanceAfter < balanceBefore => canDecreaseBalance(f);
```

6. **Rule:** `onlyAllowedMethodsMayChangeTotalSupply` - verifies that changes to the total supply of tokens are conducted only through authorized methods, maintaining supply integrity.

```solidity
definition canIncreaseTotalSupply(method f) returns bool = 
	f.selector == sig:mintRedemptionValue(address,uint256).selector || 
    f.selector == sig:mintTokens(address,uint256).selector;

definition canDecreaseTotalSupply(method f) returns bool = 
	f.selector == sig:burn(address,uint256).selector || 
    f.selector == sig:burnAndReturnValue(address,uint256).selector;

 assert totalSupplyAfter > totalSupplyBefore => canIncreaseTotalSupply(f);
 assert totalSupplyAfter < totalSupplyBefore => canDecreaseTotalSupply(f);
```

7. **Rule:** `reachability` - verifies that all non-initialization and non-upgrade methods can be executed, ensuring contract functionality is accessible.

```solidity
f(e,args);
satisfy true;
```

8. **Rule:** `onlyAuthorizedCanTransfer` - verifies that token transfers can only be initiated by authorized entities.

```solidity
assert (
    balanceAfter < balanceBefore
) => (
    f.selector == sig:burn(address,uint256).selector ||
    f.selector == sig:burnAndReturnValue(address,uint256).selector ||
    e.msg.sender == account ||
    balanceBefore - balanceAfter <= to_mathint(allowanceBefore)
);
```

9. **Rule:** `onlyHolderOfSpenderCanChangeAllowance` - verifies that changes to spending allowance, which is the limit set by the token holder for how much another account can spend on their behalf, can only be made by the token holder or a designated spender

<pre class="language-solidity"><code class="lang-solidity"><strong>assert (
</strong>        allowanceAfter > allowanceBefore
    ) => (
        ((f.selector == sig:approve(address,uint256).selector || f.selector == sig:increaseAllowance(address,uint256).selector) &#x26;&#x26; e.msg.sender == holder)
    );

    assert (
        allowanceAfter &#x3C; allowanceBefore
    ) => (
        (f.selector == sig:transferFrom(address,address,uint256).selector &#x26;&#x26; e.msg.sender == spender) ||
        ((f.selector == sig:approve(address,uint256).selector || f.selector == sig:decreaseAllowance(address,uint256).selector) &#x26;&#x26; e.msg.sender == holder )
    );
</code></pre>

10. **Rule:** `mintTokensIntegrity` - ensures that after minting tokens, the balance of the minter and the total supply are correctly increased.

```solidity
  assert to_mathint(balanceOf(to)) == toBalanceBefore   + amount;
  assert to_mathint(totalSupply()) == totalSupplyBefore + amount;
```

11. **Rule:** `mintRedemptionValueIntegrity` - ensures that after minting tokens and returning a value, the balance of the minter and the total supply are correctly increased.

```solidity
mathint redemptValue = redemptionValue();
mathint expectedBalanceAfter = (balanceBefore + ( amount * expScale * expScale / redemptValue) / expScale);
mathint expectedTotalSupplyAfter = (totalSupply() + ( amount * expScale * expScale / redemptValue) / expScale);

assert balanceAfter == expectedBalanceAfter;
assert totalSupplyAfter == expectedTotalSupplyAfter;
```

where `expScale` = 10^ 18.

12. **Rule:** `mintTokensRevertingConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool paused = mintingPaused() == true;
bool payable = e.msg.value > 0;
bool toZeroAccount = account == 0;
bool notMinterRole = !hasRole(MINTER_ROLE(), e.msg.sender);

bool isExpectedToRevert = paused || payable || notMinterRole || toZeroAccount;
```

13. **Rule:** `mintRedemptionValueRevertingConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool paused = mintingPaused() == true;
bool payable = e.msg.value > 0;
bool toZeroAccount = account == 0;
bool notMinterRole = !hasRole(MINTER_ROLE(), e.msg.sender);

bool isExpectedToRevert = paused || payable || notMinterRole || toZeroAccount;
```

14. **Rule:** `mintRedemptionValueDoesNotAffectThirdParty` - verifies that when one account invokes `mintRedemptionValue`, this action does not affect third-party balances.

```solidity
	require addr1 != addr2;
	
	uint256 before = balanceOf(addr2);
		
	mintRedemptionValue(e, addr1, amount);
	assert balanceOf(addr2) == before;
```

15. **Rule:** `mintTokensDoesNotAffectThirdParty` - verifies that when one account invokes `mintOpenExposure`, this action does not affect third-party balances.

```solidity
	require addr1 != addr2;
		
	uint256 before = balanceOf(addr2);
		
	mintTokens(e, addr1, amount);
	assert balanceOf(addr2) == before;
```

16. **Rule:** `burnIntegrity` - ensures that after burning tokens, the balance of the burner and the total supply are correctly decreased.

```solidity
 assert to_mathint(balanceOf(from)) == fromBalanceBefore   - amount;
 assert to_mathint(totalSupply())   == totalSupplyBefore - amount;
```

17. **Rule:** `burnAndReturnValueIntegrity` - ensures that after burning tokens and returning a value, the balance of the burner and the total supply are correctly decreased.

```solidity
assert to_mathint(balanceOf(from)) == fromBalanceBefore - amount;
assert to_mathint(totalSupply()) == totalSupplyBefore - amount;
```

18. **Rule:** `burnRevertingConditions` - checks conditions under which a burn operation should revert, such as not having enough balance, the contract being paused, etc.

```solidity
 bool payable = e.msg.value > 0;
 bool notEnoughBalance = balanceOf(account) < amount;
 bool notBurnerRole = !hasRole(BURNER_ROLE(), e.msg.sender);
 bool fromZeroAccount = account == 0;
 bool paused = burningPaused();
 bool isExpectedToRevert = notEnoughBalance || notBurnerRole || paused || fromZeroAccount || payable;

 assert lastReverted <=> isExpectedToRevert;

```

19. **Rule:** `burnDoesNotAffectThirdParty` - verifies that burning tokens from one account does not affect third party balances.

```solidity
assert balanceOf(addr2) == before;
```

20. **Rule:** `burnAndReturnValueDoesNotAffectThirdParty` - confirms that burning tokens and returning a value from one account does not impact the balance of an unrelated account.

```solidity
assert balanceOf(addr2) == before;
```

21. **Rule:** `transferIntegrity` - asserts that after a transfer, the balances of the sender and recipient are updated correctly, respecting the case when sender and recipient are the same.

```solidity
assert to_mathint(balanceOf(holder)) == holderBalanceBefore - (holder == recipient ? 0 : amount);
assert to_mathint(balanceOf(recipient)) == recipientBalanceBefore + (holder == recipient ? 0 : amount);

```

22. **Rule:** `transferIsOneWayAdditive` - demonstrates that if a transfer of a combined amount succeeds, individual transfers of the components should also succeed without affecting the final state.

```solidity
transfer(e, recipient, assert_uint256(sum));
	storage after1 = lastStorage;

	transfer@withrevert(e, recipient, amount_a) at init; // restores storage
		assert !lastReverted;	//if the transfer passed with sum, it should pass with both summands individually
	transfer@withrevert(e, recipient, amount_b);
		assert !lastReverted;
	storage after2 = lastStorage;

assert after1[currentContract] == after2[currentContract];

```

23. **Rule:** `transferRevertingConditions`- identifies conditions under which a transfer should revert, such as the sender not having enough balance.

```solidity
    bool payable = e.msg.value != 0;
    bool zeroTo = account == 0;
    bool notEnoughBalance = balanceOf(e.msg.sender) < amount;
    bool isExpectedToRevert = payable || zeroTo || notEnoughBalance;

assert lastReverted <=> isExpectedToRevert;

```

24. **Rule:** `transferDoesNotAffectThirdParty` - ensures that a transfer between two accounts does not affect the balance of a third party.

```solidity
assert balanceOf(addr2) == before;

```

25. **Rule:** `transferFromIntegrity` - confirms that after a transferFrom operation, the balances of the holder and recipient are correctly adjusted, and the allowance is updated appropriately.

```solidity
assert to_mathint(allowance(holder, spender)) == (allowanceBefore == max_uint256 ? max_uint256 : allowanceBefore - amount);
assert to_mathint(balanceOf(holder)) == holderBalanceBefore - (holder == recipient ? 0 : amount);
assert to_mathint(balanceOf(recipient)) == recipientBalanceBefore + (holder == recipient ? 0 : amount);

```

26. **Rule:** `transferFromRevertingConditions` - checks for conditions that should cause a transferFrom to revert, such as insufficient allowance or balance.

```solidity
bool sendEthToNotPayable = e.msg.value != 0;
    bool ownerZero = owner == 0;
    bool recepientZero = recepient == 0;
	bool allowanceIsLow = allowed < transfered;
    bool notEnoughBalance = balanceOf(owner) < transfered;

    bool isExpectedToRevert = sendEthToNotPayable  || allowanceIsLow || notEnoughBalance || ownerZero || recepientZero;

assert lastReverted <=> isExpectedToRevert;

```

27. **Rule:** `transferFromDoesNotAffectThirdParty` - verifies that a `transferFrom` operation does not impact the balance or allowance of third parties.

```solidity
assert thirdPartyBalanceBefore == thirdPartyBalanceAfter;
assert thirdPartyAllowanceBefore == thirdPartyAllowanceAfter;

```

28. **Rule:** `transferFromIsOneWayAdditive` - shows that if a `transferFrom` for a combined amount is successful, then separate `transferFrom` operations for each component of the amount should also succeed, without altering the final state.

```solidity
transferFrom(e, owner, recipient, assert_uint256(sum));
	storage after1 = lastStorage;

	transferFrom@withrevert(e, owner, recipient, amount_a) at init; // restores storage
		assert !lastReverted;	//if the transfer passed with sum, it should pass with both summands individually
	transferFrom@withrevert(e, owner, recipient, amount_b);
		assert !lastReverted;
	storage after2 = lastStorage;

assert after1[currentContract] == after2[currentContract];

```

29. **Rule:** `approveIntegrity` - ensures that the allowance is correctly set after an approve operation.

```solidity
assert allowance(holder, spender) == amount;

```

30. **Rule:** `approveRevertingConditions` - identifies scenarios in which an approve operation should revert, such as when trying to approve from a zero address.

```solidity
bool payable = e.msg.value != 0;
    bool spenderIsZero = spender == 0;
	bool isExpectedToRevert = payable || spenderIsZero;

assert lastReverted <=> isExpectedToRevert;

```

31. **Rule:** `approveDoesNotAffectThirdParty` - confirms that an approve operation between two parties does not affect the allowance of a third party.

```solidity
assert thirdPartyAllowanceBefore == thirdPartyAllowanceBefore;

```

32. **Rule:** `onlyAllowedMethodsMayChangeMintExposureCap` - ensures that only specific methods can modify the mint exposure cap. Methods like minting, burning, or resetting the cap are allowed to change it.

```solidity
assert mintExposureCapAfter > mintExposureCapBefore => canIncreaseMintExposureCap(f);
assert mintExposureCapAfter < mintExposureCapBefore => canDecreaseMintExposureCap(f);

```

33. **Rule:** `mintExposureCapNeverOverflow` - verifies that when the mint exposure cap is increased, this action does not cause it to overflow, ensuring the cap's value remains within safe limits.

```solidity
assert mintExposureCapBefore <= mintExposureCapAfter;

```

34. **Rule:** `noMethodChangesRedemptionValue` - confirms that the redemption value remains unchanged across transactions, except by methods explicitly intended to modify it. This rule ensures stability in the redemption value.

```solidity
assert redemptionValueBefore == redemptionValueAfter;

```

35. **Rule:** `onlyRoleCanCallRevert` - checks if a method call that is not a view and requires specific roles to execute successfully, does not revert if the caller has the necessary role.

```solidity
assert !lastReverted => hasRole(MINTER_ROLE(),e.msg.sender)
    || hasRole(BURNER_ROLE(),e.msg.sender)
    || hasRole(ADMIN_ROLE(),e.msg.sender)
    || hasRole(DEVOPS_ROLE(),e.msg.sender)
    || hasRole(INITIALIZER_ROLE(),e.msg.sender);

```

36. **Rule:** `onlyRoleCanCallStorage` - ensures that changes to storage by non-view method calls can only be performed by addresses with specific roles, guarding against unauthorized modifications.

```solidity
storage storeBefore = lastStorage;
currentContract.f(e,args);
storage storeAfter = lastStorage;

assert storeBefore != storeAfter => hasRole(MINTER_ROLE(),e.msg.sender)
    || hasRole(BURNER_ROLE(),e.msg.sender)
    || hasRole(ADMIN_ROLE(),e.msg.sender)
    || hasRole(DEVOPS_ROLE(),e.msg.sender)
    || hasRole(INITIALIZER_ROLE(),e.msg.sender);

```

### **TermRepoLocker.sol**

1. **Rule:** `onlyAllowedMethodsMayChangeTransfersPaused` - ensures that the state of transfers being paused can only be altered by specific methods designated for pausing or unpausing transfers.

```solidity
bool transfersPausedBefore = transfersPaused();
f(e, args);
bool transfersPausedAfter = transfersPaused();

assert(transfersPausedBefore == transfersPausedAfter);

```

2. **Rule:** `noMethodChangesTermRepoId` - confirms that the Term Repo ID remains constant and is not changed by any method calls, ensuring its immutability post-initialization.

```solidity
bytes32 termRepoIdBefore = termRepoId();
f(e, args);
bytes32 termRepoIdAfter = termRepoId();

assert(termRepoIdBefore == termRepoIdAfter);

```

3. **Rule:** `onlyAllowedMethodsMayChangeEmitter` - verifies that the emitter's address can only be changed through specific methods, preserving the integrity and security of the emitter identification.

```solidity
address emitterBefore = emitterAddress();
f(e, args);
address emitterAfter = emitterAddress();

assert(emitterBefore == emitterAfter);

```

4. **Rule:** `onlyAllowedMethodsMayChangeBalance` - checks if the treasury balance is correctly updated by allowed methods and remains unchanged by others.

```solidity
uint256 balanceBefore = token.balanceOf(currentContract);
f(e, args);
uint256 balanceAfter = token.balanceOf(currentContract);

// For increasing treasury balance
if (canIncreaseTreasuryBalance(f)) {
    assert balanceAfter > balanceBefore => (sender != currentContract) && (amount != 0);
    assert balanceAfter == balanceBefore => (sender == currentContract) || (amount == 0);
}
// For decreasing treasury balance
else if (canDecreaseTreasuryBalance(f)) {
    assert balanceAfter < balanceBefore => (recipient != currentContract) && (amount != 0);
    assert balanceAfter == balanceBefore => (recipient == currentContract) || (amount == 0);
}
// For other methods
else {
    assert balanceAfter == balanceBefore;
}

```

5. **Rule:** `reachability` - verifies that all non-initialization and non-upgrade methods can be executed, ensuring contract functionality is accessible.

```solidity
f(e,args);
satisfy true;

```

6. **Rule:** `transferTokenFromWalletIntegrity` - validates the integrity of transferring tokens from the wallet, checking the update in treasury and sender balances post-transaction.

```solidity
mathint treasuryBalanceBefore = to_mathint(token.balanceOf(currentContract));
mathint senderBalanceBefore = to_mathint(token.balanceOf(sender));

transferTokenFromWallet(e, sender, token, amount);

mathint treasuryBalanceAfter = to_mathint(token.balanceOf(currentContract));
mathint senderBalanceAfter = to_mathint(token.balanceOf(sender));

mathint expectedDiff = (isSelf || !isServicer || transfersPaused || isOverspend) ? 0 : to_mathint(amount);

// Asserting balance changes based on conditions
assert treasuryBalanceAfter == treasuryBalanceBefore + expectedDiff;
assert senderBalanceAfter == senderBalanceBefore - expectedDiff;
assert transfersPaused() == transfersPaused;

```

7. **Rule:** `transferTokenToWalletIntegrity` - ensures the correct adjustment of balances when tokens are transferred to the wallet, factoring in role permissions and pause status.

```solidity
mathint treasuryBalanceBefore = to_mathint(token.balanceOf(currentContract));
mathint recipientBalanceBefore = to_mathint(token.balanceOf(recipient));

transferTokenToWallet(e, recipient, token, amount);

mathint treasuryBalanceAfter = to_mathint(token.balanceOf(currentContract));
mathint recipientBalanceAfter = to_mathint(token.balanceOf(recipient));

mathint expectedDiff = (isSelf || !isServicer || transfersPaused || isOverspend) ? 0 : to_mathint(amount);

// Verifying the outcome matches expectations
assert recipientBalanceAfter == recipientBalanceBefore + expectedDiff;
assert treasuryBalanceAfter == treasuryBalanceBefore - expectedDiff;
assert transfersPaused() == transfersPaused;

```

8. **Rule:** `pauseTransfersIntegrity` - validates that transfers can be paused correctly by the authorized role, ensuring the state is changed as expected.

```solidity
pauseTransfers(e);
assert transfersPaused();

```

9. **Rule:** `unpauseTransfersIntegrity` - confirms that transfers can be unpaused accurately, reverting the paused state and allowing transactions to proceed.

```solidity
unpauseTransfers(e);
assert !transfersPaused();

```

10. **Rule:** `onlyRoleCanCallRevert` - ensures that methods not related to initialization, upgrade, or role management only revert if the caller lacks the necessary roles. This rule safeguards against unauthorized actions while allowing legitimate operations.

```solidity
currentContract.f@withrevert(e,args);

// Verification if the method didn't revert, the caller must possess one of the specified roles.
assert !lastReverted => hasRole(SERVICER_ROLE(),e.msg.sender)
    || hasRole(ADMIN_ROLE(),e.msg.sender)
    || hasRole(DEVOPS_ROLE(),e.msg.sender)
    || hasRole(INITIALIZER_ROLE(),e.msg.sender);

```

11. **Rule:** `onlyRoleCanCallStorage` - verifies that storage modifications by non-view methods are properly guarded by role checks, preventing unauthorized changes to the contract's state. This rule enforces role-based access control for sensitive operations.

```solidity
storage storeBefore = lastStorage;
currentContract.f(e,args);
storage storeAfter = lastStorage;

// Conditionally asserts that if storage was altered, the action must have been performed by an entity with an appropriate role.
assert storeBefore != storeAfter => hasRole(SERVICER_ROLE(),e.msg.sender)
    || hasRole(ADMIN_ROLE(),e.msg.sender)
    || hasRole(DEVOPS_ROLE(),e.msg.sender)
    || hasRole(INITIALIZER_ROLE(),e.msg.sender);

```

### TermRepoServicer.sol

1. **Invariant:** `totalOutstandingRepurchaseExposureIsSumOfRepurchases` - asserts that the total outstanding repurchase exposure is equal to the sum of all individual repurchase exposures, ensuring consistency within the ledger.

```solidity
to_mathint(totalOutstandingRepurchaseExposure()) == sumOfRepurchases
filtered { m ->
    m.selector != sig:initialize(string,uint256,uint256,uint256,uint256,address,address,address,address).selector &&
    m.selector != sig:upgradeToAndCall(address,bytes).selector &&
    m.selector != sig:upgradeTo(address).selector
}

```

2. **Rule:** `onlyAllowedMethodsMayChangeTotalOutstandingRepurchaseExposure` - specifies that only particular methods can increase or decrease the total outstanding repurchase exposure, aligning changes with expected business logic operations.

```solidity
definition canIncreaseTotalOutstandingRepurchaseExposure(method f) returns bool = 
	f.selector == sig:fulfillBid(address,uint256,uint256,address[],uint256[],uint256).selector || 
    f.selector == sig:openExposureOnRolloverNew(address,uint256,uint256,address,uint256).selector ||
    f.selector == sig:mintOpenExposure(uint256,uint256[]).selector;

definition canDecreaseTotalOutstandingRepurchaseExposure(method f) returns bool = 
	f.selector == sig:submitRepurchasePayment(uint256).selector || 
    f.selector == sig:closeExposureOnRolloverExisting(address,uint256).selector ||
    f.selector == sig:liquidatorCoverExposureWithRepoToken(address,address,uint256).selector ||
    f.selector == sig:liquidatorCoverExposure(address,address,uint256).selector ||
    f.selector == sig:burnCollapseExposure(uint256).selector;

uint256 totalOutstandingRepurchaseExposureBefore = totalOutstandingRepurchaseExposure();
f(e, args);
uint256 totalOutstandingRepurchaseExposureAfter = totalOutstandingRepurchaseExposure();

assert totalOutstandingRepurchaseExposureAfter > totalOutstandingRepurchaseExposureBefore => canIncreaseTotalOutstandingRepurchaseExposure(f);
assert totalOutstandingRepurchaseExposureAfter < totalOutstandingRepurchaseExposureBefore => canDecreaseTotalOutstandingRepurchaseExposure(f);

```

3. **Rule:** `totalOutstandingRepurchaseExposureNeverOverflows` - ensures that actions intended to increase the total outstanding repurchase exposure do not result in an overflow, preserving the integrity of financial calculations.

```solidity
uint256 totalOutstandingRepurchaseExposureBefore = totalOutstandingRepurchaseExposure();
f(e, args);
uint256 totalOutstandingRepurchaseExposureAfter = totalOutstandingRepurchaseExposure();

assert totalOutstandingRepurchaseExposureBefore <= totalOutstandingRepurchaseExposureAfter;

```

4. **Rule:** `onlyAllowedMethodsMayChangeTotalRepurchaseCollected` - identifies methods permitted to increase or decrease the total repurchase collected, ensuring that financial metrics reflect actual repurchase activity accurately.

```solidity
definition canIncreaseTotalRepurchaseCollected(method f) returns bool = 
    f.selector == sig:submitRepurchasePayment(uint256).selector || 
    f.selector == sig:closeExposureOnRolloverExisting(address,uint256).selector ||
    f.selector == sig:liquidatorCoverExposure(address,address,uint256).selector;

definition canDecreaseTotalRepurchaseCollected(method f) returns bool = 
    f.selector == sig:redeemTermRepoTokens(address,uint256).selector;

uint256 totalRepurchaseCollectedBefore = totalRepurchaseCollected();
f(e, args);
uint256 totalRepurchaseCollectedAfter = totalRepurchaseCollected();

assert totalRepurchaseCollectedAfter > totalRepurchaseCollectedBefore => canIncreaseTotalRepurchaseCollected(f);
assert totalRepurchaseCollectedAfter < totalRepurchaseCollectedBefore => canDecreaseTotalRepurchaseCollected(f);

```

5. **Rule:** `totalRepurchaseCollectedNeverOverflows` - verifies that the total repurchase collected metric cannot overflow as a result of any operation, maintaining the system's financial stability.

```solidity
uint256 totalRepurchaseCollectedBefore = totalRepurchaseCollected();
f(e, args);
uint256 totalRepurchaseCollectedAfter = totalRepurchaseCollected();

assert totalRepurchaseCollectedBefore <= totalRepurchaseCollectedAfter;

```

6. **Rule:**`shortfallHaircutMantissaAlwaysZeroBeforeRedemptionAndLessThanExpScaleAfter` - confirms the shortfall haircut mantissa remains zero before the redemption timestamp and falls within expected bounds after, ensuring fair and predictable financial adjustments.

```solidity
require(shortfallHaircutMantissa() == 0);

f(e, args);

assert (e.block.timestamp <= redemptionTimestamp()) => (shortfallHaircutMantissa() == 0);
assert (shortfallHaircutMantissa() > 0  && shortfallHaircutMantissa() < 10 ^ 18) => (e.block.timestamp > redemptionTimestamp());

```

7. **Rule:** `totalRepurchaseCollectedLessThanOrEqualToLockerPurchaseTokenBalance` - ensures that the total repurchase collected does not exceed the locker's purchase token balance, preventing overestimation of collected repurchases.

```solidity
require(termRepoLocker() == stateLocker); // bounds for test
require(purchaseToken() == stateToken); // bounds for test
require(totalRepurchaseCollected() <= stateToken.balanceOf(stateLocker)); // starting condition
require(e.msg.sender != stateLocker); // repo locker contract does not have calls to servicer
require(!isTokenCollateral(stateToken)); // token will not be both purchase and collateral token

f(e, args);

assert (totalRepurchaseCollected() <= stateToken.balanceOf(stateLocker));

```

8. **Rule:** `noMethodsChangeMaturityTimestamp` - validates that no method changes the maturity timestamp, ensuring consistency in the term's length and financial obligations.

```solidity
uint256 maturityTimestampBefore = maturityTimestamp();
f(e, args);
uint256 maturityTimestampAfter = maturityTimestamp();

assert maturityTimestampBefore == maturityTimestampAfter;

```

9. **Rule:** `noMethodsChangeEndOfRepurchaseWindow` - confirms the end of the repurchase window is immutable across all contract interactions, preserving the predetermined timeframe for repurchases, which is critical for contractual agreements.

```solidity
uint256 endOfRepurchaseWindowBefore = endOfRepurchaseWindow();
f(e, args);
uint256 endOfRepurchaseWindowAfter = endOfRepurchaseWindow();
assert endOfRepurchaseWindowBefore == endOfRepurchaseWindowAfter;
```

10. **Rule:** `noMethodsChangeRedemptionTimestamp` - ensures the redemption timestamp remains constant across all contract interactions, guaranteeing the redemption period's stability and predictability.

```solidity
uint256 redemptionTimestampBefore = redemptionTimestamp();
f(e, args);
uint256 redemptionTimestampAfter = redemptionTimestamp();
assert redemptionTimestampBefore == redemptionTimestampAfter;

```

11. **Rule:** `noMethodsChangeServicingFee` - verifies that the servicing fee rate is maintained across all transactions, ensuring consistent fee calculations and financial expectations for parties involved.

```solidity
uint256 servicingFeeBefore = servicingFee();
f(e, args);
uint256 servicingFeeAfter = servicingFee();
assert servicingFeeBefore == servicingFeeAfter;

```

12. **Rule:** `onlyAllowedMethodsChangeShortfallHaircutMantissa` - restricts adjustments to the shortfall haircut mantissa to specific authorized methods, safeguarding the metric's integrity against unauthorized modifications.

```solidity
uint256 shortfallHaircutMantissaBefore = shortfallHaircutMantissa();
f(e, args);
uint256 shortfallHaircutMantissaAfter = shortfallHaircutMantissa();
assert shortfallHaircutMantissaBefore == shortfallHaircutMantissaAfter;

```

13. **Rule:** `noMethodChangesPurchaseToken` - confirms the purchase token's address remains unaltered through contract operations, ensuring continuity and reliability in financial mechanisms involving the token.

```solidity
address purchaseTokenBefore = purchaseToken();
f(e, args);
address purchaseTokenAfter = purchaseToken();
assert purchaseTokenBefore == purchaseTokenAfter;

```

14. **Rule:** `onlyAllowedMethodsMayChangeTermContracts` - specifies that term contract addresses can only be modified through designated methods, preventing unauthorized updates and maintaining contract ecosystem integrity.

```solidity
address termRepoCollateralManagerBefore = termRepoCollateralManager();
address termRepoRolloverManagerBefore = termRepoRolloverManager();
address termRepoLockerBefore = termRepoLocker();
address termRepoTokenBefore = termRepoToken();
address termControllerBefore = termControllerAddress();
address emitterBefore = emitterAddress();
f(e, args);
assert termRepoCollateralManager() == termRepoCollateralManagerBefore, "termRepoCollateralManager cannot be changed";
assert termRepoRolloverManager() == termRepoRolloverManagerBefore, "termRepoRolloverManager cannot be changed";
assert termRepoLocker() == termRepoLockerBefore, "termRepoLocker cannot be changed";
assert termRepoToken() == termRepoTokenBefore, "termRepoToken cannot be changed";
assert termControllerAddress() == termControllerBefore, "termController cannot be changed";
assert emitterAddress() == emitterBefore, "emitter cannot be changed";

```

15. **Rule:** `onlyAllowedMethodsMayChangeRepurchaseExposureLedger` - limits the conditions under which the repurchase exposure ledger can be altered, ensuring that changes are strictly governed and reflect actual repurchase activities.

```solidity
uint256 repurchaseExposureLedgerBefore = repurchaseExposureLedger(borrower);
f(e, args);
uint256 repurchaseExposureLedgerAfter = repurchaseExposureLedger(borrower);
assert repurchaseExposureLedgerAfter == repurchaseExposureLedgerBefore, "repurchaseExposureLedger cannot be changed";

```

16. **Rule:** `burnCollapseExposureMonotonicBehavior` - verifies that burning to collapse exposure reduces the caller's repo token balance, their repurchase obligation, and the total outstanding repurchase exposure monotonically, ensuring systemic risk reduction and individual accountability.

```solidity
uint256 collapserRepoTokenBalanceBefore = collapsingRepoToken.balanceOf(e.msg.sender);
uint256 collapserRepoExposureBefore = getBorrowerRepurchaseObligation(e.msg.sender);
uint256 totalOutstandingRepurchaseExposureBefore = totalOutstandingRepurchaseExposure();

burnCollapseExposure(e, amount);

uint256 collapserRepoTokenBalanceAfter = collapsingRepoToken.balanceOf(e.msg.sender);
uint256 collapserRepoExposureAfter = getBorrowerRepurchaseObligation(e.msg.sender);
uint256 totalOutstandingRepurchaseExposureAfter = totalOutstandingRepurchaseExposure();

assert collapserRepoTokenBalanceBefore >= collapserRepoTokenBalanceAfter;
assert collapserRepoExposureBefore >= collapserRepoExposureAfter;
assert totalOutstandingRepurchaseExposureBefore >= totalOutstandingRepurchaseExposureAfter;

```

17. **Rule:** `burnCollapseExposureIntegrity` - ensures that burning for exposure collapse adjusts the repo token balance, repurchase obligation, and total outstanding repurchase exposure by the expected amounts, reflecting accurate and fair financial adjustments.

```solidity
uint256 collapserRepoTokenBalanceBefore = collapsingRepoToken.balanceOf(e.msg.sender);
uint256 collapserRepoExposureBefore = getBorrowerRepurchaseObligation(e.msg.sender);
uint256 totalOutstandingRepurchaseExposureBefore = totalOutstandingRepurchaseExposure();

burnCollapseExposure(e, amount);

uint256 collapserRepoTokenBalanceAfter = collapsingRepoToken.balanceOf(e.msg.sender);
uint256 collapserRepoExposureAfter = getBorrowerRepurchaseObligation(e.msg.sender);
uint256 totalOutstandingRepurchaseExposureAfter = totalOutstandingRepurchaseExposure();

assert collapserRepoTokenBalanceBefore - collapserRepoTokenBalanceAfter == expectedTokenBalanceDecrease;
assert collapserRepoExposureBefore - collapserRepoExposureAfter == expectedObligationDecrease;
assert totalOutstandingRepurchaseExposureBefore - totalOutstandingRepurchaseExposureAfter == expectedExposureDecrease;

```

18. **Rule:** `burnCollapseExposureDoesNotAffectThirdParty` - confirms that an individual's action to burn repo tokens to collapse exposure does not impact the financial positions (token balances or repurchase obligations) of unrelated third parties, maintaining isolation of financial activities.

```solidity
uint256 thirdPartyRepoTokenBalanceBefore = collapsingRepoToken.balanceOf(thirdParty);
uint256 thirdPartyRepoExposureBefore = getBorrowerRepurchaseObligation(thirdParty);

burnCollapseExposure(e, amount);

uint256 thirdPartyRepoTokenBalanceAfter = collapsingRepoToken.balanceOf(thirdParty);
uint256 thirdPartyRepoExposureAfter = getBorrowerRepurchaseObligation(thirdParty);

assert thirdPartyRepoTokenBalanceBefore == thirdPartyRepoTokenBalanceAfter;
assert thirdPartyRepoExposureBefore == thirdPartyRepoExposureAfter;

```

19. **Rule:** `burnCollapseExposureRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool payable = e.msg.value > 0;
    bool zeroAddressSender = e.msg.sender == 0;
    bool pastRepurchaseWindow = e.block.timestamp >= endOfRepurchaseWindow();
    bool zeroBorrowerRepurchaseObligation = getBorrowerRepurchaseObligation(e.msg.sender) == 0;
    bool zeroMaxRepayment = maxRepayment == 0;
    bool servicerNotHaveRepoTokenBurnerRole = !collapsingRepoToken.hasRole(collapsingRepoToken.BURNER_ROLE(), currentContract);
    bool borrowerRepoTokenBalanceTooLow = (collapserRepoTokenBalanceBefore < collapseAmount && repaymentInTokens == collapseAmount) || (collapserRepoTokenBalanceBefore < maxRepaymentInRepoTokens && maxRepaymentInRepoTokens <= collapseAmount);
    bool repoTokenBurningPaused = collapsingRepoToken.burningPaused();
    bool noServicerRoleOnCollateralManager = !collapsingCollateralManager.hasRole(collapsingCollateralManager.SERVICER_ROLE(), currentContract) && maxRepaymentInRepoTokens <= collapseAmount;
    bool collatManagerDoesNotHaveLockerServicerRole = !collapsingLocker.hasRole(collapsingLocker.SERVICER_ROLE(), collapsingCollateralManager) && maxRepaymentInRepoTokens <= collapseAmount && totalCollateral(e.msg.sender) > 0; 
    bool lockerTransfersPaused = collapsingLocker.transfersPaused() && maxRepaymentInRepoTokens <= collapseAmount && totalCollateral(e.msg.sender) > 0; // Only in the case of full repayment
    bool termRepoUnbalanced = (totalOutstandingRepurchaseExposure() - repaymentInPurchaseToken + totalRepurchaseCollected() ) / (10 ^ 4) != (((((collapsingRepoToken.totalSupply() -  repaymentInTokens) * expScale * collapsingRepoToken.redemptionValue()) / expScale ) / expScale) / 10 ^ 4);

    bool isExpectedToRevert = payable || zeroAddressSender || pastRepurchaseWindow  || zeroBorrowerRepurchaseObligation || zeroMaxRepayment || servicerNotHaveRepoTokenBurnerRole || borrowerRepoTokenBalanceTooLow || repoTokenBurningPaused || noServicerRoleOnCollateralManager ||  collatManagerDoesNotHaveLockerServicerRole || lockerTransfersPaused || termRepoUnbalanced ;

    assert lastReverted <=> isExpectedToRevert;
```

20. **Rule:** `mintOpenExposureMonotonicBehavior` - ensures that minting open exposure increases the minter's repo token balance, their repurchase obligation, and the total outstanding repurchase exposure, as well as the minter's collateral balance, indicating correct operation and accountability in minting activities.

```solidity
uint256 minterRepoTokenBalanceBefore = mintingRepoToken.balanceOf(e.msg.sender);
uint256 minterRepoExposureBefore = getBorrowerRepurchaseObligation(e.msg.sender);
uint256 totalOutstandingRepurchaseExposureBefore = totalOutstandingRepurchaseExposure();
uint256 collateralBalanceBefore = mintingCollateralManager.getCollateralBalance(e.msg.sender, collateralTokenAddress);

mintOpenExposure(e, amount, collateralAmounts);

uint256 minterRepoTokenBalanceAfter = mintingRepoToken.balanceOf(e.msg.sender);
uint256 minterRepoExposureAfter = getBorrowerRepurchaseObligation(e.msg.sender);
uint256 totalOutstandingRepurchaseExposureAfter = totalOutstandingRepurchaseExposure();
uint256 collateralBalanceAfter = mintingCollateralManager.getCollateralBalance(e.msg.sender, collateralTokenAddress);

assert minterRepoTokenBalanceBefore <= minterRepoTokenBalanceAfter;
assert minterRepoExposureBefore <= minterRepoExposureAfter;
assert totalOutstandingRepurchaseExposureBefore <= totalOutstandingRepurchaseExposureAfter;
assert collateralBalanceBefore <= collateralBalanceAfter;

```

21. **Rule:** `mintOpenExposureIntegrity` - confirms that minting for open exposure results in expected increases in the minter's repo token balance and repurchase obligation, as well as the total outstanding repurchase exposure, demonstrating the transaction's impact aligns with predefined financial mechanisms.

```solidity
uint256 minterRepoTokenBalanceBefore = mintingRepoToken.balanceOf(e.msg.sender);
uint256 minterRepoExposureBefore = getBorrowerRepurchaseObligation(e.msg.sender);
uint256 totalOutstandingRepurchaseExposureBefore = totalOutstandingRepurchaseExposure();

mintOpenExposure(e, amount, collateralAmounts);

uint256 minterRepoTokenBalanceAfter = mintingRepoToken.balanceOf(e.msg.sender);
uint256 minterRepoExposureAfter = getBorrowerRepurchaseObligation(e.msg.sender);
uint256 totalOutstandingRepurchaseExposureAfter = totalOutstandingRepurchaseExposure();

assert minterRepoTokenBalanceAfter - minterRepoTokenBalanceBefore == expectedIncrease;
assert minterRepoExposureAfter - minterRepoExposureBefore == expectedIncrease;
assert totalOutstandingRepurchaseExposureAfter - totalOutstandingRepurchaseExposureBefore == expectedIncrease;

```

22. **Rule:** `mintOpenExposureDoesNotAffectThirdParty` - verifies that a minter's action to open exposure does not alter the repo token balances of unrelated third parties, ensuring the isolation of minting effects within the financial ecosystem.

```solidity
uint256 thirdPartyBalanceBefore = mintingRepoToken.balanceOf(thirdParty);

mintOpenExposure(e, amount, collateralAmounts);

uint256 thirdPartyBalanceAfter = mintingRepoToken.balanceOf(thirdParty);

assert thirdPartyBalanceBefore == thirdPartyBalanceAfter;

```

23. **Rule:** `mintOpenExposureRevertConditions` - check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
 bool payable = e.msg.value > 0;
    bool callerNotSpecialist = !hasRole(SPECIALIST_ROLE(), e.msg.sender);
    bool noMinterRole = !mintingRepoToken.hasRole(mintingRepoToken.MINTER_ROLE(), currentContract);
    bool noServicerRoleToCollatManager = !mintingCollateralManager.hasRole(mintingCollateralManager.SERVICER_ROLE(), currentContract);
    bool borrowerNotEnoughCollateralBalance = mintingToken.balanceOf(e.msg.sender) < collateralAmounts[0];
    bool lockerTransfersPaused = mintingLocker.transfersPaused();
    bool noLockerServicerAccessForCollatManager = !mintingLocker.hasRole(locker.SERVICER_ROLE(), mintingCollateralManager);
    bool collateralAmountsNotProperLength = assert_uint8(collateralAmounts.length) != mintingCollateralManager.numOfAcceptedCollateralTokens();
    bool afterMaturity = e.block.timestamp > maturityTimestamp();
    bool noServicerRoleOnCollateralManager = !repaymentCollateralManager.hasRole(repaymentCollateralManager.SERVICER_ROLE(), currentContract);

    bool isExpectedToRevert = payable || callerNotSpecialist || noMinterRole || noServicerRoleToCollatManager || borrowerNotEnoughCollateralBalance || lockerTransfersPaused || noLockerServicerAccessForCollatManager || collateralAmountsNotProperLength  || afterMaturity || noServicerRoleOnCollateralManager;

mintOpenExposure@withrevert(e, amount, collateralAmounts);

assert lastReverted <=> isExpectedToRevert;

```

24. **Rule:** `redemptionsMonotonicBehavior` - verifies that redemption operations result in expected changes to the balances and obligations involved, ensuring that the redeemer's repo token balance decreases, their purchase token balance increases, and the overall repurchase obligations and available tokens within the locker adjust accordingly.

```solidity
uint256 redeemerRepoTokenBalanceBefore = repoTokenRedempt.balanceOf(redeemer);
uint256 totalRepurchaseCollectedBefore = totalRepurchaseCollected();
uint256 redeemerPurchaseTokenBalanceBefore = tokenRedempt.balanceOf(redeemer);
uint256 lockerPurchaseTokenBalanceBefore = tokenRedempt.balanceOf(lockerRedempt);

redeemTermRepoTokens(e, redeemer, amount);

uint256 redeemerRepoTokenBalanceAfter = repoTokenRedempt.balanceOf(redeemer);
uint256 totalRepurchaseCollectedAfter = totalRepurchaseCollected();
uint256 redeemerPurchaseTokenBalanceAfter = tokenRedempt.balanceOf(redeemer);
uint256 lockerPurchaseTokenBalanceAfter = tokenRedempt.balanceOf(lockerRedempt);

assert redeemerRepoTokenBalanceBefore >= redeemerRepoTokenBalanceAfter;
assert totalRepurchaseCollectedBefore >= totalRepurchaseCollectedAfter;
assert redeemerPurchaseTokenBalanceBefore <= redeemerPurchaseTokenBalanceAfter;
assert lockerPurchaseTokenBalanceBefore >= lockerPurchaseTokenBalanceAfter;

```

25. **Rule:** `redemptionsIntegrity` - confirms that the redemption of repo tokens by a redeemer leads to the precise adjustments in the total repurchase collected, the repo token balance of the redeemer, and the purchase token balance in accordance with the redemption value and terms defined, reflecting the accurate financial transaction and impact.

```solidity
uint256 redeemerRepoTokenBalanceBefore = repoTokenRedempt.balanceOf(redeemer);
uint256 totalRepurchaseCollectedBefore = totalRepurchaseCollected();
uint256 redeemerPurchaseTokenBalanceBefore = tokenRedempt.balanceOf(redeemer);
uint256 lockerPurchaseTokenBalanceBefore = tokenRedempt.balanceOf(lockerRedempt);

redeemTermRepoTokens(e, redeemer, amount);

uint256 redeemerRepoTokenBalanceAfter = repoTokenRedempt.balanceOf(redeemer);
uint256 totalRepurchaseCollectedAfter = totalRepurchaseCollected();
uint256 redeemerPurchaseTokenBalanceAfter = tokenRedempt.balanceOf(redeemer);
uint256 lockerPurchaseTokenBalanceAfter = tokenRedempt.balanceOf(lockerRedempt);

assert redeemerRepoTokenBalanceBefore - amount == redeemerRepoTokenBalanceAfter;
assert totalRepurchaseCollectedBefore - expectedRedemption == totalRepurchaseCollectedAfter;
assert redeemerPurchaseTokenBalanceAfter - expectedRedemption == redeemerPurchaseTokenBalanceBefore;
assert lockerPurchaseTokenBalanceBefore - expectedRedemption == lockerPurchaseTokenBalanceAfter;

```

26. **Rule:** `redemptionsDoesNotAffectThirdParty` - ensures that a redemption action taken by one participant does not inadvertently alter the financial position or balances of unrelated third parties, maintaining the integrity and isolation of individual transactions within the ecosystem.

```solidity
uint256 thirdPartyRepoTokenBalanceBefore = repoTokenRedempt.balanceOf(thirdParty);
uint256 thirdPartyPurchaseTokenBalanceBefore = tokenRedempt.balanceOf(thirdParty);

redeemTermRepoTokens(e, redeemer, amount);

uint256 thirdPartyRepoTokenBalanceAfter = repoTokenRedempt.balanceOf(thirdParty);
uint256 thirdPartyPurchaseTokenBalanceAfter = tokenRedempt.balanceOf(thirdParty);

assert thirdPartyRepoTokenBalanceBefore == thirdPartyRepoTokenBalanceAfter;
assert thirdPartyPurchaseTokenBalanceBefore == thirdPartyPurchaseTokenBalanceAfter;

```

27. **Rule:** `redemptionsRevertConditions` - evaluates whether the operation correctly reverts under the prescribed conditions, ensuring compliance with defined contractual behaviors and protections.

```solidity
bool payable = e.msg.value > 0;
    bool zeroAddress = redeemer == 0;
    bool beforeRedemption = e.block.timestamp <= redemptionTimestamp();
    bool zeroRepoTokens = repoTokenRedempt.balanceOf(redeemer) == 0;
    bool encumberedCollateralRemaining = collateralManagerRedempt.encumberedCollateralRemaining() && (repoTokenRedempt.totalRedemptionValue() > assert_uint256(totalRepurchaseCollected() + 10 ^ 4));
    bool servicerNotHaveRepoTokenBurnerRole = !repoTokenRedempt.hasRole(repoTokenRedempt.BURNER_ROLE(), currentContract);
    bool repoTokenBurningPaused = repoTokenRedempt.burningPaused();
    bool noServicerAccessToLocker = !lockerRedempt.hasRole(lockerRedempt.SERVICER_ROLE(), currentContract);
    bool lockerTransfersPaused = lockerRedempt.transfersPaused();
    bool notEnoughRepoTokens = repoTokenRedempt.balanceOf(redeemer) < amount; 
    bool termRepoUnbalanced = (termRepoUnbalancedLeftSide) / (10 ^ 4) != (totalRedemptionValueExpected / 10 ^ 4);

    bool isExpectedToRevert = payable || zeroAddress || beforeRedemption || zeroRepoTokens || encumberedCollateralRemaining || servicerNotHaveRepoTokenBurnerRole || repoTokenBurningPaused || lockerTransfersPaused || noServicerAccessToLocker ||  notEnoughRepoTokens || termRepoUnbalanced;

redeemTermRepoTokens@withrevert(e, redeemer, amount);

assert lastReverted <=> isExpectedToRevert;

```

28. **Rule:** `repaymentsMonotonicBehavior` - validates that repayments lead to expected monotonic changes in borrower obligations and system totals, ensuring borrower balances and overall repurchase exposures decrease as payments are made, while the total repurchase collected and potentially the collateral values adjust accordingly.

```solidity
uint256 borrowerBalanceBefore = getBorrowerRepurchaseObligation(borrower);
uint256 totalOutstandingRepurchaseExposureBefore = totalOutstandingRepurchaseExposure();
uint256 totalRepurchaseCollectedBefore = totalRepurchaseCollected();
uint256 borrowerCollateralBefore = totalCollateral(borrower);

submitRepurchasePayment(e, repayment);

uint256 borrowerBalanceAfter = getBorrowerRepurchaseObligation(borrower);
uint256 totalOutstandingRepurchaseExposureAfter = totalOutstandingRepurchaseExposure();
uint256 totalRepurchaseCollectedAfter = totalRepurchaseCollected();
uint256 borrowerCollateralAfter = totalCollateral(borrower);

assert borrowerBalanceBefore >= borrowerBalanceAfter;
assert totalOutstandingRepurchaseExposureBefore >= totalOutstandingRepurchaseExposureAfter;
assert totalRepurchaseCollectedBefore <= totalRepurchaseCollectedAfter;
assert borrowerCollateralAfter <= borrowerCollateralBefore;

```

29. **Rule:** `repaymentsIntegrity` - ensures the integrity of repayments by verifying that the repayments correctly decrease the borrower's obligations and appropriately adjust the system's repurchase exposure and collected totals, with specific attention to the treatment of collateral in the event of complete repayment.

```solidity
uint256 borrowerBalanceBefore = getBorrowerRepurchaseObligation(borrower);
uint256 totalOutstandingRepurchaseExposureBefore = totalOutstandingRepurchaseExposure();
uint256 totalRepurchaseCollectedBefore = totalRepurchaseCollected();

submitRepurchasePayment(e, repayment);

uint256 borrowerBalanceAfter = getBorrowerRepurchaseObligation(borrower);
uint256 totalOutstandingRepurchaseExposureAfter = totalOutstandingRepurchaseExposure();
uint256 totalRepurchaseCollectedAfter = totalRepurchaseCollected();

assert borrowerBalanceBefore - repayment == borrowerBalanceAfter;
assert totalOutstandingRepurchaseExposureBefore - repayment == totalOutstandingRepurchaseExposureAfter;
assert totalRepurchaseCollectedBefore + repayment == totalRepurchaseCollectedAfter;
assert borrowerBalanceAfter == 0 ? totalCollateral(borrower) == 0 : totalCollateral(borrower) remains unchanged;

```

30. **Rule:** `repaymentsDoesNotAffectThirdParty` - confirms that a borrower's repayment activity does not inadvertently affect the financial obligations or collateral standings of any unrelated third parties, preserving the isolation and accuracy of individual account statuses within the system.

```solidity
uint256 thirdPartyObligationBefore = getBorrowerRepurchaseObligation(thirdParty);

submitRepurchasePayment(e, repayment);

uint256 thirdPartyObligationAfter = getBorrowerRepurchaseObligation(thirdParty);

assert thirdPartyObligationBefore == thirdPartyObligationAfter;

```

31. **Rule:** `repaymentsRevertingConditions` - check if the operation correctly reverts under specified conditions, ensuring adherence to defined contractual behaviors and safeguards.

```solidity
bool payable = e.msg.value > 0;
    bool lockerTransfersPaused = locker.transfersPaused();
    bool noLockerServicerAccess = !locker.hasRole(locker.SERVICER_ROLE(), currentContract);
    bool allowanceTooLow = token.allowance( borrower, termRepoLocker()) < repayment;
    bool borrowTokenBalanceTooLow = token.balanceOf(borrower) < repayment;
    bool afterRepurchaseWindow = e.block.timestamp >= endOfRepurchaseWindow();
    bool borrowerZeroObligation = getBorrowerRepurchaseObligation(borrower) == 0;
    bool uintMaxRepayment = repayment == max_uint256;
    bool repaymentGreaterThanMax = repaymentAmount > maxRepayment;
    bool noServicerRoleOnCollateralManager = !repaymentCollateralManager.hasRole(repaymentCollateralManager.SERVICER_ROLE(), currentContract);

    bool isExpectedToRevert = payable || lockerTransfersPaused || noLockerServicerAccess || borrowTokenBalanceTooLow || allowanceTooLow || afterRepurchaseWindow || borrowerZeroObligation || uintMaxRepayment || repaymentGreaterThanMax || noServicerRoleOnCollateralManager;

submitRepurchasePayment@withrevert(e, repayment);

assert lastReverted <=> isExpectedToRevert;

```

32. **Rule:** `liquidatorCoverExposureIntegrity` - validates the integrity of a liquidation process where a liquidator covers the exposure of a borrower using purchase tokens. It checks that balances and obligations adjust correctly, reflecting the liquidation payment in system totals and individual accounts.

```solidity
uint256 borrowerObligationBefore = getBorrowerRepurchaseObligation(borrower);
uint256 totalOutstandingBefore = totalOutstandingRepurchaseExposure();
uint256 totalCollectedBefore = totalRepurchaseCollected();
uint256 liquidatorBalanceBefore = liquidationRepaymentExposureToken.balanceOf(liquidator);
uint256 lockerBalanceBefore = liquidationRepaymentExposureToken.balanceOf(termRepoLocker());

liquidatorCoverExposure(e, borrower, liquidator, amountToCover);

uint256 borrowerObligationAfter = getBorrowerRepurchaseObligation(borrower);
uint256 totalOutstandingAfter = totalOutstandingRepurchaseExposure();
uint256 totalCollectedAfter = totalRepurchaseCollected();
uint256 liquidatorBalanceAfter = liquidationRepaymentExposureToken.balanceOf(liquidator);
uint256 lockerBalanceAfter = liquidationRepaymentExposureToken.balanceOf(termRepoLocker());

assert borrowerObligationBefore - borrowerObligationAfter == amountToCover;
assert totalOutstandingBefore - totalOutstandingAfter == amountToCover;
assert totalCollectedAfter - totalCollectedBefore == amountToCover;
assert liquidatorBalanceBefore - liquidatorBalanceAfter == amountToCover;
assert lockerBalanceAfter - lockerBalanceBefore == amountToCover;

```

33. **Rule:** `liquidatorCoverExposureDoesNotAffectThirdParty` - ensures that the liquidation process does not inadvertently impact the financial status or obligations of any third parties, maintaining the precision and isolation of account transactions within the system.

```solidity
uint256 thirdPartyObligationBefore = getBorrowerRepurchaseObligation(thirdParty);
uint256 thirdPartyBalanceBefore = liquidationRepaymentExposureToken.balanceOf(thirdParty);

liquidatorCoverExposure(e, borrower, liquidator, amountToCover);

uint256 thirdPartyObligationAfter = getBorrowerRepurchaseObligation(thirdParty);
uint256 thirdPartyBalanceAfter = liquidationRepaymentExposureToken.balanceOf(thirdParty);

assert thirdPartyObligationBefore == thirdPartyObligationAfter;
assert thirdPartyBalanceBefore == thirdPartyBalanceAfter;

```

34. **Rule:** `liquidatorCoverExposureRevertConditions` - evaluate if the transaction reverts as expected under identified conditions, ensuring compliance with system rules and safeguards.

```solidity
bool payable = e.msg.value > 0;
    bool callerNotCollateralManager = !hasRole(COLLATERAL_MANAGER(), e.msg.sender);
    bool servicerDoesNotHaveLockerServicerRole = !liquidationRepaymentExposureLocker.hasRole(liquidationRepaymentExposureLocker.SERVICER_ROLE(), currentContract);
    bool lockerTransfersPaused = liquidationRepaymentExposureLocker.transfersPaused();
    bool allowanceTooLow = liquidationRepaymentExposureToken.allowance( liquidator, termRepoLocker()) < amountToCover;
    bool liquidatorTokenBalanceTooLow = liquidationRepaymentExposureToken.balanceOf(liquidator) < amountToCover;
    bool borrowBalancecLowerThanCoverAmount = getBorrowerRepurchaseObligation(borrower) < amountToCover;

    bool isExpectedToRevert = payable || callerNotCollateralManager || servicerDoesNotHaveLockerServicerRole  || lockerTransfersPaused || liquidatorTokenBalanceTooLow || allowanceTooLow || borrowBalancecLowerThanCoverAmount ;

liquidatorCoverExposure@withrevert(e, borrower, liquidator, amountToCover);

assert lastReverted <=> isExpectedToRevert;

```

35. **Rule:** `liquidatorCoverExposureWithRepoTokenIntegrity` - examines the proper functioning of liquidation via repo tokens, verifying that such transactions correctly reduce borrower obligations and adjust system and participant balances in accordance with the repo tokens used in the liquidation.

```solidity
uint256 borrowerObligationBefore = getBorrowerRepurchaseObligation(borrower);
uint256 totalOutstandingBefore = totalOutstandingRepurchaseExposure();
uint256 liquidatorRepoBalanceBefore = liquidationRepaymentExposureRepoToken.balanceOf(liquidator);
uint256 repoTotalSupplyBefore = liquidationRepaymentExposureRepoToken.totalSupply();

liquidatorCoverExposureWithRepoToken(e, borrower, liquidator, amountOfRepoToken);

uint256 borrowerObligationAfter = getBorrowerRepurchaseObligation(borrower);
uint256 totalOutstandingAfter = totalOutstandingRepurchaseExposure();
uint256 liquidatorRepoBalanceAfter = liquidationRepaymentExposureRepoToken.balanceOf(liquidator);
uint256 repoTotalSupplyAfter = liquidationRepaymentExposureRepoToken.totalSupply();

assert borrowerObligationBefore - borrowerObligationAfter == calculatedAmountCovered;
assert totalOutstandingBefore - totalOutstandingAfter == calculatedAmountCovered;
assert liquidatorRepoBalanceBefore - liquidatorRepoBalanceAfter == amountOfRepoToken;
assert repoTotalSupplyBefore - repoTotalSupplyAfter == amountOfRepoToken;

```

36. **Rule:** `liquidatorCoverExposureWithRepoTokenRevertConditions` - define conditions that would lead to a transaction revert; aggregate revert conditions to determine expectation; eliquidation attempt with potential revert and validate against expected outcome; ensure actual revert aligns with expectations based on identified conditions.

```solidity

bool payable = e.msg.value > 0;
bool callerNotCollateralManager = !hasRole(COLLATERAL_MANAGER(), e.msg.sender);
bool liquidatorIsAddressZero = liquidator == 0;
bool servicerNotHaveRepoTokenBurnerRole = !liquidationRepaymentExposureRepoToken.hasRole(liquidationRepaymentExposureRepoToken.BURNER_ROLE(), currentContract);
bool liquidatorTokenBalanceTooLow = liquidationRepaymentExposureRepoToken.balanceOf(liquidator) < amountOfRepoToken;
bool repoTokenBurningPaused = liquidationRepaymentExposureRepoToken.burningPaused();
bool termPoolBalanceThresholdBreached = ((totalOutstandingRepurchaseExposure() - amountToCover + totalRepurchaseCollected()) / 10^4) != (((((liquidationRepaymentExposureRepoToken.totalSupply() - amountOfRepoToken) * expScale * liquidationRepaymentExposureRepoToken.redemptionValue()) / expScale) / expScale) / 10^4);
bool borrowBalanceLowerThanCoverAmount = borrowerObligationBefore < amountToCover;

// Aggregate revert conditions to determine expectation
isExpectedToRevert = payable || callerNotCollateralManager || liquidatorIsAddressZero || servicerNotHaveRepoTokenBurnerRole || liquidatorTokenBalanceTooLow || repoTokenBurningPaused || termPoolBalanceThresholdBreached || borrowBalanceLowerThanCoverAmount;

// Execute liquidation attempt with potential revert and validate against expected outcome
liquidatorCoverExposureWithRepoToken@withrevert(e, borrower, liquidator, amountOfRepoToken);
assert lastReverted <=> isExpectedToRevert; // Ensure actual revert aligns with expectations based on identified conditions

```

37. **Rule:** `openExposureOnRolloverNewIntegrity` - ensures that all relevant balances properly accounted for after opening a repoExposure on account of a successful rollover.

```solidity
assert balanceAfter == balanceBefore + repurchasePrice;
    assert totalOutstandingRepurchaseExposureAfter == totalOutstandingRepurchaseExposureBefore + repurchasePrice;
    assert tokenBalanceTermRepoLockerAfter + purchasePrice == tokenBalanceTermRepoLockerBefore;
    assert tokenBalancePreviousTermRepoLockerAfter == tokenBalancePreviousTermRepoLockerBefore + previousRepoLockerRepayment;
    assert  tokenBalanceTreasuryAfter == tokenBalanceTreasuryBefore + protocolShare;
```

38. **Rule:** `openExposureOnRolloverNewDoesNotAffectThirdParty` - verifies that rolling over loan exposures from one account does not affect third-party balances.

```solidity
mathint balanceBefore = getBorrowerRepurchaseObligation(borrower2);

    openExposureOnRolloverNew(e, borrower, purchasePrice, repurchasePrice, previousTermRepoLocker, dayCountFractionMantissa);

    mathint balanceAfter = getBorrowerRepurchaseObligation(borrower2);

    assert balanceAfter == balanceBefore;
```

39. **Rule:** `openExposureOnRolloverNewRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool payable = e.msg.value > 0;
    bool callerNotAuctioneer = !hasRole(AUCTIONEER(), e.msg.sender);
    bool afterMaturity = e.block.timestamp >= maturityTimestamp();
    bool lockerTransfersPaused = rolloverExposureLocker.transfersPaused();
    bool servicerNoLockerAccess = !rolloverExposureLocker.hasRole(rolloverExposureLocker.SERVICER_ROLE(), currentContract);

    bool lockerTokenBalanceTooLow = rolloverExposureToken.balanceOf(rolloverExposureLocker) < purchasePrice;

    bool isExpectedToRevert = payable ||   callerNotAuctioneer || afterMaturity || lockerTransfersPaused  || servicerNoLockerAccess  || lockerTokenBalanceTooLow;

    openExposureOnRolloverNew@withrevert(e, borrower, purchasePrice, repurchasePrice, previousTermRepoLocker, dayCountFractionMantissa);

    
    assert lastReverted <=> isExpectedToRevert;
```

40. **Rule:** `closeExposureOnRolloverExistingIntegrity` - ensures that all relevant balances properly accounted for after closing a repoExposure on account of a successful rollover.

```solidity
assert balanceBefore == balanceAfter + actualRolloverSettlementAmount;
    assert totalOutstandingRepurchaseExposureBefore == totalOutstandingRepurchaseExposureAfter + actualRolloverSettlementAmount;
    assert amountCollectedAfter == amountCollectedBefore + actualRolloverSettlementAmount;
    assert rolloverExposureRolloverManager.getRolloverInstructions(borrower).processed;
```

41. **Rule:** `closeExposureOnRolloverExistingDoesNotAffectThirdParty` - verifies that rolling over loan exposures from one account does not affect third-party balances.

```solidity
    mathint balanceBefore = getBorrowerRepurchaseObligation(borrower2);

    closeExposureOnRolloverExisting(e, borrower, rolloverSettlementAmount);

    mathint balanceAfter = getBorrowerRepurchaseObligation(borrower2);

    assert balanceBefore == balanceAfter;
```

42. **Rule:** `closeExposureOnRolloverExistingRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity

    bool payable = e.msg.value > 0;
    bool callerNotRolloverTargetAuctioneer = !hasRole(ROLLOVER_TARGET_AUCTIONEER_ROLE(), e.msg.sender);
    bool beforeMaturity = e.block.timestamp < maturityTimestamp();
    bool afterRepurchaseWindow = e.block.timestamp >= endOfRepurchaseWindow();
    bool servicerDoesNotHaveRolloverFulfillerRole = !rolloverExposureRolloverManager.hasRole(rolloverExposureRolloverManager.ROLLOVER_BID_FULFILLER_ROLE(), currentContract);

    bool isExpectedToRevert = payable ||   callerNotRolloverTargetAuctioneer || beforeMaturity || afterRepurchaseWindow || servicerDoesNotHaveRolloverFulfillerRole;

    closeExposureOnRolloverExisting@withrevert(e, borrower, rolloverSettlementAmount);
    
    assert lastReverted <=> isExpectedToRevert;
```

43. **Rule:** `fulfillOfferIntegrity` - ensures repoTokens are properly minted to a user's address when their offer is fulfilled.

```solidity
assert offerorRepoTokenBalanceAfter == offerorRepoTokenBalanceBefore + tokensMinted,
```

44. **Rule:** `fulfillBidIntegrity` - check that the bidder's token balance has decreased and protocol's token balance has increased after `fulfillBid`.

```solidity
    // Check that the bidder's token balance has decreased.
    assert bidderTokenBalanceAfter == bidderTokenBalanceBefore + (to_mathint(purchasePrice) - protocolShare)

    // Check that the protocol's token balance has increased.
    assert protocolTokenBalanceAfter == protocolTokenBalanceBefore + protocolShare
```

45. **Rule:** `fulfillOfferRevertsIfNotValid` - ensure that `fulfillOffer` reverts if not valid.

```solidity
bool notAuctioneer = !hasRole(AUCTIONEER(), e.msg.sender);
    bool servicerNotMinterRole = !repoTokenFulfill.hasRole(repoTokenFulfill.MINTER_ROLE(), currentContract);
    bool msgHasValue = e.msg.value != 0;
    bool divByZero = repoTokenFulfill.redemptionValue() == 0;
    bool overflow = (repurchasePrice * 10 ^ 36) > 2^256
        || ((repoTokenFulfill.redemptionValue() > 0) && (repoTokenFulfill.totalSupply() + (repurchasePrice * 10^18) / repoTokenFulfill.redemptionValue()) >= 2^256);
    bool mintingPaused = repoTokenFulfill.mintingPaused();
    bool zeroAddress = offeror == 0;
    fulfillOffer@withrevert(e, offeror, purchasePrice, repurchasePrice, offerId);
    assert lastReverted == (
        notAuctioneer ||
        msgHasValue ||
        divByZero ||
        servicerNotMinterRole ||
        overflow ||
        mintingPaused ||
        zeroAddress
    ), "fulfillOffer should revert if not valid";
```

46. **Rule:** `fulfillBidRevertsIfNotValid` - ensure that `fulfillBid` reverts if not valid.

```solidity
bool notAuctioneer = !hasRole(AUCTIONEER(), e.msg.sender);
    bool servicerNotServicerRole = !collateralManagerFulfill.hasRole(collateralManagerFulfill.SERVICER_ROLE(), currentContract)
        || !lockerFulfill.hasRole(lockerFulfill.SERVICER_ROLE(), currentContract);
    bool afterMaturity = e.block.timestamp >= maturityTimestamp();
    bool msgHasValue = e.msg.value != 0;
    bool overflowRepurchaseExposureLedger = getBorrowerRepurchaseObligation(bidder) + repurchasePrice >= 2^256;
    bool overflowTotalOutstandingRepurchaseExposure = totalOutstandingRepurchaseExposure() + repurchasePrice >= 2^256;
    bool overflowLockedCollateralLedger0 = collateralManagerFulfill.harnessLockedCollateralLedger(bidder, collateralTokens[0]) + collateralAmounts[0] >= 2^256;
    bool overflowEncumberedCollateralBalance0 = collateralManagerFulfill.encumberedCollateralBalance(collateralTokens[0]) + collateralAmounts[0] >= 2^256;
    mathint dcfServicingFee = dayCountFractionMantissa * servicingFee();
    bool overflowDcfServicingFee = dcfServicingFee >= 2^256;
    mathint dcfServicingFeePrice = (dcfServicingFee / 10^18) * purchasePrice;
    bool overflowDcfServicingFeePrice = dcfServicingFeePrice >= 2^256;
    mathint protocolShare = dcfServicingFeePrice / 10^18;
    bool insufficientBalance = tokenFulfill.balanceOf(lockerFulfill) < purchasePrice;
    bool purchasePriceLessThanProtocolShare = to_mathint(purchasePrice) < protocolShare;
    bool transfersPaused = lockerFulfill.transfersPaused();
    bool overflowTreasuryBalance = tokenFulfill.balanceOf(100) + protocolShare >= 2^256;
    bool overflowBidderBalance = tokenFulfill.balanceOf(bidder) + purchasePrice - protocolShare >= 2^256;
    fulfillBid@withrevert(e, bidder, purchasePrice, repurchasePrice, collateralTokens, collateralAmounts, dayCountFractionMantissa);
    assert lastReverted == (
        notAuctioneer ||
        afterMaturity ||
        msgHasValue ||
        servicerNotServicerRole ||
        overflowRepurchaseExposureLedger ||
        overflowTotalOutstandingRepurchaseExposure ||
        overflowLockedCollateralLedger0 ||
        overflowEncumberedCollateralBalance0 ||
        overflowDcfServicingFee ||
        overflowDcfServicingFeePrice ||
        purchasePriceLessThanProtocolShare ||
        transfersPaused ||
        overflowBidderBalance ||
        overflowTreasuryBalance ||
        overflowBidderBalance ||
        insufficientBalance
    ), "fulfillBid should revert if not valid";
```

47. **Rule:** `fulfillOfferDoesNotAffectThirdParty` - verifies that fulfilling an offer belonging to one account does not affect the third party balances.

```solidity
assert thirdPartyRepoTokenBalanceBefore == thirdPartyRepoTokenBalanceAfter
```

48. **Rule:** `fulfillBidDoesNotAffectThirdParty` - verifies that fulfilling a bid belonging to from one account does not affect the third party balances.

```solidity
    assert thirdPartyTokenBalanceBefore == thirdPartyTokenBalanceAfter
```

49. **Rule:** `lockOfferAmountIntegrity` - ensures purchase tokens are properly deducted from a user's address when they lock an offer.

```solidity
assert offerorPurchaseTokenBalanceAfter == offerorPurchaseTokenBalanceBefore - to_mathint(amount)

```

50. **Rule:** `unlockOfferAmountIntegrity` - ensures purchase tokens are properly transferred to a user's address when they unlock an offer.

```solidity
assert offerorPurchaseTokenBalanceAfter == offerorPurchaseTokenBalanceBefore + to_mathint(amount)
```

51. **Rule:** `lockOfferAmountDoesNotAffectThirdParty` - verifies that locking an offer belonging to one account does not affect the third party balances.

```solidity
assert thirdPartyPurchaseTokenBalanceBefore == thirdPartyPurchaseTokenBalanceAfter
```

52. **Rule:** `unlockOfferAmountDoesNotAffectThirdParty` - verifies that unlocking an offer belonging to one account does not affect the third party balances..

```solidity
assert thirdPartyPurchaseTokenBalanceBefore == thirdPartyPurchaseTokenBalanceAfter
```

53. **Rule:** `lockOfferAmountRevertsWhenInvalid` - ensure that locking offers reverts if not valid

```solidity
    bool includesValue = e.msg.value > 0;
    bool isAuctionLocker = hasRole(AUCTION_LOCKER(), e.msg.sender);
    bool servicerNotServicerRole = !lockerLocking.hasRole(lockerLocking.SERVICER_ROLE(), currentContract);
    bool isLockerPaused = lockerLocking.transfersPaused();
    bool insufficientBalance = purchaseTokenLocking.balanceOf(offeror) < amount;
    bool insufficientAllowance = purchaseTokenLocking.allowance(offeror, lockerLocking) < amount;
    bool overflow = amount + purchaseTokenLocking.balanceOf(lockerLocking) > 2 ^ 256 - 1 && amount > 0;

    lockOfferAmount@withrevert(e, offeror, amount);

assert (
    !isAuctionLocker ||
    includesValue ||
    isLockerPaused ||
    servicerNotServicerRole ||
    insufficientBalance ||
    insufficientAllowance ||
    overflow
) == lastReverted
```

54. **Rule:** `unlockOfferAmountRevertsWhenInvalid` - ensure that unlocking offers reverts if not valid

```solidity
 bool includesValue = e.msg.value > 0;
    bool isAuctionLocker = hasRole(AUCTION_LOCKER(), e.msg.sender);
    bool servicerNotServicerRole = !lockerLocking.hasRole(lockerLocking.SERVICER_ROLE(), currentContract);
    bool isLockerPaused = lockerLocking.transfersPaused();
    bool insufficientBalance = purchaseTokenLocking.balanceOf(lockerLocking) < amount;
    bool overflow = amount + purchaseTokenLocking.balanceOf(offeror) > 2 ^ 256 - 1 && amount > 0;

    unlockOfferAmount@withrevert(e, offeror, amount);
assert (
    !isAuctionLocker ||
    includesValue ||
    isLockerPaused ||
    servicerNotServicerRole ||
    insufficientBalance ||
    overflow
) == lastReverted
```

55. **Rule:** `onlyRoleCanCallRevert` - checks if a method call requires specific roles to execute successfully, does not revert if the caller has the necessary role.

```solidity
assert !lastReverted =>
    hasRole(ADMIN_ROLE(),e.msg.sender)
    || hasRole(AUCTION_LOCKER(),e.msg.sender)
    || hasRole(AUCTIONEER(),e.msg.sender)
    || hasRole(COLLATERAL_MANAGER(),e.msg.sender)
    || hasRole(DEVOPS_ROLE(),e.msg.sender)
    || hasRole(SPECIALIST_ROLE(),e.msg.sender)
    || hasRole(ROLLOVER_MANAGER(),e.msg.sender)
    || hasRole(ROLLOVER_TARGET_AUCTIONEER_ROLE(),e.msg.sender)
    || hasRole(INITIALIZER_ROLE(),e.msg.sender);
```

56. **Rule:** `onlyRoleCanCallStorage` - ensures that changes to storage by non-view method calls can only be performed by addresses with specific roles, guarding against unauthorized modifications.

```solidity
assert storeBefore != storeAfter => hasRole(ADMIN_ROLE(),e.msg.sender)
    || hasRole(AUCTION_LOCKER(),e.msg.sender)
    || hasRole(AUCTIONEER(),e.msg.sender)
    || hasRole(COLLATERAL_MANAGER(),e.msg.sender)
    || hasRole(DEVOPS_ROLE(),e.msg.sender)
    || hasRole(SPECIALIST_ROLE(),e.msg.sender)
    || hasRole(ROLLOVER_MANAGER(),e.msg.sender)
    || hasRole(ROLLOVER_TARGET_AUCTIONEER_ROLE(),e.msg.sender)
    || hasRole(INITIALIZER_ROLE(),e.msg.sender);
```

### TermRepoCollateralManager.sol

1. **Rule:** `auctionLockCollateralIntegrity` - ensures that all relevant balances are properly reflected on account of locking collateral when calling `auctionLockCollateral`

```solidity
assert bidderCollateralBalanceAfter == bidderCollateralBalanceBefore;
assert encumberedCollateralBalanceAfter == encumberedCollateralBalanceBefore;
assert bidderCollateralTokenBalanceAfter + amount == bidderCollateralTokenBalanceBefore;
assert lockerCollateralBalanceBefore + amount == lockerCollateralBalanceAfter;
```

2. **Rule:** `auctionLockCollateralThirdParty` - verifies that locking collateral belonging to one account when calling `lockBid` does not affect the third party balances

```solidity
assert thirdPartyBidderCollateralBalanceAfter == thirdPartyBidderCollateralBalanceBefore;
assert thirdPartyBidderCollateralTokenBalanceAfter == thirdPartyBidderCollateralTokenBalanceBefore;
```

3. **Rule:** `auctionLockCollateralRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool payable = e.msg.value > 0;
    bool lockerTransfersPaused = lockingCollateralLocker.transfersPaused();
    bool lockerNotPaired = !lockingCollateralLocker.hasRole(lockingCollateralLocker.SERVICER_ROLE(), currentContract);
    bool allowanceTooLow = lockingCollateralToken.allowance( bidder, termRepoLocker()) < amount;
    bool borrowTokenBalanceTooLow = lockingCollateralToken.balanceOf(bidder) < amount;
    bool notAuctionLocker = !hasRole(AUCTION_LOCKER(), e.msg.sender);

    bool isExpectedToRevert = payable || lockerTransfersPaused || lockerNotPaired ||  borrowTokenBalanceTooLow || allowanceTooLow || notAuctionLocker;

    auctionLockCollateral@withrevert(e, bidder, lockingCollateralToken, amount);

assert lastReverted <=> isExpectedToRevert;
```

4. **Rule:** `auctionUnlockCollateralIntegrity` - ensures that all relevant balances are properly reflected on account of locking collateral when calling `auctionUnlockCollateral`

```solidity
assert bidderCollateralBalanceAfter == bidderCollateralBalanceBefore;
assert encumberedCollateralBalanceAfter == encumberedCollateralBalanceBefore;
assert bidderCollateralTokenBalanceAfter == bidderCollateralTokenBalanceBefore + amount;
assert lockerCollateralBalanceBefore == lockerCollateralBalanceAfter + amount;

```

5. **Rule:** `auctionUnlockCollateralThirdParty` - verifies that unlocking collateral belonging to one account when calling `auctionUnlockCollateral` does not affect the third party balances

```solidity
assert thirdPartyBidderCollateralBalanceAfter == thirdPartyBidderCollateralBalanceBefore;
assert thirdPartyBidderCollateralTokenBalanceAfter == thirdPartyBidderCollateralTokenBalanceBefore;

```

6. **Rule:** `auctionUnlockCollateralRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity

bool payable = e.msg.value > 0;
    bool lockerTransfersPaused = lockingCollateralLocker.transfersPaused();
    bool lockerNotPaired = !lockingCollateralLocker.hasRole(lockingCollateralLocker.SERVICER_ROLE(), currentContract);
    bool lockerTokenBalanceTooLow = lockingCollateralToken.balanceOf(lockingCollateralLocker) < amount;
    bool notAuctionLocker = !hasRole(AUCTION_LOCKER(), e.msg.sender);

    bool isExpectedToRevert = payable || lockerTransfersPaused || lockerNotPaired ||  lockerTokenBalanceTooLow || notAuctionLocker;

    auctionUnlockCollateral@withrevert(e, bidder, lockingCollateralToken, amount);
assert lastReverted <=> isExpectedToRevert;
```

7. **Rule:** `journalBidCollateralToCollateralManagerIntegrity` - ensures that all relevant balances are properly reflected on account of locking collateral when fulfilling a bid.

```solidity
assert bidderCollateralBalanceAfter == require_uint256(bidderCollateralBalanceBefore + amount);
assert encumberedCollateralBalanceAfter == encumberedCollateralBalanceBefore + amount;
assert bidderCollateralTokenBalanceAfter == bidderCollateralTokenBalanceBefore;
assert lockerCollateralBalanceBefore == lockerCollateralBalanceAfter;
```

8. **Rule:** `journalBidCollateralToCollateralManagerThirdParty` - verifies that journaling collateral to the `lockedCollateralLedger` when fulfilling a bid belonging to one account does not affect the third party balances.

```solidity
assert bidderCollateralBalanceAfter == bidderCollateralBalanceBefore;
assert bidderCollateralTokenBalanceAfter == bidderCollateralTokenBalanceBefore;
```

9. **Rule:** `journalBidCollateralToCollateralManagerRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool payable = e.msg.value > 0;
bool notServicerRole = !hasRole(SERVICER_ROLE(), e.msg.sender);

bool isExpectedToRevert = payable ||  notServicerRole;
assert lastReverted <=> isExpectedToRevert;
```

10. **Rule:** `externalLockCollateralIntegrity` - ensures that all relevant balances are properly reflected on account of locking collateral when calling `externalLockCollateral`.

```solidity
assert borrowerCollateralBalanceAfter == borrowerCollateralBalanceBefore + amount;
assert encumberedCollateralBalanceAfter == encumberedCollateralBalanceBefore + amount;
assert borrowerCollateralTokenBalanceAfter + amount == borrowerCollateralTokenBalanceBefore;
assert lockerCollateralBalanceBefore + amount == lockerCollateralBalanceAfter;

```

11. **Rule:** `externalLockCollateralThirdParty` - verifies that locking collateral belonging to one account when calling `externalLockCollateral` does not affect the third party balances

```solidity
assert thirdPartyBorrowerCollateralBalanceAfter == thirdPartyBorrowerCollateralBalanceBefore;
assert thirdPartyBorrowerCollateralTokenBalanceAfter == thirdPartyBorrowerCollateralTokenBalanceBefore;

```

12. **Rule:** `externalLockCollateralRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool payable = e.msg.value > 0;
    bool isNotCollateralToken = !isTokenCollateral(extLockingCollateralToken);
    bool collateralDepositClosed = e.block.timestamp > extLockingRepoServicer.endOfRepurchaseWindow();
    bool zeroBorrowerRepurchaseObligation = extLockingRepoServicer.getBorrowerRepurchaseObligation(e.msg.sender) == 0;
    bool lockerTransfersPaused = extLockingCollateralLocker.transfersPaused();
    bool lockerNotPaired = !extLockingCollateralLocker.hasRole(extLockingCollateralLocker.SERVICER_ROLE(), currentContract);
    bool allowanceTooLow = extLockingCollateralToken.allowance( e.msg.sender, termRepoLocker()) < amount;
    bool borrowTokenBalanceTooLow = extLockingCollateralToken.balanceOf(e.msg.sender) < amount;

    bool isExpectedToRevert = payable || isNotCollateralToken || collateralDepositClosed || zeroBorrowerRepurchaseObligation || lockerTransfersPaused || lockerNotPaired ||  borrowTokenBalanceTooLow || allowanceTooLow ;

    externalLockCollateral@withrevert(e, extLockingCollateralToken, amount);
```

13. **Rule:** `externalUnlockCollateralIntegrity` - ensures that all relevant balances are properly reflected on account of locking collateral when calling `externalUnlockCollateral`.

```solidity
assert borrowerCollateralBalanceAfter + amount == borrowerCollateralBalanceBefore;
assert (extLockingRepoServicer.getBorrowerRepurchaseObligation(e.msg.sender) != 0) => encumberedCollateralBalanceAfter + amount  == encumberedCollateralBalanceBefore;
assert (extLockingRepoServicer.getBorrowerRepurchaseObligation(e.msg.sender) == 0) => encumberedCollateralBalanceAfter == encumberedCollateralBalanceBefore;
assert borrowerCollateralTokenBalanceAfter == borrowerCollateralTokenBalanceBefore + amount;
assert lockerCollateralBalanceBefore == lockerCollateralBalanceAfter + amount;

```

14. **Rule:** `externalUnlockCollateralThirdParty` - verifies that unlocking collateral belonging to one account when calling `externalUnlockCollateral`does not affect the third party balances

```solidity
assert thirdPartyBorrowerCollateralBalanceAfter == thirdPartyBorrowerCollateralBalanceBefore;
assert thirdPartyBorrowerCollateralTokenBalanceAfter == thirdPartyBorrowerCollateralTokenBalanceBefore;

```

15. **Rule:** `externalUnlockCollateralRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool payable = e.msg.value > 0;
    bool zeroAmount = amount == 0;
    bool isNotCollateralToken = !isTokenCollateral(extLockingCollateralToken);
    bool borrowerEndsUpInShortfall = willBorrowerBeInShortfall(e.msg.sender,0,extLockingCollateralToken,amount); 
    bool collateralDepositClosed = e.block.timestamp >= extLockingRepoServicer.endOfRepurchaseWindow() && e.block.timestamp < extLockingRepoServicer.redemptionTimestamp();
    bool zeroBorrowerCollateralBalance = getCollateralBalance(e.msg.sender, extLockingCollateralToken) == 0;
    bool notEnoughCollateralToUnlock = getCollateralBalance(e.msg.sender, extLockingCollateralToken) < amount;
    bool lockerTransfersPaused = extLockingCollateralLocker.transfersPaused();
    bool lockerNotPaired = !extLockingCollateralLocker.hasRole(extLockingCollateralLocker.SERVICER_ROLE(), currentContract);

    bool isExpectedToRevert = payable || zeroAmount || isNotCollateralToken || borrowerEndsUpInShortfall || collateralDepositClosed || zeroBorrowerCollateralBalance || notEnoughCollateralToUnlock || lockerTransfersPaused || lockerNotPaired  ;

    externalUnlockCollateral@withrevert(e, extLockingCollateralToken, amount);
```

16. **Rule:** `lockerCollateralTokenBalanceGreaterThanCollateralLedgerBalance` - verifies the assumption that total collateral token balances is always less than or equal to the balance recorded in ledger

```solidity
assert sumOfCollateralBalances <= to_mathint((stateToken.balanceOf(stateLocker)));

```

17. **Rule:** `onlyAllowedMethodsMayChangeEncumberedCollateralBalances` - verifies that changes to the balances of encumbered collateral to specific methods, ensuring that such modifications are controlled and intentional.

```solidity
assert encumberedCollateralBalanceAfter > encumberedCollateralBalanceBefore => canIncreaseEncumberedCollateralBalances(f);
assert encumberedCollateralBalanceAfter < encumberedCollateralBalanceBefore => canDecreaseEncumberedCollateralBalances(f);

```

18. **Rule:** `encumberedCollateralBalancesNeverOverflows` - ensure that `encumberedCollateralBalances` never overflows

```solidity
assert encumberedCollateralBalanceBefore <= encumberedCollateralBalanceAfter;

```

19. **Rule:** `noMethodsChangeTermRepoId` - verifies that termRepoIds are immutable.

```solidity
assert termRepoIdBefore == termRepoIdAfter;

```

20. **Rule:** `noMethodsChangeNumOfAcceptedCollateralTokens` - verifies that the number of accepted collateral tokens are immutable.

```solidity
assert numOfAcceptedCollateralTokensBefore == numOfAcceptedCollateralTokensAfter;

```

21. **Rule:** `noMethodsChangeDeMinimisMarginThreshold` - verifies that the `deminimisMarginThreshold` is immutable.

```solidity
assert deMinimisMarginThresholdBefore == deMinimisMarginThresholdAfter;

```

22. **Rule:** `noMethodsChangeLiquidateDamagesDueToProtocol` - verifies that the liquidated damages due to protocol is immutable.

```solidity
assert liquidateDamagesDueToProtocolBefore == liquidateDamagesDueToProtocolAfter;

```

23. **Rule:** `noMethodsChangeNetExposureCapOnLiquidation` - verifies that the `netExposureCapOnLiquidation` parameter of a termRepo is immutable.

```solidity
assert netExposureCapOnLiquidationBefore == netExposureCapOnLiquidationAfter;

```

24. **Rule:** `noMethodsChangePurchaseToken` - verifies that the purchaseToken associated with a termRepo is immutable.

```solidity
assert purchaseTokenBefore == purchaseTokenAfter;

```

25. **Rule:** `onlyAllowedMethodsChangeTermContracts` - verifies that changes to term contracts addresses are restricted to certain allowed methods.

```solidity
assert servicerBefore == servicerAfter;
assert oracleBefore == oracleAfter;
assert lockerBefore == lockerAfter;
assert controllerBefore == controllerAfter;
assert emitterBefore == emitterAfter;

```

26. **Rule:** `noMethodsChangeMaintenanceCollateralRatios` - verifies that maintenance collateral ratios associated with a termRepo are immutable.

```solidity
assert maintenanceCollateralRatioBefore == maintenanceCollateralRatioAfter;

```

27. **Rule:** `noMethodsChangeInitialCollateralRatios` - verifies that initial collateral ratios associated with a termRepo are immutable.

```solidity
assert initialCollateralRatioBefore == initialCollateralRatioAfter;

```

28. **Rule:** `noMethodsChangeLiquidatedDamages` - verifies that liquidated damages associated with a termRepo are immutable.

```solidity
assert liquidatedDamagesBefore == liquidatedDamagesAfter;

```

29. **Rule:** `onlyAllowedMethodsChangeLockedCollateralLedger` - verifies that changes t othe collateral ledger is restricted to certain approved methods.

```solidity
assert lockedCollateralLedgerBefore == lockedCollateralLedgerAfter;

```

30. **Rule:** `sumOfCollateralBalancesLessThanEncumberedBalances` - verifes the assumption that the total sum of all collateral balances is always less than the encumbered collateral balance.

```solidity
mathint encumberedCollateralBalanceAfter = encumberedCollateralBalance(stateToken);
mathint sumOfCollateralBalancesAfter = sumOfCollateralBalances;

assert sumOfCollateralBalancesAfter <= encumberedCollateralBalanceAfter;
```

31. **Rule:** `batchLiquidationSuccessfullyLiquidates` - assert that the locker's balances, the liquidator's balances and protocol reserve's balances have changed by the correct amount after `bathLiquidate`

```solidity
    // Assert that the locker's balances have changed by the correct amount.
    assert(lockerCollateralTokenBalanceBefore - lockerCollateralTokenBalanceAfter == liquidationIncentiveAmount);
    assert(lockerPurchaseTokenBalanceAfter - lockerPurchaseTokenBalanceBefore == to_mathint(closureAmount));

    // Assert that the liquidator's balances have changed by the correct amount.
    assert(liquidatorCollateralTokenBalanceAfter - liquidatorCollateralTokenBalanceBefore == liquidationIncentiveAmount - protocolLiquidatedDamagesAmount);
    assert(liquidatorPurchaseTokenBalanceBefore - liquidatorPurchaseTokenBalanceAfter == to_mathint(closureAmount));

    // Assert that the reserve's balances have changed by the correct amount.
    assert(reserveCollateralTokenBalanceAfter - reserveCollateralTokenBalanceBefore == protocolLiquidatedDamagesAmount);
```

32. **Rule:** `batchLiquidateWithRepoTokenSuccessfullyLiquidates` - assert that the locker's balances, liquidators balances and protocol reserve blances have changed by the correct amount after calling `batchLiquidatedWithRepoToken`

```solidity
    // Assert that the locker's balances have changed by the correct amount.
    assert(lockerCollateralTokenBalanceBefore - lockerCollateralTokenBalanceAfter == liquidationIncentiveAmount);

    // Assert that the liquidator's balances have changed by the correct amount.
    assert(liquidatorCollateralTokenBalanceAfter - liquidatorCollateralTokenBalanceBefore == liquidationIncentiveAmount - protocolLiquidatedDamagesAmount);
    assert(liquidatorRepoTokenBalanceBefore - liquidatorRepoTokenBalanceAfter == to_mathint(closureRepoTokenAmount));

    // Assert that the reserve's balances have changed by the correct amount.
    assert(reserveCollateralTokenBalanceAfter - reserveCollateralTokenBalanceBefore == protocolLiquidatedDamagesAmount);
}

```

33. **Rule:** `batchDefaultSuccessfullyDefaults` - assert that the locker's balances, liquidator's balances and protocol reserve balances have changed by the correct amount after calling`batchDefault`

```solidity
// Assert that the locker's balances have changed by the correct amount.
assert(lockerCollateralTokenBalanceBefore - lockerCollateralTokenBalanceAfter == liquidationIncentiveAmount);
assert(lockerPurchaseTokenBalanceAfter - lockerPurchaseTokenBalanceBefore == to_mathint(closureAmount));

// Assert that the liquidator's balances have changed by the correct amount.
assert(liquidatorCollateralTokenBalanceAfter - liquidatorCollateralTokenBalanceBefore == liquidationIncentiveAmount - protocolLiquidatedDamagesAmount);
assert(liquidatorPurchaseTokenBalanceBefore - liquidatorPurchaseTokenBalanceAfter == to_mathint(closureAmount));

// Assert that the reserve's balances have changed by the correct amount.
assert(reserveCollateralTokenBalanceAfter - reserveCollateralTokenBalanceBefore == protocolLiquidatedDamagesAmount);
// assert(reservePurchaseTokenBalanceAfter == reservePurchaseTokenBalanceBefore);
```

34. **Rule:** `batchLiquidationDoesNotAffectThirdParty` - verifies that liquidating collateral belonging to one account does not affect the third party balances.

```solidity
batchLiquidation(e, borrower, [closureAmount]);

    assert(otherBorrowerRepurchaseObligationBefore == otherBorrowerRepurchaseObligationAfter);
    assert(otherBorrowerCollateralBalanceBefore == otherBorrowerCollateralBalanceAfter);

```

35. Rule: `batchLiquidationWithRepoTokenDoesNotAffectThirdParty` - verifies that liquidating collateral using `batchLiquidationWithRepoToken` belonging to one account does not affect the third party balances.

```solidity
batchLiquidationWithRepoToken(e, borrower, [closureAmount]);

    assert(otherBorrowerRepurchaseObligationBefore == otherBorrowerRepurchaseObligationAfter);
    assert(otherBorrowerCollateralBalanceBefore == otherBorrowerCollateralBalanceAfter);

```

36. `Rule: batchDefaultDoesNotAffectThirdParty` - verifies that liquidating collateral belonging to one account when calling `batchDefault` does not affect the third party balances.

```solidity
batchDefault(e, borrower, [closureAmount]);

    assert(otherBorrowerRepurchaseObligationBefore == otherBorrowerRepurchaseObligationAfter);
    assert(otherBorrowerCollateralBalanceBefore == otherBorrowerCollateralBalanceAfter);

```

37. **Rule:** `batchLiquidationRevertsIfInvalid` - ensures that `batchLiquidate` reverts if not valid.

```solidity
    bool liquidationsClosed = e.block.timestamp > servicerLiquidations.endOfRepurchaseWindow();
    bool selfLiquidation = borrower == e.msg.sender;
    bool invalidParameters = harnessCollateralTokensLength() != closureAmounts.length;
    bool zeroBorrowerRepurchaseObligation = servicerLiquidations.getBorrowerRepurchaseObligation(borrower) == 0;
    bool borrowerNotInShortfall = !isBorrowerInShortfall(borrower);
    bool exceedsNetExposureCapOnLiquidation = !willBeWithinNetExposureCapOnLiquidation(borrower,  closureAmounts[0], collateralTokenLiquidations, collateralSeizure) && !allowFullLiquidation(borrower, closureAmounts);
    bool servicerNoLockerAccess = !lockerLiquidations.hasRole(lockerLiquidations.SERVICER_ROLE(), servicerLiquidations);
    bool noLockerAccess = !lockerLiquidations.hasRole(lockerLiquidations.SERVICER_ROLE(), currentContract);
    bool lockerTransfersPaused = lockerLiquidations.transfersPaused();
    bool totalClosureIsZero = closureAmounts[0] == 0;
    bool closureAmountIsUIntMax = closureAmounts[0] == max_uint256;
    bool closureAmountMoreThanBorrowObligation = closureAmounts[0] > servicerLiquidations.getBorrowerRepurchaseObligation(borrower);
    bool noAccessToServicer = !servicerLiquidations.hasRole(servicerLiquidations.COLLATERAL_MANAGER(), currentContract);
    bool liquidatorDoesNotHaveEnoughFunds = purchaseTokenLiquidations.balanceOf(e.msg.sender) < closureAmounts[0];
    bool liquidatorAllowanceFoLockerTooLow = purchaseTokenLiquidations.allowance(e.msg.sender, lockerLiquidations) < closureAmounts[0];
    bool notEnoughCollateralToLiquidate = collateralSeizure > getCollateralBalance(borrower,collateralTokenLiquidations);
    bool msgHasValue = e.msg.value != 0;

    batchLiquidation@withrevert(e, borrower, closureAmounts);
    assert lastReverted == (
        liquidationsClosed ||
        selfLiquidation ||
        invalidParameters ||
        zeroBorrowerRepurchaseObligation ||
        borrowerNotInShortfall ||
        exceedsNetExposureCapOnLiquidation ||
        servicerNoLockerAccess ||
        noLockerAccess ||
        lockerTransfersPaused ||
        totalClosureIsZero ||
        closureAmountIsUIntMax ||
        closureAmountMoreThanBorrowObligation ||
        noAccessToServicer ||
        liquidatorDoesNotHaveEnoughFunds ||
        liquidatorAllowanceFoLockerTooLow ||
        notEnoughCollateralToLiquidate ||
        liquidationsPaused() ||
        msgHasValue
    ), "Expected revert";
```

38. **Rule:** `batchLiquidationWithRepoTokenRevertsIfInvalid` - ensure that `batchLiquidateWithRepoToken` reverts if not valid.

```solidity
    bool liquidationsClosed = e.block.timestamp > servicerLiquidations.endOfRepurchaseWindow();
    bool selfLiquidation = borrower == e.msg.sender;
    bool invalidParameters = harnessCollateralTokensLength() != closureAmounts.length;
    bool zeroBorrowerRepurchaseObligation = servicerLiquidations.getBorrowerRepurchaseObligation(borrower) == 0;
    bool borrowerNotInShortfall = !isBorrowerInShortfall(borrower);
    bool exceedsNetExposureCapOnLiquidation = !willBeWithinNetExposureCapOnLiquidation(borrower,  closureAmountInPurchaseToken, collateralTokenLiquidations, collateralSeizure) && !allowFullLiquidation(borrower, closureAmounts);
    bool noLockerAccess = !lockerLiquidations.hasRole(lockerLiquidations.SERVICER_ROLE(), currentContract);
    bool burningPaused = repoTokenLiquidations.burningPaused();
    bool noServicerAccessToTokenBurns = !repoTokenLiquidations.hasRole(repoTokenLiquidations.BURNER_ROLE(), servicerLiquidations);
    bool lockerTransfersPaused = lockerLiquidations.transfersPaused();
    bool totalClosureIsZero = closureAmounts[0] == 0;
    bool closureAmountIsUIntMax = closureAmounts[0] == max_uint256;
    bool closureAmountMoreThanBorrowObligation = closureAmountInPurchaseToken > servicerLiquidations.getBorrowerRepurchaseObligation(borrower);
    bool noAccessToServicer = !servicerLiquidations.hasRole(servicerLiquidations.COLLATERAL_MANAGER(), currentContract);
    bool liquidatorDoesNotHaveEnoughFunds = repoTokenLiquidations.balanceOf(e.msg.sender) < closureAmounts[0];
    bool notEnoughCollateralToLiquidate = collateralSeizure > getCollateralBalance(borrower,collateralTokenLiquidations);
    bool servicerIsNotTermRepoBalanced = (servicerLiquidations.totalOutstandingRepurchaseExposure() - closureAmountInPurchaseToken + servicerLiquidations.totalRepurchaseCollected() ) / (10 ^ 4) != (((((repoTokenLiquidations.totalSupply() -  closureAmounts[0]) * expScale * redemptionVal) / expScale ) / expScale) / 10 ^ 4);
    bool msgHasValue = e.msg.value != 0;
    bool liquidatorIsZero = e.msg.sender == 0;

    batchLiquidationWithRepoToken@withrevert(e, borrower, closureAmounts);
    assert lastReverted == (
        liquidationsClosed ||
        selfLiquidation ||
        invalidParameters ||
        zeroBorrowerRepurchaseObligation ||
        borrowerNotInShortfall ||
        exceedsNetExposureCapOnLiquidation ||
        noLockerAccess ||
        burningPaused ||
        noServicerAccessToTokenBurns ||
        lockerTransfersPaused ||
        totalClosureIsZero ||
        closureAmountIsUIntMax ||
        closureAmountMoreThanBorrowObligation ||
        noAccessToServicer ||
        liquidatorDoesNotHaveEnoughFunds ||
        notEnoughCollateralToLiquidate ||
        liquidationsPaused() ||
        servicerIsNotTermRepoBalanced ||
        msgHasValue || liquidatorIsZero
    ), "Expected revert";
```

39. **Rule:** `batchDefaultRevertsIfInvalid` - ensure that `batchDefault` reverts if not valid.

```solidity
bool defaultsClosed = e.block.timestamp <= servicerLiquidations.endOfRepurchaseWindow();
bool selfLiquidation = borrower == e.msg.sender;
bool invalidParameters = harnessCollateralTokensLength() != closureAmounts.length;
bool zeroBorrowerRepurchaseObligation = servicerLiquidations.getBorrowerRepurchaseObligation(borrower) == 0;
bool servicerNoLockerAccess = !lockerLiquidations.hasRole(lockerLiquidations.SERVICER_ROLE(), servicerLiquidations);
bool noLockerAccess = !lockerLiquidations.hasRole(lockerLiquidations.SERVICER_ROLE(), currentContract);
bool lockerTransfersPaused = lockerLiquidations.transfersPaused();
bool totalClosureIsZero = closureAmounts[0] == 0;
bool closureAmountIsUIntMax = closureAmounts[0] == max_uint256;
bool closureAmountMoreThanBorrowObligation = closureAmounts[0] > servicerLiquidations.getBorrowerRepurchaseObligation(borrower);
bool noAccessToServicer = !servicerLiquidations.hasRole(servicerLiquidations.COLLATERAL_MANAGER(), currentContract);
bool liquidatorDoesNotHaveEnoughFunds = purchaseTokenLiquidations.balanceOf(e.msg.sender) < closureAmounts[0];
bool liquidatorAllowanceFoLockerTooLow = purchaseTokenLiquidations.allowance(e.msg.sender, lockerLiquidations) < closureAmounts[0];
bool notEnoughCollateralToLiquidate = collateralSeizure > getCollateralBalance(borrower, collateralTokenLiquidations);

bool msgHasValue = e.msg.value != 0;

batchDefault@withrevert(e, borrower, closureAmounts);
assert lastReverted == (
    defaultsClosed ||
    selfLiquidation ||
    invalidParameters ||
    zeroBorrowerRepurchaseObligation ||
    liquidationsPaused() ||
    servicerNoLockerAccess ||
    noLockerAccess ||
    lockerTransfersPaused ||
    totalClosureIsZero ||
    closureAmountIsUIntMax ||
    closureAmountMoreThanBorrowObligation ||
    noAccessToServicer ||

```

40. **Rule:** `onlyRoleCanCallRevert` - checks if a method call requires specific roles to execute successfully, does not revert if the caller has the necessary role.

```solidity

    assert !lastReverted =>
        hasRole(ADMIN_ROLE(),e.msg.sender)
        || hasRole(AUCTION_LOCKER(),e.msg.sender)
        || hasRole(DEVOPS_ROLE(),e.msg.sender)
        || hasRole(INITIALIZER_ROLE(),e.msg.sender)
        || hasRole(SERVICER_ROLE(),e.msg.sender)
        || hasRole(ROLLOVER_MANAGER(),e.msg.sender)
        || hasRole(ROLLOVER_TARGET_AUCTIONEER_ROLE(),e.msg.sender);

```

41. **Rule:** `onlyRoleCanCallStorage` - ensures that changes to storage by non-view method calls can only be performed by addresses with specific roles, guarding against unauthorized modifications.

```solidity

    assert storeBefore != storeAfter =>
        hasRole(ADMIN_ROLE(),e.msg.sender)
        || hasRole(AUCTION_LOCKER(),e.msg.sender)
        || hasRole(DEVOPS_ROLE(),e.msg.sender)
        || hasRole(INITIALIZER_ROLE(),e.msg.sender)
        || hasRole(SERVICER_ROLE(),e.msg.sender)
        || hasRole(ROLLOVER_MANAGER(),e.msg.sender)
        || hasRole(ROLLOVER_TARGET_AUCTIONEER_ROLE(),e.msg.sender);

```

### TermRepoRolloverManager

1. **Rule:** `noMethodsChangeTermRepoId` - ensures that the `termRepoId` is immutable.

```solidity
env e, method f, calldataarg args filtered {
    f -> !f.isView &&
    f.selector != initialize(string,address,address,address,address).selector &&
    f.selector != upgradeToAndCall(address,bytes).selector &&
    f.selector != upgradeTo(address).selector
} {
    bytes32 termRepoIdBefore = termRepoId();
    f(e, args);
    bytes32 termRepoIdAfter = termRepoId();

    assert termRepoIdBefore == termRepoIdAfter,
        "termRepoId cannot be changed";
}

```

2. **Rule:** `onlyAllowedMethodsChangeTermContracts` - verifies that changes to term contracts addresses are restricted to certain allowed methods.

```solidity
// Restricts contract changes to specific methods.
env e, method f, calldataarg args filtered {
    f -> !f.isView &&
    f.selector != initialize(string,address,address,address,address).selector &&
    f.selector != upgradeToAndCall(address,bytes).selector &&
    f.selector != upgradeTo(address).selector &&
    f.selector != pairTermContracts(address,address,address,address).selector
} {
    address collateralManagerBefore = collateralManager();
    address servicerBefore = repoServicer();
    address controllerBefore = controller();
    address eventEmitterBefore = eventEmitter();
    f(e, args);
    address collateralManagerAfter = collateralManager();
    address servicerAfter = repoServicer();
    address controllerAfter = controller();
    address eventEmitterAfter = eventEmitter();

    assert collateralManagerBefore == collateralManagerAfter,
        "collateralManager cannot be changed";
    assert servicerBefore == servicerAfter,
        "servicer cannot be changed";
    assert controllerBefore == controllerAfter,
        "controller cannot be changed";
    assert eventEmitterBefore == eventEmitterAfter,
        "eventEmitter cannot be changed";
}

```

3. **Rule:** `onlyAllowedMethodsChangeApprovedRolloverAuctionBidLockers` - verifies that changes to approved rollover contracts are restricted to certain allowed methods.

```solidity
// Specifies which methods can change the approval status of rollover auction bid lockers.
env e, method f, calldataarg args, address bidLocker filtered {
    f -> !f.isView &&
    f.selector != initialize(string,address,address,address,address).selector &&
    f.selector != upgradeToAndCall(address,bytes).selector &&
    f.selector != upgradeTo(address).selector &&
    f.selector != electRollover(TermRepoRolloverManagerHarness.TermRepoRolloverElectionSubmission).selector &&
    f.selector != approveRolloverAuction(address).selector &&
    f.selector != revokeRolloverApproval(address).selector
} {
    bool isRolloverAuctionApprovedBefore = isRolloverAuctionApproved(bidLocker);
    f(e, args);
    bool isRolloverAuctionApprovedAfter = isRolloverAuctionApproved(bidLocker);

    assert isRolloverAuctionApprovedBefore == isRolloverAuctionApprovedAfter,
        "only the approveRolloverAuction method can change the approved rollover auction bid lockers";
}

```

4. **Rule:** `onlyAllowedMethodsChangeRolloverElections` - verifies that changes to rollover elections are restricted to certain allowed methods.

```solidity
// Limits which methods can modify rollover elections.
env e, method f, calldataarg args, address bidder filtered {
    f -> !f.isView &&
    f.selector != initialize(string,address,address,address,address).selector &&
    f.selector != upgradeToAndCall(address,bytes).selector &&
    f.selector != upgradeTo(address).selector &&
    f.selector != electRollover(TermRepoRolloverManagerHarness.TermRepoRolloverElectionSubmission).selector &&
    f.selector != cancelRollover().selector &&
    f.selector != fulfillRollover(address).selector
} {
    TermRepoRolloverManagerHarness.TermRepoRolloverElection electionBefore = getRolloverInstructions(bidder);
    f(e, args);
    TermRepoRolloverManagerHarness.TermRepoRolloverElection electionAfter = getRolloverInstructions(bidder);

    assert electionBefore.rolloverAuctionBidLocker == electionAfter.rolloverAuctionBidLocker &&
           electionBefore.rollover
```

5. **Rule:** `electRolloverIntegrity` - ensures that all relevant balances are properly reflected when electing to roll-over a loan.

```solidity

    TermRepoRolloverManagerHarness.TermRepoRolloverElectionSubmission submission;

    require(repoServicer() == electionRepoServicer);
    electRollover(e, submission);
    uint256 rolloverAmount = getRolloverInstructions(e.msg.sender).rolloverAmount;
    bytes32 rolloverBidPriceHash = getRolloverInstructions(e.msg.sender).rolloverBidPriceHash;
    address rolloverAuctionBidLocker = getRolloverInstructions(e.msg.sender).rolloverAuctionBidLocker;

    assert submission.rolloverAmount == rolloverAmount;
    assert submission.rolloverBidPriceHash == rolloverBidPriceHash;
    assert submission.rolloverAuctionBidLocker == rolloverAuctionBidLocker;
    assert rolloverAmount <= electionRepoServicer.getBorrowerRepurchaseObligation(e.msg.sender); // Rollover amount cannot exceed borrower's obligation.
}

```

6. **Rule:** `electRolloverDoesNotAffectThirdParty` - verifies that the action of one account electing to roll over their loan does not impact third-party balances.

```solidity
TermRepoRolloverManagerHarness.TermRepoRolloverElectionSubmission submission;
address otherBorrower;

require(otherBorrower != e.msg.sender);

uint256 thirdPartyRolloverAmountBefore = getRolloverInstructions(otherBorrower).rolloverAmount;
bytes32 thirdPartyRolloverBidPriceHashBefore = getRolloverInstructions(otherBorrower).rolloverBidPriceHash;
address thirdPartyRolloverAuctionBidLockerBefore = getRolloverInstructions(otherBorrower).rolloverAuctionBidLocker;

electRollover(e, submission);

uint256 thirdPartyRolloverAmountAfter = getRolloverInstructions(otherBorrower).rolloverAmount;
bytes32 thirdPartyRolloverBidPriceHashAfter = getRolloverInstructions(otherBorrower).rolloverBidPriceHash;
address thirdPartyRolloverAuctionBidLockerAfter = getRolloverInstructions(otherBorrower).rolloverAuctionBidLocker;

assert thirdPartyRolloverAmountBefore == thirdPartyRolloverAmountAfter;
assert thirdPartyRolloverBidPriceHashBefore == thirdPartyRolloverBidPriceHashAfter;
assert thirdPartyRolloverAuctionBidLockerBefore == thirdPartyRolloverAuctionBidLockerAfter;
```

7. **Rule:** `electRolloverRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity

TermRepoRolloverManagerHarness.TermRepoRolloverElectionSubmission submission;

// Define various conditions that lead to reversion (simplified for clarity).
bool isExpectedToRevert = /* conditions leading to revert */;

electRollover@withrevert(e, submission);

assert lastReverted <=> isExpectedToRevert;

```

8. **Rule:** `cancelRolloverIntegrity` - ensures that all relevant balances are properly reflected when cancelling a roll-over election.

```solidity
assert rolloverAmount == 0;
assert rolloverBidPriceHash == to_bytes32(0);
assert rolloverAuctionBidLocker == 0;

```

9. **Rule** `cancelRolloverDoesNotAffectThirdParty` - verifies that the action of one account cancelling their roll over election does not impact third-party balances.

```solidity
assert thirdPartyRolloverAmountBefore == thirdPartyRolloverAmountAfter;
assert thirdPartyRolloverBidPriceHashBefore == thirdPartyRolloverBidPriceHashAfter;
assert thirdPartyRolloverAuctionBidLockerBefore == thirdPartyRolloverAuctionBidLockerAfter;
```

10. **Rule:** `cancelRolloverRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool payable = e.msg.value > 0;
bool zeroBorrowerRepurchaseObligation = electionRepoServicer.getBorrowerRepurchaseObligation(e.msg.sender) == 0;
bool noRolloverToCancel = getRolloverInstructions(e.msg.sender).rolloverAmount == 0;
bool rolloverAlreadyProcessed = getRolloverInstructions(e.msg.sender).processed;
bool lockingPausedForRolloverAuction = electionBidLocker.lockingPaused();
bool noRolloverManagerAccessToBidLocker = !electionBidLocker.hasRole(electionBidLocker.ROLLOVER_MANAGER(), currentContract);
bool beyondAuctionRevealTime = e.block.timestamp > electionBidLocker.revealTime();
bool nonExistentRolloverBid = existingRolloverBidAmount == 0;

bool isExpectedToRevert = payable || zeroBorrowerRepurchaseObligation || noRolloverToCancel || rolloverAlreadyProcessed || lockingPausedForRolloverAuction || noRolloverManagerAccessToBidLocker || beyondAuctionRevealTime || nonExistentRolloverBid;
cancelRollover@withrevert(e);

assert lastReverted <=> isExpectedToRevert;
```

11. **Rule:** `fulfillRolloverIntegrity` - ensures that a rollover election is properly marked as processed when fulfilled.

```solidity
    fulfillRollover(e, borrower);

    bool rolloverProcessed = getRolloverInstructions(borrower).processed;

    assert rolloverProcessed, "The rollover should be marked as processed.";

```

12. **Rule:** `fulfillRolloverDoesNotAffectThirdParty` - verifies that fulfilling a rollover election submitted by one account does not affect the third party balances

```solidity
    bool thirdPartyRolloverProcessedBefore = getRolloverInstructions(borrower2).processed;

    fulfillRollover(e, borrower);

    bool thirdPartyRolloverProcessedAfter = getRolloverInstructions(borrower2).processed;

    assert thirdPartyRolloverProcessedBefore == thirdPartyRolloverProcessedAfter, "Third party's rollover state should remain unaffected.";
}
```

13. **Rule:** `fulfillRolloverRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
    bool payable = e.msg.value > 0;
    bool callerNotRolloverBidFulfillerRole = !hasRole(ROLLOVER_BID_FULFILLER_ROLE(), e.msg.sender);

    bool isExpectedToRevert = payable || callerNotRolloverBidFulfillerRole;
    fulfillRollover@withrevert(e, borrower);

    assert lastReverted <=> isExpectedToRevert, "fulfillRollover should only revert under specific conditions.";

```

14. **Rule:** `onlyRoleCanCallRevert` - checks if a method call requires specific roles to execute successfully, does not revert if the caller has the necessary role.

```solidity
    assert !lastReverted =>
        hasRole(ADMIN_ROLE(),e.msg.sender)
        || hasRole(DEVOPS_ROLE(),e.msg.sender)
        || hasRole(ROLLOVER_BID_FULFILLER_ROLE(),e.msg.sender)
        || hasRole(INITIALIZER_ROLE(),e.msg.sender), "Function should only be callable by specific roles without reverting.";
}

```

15. **Rule:** `onlyRoleCanCallStorage` - ensures that changes to storage by non-view method calls can only be performed by addresses with specific roles, guarding against unauthorized modifications.

```solidity
    assert storeBefore != storeAfter =>
        hasRole(ADMIN_ROLE(),e.msg.sender)
        || hasRole(DEVOPS_ROLE(),e.msg.sender)
        || hasRole(ROLLOVER_BID_FULFILLER_ROLE(),e.msg.sender)
        || hasRole(INITIALIZER_ROLE(),e.msg.sender), "Only specific roles should be able to cause state changes.";

```

### TermAuctionBidLocker

1. **Rule:** `PauseLockingCausesBidLockingToRevert` - verifies that pausing locking reverts any attempts at locking bids.

```solidity
    require lockingPaused() == true;
    f@withrevert(e, args);
    assert lastReverted, "lockBids(...) should revert when bid locking is paused";

```

2. **Rule:** `UnpauseLockingAllowsBidLocking` - verifies that unpausing locking allows users to lock bids.

```solidity
    require lockingPaused() == false;
    f(e, args);
    assert !lastReverted, "lockBids(...) should not revert when bid locking is not paused";

```

3. **Rule:** `PauseUnlockingCausesBidUnlockingToRevert` - verifies that pausing unlocking reverts any attempts at unlocking offers.

```solidity
    require unlockingPaused() == true;
    unlockBids@withrevert(e, ids);
    assert lastReverted, "unlockBids(...) should revert when bid unlocking is paused";

```

4. **Rule:** `UnpauseUnlockingAllowsBidUnlocking` - verifies that unpausing locking allows users to unlock bids.

```solidity
    require unlockingPaused() == false;
    require harnessGetInternalBids(id).id == id;
    unlockBids(e, [id]);
    assert !lastReverted, "unlockBids(...) should not revert when bid unlocking is not paused";

```

5. **Rule:** `lockerCollateralTokenBalanceGreaterThanCollateralLedgerBalance` - verified the assumption that the total amount of collateral locked is always greater than or equal to the amount recorded in ledger.

```solidity
require(bidLockerStateCollateralToken.balanceOf(lockerBidLockingState) + bidSubmissions[0].collateralAmounts[0] <= max_uint256);

f(e, args);

assert sumOfCollateralBalances <= to_mathint((bidLockerStateCollateralToken.balanceOf(lockerBidLockingState)));
```

6. **Invariant:** `LockedBidIdAlwaysMatchesIndex` - verifies the assumption that the bidId matches the ledger.

```solidity
    harnessGetInternalBidId(bidId) == bidId || harnessGetInternalBidId(bidId) == to_bytes32(0);
```

7. **Invariant:** `BidCountAlwaysMatchesNumberOfStoredBids` - verifies the assumption that the bidCount matches the ledger.

```solidity
    to_mathint(bidCount()) == lockedBidCount;

```

8. **Rule:** `LockBidsIntegrity` - ensures that collateral token balances are properly transferred to the repo locker when locking bids.

```solidity
assert
    (collateralTokenOneBalanceAfter == collateralTokenOneBalanceBefore - collateralOneAmountToLock),
    "lockBids should transfer collateral tokens from bidder to contract";
  assert
    (collateralTokenTwoBalanceAfter == collateralTokenTwoBalanceBefore - collateralTwoAmountToLock),
    "lockBids should transfer collateral tokens from bidder to contract";
```

9. **Rule:** `LockBidsDoesNotAffectThirdParty` - verifies that locking bids belonging to one account does not affect the third party balances.

```solidity
assert bidIdBefore == bidIdAfter,
    "lockBids should not modify bid id";
  assert bidderBefore == bidderAfter,
    "lockBids should not modify bidder";
  assert bidPriceHashBefore == bidPriceHashAfter,
    "lockBids should not modify bid price hash";
  assert bidRevealedPriceBefore == bidRevealedPriceAfter,
    "lockBids should not modify bid revealed price";
  assert bidAmountBefore == bidAmountAfter,
    "lockBids should not modify bid amount";
  assert bidCollateralAmountBefore == bidCollateralAmountAfter,
    "lockBids should not modify bid collateral amounts";
  assert bidIsRolloverBefore == bidIsRolloverAfter,
    "lockBids should not modify bid rollover status";
  assert bidRolloverAddressBefore == bidRolloverAddressAfter,
    "lockBids should not modify bid rollover address";
  assert bidIsRevealedBefore == bidIsRevealedAfter,
    "lockBids should not modify bid revealed status";
```

10. **Rule:** `lockBidsMonotonicBehavior` - verifies that locking a bid is monotonically increasing in the bid count.

```solidity
uint256 bidCountBefore = bidCount();
  lockBids(e, bidSubmissions);
  uint256 bidCountAfter = bidCount();

  assert bidCountAfter >= bidCountBefore,
    "bidCount should either increase or stay the same after lockBids is called";
```

11. **Rule:** `LockBidsRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
  bool msgValueIsNotZero = e.msg.value != 0;
  bool reentrant = harnessReentrancyGuardEntered();
  bool auctionNotOpen = e.block.timestamp < auctionStartTime() || e.block.timestamp > revealTime(); // AuctionNotOpen
  bool lockingPaused = lockingPaused(); // LockingPaused
  bool bidSubmissionNotOwned = bidSubmissions[0].bidder != e.msg.sender; // BidNotOwned
  bool maxBidCountReached = bidCount() >= MAX_BID_COUNT(); // MaxBidCountReached
  bool bidIdAlreadyExists = existingGeneratedBid.amount != 0 && existingBid.amount == 0 ; // BidIdAlreadyExists

  bool editingBidNotOwned = existingBidAmount != 0
    && existingBidder != bidSubmissions[0].bidder; // BidNotOwned
  bool purchaseTokenNotApproved = bidSubmissions[0].purchaseToken != purchaseToken(); // PurchaseTokenNotApproved
  bool firstCollateralTokenNotApproved = !collateralTokens(bidSubmissions[0].collateralTokens[0]); // CollateralTokenNotApproved
  bool secondCollateralTokenNotApproved = !collateralTokens(bidSubmissions[0].collateralTokens[1]); // CollateralTokenNotApproved
  bool bidAmountTooLow = bidSubmissions[0].amount < minimumTenderAmount(); // BidAmountTooLow
  bool collateralBalanceTooLow = ((existingBid.collateralAmounts[0] < bidSubmissions[0].collateralAmounts[0]) && lockingAuctionCollateralTokenOne.balanceOf(bidSubmissions[0].bidder) < bidCollat1Diff) || ((existingBid.collateralAmounts[1] < bidSubmissions[0].collateralAmounts[1]) && lockingAuctionCollateralTokenTwo.balanceOf(bidSubmissions[0].bidder) <bidCollat2Diff);
  bool collateralApprovalsTooLow = ((existingBid.collateralAmounts[0] < bidSubmissions[0].collateralAmounts[0]) && lockingAuctionCollateralTokenOne.allowance(bidSubmissions[0].bidder, lockerLocking) < bidCollat1Diff) || ((existingBid.collateralAmounts[1] < bidSubmissions[0].collateralAmounts[1]) && lockingAuctionCollateralTokenTwo.allowance(bidSubmissions[0].bidder, lockerLocking) < bidCollat2Diff);
  bool collateralAmountTooLow = harnessIsInInitialCollateralShortFall(
    bidSubmissions[0].amount,
    bidSubmissions[0].collateralTokens,
    bidSubmissions[0].collateralAmounts
  ); // CollateralAmountTooLow
  bool lockerTransfersPaused = (bidCollat1Diff != 0 || bidCollat2Diff != 0) && lockerLocking.transfersPaused();
  bool collateralManagerNotPairedToLocker = (bidCollat1Diff != 0 || bidCollat2Diff != 0) && !lockerLocking.hasRole(lockerLocking.SERVICER_ROLE(), collateralManagerLocking);
  bool bidLockerNotPairedToCollatManager = (bidCollat1Diff != 0 || bidCollat2Diff != 0) && !collateralManagerLocking.hasRole(collateralManagerLocking.AUCTION_LOCKER(), currentContract);

  bool isExpectedToRevert =
    msgValueIsNotZero ||
    reentrant ||
    auctionNotOpen ||
    lockingPaused ||
    bidSubmissionNotOwned ||
    maxBidCountReached ||
    bidIdAlreadyExists || 
    editingBidNotOwned ||
    bidAmountTooLow ||
    purchaseTokenNotApproved ||
    firstCollateralTokenNotApproved ||
    secondCollateralTokenNotApproved ||
    bidAmountTooLow ||
    collateralBalanceTooLow ||
    collateralApprovalsTooLow || 
    collateralAmountTooLow || 
    lockerTransfersPaused || 
    collateralManagerNotPairedToLocker ||
    bidLockerNotPairedToCollatManager
    ;

  assert lastReverted == isExpectedToRevert,
    "lockBids should revert when one of the revert conditions is reached";
```

12. **Rule:** `lockBidsWithReferralIntegrity` - ensures that collateral token balances are properly transferred to the repo locker when locking bids with a referral.

```solidity
  assert
    (collateralTokenOneBalanceAfter == collateralTokenOneBalanceBefore - collateralOneAmountToLock) &&
    (collateralTokenTwoBalanceAfter == collateralTokenTwoBalanceBefore - collateralTwoAmountToLock),
    "lockBids should transfer collateral tokens from bidder to contract";
```

13. **Rule:** `lockBidsWithReferralDoesNotAffectThirdParty` - verifies that locking bids belonging to one account when calling `lockBidsWithReferral` does not affect the third party balances.

```solidity
assert bidIdBefore == bidIdAfter,
    "lockBidsWithReferral should not modify bid id";
  assert bidderBefore == bidderAfter,
    "lockBidsWithReferral should not modify bidder";
  assert bidPriceHashBefore == bidPriceHashAfter,
    "lockBidsWithReferral should not modify bid price hash";
  assert bidRevealedPriceBefore == bidRevealedPriceAfter,
    "lockBidsWithReferral should not modify bid revealed price";
  assert bidAmountBefore == bidAmountAfter,
    "lockBidsWithReferral should not modify bid amount";
  assert bidCollateralAmountBefore == bidCollateralAmountAfter,
    "lockBidsWithReferral should not modify bid collateral amounts";
  assert bidIsRolloverBefore == bidIsRolloverAfter,
    "lockBidsWithReferral should not modify bid rollover status";
  assert bidRolloverAddressBefore == bidRolloverAddressAfter,
    "lockBidsWithReferral should not modify bid rollover address";
  assert bidIsRevealedBefore == bidIsRevealedAfter,
    "lockBidsWithReferral should not modify bid revealed status";
```

14. **Rule:** `lockBidsWithReferralRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
 bool auctionNotOpen = e.block.timestamp < auctionStartTime() || e.block.timestamp > revealTime(); // AuctionNotOpen
  bool lockingPaused = lockingPaused(); // LockingPaused
  bool reentrant = harnessReentrancyGuardEntered();
  bool sameReferral = (refer == e.msg.sender ? true : false); // InvalidSelfReferral
  bool bidSubmissionNotOwned = bidSubmissions[0].bidder != e.msg.sender ? true : false; // BidNotOwned
  bool maxBidCountReached = bidCount() >= MAX_BID_COUNT() ? true : false; // MaxBidCountReached
  bool bidIdAlreadyExists = existingGeneratedBid.amount != 0 && existingBid.amount == 0 ; // BidIdAlreadyExists

  bool editingBidNotOwned = existingBid.amount != 0 && existingBid.bidder != bidSubmissions[0].bidder; // BidNotOwned
  bool purchaseTokenNotApproved = bidSubmissions[0].purchaseToken != purchaseToken() ? true : false; // PurchaseTokenNotApproved
  bool firstCollateralTokenNotApproved = !collateralTokens(bidSubmissions[0].collateralTokens[0]); // CollateralTokenNotApproved
  bool secondCollateralTokenNotApproved = !collateralTokens(bidSubmissions[0].collateralTokens[1]); // CollateralTokenNotApproved
  bool bidAmountTooLow = bidSubmissions[0].amount < minimumTenderAmount(); // BidAmountTooLow
    bool collateralBalanceTooLow = ((existingBid.collateralAmounts[0] < bidSubmissions[0].collateralAmounts[0]) && lockingAuctionCollateralTokenOne.balanceOf(bidSubmissions[0].bidder) < bidCollat1Diff) || ((existingBid.collateralAmounts[1] < bidSubmissions[0].collateralAmounts[1]) && lockingAuctionCollateralTokenTwo.balanceOf(bidSubmissions[0].bidder) <bidCollat2Diff);
  bool collateralApprovalsTooLow = ((existingBid.collateralAmounts[0] < bidSubmissions[0].collateralAmounts[0]) && lockingAuctionCollateralTokenOne.allowance(bidSubmissions[0].bidder, lockerLocking) < bidCollat1Diff) || ((existingBid.collateralAmounts[1] < bidSubmissions[0].collateralAmounts[1]) && lockingAuctionCollateralTokenTwo.allowance(bidSubmissions[0].bidder, lockerLocking) < bidCollat2Diff);
  bool lockerTransfersPaused = (bidCollat1Diff != 0 || bidCollat2Diff != 0) && lockerLocking.transfersPaused();
  bool collateralManagerNotPairedToLocker = (bidCollat1Diff != 0 || bidCollat2Diff != 0) && !lockerLocking.hasRole(lockerLocking.SERVICER_ROLE(), collateralManagerLocking);
  bool bidLockerNotPairedToCollatManager = (bidCollat1Diff != 0 || bidCollat2Diff != 0) && !collateralManagerLocking.hasRole(collateralManagerLocking.AUCTION_LOCKER(), currentContract);
 bool collateralAmountTooLow = harnessIsInInitialCollateralShortFall(
    bidSubmissions[0].amount,
    bidSubmissions[0].collateralTokens,
    bidSubmissions[0].collateralAmounts
  ); // CollateralAmountTooLow
  bool msgValueNotZero = e.msg.value != 0;
  bool isExpectedToRevert =
    auctionNotOpen || lockingPaused || reentrant || sameReferral ||
    bidSubmissionNotOwned || maxBidCountReached ||  bidIdAlreadyExists || 
    editingBidNotOwned ||
    bidAmountTooLow || collateralBalanceTooLow || collateralApprovalsTooLow || purchaseTokenNotApproved ||
    firstCollateralTokenNotApproved || secondCollateralTokenNotApproved ||
    bidAmountTooLow || collateralAmountTooLow || lockerTransfersPaused || collateralManagerNotPairedToLocker || bidLockerNotPairedToCollatManager || msgValueNotZero;

  assert lastReverted <=> isExpectedToRevert,
    "lockBidsWithReferral should revert when one of the revert conditions is reached";
```

15. **Rule:** `lockBidsWithReferralMonotonicBehavior` - verifies that locking a bid with referral is monotonically increasing in the bid count.

```solidity
assert bidCountAfter >= bidCountBefore,
    "bidCount should either increase or stay the same after lockBidsWithReferral is called";
```

16. **Rule:** `UnlockBidsIntegrity` - ensures that collateral token balances are properly transferred from the repo locker to the user when unlocking bids.

```solidity
if (collateralTokenCount > 1) {
    assert collateralTokenTwoBalanceAfter == collateralTokenTwoBalanceBefore + idOneTokenTwoAmountToUnlock + (ids.length > 1 ? idTwoTokenTwoAmountToUnlock : 0),
      "collateral token two balance should increase by the amount of collateral token two";
  }
  assert collateralTokenOneBalanceAfter == collateralTokenOneBalanceBefore + idOneTokenOneAmountToUnlock + (ids.length > 1 ? idTwoTokenOneAmountToUnlock : 0),
    "collateral token one balance should increase by the amount of collateral token one";

```

17. **Rule:** `UnlockBidsDoesNotAffectThirdParty` - verifies that unlocking bids belonging to one account does not affect the third party balances.

```solidity
 assert bidIdBefore == bidIdAfter,
    "lockBids should not modify bid id";
  assert bidderBefore == bidderAfter,
    "lockBids should not modify bidder";
  assert bidPriceHashBefore == bidPriceHashAfter,
    "lockBids should not modify bid price hash";
  assert bidRevealedPriceBefore == bidRevealedPriceAfter,
    "lockBids should not modify bid revealed price";
  assert bidAmountBefore == bidAmountAfter,
    "lockBids should not modify bid amount";
  assert bidCollateralAmountBefore == bidCollateralAmountAfter,
    "lockBids should not modify bid collateral amounts";
  assert bidIsRolloverBefore == bidIsRolloverAfter,
    "lockBids should not modify bid rollover status";
  assert bidRolloverAddressBefore == bidRolloverAddressAfter,
    "lockBids should not modify bid rollover address";
  assert bidIsRevealedBefore == bidIsRevealedAfter,
    "lockBids should not modify bid revealed status";

```

18. **Rule:** `UnlockBidsRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
  bool unlockingPaused = unlockingPaused(); // UnlockingPaused
  bool reentrant = harnessReentrancyGuardEntered();
  bool auctionNotOpen = e.block.timestamp < auctionStartTime(); // AuctionNotOpen
  bool auctionNotCancelledForWithdrawal = e.block.timestamp > revealTime() && !termAuction.auctionCancelledForWithdrawal(); // AuctionNotOpen
  bool nonExistentBid = harnessGetInternalBids(unlockBidId).amount == 0; // NonExistentBid

  bool bidNotOwned = harnessGetInternalBids(unlockBidId).bidder != e.msg.sender; // BidNotOwned
  bool rolloverBid = harnessGetInternalBids(unlockBidId).isRollover; // RolloverBid
  bool lockerTransfersPaused = lockerUnlocking.transfersPaused();
  bool collateralManagerNotPairedToLocker = !lockerUnlocking.hasRole(lockerUnlocking.SERVICER_ROLE(), collateralManagerLocking);
  bool bidLockerNotPairedToCollatManager = !collateralManagerUnlocking.hasRole(collateralManagerUnlocking.AUCTION_LOCKER(), currentContract);

  bool nonZeroMsgValue = e.msg.value != 0;

  bool isExpectedToRevert = unlockingPaused || reentrant || auctionNotOpen || auctionNotCancelledForWithdrawal || nonExistentBid || bidNotOwned || rolloverBid ||
  lockerTransfersPaused || collateralManagerNotPairedToLocker || bidLockerNotPairedToCollatManager || nonZeroMsgValue;

  assert isExpectedToRevert <=> lastReverted,
    "unlockBids should revert when revert conditions are met";
```

19. **Rule:** `UnlockBidsMonotonicBehavior` - verifies that unlocking a bid is monotonically decreasing in the bid count.

```solidity
 assert bidCountAfter <= bidCountBefore,
    "unlockBids should decrease or maintain bid count";
```

20. **Rule:** `AuctionUnlockBidIntegrity` - ensures that collateral token balances are properly transferred from the repo locker to the user when unlocking bids.

```solidity
if (bidCollateralTokens.length > 1) {
    assert collateralTokenTwoBalanceAfter == collateralTokenTwoBalanceBefore + amounts[1],
      "collateral token two balance should increase by the amount of collateral token two";
  }
  assert bidCollateralTokens.length == 0 || collateralTokenOneBalanceAfter == collateralTokenOneBalanceBefore + amounts[0],
    "collateral token one balance should increase by the amount of collateral token one";
```

21. **Rule:** `AuctionUnlockBidDoesNotAffectThirdParty` - verifies that unlocking bids belonging to one account does not affect the third party balances.

```solidity
  assert bidIdBefore == bidIdAfter,
    "lockBids should not modify bid id";
  assert bidderBefore == bidderAfter,
    "lockBids should not modify bidder";
  assert bidPriceHashBefore == bidPriceHashAfter,
    "lockBids should not modify bid price hash";
  assert bidRevealedPriceBefore == bidRevealedPriceAfter,
    "lockBids should not modify bid revealed price";
  assert bidAmountBefore == bidAmountAfter,
    "lockBids should not modify bid amount";
  assert bidCollateralAmountBefore == bidCollateralAmountAfter,
    "lockBids should not modify bid collateral amounts";
  assert bidIsRolloverBefore == bidIsRolloverAfter,
    "lockBids should not modify bid rollover status";
  assert bidRolloverAddressBefore == bidRolloverAddressAfter,
    "lockBids should not modify bid rollover address";
  assert bidIsRevealedBefore == bidIsRevealedAfter,
    "lockBids should not modify bid revealed status";

```

22. **Rule:** `AuctionUnlockBidRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool isRollover = harnessGetInternalBidIsRollover(unlockBidId); // RolloverBid
  bool msgValueIsNotZero = e.msg.value != 0;
  bool callerNotAuctioneer = !hasRole(AUCTIONEER_ROLE(), e.msg.sender);
  bool lockerTransfersPaused = lockerUnlocking.transfersPaused();
  bool collateralManagerNotPairedToLocker = !lockerUnlocking.hasRole(lockerUnlocking.SERVICER_ROLE(), collateralManagerLocking);
  bool bidLockerNotPairedToCollatManager = !collateralManagerUnlocking.hasRole(collateralManagerUnlocking.AUCTION_LOCKER(), currentContract);
  bool insufficientLockerBalance = amounts[0] > unlockingAuctionCollateralTokenOne.balanceOf(lockerUnlocking) ||  amounts[1] > unlockingAuctionCollateralTokenTwo.balanceOf(lockerUnlocking);

  bool isExpectedToRevert = isRollover || msgValueIsNotZero || callerNotAuctioneer || lockerTransfersPaused || collateralManagerNotPairedToLocker || bidLockerNotPairedToCollatManager || insufficientLockerBalance;

  assert isExpectedToRevert <=> lastReverted,
    "auctionUnlockBid should revert if it tries to unlock a rollover bid";
```

23. **Rule:** `AuctionUnlockBidMonotonicBehavior` - verifies that `auctionUnlockCollateral` monotonically decreases the bid count.

```solidity
assert bidCountAfter <= bidCountBefore,
    "auctionUnlockBid should decrease or maintain bid count";

```

24. **Rule:** `RevealBidsIntegrity` - ensures that prices are revealed when revealing bids.

```solidity
  assert isRevealedAfter && revealedPriceAfter == price,
    "revealBids should not revert";
```

25. **Rule:** `RevealBidsDoesNotAffectThirdParty` - verifies that revealing a bid belonging to one account does not affect the third party balances.

```solidity
  assert !isThirdPartyRevealedAfter,
    "revealBids should not reveal third party bids";
```

26. **Rule:** `RevealBidsRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool isNotInRevealPhase = e.block.timestamp < revealTime(); // AuctionNotRevealing
  bool isBidPriceModified = harnessGenerateBidPriceHash(price, nonce) != harnessGetInternalBidBidPriceHash(id); // BidPriceModified
  bool isTenderPriceTooHigh = price > MAX_BID_PRICE(); // TenderPriceTooHigh
  bool msgValueNotZero = e.msg.value != 0;

  bool isExpectedToRevert = isNotInRevealPhase || isBidPriceModified || isTenderPriceTooHigh || msgValueNotZero;

  assert lastReverted <=> isExpectedToRevert,
    "revealBids should revert if conditions are met";
```

27. **Rule:** `RevealBidsMonotonicBehavior` - verifies that `revealBids` does not change the bid count.

```solidity
assert bidCountBefore == bidCountAfter,
    "revealBids should not change bid count";
    
```

28. **Rule:** `OnlyRoleCanCallRevert` - checks if a method call requires specific roles to execute successfully, does not revert if the caller has the necessary role.

```solidity
assert !lastReverted => 
        hasRole(ADMIN_ROLE(),e.msg.sender)
        || hasRole(AUCTIONEER_ROLE(),e.msg.sender)
        || hasRole(DEVOPS_ROLE(),e.msg.sender)
        || hasRole(INITIALIZER_ROLE(),e.msg.sender)
        || hasRole(ROLLOVER_MANAGER(),e.msg.sender);

```

29. **Rule:** `OnlyRoleCanCallStorage` - ensures that changes to storage by non-view method calls can only be performed by addresses with specific roles, guarding against unauthorized modifications.

```solidity
assert storeBefore != storeAfter => hasRole(ADMIN_ROLE(),e.msg.sender)
        || hasRole(AUCTIONEER_ROLE(),e.msg.sender)
        || hasRole(DEVOPS_ROLE(),e.msg.sender)
        || hasRole(INITIALIZER_ROLE(),e.msg.sender)
        || hasRole(ROLLOVER_MANAGER(),e.msg.sender);

```

### TermAuctionOfferLocker

1. **Rule:** `PauseLockingCausesOfferLockingToRevert` - verifies that pausing locking reverts any attempts at locking offers.

```solidity
require lockingPaused() == true;
    f@withrevert(e, args);
    assert lastReverted,
      "lockOffers(...) should revert when trying to lock a paused contract";
```

2. **Rule:** `UnpauseLockingAllowsOfferLocking` - verifies that unpausing locking allows users to lock offers.

```solidity

    require lockingPaused() == false;
    f(e, args);
    assert !lastReverted, "lockOffers(...) should not revert when trying to lock offers on an unpaused contract";

```

3. **Rule:** `PauseUnlockingCausesOfferUnlockingToRevert` - verifies that pausing unlocking reverts any attempts at unlocking offers.

```solidity
    require unlockingPaused() == true;
    unlockOffers@withrevert(e, ids);
    assert lastReverted, "unlockOffers(...) should revert when trying to unlock offers on a paused contract";
```

4. **Rule:** `UnpauseUnlockingAllowsOfferUnlocking` - verifies that unpausing unlocking allows users to unlock offers.

```solidity
    require unlockingPaused() == false;
    require harnessGetInternalOffers(id).id == id;
    unlockOffers(e, [id]);
    assert !lastReverted, "unlockOffers(...) should not revert when trying to unlock offers on an unpaused contract";
```

5. **Invariant:** `LockedOfferIdAlwaysMatchesIndex` - verifies the assumption that the offerId matches the ledger.

```solidity
    harnessGetInternalOfferId(offerId) == offerId || harnessGetInternalOfferId(offerId) == to_bytes32(0);

```

6. **Invariant:** `OfferCountAlwaysMatchesNumberOfStoredOffers` - verifies the assumption that the offerCount always matches the ledger.

```solidity
    to_mathint(offerCount()) == lockedOfferCount;

```

7. **Rule:** `lockerPurchaseTokenBalanceGreaterThanOfferLedgerBalance` - verifies the assumption that total purchaseToken balances are always greater than or equal to the amount recorded in ledger.

```solidity
    require(sumOfOfferBalances <= to_mathint((offerStatePurchaseToken.balanceOf(repoLockerOfferState)))); // starting condition

    f(e, args);

    assert sumOfOfferBalances <= to_mathint((offerStatePurchaseToken.balanceOf(repoLockerOfferState)));
```

8. **Rule:** `LockOffersIntegrity` - ensures that purchase token balances are properly transferred to the repo locker when locking offers.

```solidity
assert (purchaseTokenOneBalanceAfter == purchaseTokenBalanceBefore - amountToLock),
    "lockOffers should transfer collateral tokens from offeror to contract";

```

9. **Rule:** `LockOffersDoesNotAffectThirdParty` - verifies that locking offers belonging to one account does not affect the third party balances.

```solidity
assert offerIdBefore == offerIdAfter,
    "lockRolloverOffer should not modify offer id";
  assert offerorBefore == offerorAfter,
    "lockRolloverOffer should not modify offeror";
  assert offerPriceHashBefore == offerPriceHashAfter,
    "lockRolloverOffer should not modify offer price hash";
  assert offerRevealedPriceBefore == offerRevealedPriceAfter,
    "lockRolloverOffer should not modify offer revealed price";
  assert offerAmountBefore == offerAmountAfter,
    "lockRolloverOffer should not modify offer amount";
  assert offerIsRevealedBefore == offerIsRevealedAfter,
    "lockRolloverOffer should not modify offer revealed status";
```

10. **Rule:** `LockOffersMonotonicBehavior` - verifies that locking offers is monotonically increasing in the offer count.

```solidity
assert offerCountAfter >= offerCountBefore,
    "offerCount should increment or maintain the same value after locking an offer";
```

11. **Rule:** `LockOffersRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
 bool offerIdAlreadyExists = existingGeneratedOffer.amount != 0 && existingOffer.amount == 0 ; // OfferIdAlreadyExists

  bool auctionNotOpen = e.block.timestamp < auctionStartTime() || e.block.timestamp > revealTime(); // AuctionNotOpen
  bool lockingPaused = lockingPaused(); // LockingPaused
  bool reentrant = harnessReentrancyGuardEntered();
  bool notSameOfferor = offerSubmissions[0].offeror != e.msg.sender ? true : false; // OfferNotOwned
  bool offerCountReached = offerCount() >= MAX_OFFER_COUNT() ? true : false; // MaxOfferCountReached
  bool offerNotOwned = harnessGetInternalOffers(offerSubmissions[0].id).amount != 0 && harnessGetInternalOffers(offerSubmissions[0].id).offeror != offerSubmissions[0].offeror; // OfferNotOwned

  bool editingOfferNotOwned = existingOfferAmount != 0
    && existingOfferor != offerSubmissions[0].offeror; // OfferNotOwned
  
  bool purchaseTokenNotApproved = offerSubmissions[0].purchaseToken != purchaseToken() ? true : false; // PurchaseTokenNotApproved
  bool offerAmountTooLow = offerSubmissions[0].amount < minimumTenderAmount(); // OfferAmountTooLow
  bool purchaseTokenBalanceTooLow = existingOfferAmount < offerSubmissions[0].amount  && lockingAuctionPurchaseToken.balanceOf(offerSubmissions[0].offeror) < offerDiff;
  bool purchaseTokenApprovalsTooLow = existingOfferAmount < offerSubmissions[0].amount && lockingAuctionPurchaseToken.allowance(offerSubmissions[0].offeror, repoLockerUnlocking) < offerDiff;
  bool lockerTransfersPaused = existingOfferAmount != offerSubmissions[0].amount && repoLockerOfferLocking.transfersPaused();
  bool repoServicerNotPairedToLocker = existingOfferAmount != offerSubmissions[0].amount && !repoLockerOfferLocking.hasRole(repoLockerOfferLocking.SERVICER_ROLE(), repoServicerLocking);
  bool offerLockerNotPairedToRepoServicer = existingOfferAmount != offerSubmissions[0].amount && !repoServicerLocking.hasRole(repoServicerLocking.AUCTION_LOCKER(), currentContract);

  bool nonZeroMsgValue = e.msg.value != 0;

  bool isExpectedToRevert =
    auctionNotOpen || lockingPaused || reentrant || notSameOfferor ||
    offerCountReached || offerNotOwned || editingOfferNotOwned || offerIdAlreadyExists ||
    purchaseTokenNotApproved || offerAmountTooLow || purchaseTokenBalanceTooLow || purchaseTokenApprovalsTooLow || lockerTransfersPaused 
    || repoServicerNotPairedToLocker || offerLockerNotPairedToRepoServicer || nonZeroMsgValue;
    
    assert lastReverted <=> isExpectedToRevert,
    "lockOffers should revert when one of the revert conditions is reached";
```

12. **Rule:** `LockOffersWithReferralIntegrity` - ensures that purchase token balances are properly transferred to the repo locker when locking offers with referral.

```solidity
assert (purchaseTokenOneBalanceAfter == purchaseTokenBalanceBefore - amountToLock),
    "lockOffers should transfer collateral tokens from offeror to contract";

```

13. **Rule:** `LockOffersWithReferralDoesNotAffectThirdParty` - verifies that locking offers belonging to one account when calling `lockOffersWithReferral` does not affect the third party balances

```solidity
   assert offerIdBefore == offerIdAfter,
    "lockRolloverOffer should not modify offer id";
  assert offerorBefore == offerorAfter,
    "lockRolloverOffer should not modify offeror";
  assert offerPriceHashBefore == offerPriceHashAfter,
    "lockRolloverOffer should not modify offer price hash";
  assert offerRevealedPriceBefore == offerRevealedPriceAfter,
    "lockRolloverOffer should not modify offer revealed price";
  assert offerAmountBefore == offerAmountAfter,
    "lockRolloverOffer should not modify offer amount";
  assert offerIsRevealedBefore == offerIsRevealedAfter,
    "lockRolloverOffer should not modify offer revealed status";
```

14. **Rule:** `LockOffersWithReferralRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

<pre class="language-solidity"><code class="lang-solidity"><strong>  bool auctionNotOpen = e.block.timestamp &#x3C; auctionStartTime() || e.block.timestamp > revealTime(); // AuctionNotOpen
</strong>  bool lockingPaused = lockingPaused(); // LockingPaused
  bool sameReferral = e.msg.sender == referrer; // InvalidSelfReferral
  bool notSameOfferor = offerSubmissions[0].offeror != e.msg.sender ? true : false; // OfferNotOwned
  bool offerCountReached = offerCount() >= MAX_OFFER_COUNT() ? true : false; // MaxOfferCountReached
  bool offerNotOwned = harnessGetInternalOffers(offerSubmissions[0].id).amount != 0 &#x26;&#x26; harnessGetInternalOffers(offerSubmissions[0].id).offeror != offerSubmissions[0].offeror; // OfferNotOwned
  bool purchaseTokenNotApproved = offerSubmissions[0].purchaseToken != purchaseToken() ? true : false; // PurchaseTokenNotApproved
  bool offerAmountTooLow = offerSubmissions[0].amount &#x3C; minimumTenderAmount(); // OfferAmountTooLow

  bool isExpectedToRevert =
    auctionNotOpen || lockingPaused || notSameOfferor ||
    offerCountReached || offerNotOwned ||
    purchaseTokenNotApproved || offerAmountTooLow;

  assert lastReverted &#x3C;=> isExpectedToRevert,
    "lockOffersWithReferral should revert when one of the revert conditions is reached";
</code></pre>

15. **Rule:** `LockOffersWithReferralMonotonicBehavior` - verifies that locking offers with referral is monotonically increasing in the offer count.

```solidity
assert offerCountAfter >= offerCountBefore,
    "offerCount should increment or maintain the same value after locking an offer";
```

16. **Rule:** `UnlockOffersIntegrity` - ensures that purchase token balances are properly transferred to user when unlocking offers.

```solidity
 assert (purchaseTokenBalanceAfter == (purchaseTokenBalanceBefore + purchaseTokenAmountToUnlock)),
    "unlockOffers should not revert";
```

17. **Rule:** `UnlockOffersDoesNotAffectThirdParty` - verifies that unlocking offers belonging to one account does not affect the third party balances

```solidity
   assert thirdPartyOfferAffected,
     "unlockOffers should not modify offers that are not in args"; 
```

18. **Rule:** `UnlockOffersRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
  bool unlockingPaused = unlockingPaused(); // UnlockingPaused
  bool reentrant = harnessReentrancyGuardEntered();
  bool auctionNotOpen = e.block.timestamp < auctionStartTime(); // AuctionNotOpen
  bool auctionNotCancelledForWithdrawal = e.block.timestamp > revealTime() && !termAuction.auctionCancelledForWithdrawal(); // AuctionNotOpen
  bool nonExistentOffer = harnessGetInternalOffers(unlockOfferId).amount == 0; // NonExistentOffer
  bool offerNotOwned = harnessGetInternalOffers(unlockOfferId).offeror != e.msg.sender; // OfferNotOwned

  bool lockerTransfersPaused = repoLockerUnlocking.transfersPaused();
  bool repoServicerNotPairedToLocker = !repoLockerUnlocking.hasRole(repoLockerUnlocking.SERVICER_ROLE(), repoServicerUnlocking);
  bool offerLockerNotPairedToRepoServicer = !repoServicerUnlocking.hasRole(repoServicerUnlocking.AUCTION_LOCKER(), currentContract);

  bool nonZeroMsgValue = e.msg.value != 0;

  bool isExpectedToRevert = unlockingPaused || reentrant || auctionNotOpen || auctionNotCancelledForWithdrawal || nonExistentOffer || offerNotOwned 
  || lockerTransfersPaused || repoServicerNotPairedToLocker ||  offerLockerNotPairedToRepoServicer || nonZeroMsgValue;

  assert isExpectedToRevert <=> lastReverted,
    "unlockOffers should revert when revert conditions are met";

```

19. **Rule:** `UnlockOffersMonotonicBehavior` - verifies that unlocking offers is monotonically decreasing in the offer count.

```solidity
assert offerCountAfter == assert_uint256(offerCountBefore - unlockOfferIds.length),
    "offerCount should decrement by the number of offer ids submitted to unlock";
```

20. **Rule:** `UnlockOfferPartialIntegrity` - ensures that purchase token balances are properly transferred to user when partially unlocking offers.

```solidity
assert purchaseTokenBalancAfter == purchaseTokenBalanceBefore + amount,
    "purchase token balance should increase by the provided amount";

```

21. **Rule:** `UnlockOfferPartialDoesNotAffectThirdParty` - verifies that partially unlocking offers belonging to one account does not affect the third party balances

```solidity
assert thirdPartyOfferNotAffected,
    "unlockOfferPartial should not modify offers that are not in args";

```

22. **Rule:** `UnlockOfferPartialRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity
bool msgValueNotZero = e.msg.value != 0;
  bool notAuctioneer = !hasRole(AUCTIONEER_ROLE(), e.msg.sender);
  bool lockerNotAuctionLocker = !repoServicerUnlocking.hasRole(repoServicerUnlocking.AUCTION_LOCKER(), currentContract);
  bool servicerNotServicer = !repoLockerUnlocking.hasRole(repoLockerUnlocking.SERVICER_ROLE(), repoServicerUnlocking);
  bool insufficientLockerBalance = amount > unlockingAuctionPurchaseToken.balanceOf(repoLockerUnlocking);
  bool lockerTransfersPaused = repoLockerUnlocking.transfersPaused();

  bool isExpectedToRevert =
    msgValueNotZero ||
    notAuctioneer ||
    lockerNotAuctionLocker ||
    servicerNotServicer ||
    insufficientLockerBalance ||
    lockerTransfersPaused;

  assert isExpectedToRevert == lastReverted,
    "unlockOfferPartial should revert when revert conditions are met";

```

23. **Rule:** `UnlockOfferPartialMonotonicBehavior` - verifies that partially unlocking offers does not change the offer count.

```solidity
assert offerCountAfter == offerCountBefore,
    "unlockOfferPartial should not affect the offerCount";
}
```

24. **Rule:** `RevealOffersIntegrity` - ensures that prices are revealed when revealing offers.

```solidity

    assert isRevealedAfter && revealedPriceAfter == price, "revealOffers should successfully reveal offers";

```

25. **Rule:** `RevealOffersDoesNotAffectThirdParty` - verifies that revealing offers belonging to one account does not affect the third party balances

```solidity
    assert !isThirdPartyRevealedAfter, "revealOffers should not affect third-party offers";
}

```

26. **Rule:** `RevealOffersRevertConditions`- check for revert under the defined expected conditions, ensuring operation adherence to defined rules.

```solidity

  bool isNotInRevealPhase = e.block.timestamp < revealTime(); // AuctionNotRevealing
  bool isOfferPriceModified = harnessGenerateOfferPriceHash(price, nonce) != harnessGetInternalOfferOfferPriceHash(id); // OfferPriceModified
  bool isTenderPriceTooHigh = price > MAX_OFFER_PRICE(); // TenderPriceTooHigh
  bool msgValueNotZero = e.msg.value != 0;

  bool isExpectedToRevert = isNotInRevealPhase || isOfferPriceModified || isTenderPriceTooHigh || msgValueNotZero;

  assert lastReverted <=> isExpectedToRevert,
    "revealOffers should revert if conditions are met";

```

27. **Rule:** `RevealOffersMonotonicBehavior` - verifies that revealing offers does not change the offer count.

```solidity

    assert offerCountBefore == offerCountAfter, "revealOffers should not change the offer count";

```

28. **Rule:** `OnlyRoleCanCallRevert` - checks if a method call requires specific roles to execute successfully, does not revert if the caller has the necessary role.

```solidity

    assert !lastReverted =>
        hasRole(ADMIN_ROLE(), e.msg.sender) ||
        hasRole(AUCTIONEER_ROLE(), e.msg.sender) ||
        hasRole(DEVOPS_ROLE(), e.msg.sender) ||
        hasRole(INITIALIZER_ROLE(), e.msg.sender);

```

29. **Rule:** `OnlyRoleCanCallStorage` - ensures that changes to storage by non-view method calls can only be performed by addresses with specific roles, guarding against unauthorized modifications.

```solidity

    assert storeBefore != storeAfter =>
        hasRole(ADMIN_ROLE(), e.msg.sender) ||
        hasRole(AUCTIONEER_ROLE(), e.msg.sender) ||
        hasRole(DEVOPS_ROLE(), e.msg.sender) ||
        hasRole(INITIALIZER_ROLE(), e.msg.sender);

```

### TermAuction

1. **Rule:** `OnlyRoleCanCallRevert` - checks if a method call requires specific roles to execute successfully, does not revert if the caller has the necessary role.

```solidity

    assert !lastReverted =>
        hasRole(ADMIN_ROLE(), e.msg.sender) ||
        hasRole(DEVOPS_ROLE(), e.msg.sender) ||
        hasRole(INITIALIZER_ROLE(), e.msg.sender);

```

2. **Rule:** `OnlyRoleCanCallStorage` - ensures that changes to storage by non-view method calls can only be performed by addresses with specific roles, guarding against unauthorized modifications.

```solidity

    assert storeBefore != storeAfter =>
        hasRole(ADMIN_ROLE(), e.msg.sender) ||
        hasRole(DEVOPS_ROLE(), e.msg.sender) ||
        hasRole(INITIALIZER_ROLE(), e.msg.sender);

```

3. **Rule:** `OnlyRoleCanCallRevertCompleteAuction` **and** `OnlyRoleCanCallStorageCompleteAuction` - verifies that the `completeAuction` call where unrevealed bids exists requires specific roles to execute successfully, does not revert if the caller has the necessary role.

```solidity

    assert !lastReverted =>
        hasRole(ADMIN_ROLE(), e.msg.sender) ||
        (completeAuctionInput.unrevealedBidSubmissions.length == 0 && completeAuctionInput.unrevealedOfferSubmissions.length == 0);

```

4. **Rule:** `OnlyRoleCanCallStorageCompleteAuction` - ensures that changes to storage by the `completeAuction` call where unrevealed bids exists can only be performed by addresses with the admin role, guarding against unauthorized auction clearing where unrevealed bids exist.

```solidity

    assert storeBefore != storeAfter =>
        hasRole(ADMIN_ROLE(), e.msg.sender) ||
        (completeAuctionInput.unrevealedBidSubmissions.length == 0 && completeAuctionInput.unrevealedOfferSubmissions.length == 0);

```

## Getting Started

Install `certora-cli` package with `pip install certora-cli`. To verify specification files, pass to `certoraRun` the corresponding configuration file in the `[certora/confs](<https://github.com/morpho-org/morpho-blue/blob/2ffb6821815ec542c78e0d0379b5e7094d6fd37a/certora/confs>)` folder. It requires having set the `CERTORAKEY` environment variable to a valid Certora key. You can also pass additional arguments, notably to verify a specific rule. For example, at the root of the repository:

```
certoraRun certora/confs/termRepoServicer.conf --rule mintOpenExposureIntegrity
```


# \[Ethereum]

{% tabs %}
{% tab title="2.1.0" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

<table><thead><tr><th width="228.66666666666666">Protocol Contract</th><th>Implementation Address</th><th>Proxy Address</th></tr></thead><tbody><tr><td>TermController</td><td><a href="https://etherscan.io/address/0x2879C9D15406e7EBD46770f4B0781Fe665f9da1b"><code>0x2879C9D15406e7EBD46770f4B0781Fe665f9da1b</code></a></td><td><a href="https://etherscan.io/address/0xd902EBb8AEb832643af38f43d466a6155cD8Bd5A#writeProxyContract"><code>0xd902EBb8AEb832643af38f43d466a6155cD8Bd5A</code></a></td></tr><tr><td>TermEventEmitter</td><td><a href="https://etherscan.io/address/0x1c41CC8495CF570b825FcF17eC4C9159E728cc4a#code"><code>0x1c41CC8495CF570b825FcF17eC4C9159E728cc4a</code></a></td><td><a href="https://etherscan.io/address/0xf021B31282a60528B2F47D07Ce353da870be78b3#readProxyContract"><code>0xf021B31282a60528B2F47D07Ce353da870be78b3</code></a></td></tr><tr><td>TermPriceConsumerV3</td><td><a href="https://etherscan.io/address/0x47D437Bb536Ba279762EBDeCA2F10de654816F38#code"><code>0x47D437Bb536Ba279762EBDeCA2F10de654816F38</code></a></td><td><a href="https://etherscan.io/address/0x13Ca4ddB295d621761057D682a1c7b5f5D7Bba4c#code"><code>0x13Ca4ddB295d621761057D682a1c7b5f5D7Bba4c</code></a></td></tr><tr><td>TermInitializer</td><td><a href="https://etherscan.io/address/0xc6d96f1752dbc73276c3e6b07c04d04c61fc2cd6#code"><code>0xc6d96f1752dbc73276c3e6b07c04d04c61fc2cd6</code></a></td><td><code>NA</code></td></tr></tbody></table>

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                       |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0x268Cb106DDD13bCE313505bD976b644C298d3c34`](https://etherscan.io/address/0x268Cb106DDD13bCE313505bD976b644C298d3c34#code) |
| TermAuctionBidLocker   | [`0x67bB61554180d23790ae0d7B7DF0d582DE3D0F11`](https://etherscan.io/address/0x67bB61554180d23790ae0d7B7DF0d582DE3D0F11#code) |
| TermAuctionOfferLocker | [`0x12e85C509F6F71e058C6D5eafb53AF3C4BB791E6`](https://etherscan.io/address/0x12e85C509F6F71e058C6D5eafb53AF3C4BB791E6#code) |

\
**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

<table><thead><tr><th width="350">Repo Contracts</th><th>Implementation Address</th></tr></thead><tbody><tr><td>TermRepoCollateralManager</td><td><a href="https://etherscan.io/address/0xb99F5a082465b4cD8037E28Ac7e0BF81B609Df53#code"><code>0xb99F5a082465b4cD8037E28Ac7e0BF81B609Df53</code></a></td></tr><tr><td>TermRepoServicer</td><td><a href="https://etherscan.io/address/0x61258DeCab510b0Ac39B0873E5464E68d5041Ab1#code"><code>0x61258DeCab510b0Ac39B0873E5464E68d5041Ab1</code></a></td></tr><tr><td>TermRepoRolloverManager</td><td><a href="https://etherscan.io/address/0x670FBaea148F5082EA4DAc541B1fE67Be3493D1e#code"><code>0x670FBaea148F5082EA4DAc541B1fE67Be3493D1e</code></a></td></tr><tr><td>TermRepoLocker</td><td><a href="https://etherscan.io/address/0xFCf4eF17D1BC11dF6c6200A809C54cB06F16e86e#code"><code>0xFCf4eF17D1BC11dF6c6200A809C54cB06F16e86e</code></a></td></tr><tr><td>TermRepoToken</td><td><a href="https://etherscan.io/address/0xb481Db29312cEdc1956090d24a5B3b5fcfaA8b9F#code"><code>0xb481Db29312cEdc1956090d24a5B3b5fcfaA8b9F</code></a></td></tr></tbody></table>
{% endtab %}

{% tab title="0.9.0" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

<table><thead><tr><th width="228.66666666666666">Protocol Contract</th><th>Implementation Address</th><th>Proxy Address</th></tr></thead><tbody><tr><td>TermController</td><td><a href="https://etherscan.io/token/0x73b47fcC02Aa3774c67865c1f3D65640f2C29A95#code"><code>0x73b47fcC02Aa3774c67865c1f3D65640f2C29A95</code></a></td><td><a href="https://etherscan.io/address/0x21FC7B250CCAeECDb2abb38e04617D1f24D98772"><code>0x21FC7B250CCAeECDb2abb38e04617D1f24D98772</code></a></td></tr><tr><td>TermEventEmitter</td><td><a href="https://etherscan.io/token/0xFeD347E7Ecb227eaaffae7b428C0447981283156#code"><code>0xFeD347E7Ecb227eaaffae7b428C0447981283156</code></a></td><td><a href="https://etherscan.io/address/0x4C6Aeb4E8dBBAF53c13AF495c847D4eC68994bD4"><code>0x4C6Aeb4E8dBBAF53c13AF495c847D4eC68994bD4</code></a></td></tr><tr><td>TermPriceConsumerV3</td><td><a href="https://etherscan.io/token/0xC3E49355fCf95AF200250843D3872203589E6204#code"><code>0xC3E49355fCf95AF200250843D3872203589E6204</code></a></td><td><a href="https://etherscan.io/address/0x04fCd15C3582F0Fa81a46533795196a5257f79C8"><code>0x04fCd15C3582F0Fa81a46533795196a5257f79C8</code></a></td></tr><tr><td>TermInitializer</td><td><a href="https://etherscan.io/token/0x155c07b833D660617a1BD42Deb95D9862C10C16b#code"><code>0x155c07b833D660617a1BD42Deb95D9862C10C16b</code></a></td><td><code>NA</code></td></tr></tbody></table>

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                       |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0xE94DfE01cbD8f86299b6bd260a52908345B8CB9A`](https://etherscan.io/address/0xE94DfE01cbD8f86299b6bd260a52908345B8CB9A)      |
| TermAuctionBidLocker   | [`0xEC2125566ee98761d0605E42B0c3b2adeB051007`](https://etherscan.io/address/0xEC2125566ee98761d0605E42B0c3b2adeB051007#code) |
| TermAuctionOfferLocker | [`0x11B11b89Fa31D3A3125320F128b16E90EBc3838e`](https://etherscan.io/address/0x11B11b89Fa31D3A3125320F128b16E90EBc3838e#code) |

\
**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

<table><thead><tr><th width="350">Repo Contracts</th><th>Implementation Address</th></tr></thead><tbody><tr><td>TermRepoCollateralManager</td><td><a href="https://etherscan.io/address/0x6A2E09F23Ef3a1f5ECEd9d4DAeD3b27d181F93e1#code"><code>0x6A2E09F23Ef3a1f5ECEd9d4DAeD3b27d181F93e1</code></a></td></tr><tr><td>TermRepoServicer</td><td><a href="https://etherscan.io/address/0x06528722fF473d89b337405786e82C5F92717594#code"><code>0x06528722fF473d89b337405786e82C5F92717594</code></a></td></tr><tr><td>TermRepoRolloverManager</td><td><a href="https://etherscan.io/address/0xeA93EA14B7Ad812C1769A353D226e6b0899B347d#code"><code>0xeA93EA14B7Ad812C1769A353D226e6b0899B347d</code></a></td></tr><tr><td>TermRepoLocker</td><td><a href="https://etherscan.io/address/0xa241F9ee0EdAc5C66dD9d95B4dF20EA386F577BB#code"><code>0xa241F9ee0EdAc5C66dD9d95B4dF20EA386F577BB</code></a></td></tr><tr><td>TermRepoToken</td><td><a href="https://etherscan.io/address/0x68D05b886642Aa5401Fa152FBe90a1504a0479d6#code"><code>0x68D05b886642Aa5401Fa152FBe90a1504a0479d6</code></a></td></tr></tbody></table>
{% endtab %}

{% tab title="0.6.0" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

<table><thead><tr><th width="228.66666666666666">Protocol Contract</th><th>Implementation Address</th><th>Proxy Address</th></tr></thead><tbody><tr><td>TermController</td><td><a href="https://etherscan.io/address/0x4c39f8b130ff1cfc7ecdc8e9917b11bf37f5d2df#code"><code>0x4C39F8b130FF1cfc7EcDc8e9917b11BF37F5d2Df</code></a></td><td><a href="https://etherscan.io/address/0x62f476DBB9B60D9272e26994525F4Db80Fd543e4"><code>0x62f476DBB9B60D9272e26994525F4Db80Fd543e4</code></a></td></tr><tr><td>TermEventEmitter</td><td><a href="https://etherscan.io/address/0x062663509b99D508119cf9aC524332509Bf7fe86"><code>0x062663509b99D508119cf9aC524332509Bf7fe86</code></a></td><td><a href="https://etherscan.io/address/0xc60e0f5cD9EE7ACd22dB42F7f56A67611ab6429F"><code>0xc60e0f5cD9EE7ACd22dB42F7f56A67611ab6429F</code></a></td></tr><tr><td>TermPriceConsumerV3</td><td><a href="https://etherscan.io/address/0x1D2508c50bfDAa0c046c385544d90FC56c46C4c5"><code>0x1D2508c50bfDAa0c046c385544d90FC56c46C4c5</code></a></td><td><a href="https://etherscan.io/address/0x9FB401e23fB5632FaFEB96E8bc872BEE19D3e6C5"><code>0x9FB401e23fB5632FaFEB96E8bc872BEE19D3e6C5</code></a></td></tr><tr><td>TermInitializer</td><td><a href="https://etherscan.io/address/0x5a9fC6C2F9d8976DC78Ed208c79116676CD5FD3F"><code>0x5a9fC6C2F9d8976DC78Ed208c79116676CD5FD3F</code></a></td><td><code>NA</code></td></tr></tbody></table>

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                  |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0x3552258c0e4DA5C5148818be15A776e539a41Ead`](https://etherscan.io/address/0x3552258c0e4DA5C5148818be15A776e539a41Ead) |
| TermAuctionBidLocker   | [`0xA96b1611cC45f8411B26631472259413C797B474`](https://etherscan.io/address/0xA96b1611cC45f8411B26631472259413C797B474) |
| TermAuctionOfferLocker | [`0x3285FF3F510D61C69c6A217278f574395c11A04c`](https://etherscan.io/address/0x3285FF3F510D61C69c6A217278f574395c11A04c) |

\
**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

<table><thead><tr><th width="350">Repo Contracts</th><th>Implementation Address</th></tr></thead><tbody><tr><td>TermRepoCollateralManager</td><td><a href="https://etherscan.io/address/0xD7Fc64CC9E5345Fa5f26B31c92216781B4faE65A"><code>0xD7Fc64CC9E5345Fa5f26B31c92216781B4faE65A</code></a></td></tr><tr><td>TermRepoServicer</td><td><a href="https://etherscan.io/address/0xB1d418C44adA2Dcd5a39605C6629c44EC86a069B"><code>0xB1d418C44adA2Dcd5a39605C6629c44EC86a069B</code></a></td></tr><tr><td>TermRepoRolloverManager</td><td><a href="https://etherscan.io/address/0x245dE1fD2782dD55C1E1c14533171A54a0c96713"><code>0x245dE1fD2782dD55C1E1c14533171A54a0c96713</code></a></td></tr><tr><td>TermRepoLocker</td><td><a href="https://etherscan.io/address/0x92E5028315eC168da29dC1Bfc4d0E54Defd0648E"><code>0x92E5028315eC168da29dC1Bfc4d0E54Defd0648E</code></a></td></tr><tr><td>TermRepoToken</td><td><a href="https://etherscan.io/address/0xDBb134f2e318FeDa60bAe521303b53C132AAF0c7"><code>0xDBb134f2e318FeDa60bAe521303b53C132AAF0c7</code></a></td></tr></tbody></table>
{% endtab %}

{% tab title="0.4.6" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                  | Proxy Address                                                                                                           |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0xD5b6b9A938e8d78597DCa20B1843Bba1823B79EE`](https://etherscan.io/address/0xD5b6b9A938e8d78597DCa20B1843Bba1823B79EE) | [`0xCEE55c9286b9fBd3eC8c50Cc93CfebE7090E02Af`](https://etherscan.io/address/0xCEE55c9286b9fBd3eC8c50Cc93CfebE7090E02Af) |
| TermEventEmitter    | [`0x529fDc0971D7a3CAeDef43fb3144A0f5C9F0D607`](https://etherscan.io/address/0x529fDc0971D7a3CAeDef43fb3144A0f5C9F0D607) | [`0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3`](https://etherscan.io/address/0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3) |
| TermPriceConsumerV3 | [`0x5a8562E19551925d301155571808dd2535D82805`](https://etherscan.io/address/0x5a8562E19551925d301155571808dd2535D82805) | [`0x96Cb2fd2432d47675Ce35705AFA6A88889937b1C`](https://etherscan.io/address/0x96Cb2fd2432d47675Ce35705AFA6A88889937b1C) |
| TermInitializer     | [`0x9cB21e2B82a2235fe9fAa542E409850ac8b51bB6`](https://etherscan.io/address/0x9cB21e2B82a2235fe9fAa542E409850ac8b51bB6) | `NA`                                                                                                                    |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                       |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0x1Cd6480A836EaBC66288Ec4e8735d9442511F957`](https://etherscan.io/address/0x1Cd6480A836EaBC66288Ec4e8735d9442511F957)      |
| TermAuctionBidLocker   | [`0x5F7ff77249A309d6a670CbEC6Ce2A8587ff6306c`](https://etherscan.io/address/0x5F7ff77249A309d6a670CbEC6Ce2A8587ff6306c)      |
| TermAuctionOfferLocker | [`0xAD7F2A936bE83D78D1674DA19ED8a428E23b7508`](https://etherscan.io/address/0xAD7F2A936bE83D78D1674DA19ED8a428E23b7508#code) |

\
**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                  |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0xf7ebE094b0C94b10E3776451b238CC7bAA3B5FBc`](https://etherscan.io/address/0xf7ebE094b0C94b10E3776451b238CC7bAA3B5FBc) |
| TermRepoServicer          | [`0x01c5AFdC4d40d4632c630E8371c49088084EA9c3`](https://etherscan.io/address/0x01c5AFdC4d40d4632c630E8371c49088084EA9c3) |
| TermRepoRolloverManager   | [`0x83E3A19fb44E0c99a39E5484a8FCC1C79aB0788A`](https://etherscan.io/address/0x83E3A19fb44E0c99a39E5484a8FCC1C79aB0788A) |
| TermRepoLocker            | [`0x5aD7d46d3C15D3A4049de67f2386AcF55A466450`](https://etherscan.io/address/0x5aD7d46d3C15D3A4049de67f2386AcF55A466450) |
| TermRepoToken             | [`0x542f335Cd30148C82DB2d3AC32eCCa154257EA00`](https://etherscan.io/address/0x542f335Cd30148C82DB2d3AC32eCCa154257EA00) |
| {% endtab %}              |                                                                                                                         |

{% tab title="0.4.5" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                  | Proxy Address                                                                                                           |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0xD5b6b9A938e8d78597DCa20B1843Bba1823B79EE`](https://etherscan.io/address/0xD5b6b9A938e8d78597DCa20B1843Bba1823B79EE) | [`0xCEE55c9286b9fBd3eC8c50Cc93CfebE7090E02Af`](https://etherscan.io/address/0xCEE55c9286b9fBd3eC8c50Cc93CfebE7090E02Af) |
| TermEventEmitter    | [`0x529fDc0971D7a3CAeDef43fb3144A0f5C9F0D607`](https://etherscan.io/address/0x529fDc0971D7a3CAeDef43fb3144A0f5C9F0D607) | [`0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3`](https://etherscan.io/address/0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3) |
| TermPriceConsumerV3 | [`0x5a8562E19551925d301155571808dd2535D82805`](https://etherscan.io/address/0x5a8562E19551925d301155571808dd2535D82805) | [`0x96Cb2fd2432d47675Ce35705AFA6A88889937b1C`](https://etherscan.io/address/0x96Cb2fd2432d47675Ce35705AFA6A88889937b1C) |
| TermInitializer     | [`0x9cB21e2B82a2235fe9fAa542E409850ac8b51bB6`](https://etherscan.io/address/0x9cB21e2B82a2235fe9fAa542E409850ac8b51bB6) | `NA`                                                                                                                    |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                       |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0x1Cd6480A836EaBC66288Ec4e8735d9442511F957`](https://etherscan.io/address/0x1Cd6480A836EaBC66288Ec4e8735d9442511F957)      |
| TermAuctionBidLocker   | [`0x2161F952FCe31b86caa54F1517164eF350945acA`](https://etherscan.io/address/0x2161F952FCe31b86caa54F1517164eF350945acA)      |
| TermAuctionOfferLocker | [`0xAD7F2A936bE83D78D1674DA19ED8a428E23b7508`](https://etherscan.io/address/0xAD7F2A936bE83D78D1674DA19ED8a428E23b7508#code) |

\
**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                  |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0xf7ebE094b0C94b10E3776451b238CC7bAA3B5FBc`](https://etherscan.io/address/0xf7ebE094b0C94b10E3776451b238CC7bAA3B5FBc) |
| TermRepoServicer          | [`0x01c5AFdC4d40d4632c630E8371c49088084EA9c3`](https://etherscan.io/address/0x01c5AFdC4d40d4632c630E8371c49088084EA9c3) |
| TermRepoRolloverManager   | [`0x83E3A19fb44E0c99a39E5484a8FCC1C79aB0788A`](https://etherscan.io/address/0x83E3A19fb44E0c99a39E5484a8FCC1C79aB0788A) |
| TermRepoLocker            | [`0x5aD7d46d3C15D3A4049de67f2386AcF55A466450`](https://etherscan.io/address/0x5aD7d46d3C15D3A4049de67f2386AcF55A466450) |
| TermRepoToken             | [`0x542f335Cd30148C82DB2d3AC32eCCa154257EA00`](https://etherscan.io/address/0x542f335Cd30148C82DB2d3AC32eCCa154257EA00) |
| {% endtab %}              |                                                                                                                         |

{% tab title="0.4.4" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                  | Proxy Address                                                                                                           |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0xD5b6b9A938e8d78597DCa20B1843Bba1823B79EE`](https://etherscan.io/address/0xD5b6b9A938e8d78597DCa20B1843Bba1823B79EE) | [`0xCEE55c9286b9fBd3eC8c50Cc93CfebE7090E02Af`](https://etherscan.io/address/0xCEE55c9286b9fBd3eC8c50Cc93CfebE7090E02Af) |
| TermEventEmitter    | [`0x529fDc0971D7a3CAeDef43fb3144A0f5C9F0D607`](https://etherscan.io/address/0x529fDc0971D7a3CAeDef43fb3144A0f5C9F0D607) | [`0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3`](https://etherscan.io/address/0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3) |
| TermPriceConsumerV3 | [`0x5a8562E19551925d301155571808dd2535D82805`](https://etherscan.io/address/0x5a8562E19551925d301155571808dd2535D82805) | [`0x96Cb2fd2432d47675Ce35705AFA6A88889937b1C`](https://etherscan.io/address/0x96Cb2fd2432d47675Ce35705AFA6A88889937b1C) |
| TermInitializer     | [`0x9cB21e2B82a2235fe9fAa542E409850ac8b51bB6`](https://etherscan.io/address/0x9cB21e2B82a2235fe9fAa542E409850ac8b51bB6) | `NA`                                                                                                                    |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                  |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0x1Cd6480A836EaBC66288Ec4e8735d9442511F957`](https://etherscan.io/address/0x1Cd6480A836EaBC66288Ec4e8735d9442511F957) |
| TermAuctionBidLocker   | [`0x2161F952FCe31b86caa54F1517164eF350945acA`](https://etherscan.io/address/0x2161F952FCe31b86caa54F1517164eF350945acA) |
| TermAuctionOfferLocker | [`0xAD7F2A936bE83D78D1674DA19ED8a428E23b7508`](https://etherscan.io/address/0xAD7F2A936bE83D78D1674DA19ED8a428E23b7508) |

\
**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                  |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0xE0fC587E1F56b5968a7d5DC3667bA1f385fddb38`](https://etherscan.io/address/0xE0fC587E1F56b5968a7d5DC3667bA1f385fddb38) |
| TermRepoServicer          | [`0x01c5AFdC4d40d4632c630E8371c49088084EA9c3`](https://etherscan.io/address/0x01c5AFdC4d40d4632c630E8371c49088084EA9c3) |
| TermRepoRolloverManager   | [`0x83E3A19fb44E0c99a39E5484a8FCC1C79aB0788A`](https://etherscan.io/address/0x83E3A19fb44E0c99a39E5484a8FCC1C79aB0788A) |
| TermRepoLocker            | [`0x5aD7d46d3C15D3A4049de67f2386AcF55A466450`](https://etherscan.io/address/0x5aD7d46d3C15D3A4049de67f2386AcF55A466450) |
| TermRepoToken             | [`0x542f335Cd30148C82DB2d3AC32eCCa154257EA00`](https://etherscan.io/address/0x542f335Cd30148C82DB2d3AC32eCCa154257EA00) |
| {% endtab %}              |                                                                                                                         |

{% tab title="0.2.4" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                  | Proxy Address                                                                                                           |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0x2b2a13D8729F48315a1017Df83984076b83d4367`](https://etherscan.io/address/0x2b2a13D8729F48315a1017Df83984076b83d4367) | [`0xecf3061c9bc51ca6cc7eeea1dad3912e2bff7dd2`](https://etherscan.io/address/0xecf3061c9bc51ca6cc7eeea1dad3912e2bff7dd2) |
| TermEventEmitter    | [`0x8e3774649b31A8F6EA11ea4307c5Cf5549c3DdD9`](https://etherscan.io/address/0x8e3774649b31A8F6EA11ea4307c5Cf5549c3DdD9) | [`0x9d6a563cf79d47f32ce46cd7b1fb926ecd0f6160`](https://etherscan.io/address/0x9d6a563cf79d47f32ce46cd7b1fb926ecd0f6160) |
| TermPriceConsumerV3 | [`0x0551bd6730D762dA77e96f765045648667E0f976`](https://etherscan.io/address/0x0551bd6730D762dA77e96f765045648667E0f976) | [`0xa3870f0466b0f44cdb8055df9e7ae2403670b93b`](https://etherscan.io/address/0xa3870f0466b0f44cdb8055df9e7ae2403670b93b) |
| TermInitializer     | [`0x86839D923e1a708b25312A30020D43A16948AEaD`](https://etherscan.io/address/0x86839D923e1a708b25312A30020D43A16948AEaD) | `NA`                                                                                                                    |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                  |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0xc887080fbfab316269c62f120ec95adc88ea6c0d`](https://etherscan.io/address/0xc887080fbfab316269c62f120ec95adc88ea6c0d) |
| TermAuctionBidLocker   | [`0xd32c3f92fca993c3c27789ae14674fd4fa02f421`](https://etherscan.io/address/0xd32c3f92fca993c3c27789ae14674fd4fa02f421) |
| TermAuctionOfferLocker | [`0x608e17b09dc92ebcb03297703791f302f989fd66`](https://etherscan.io/address/0x608e17b09dc92ebcb03297703791f302f989fd66) |

\
**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                  |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0x4ff7335888f1e1d28a41dde0a99d9597f2a0aa41`](https://etherscan.io/address/0x4ff7335888f1e1d28a41dde0a99d9597f2a0aa41) |
| TermRepoServicer          | [`0xaab02fd974e924be8353cae591c70da308c0ac32`](https://etherscan.io/address/0xaab02fd974e924be8353cae591c70da308c0ac32) |
| TermRepoRolloverManager   | [`0x4a3945f6e78219df3b389f96dd157ac321e8ec41`](https://etherscan.io/address/0x4a3945f6e78219df3b389f96dd157ac321e8ec41) |
| TermRepoLocker            | [`0x6dc0880fbbb57afb63f2d3652e6f6953a1830cb0`](https://etherscan.io/address/0x6dc0880fbbb57afb63f2d3652e6f6953a1830cb0) |
| TermRepoToken             | [`0xA0d81BdB1BbF620892C74D9c1940116437a0f11b`](https://etherscan.io/address/0xA0d81BdB1BbF620892C74D9c1940116437a0f11b) |

\\
{% endtab %}
{% endtabs %}


# \[Avalanche]

{% tabs %}
{% tab title="0.9.0" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                                      | Proxy Address                                                                                                                                             |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9`](https://snowtrace.io/address/0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9)                     | [`0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031`](https://snowtrace.io/address/0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031/contract/43114/code)               |
| TermEventEmitter    | [`0xbA1112F957f2D1d4E6F13CEF17e68ED6F00C81BE`](https://snowtrace.io/address/0xbA1112F957f2D1d4E6F13CEF17e68ED6F00C81BE)                     | [`0xEfE449c89d045907D29f31BFB79aA99877834E8A`](https://snowtrace.io/address/0xEfE449c89d045907D29f31BFB79aA99877834E8A/contract/43114/code?chainid=43114) |
| TermPriceConsumerV3 | [`0xF6F7a44Ff0F3c1f2633c3b971b9ee181bA72d3Bc`](https://snowtrace.io/address/0xF6F7a44Ff0F3c1f2633c3b971b9ee181bA72d3Bc/contract/43114/code) | [`0xAFAa777e3c71b93cEe4288FA6BE98E6C2b4dDd18`](https://snowtrace.io/address/0xAFAa777e3c71b93cEe4288FA6BE98E6C2b4dDd18/contract/43114/code)               |
| TermInitializer     | [`0x5E3D24F4c7643B67156C07994F365eb1165C60B2`](https://snowtrace.io/address/0x5E3D24F4c7643B67156C07994F365eb1165C60B2/contract/43114/code) | `NA`                                                                                                                                                      |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                                                                   |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| TermAuction            | [`0xC008EF0e4cE3C9315dA5b283f1b8864b0cB59C95`](https://snowtrace.io/address/0x39249877b0617662cF4c0CF2FCcC781fE45020eb/contract/43114/proxyImplementation?chainid=43114) |
| TermAuctionBidLocker   | [`0x27DD7eAE348Ce9697dF8FBc048f021286525FE06`](https://snowtrace.io/address/0x27DD7eAE348Ce9697dF8FBc048f021286525FE06/contract/43114/code)                              |
| TermAuctionOfferLocker | [`0xacF9f886DA1A4D29F86e103957cA90c405828ef9`](https://snowtrace.io/address/0xacF9f886DA1A4D29F86e103957cA90c405828ef9/contract/43114/code)                              |

**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                                      |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0x67B6eB2bdAE054265E83c98C8e0d207013D6C7C1`](https://snowtrace.io/address/0x67B6eB2bdAE054265E83c98C8e0d207013D6C7C1)                     |
| TermRepoServicer          | [`0xeD0476D54bE38FC55Df0A6962D6b215508007d3c`](https://snowtrace.io/address/0xeD0476D54bE38FC55Df0A6962D6b215508007d3c/contract/43114/code) |
| TermRepoRolloverManager   | [`0xd9a00d2AE501278b78DeEA8991B4a3cb518c664E`](https://snowtrace.io/address/0xd9a00d2AE501278b78DeEA8991B4a3cb518c664E/contract/43114/code) |
| TermRepoLocker            | [`0xE1c243C71bb54F9947De85517A6Cc926459668ad`](https://snowtrace.io/address/0xE1c243C71bb54F9947De85517A6Cc926459668ad/contract/43114/code) |
| TermRepoToken             | [`0x3869550d5Ae1343110C0F8f062fbf24621e537d1`](https://snowtrace.io/address/0x3869550d5Ae1343110C0F8f062fbf24621e537d1/contract/43114/code) |
| {% endtab %}              |                                                                                                                                             |

{% tab title="0.6.0" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                                             | Proxy Address                                                                                                                                      |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0x86839D923e1a708b25312A30020D43A16948AEaD`](https://snowtrace.io/address/0x86839D923e1a708b25312A30020D43A16948AEaD/contract/43114/code)        | [`0x609f3F2636caE1E5CD0eA7940396f4fB65802a21`](https://snowtrace.io/address/0x609f3F2636caE1E5CD0eA7940396f4fB65802a21/contract/43114/code#loaded) |
| TermEventEmitter    | [`0x888a5F09b7F85236C091a74acA2259fAc6470C0e`](https://snowtrace.io/address/0x888a5F09b7F85236C091a74acA2259fAc6470C0e/contract/43114/code#loaded) | [`0xb81afB6724ba9d19a3572Fb29ed7ef633fD50093`](https://snowtrace.io/address/0xb81afB6724ba9d19a3572Fb29ed7ef633fD50093/contract/43114/code#loaded) |
| TermPriceConsumerV3 | [`0x44111EDF1eb9a65BA4AB73411787AF110565DBA2`](https://snowtrace.io/address/0x44111EDF1eb9a65BA4AB73411787AF110565DBA2/contract/43114/code#loaded) | [`0xCe580B2da6E002E43095aD7797255e49A20f6B06`](https://snowtrace.io/address/0xCe580B2da6E002E43095aD7797255e49A20f6B06/contract/43114/code#loaded) |
| TermInitializer     | [`0xA3870F0466b0f44CDB8055DF9E7ae2403670b93B`](https://snowtrace.io/address/0xA3870F0466b0f44CDB8055DF9E7ae2403670b93B/contract/43114/code#loaded) | `NA`                                                                                                                                               |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                                             |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0x0551bd6730D762dA77e96f765045648667E0f976`](https://snowtrace.io/address/0x0551bd6730D762dA77e96f765045648667E0f976/contract/43114/code#loaded) |
| TermAuctionBidLocker   | [`0x8e3774649b31A8F6EA11ea4307c5Cf5549c3DdD9`](https://snowtrace.io/address/0x8e3774649b31A8F6EA11ea4307c5Cf5549c3DdD9/contract/43114/code#loaded) |
| TermAuctionOfferLocker | [`0x9D6a563cf79d47f32cE46CD7b1fb926eCd0f6160`](https://snowtrace.io/address/0x9D6a563cf79d47f32cE46CD7b1fb926eCd0f6160/contract/43114/code#loaded) |

**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                                                   |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0x8203B41A7655c0577b932603c41e3e0eDaf789D1`](https://snowtrace.io/address/0x8203B41A7655c0577b932603c41e3e0eDaf789D1/contract/43114/code#loaded)       |
| TermRepoServicer          | [`0xe77b8E8FA43f8c30323814f81dC81f3320F154C1`](https://snowtrace.io/address/0xe77b8E8FA43f8c30323814f81dC81f3320F154C1/contract/43114/code#loaded)       |
| TermRepoRolloverManager   | [`0xeCF3061c9bC51CA6cc7eeEa1daD3912E2bfF7dD2`](https://snowtrace.io/address/0xeCF3061c9bC51CA6cc7eeEa1daD3912E2bfF7dD2/contract/43114/code#loaded)       |
| TermRepoLocker            | [`0x2b2a13D8729F48315a1017Df83984076b83d4367`](https://snowtrace.io/address/0x2b2a13D8729F48315a1017Df83984076b83d4367/contract/43114/code#loaded)       |
| TermRepoToken             | [`0x8a46267d458266714B43c7B4B816A300192c6759`](https://snowtrace.io/token/0x8a46267d458266714B43c7B4B816A300192c6759/contract/code?chainId=43114#loaded) |
| {% endtab %}              |                                                                                                                                                          |
| {% endtabs %}             |                                                                                                                                                          |


# \[Base]

{% tabs %}
{% tab title="0.9.0" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                       | Proxy Address                                                                                                                |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0x979a799C25ccA57c44711A595919D795f3a90D25`](https://basescan.org/address/0x979a799C25ccA57c44711A595919D795f3a90D25#code) | [`0x53838E6d7713Cd59e1a01d97b52e412891430bA5`](https://basescan.org/address/0x53838E6d7713Cd59e1a01d97b52e412891430bA5#code) |
| TermEventEmitter    | [`0x99c5a92b435eA45054EB64FBceFec08910cbC151`](https://basescan.org/address/0x99c5a92b435eA45054EB64FBceFec08910cbC151#code) | [`0x5E3D24F4c7643B67156C07994F365eb1165C60B2`](https://basescan.org/address/0x5E3D24F4c7643B67156C07994F365eb1165C60B2#code) |
| TermPriceConsumerV3 | [`0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9`](https://basescan.org/address/0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9#code) | [`0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031`](https://basescan.org/address/0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031#code) |
| TermInitializer     | [`0x52b4c5908E8E033BD58A2F815973013B596D9005`](https://basescan.org/address/0x52b4c5908E8E033BD58A2F815973013B596D9005#code) | `NA`                                                                                                                         |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                       |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0xC008EF0e4cE3C9315dA5b283f1b8864b0cB59C95`](https://basescan.org/address/0xC008EF0e4cE3C9315dA5b283f1b8864b0cB59C95#code) |
| TermAuctionBidLocker   | [`0x27DD7eAE348Ce9697dF8FBc048f021286525FE06`](https://basescan.org/address/0x27DD7eAE348Ce9697dF8FBc048f021286525FE06#code) |
| TermAuctionOfferLocker | [`0xacF9f886DA1A4D29F86e103957cA90c405828ef9`](https://basescan.org/address/0xacF9f886DA1A4D29F86e103957cA90c405828ef9#code) |

**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                       |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0x67B6eB2bdAE054265E83c98C8e0d207013D6C7C1`](https://basescan.org/address/0x67B6eB2bdAE054265E83c98C8e0d207013D6C7C1#code) |
| TermRepoServicer          | [`0xeD0476D54bE38FC55Df0A6962D6b215508007d3c`](https://basescan.org/address/0xeD0476D54bE38FC55Df0A6962D6b215508007d3c#code) |
| TermRepoRolloverManager   | [`0xd9a00d2AE501278b78DeEA8991B4a3cb518c664E`](https://basescan.org/address/0xd9a00d2AE501278b78DeEA8991B4a3cb518c664E#code) |
| TermRepoLocker            | [`0xE1c243C71bb54F9947De85517A6Cc926459668ad`](https://basescan.org/address/0xE1c243C71bb54F9947De85517A6Cc926459668ad#code) |
| TermRepoToken             | [`0x3869550d5Ae1343110C0F8f062fbf24621e537d1`](https://basescan.org/address/0x3869550d5Ae1343110C0F8f062fbf24621e537d1#code) |
| {% endtab %}              |                                                                                                                              |
| {% endtabs %}             |                                                                                                                              |


# \[Binance Smart Chain]

{% tabs %}
{% tab title="0.9.0" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                      | Proxy Address                                                                                                               |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9`](https://bscscan.com/address/0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9#code) | [`0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031`](https://bscscan.com/address/0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031#code) |
| TermEventEmitter    | [`0xbA1112F957f2D1d4E6F13CEF17e68ED6F00C81BE`](https://bscscan.com/address/0xbA1112F957f2D1d4E6F13CEF17e68ED6F00C81BE#code) | [`0xEfE449c89d045907D29f31BFB79aA99877834E8A`](https://bscscan.com/address/0xEfE449c89d045907D29f31BFB79aA99877834E8A#code) |
| TermPriceConsumerV3 | [`0xF6F7a44Ff0F3c1f2633c3b971b9ee181bA72d3Bc`](https://bscscan.com/address/0xF6F7a44Ff0F3c1f2633c3b971b9ee181bA72d3Bc#code) | [`0xAFAa777e3c71b93cEe4288FA6BE98E6C2b4dDd18`](https://bscscan.com/address/0xAFAa777e3c71b93cEe4288FA6BE98E6C2b4dDd18#code) |
| TermInitializer     | [`0x5E3D24F4c7643B67156C07994F365eb1165C60B2`](https://bscscan.com/address/0x5E3D24F4c7643B67156C07994F365eb1165C60B2#code) | `NA`                                                                                                                        |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                      |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0x99c5a92b435eA45054EB64FBceFec08910cbC151`](https://bscscan.com/address/0x99c5a92b435eA45054EB64FBceFec08910cbC151#code) |
| TermAuctionBidLocker   | [`0x979a799C25ccA57c44711A595919D795f3a90D25`](https://bscscan.com/address/0x979a799C25ccA57c44711A595919D795f3a90D25#code) |
| TermAuctionOfferLocker | [`0x53838E6d7713Cd59e1a01d97b52e412891430bA5`](https://bscscan.com/address/0x53838E6d7713Cd59e1a01d97b52e412891430bA5#code) |

**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                      |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0x27DD7eAE348Ce9697dF8FBc048f021286525FE06`](https://bscscan.com/address/0x27DD7eAE348Ce9697dF8FBc048f021286525FE06#code) |
| TermRepoServicer          | [`0xd9a00d2AE501278b78DeEA8991B4a3cb518c664E`](https://bscscan.com/address/0xd9a00d2AE501278b78DeEA8991B4a3cb518c664E#code) |
| TermRepoRolloverManager   | [`0x52b4c5908E8E033BD58A2F815973013B596D9005`](https://bscscan.com/address/0x52b4c5908E8E033BD58A2F815973013B596D9005#code) |
| TermRepoLocker            | [`0xC008EF0e4cE3C9315dA5b283f1b8864b0cB59C95`](https://bscscan.com/address/0xC008EF0e4cE3C9315dA5b283f1b8864b0cB59C95#code) |
| TermRepoToken             | [`0xacF9f886DA1A4D29F86e103957cA90c405828ef9`](https://bscscan.com/address/0xacF9f886DA1A4D29F86e103957cA90c405828ef9#code) |
| {% endtab %}              |                                                                                                                             |
| {% endtabs %}             |                                                                                                                             |


# \[Plasma]

{% tabs %}
{% tab title="0.9.0" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                                      | Proxy Address                                                                                                                               |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0x53838E6d7713Cd59e1a01d97b52e412891430bA5`](https://plasmascan.to/address/0x53838E6d7713Cd59e1a01d97b52e412891430bA5/contract/9745/code) | [`0x979a799C25ccA57c44711A595919D795f3a90D25`](https://plasmascan.to/address/0x979a799C25ccA57c44711A595919D795f3a90D25/contract/9745/code) |
| TermEventEmitter    | [`0x5E3D24F4c7643B67156C07994F365eb1165C60B2`](https://plasmascan.to/address/0x5E3D24F4c7643B67156C07994F365eb1165C60B2/contract/9745/code) | [`0x99c5a92b435eA45054EB64FBceFec08910cbC151`](https://plasmascan.to/address/0x99c5a92b435eA45054EB64FBceFec08910cbC151/contract/9745/code) |
| TermPriceConsumerV3 | [`0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031`](https://plasmascan.to/address/0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031/contract/9745/code) | [`0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9`](https://plasmascan.to/address/0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9/contract/9745/code) |
| TermInitializer     | [`0x52b4c5908E8E033BD58A2F815973013B596D9005`](https://plasmascan.to/address/0x52b4c5908E8E033BD58A2F815973013B596D9005/contract/9745/code) | `NA`                                                                                                                                        |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                                      |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0xC008EF0e4cE3C9315dA5b283f1b8864b0cB59C95`](https://plasmascan.to/address/0xC008EF0e4cE3C9315dA5b283f1b8864b0cB59C95/contract/9745/code) |
| TermAuctionBidLocker   | [`0x27DD7eAE348Ce9697dF8FBc048f021286525FE06`](https://plasmascan.to/address/0x27DD7eAE348Ce9697dF8FBc048f021286525FE06/contract/9745/code) |
| TermAuctionOfferLocker | [`0xacF9f886DA1A4D29F86e103957cA90c405828ef9`](https://plasmascan.to/address/0xacF9f886DA1A4D29F86e103957cA90c405828ef9/contract/9745/code) |

**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                                      |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0x67B6eB2bdAE054265E83c98C8e0d207013D6C7C1`](https://plasmascan.to/address/0x67B6eB2bdAE054265E83c98C8e0d207013D6C7C1/contract/9745/code) |
| TermRepoServicer          | [`0xeD0476D54bE38FC55Df0A6962D6b215508007d3c`](https://plasmascan.to/address/0xeD0476D54bE38FC55Df0A6962D6b215508007d3c/contract/9745/code) |
| TermRepoRolloverManager   | [`0xd9a00d2AE501278b78DeEA8991B4a3cb518c664E`](https://plasmascan.to/address/0xd9a00d2AE501278b78DeEA8991B4a3cb518c664E/contract/9745/code) |
| TermRepoLocker            | [`0xE1c243C71bb54F9947De85517A6Cc926459668ad`](https://plasmascan.to/address/0xE1c243C71bb54F9947De85517A6Cc926459668ad/contract/9745/code) |
| TermRepoToken             | [`0x3869550d5Ae1343110C0F8f062fbf24621e537d1`](https://plasmascan.to/address/0x3869550d5Ae1343110C0F8f062fbf24621e537d1/contract/9745/code) |
| {% endtab %}              |                                                                                                                                             |
| {% endtabs %}             |                                                                                                                                             |


# \[MegaETH]

{% tabs %}
{% tab title="2.1.3" %}
**Protocol Contracts** are "evergreen" contracts that govern and apply to all Term Repo contract deployments.

| Protocol Contract   | Implementation Address                                                                                                            | Proxy Address                                                                                                                     |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| TermController      | [`0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9`](https://mega.etherscan.io/address/0x145e7813c5CEAB4c5FD5f3c4943b40d075F67Da9#code) | [`0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031`](https://mega.etherscan.io/address/0xe46E6DDad84aBb0F87a1c2d8180aE1FB41a60031#code) |
| TermEventEmitter    | [`0xbA1112F957f2D1d4E6F13CEF17e68ED6F00C81BE`](https://mega.etherscan.io/address/0xbA1112F957f2D1d4E6F13CEF17e68ED6F00C81BE#code) | [`0xEfE449c89d045907D29f31BFB79aA99877834E8A`](https://mega.etherscan.io/address/0xEfE449c89d045907D29f31BFB79aA99877834E8A#code) |
| TermPriceConsumerV3 | [`0xF6F7a44Ff0F3c1f2633c3b971b9ee181bA72d3Bc`](https://mega.etherscan.io/address/0xF6F7a44Ff0F3c1f2633c3b971b9ee181bA72d3Bc#code) | [`0xAFAa777e3c71b93cEe4288FA6BE98E6C2b4dDd18`](https://mega.etherscan.io/address/0xAFAa777e3c71b93cEe4288FA6BE98E6C2b4dDd18#code) |
| TermInitializer     | [`0x155c07b833D660617a1BD42Deb95D9862C10C16b`](https://mega.etherscan.io/address/0x5E3D24F4c7643B67156C07994F365eb1165C60B2#code) | `NA`                                                                                                                              |

**Auction Contracts** are "serially" deployed -- a new set of proxy contracts are deployed to facilitate each Term Auction. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Auction Contracts      | Implementation Address                                                                                                            |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| TermAuction            | [`0xD792B87E7517D8a6BEE1b82C7B9Cef6c9b371C13`](https://mega.etherscan.io/address/0xD792B87E7517D8a6BEE1b82C7B9Cef6c9b371C13#code) |
| TermAuctionBidLocker   | [`0x971419cf26e78C49eaE91435e3721f4C0f325380`](https://mega.etherscan.io/address/0x971419cf26e78C49eaE91435e3721f4C0f325380#code) |
| TermAuctionOfferLocker | [`0xD2515Ed3462e843Fc7a2f0f6eb01f001b7062641`](https://mega.etherscan.io/address/0xD2515Ed3462e843Fc7a2f0f6eb01f001b7062641#code) |

**Repo Contracts**, like Auction Contracts, are "serially" deployed -- each Term Repo is defined by a new set of Repo Contract proxy deployments. Implementations addresses are provided below. Specific proxy addresses can be found at [app.term.finance](https://app.term.finance/).

| Repo Contracts            | Implementation Address                                                                                                            |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| TermRepoCollateralManager | [`0x8eF51A946b939eEd46552770D0D6511a72033b50`](https://mega.etherscan.io/address/0x8eF51A946b939eEd46552770D0D6511a72033b50#code) |
| TermRepoServicer          | [`0x2Ec88a447d51F5CFeB4552D25E61256a2b25D74a`](https://mega.etherscan.io/address/0x2Ec88a447d51F5CFeB4552D25E61256a2b25D74a#code) |
| TermRepoRolloverManager   | [`0xEe09f971fA0EBA8BD7ec2DdfC2C0dfa80D2d462D`](https://mega.etherscan.io/address/0xEe09f971fA0EBA8BD7ec2DdfC2C0dfa80D2d462D#code) |
| TermRepoLocker            | [`0x1a565e4f66642678Cb095E1E407461EB229c8A56`](https://mega.etherscan.io/address/0x1a565e4f66642678Cb095E1E407461EB229c8A56#code) |
| TermRepoToken             | [`0x5b108D7c733F857306C0d3cbf4Aa498aE40f1F5F`](https://mega.etherscan.io/address/0x5b108D7c733F857306C0d3cbf4Aa498aE40f1F5F#code) |
| {% endtab %}              |                                                                                                                                   |
| {% endtabs %}             |                                                                                                                                   |


# Protocol Security

### Incident Identification

The Protocol monitors risk on (i) the smart contract level and (ii) the infrastructure and UI level. On the smart contract level, Term Finance utilizes OpenZeppelin Defender [Contract Sentinels](https://docs.openzeppelin.com/defender/v1/sentinel) to monitor any calls to access controlled functions. On the infrastructure and UI level, measures are established to prevent against DDOS attacks, implement DNS security, and detect unwanted front-end modification and intrusion. For more details follow the page links below.

{% content-ref url="/pages/3UdoCux35paJb9hxRaGT" %}
[Smart Contract Monitoring](/protocol-security/smart-contract-monitoring)
{% endcontent-ref %}

{% content-ref url="/pages/FZbmBD5kvVet9x9TIgVn" %}
[Front-End Security](/protocol-security/front-end-security)
{% endcontent-ref %}

### Incident Reporting

Alerts are sent to all members of the team in real-time, though a rotating schedule is in place to designate a single member of the core team as being responsible for monitoring and escalating alerts to an incident report board each day of the week. Incidents added to the board move through the following steps:

* Discovered
* Triage Needed
* Planned
* Diagnosing
* Fixing

### Isolate and Contain

Once identified, emphasis is placed on isolating and containing an incident from spreading or causing further damage to the Protocol. Responses for common situations described in the table below.

| Type                              | Response                                                                                                                                                                                                                                                                                                                                                                                   |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **SC - Unauthorized deployments** | To isolate and contain an unauthorized or malicious deployment, the Protocol can (i) pause further deployments through the Term Initializer and (ii) delist the contracts.                                                                                                                                                                                                                 |
| **SC - Exploits**                 | Depending on the nature of a hypothetical smart contract exploit, containment will be narrowly tailored to the minimum restrictions necessary to isolate the exploit without unnecessarily prohibiting users from exiting the Protocol. To this end, in some cases it may be sufficient to pause a subset of public functions, in other it may be necessary to pause all public functions. |
| **Web 2.0 infra / front-end**     | While containment will vary on a case-by-case basis, the procedure will be to isolate affected systems or networks to prevent further damage to the extent there are interconnections before diagnosing and eliminating root cause.                                                                                                                                                        |

### Resolve and/or Restore

Once contained, emphasis turns toward resolving and restoring systems. Resolutions for common situations are detailed in the table below.

| Type                                 | Response                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **SC - Unauthorized deployments**    | To the extent the cause of unauthorized deployments is due to a compromised access control wallet, roles can be re-assigned using the DEVOPS\_ROLE multisig.                                                                                                                                                                                                                                        |
| **SC - Exploits**                    | In certain circumstances, it may be necessary to authorize upgrades to resolve the exploit. In others, it may be sufficient to simply redeploy the entire protocol. Given the finite nature of Term Finance contracts, the impact of redeployments is limited.                                                                                                                                      |
| **SC - Compromised access controls** | To the extent any of the access control wallets (other than the DEVOPS\_ROLE wallet ) are compromised, it is possible to re-assign roles using the DEVOPS\_ROLE multisig. To the extent unauthorized transactions are proposed to the DEVOPS\_ROLE multisig, the Zodiac Role Modifier can invalidate any pending transactions during the 24-hour timelock imposed on all DEVOPS\_ROLE transactions. |
| **Web 2.0 infra / front-end**        | The front-end is deployed using Github Pipelines and stored in Amazon S3 buckets with version histories. Once contained and isolated, UI can be quickly restored to a previous version.                                                                                                                                                                                                             |

### Documentation

Lastly, once an incident is contained and resolved, the Protocol will seek to document all actions taken during the incident response process, including timestamps and individuals involved.


# Smart Contract Monitoring

### Monitoring

All access controlled contract calls and calls pertaining to contract deployment trigger alerts in real-time via OpenZeppelin Defender Contract Sentinels. This is done by monitoring the contracts in the following table. Note, in addition to monitoring calls at the Protocol level, monitoring is also done on the Protocol's Zodial Delay Modifier through which all DEVOPS\_ROLE calls must be initiated in order to provide a second layer of ACL intrusion detection.

<table><thead><tr><th width="230">Contract</th><th width="157">Role</th><th>Events/Functions</th></tr></thead><tbody><tr><td><strong>Event Emitter 0.6.0</strong></td><td><pre><code>ADMIN_ROLE
</code></pre></td><td><code>AuctionCancelled(bytes32,bool,bool)AuctionCompleted(bytes32,uint256,uint256,uint256,uint256,uint256)BidLockingPaused(bytes32,bytes32)BidLockingUnpaused(bytes32,bytes32)BidUnlockingPaused(bytes32,bytes32)BidUnlockingUnpaused(bytes32,bytes32)CompleteAuctionPaused(bytes32,bytes32)CompleteAuctionUnpaused(bytes32,bytes32)DelistTermAuction(bytes32)DelistTermRepo(bytes32)LiquidationsPaused(bytes32)LiquidationsUnpaused(bytes32)MintExposureAccessGranted(bytes32,address)OfferLockingPaused(bytes32,bytes32)OfferLockingUnpaused(bytes32,bytes32)OfferUnlockingPaused(bytes32,bytes32)OfferUnlockingUnpaused(bytes32,bytes32)RolloverTermApprovalRevoked(bytes32,bytes32)RolloverTermApproved(bytes32,bytes32)TermRepoLockerTransfersPaused(bytes32)TermRepoLockerTransfersUnpaused(bytes32)TermRepoTokenBurningPaused(bytes32)TermRepoTokenBurningUnpaused(bytes32)TermRepoTokenMintingPaused(bytes32)TermRepoTokenMintingUnpaused(bytes32)</code></td></tr><tr><td><strong>Event Emitter 0.6.0</strong></td><td><pre data-full-width="true"><code>DEVOPS_ROLE
</code></pre></td><td><code>TermContractUpgraded(address,address)</code></td></tr><tr><td><strong>Term Initializer 0.6.0</strong></td><td><pre><code>DEPLOYER
</code></pre></td><td><code>pairTermContracts(address,address,address)setupAuction(address,address,address,address,address,address,address,string)setupTerm((address,address,address,address,address,address,address,address),address,address,string,string)</code></td></tr><tr><td><strong>Term Initializer 0.6.0</strong></td><td><pre><code>DEVOPS_ROLE
</code></pre></td><td><code>pauseDeploying()unpauseDeploying()</code></td></tr><tr><td><strong>Term Controller 0.6.0</strong></td><td><pre><code>DEPLOYER
</code></pre></td><td><code>markTermDeployed(address)unmarkTermDeployed(address)</code></td></tr><tr><td><strong>Term Controller - 0.6.0</strong></td><td><pre><code>DEVOPS_ROLE
</code></pre></td><td><code>ProtocolReserveAddressUpdated(address,address)TreasuryAddressUpdated(address,address)updateControllerAdminWallet(address,address)</code></td></tr><tr><td><strong>Term Oracle - 0.6.0</strong></td><td><pre><code>DEVOPS_ROLE
</code></pre></td><td><code>Upgraded(address)addNewTokenPriceFeed(address,address)removeTokenPriceFeed(address)</code></td></tr><tr><td><strong>Zodiac Delay Module</strong></td><td><pre><code>DEVOPS_ROLE
</code></pre></td><td><code>disableModule(address,address)enableModule(address)execTransactionFromModule(address,uint256,bytes,uint8)executeNextTx(address,uint256,bytes,uint8)setAvatar(address)setTarget(address)setTxCooldown(uint256)setTxExpiration(uint256)setTxNonce(uint256)</code></td></tr></tbody></table>


# Front-End Security

Front-end security is accomplished through a four-pronged defense setup. Specifically, protections are in place (i) to protect against DDOS attack, (ii) enable DNS security, (iii) detect unwanted front-end changes and (iv) detect front-end intrusion.

| Type             | Details                                                                                                                                                          |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| DDOS             | Prevent DDOS attack using AWS load shedding mechanisms by throttling users that attempt to access relevant IP address at a rate exceeding 500 hits in 5 minutes. |
| DNS              | Enable and implement [AWS DNSSEC](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-configuring-dnssec.html).                                        |
| Intrusion        | Changes to web application assets are monitored using AWS Cloudwatch and Simple Notification Service (SNS).                                                      |
| Intrusion        | Changes to AWS account are monitored through AWS Cloudtrail.                                                                                                     |
| Unwanted Changes | Utilize [third-party service provider ](https://visualping.io/)to monitor changes to UI.                                                                         |

#### Incidence Response

The Web 2.0 incidence response plan involves diagnosing and resolving alerts that have been escalated and triaged via an incident response workflow board.


# Solidity API - latest

Detailed specifications for Term Finance Protocol v1 contracts can be found here. The groups are broken down by category as described [here](https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/term-finance-protocol/README.md).


# Term Repo Class

Each deployment of a Term Repo is comprised of a set of smart contracts broadly divided into three groups: (i) the Term Auction Group, (ii) the Term Servicer Group and (iii) the Term Repo Token.

{% content-ref url="/pages/y0pOxj2gkKZk5awNw1KR" %}
[Term Auction Group](/latest/term-repo-class/term-auction-group)
{% endcontent-ref %}

{% content-ref url="/pages/Jo4hRrGpKZlxQ7vGMGXZ" %}
[Term Servicer Group](/latest/term-repo-class/term-servicer-group)
{% endcontent-ref %}

{% content-ref url="/pages/FzeN185NjlLAcj2nE0z5" %}
[TermRepoToken.sol](/latest/term-repo-class/termrepotoken)
{% endcontent-ref %}


# Term Auction Group

The Term Auction group of contracts contain the logic to handle and process bid and offer submissions, determine an auction clearing price, and to settle and clear a Term Auction.

{% content-ref url="/pages/lXbaixBmQy3cC0EljLje" %}
[TermAuction.sol](/latest/term-repo-class/term-auction-group/termauction)
{% endcontent-ref %}

{% content-ref url="/pages/QPDrAsGwvyaPBaii8qA7" %}
[TermAuctionBidLocker.sol](/latest/term-repo-class/term-auction-group/termauctionbidlocker)
{% endcontent-ref %}

{% content-ref url="/pages/SzYjOft5j7hW20tDTVLY" %}
[TermAuctionOfferLocker.sol](/latest/term-repo-class/term-auction-group/termauctionofferlocker)
{% endcontent-ref %}


# TermAuction.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract calculates a clearing price in a blind double auction and manages auction clearing

## TermAuction

This contract calculates a clearing price in a blind double auction and manages auction clearing and settlement

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

### ClearingPriceState

State used during the `calculateClearingPrice` function

*Used to reduce the number of stack variables*

```solidity
struct ClearingPriceState {
  uint256 offerPrice;
  uint256 offerIndex;
  uint256 bidIndex;
  uint256 cumSumOffers;
  uint256 cumSumBids;
  uint256 maxClearingVolume;
  uint256 nextOfferIndex;
  uint256 nextBidIndex;
  uint256 nextCumSumOffers;
  uint256 nextCumSumBids;
  uint256 nextOfferPrice;
  uint256 nextMaxClearingVolume;
  bool minCumSumCorrection;
  uint256 nextBidPrice;
  uint256 clearingPrice;
}
```

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 THREESIXTY_DAYCOUNT_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### dayCountFractionMantissa

```solidity
uint256 dayCountFractionMantissa
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termAuctionBidLocker

```solidity
contract ITermAuctionBidLocker termAuctionBidLocker
```

### termAuctionOfferLocker

```solidity
contract ITermAuctionOfferLocker termAuctionOfferLocker
```

### purchaseToken

```solidity
contract IERC20Metadata purchaseToken
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### controller

```solidity
contract ITermController controller
```

### clearingPrice

```solidity
uint256 clearingPrice
```

### clearingPricePostProcessingOffset

```solidity
uint256 clearingPricePostProcessingOffset
```

### auctionCompleted

```solidity
bool auctionCompleted
```

### auctionCancelledForWithdrawal

```solidity
bool auctionCancelledForWithdrawal
```

### completeAuctionPaused

```solidity
bool completeAuctionPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### onlyWhileAuctionClosed

```solidity
modifier onlyWhileAuctionClosed()
```

This only runs if the auction is closed (after auction end time)

*This uses the block timestamp to determine if the auction is closed*

### whenCompleteAuctionNotPaused

```solidity
modifier whenCompleteAuctionNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionEndTime_, uint256 termStart_, uint256 redemptionTimestamp_, contract IERC20Metadata purchaseToken_, address termAuctionInitializer_, uint256 clearingPricePostProcessingOffset_) external
```

Initializes the contract

*See: <https://docs.openzeppelin.com/contracts/4.x/upgradeable>*

### pairTermContracts

```solidity
function pairTermContracts(contract ITermEventEmitter emitter_, contract ITermController controller_, contract ITermRepoServicer termRepoServicer_, contract ITermAuctionBidLocker termAuctionBidLocker_, contract ITermAuctionOfferLocker termAuctionOfferLocker_, address devopsMultisigAddress_, address adminWallet_, address deployerWallet_, string version_) external
```

### completeAuction

```solidity
function completeAuction(struct CompleteAuctionInput completeAuctionInput) external
```

Calculates an auction's clearing price, assigns bids/offers, and returns unassigned funds

#### Parameters

| Name                 | Type                        | Description                                                                               |
| -------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| completeAuctionInput | struct CompleteAuctionInput | A struct containing all revealed and unrevealed bids and offers and expired rollover bids |

### cancelAuction

```solidity
function cancelAuction(struct CompleteAuctionInput completeAuctionInput) public
```

Cancels an auction and returns all funds to bidders and fulfillBiders

#### Parameters

| Name                 | Type                        | Description                                                                               |
| -------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| completeAuctionInput | struct CompleteAuctionInput | A struct containing all revealed and unrevealed bids and offers and expired rollover bids |

### cancelAuctionForWithdrawal

```solidity
function cancelAuctionForWithdrawal(address[] rolloverBorrowers, address[] rolloverPairOffTermRepoServicer) public
```

Cancels an auction and sets auctionCancelledForWithdrawal to true to open unlocking tenders

### \_increaseCumSumBids

```solidity
function _increaseCumSumBids(struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex, uint256 previousCumSumBids, uint256 currentPrice) internal pure returns (uint256, uint256)
```

### \_decreaseCumSumBids

```solidity
function _decreaseCumSumBids(struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex, uint256 previousCumSumBids, uint256 currentPrice) internal pure returns (uint256, uint256)
```

### \_minUint256

```solidity
function _minUint256(uint256 a, uint256 b) internal pure returns (uint256)
```

Returns the min of two `uint256` values

#### Parameters

| Name | Type    | Description                 |
| ---- | ------- | --------------------------- |
| a    | uint256 | The first value to compare  |
| b    | uint256 | The second value to compare |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The min of the two values |

### \_calculateClearingPrice

```solidity
function _calculateClearingPrice(struct TermAuctionRevealedBid[] sortedBids, struct TermAuctionRevealedOffer[] sortedOffers, uint256 clearingOffset) internal pure returns (uint256, uint256)
```

Calculates the intersection between bid/offer schedules to arrive at a clearing price

*Imagine a graph with price along the X-axis and cumsum(bid/offerAmount\*price) along the Y-axis. This function finds the point where the supply line crosses the demand line using binary search*

#### Parameters

| Name           | Type                               | Description                                                                                         |
| -------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------- |
| sortedBids     | struct TermAuctionRevealedBid\[]   | A sorted array of bids used to arrive at a demand schedule                                          |
| sortedOffers   | struct TermAuctionRevealedOffer\[] | A sorted array of offers used to arrive at a supply schedule                                        |
| clearingOffset | uint256                            | The offset to apply to the marginal bid and offer indexes when calculating the final clearing price |

#### Return Values

| Name | Type    | Description                                                   |
| ---- | ------- | ------------------------------------------------------------- |
| \[0] | uint256 | clearingPrice The price at which Term Auction will be cleared |
| \[1] | uint256 |                                                               |

### \_findFirstIndexForPrice

```solidity
function _findFirstIndexForPrice(uint256 price, struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex) internal pure returns (uint256 i, uint256 totalAmount)
```

Finds the index of the first bid with a bidPrice of `price` and calculate the cumsum of the bid amounts up to that index

#### Parameters

| Name       | Type                             | Description                       |
| ---------- | -------------------------------- | --------------------------------- |
| price      | uint256                          | The price to search for           |
| sortedBids | struct TermAuctionRevealedBid\[] | An array of sorted bids to search |
| startIndex | uint256                          | The index to start searching from |

#### Return Values

| Name        | Type    | Description                                           |
| ----------- | ------- | ----------------------------------------------------- |
| i           | uint256 | The index of the first bid with a bidPrice of `price` |
| totalAmount | uint256 | The cumsum of the bid amounts up to return index i    |

### \_findLastIndexForPrice

```solidity
function _findLastIndexForPrice(uint256 price, struct TermAuctionRevealedOffer[] sortedOffers, uint256 startIndex) internal pure returns (uint256 i, uint256 totalAmount)
```

Finds the index of the last offer with a offerPrice of `price` and calculate the cumsum of the offer amounts up to that index

#### Parameters

| Name         | Type                               | Description                       |
| ------------ | ---------------------------------- | --------------------------------- |
| price        | uint256                            | The price to search for           |
| sortedOffers | struct TermAuctionRevealedOffer\[] | An array of offers to search      |
| startIndex   | uint256                            | The index to start searching from |

#### Return Values

| Name        | Type    | Description                                              |
| ----------- | ------- | -------------------------------------------------------- |
| i           | uint256 | The index of the last offer with a offerPrice of `price` |
| totalAmount | uint256 | The cumsum of the offer amounts up to return index i     |

### \_fullyAssignBid

```solidity
function _fullyAssignBid(struct TermAuctionRevealedBid bid) internal returns (uint256)
```

Fully assigns a bid

#### Parameters

| Name | Type                          | Description       |
| ---- | ----------------------------- | ----------------- |
| bid  | struct TermAuctionRevealedBid | The bid to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_fullyAssignOffer

```solidity
function _fullyAssignOffer(struct TermAuctionRevealedOffer offer) internal returns (uint256)
```

Fully assigns an offer

#### Parameters

| Name  | Type                            | Description         |
| ----- | ------------------------------- | ------------------- |
| offer | struct TermAuctionRevealedOffer | The offer to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_partiallyAssignBid

```solidity
function _partiallyAssignBid(struct TermAuctionRevealedBid bid, uint256 assignedAmount) internal returns (uint256)
```

Partially assigns a bid

#### Parameters

| Name           | Type                          | Description          |
| -------------- | ----------------------------- | -------------------- |
| bid            | struct TermAuctionRevealedBid | The bid to assign    |
| assignedAmount | uint256                       | The amount to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_partiallyAssignOffer

```solidity
function _partiallyAssignOffer(struct TermAuctionRevealedOffer offer, uint256 assignedAmount) internal returns (uint256)
```

Partially assigns an offer

#### Parameters

| Name           | Type                            | Description          |
| -------------- | ------------------------------- | -------------------- |
| offer          | struct TermAuctionRevealedOffer | The offer to assign  |
| assignedAmount | uint256                         | The amount to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_assignRolloverBid

```solidity
function _assignRolloverBid(address borrower, uint256 purchasePrice, uint256 repurchasePrice, address rolloverPairOffTermRepoServicer) internal
```

### \_markRolloverAsProcessed

```solidity
function _markRolloverAsProcessed(address rolloverPairOffTermRepoServicer, address borrower) internal
```

### \_assignBids

```solidity
function _assignBids(struct TermAuctionRevealedBid[] sortedBids, uint256 maxAssignable, uint256 purchaseTokenDecimals) internal returns (uint256)
```

Assigns bids up to `maxAssignable`

*This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single bid*

#### Parameters

| Name                  | Type                             | Description                                                    |
| --------------------- | -------------------------------- | -------------------------------------------------------------- |
| sortedBids            | struct TermAuctionRevealedBid\[] | An array of sorted bids to process                             |
| maxAssignable         | uint256                          | The maximum bid amount that can be assigned across all bidders |
| purchaseTokenDecimals | uint256                          | The number of decimals of the purchase token                   |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The total amount assigned |

### \_assignOffers

```solidity
function _assignOffers(struct TermAuctionRevealedOffer[] sortedOffers, uint256 maxAssignable, uint256 purchaseTokenDecimals) internal returns (uint256)
```

Assigns offers up to `maxAssignable`

*This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single offer*

#### Parameters

| Name                  | Type                               | Description                                                     |
| --------------------- | ---------------------------------- | --------------------------------------------------------------- |
| sortedOffers          | struct TermAuctionRevealedOffer\[] | An array of sorted offers to process                            |
| maxAssignable         | uint256                            | The maximum offer amount that can be assigned across all offers |
| purchaseTokenDecimals | uint256                            | The number of decimals of the purchase token                    |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The total amount assigned |

### \_calculateRepurchasePrice

```solidity
function _calculateRepurchasePrice(uint256 purchasePrice) internal view returns (uint256)
```

Calculates repurchase price given a purchase price (equivalent to principal plus interest)

#### Parameters

| Name          | Type    | Description        |
| ------------- | ------- | ------------------ |
| purchasePrice | uint256 | The purchase price |

#### Return Values

| Name | Type    | Description                                                                                       |
| ---- | ------- | ------------------------------------------------------------------------------------------------- |
| \[0] | uint256 | The repurchase price obtained by applying the clearing rate on an Actual/360 day-count convention |

### \_calculateAndStoreClearingPrice

```solidity
function _calculateAndStoreClearingPrice(struct TermAuctionRevealedBid[] sortedBids, struct TermAuctionRevealedOffer[] sortedOffers) internal returns (uint256, uint256)
```

### pauseCompleteAuction

```solidity
function pauseCompleteAuction() external
```

\_This function pauses the TermAuction contract preventing public state changes See {Pausable-*pause}.*

### unpauseCompleteAuction

```solidity
function unpauseCompleteAuction() external
```

Unpuses the TermAuction contract allowing public state changes

\_See {Pausable-*unpause}.*

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


# TermAuctionBidLocker.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract handles and proceesses Term Auction bid submissions

## TermAuctionBidLocker

This contract handles and proceesses Term Auction bid submissions

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

### MAX\_BID\_PRICE

```solidity
uint256 MAX_BID_PRICE
```

### MAX\_BID\_COUNT

```solidity
uint256 MAX_BID_COUNT
```

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 THREESIXTY_DAYCOUNT_SECONDS
```

### MINIMUM\_ROLLOVER\_TENDER\_DIVISOR

```solidity
uint256 MINIMUM_ROLLOVER_TENDER_DIVISOR
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTIONEER\_ROLE

```solidity
bytes32 AUCTIONEER_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### DIAMOND\_ROLE

```solidity
bytes32 DIAMOND_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionStartTime

```solidity
uint256 auctionStartTime
```

### revealTime

```solidity
uint256 revealTime
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### minimumTenderAmount

```solidity
uint256 minimumTenderAmount
```

### dayCountFractionMantissa

```solidity
uint256 dayCountFractionMantissa
```

### purchaseToken

```solidity
address purchaseToken
```

### collateralTokens

```solidity
mapping(contract IERC20 => bool) collateralTokens
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termPriceOracle

```solidity
contract ITermPriceOracle termPriceOracle
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termAuction

```solidity
contract ITermAuction termAuction
```

### bids

```solidity
mapping(bytes32 => struct TermAuctionBid) bids
```

### bidCount

```solidity
uint256 bidCount
```

### termContractPaired

```solidity
bool termContractPaired
```

### lockingPaused

```solidity
bool lockingPaused
```

### unlockingPaused

```solidity
bool unlockingPaused
```

### onlyWhileAuctionOpen

```solidity
modifier onlyWhileAuctionOpen()
```

### onlyWhileAuctionRevealing

```solidity
modifier onlyWhileAuctionRevealing()
```

### onlyBidder

```solidity
modifier onlyBidder(address bidder, address authedUser)
```

### whenLockingNotPaused

```solidity
modifier whenLockingNotPaused()
```

### whenUnlockingNotPaused

```solidity
modifier whenUnlockingNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionStartTime_, uint256 revealTime_, uint256 auctionEndTime_, uint256 redemptionTimestamp_, uint256 minimumTenderAmount_, address purchaseToken_, contract IERC20[] collateralTokens_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termAuction_, contract ITermRepoServicer termRepoServicer_, contract ITermEventEmitter emitter_, contract ITermRepoCollateralManager termRepoCollateralManager_, contract ITermPriceOracle termPriceOracle_, address devopsMultisig_, address adminWallet_, address termDiamond_) external
```

### pairRolloverManager

```solidity
function pairRolloverManager(address rolloverManager) external
```

#### Parameters

| Name            | Type    | Description                                         |
| --------------- | ------- | --------------------------------------------------- |
| rolloverManager | address | The address of the TermRepoRolloverManager contract |

### lockBidsWithReferral

```solidity
function lockBidsWithReferral(struct TermAuctionBidSubmission[] bidSubmissions, address referralAddress) external returns (bytes32[])
```

When modifying an existing bid, the collateral tokens in the submission must match the original bid's collateral tokens in the same order

#### Parameters

| Name            | Type                               | Description                                                                                                        |
| --------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| bidSubmissions  | struct TermAuctionBidSubmission\[] | An array of Term Auction bid submissions to borrow an amount of money at rate up to but not exceeding the bid rate |
| referralAddress | address                            | A user address that referred the submitter of this bid                                                             |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockBidsWithReferral

```solidity
function lockBidsWithReferral(address bidder, struct TermAuctionBidSubmission[] bidSubmissions, address referralAddress) external returns (bytes32[])
```

When modifying an existing bid, the collateral tokens in the submission must match the original bid's collateral tokens in the same order

#### Parameters

| Name            | Type                               | Description                                                                                                        |
| --------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| bidder          | address                            |                                                                                                                    |
| bidSubmissions  | struct TermAuctionBidSubmission\[] | An array of Term Auction bid submissions to borrow an amount of money at rate up to but not exceeding the bid rate |
| referralAddress | address                            | A user address that referred the submitter of this bid                                                             |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockRolloverBid

```solidity
function lockRolloverBid(struct TermAuctionBid bid) external
```

#### Parameters

| Name | Type                  | Description                            |
| ---- | --------------------- | -------------------------------------- |
| bid  | struct TermAuctionBid | A struct containing details of the bid |

### lockBids

```solidity
function lockBids(struct TermAuctionBidSubmission[] bidSubmissions) external returns (bytes32[])
```

When modifying an existing bid, the collateral tokens in the submission must match the original bid's collateral tokens in the same order

#### Parameters

| Name           | Type                               | Description                 |
| -------------- | ---------------------------------- | --------------------------- |
| bidSubmissions | struct TermAuctionBidSubmission\[] | An array of bid submissions |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockedBid

```solidity
function lockedBid(bytes32 id) external view returns (struct TermAuctionBid)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | bytes32 | A bid Id    |

#### Return Values

| Name | Type                  | Description                                   |
| ---- | --------------------- | --------------------------------------------- |
| \[0] | struct TermAuctionBid | A struct containing details of the locked bid |

### revealBids

```solidity
function revealBids(bytes32[] ids, uint256[] prices, uint256[] nonces) external
```

#### Parameters

| Name   | Type       | Description                                           |
| ------ | ---------- | ----------------------------------------------------- |
| ids    | bytes32\[] | An array of bid ids of the bids to reveal             |
| prices | uint256\[] | An array of the bid prices to reveal                  |
| nonces | uint256\[] | An array of nonce values to generate bid price hashes |

### unlockBids

```solidity
function unlockBids(bytes32[] ids) external
```

unlockBids unlocks multiple bids and returns funds to the bidder

#### Parameters

| Name | Type       | Description               |
| ---- | ---------- | ------------------------- |
| ids  | bytes32\[] | An array of ids to unlock |

### unlockBids

```solidity
function unlockBids(address bidder, bytes32[] ids) external
```

unlockBids unlocks multiple bids and returns funds to the bidder

#### Parameters

| Name   | Type       | Description               |
| ------ | ---------- | ------------------------- |
| bidder | address    |                           |
| ids    | bytes32\[] | An array of ids to unlock |

### getAllBids

```solidity
function getAllBids(bytes32[] revealedBids, bytes32[] expiredRolloverBids, bytes32[] unrevealedBids) external returns (struct TermAuctionRevealedBid[], struct TermAuctionBid[])
```

#### Parameters

| Name                | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| revealedBids        | bytes32\[] | An array of the revealed offer ids       |
| expiredRolloverBids | bytes32\[] | An array of the expired rollover bid ids |
| unrevealedBids      | bytes32\[] | An array of the unrevealed offer ids     |

#### Return Values

| Name | Type                             | Description                                                                        |
| ---- | -------------------------------- | ---------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedBid\[] | An array of TermAuctionRevealedBid structs containing details of the revealed bids |
| \[1] | struct TermAuctionBid\[]         | An array of TermAuctionBid structs containing details of the unrevealed bids       |

### auctionUnlockBid

```solidity
function auctionUnlockBid(bytes32 id, address bidder, address[] bidCollateralTokens, uint256[] amounts) external
```

#### Parameters

| Name                | Type       | Description                                   |
| ------------------- | ---------- | --------------------------------------------- |
| id                  | bytes32    | A bytes32 bid id                              |
| bidder              | address    | The address of the bidder                     |
| bidCollateralTokens | address\[] | The addresses of the token used as collateral |
| amounts             | uint256\[] | The amounts of collateral tokens to unlock    |

### \_lock

```solidity
function _lock(struct TermAuctionBidSubmission bidSubmission, address authedUser, address sender) internal returns (struct TermAuctionBid)
```

### \_lockRolloverBid

```solidity
function _lockRolloverBid(struct TermAuctionBid bid) internal
```

### \_unlock

```solidity
function _unlock(bytes32 id, address bidder, address[] bidCollateralTokens, uint256[] amounts) internal
```

### \_revealBid

```solidity
function _revealBid(bytes32 id, uint256 price, uint256 nonce) internal
```

### \_getAllBids

```solidity
function _getAllBids(bytes32[] revealedBids, bytes32[] expiredRolloverBids, bytes32[] unrevealedBids) internal returns (struct TermAuctionRevealedBid[], struct TermAuctionBid[])
```

#### Parameters

| Name                | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| revealedBids        | bytes32\[] | An array of the revealed offer ids       |
| expiredRolloverBids | bytes32\[] | An array of the expired rollover bid ids |
| unrevealedBids      | bytes32\[] | An array of the unrevealed offer ids     |

#### Return Values

| Name | Type                             | Description                                                                        |
| ---- | -------------------------------- | ---------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedBid\[] | An array of TermAuctionRevealedBid structs containing details of the revealed bids |
| \[1] | struct TermAuctionBid\[]         | An array of TermAuctionBid structs containing details of the unrevealed bids       |

### \_truncateBidStruct

```solidity
function _truncateBidStruct(struct TermAuctionBid bid) internal pure returns (struct TermAuctionRevealedBid revealed)
```

*This does not check the hash of the revealed bid price*

#### Parameters

| Name | Type                  | Description                                             |
| ---- | --------------------- | ------------------------------------------------------- |
| bid  | struct TermAuctionBid | The TermAuctionBid to convert to TermAuctionRevealedBid |

### \_processRevealedBidsForValidity

```solidity
function _processRevealedBidsForValidity(bytes32[] revealedBids, uint256 unrevealedBidCount) internal returns (struct TermAuctionBid[], uint256, uint256, uint256)
```

### \_isRolloverStillValid

```solidity
function _isRolloverStillValid(struct TermAuctionBid revealedBid, contract ITermRepoServicer pairOffServicer) internal returns (bool)
```

### \_isInInitialCollateralShortFall

```solidity
function _isInInitialCollateralShortFall(uint256 bidAmount, address[] collateralTokens_, uint256[] collateralAmounts) internal view returns (bool)
```

### \_isInMaintenanceCollateralShortFall

```solidity
function _isInMaintenanceCollateralShortFall(uint256 bidAmount, uint256 bidPrice, address[] collateralTokens_, uint256[] collateralAmounts) internal view returns (bool)
```

### \_fillRevealedBidsForAuctionClearing

```solidity
function _fillRevealedBidsForAuctionClearing(bytes32[] revealedBids, uint256 auctionBidCount) internal returns (struct TermAuctionRevealedBid[])
```

### \_generateBidId

```solidity
function _generateBidId(bytes32 id, address user) internal view returns (bytes32)
```

### \_processBidForAuction

```solidity
function _processBidForAuction(bytes32 id) internal
```

### pauseLocking

```solidity
function pauseLocking() external
```

### unpauseLocking

```solidity
function unpauseLocking() external
```

### pauseUnlocking

```solidity
function pauseUnlocking() external
```

### unpauseUnlocking

```solidity
function unpauseUnlocking() 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 |


# TermAuctionOfferLocker.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract handles and processes Term Auction offer submissions

## TermAuctionOfferLocker

This contract handles and proceesses Term Auction offer submissions

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

### MAX\_OFFER\_PRICE

```solidity
uint256 MAX_OFFER_PRICE
```

### MAX\_OFFER\_COUNT

```solidity
uint256 MAX_OFFER_COUNT
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTIONEER\_ROLE

```solidity
bytes32 AUCTIONEER_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### DIAMOND\_ROLE

```solidity
bytes32 DIAMOND_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionStartTime

```solidity
uint256 auctionStartTime
```

### revealTime

```solidity
uint256 revealTime
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### minimumTenderAmount

```solidity
uint256 minimumTenderAmount
```

### purchaseToken

```solidity
contract IERC20 purchaseToken
```

### collateralTokens

```solidity
mapping(contract IERC20 => bool) collateralTokens
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termAuction

```solidity
contract ITermAuction termAuction
```

### offers

```solidity
mapping(bytes32 => struct TermAuctionOffer) offers
```

### offerCount

```solidity
uint256 offerCount
```

### termContractPaired

```solidity
bool termContractPaired
```

### lockingPaused

```solidity
bool lockingPaused
```

### unlockingPaused

```solidity
bool unlockingPaused
```

### onlyWhileAuctionOpen

```solidity
modifier onlyWhileAuctionOpen()
```

### onlyWhileAuctionRevealing

```solidity
modifier onlyWhileAuctionRevealing()
```

### onlyOfferor

```solidity
modifier onlyOfferor(address offeror, address authedUser)
```

### onlyExistingOffer

```solidity
modifier onlyExistingOffer(bytes32 id)
```

### whenLockingNotPaused

```solidity
modifier whenLockingNotPaused()
```

### whenUnlockingNotPaused

```solidity
modifier whenUnlockingNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionStartTime_, uint256 revealTime_, uint256 auctionEndTime_, uint256 minimumTenderAmount_, contract IERC20 purchaseToken_, contract IERC20[] collateralTokens_, address termInitializer_) external
```

### pairTermContracts

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

### lockOffersWithReferral

```solidity
function lockOffersWithReferral(struct TermAuctionOfferSubmission[] offerSubmissions, address referralAddress) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                                                                                                |
| ---------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of Term Auction offer submissions to lend an amount of money at rate no lower than the offer rate |
| referralAddress  | address                              | A user address that referred the submitter of this offer                                                   |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockOffersWithReferral

```solidity
function lockOffersWithReferral(address offeror, struct TermAuctionOfferSubmission[] offerSubmissions, address referralAddress) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                                                                                                |
| ---------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| offeror          | address                              | The address of the offeror                                                                                 |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of Term Auction offer submissions to lend an amount of money at rate no lower than the offer rate |
| referralAddress  | address                              | A user address that referred the submitter of this offer                                                   |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockOffers

```solidity
function lockOffers(struct TermAuctionOfferSubmission[] offerSubmissions) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                   |
| ---------------- | ------------------------------------ | ----------------------------- |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of offer submissions |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockedOffer

```solidity
function lockedOffer(bytes32 id) external view returns (struct TermAuctionOffer)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | bytes32 | An offer Id |

#### Return Values

| Name | Type                    | Description                                         |
| ---- | ----------------------- | --------------------------------------------------- |
| \[0] | struct TermAuctionOffer | A struct containing the details of the locked offer |

### revealOffers

```solidity
function revealOffers(bytes32[] ids, uint256[] prices, uint256[] nonces) external
```

#### Parameters

| Name   | Type       | Description                                           |
| ------ | ---------- | ----------------------------------------------------- |
| ids    | bytes32\[] | An array offer ids to reveal                          |
| prices | uint256\[] | An array of the offer prices to reveal                |
| nonces | uint256\[] | An array of nonce values to generate bid price hashes |

### unlockOffers

```solidity
function unlockOffers(bytes32[] ids) external
```

unlockOffers unlocks multiple offers and returns funds to the offeror

#### Parameters

| Name | Type       | Description           |
| ---- | ---------- | --------------------- |
| ids  | bytes32\[] | An array of offer ids |

### unlockOffers

```solidity
function unlockOffers(address offeror, bytes32[] ids) external
```

unlockOffers unlocks multiple offers and returns funds to the offeror

#### Parameters

| Name    | Type       | Description           |
| ------- | ---------- | --------------------- |
| offeror | address    |                       |
| ids     | bytes32\[] | An array of offer ids |

### getAllOffers

```solidity
function getAllOffers(bytes32[] revealedOffers, bytes32[] unrevealedOffers) external returns (struct TermAuctionRevealedOffer[], struct TermAuctionOffer[])
```

#### Parameters

| Name             | Type       | Description                          |
| ---------------- | ---------- | ------------------------------------ |
| revealedOffers   | bytes32\[] | An array of the revealed offer ids   |
| unrevealedOffers | bytes32\[] | An array of the unrevealed offer ids |

#### Return Values

| Name | Type                               | Description                                                                            |
| ---- | ---------------------------------- | -------------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedOffer\[] | An array of TermAuctionRevealedOffer structs containing details of the revealed offers |
| \[1] | struct TermAuctionOffer\[]         | An array of TermAuctionOffer structs containing details of the unrevealed offers       |

### unlockOfferPartial

```solidity
function unlockOfferPartial(bytes32 id, address offeror, uint256 amount) public
```

#### Parameters

| Name    | Type    | Description                             |
| ------- | ------- | --------------------------------------- |
| id      | bytes32 | An offer Id                             |
| offeror | address | Address of the offeror                  |
| amount  | uint256 | The amount of purchase tokens to unlock |

### \_lock

```solidity
function _lock(struct TermAuctionOfferSubmission offerSubmission, address authedUser, address sender) internal returns (struct TermAuctionOffer)
```

### \_unlock

```solidity
function _unlock(bytes32 id, address offeror) internal
```

### \_revealOffer

```solidity
function _revealOffer(bytes32 id, uint256 price, uint256 nonce) internal
```

*Will revert if either the price does not match the offer price or is greater than the max offer price*

#### Parameters

| Name  | Type    | Description                                                  |
| ----- | ------- | ------------------------------------------------------------ |
| id    | bytes32 | An offer Id                                                  |
| price | uint256 | The price of the offer to reveal                             |
| nonce | uint256 | The user provided nonce value to generate the bid price hash |

### \_generateOfferId

```solidity
function _generateOfferId(bytes32 id, address user) internal view returns (bytes32)
```

### \_processOfferForAuction

```solidity
function _processOfferForAuction(bytes32 id) internal
```

### \_truncateOfferStruct

```solidity
function _truncateOfferStruct(struct TermAuctionOffer hidden, uint256 price) internal pure returns (struct TermAuctionRevealedOffer revealed)
```

*This does not check the hash of the revealed offer price*

#### Parameters

| Name   | Type                    | Description                                             |
| ------ | ----------------------- | ------------------------------------------------------- |
| hidden | struct TermAuctionOffer | TermAuctionOffer to convert to TermAuctionRevealedOffer |
| price  | uint256                 | The revealed price of the offer                         |

### pauseLocking

```solidity
function pauseLocking() external
```

### unpauseLocking

```solidity
function unpauseLocking() external
```

### pauseUnlocking

```solidity
function pauseUnlocking() external
```

### unpauseUnlocking

```solidity
function unpauseUnlocking() 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 |


# Term Servicer Group

The Term Servicer group of contracts maintain records, enforce the terms of a Term Repo arrangement and automate the settlement and collateral management functions.

{% content-ref url="/pages/cS89nux3i7Knxx75WqUE" %}
[TermRepoServicer.sol](/latest/term-repo-class/term-servicer-group/termreposervicer)
{% endcontent-ref %}

{% content-ref url="/pages/yMe2hXic5SKLXZ2B48Ru" %}
[TermRepoLocker.sol](/latest/term-repo-class/term-servicer-group/termrepolocker)
{% endcontent-ref %}

{% content-ref url="/pages/Zh5wJqHZErjGlxYe408j" %}
[TermRepoCollateralManager.sol](/latest/term-repo-class/term-servicer-group/termrepocollateralmanager)
{% endcontent-ref %}

{% content-ref url="/pages/1zK41UqAf4vMD8H2oyFo" %}
[TermRepoRolloverManager.sol](/latest/term-repo-class/term-servicer-group/termreporollovermanager)
{% endcontent-ref %}


# TermRepoServicer.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract maintains records, collects and disburse repurchase payments.

## TermRepoServicer

This contract maintains records, collects and disburse repurchase payments

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

### YEAR\_SECONDS

```solidity
uint256 YEAR_SECONDS
```

### AUCTION\_LOCKER

```solidity
bytes32 AUCTION_LOCKER
```

### AUCTIONEER

```solidity
bytes32 AUCTIONEER
```

### COLLATERAL\_MANAGER

```solidity
bytes32 COLLATERAL_MANAGER
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### ROLLOVER\_TARGET\_AUCTIONEER\_ROLE

```solidity
bytes32 ROLLOVER_TARGET_AUCTIONEER_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### DIAMOND\_ROLE

```solidity
bytes32 DIAMOND_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### totalOutstandingRepurchaseExposure

```solidity
uint256 totalOutstandingRepurchaseExposure
```

### totalRepurchaseCollected

```solidity
uint256 totalRepurchaseCollected
```

### maturityTimestamp

```solidity
uint256 maturityTimestamp
```

### endOfRepurchaseWindow

```solidity
uint256 endOfRepurchaseWindow
```

### redemptionTimestamp

```solidity
uint256 redemptionTimestamp
```

block timestamp at which term repo tokens can be redeemed

### servicingFee

```solidity
uint256 servicingFee
```

percentage share of bid amounts charged to bidder

### shortfallHaircutMantissa

```solidity
uint256 shortfallHaircutMantissa
```

proportion of redemption value for redemption

### termRepoBalancedThreshold

```solidity
uint256 termRepoBalancedThreshold
```

threshold for determining whether term repo is balanced

### purchaseToken

```solidity
address purchaseToken
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoRolloverManager

```solidity
contract ITermRepoRolloverManager termRepoRolloverManager
```

### termRepoLocker

```solidity
contract ITermRepoLocker termRepoLocker
```

### termRepoToken

```solidity
contract ITermRepoToken termRepoToken
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### repurchaseExposureLedger

```solidity
mapping(address => uint256) repurchaseExposureLedger
```

### termContractPaired

```solidity
bool termContractPaired
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, uint256 maturityTimestamp_, uint256 repurchaseWindow_, uint256 redemptionBuffer_, uint256 servicingFee_, address purchaseToken_, contract ITermController termController_, contract ITermEventEmitter emitter_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoLocker_, address termRepoCollateralManager_, address termRepoToken_, address termDiamond_, address termAuctionOfferLocker_, address termAuction_, address rolloverManager_, address devopsMultisig_, address deployerWallet_, string version_) external
```

### submitRepurchasePayment

```solidity
function submitRepurchasePayment(uint256 amount) external
```

The max repurchase amount is the repurchase balance less any amounts earmarked for rollover

#### Parameters

| Name   | Type    | Description                                           |
| ------ | ------- | ----------------------------------------------------- |
| amount | uint256 | The amount of purchase token to submit for repurchase |

### submitRepurchasePayment

```solidity
function submitRepurchasePayment(address borrower, uint256 amount) external
```

Allows DIAMOND\_ROLE to submit repurchase payment on behalf of a borrower

#### Parameters

| Name     | Type    | Description                                               |
| -------- | ------- | --------------------------------------------------------- |
| borrower | address | The address of the borrower making the repurchase payment |
| amount   | uint256 | The amount of purchase token to submit for repurchase     |

### burnCollapseExposure

```solidity
function burnCollapseExposure(uint256 amountToBurn) external
```

#### Parameters

| Name         | Type    | Description                          |
| ------------ | ------- | ------------------------------------ |
| amountToBurn | uint256 | The amount of TermRepoTokens to burn |

### burnCollapseExposure

```solidity
function burnCollapseExposure(address borrower, uint256 amountToBurn) external
```

Allows DIAMOND\_ROLE to burn and collapse exposure on behalf of a borrower

#### Parameters

| Name         | Type    | Description                                                   |
| ------------ | ------- | ------------------------------------------------------------- |
| borrower     | address | The address of the borrower whose exposure is being collapsed |
| amountToBurn | uint256 | The amount of TermRepoTokens to burn                          |

### getBorrowerRepurchaseObligation

```solidity
function getBorrowerRepurchaseObligation(address borrower) external view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                          |
| -------- | ------- | ------------------------------------ |
| borrower | address | The address of the borrower to query |

#### Return Values

| Name | Type    | Description                                                     |
| ---- | ------- | --------------------------------------------------------------- |
| \[0] | uint256 | The total repurchase price due at maturity for a given borrower |

### mintOpenExposure

```solidity
function mintOpenExposure(uint256 amount, uint256[] collateralAmounts) external
```

*This method allows verified users to open repurchase price exposure against a TermRepoToken mint of corresponding value outside of a Term Auction to create new supply*

#### Parameters

| Name              | Type       | Description                                                                           |
| ----------------- | ---------- | ------------------------------------------------------------------------------------- |
| amount            | uint256    | The amount of Term Repo Tokens to mint                                                |
| collateralAmounts | uint256\[] | An array containing an amount of collateral token for each token in collateral basket |

### mintOpenExposure

```solidity
function mintOpenExposure(address borrower, uint256 amount, uint256[] collateralAmounts) external
```

*This method allows DIAMOND\_ROLE to open repurchase price exposure against a TermRepoToken mint on behalf of a borrower outside of a Term Auction to create new supply*

#### Parameters

| Name              | Type       | Description                                                                           |
| ----------------- | ---------- | ------------------------------------------------------------------------------------- |
| borrower          | address    | The address of the borrower for whom exposure is being minted                         |
| amount            | uint256    | The amount of Term Repo Tokens to mint                                                |
| collateralAmounts | uint256\[] | An array containing an amount of collateral token for each token in collateral basket |

### mintOpenExposureFromIntent

```solidity
function mintOpenExposureFromIntent(address borrower, address lender, uint256 purchaseTokenAmount, uint256[] collateralAmounts, uint256 offerRate, bool isRoutedCollateral) external returns (uint256)
```

Mint open exposure for intent-based order settlement (DIAMOND\_ROLE)

*This method allows DIAMOND\_ROLE to open repurchase price exposure against a TermRepoToken mint for intent-based orders*

#### Parameters

| Name                | Type       | Description                                                                          |
| ------------------- | ---------- | ------------------------------------------------------------------------------------ |
| borrower            | address    | The address of the borrower for whom exposure is being minted                        |
| lender              | address    | The address of the lender providing the purchase tokens                              |
| purchaseTokenAmount | uint256    | The amount of purchase tokens being lent                                             |
| collateralAmounts   | uint256\[] | An array containing collateral token amounts for each token in the collateral basket |
| offerRate           | uint256    | The interest rate for the position (percentage in 1e18 format)                       |
| isRoutedCollateral  | bool       | Whether the collateral tokens are already routed to the contract                     |

#### Return Values

| Name | Type    | Description                       |
| ---- | ------- | --------------------------------- |
| \[0] | uint256 | Amount of Term Repo Tokens minted |

### redeemTermRepoTokens

```solidity
function redeemTermRepoTokens(address redeemer, uint256 amountToRedeem) external
```

#### Parameters

| Name           | Type    | Description                            |
| -------------- | ------- | -------------------------------------- |
| redeemer       | address | The address of redeemer                |
| amountToRedeem | uint256 | The amount of TermRepoTokens to redeem |

### isTermRepoBalanced

```solidity
function isTermRepoBalanced() external view returns (bool)
```

#### Return Values

| Name | Type | Description                                                        |
| ---- | ---- | ------------------------------------------------------------------ |
| \[0] | bool | A boolean that represents whether the term repo locker is balanced |

### lockOfferAmount

```solidity
function lockOfferAmount(address sender, address offeror, uint256 amount) external
```

#### Parameters

| Name    | Type    | Description                           |
| ------- | ------- | ------------------------------------- |
| sender  | address | The address of the sender             |
| offeror | address | The address of the offeror            |
| amount  | uint256 | The amount of purchase tokens to lock |

### unlockOfferAmount

```solidity
function unlockOfferAmount(address offeror, uint256 amount) external
```

#### Parameters

| Name    | Type    | Description                               |
| ------- | ------- | ----------------------------------------- |
| offeror | address | The address of the offeror                |
| amount  | uint256 | The amount of purchase tokens to unlocked |

### fulfillOffer

```solidity
function fulfillOffer(address offeror, uint256 purchasePrice, uint256 repurchasePrice, bytes32 offerId) external
```

#### Parameters

| Name            | Type    | Description                                     |
| --------------- | ------- | ----------------------------------------------- |
| offeror         | address | The address of the offeror                      |
| purchasePrice   | uint256 | The offer amount to fulfill                     |
| repurchasePrice | uint256 | The repurchase price due to offeror at maturity |
| offerId         | bytes32 | Unique identifier for this offer                |

### fulfillBid

```solidity
function fulfillBid(address bidder, uint256 purchasePrice, uint256 repurchasePrice, address[] collateralTokens, uint256[] collateralAmounts, uint256 dayCountFractionMantissa) external
```

#### Parameters

| Name                     | Type       | Description                                                     |
| ------------------------ | ---------- | --------------------------------------------------------------- |
| bidder                   | address    | The address of the bidder                                       |
| purchasePrice            | uint256    | The bid amount to fulfill                                       |
| repurchasePrice          | uint256    | The repurchase price due at maturity                            |
| collateralTokens         | address\[] | Collateral token addresses                                      |
| collateralAmounts        | uint256\[] | Collateral token amounts                                        |
| dayCountFractionMantissa | uint256    | Actual/360 day count fraction parameter from Term Auction Group |

### approveRolloverAuction

```solidity
function approveRolloverAuction(address termAuction) external
```

#### Parameters

| Name        | Type    | Description                                                     |
| ----------- | ------- | --------------------------------------------------------------- |
| termAuction | address | The address of a TermAuction contract to receive autioneer role |

### openExposureOnRolloverNew

```solidity
function openExposureOnRolloverNew(address borrower, uint256 purchasePrice, uint256 repurchasePrice, address previousTermRepoLocker, uint256 dayCountFractionMantissa) external returns (uint256)
```

#### Parameters

| Name                     | Type    | Description                                                     |
| ------------------------ | ------- | --------------------------------------------------------------- |
| borrower                 | address | The address of the borrower rolling into new Term Repo          |
| purchasePrice            | uint256 | The purchase price received from new TermRepo                   |
| repurchasePrice          | uint256 | The new repurchase price due at maturity of new TermRepo        |
| previousTermRepoLocker   | address | The address of the old TermRepoLocker contract                  |
| dayCountFractionMantissa | uint256 | Actual/360 day count fraction parameter from Term Auction Group |

#### Return Values

| Name | Type    | Description                                                               |
| ---- | ------- | ------------------------------------------------------------------------- |
| \[0] | uint256 | The net purchase price received in after deducing protocol servicing fees |

### closeExposureOnRolloverExisting

```solidity
function closeExposureOnRolloverExisting(address borrower, uint256 rolloverSettlementAmount) external returns (uint256)
```

#### Parameters

| Name                     | Type    | Description                                                                                                           |
| ------------------------ | ------- | --------------------------------------------------------------------------------------------------------------------- |
| borrower                 | address | The address of the borrower                                                                                           |
| rolloverSettlementAmount | uint256 | The amount of net proceeds received from new TermRepo to pay down existing repurchase obligation due to old Term Repo |

#### Return Values

| Name | Type    | Description                                                                                                                        |
| ---- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| \[0] | uint256 | A uint256 representing the proportion of total repurchase due to old Term Repo from borrower settled by proceeds from new TermRepo |

### liquidatorCoverExposure

```solidity
function liquidatorCoverExposure(address borrower, address liquidator, uint256 amountToCover) external
```

#### Parameters

| Name          | Type    | Description                                               |
| ------------- | ------- | --------------------------------------------------------- |
| borrower      | address | The address of the borrower                               |
| liquidator    | address | The address of the liquidator                             |
| amountToCover | uint256 | The amount of repurchase exposure to cover in liquidation |

### liquidatorCoverExposureWithRepoToken

```solidity
function liquidatorCoverExposureWithRepoToken(address borrower, address liquidator, uint256 amountOfRepoToken) external returns (uint256)
```

#### Parameters

| Name              | Type    | Description                                            |
| ----------------- | ------- | ------------------------------------------------------ |
| borrower          | address | The address of the borrower                            |
| liquidator        | address | The address of the liquidator                          |
| amountOfRepoToken | uint256 | The amount of term tokens used to cover in liquidation |

#### Return Values

| Name | Type    | Description                                                 |
| ---- | ------- | ----------------------------------------------------------- |
| \[0] | uint256 | A uint256 representing purchase value of repo tokens burned |

### reopenToNewAuction

```solidity
function reopenToNewAuction(struct TermAuctionGroup termAuctionGroup) external
```

#### Parameters

| Name             | Type                    | Description                                                                                               |
| ---------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
| termAuctionGroup | struct TermAuctionGroup | A struct containing contract addresses of a Term Auction deployment to pair for a reopening of a TermRepo |

### \_submitRepurchasePaymentInternal

```solidity
function _submitRepurchasePaymentInternal(address borrower, uint256 amount) internal
```

### \_burnCollapseExposureInternal

```solidity
function _burnCollapseExposureInternal(address borrower, uint256 amountToBurn) internal
```

### \_mintOpenExposureInternal

```solidity
function _mintOpenExposureInternal(address borrower, address sender, uint256 amount, uint256[] collateralAmounts) internal
```

### \_isTermRepoBalanced

```solidity
function _isTermRepoBalanced() internal view returns (bool)
```

Truncation is by 4 decimal places due to the assumption that number of participants < 10000

### \_getMaxRepaymentAroundRollover

```solidity
function _getMaxRepaymentAroundRollover(address borrower) internal view returns (uint256)
```

### \_repay

```solidity
function _repay(address _borrower, address repayer_, uint256 amount_) internal
```

### \_parRedemption

```solidity
function _parRedemption(address redeemer_, uint256 amount_) internal
```

### \_proRataRedemption

```solidity
function _proRataRedemption(address redeemer_, uint256 amount_) internal
```

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


# TermRepoLocker.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This is the contract in which Term Servicer locks collateral and purchase tokens.

## TermRepoLocker

This is the contract in which Term Servicer locks collateral and purchase tokens

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

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### SERVICER\_ROLE

```solidity
bytes32 SERVICER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### transfersPaused

```solidity
bool transfersPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### whileTransfersNotPaused

```solidity
modifier whileTransfersNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, address termInitializer_) external
```

### pairTermContracts

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

### transferTokenFromWallet

```solidity
function transferTokenFromWallet(address originWallet, address token, uint256 amount) external
```

Locks tokens from origin wallet Reverts if caller doesn't have SERVICER\_ROLE

#### Parameters

| Name         | Type    | Description                              |
| ------------ | ------- | ---------------------------------------- |
| originWallet | address | The wallet from which to transfer tokens |
| token        | address | The address of token being transferred   |
| amount       | uint256 | The amount of tokens to transfer         |

### transferTokenToWallet

```solidity
function transferTokenToWallet(address destinationWallet, address token, uint256 amount) external
```

Unlocks tokens to destination wallet

*Reverts if caller doesn't have SERVICER\_ROLE*

#### Parameters

| Name              | Type    | Description                         |
| ----------------- | ------- | ----------------------------------- |
| destinationWallet | address | The wallet to unlock tokens into    |
| token             | address | The address of token being unlocked |
| amount            | uint256 | The amount of tokens to unlock      |

### pauseTransfers

```solidity
function pauseTransfers() external
```

### unpauseTransfers

```solidity
function unpauseTransfers() 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 |


# TermRepoCollateralManager.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract enforces margin maintenance rules for adding/withdrawing, and liquidating tokens.

## TermRepoCollateralManager

This contract enforces margin maintenance rules for adding/withdrawing, repurchasing and liquidating collateral

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

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTION\_LOCKER

```solidity
bytes32 AUCTION_LOCKER
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### SERVICER\_ROLE

```solidity
bytes32 SERVICER_ROLE
```

### DIAMOND\_ROLE

```solidity
bytes32 DIAMOND_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### ROLLOVER\_TARGET\_AUCTIONEER\_ROLE

```solidity
bytes32 ROLLOVER_TARGET_AUCTIONEER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### liquidationsPaused

```solidity
bool liquidationsPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### numOfAcceptedCollateralTokens

```solidity
uint8 numOfAcceptedCollateralTokens
```

### deMinimisMarginThreshold

```solidity
uint256 deMinimisMarginThreshold
```

### liquidatedDamagesDueToProtocol

```solidity
uint256 liquidatedDamagesDueToProtocol
```

### netExposureCapOnLiquidation

```solidity
uint256 netExposureCapOnLiquidation
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### purchaseToken

```solidity
address purchaseToken
```

### termPriceOracle

```solidity
contract ITermPriceOracle termPriceOracle
```

### termRepoLocker

```solidity
contract ITermRepoLocker termRepoLocker
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### collateralTokens

```solidity
address[] collateralTokens
```

### encumberedCollateralBalances

```solidity
mapping(address => uint256) encumberedCollateralBalances
```

### maintenanceCollateralRatios

```solidity
mapping(address => uint256) maintenanceCollateralRatios
```

### initialCollateralRatios

```solidity
mapping(address => uint256) initialCollateralRatios
```

### liquidatedDamages

```solidity
mapping(address => uint256) liquidatedDamages
```

### lockedCollateralLedger

```solidity
mapping(address => mapping(address => uint256)) lockedCollateralLedger
```

### isCollateralTokenAccepted

```solidity
modifier isCollateralTokenAccepted(address token)
```

### whileLiquidationsNotPaused

```solidity
modifier whileLiquidationsNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, uint256 liquidatedDamagesDueToProtocol_, uint256 netExposureCapOnLiquidation_, uint256 deMinimisMarginThreshold_, address purchaseToken_, struct Collateral[] collateralTokens_, contract ITermEventEmitter emitter_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoLocker_, address termRepoServicer_, address termAuctionBidLocker_, address termAuction_, address termController_, address termPriceOracle_, address termRepoRolloverManager_, address termDiamond_, address devopsMultisig_, address adminWallet_) external
```

### externalLockCollateral

```solidity
function externalLockCollateral(address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                 |
| --------------- | ------- | ------------------------------------------- |
| collateralToken | address | The address of the collateral token to lock |
| amount          | uint256 | The amount of collateral token to lock      |

### externalLockCollateral

```solidity
function externalLockCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                                     |
| --------------- | ------- | --------------------------------------------------------------- |
| borrower        | address | The address of the borrower for whom collateral is being locked |
| collateralToken | address | The address of the collateral token to lock                     |
| amount          | uint256 | The amount of collateral token to lock                          |

### externalUnlockCollateral

```solidity
function externalUnlockCollateral(address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                   |
| --------------- | ------- | --------------------------------------------- |
| collateralToken | address | The address of the collateral token to unlock |
| amount          | uint256 | The amount of collateral token to unlock      |

### externalUnlockCollateral

```solidity
function externalUnlockCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                                       |
| --------------- | ------- | ----------------------------------------------------------------- |
| borrower        | address | The address of the borrower for whom collateral is being unlocked |
| collateralToken | address | The address of the collateral token to unlock                     |
| amount          | uint256 | The amount of collateral token to unlock                          |

### batchLiquidation

```solidity
function batchLiquidation(address borrower, uint256[] closureAmounts) external
```

#### Parameters

| Name           | Type       | Description                                                                                                                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower       | address    | The address of the borrower                                                                                                                                            |
| closureAmounts | uint256\[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |

### batchLiquidationWithRepoToken

```solidity
function batchLiquidationWithRepoToken(address borrower, uint256[] closureRepoTokenAmounts) external
```

#### Parameters

| Name                    | Type       | Description                                                                                                                                                                                 |
| ----------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower                | address    | The address of the borrower                                                                                                                                                                 |
| closureRepoTokenAmounts | uint256\[] | An array specifying the amounts of Term Repo Tokens the liquidator proposes to cover borrower repo exposure in liquidation; an amount is required to be specified for each collateral token |

### batchDefault

```solidity
function batchDefault(address borrower, uint256[] closureAmounts) external
```

#### Parameters

| Name           | Type       | Description                                                                                                                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower       | address    | The address of the borrower                                                                                                                                            |
| closureAmounts | uint256\[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |

### batchDefaultWithRepoToken

```solidity
function batchDefaultWithRepoToken(address borrower, uint256[] closureRepoTokenAmounts) external
```

#### Parameters

| Name                    | Type       | Description                                                                                                                                                                                         |
| ----------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower                | address    | The address of the borrower                                                                                                                                                                         |
| closureRepoTokenAmounts | uint256\[] | An array specifying the amounts of Term Repo Tokens the liquidator proposes to cover borrower repo exposure in default liquidation; an amount is required to be specified for each collateral token |

### calculateMintableExposure

```solidity
function calculateMintableExposure(address collateralToken, uint256 amountToLock) external view returns (struct ExponentialNoError.Exp)
```

#### Parameters

| Name            | Type    | Description                                   |
| --------------- | ------- | --------------------------------------------- |
| collateralToken | address | The collateral token address of tokens locked |
| amountToLock    | uint256 | The amount of collateral tokens to lock       |

### getCollateralBalances

```solidity
function getCollateralBalances(address borrower) external view returns (address[], uint256[])
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type       | Description                                                     |
| ---- | ---------- | --------------------------------------------------------------- |
| \[0] | address\[] | An array of collateral token addresses                          |
| \[1] | uint256\[] | An array collateral token balances locked on behalf of borrower |

### getCollateralBalance

```solidity
function getCollateralBalance(address borrower, address collateralToken) external view returns (uint256)
```

#### Parameters

| Name            | Type    | Description                           |
| --------------- | ------- | ------------------------------------- |
| borrower        | address | The address of the borrower           |
| collateralToken | address | The collateral token address to query |

#### Return Values

| Name | Type    | Description                                                        |
| ---- | ------- | ------------------------------------------------------------------ |
| \[0] | uint256 | uint256 The amount of collateralToken locked on behalf of borrower |

### encumberedCollateralRemaining

```solidity
function encumberedCollateralRemaining() external view returns (bool)
```

#### Return Values

| Name | Type | Description                                                                |
| ---- | ---- | -------------------------------------------------------------------------- |
| \[0] | bool | bool A boolean that tests whether any encumbered collateral remains locked |

### auctionLockCollateral

```solidity
function auctionLockCollateral(address sender, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                       |
| --------------- | ------- | ------------------------------------------------- |
| sender          | address | The address of the sender locking collateral      |
| collateralToken | address | The address of the token to be used as collateral |
| amount          | uint256 | The amount of the token to lock                   |

### auctionUnlockCollateral

```solidity
function auctionUnlockCollateral(address sender, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                    |
| --------------- | ------- | ---------------------------------------------- |
| sender          | address | The address of the sender unlocking collateral |
| collateralToken | address | The address of the token used as collateral    |
| amount          | uint256 | The amount of collateral tokens to unlock      |

### encumberExistingCollateral

```solidity
function encumberExistingCollateral(address borrower) external
```

Marks a borrower's currently locked collateral as encumbered across all accepted collateral tokens

#### Parameters

| Name     | Type    | Description                                                             |
| -------- | ------- | ----------------------------------------------------------------------- |
| borrower | address | The address of the borrower whose locked collateral is being encumbered |

### acceptRolloverCollateral

```solidity
function acceptRolloverCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                             |
| --------------- | ------- | --------------------------------------- |
| borrower        | address | The address of the borrower             |
| collateralToken | address | The address of a collateral token       |
| amount          | uint256 | The amount of collateral tokens to lock |

### transferRolloverCollateral

```solidity
function transferRolloverCollateral(address borrower, uint256 rolloverProportion, address rolloverTermRepoLocker) external returns (address[], uint256[])
```

#### Parameters

| Name                   | Type    | Description                                                                                       |
| ---------------------- | ------- | ------------------------------------------------------------------------------------------------- |
| borrower               | address | The borrower's address                                                                            |
| rolloverProportion     | uint256 | The proportion of the collateral to be unlocked, equal to the proportion of the collateral repaid |
| rolloverTermRepoLocker | address | The address of the new TermRepoLocker contract to roll into                                       |

#### Return Values

| Name | Type       | Description                                                                                                    |
| ---- | ---------- | -------------------------------------------------------------------------------------------------------------- |
| \[0] | address\[] | An array representing a list of accepted collateral token addresses                                            |
| \[1] | uint256\[] | An array containing the amount of collateral tokens to pairoff and transfer to new TermRepoLocker to roll into |

### approveRolloverAuction

```solidity
function approveRolloverAuction(address rolloverAuction) external
```

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| rolloverAuction | address | The address of the rollover auction |

### unlockCollateralOnRepurchase

```solidity
function unlockCollateralOnRepurchase(address borrower) external
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

### journalBidCollateralToCollateralManager

```solidity
function journalBidCollateralToCollateralManager(address borrower, address[] collateralTokenAddresses, uint256[] collateralTokenAmounts) external
```

#### Parameters

| Name                     | Type       | Description                 |
| ------------------------ | ---------- | --------------------------- |
| borrower                 | address    | The address of the borrower |
| collateralTokenAddresses | address\[] | Collateral token addresses  |
| collateralTokenAmounts   | uint256\[] | Collateral token amounts    |

### mintOpenExposureLockCollateral

```solidity
function mintOpenExposureLockCollateral(address borrower, address sender, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                  |
| --------------- | ------- | -------------------------------------------- |
| borrower        | address | The address of the borrower                  |
| sender          | address | The address of the sender locking collateral |
| collateralToken | address | Collateral token addresse                    |
| amount          | uint256 | Collateral token amount                      |

### reopenToNewAuction

```solidity
function reopenToNewAuction(struct TermAuctionGroup termAuctionGroup) external
```

#### Parameters

| Name             | Type                    | Description                   |
| ---------------- | ----------------------- | ----------------------------- |
| termAuctionGroup | struct TermAuctionGroup | A struct of auction contracts |

### pauseLiquidations

```solidity
function pauseLiquidations() external
```

### unpauseLiquidations

```solidity
function unpauseLiquidations() external
```

### isBorrowerInShortfall

```solidity
function isBorrowerInShortfall(address borrower) public view returns (bool)
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type | Description                                                                  |
| ---- | ---- | ---------------------------------------------------------------------------- |
| \[0] | bool | Boolean testing whether the given borrower is in shortfall or margin deficit |

### getCollateralMarketValue

```solidity
function getCollateralMarketValue(address borrower) public view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type    | Description                                                         |
| ---- | ------- | ------------------------------------------------------------------- |
| \[0] | uint256 | The market value of borrower's locked collateral denominated in USD |

### \_externalLockCollateralInternal

```solidity
function _externalLockCollateralInternal(address borrower, address sender, address collateralToken, uint256 amount) internal
```

### \_externalUnlockCollateralInternal

```solidity
function _externalUnlockCollateralInternal(address borrower, address collateralToken, uint256 amount) internal
```

### \_lockCollateral

```solidity
function _lockCollateral(address borrower, address sender, address collateralToken, uint256 amount) internal
```

### \_unlockCollateral

```solidity
function _unlockCollateral(address borrower, address collateralToken, uint256 amount, bool decrementEncumberedCollateral) internal
```

### \_partialUnlockCollateral

```solidity
function _partialUnlockCollateral(address borrower, uint256 unlockProportion, address destinationwallet) internal returns (uint256[])
```

### \_encumberExistingCollateralInternal

```solidity
function _encumberExistingCollateralInternal(address borrower) internal
```

*Adds a borrower's existing locked collateral balances to encumberedCollateralBalances*

#### Parameters

| Name     | Type    | Description                                              |
| -------- | ------- | -------------------------------------------------------- |
| borrower | address | The address of the borrower whose collateral to encumber |

### \_validateBatchLiquidationForFullLiquidation

```solidity
function _validateBatchLiquidationForFullLiquidation(address borrower, address liquidator, uint256[] closureTokenAmounts) internal returns (bool)
```

*A helper function to validate various conditions required to liquidate*

#### Return Values

| Name | Type | Description                                                           |
| ---- | ---- | --------------------------------------------------------------------- |
| \[0] | bool | A boolean for whether borrower position eligible for full liquidation |

### \_unencumberRemainingBorrowerCollateralOnZeroObligation

```solidity
function _unencumberRemainingBorrowerCollateralOnZeroObligation(address borrower) internal
```

### \_withinNetExposureCapOnLiquidation

```solidity
function _withinNetExposureCapOnLiquidation(address borrower) internal view returns (bool)
```

### \_collateralSeizureAmounts

```solidity
function _collateralSeizureAmounts(uint256 amountToCover_, address collateralToken) internal view returns (uint256, uint256)
```

*returns total amount of collateral seized in liquidation and the amount of that total going protocol*

### \_transferLiquidationCollateral

```solidity
function _transferLiquidationCollateral(address borrower, address liquidator, address collateralAddress, uint256 closureAmount, uint256 collateralSeizureAmount, uint256 collateralSeizureProtocolShare, bool isDefault) internal
```

*A helper function to transfer tokens and update relevant state variables and mappings*

### \_isAcceptedCollateralToken

```solidity
function _isAcceptedCollateralToken(address token_) internal view returns (bool)
```

### \_usdValueOfBalances

```solidity
function _usdValueOfBalances(mapping(address => uint256) _tokenBalances) internal view returns (uint256)
```

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


# TermRepoRolloverManager.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract accepts and carries out borrower Term Repo rollover instructions.

## TermRepoRolloverManager

This contract accepts and carries out borrower Term Repo rollover instructions

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

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### ROLLOVER\_BID\_FULFILLER\_ROLE

```solidity
bytes32 ROLLOVER_BID_FULFILLER_ROLE
```

### DIAMOND\_ROLE

```solidity
bytes32 DIAMOND_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### approvedRolloverAuctionBidLockers

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

### rolloverElections

```solidity
mapping(address => struct TermRepoRolloverElection) rolloverElections
```

### termContractPaired

```solidity
bool termContractPaired
```

### notPastRepaymentWindow

```solidity
modifier notPastRepaymentWindow()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, contract ITermRepoServicer termRepoServicer_, contract ITermRepoCollateralManager termRepoCollateralManager_, contract ITermController termController_, address termInitializer_) external
```

### pairTermContracts

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

### electRollover

```solidity
function electRollover(struct TermRepoRolloverElectionSubmission termRepoRolloverElectionSubmission) external
```

An external function that accepted Term Repo rollover instructions

#### Parameters

| Name                               | Type                                      | Description                                        |
| ---------------------------------- | ----------------------------------------- | -------------------------------------------------- |
| termRepoRolloverElectionSubmission | struct TermRepoRolloverElectionSubmission | A struct containing borrower rollover instructions |

### electRollover

```solidity
function electRollover(address borrower, struct TermRepoRolloverElectionSubmission termRepoRolloverElectionSubmission) external
```

Allows DIAMOND\_ROLE to elect rollover on behalf of a borrower

#### Parameters

| Name                               | Type                                      | Description                                                    |
| ---------------------------------- | ----------------------------------------- | -------------------------------------------------------------- |
| borrower                           | address                                   | The address of the borrower for whom rollover is being elected |
| termRepoRolloverElectionSubmission | struct TermRepoRolloverElectionSubmission | A struct containing borrower rollover instructions             |

### getRolloverInstructions

```solidity
function getRolloverInstructions(address borrower) external view returns (struct TermRepoRolloverElection)
```

A view function that returns borrower rollover instructions

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type                            | Description                                        |
| ---- | ------------------------------- | -------------------------------------------------- |
| \[0] | struct TermRepoRolloverElection | A struct containing borrower rollover instructions |

### cancelRollover

```solidity
function cancelRollover() external
```

An external function to cancel previously submitted rollover instructions

### cancelRollover

```solidity
function cancelRollover(address borrower) external
```

Allows DIAMOND\_ROLE to cancel rollover on behalf of a borrower

#### Parameters

| Name     | Type    | Description                                                      |
| -------- | ------- | ---------------------------------------------------------------- |
| borrower | address | The address of the borrower for whom rollover is being cancelled |

### fulfillRollover

```solidity
function fulfillRollover(address borrower) external
```

An external function called by repo servicer to mark rollover as fulfilled

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

### approveRolloverAuction

```solidity
function approveRolloverAuction(contract ITermAuctionBidLocker auctionBidLocker) external
```

#### Parameters

| Name             | Type                           | Description                                 |
| ---------------- | ------------------------------ | ------------------------------------------- |
| auctionBidLocker | contract ITermAuctionBidLocker | The ABI for ITermAuctionBidLocker interface |

### revokeRolloverApproval

```solidity
function revokeRolloverApproval(contract ITermAuctionBidLocker auctionBidLocker) external
```

#### Parameters

| Name             | Type                           | Description                                 |
| ---------------- | ------------------------------ | ------------------------------------------- |
| auctionBidLocker | contract ITermAuctionBidLocker | The ABI for ITermAuctionBidLocker interface |

### \_electRolloverInternal

```solidity
function _electRolloverInternal(address borrower, struct TermRepoRolloverElectionSubmission termRepoRolloverElectionSubmission) internal
```

### \_cancelRolloverInternal

```solidity
function _cancelRolloverInternal(address borrower) internal
```

### \_processRollover

```solidity
function _processRollover(address borrowerToRollover) internal
```

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


# TermRepoToken.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This is an ERC-20 contract to track claims to the aggregate repurchase obligations due on the r

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

### getCollateralRequirements

```solidity
function getCollateralRequirements() external view returns (address[] collateralTokens, uint256[] maintenanceRatios)
```

#### Return Values

| Name              | Type       | Description                                                                                   |
| ----------------- | ---------- | --------------------------------------------------------------------------------------------- |
| collateralTokens  | address\[] | An array of collateral token addresses eligible to serve as collateral backing this repoToken |
| maintenanceRatios | uint256\[] | An array of maintenance ratios applicable to each collateral token backing this repoToken     |

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


# Protocol Class

Protocol contracts are evergreen contracts at the protocol level that govern and apply across all Term Repos.

{% content-ref url="/pages/KHOHEMVIlSmn4JKjwVjD" %}
[TermController.sol](/latest/protocol-class/termcontroller)
{% endcontent-ref %}

{% content-ref url="/pages/nqKA4PR494YcdjBjkPk0" %}
[TermEventEmitter.sol](/latest/protocol-class/termeventemitter)
{% endcontent-ref %}

{% content-ref url="/pages/ZwaW8HJamIyRG8ylKMUV" %}
[TermInitializer.sol](/latest/protocol-class/terminitializer)
{% endcontent-ref %}

{% content-ref url="/pages/KcBkhsMKxql5ap5x0DAK" %}
[TermPriceConsumerV3.sol](/latest/protocol-class/termpriceconsumerv3)
{% endcontent-ref %}


# TermController.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract manages Term Finance protocol permissions and controls

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


# TermEventEmitter.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract is a centralized event emitter that records important events to the blockchain

## TermEventEmitter

This contract is a centralized event emitter that records important events to the blockchain

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

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### TERM\_CONTRACT

```solidity
bytes32 TERM_CONTRACT
```

### TERM\_DELISTER

```solidity
bytes32 TERM_DELISTER
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address devopsWallet_, address termDelister_, address termInitializer_, address adminWallet_, address termDiamond_) external
```

### pairTermFactory

```solidity
function pairTermFactory(address termFactory) external
```

### pairTermContract

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

### emitTermAuctionInitialized

```solidity
function emitTermAuctionInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuction, uint256 auctionEndTime, address deployerWallet, string version) external
```

#### Parameters

| Name           | Type    | Description                                                  |
| -------------- | ------- | ------------------------------------------------------------ |
| termRepoId     | bytes32 | The id of the current Term Repo deployment being initialized |
| termAuctionId  | bytes32 | The id of the auction being initialized                      |
| termAuction    | address | The address of the auction contract being initialized        |
| auctionEndTime | uint256 | The end time of the auction being initialized                |
| deployerWallet | address |                                                              |
| version        | string  | The version tag of the smart contract deployed               |

### emitBidAssigned

```solidity
function emitBidAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount) external
```

#### Parameters

| Name          | Type    | Description                     |
| ------------- | ------- | ------------------------------- |
| termAuctionId | bytes32 | A Term Auction id               |
| id            | bytes32 | A bid id                        |
| amount        | uint256 | The amount assigned to this bid |

### emitOfferAssigned

```solidity
function emitOfferAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount) external
```

#### Parameters

| Name          | Type    | Description                       |
| ------------- | ------- | --------------------------------- |
| termAuctionId | bytes32 | A Term Auction id                 |
| id            | bytes32 | An offer id                       |
| amount        | uint256 | The amount assigned to this offer |

### emitAuctionCompleted

```solidity
function emitAuctionCompleted(bytes32 termAuctionId, uint256 timestamp, uint256 blockNumber, uint256 totalAssignedBids, uint256 totalAssignedOffers, uint256 clearingPrice) external
```

#### Parameters

| Name                | Type    | Description                                  |
| ------------------- | ------- | -------------------------------------------- |
| termAuctionId       | bytes32 | The Term Auction id of auction completed     |
| timestamp           | uint256 | The timestamp of the current block           |
| blockNumber         | uint256 | The number of the current block              |
| totalAssignedBids   | uint256 | The number of assigned bids in the auction   |
| totalAssignedOffers | uint256 | The number of assigned offers in the auction |
| clearingPrice       | uint256 | The clearing price of the auction            |

### emitAuctionCancelled

```solidity
function emitAuctionCancelled(bytes32 termAuctionId, bool nonViableAuction, bool auctionCancelledforWithdrawal) external
```

#### Parameters

| Name                          | Type    | Description                                                     |
| ----------------------------- | ------- | --------------------------------------------------------------- |
| termAuctionId                 | bytes32 | The id of the auction cancelled                                 |
| nonViableAuction              | bool    | Auction not viable due to bid and offer prices not intersecting |
| auctionCancelledforWithdrawal | bool    | Auction has been cancelled for manual fund withdrawal           |

### emitCompleteAuctionPaused

```solidity
function emitCompleteAuctionPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                     |
| ------------- | ------- | ----------------------------------------------- |
| termAuctionId | bytes32 | The id of the auction paused                    |
| termRepoId    | bytes32 | The Term Repo id associated with auction paused |

### emitCompleteAuctionUnpaused

```solidity
function emitCompleteAuctionUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                       |
| ------------- | ------- | ------------------------------------------------- |
| termAuctionId | bytes32 | The id of the auction unpaused                    |
| termRepoId    | bytes32 | The Term Repo id associated with auction unpaused |

### emitTermAuctionBidLockerInitialized

```solidity
function emitTermAuctionBidLockerInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuctionBidLocker, uint256 auctionStartTime, uint256 revealTime, uint256 maxBidPrice, uint256 minimumTenderAmount, uint256 dayCountFractionMantissa) external
```

#### Parameters

| Name                     | Type    | Description                                                       |
| ------------------------ | ------- | ----------------------------------------------------------------- |
| termRepoId               | bytes32 | The Term Repo id associated with BidLocker initialized            |
| termAuctionId            | bytes32 | The Term Auction id associated with BidLocker initialized         |
| termAuctionBidLocker     | address | The address of the TermAuctionBidLocker contract being intialized |
| auctionStartTime         | uint256 | The time at which auction bids will be accepted for submission    |
| revealTime               | uint256 | The time at which sealed auction bids can be revealed             |
| maxBidPrice              | uint256 | The maximum bid price for the auction                             |
| minimumTenderAmount      | uint256 | The minimum tender amount for the auction                         |
| dayCountFractionMantissa | uint256 | The day count fraction remainder                                  |

### emitBidLocked

```solidity
function emitBidLocked(bytes32 termAuctionId, struct TermAuctionBid bid, address referralAddress) external
```

#### Parameters

| Name            | Type                  | Description                                        |
| --------------- | --------------------- | -------------------------------------------------- |
| termAuctionId   | bytes32               | A Term Auction id                                  |
| bid             | struct TermAuctionBid | A struct containing details of the locked bid      |
| referralAddress | address               | The address of the referrer. Zero Address if none. |

### emitBidRevealed

```solidity
function emitBidRevealed(bytes32 termAuctionId, bytes32 id, uint256 bidPrice) external
```

#### Parameters

| Name          | Type    | Description                   |
| ------------- | ------- | ----------------------------- |
| termAuctionId | bytes32 | A Term Auction id             |
| id            | bytes32 | The bid id                    |
| bidPrice      | uint256 | The revealed price of the bid |

### emitBidUnlocked

```solidity
function emitBidUnlocked(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | A bid id          |

### emitBidInShortfall

```solidity
function emitBidInShortfall(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | A bid id          |

### emitBidLockingPaused

```solidity
function emitBidLockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                        |
| ------------- | ------- | -------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid locking is paused |
| termRepoId    | bytes32 | The Term Repo id where bid locking is paused       |

### emitBidLockingUnpaused

```solidity
function emitBidLockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid locking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where bid locking is unpaused       |

### emitBidUnlockingPaused

```solidity
function emitBidUnlockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid unlocking is paused |
| termRepoId    | bytes32 | The Term Repo id where bid unlocking is paused       |

### emitBidUnlockingUnpaused

```solidity
function emitBidUnlockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where bid unlocking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where bid unlocking is unpaused       |

### emitTermAuctionOfferLockerInitialized

```solidity
function emitTermAuctionOfferLockerInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuctionOfferLocker, uint256 auctionStartTime, uint256 revealTime, uint256 maxOfferPrice, uint256 minimumTenderAmount) external
```

#### Parameters

| Name                   | Type    | Description                                                         |
| ---------------------- | ------- | ------------------------------------------------------------------- |
| termRepoId             | bytes32 | The Term Repo id associated with OfferLocker initialized            |
| termAuctionId          | bytes32 | The Term Auction id associated with OfferLocker initialized         |
| termAuctionOfferLocker | address | The address of the TermAuctionOfferLocker contract being intialized |
| auctionStartTime       | uint256 | The time at which auction bids will be accepted for submission      |
| revealTime             | uint256 | The time at which sealed auction bids can be revealed               |
| maxOfferPrice          | uint256 | The maximum offer price for the auction                             |
| minimumTenderAmount    | uint256 | The minimum tender amount for the auction                           |

### emitOfferLocked

```solidity
function emitOfferLocked(bytes32 termAuctionId, bytes32 id, address offeror, bytes32 offerPrice, uint256 amount, address purchaseToken, address referralAddress) external
```

#### Parameters

| Name            | Type    | Description                                        |
| --------------- | ------- | -------------------------------------------------- |
| termAuctionId   | bytes32 | A Term Auction id                                  |
| id              | bytes32 | An offer id                                        |
| offeror         | address | The address of the offeror                         |
| offerPrice      | bytes32 | The offer price                                    |
| amount          | uint256 | The amount of purchase tokens offered              |
| purchaseToken   | address | The address of the purchase token being offered    |
| referralAddress | address | The address of the referrer. Zero Address if none. |

### emitOfferRevealed

```solidity
function emitOfferRevealed(bytes32 termAuctionId, bytes32 id, uint256 offerPrice) external
```

#### Parameters

| Name          | Type    | Description              |
| ------------- | ------- | ------------------------ |
| termAuctionId | bytes32 | A Term Auction id        |
| id            | bytes32 | An offer id              |
| offerPrice    | uint256 | The offer price revealed |

### emitOfferUnlocked

```solidity
function emitOfferUnlocked(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | An offer id       |

### emitOfferLockingPaused

```solidity
function emitOfferLockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where offer locking is paused |
| termRepoId    | bytes32 | The Term Repo id where offer locking is paused       |

### emitOfferLockingUnpaused

```solidity
function emitOfferLockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where offer locking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where offer locking is unpaused       |

### emitOfferUnlockingPaused

```solidity
function emitOfferUnlockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where offer unlocking is paused |
| termRepoId    | bytes32 | The Term Repo id where offer unlocking is paused       |

### emitOfferUnlockingUnpaused

```solidity
function emitOfferUnlockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                              |
| ------------- | ------- | -------------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where offer unlocking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where offer unlocking is unpaused       |

### emitTermRepoCollateralManagerInitialized

```solidity
function emitTermRepoCollateralManagerInitialized(bytes32 termRepoId, address termRepoCollateralManager, address[] collateralTokens, uint256[] initialCollateralRatios, uint256[] maintenanceCollateralRatios, uint256[] liquidatedDamagesSchedule) external
```

#### Parameters

| Name                        | Type       | Description                                                                     |
| --------------------------- | ---------- | ------------------------------------------------------------------------------- |
| termRepoId                  | bytes32    | The Term Repo id associated with collateral manger being initialized            |
| termRepoCollateralManager   | address    | The address of the TermRepoCollateralManager contract being intialized          |
| collateralTokens            | address\[] | An array containing a list of the addresses of all accepted collateral tokens   |
| initialCollateralRatios     | uint256\[] | An array containing the initial collateral ratios for each collateral token     |
| maintenanceCollateralRatios | uint256\[] | An array containing the maintenance collateral ratios for each collateral token |
| liquidatedDamagesSchedule   | uint256\[] | An array containing the liquidated damages applicable to each collateral token  |

### emitPairReopeningBidLocker

```solidity
function emitPairReopeningBidLocker(bytes32 termRepoId, address termRepoCollateralManager, address termAuctionBidLocker) external
```

#### Parameters

| Name                      | Type    | Description                                                            |
| ------------------------- | ------- | ---------------------------------------------------------------------- |
| termRepoId                | bytes32 | The Term Repo id for the Term Repo being reopened                      |
| termRepoCollateralManager | address | The TermRepoCollateralManager address for the Term Repo being reopened |
| termAuctionBidLocker      | address | The new TermAuctionBidLocker to be paired for reopening                |

### emitCollateralLocked

```solidity
function emitCollateralLocked(bytes32 termRepoId, address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                |
| --------------- | ------- | ------------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                             |
| borrower        | address | The address of the borrower                |
| collateralToken | address | The address of the collateral token locked |
| amount          | uint256 | The amount of collateral being locked      |

### emitCollateralUnlocked

```solidity
function emitCollateralUnlocked(bytes32 termRepoId, address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                |
| --------------- | ------- | ------------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                             |
| borrower        | address | The address of the borrower                |
| collateralToken | address | The address of the collateral token locked |
| amount          | uint256 | The amount of collateral being unlocked    |

### emitLiquidation

```solidity
function emitLiquidation(bytes32 termRepoId, address borrower, address liquidator, uint256 closureAmount, address collateralToken, uint256 amountLiquidated, uint256 protocolSeizureAmount, bool defaultLiquidation) external
```

#### Parameters

| Name                  | Type    | Description                                     |
| --------------------- | ------- | ----------------------------------------------- |
| termRepoId            | bytes32 | A Term Repo id                                  |
| borrower              | address | The address of the borrower                     |
| liquidator            | address | The address of the liquidator                   |
| closureAmount         | uint256 | The amount of repurchase exposure covered       |
| collateralToken       | address | The address of the collateral tokens liquidated |
| amountLiquidated      | uint256 | The amount of collateral tokens liquidated      |
| protocolSeizureAmount | uint256 |                                                 |
| defaultLiquidation    | bool    |                                                 |

### emitLiquidationPaused

```solidity
function emitLiquidationPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                       |
| ---------- | ------- | ------------------------------------------------- |
| termRepoId | bytes32 | The id of Term Repo where liquidations are paused |

### emitLiquidationUnpaused

```solidity
function emitLiquidationUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                       |
| ---------- | ------- | ------------------------------------------------- |
| termRepoId | bytes32 | The id of Term Repo where liquidation is unpaused |

### emitTermRepoServicerInitialized

```solidity
function emitTermRepoServicerInitialized(bytes32 termRepoId, address termRepoServicer, address purchaseToken, uint256 maturityTimestamp, uint256 endOfRepurchaseWindow, uint256 redemptionTimestamp, uint256 servicingFee, address deployerWallet, string version) external
```

#### Parameters

| Name                  | Type    | Description                                                         |
| --------------------- | ------- | ------------------------------------------------------------------- |
| termRepoId            | bytes32 | The Term Repo id associated with TermRepoServicer being initialized |
| termRepoServicer      | address | The address of the TermRepoServicer contract being initialized      |
| purchaseToken         | address | The address of the purchase token                                   |
| maturityTimestamp     | uint256 | The time at which repurchase is due                                 |
| endOfRepurchaseWindow | uint256 | The time at which the repurchase window ends                        |
| redemptionTimestamp   | uint256 | The time when redemption of Term Repo Tokens begins                 |
| servicingFee          | uint256 | percentage share of bid amounts charged to bidder                   |
| deployerWallet        | address |                                                                     |
| version               | string  | The version tag of the smart contract deployed                      |

### emitReopeningOfferLockerPaired

```solidity
function emitReopeningOfferLockerPaired(bytes32 termRepoId, address termRepoServicer, address termAuctionOfferLocker, address termAuction) external
```

#### Parameters

| Name                   | Type    | Description                                                                   |
| ---------------------- | ------- | ----------------------------------------------------------------------------- |
| termRepoId             | bytes32 | The Term Repo id for the Term Repo being reopened                             |
| termRepoServicer       | address | The address of the TermRepoServicer contract for the Term Repo being reopened |
| termAuctionOfferLocker | address | The TermAuctionOfferLocker to be paired for reopening                         |
| termAuction            | address | The address of the TermAuction contract to be paired for reopening            |

### emitOfferLockedByServicer

```solidity
function emitOfferLockedByServicer(bytes32 termRepoId, address offeror, uint256 amount) external
```

This event is not to be confused with OfferLocked by TermOfferLocker Both this event and OfferLocked will be triggered, this one specifically refers to corresponding action taken by Term Servicer

#### Parameters

| Name       | Type    | Description                   |
| ---------- | ------- | ----------------------------- |
| termRepoId | bytes32 | A Term Repo id                |
| offeror    | address | The address of the offeror    |
| amount     | uint256 | The offer amount to be locked |

### emitOfferUnlockedByServicer

```solidity
function emitOfferUnlockedByServicer(bytes32 termRepoId, address offeror, uint256 amount) external
```

This event is not to be confused with OfferUnlocked by TermOfferLocker Both this event and OfferLocked will be triggered, this one specifically refers to corresponding action taken by Term Servicer

#### Parameters

| Name       | Type    | Description                     |
| ---------- | ------- | ------------------------------- |
| termRepoId | bytes32 | A Term Repo id                  |
| offeror    | address | The address of the offeror      |
| amount     | uint256 | The offer amount to be unlocked |

### emitOfferFulfilled

```solidity
function emitOfferFulfilled(bytes32 offerId, address offeror, uint256 purchasePrice, uint256 repurchasePrice, uint256 repoTokensMinted) external
```

#### Parameters

| Name             | Type    | Description                                      |
| ---------------- | ------- | ------------------------------------------------ |
| offerId          | bytes32 | A unique offer id                                |
| offeror          | address | The address of the offeror                       |
| purchasePrice    | uint256 | The offer amount fulfilled                       |
| repurchasePrice  | uint256 | The repurchase price due to offeror at maturity  |
| repoTokensMinted | uint256 | The amount of Term Repo Tokens minted to offeror |

### emitTermRepoTokensRedeemed

```solidity
function emitTermRepoTokensRedeemed(bytes32 termRepoId, address redeemer, uint256 redemptionAmount, uint256 redemptionHaircut) external
```

#### Parameters

| Name              | Type    | Description                                                                    |
| ----------------- | ------- | ------------------------------------------------------------------------------ |
| termRepoId        | bytes32 | A Term Repo id                                                                 |
| redeemer          | address | The address of the redeemer                                                    |
| redemptionAmount  | uint256 | The amount of TermRepoTokens redeemed                                          |
| redemptionHaircut | uint256 | The haircut applied to redemptions (if any) due to unrecoverable repo exposure |

### emitBidFulfilled

```solidity
function emitBidFulfilled(bytes32 termRepoId, address bidder, uint256 purchasePrice, uint256 repurchasePrice, uint256 servicingFees) external
```

#### Parameters

| Name            | Type    | Description                          |
| --------------- | ------- | ------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                       |
| bidder          | address | The address of the bidder            |
| purchasePrice   | uint256 | The bid amount fulfilled in auction  |
| repurchasePrice | uint256 | The repurchase price due at maturity |
| servicingFees   | uint256 | The fees earned by the protocol      |

### emitExposureOpenedOnRolloverNew

```solidity
function emitExposureOpenedOnRolloverNew(bytes32 termRepoId, address borrower, uint256 purchasePrice, uint256 repurchasePrice, uint256 servicingFees) external
```

#### Parameters

| Name            | Type    | Description                                              |
| --------------- | ------- | -------------------------------------------------------- |
| termRepoId      | bytes32 | A Term Repo id                                           |
| borrower        | address | The address of the borrower                              |
| purchasePrice   | uint256 | The purchase price received from new TermRepo            |
| repurchasePrice | uint256 | The new repurchase price due at maturity of new TermRepo |
| servicingFees   | uint256 | The fees earned by the protocol                          |

### emitExposureClosedOnRolloverExisting

```solidity
function emitExposureClosedOnRolloverExisting(bytes32 termRepoId, address borrower, uint256 amountRolled) external
```

#### Parameters

| Name         | Type    | Description                                             |
| ------------ | ------- | ------------------------------------------------------- |
| termRepoId   | bytes32 | A Term Repo id                                          |
| borrower     | address | The address of the borrower                             |
| amountRolled | uint256 | The repurchase exposure balance closed on old Term Repo |

### emitRepurchasePaymentSubmitted

```solidity
function emitRepurchasePaymentSubmitted(bytes32 termRepoId, address borrower, uint256 amount) external
```

#### Parameters

| Name       | Type    | Description                         |
| ---------- | ------- | ----------------------------------- |
| termRepoId | bytes32 | A Term Repo id                      |
| borrower   | address | The address of the borrower         |
| amount     | uint256 | The amount submitted for repurchase |

### emitMintExposureAccessGranted

```solidity
function emitMintExposureAccessGranted(bytes32 termRepoId, address authedUser) external
```

#### Parameters

| Name       | Type    | Description                       |
| ---------- | ------- | --------------------------------- |
| termRepoId | bytes32 | A Term Repo id                    |
| authedUser | address | User granted mint exposure access |

### emitMintExposure

```solidity
function emitMintExposure(bytes32 termRepoId, address minter, uint256 netTokensReceived, uint256 servicingFeeTokens, uint256 repurchasePrice) external
```

#### Parameters

| Name               | Type    | Description                                                             |
| ------------------ | ------- | ----------------------------------------------------------------------- |
| termRepoId         | bytes32 | A Term Repo id                                                          |
| minter             | address | The address of the minter                                               |
| netTokensReceived  | uint256 | The amount of Term Repo Tokens received by minter net of servicing fees |
| servicingFeeTokens | uint256 | The number of Term Repo Tokens retained by protocol in servicing fees   |
| repurchasePrice    | uint256 | The repurchase exposure opened by minter against Term Repo Token mint   |

### emitBurnCollapseExposure

```solidity
function emitBurnCollapseExposure(bytes32 termRepoId, address borrower, uint256 closeAmount) external
```

#### Parameters

| Name        | Type    | Description                                |
| ----------- | ------- | ------------------------------------------ |
| termRepoId  | bytes32 | A Term Repo id                             |
| borrower    | address | The address of the borrower                |
| closeAmount | uint256 | The amount of repurchase exposure to close |

### emitTermRepoRolloverManagerInitialized

```solidity
function emitTermRepoRolloverManagerInitialized(bytes32 termRepoId, address rolloverManager) external
```

#### Parameters

| Name            | Type    | Description                                                                |
| --------------- | ------- | -------------------------------------------------------------------------- |
| termRepoId      | bytes32 | The Term Repo id associated with TermRepoRolloverManager being initialized |
| rolloverManager | address | The address of the TermRepoRolloverManager contract being initialized      |

### emitRolloverTermApproved

```solidity
function emitRolloverTermApproved(bytes32 termRepoId, bytes32 rolloverTermAuctionId) external
```

#### Parameters

| Name                  | Type    | Description                                                  |
| --------------------- | ------- | ------------------------------------------------------------ |
| termRepoId            | bytes32 | The Term Repo id of existing Term Repo                       |
| rolloverTermAuctionId | bytes32 | The Term Auction Id that rollover bid will be submitted into |

### emitRolloverTermApprovalRevoked

```solidity
function emitRolloverTermApprovalRevoked(bytes32 termRepoId, bytes32 rolloverTermAuctionId) external
```

#### Parameters

| Name                  | Type    | Description                                            |
| --------------------- | ------- | ------------------------------------------------------ |
| termRepoId            | bytes32 | The Term Repo id of existing Term Repo                 |
| rolloverTermAuctionId | bytes32 | The Term Auction Id whose rollover approval is revoked |

### emitRolloverElection

```solidity
function emitRolloverElection(bytes32 termRepoId, bytes32 rolloverTermRepoId, address borrower, address rolloverAuction, uint256 rolloverAmount, bytes32 hashedBidPrice) external
```

#### Parameters

| Name               | Type    | Description                                     |
| ------------------ | ------- | ----------------------------------------------- |
| termRepoId         | bytes32 | The Term Repo id of existing Term Repo          |
| rolloverTermRepoId | bytes32 | The Term Repo Id of Rollover Term Repo          |
| borrower           | address | The address of the borrower                     |
| rolloverAuction    | address | The address of the auction being rolled over to |
| rolloverAmount     | uint256 | The repurchase amount being rolled over         |
| hashedBidPrice     | bytes32 | The hash of the rollover bid price              |

### emitRolloverCancellation

```solidity
function emitRolloverCancellation(bytes32 termRepoId, address borrower) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The Term Repo id of existing Term Repo |
| borrower   | address | The address of the borrower            |

### emitRolloverProcessed

```solidity
function emitRolloverProcessed(bytes32 termRepoId, address borrower) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The Term Repo id of existing Term Repo |
| borrower   | address | The address of the borrower            |

### emitTermRepoLockerInitialized

```solidity
function emitTermRepoLockerInitialized(bytes32 termRepoId, address termRepoLocker) external
```

#### Parameters

| Name           | Type    | Description                                                                |
| -------------- | ------- | -------------------------------------------------------------------------- |
| termRepoId     | bytes32 | The Term Repo id associated with TermRepoLocker contract being initialized |
| termRepoLocker | address | The address of the TermRepoLocker contract being initialized               |

### emitTermRepoLockerTransfersPaused

```solidity
function emitTermRepoLockerTransfersPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| termRepoId | bytes32 | A Term Repo id |

### emitTermRepoLockerTransfersUnpaused

```solidity
function emitTermRepoLockerTransfersUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| termRepoId | bytes32 | A Term Repo id |

### emitTermRepoTokenInitialized

```solidity
function emitTermRepoTokenInitialized(bytes32 termRepoId, address termRepoToken, uint256 redemptionRatio) external
```

#### Parameters

| Name            | Type    | Description                                                                 |
| --------------- | ------- | --------------------------------------------------------------------------- |
| termRepoId      | bytes32 | The Term Repo id associated with the TermRepoToken being initalized         |
| termRepoToken   | address | The address of the TermRepoToken contract being initialized                 |
| redemptionRatio | uint256 | The number of purchase tokens redeemable per unit of Term Repo Token at par |

### emitTermRepoTokenMintingPaused

```solidity
function emitTermRepoTokenMintingPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                |
| ---------- | ------- | -------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where minting is paused |

### emitTermRepoTokenMintingUnpaused

```solidity
function emitTermRepoTokenMintingUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where minting is unpaused |

### emitTermRepoTokenBurningPaused

```solidity
function emitTermRepoTokenBurningPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                |
| ---------- | ------- | -------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where burning is paused |

### emitTermRepoTokenBurningUnpaused

```solidity
function emitTermRepoTokenBurningUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where burning is unpaused |

### emitIntentFilled

```solidity
function emitIntentFilled(bytes32 orderHash, bytes32 termRepoId, address purchaseToken, address maker, address taker, address makerToken, address takerToken, uint256 offerRate, uint256 makerTokenAmountFilled, uint256 takerTokenAmountFilled, uint256 proratedBorrowFee, address feeRecipient, uint256 originalOrderAmount, uint256 expiry, uint256 salt) external
```

#### Parameters

| Name                   | Type    | Description                                                         |
| ---------------------- | ------- | ------------------------------------------------------------------- |
| orderHash              | bytes32 | The hash of the order that was filled                               |
| termRepoId             | bytes32 | The Term Repo id associated with the intent                         |
| purchaseToken          | address | The address of the purchase token                                   |
| maker                  | address | The address of the maker                                            |
| taker                  | address | The address of the taker                                            |
| makerToken             | address | The address of the maker's token                                    |
| takerToken             | address | The address of the taker's token                                    |
| offerRate              | uint256 | The rate of the offer                                               |
| makerTokenAmountFilled | uint256 | The amount of maker tokens filled                                   |
| takerTokenAmountFilled | uint256 | The amount of taker tokens filled                                   |
| proratedBorrowFee      | uint256 | The prorated fee for borrow                                         |
| feeRecipient           | address | The address that receives the fees                                  |
| originalOrderAmount    | uint256 | The original purchaseTokenAmount of the maker provided by the Maker |
| expiry                 | uint256 | The expiration date of the order                                    |
| salt                   | uint256 | The user generated value for order uniqueness and replay protection |

### emitIntentCancelled

```solidity
function emitIntentCancelled(bytes32 orderHash) external
```

#### Parameters

| Name      | Type    | Description                              |
| --------- | ------- | ---------------------------------------- |
| orderHash | bytes32 | The hash of the order that was cancelled |

### emitRepoTokenSwapFilled

```solidity
function emitRepoTokenSwapFilled(bytes32 orderHash, struct ITermIntentEvents.RepoTokenSwapData swapData) external
```

#### Parameters

| Name      | Type                                       | Description                               |
| --------- | ------------------------------------------ | ----------------------------------------- |
| orderHash | bytes32                                    | The hash of the order that was filled     |
| swapData  | struct ITermIntentEvents.RepoTokenSwapData | The swap data containing all swap details |

### emitLimitOrderTokenPairMinSaltValue

```solidity
function emitLimitOrderTokenPairMinSaltValue(address maker, address makerToken, address takerToken, uint256 minSaltValue) external
```

Emits an event for the minimum salt value of a limit order token pair

*This function can only be called by contracts with the TERM\_CONTRACT role*

#### Parameters

| Name         | Type    | Description                                           |
| ------------ | ------- | ----------------------------------------------------- |
| maker        | address | The address of the order maker                        |
| makerToken   | address | The address of the token being offered by the maker   |
| takerToken   | address | The address of the token being requested by the maker |
| minSaltValue | uint256 | The minimum salt value for this token pair            |

### emitSwapOrderTokenPairMinSaltValue

```solidity
function emitSwapOrderTokenPairMinSaltValue(address maker, address makerToken, address takerToken, uint256 minSaltValue) external
```

Emits an event for the minimum salt value of a swap order token pair

*This function can only be called by contracts with the TERM\_CONTRACT role*

#### Parameters

| Name         | Type    | Description                                           |
| ------------ | ------- | ----------------------------------------------------- |
| maker        | address | The address of the order maker                        |
| makerToken   | address | The address of the token being offered by the maker   |
| takerToken   | address | The address of the token being requested by the maker |
| minSaltValue | uint256 | The minimum salt value for this token pair            |

### emitDelistTermRepo

```solidity
function emitDelistTermRepo(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The id of the Term Repo being delisted |

### emitDelistTermAuction

```solidity
function emitDelistTermAuction(bytes32 termAuctionId) external
```

#### Parameters

| Name          | Type    | Description                               |
| ------------- | ------- | ----------------------------------------- |
| termAuctionId | bytes32 | The id of the Term Auction being delisted |

### emitTermContractUpgraded

```solidity
function emitTermContractUpgraded(address proxy, address implementation) external
```

#### Parameters

| Name           | Type    | Description                                             |
| -------------- | ------- | ------------------------------------------------------- |
| proxy          | address | address of proxy contract                               |
| implementation | address | address of new impl contract proxy has been upgraded to |

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# TermInitializer.sol

This contract provides utility methods for initializing/pairing a set of term/auction contracts

## TermInitializer

This contract provides utility methods for initializing/pairing a set of term/auction contracts

*This contract operates at the protocol level and provides utility functions for deploying terms/auctions*

### DeployingPaused

```solidity
error DeployingPaused()
```

### DEPLOYER\_ROLE

```solidity
bytes32 DEPLOYER_ROLE
```

### INITIALIZER\_APPROVAL\_ROLE

```solidity
bytes32 INITIALIZER_APPROVAL_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### controller

```solidity
contract ITermController controller
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### priceOracle

```solidity
contract TermPriceConsumerV3 priceOracle
```

### termDiamond

```solidity
address termDiamond
```

### deployingPaused

```solidity
bool deployingPaused
```

### whileDeployingNotPaused

```solidity
modifier whileDeployingNotPaused()
```

### constructor

```solidity
constructor(address initializerApprovalRole_, address devopsWallet_) public
```

### pairTermContracts

```solidity
function pairTermContracts(contract ITermController controller_, contract ITermEventEmitter emitter_, contract TermPriceConsumerV3 priceOracle_, address termDiamond_) external
```

### setupTerm

```solidity
function setupTerm(struct TermContractGroup termContractGroup, address devOpsMultiSig, address adminWallet, address deployerWallet, string termVersion, string auctionVersion) external
```

Sets up a set of deployed term contracts

### setupAuction

```solidity
function setupAuction(contract TermRepoServicer termRepoServicer, contract TermRepoCollateralManager termRepoCollateralManager, contract TermAuctionOfferLocker termAuctionOfferLocker, contract TermAuctionBidLocker termAuctionBidLocker, contract TermAuction auction, address devOpsMultiSig, address adminWallet, address deployerWallet, string auctionVersion) external
```

Sets up a set of deployed term contracts

### pauseDeploying

```solidity
function pauseDeploying() external
```

### unpauseDeploying

```solidity
function unpauseDeploying() external
```


# TermPriceConsumerV3.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract is a centralized price oracle contract that feeds pricing data to all Term Repos.

## TermPriceConsumerV3

This contract is a centralized price oracle contract that feeds pricing data to all Term Repos

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

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### DEFAULT\_MAX\_DATA\_TIMESTAMP\_AHEAD\_SECONDS

```solidity
uint256 DEFAULT_MAX_DATA_TIMESTAMP_AHEAD_SECONDS
```

### priceFeeds

```solidity
mapping(address => struct TermPriceFeedConfig) priceFeeds
```

### fallbackPriceFeeds

```solidity
mapping(address => struct TermPriceFeedConfig) fallbackPriceFeeds
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address devopsWallet_) external
```

Intializes with an array of token addresses, followed with an array of Chainlink aggregator addresses <https://docs.chain.link/docs/ethereum-addresses/>

### usdValueOfTokens

```solidity
function usdValueOfTokens(address token, uint256 amount) external view returns (struct ExponentialNoError.Exp)
```

A function to return current market value given a token address and an amount

#### Parameters

| Name   | Type    | Description                       |
| ------ | ------- | --------------------------------- |
| token  | address | The address of the token to query |
| amount | uint256 | The amount tokens to value        |

#### Return Values

| Name | Type                          | Description                                                        |
| ---- | ----------------------------- | ------------------------------------------------------------------ |
| \[0] | struct ExponentialNoError.Exp | The current market value of tokens at the specified amount, in USD |

### addNewTokenPriceFeedAndFallbackPriceFeed

```solidity
function addNewTokenPriceFeedAndFallbackPriceFeed(address token, address tokenPriceAggregator, uint256 tokenPriceAggregatorRefreshRateThreshold, address fallbackPriceAggregator, uint256 fallbackPriceAggregatorRefreshRateThreshold) external
```

#### Parameters

| Name                                        | Type    | Description                                                                             |
| ------------------------------------------- | ------- | --------------------------------------------------------------------------------------- |
| token                                       | address | The address of the token to add a price feed for                                        |
| tokenPriceAggregator                        | address | The price aggregator address for token to be added                                      |
| tokenPriceAggregatorRefreshRateThreshold    | uint256 | Refresh threshold in seconds for primary price feed updates beyond which price is stale |
| fallbackPriceAggregator                     | address | The fallback price aggregator address for token to be added                             |
| fallbackPriceAggregatorRefreshRateThreshold | uint256 | Refresh threshold for fallback price feed updates beyond which price is stale           |

### addNewTokenPriceFeed

```solidity
function addNewTokenPriceFeed(address token, address tokenPriceAggregator, uint256 refreshRateThreshold) external
```

#### Parameters

| Name                 | Type    | Description                                                                             |
| -------------------- | ------- | --------------------------------------------------------------------------------------- |
| token                | address | The address of the token to add a price feed for                                        |
| tokenPriceAggregator | address | The proxy price aggregator address for token to be added                                |
| refreshRateThreshold | uint256 | Refresh threshold in seconds for primary price feed updates beyond which price is stale |

### addNewTokenFallbackPriceFeed

```solidity
function addNewTokenFallbackPriceFeed(address token, address tokenPriceAggregator, uint256 refreshRateThreshold) external
```

#### Parameters

| Name                 | Type    | Description                                                                              |
| -------------------- | ------- | ---------------------------------------------------------------------------------------- |
| token                | address | The address of the token to add a price feed for                                         |
| tokenPriceAggregator | address | The proxy price aggregator address for token to be added                                 |
| refreshRateThreshold | uint256 | Refresh threshold in seconds for fallback price feed updates beyond which price is stale |

### removeTokenPriceFeed

```solidity
function removeTokenPriceFeed(address token) external
```

#### Parameters

| Name  | Type    | Description                                                   |
| ----- | ------- | ------------------------------------------------------------- |
| token | address | The address of the token whose price feed needs to be removed |

### removeFallbackTokenPriceFeed

```solidity
function removeFallbackTokenPriceFeed(address token) external
```

#### Parameters

| Name  | Type    | Description                                                   |
| ----- | ------- | ------------------------------------------------------------- |
| token | address | The address of the token whose price feed needs to be removed |

### getPriceFeedConfig

```solidity
function getPriceFeedConfig(address token) external view returns (address priceFeed, uint256 refreshRateThreshold)
```

Get the primary price feed configuration for a token

#### Parameters

| Name  | Type    | Description                       |
| ----- | ------- | --------------------------------- |
| token | address | The address of the token to query |

#### Return Values

| Name                 | Type    | Description                                      |
| -------------------- | ------- | ------------------------------------------------ |
| priceFeed            | address | The address of the primary price feed aggregator |
| refreshRateThreshold | uint256 | The refresh rate threshold in seconds            |

### getFallbackPriceFeedConfig

```solidity
function getFallbackPriceFeedConfig(address token) external view returns (address fallbackPriceFeed, uint256 refreshRateThreshold)
```

Get the fallback price feed configuration for a token

#### Parameters

| Name  | Type    | Description                       |
| ----- | ------- | --------------------------------- |
| token | address | The address of the token to query |

#### Return Values

| Name                 | Type    | Description                                       |
| -------------------- | ------- | ------------------------------------------------- |
| fallbackPriceFeed    | address | The address of the fallback price feed aggregator |
| refreshRateThreshold | uint256 | The refresh rate threshold in seconds             |

### \_addNewTokenPriceFeed

```solidity
function _addNewTokenPriceFeed(address token, address tokenPriceAggregator, uint256 refreshRateThreshold) internal
```

#### Parameters

| Name                 | Type    | Description                                                                             |
| -------------------- | ------- | --------------------------------------------------------------------------------------- |
| token                | address | The address of the token to add a price feed for                                        |
| tokenPriceAggregator | address | The proxy price aggregator address for token to be added                                |
| refreshRateThreshold | uint256 | Refresh threshold in seconds for primary price feed updates beyond which price is stale |

### \_addNewTokenFallbackPriceFeed

```solidity
function _addNewTokenFallbackPriceFeed(address token, address tokenPriceAggregator, uint256 refreshRateThreshold) internal
```

#### Parameters

| Name                 | Type    | Description                                                                              |
| -------------------- | ------- | ---------------------------------------------------------------------------------------- |
| token                | address | The address of the token to add a price feed for                                         |
| tokenPriceAggregator | address | The proxy price aggregator address for token to be added                                 |
| refreshRateThreshold | uint256 | Refresh threshold in seconds for fallback price feed updates beyond which price is stale |

### \_getLatestPrice

```solidity
function _getLatestPrice(address token) internal view returns (int256 latestPrice, uint8 decimals)
```

#### Return Values

| Name        | Type   | Description                            |
| ----------- | ------ | -------------------------------------- |
| latestPrice | int256 | The latest price from price aggregator |
| decimals    | uint8  | The decimals in the price              |

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# Solidity API - 0.5.31

Detailed specifications for Term Finance Protocol v1 contracts can be found here. The groups are broken down by category as described [here](https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/term-finance-protocol/README.md).


# Term Repo Class

Each deployment of a Term Repo is comprised of a set of smart contracts broadly divided into three groups: (i) the Term Auction Group, (ii) the Term Servicer Group and (iii) the Term Repo Token.

{% content-ref url="/pages/i6H3VJvBUccszv3riMvU" %}
[Term Auction Group](/0.5.32/term-repo-class/term-auction-group)
{% endcontent-ref %}

{% content-ref url="/pages/0C97PVSyVb1mRQdTCNGf" %}
[Term Servicer Group](/0.5.31/term-repo-class/term-servicer-group)
{% endcontent-ref %}

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.31/term-repo-class/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.31/term-repo-class/broken-reference/README.md>
{% endcontent-ref %}


# Term Auction Group

The Term Auction group of contracts contain the logic to handle and process bid and offer submissions, determine an auction clearing price, and to settle and clear a Term Auction.

{% content-ref url="/pages/YlhqiAfOxtv0l5sUeDRN" %}
[TermAuction.sol](/0.5.32/term-repo-class/term-auction-group/termauction)
{% endcontent-ref %}

{% content-ref url="/pages/K30Bq9qxsM6pEdqMR7rh" %}
[TermAuctionBidLocker.sol](/0.5.31/term-repo-class/term-auction-group/termauctionbidlocker)
{% endcontent-ref %}

{% content-ref url="/pages/rocc595kL89fSccUnO93" %}
[TermAuctionOfferLocker.sol](/0.5.31/term-repo-class/term-auction-group/termauctionofferlocker)
{% endcontent-ref %}


# TermAuction.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract calculates a clearing price in a blind double auction and manages auction clearing

## TermAuction

This contract calculates a clearing price in a blind double auction and manages auction clearing and settlement

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

### ClearingPriceState

```solidity
struct ClearingPriceState {
  uint256 offerPrice;
  uint256 offerIndex;
  uint256 bidIndex;
  uint256 cumSumOffers;
  uint256 cumSumBids;
  uint256 maxClearingVolume;
  uint256 nextOfferIndex;
  uint256 nextBidIndex;
  uint256 nextCumSumOffers;
  uint256 nextCumSumBids;
  uint256 nextOfferPrice;
  uint256 nextMaxClearingVolume;
  bool minCumSumCorrection;
  uint256 nextBidPrice;
  uint256 clearingPrice;
}
```

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 THREESIXTY_DAYCOUNT_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### dayCountFractionMantissa

```solidity
uint256 dayCountFractionMantissa
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termAuctionBidLocker

```solidity
contract ITermAuctionBidLocker termAuctionBidLocker
```

### termAuctionOfferLocker

```solidity
contract ITermAuctionOfferLocker termAuctionOfferLocker
```

### purchaseToken

```solidity
contract IERC20MetadataUpgradeable purchaseToken
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### clearingPrice

```solidity
uint256 clearingPrice
```

### clearingPricePostProcessingOffset

```solidity
uint256 clearingPricePostProcessingOffset
```

### auctionCompleted

```solidity
bool auctionCompleted
```

### auctionCancelledForWithdrawal

```solidity
bool auctionCancelledForWithdrawal
```

### completeAuctionPaused

```solidity
bool completeAuctionPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### onlyWhileAuctionClosed

```solidity
modifier onlyWhileAuctionClosed()
```

This only runs if the auction is closed (after auction end time)

*This uses the block timestamp to determine if the auction is closed*

### whenCompleteAuctionNotPaused

```solidity
modifier whenCompleteAuctionNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionEndTime_, uint256 termStart_, uint256 redemptionTimestamp_, contract IERC20MetadataUpgradeable purchaseToken_, address termAuctionInitializer_, uint256 clearingPricePostProcessingOffset_) external
```

Initializes the contract

*See: <https://docs.openzeppelin.com/contracts/4.x/upgradeable>*

### pairTermContracts

```solidity
function pairTermContracts(contract ITermEventEmitter emitter_, contract ITermRepoServicer termRepoServicer_, contract ITermAuctionBidLocker termAuctionBidLocker_, contract ITermAuctionOfferLocker termAuctionOfferLocker_, address devopsMultisigAddress_, address adminWallet_, string version_) external
```

### completeAuction

```solidity
function completeAuction(struct CompleteAuctionInput completeAuctionInput) external
```

Calculates an auction's clearing price, assigns bids/offers, and returns unassigned funds

#### Parameters

| Name                 | Type                        | Description                                                                               |
| -------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| completeAuctionInput | struct CompleteAuctionInput | A struct containing all revealed and unrevealed bids and offers and expired rollover bids |

### cancelAuction

```solidity
function cancelAuction(struct CompleteAuctionInput completeAuctionInput) public
```

Cancels an auction and returns all funds to bidders and fulfillBiders

#### Parameters

| Name                 | Type                        | Description                                                                               |
| -------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| completeAuctionInput | struct CompleteAuctionInput | A struct containing all revealed and unrevealed bids and offers and expired rollover bids |

### cancelAuctionForWithdrawal

```solidity
function cancelAuctionForWithdrawal(address[] rolloverBorrowers, address[] rolloverPairOffTermRepoServicer) public
```

Cancels an auction and sets auctionCancelledForWithdrawal to true to open unlocking tenders

### \_increaseCumSumBids

```solidity
function _increaseCumSumBids(struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex, uint256 previousCumSumBids, uint256 currentPrice) internal pure returns (uint256, uint256)
```

### \_decreaseCumSumBids

```solidity
function _decreaseCumSumBids(struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex, uint256 previousCumSumBids, uint256 currentPrice) internal pure returns (uint256, uint256)
```

### \_minUint256

```solidity
function _minUint256(uint256 a, uint256 b) internal pure returns (uint256)
```

Returns the min of two `uint256` values

#### Parameters

| Name | Type    | Description                 |
| ---- | ------- | --------------------------- |
| a    | uint256 | The first value to compare  |
| b    | uint256 | The second value to compare |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The min of the two values |

### \_calculateClearingPrice

```solidity
function _calculateClearingPrice(struct TermAuctionRevealedBid[] sortedBids, struct TermAuctionRevealedOffer[] sortedOffers, uint256 clearingOffset) internal pure returns (uint256, uint256)
```

Calculates the intersection between bid/offer schedules to arrive at a clearing price

*Imagine a graph with price along the X-axis and cumsum(bid/offerAmount\*price) along the Y-axis. This function finds the point where the supply line crosses the demand line using binary search*

#### Parameters

| Name           | Type                               | Description                                                                                         |
| -------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------- |
| sortedBids     | struct TermAuctionRevealedBid\[]   | A sorted array of bids used to arrive at a demand schedule                                          |
| sortedOffers   | struct TermAuctionRevealedOffer\[] | A sorted array of offers used to arrive at a supply schedule                                        |
| clearingOffset | uint256                            | The offset to apply to the marginal bid and offer indexes when calculating the final clearing price |

#### Return Values

| Name | Type    | Description                                                   |
| ---- | ------- | ------------------------------------------------------------- |
| \[0] | uint256 | clearingPrice The price at which Term Auction will be cleared |
| \[1] | uint256 |                                                               |

### \_findFirstIndexForPrice

```solidity
function _findFirstIndexForPrice(uint256 price, struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex) internal pure returns (uint256 i, uint256 totalAmount)
```

Finds the index of the first bid with a bidPrice of `price` and calculate the cumsum of the bid amounts up to that index

#### Parameters

| Name       | Type                             | Description                       |
| ---------- | -------------------------------- | --------------------------------- |
| price      | uint256                          | The price to search for           |
| sortedBids | struct TermAuctionRevealedBid\[] | An array of sorted bids to search |
| startIndex | uint256                          | The index to start searching from |

#### Return Values

| Name        | Type    | Description                                           |
| ----------- | ------- | ----------------------------------------------------- |
| i           | uint256 | The index of the first bid with a bidPrice of `price` |
| totalAmount | uint256 | The cumsum of the bid amounts up to return index i    |

### \_findLastIndexForPrice

```solidity
function _findLastIndexForPrice(uint256 price, struct TermAuctionRevealedOffer[] sortedOffers, uint256 startIndex) internal pure returns (uint256 i, uint256 totalAmount)
```

Finds the index of the last offer with a offerPrice of `price` and calculate the cumsum of the offer amounts up to that index

#### Parameters

| Name         | Type                               | Description                       |
| ------------ | ---------------------------------- | --------------------------------- |
| price        | uint256                            | The price to search for           |
| sortedOffers | struct TermAuctionRevealedOffer\[] | An array of offers to search      |
| startIndex   | uint256                            | The index to start searching from |

#### Return Values

| Name        | Type    | Description                                              |
| ----------- | ------- | -------------------------------------------------------- |
| i           | uint256 | The index of the last offer with a offerPrice of `price` |
| totalAmount | uint256 | The cumsum of the offer amounts up to return index i     |

### \_fullyAssignBid

```solidity
function _fullyAssignBid(struct TermAuctionRevealedBid bid) internal returns (uint256)
```

Fully assigns a bid

#### Parameters

| Name | Type                          | Description       |
| ---- | ----------------------------- | ----------------- |
| bid  | struct TermAuctionRevealedBid | The bid to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_fullyAssignOffer

```solidity
function _fullyAssignOffer(struct TermAuctionRevealedOffer offer) internal returns (uint256)
```

Fully assigns an offer

#### Parameters

| Name  | Type                            | Description         |
| ----- | ------------------------------- | ------------------- |
| offer | struct TermAuctionRevealedOffer | The offer to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_partiallyAssignBid

```solidity
function _partiallyAssignBid(struct TermAuctionRevealedBid bid, uint256 assignedAmount) internal returns (uint256)
```

Partially assigns a bid

#### Parameters

| Name           | Type                          | Description          |
| -------------- | ----------------------------- | -------------------- |
| bid            | struct TermAuctionRevealedBid | The bid to assign    |
| assignedAmount | uint256                       | The amount to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_partiallyAssignOffer

```solidity
function _partiallyAssignOffer(struct TermAuctionRevealedOffer offer, uint256 assignedAmount) internal returns (uint256)
```

Partially assigns an offer

#### Parameters

| Name           | Type                            | Description          |
| -------------- | ------------------------------- | -------------------- |
| offer          | struct TermAuctionRevealedOffer | The offer to assign  |
| assignedAmount | uint256                         | The amount to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_assignRolloverBid

```solidity
function _assignRolloverBid(address borrower, uint256 purchasePrice, uint256 repurchasePrice, address rolloverPairOffTermRepoServicer) internal
```

### \_markRolloverAsProcessed

```solidity
function _markRolloverAsProcessed(address rolloverPairOffTermRepoServicer, address borrower) internal
```

### \_assignBids

```solidity
function _assignBids(struct TermAuctionRevealedBid[] sortedBids, uint256 maxAssignable, uint256 purchaseTokenDecimals) internal returns (uint256)
```

Assigns bids up to `maxAssignable`

*This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single bid*

#### Parameters

| Name                  | Type                             | Description                                                    |
| --------------------- | -------------------------------- | -------------------------------------------------------------- |
| sortedBids            | struct TermAuctionRevealedBid\[] | An array of sorted bids to process                             |
| maxAssignable         | uint256                          | The maximum bid amount that can be assigned across all bidders |
| purchaseTokenDecimals | uint256                          | The number of decimals of the purchase token                   |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The total amount assigned |

### \_assignOffers

```solidity
function _assignOffers(struct TermAuctionRevealedOffer[] sortedOffers, uint256 maxAssignable, uint256 purchaseTokenDecimals) internal returns (uint256)
```

Assigns offers up to `maxAssignable`

*This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single offer*

#### Parameters

| Name                  | Type                               | Description                                                     |
| --------------------- | ---------------------------------- | --------------------------------------------------------------- |
| sortedOffers          | struct TermAuctionRevealedOffer\[] | An array of sorted offers to process                            |
| maxAssignable         | uint256                            | The maximum offer amount that can be assigned across all offers |
| purchaseTokenDecimals | uint256                            | The number of decimals of the purchase token                    |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The total amount assigned |

### \_calculateRepurchasePrice

```solidity
function _calculateRepurchasePrice(uint256 purchasePrice) internal view returns (uint256)
```

Calculates repurchase price given a purchase price (equivalent to principal plus interest)

#### Parameters

| Name          | Type    | Description        |
| ------------- | ------- | ------------------ |
| purchasePrice | uint256 | The purchase price |

#### Return Values

| Name | Type    | Description                                                                                       |
| ---- | ------- | ------------------------------------------------------------------------------------------------- |
| \[0] | uint256 | The repurchase price obtained by applying the clearing rate on an Actual/360 day-count convention |

### \_calculateAndStoreClearingPrice

```solidity
function _calculateAndStoreClearingPrice(struct TermAuctionRevealedBid[] sortedBids, struct TermAuctionRevealedOffer[] sortedOffers) internal returns (uint256, uint256)
```

### pauseCompleteAuction

```solidity
function pauseCompleteAuction() external
```

\_This function pauses the TermAuction contract preventing public state changes See {Pausable-*pause}.*

### unpauseCompleteAuction

```solidity
function unpauseCompleteAuction() external
```

Unpuses the TermAuction contract allowing public state changes

\_See {Pausable-*unpause}.*

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


# TermAuctionBidLocker.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract handles and proceesses Term Auction bid submissions

## TermAuctionBidLocker

This contract handles and proceesses Term Auction bid submissions

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

### MAX\_BID\_PRICE

```solidity
uint256 MAX_BID_PRICE
```

### MAX\_BID\_COUNT

```solidity
uint256 MAX_BID_COUNT
```

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 THREESIXTY_DAYCOUNT_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTIONEER\_ROLE

```solidity
bytes32 AUCTIONEER_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionStartTime

```solidity
uint256 auctionStartTime
```

### revealTime

```solidity
uint256 revealTime
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### minimumTenderAmount

```solidity
uint256 minimumTenderAmount
```

### dayCountFractionMantissa

```solidity
uint256 dayCountFractionMantissa
```

### purchaseToken

```solidity
address purchaseToken
```

### collateralTokens

```solidity
mapping(contract IERC20Upgradeable => bool) collateralTokens
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termPriceOracle

```solidity
contract ITermPriceOracle termPriceOracle
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termAuction

```solidity
contract ITermAuction termAuction
```

### bids

```solidity
mapping(bytes32 => struct TermAuctionBid) bids
```

### bidCount

```solidity
uint256 bidCount
```

### termContractPaired

```solidity
bool termContractPaired
```

### lockingPaused

```solidity
bool lockingPaused
```

### unlockingPaused

```solidity
bool unlockingPaused
```

### onlyWhileAuctionOpen

```solidity
modifier onlyWhileAuctionOpen()
```

### onlyWhileAuctionRevealing

```solidity
modifier onlyWhileAuctionRevealing()
```

### onlyBidder

```solidity
modifier onlyBidder(address bidder, address authedUser)
```

### whenLockingNotPaused

```solidity
modifier whenLockingNotPaused()
```

### whenUnlockingNotPaused

```solidity
modifier whenUnlockingNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionStartTime_, uint256 revealTime_, uint256 auctionEndTime_, uint256 redemptionTimestamp_, uint256 minimumTenderAmount_, address purchaseToken_, contract IERC20Upgradeable[] collateralTokens_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termAuction_, contract ITermRepoServicer termRepoServicer_, contract ITermEventEmitter emitter_, contract ITermRepoCollateralManager termRepoCollateralManager_, contract ITermPriceOracle termPriceOracle_, address devopsMultisig_, address adminWallet_) external
```

### pairRolloverManager

```solidity
function pairRolloverManager(address rolloverManager) external
```

#### Parameters

| Name            | Type    | Description                                         |
| --------------- | ------- | --------------------------------------------------- |
| rolloverManager | address | The address of the TermRepoRolloverManager contract |

### lockBidsWithReferral

```solidity
function lockBidsWithReferral(struct TermAuctionBidSubmission[] bidSubmissions, address referralAddress) external returns (bytes32[])
```

#### Parameters

| Name            | Type                               | Description                                                                                                        |
| --------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| bidSubmissions  | struct TermAuctionBidSubmission\[] | An array of Term Auction bid submissions to borrow an amount of money at rate up to but not exceeding the bid rate |
| referralAddress | address                            | A user address that referred the submitter of this bid                                                             |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockRolloverBid

```solidity
function lockRolloverBid(struct TermAuctionBid bid) external
```

#### Parameters

| Name | Type                  | Description                            |
| ---- | --------------------- | -------------------------------------- |
| bid  | struct TermAuctionBid | A struct containing details of the bid |

### lockBids

```solidity
function lockBids(struct TermAuctionBidSubmission[] bidSubmissions) external returns (bytes32[])
```

#### Parameters

| Name           | Type                               | Description                 |
| -------------- | ---------------------------------- | --------------------------- |
| bidSubmissions | struct TermAuctionBidSubmission\[] | An array of bid submissions |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockedBid

```solidity
function lockedBid(bytes32 id) external view returns (struct TermAuctionBid)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | bytes32 | A bid Id    |

#### Return Values

| Name | Type                  | Description                                   |
| ---- | --------------------- | --------------------------------------------- |
| \[0] | struct TermAuctionBid | A struct containing details of the locked bid |

### revealBids

```solidity
function revealBids(bytes32[] ids, uint256[] prices, uint256[] nonces) external
```

#### Parameters

| Name   | Type       | Description                                           |
| ------ | ---------- | ----------------------------------------------------- |
| ids    | bytes32\[] | An array of bid ids of the bids to reveal             |
| prices | uint256\[] | An array of the bid prices to reveal                  |
| nonces | uint256\[] | An array of nonce values to generate bid price hashes |

### unlockBids

```solidity
function unlockBids(bytes32[] ids) external
```

unlockBids unlocks multiple bids and returns funds to the bidder

#### Parameters

| Name | Type       | Description               |
| ---- | ---------- | ------------------------- |
| ids  | bytes32\[] | An array of ids to unlock |

### getAllBids

```solidity
function getAllBids(bytes32[] revealedBids, bytes32[] expiredRolloverBids, bytes32[] unrevealedBids) external returns (struct TermAuctionRevealedBid[], struct TermAuctionBid[])
```

#### Parameters

| Name                | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| revealedBids        | bytes32\[] | An array of the revealed offer ids       |
| expiredRolloverBids | bytes32\[] | An array of the expired rollover bid ids |
| unrevealedBids      | bytes32\[] | An array of the unrevealed offer ids     |

#### Return Values

| Name | Type                             | Description                                                                        |
| ---- | -------------------------------- | ---------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedBid\[] | An array of TermAuctionRevealedBid structs containing details of the revealed bids |
| \[1] | struct TermAuctionBid\[]         | An array of TermAuctionBid structs containing details of the unrevealed bids       |

### auctionUnlockBid

```solidity
function auctionUnlockBid(bytes32 id, address bidder, address[] bidCollateralTokens, uint256[] amounts) external
```

#### Parameters

| Name                | Type       | Description                                   |
| ------------------- | ---------- | --------------------------------------------- |
| id                  | bytes32    | A bytes32 bid id                              |
| bidder              | address    | The address of the bidder                     |
| bidCollateralTokens | address\[] | The addresses of the token used as collateral |
| amounts             | uint256\[] | The amounts of collateral tokens to unlock    |

### \_lock

```solidity
function _lock(struct TermAuctionBidSubmission bidSubmission, address authedUser) internal returns (struct TermAuctionBid)
```

### \_lockRolloverBid

```solidity
function _lockRolloverBid(struct TermAuctionBid bid) internal
```

### \_unlock

```solidity
function _unlock(bytes32 id, address bidder, address[] bidCollateralTokens, uint256[] amounts) internal
```

### \_revealBid

```solidity
function _revealBid(bytes32 id, uint256 price, uint256 nonce) internal
```

### \_getAllBids

```solidity
function _getAllBids(bytes32[] revealedBids, bytes32[] expiredRolloverBids, bytes32[] unrevealedBids) internal returns (struct TermAuctionRevealedBid[], struct TermAuctionBid[])
```

#### Parameters

| Name                | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| revealedBids        | bytes32\[] | An array of the revealed offer ids       |
| expiredRolloverBids | bytes32\[] | An array of the expired rollover bid ids |
| unrevealedBids      | bytes32\[] | An array of the unrevealed offer ids     |

#### Return Values

| Name | Type                             | Description                                                                        |
| ---- | -------------------------------- | ---------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedBid\[] | An array of TermAuctionRevealedBid structs containing details of the revealed bids |
| \[1] | struct TermAuctionBid\[]         | An array of TermAuctionBid structs containing details of the unrevealed bids       |

### \_truncateBidStruct

```solidity
function _truncateBidStruct(struct TermAuctionBid bid) internal pure returns (struct TermAuctionRevealedBid revealed)
```

*This does not check the hash of the revealed bid price*

#### Parameters

| Name | Type                  | Description                                             |
| ---- | --------------------- | ------------------------------------------------------- |
| bid  | struct TermAuctionBid | The TermAuctionBid to convert to TermAuctionRevealedBid |

### \_processRevealedBidsForValidity

```solidity
function _processRevealedBidsForValidity(bytes32[] revealedBids, uint256 unrevealedBidCount) internal returns (struct TermAuctionBid[], uint256, uint256, uint256)
```

### \_isRolloverStillValid

```solidity
function _isRolloverStillValid(struct TermAuctionBid revealedBid, contract ITermRepoServicer pairOffServicer) internal returns (bool)
```

### \_isInInitialCollateralShortFall

```solidity
function _isInInitialCollateralShortFall(uint256 bidAmount, address[] collateralTokens_, uint256[] collateralAmounts) internal view returns (bool)
```

### \_isInMaintenanceCollateralShortFall

```solidity
function _isInMaintenanceCollateralShortFall(uint256 bidAmount, uint256 bidPrice, address[] collateralTokens_, uint256[] collateralAmounts) internal view returns (bool)
```

### \_fillRevealedBidsForAuctionClearing

```solidity
function _fillRevealedBidsForAuctionClearing(bytes32[] revealedBids, uint256 auctionBidCount) internal returns (struct TermAuctionRevealedBid[])
```

### \_generateBidId

```solidity
function _generateBidId(bytes32 id, address user) internal view returns (bytes32)
```

### \_processBidForAuction

```solidity
function _processBidForAuction(bytes32 id) internal
```

### pauseLocking

```solidity
function pauseLocking() external
```

### unpauseLocking

```solidity
function unpauseLocking() external
```

### pauseUnlocking

```solidity
function pauseUnlocking() external
```

### unpauseUnlocking

```solidity
function unpauseUnlocking() 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 |


# TermAuctionOfferLocker.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract handles and processes Term Auction offer submissions

## TermAuctionOfferLocker

This contract handles and proceesses Term Auction offer submissions

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

### MAX\_OFFER\_PRICE

```solidity
uint256 MAX_OFFER_PRICE
```

### MAX\_OFFER\_COUNT

```solidity
uint256 MAX_OFFER_COUNT
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTIONEER\_ROLE

```solidity
bytes32 AUCTIONEER_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionStartTime

```solidity
uint256 auctionStartTime
```

### revealTime

```solidity
uint256 revealTime
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### minimumTenderAmount

```solidity
uint256 minimumTenderAmount
```

### purchaseToken

```solidity
contract IERC20Upgradeable purchaseToken
```

### collateralTokens

```solidity
mapping(contract IERC20Upgradeable => bool) collateralTokens
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termAuction

```solidity
contract ITermAuction termAuction
```

### offers

```solidity
mapping(bytes32 => struct TermAuctionOffer) offers
```

### offerCount

```solidity
uint256 offerCount
```

### termContractPaired

```solidity
bool termContractPaired
```

### lockingPaused

```solidity
bool lockingPaused
```

### unlockingPaused

```solidity
bool unlockingPaused
```

### onlyWhileAuctionOpen

```solidity
modifier onlyWhileAuctionOpen()
```

### onlyWhileAuctionRevealing

```solidity
modifier onlyWhileAuctionRevealing()
```

### onlyOfferor

```solidity
modifier onlyOfferor(address offeror, address authedUser)
```

### onlyExistingOffer

```solidity
modifier onlyExistingOffer(bytes32 id)
```

### whenLockingNotPaused

```solidity
modifier whenLockingNotPaused()
```

### whenUnlockingNotPaused

```solidity
modifier whenUnlockingNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionStartTime_, uint256 revealTime_, uint256 auctionEndTime_, uint256 minimumTenderAmount_, contract IERC20Upgradeable purchaseToken_, contract IERC20Upgradeable[] collateralTokens_, address termInitializer_) external
```

### pairTermContracts

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

### lockOffersWithReferral

```solidity
function lockOffersWithReferral(struct TermAuctionOfferSubmission[] offerSubmissions, address referralAddress) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                                                                                                |
| ---------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of Term Auction offer submissions to lend an amount of money at rate no lower than the offer rate |
| referralAddress  | address                              | A user address that referred the submitter of this offer                                                   |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockOffers

```solidity
function lockOffers(struct TermAuctionOfferSubmission[] offerSubmissions) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                   |
| ---------------- | ------------------------------------ | ----------------------------- |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of offer submissions |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockedOffer

```solidity
function lockedOffer(bytes32 id) external view returns (struct TermAuctionOffer)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | bytes32 | An offer Id |

#### Return Values

| Name | Type                    | Description                                         |
| ---- | ----------------------- | --------------------------------------------------- |
| \[0] | struct TermAuctionOffer | A struct containing the details of the locked offer |

### revealOffers

```solidity
function revealOffers(bytes32[] ids, uint256[] prices, uint256[] nonces) external
```

#### Parameters

| Name   | Type       | Description                                           |
| ------ | ---------- | ----------------------------------------------------- |
| ids    | bytes32\[] | An array offer ids to reveal                          |
| prices | uint256\[] | An array of the offer prices to reveal                |
| nonces | uint256\[] | An array of nonce values to generate bid price hashes |

### unlockOffers

```solidity
function unlockOffers(bytes32[] ids) external
```

unlockOffers unlocks multiple offers and returns funds to the offeror

#### Parameters

| Name | Type       | Description           |
| ---- | ---------- | --------------------- |
| ids  | bytes32\[] | An array of offer ids |

### getAllOffers

```solidity
function getAllOffers(bytes32[] revealedOffers, bytes32[] unrevealedOffers) external returns (struct TermAuctionRevealedOffer[], struct TermAuctionOffer[])
```

#### Parameters

| Name             | Type       | Description                          |
| ---------------- | ---------- | ------------------------------------ |
| revealedOffers   | bytes32\[] | An array of the revealed offer ids   |
| unrevealedOffers | bytes32\[] | An array of the unrevealed offer ids |

#### Return Values

| Name | Type                               | Description                                                                            |
| ---- | ---------------------------------- | -------------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedOffer\[] | An array of TermAuctionRevealedOffer structs containing details of the revealed offers |
| \[1] | struct TermAuctionOffer\[]         | An array of TermAuctionOffer structs containing details of the unrevealed offers       |

### unlockOfferPartial

```solidity
function unlockOfferPartial(bytes32 id, address offeror, uint256 amount) public
```

#### Parameters

| Name    | Type    | Description                             |
| ------- | ------- | --------------------------------------- |
| id      | bytes32 | An offer Id                             |
| offeror | address | Address of the offeror                  |
| amount  | uint256 | The amount of purchase tokens to unlock |

### \_lock

```solidity
function _lock(struct TermAuctionOfferSubmission offerSubmission, address authedUser) internal returns (struct TermAuctionOffer)
```

### \_unlock

```solidity
function _unlock(bytes32 id, address offeror) internal
```

### \_revealOffer

```solidity
function _revealOffer(bytes32 id, uint256 price, uint256 nonce) internal
```

*Will revert if either the price does not match the offer price or is greater than the max offer price*

#### Parameters

| Name  | Type    | Description                                                  |
| ----- | ------- | ------------------------------------------------------------ |
| id    | bytes32 | An offer Id                                                  |
| price | uint256 | The price of the offer to reveal                             |
| nonce | uint256 | The user provided nonce value to generate the bid price hash |

### \_generateOfferId

```solidity
function _generateOfferId(bytes32 id, address user) internal view returns (bytes32)
```

### \_processOfferForAuction

```solidity
function _processOfferForAuction(bytes32 id) internal
```

### \_truncateOfferStruct

```solidity
function _truncateOfferStruct(struct TermAuctionOffer hidden, uint256 price) internal pure returns (struct TermAuctionRevealedOffer revealed)
```

*This does not check the hash of the revealed offer price*

#### Parameters

| Name   | Type                    | Description                                             |
| ------ | ----------------------- | ------------------------------------------------------- |
| hidden | struct TermAuctionOffer | TermAuctionOffer to convert to TermAuctionRevealedOffer |
| price  | uint256                 | The revealed price of the offer                         |

### pauseLocking

```solidity
function pauseLocking() external
```

### unpauseLocking

```solidity
function unpauseLocking() external
```

### pauseUnlocking

```solidity
function pauseUnlocking() external
```

### unpauseUnlocking

```solidity
function unpauseUnlocking() 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 |


# Term Servicer Group

The Term Servicer group of contracts maintain records, enforce the terms of a Term Repo arrangement and automate the settlement and collateral management functions.

{% content-ref url="/pages/vkqTVLV40AkFyuvloUCe" %}
[TermRepoServicer.sol](/0.6.0/term-repo-class/term-servicer-group/termreposervicer)
{% endcontent-ref %}

{% content-ref url="/pages/IKR9Bcm2EmUbjBKBGGC1" %}
[TermRepoLocker.sol](/0.5.32/term-repo-class/term-servicer-group/termrepolocker)
{% endcontent-ref %}

{% content-ref url="/pages/6XSjSYfe7lFLrkm9XXIi" %}
[TermRepoCollateralManager.sol](/0.6.0/term-repo-class/term-servicer-group/termrepocollateralmanager)
{% endcontent-ref %}

{% content-ref url="/pages/qWpr1Op80rXPKnjik5Ze" %}
[TermRepoRolloverManager.sol](/0.5.32/term-repo-class/term-servicer-group/termreporollovermanager)
{% endcontent-ref %}


# TermRepoServicer.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract maintains records, collects and disburse repurchase payments.

## TermRepoServicer

This contract maintains records, collects and disburse repurchase payments

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

### YEAR\_SECONDS

```solidity
uint256 YEAR_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTION\_LOCKER

```solidity
bytes32 AUCTION_LOCKER
```

### AUCTIONEER

```solidity
bytes32 AUCTIONEER
```

### COLLATERAL\_MANAGER

```solidity
bytes32 COLLATERAL_MANAGER
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### SPECIALIST\_ROLE

```solidity
bytes32 SPECIALIST_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### ROLLOVER\_TARGET\_AUCTIONEER\_ROLE

```solidity
bytes32 ROLLOVER_TARGET_AUCTIONEER_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### totalOutstandingRepurchaseExposure

```solidity
uint256 totalOutstandingRepurchaseExposure
```

### totalRepurchaseCollected

```solidity
uint256 totalRepurchaseCollected
```

### maturityTimestamp

```solidity
uint256 maturityTimestamp
```

### endOfRepurchaseWindow

```solidity
uint256 endOfRepurchaseWindow
```

### redemptionTimestamp

```solidity
uint256 redemptionTimestamp
```

block timestamp at which term repo tokens can be redeemed

### servicingFee

```solidity
uint256 servicingFee
```

percentage share of bid amounts charged to bidder

### shortfallHaircutMantissa

```solidity
uint256 shortfallHaircutMantissa
```

proportion of redemption value for redemption

### purchaseToken

```solidity
address purchaseToken
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoRolloverManager

```solidity
contract ITermRepoRolloverManager termRepoRolloverManager
```

### termRepoLocker

```solidity
contract ITermRepoLocker termRepoLocker
```

### termRepoToken

```solidity
contract ITermRepoToken termRepoToken
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### repurchaseExposureLedger

```solidity
mapping(address => uint256) repurchaseExposureLedger
```

### termContractPaired

```solidity
bool termContractPaired
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, uint256 maturityTimestamp_, uint256 repurchaseWindow_, uint256 redemptionBuffer_, uint256 servicingFee_, address purchaseToken_, contract ITermController termController_, contract ITermEventEmitter emitter_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoLocker_, address termRepoCollateralManager_, address termRepoToken_, address termAuctionOfferLocker_, address termAuction_, address rolloverManager_, address devopsMultisig_, address adminWallet_, string version_) external
```

### submitRepurchasePayment

```solidity
function submitRepurchasePayment(uint256 amount) external
```

The max repurchase amount is the repurchase balance less any amounts earmarked for rollover

#### Parameters

| Name   | Type    | Description                                           |
| ------ | ------- | ----------------------------------------------------- |
| amount | uint256 | The amount of purchase token to submit for repurchase |

### burnCollapseExposure

```solidity
function burnCollapseExposure(uint256 amountToBurn) external
```

#### Parameters

| Name         | Type    | Description                          |
| ------------ | ------- | ------------------------------------ |
| amountToBurn | uint256 | The amount of TermRepoTokens to burn |

### getBorrowerRepurchaseObligation

```solidity
function getBorrowerRepurchaseObligation(address borrower) external view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                          |
| -------- | ------- | ------------------------------------ |
| borrower | address | The address of the borrower to query |

#### Return Values

| Name | Type    | Description                                                     |
| ---- | ------- | --------------------------------------------------------------- |
| \[0] | uint256 | The total repurchase price due at maturity for a given borrower |

### mintOpenExposure

```solidity
function mintOpenExposure(uint256 amount, uint256[] collateralAmounts) external
```

*This method allows SPECIALIST\_ROLE to open repurchase price exposure against a TermRepoToken mint of corresponding value outside of a Term Auction to create new supply*

#### Parameters

| Name              | Type       | Description                                                                           |
| ----------------- | ---------- | ------------------------------------------------------------------------------------- |
| amount            | uint256    | The amount of Term Repo Tokens to mint                                                |
| collateralAmounts | uint256\[] | An array containing an amount of collateral token for each token in collateral basket |

### redeemTermRepoTokens

```solidity
function redeemTermRepoTokens(address redeemer, uint256 amountToRedeem) external
```

#### Parameters

| Name           | Type    | Description                            |
| -------------- | ------- | -------------------------------------- |
| redeemer       | address | The address of redeemer                |
| amountToRedeem | uint256 | The amount of TermRepoTokens to redeem |

### isTermRepoBalanced

```solidity
function isTermRepoBalanced() external view returns (bool)
```

#### Return Values

| Name | Type | Description                                                        |
| ---- | ---- | ------------------------------------------------------------------ |
| \[0] | bool | A boolean that represents whether the term repo locker is balanced |

### lockOfferAmount

```solidity
function lockOfferAmount(address offeror, uint256 amount) external
```

#### Parameters

| Name    | Type    | Description                           |
| ------- | ------- | ------------------------------------- |
| offeror | address | The address of the offeror            |
| amount  | uint256 | The amount of purchase tokens to lock |

### unlockOfferAmount

```solidity
function unlockOfferAmount(address offeror, uint256 amount) external
```

#### Parameters

| Name    | Type    | Description                               |
| ------- | ------- | ----------------------------------------- |
| offeror | address | The address of the offeror                |
| amount  | uint256 | The amount of purchase tokens to unlocked |

### fulfillOffer

```solidity
function fulfillOffer(address offeror, uint256 purchasePrice, uint256 repurchasePrice, bytes32 offerId) external
```

#### Parameters

| Name            | Type    | Description                                     |
| --------------- | ------- | ----------------------------------------------- |
| offeror         | address | The address of the offeror                      |
| purchasePrice   | uint256 | The offer amount to fulfill                     |
| repurchasePrice | uint256 | The repurchase price due to offeror at maturity |
| offerId         | bytes32 | Unique identifier for this offer                |

### fulfillBid

```solidity
function fulfillBid(address bidder, uint256 purchasePrice, uint256 repurchasePrice, address[] collateralTokens, uint256[] collateralAmounts, uint256 dayCountFractionMantissa) external
```

#### Parameters

| Name                     | Type       | Description                                                     |
| ------------------------ | ---------- | --------------------------------------------------------------- |
| bidder                   | address    | The address of the bidder                                       |
| purchasePrice            | uint256    | The bid amount to fulfill                                       |
| repurchasePrice          | uint256    | The repurchase price due at maturity                            |
| collateralTokens         | address\[] | Collateral token addresses                                      |
| collateralAmounts        | uint256\[] | Collateral token amounts                                        |
| dayCountFractionMantissa | uint256    | Actual/360 day count fraction parameter from Term Auction Group |

### approveRolloverAuction

```solidity
function approveRolloverAuction(address termAuction) external
```

#### Parameters

| Name        | Type    | Description                                                     |
| ----------- | ------- | --------------------------------------------------------------- |
| termAuction | address | The address of a TermAuction contract to receive autioneer role |

### openExposureOnRolloverNew

```solidity
function openExposureOnRolloverNew(address borrower, uint256 purchasePrice, uint256 repurchasePrice, address previousTermRepoLocker, uint256 dayCountFractionMantissa) external returns (uint256)
```

#### Parameters

| Name                     | Type    | Description                                                     |
| ------------------------ | ------- | --------------------------------------------------------------- |
| borrower                 | address | The address of the borrower rolling into new Term Repo          |
| purchasePrice            | uint256 | The purchase price received from new TermRepo                   |
| repurchasePrice          | uint256 | The new repurchase price due at maturity of new TermRepo        |
| previousTermRepoLocker   | address | The address of the old TermRepoLocker contract                  |
| dayCountFractionMantissa | uint256 | Actual/360 day count fraction parameter from Term Auction Group |

#### Return Values

| Name | Type    | Description                                                               |
| ---- | ------- | ------------------------------------------------------------------------- |
| \[0] | uint256 | The net purchase price received in after deducing protocol servicing fees |

### closeExposureOnRolloverExisting

```solidity
function closeExposureOnRolloverExisting(address borrower, uint256 rolloverSettlementAmount) external returns (uint256)
```

#### Parameters

| Name                     | Type    | Description                                                                                                           |
| ------------------------ | ------- | --------------------------------------------------------------------------------------------------------------------- |
| borrower                 | address | The address of the borrower                                                                                           |
| rolloverSettlementAmount | uint256 | The amount of net proceeds received from new TermRepo to pay down existing repurchase obligation due to old Term Repo |

#### Return Values

| Name | Type    | Description                                                                                                                        |
| ---- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| \[0] | uint256 | A uint256 representing the proportion of total repurchase due to old Term Repo from borrower settled by proceeds from new TermRepo |

### liquidatorCoverExposure

```solidity
function liquidatorCoverExposure(address borrower, address liquidator, uint256 amountToCover) external
```

#### Parameters

| Name          | Type    | Description                                               |
| ------------- | ------- | --------------------------------------------------------- |
| borrower      | address | The address of the borrower                               |
| liquidator    | address | The address of the liquidator                             |
| amountToCover | uint256 | The amount of repurchase exposure to cover in liquidation |

### liquidatorCoverExposureWithRepoToken

```solidity
function liquidatorCoverExposureWithRepoToken(address borrower, address liquidator, uint256 amountOfRepoToken) external returns (uint256)
```

#### Parameters

| Name              | Type    | Description                                            |
| ----------------- | ------- | ------------------------------------------------------ |
| borrower          | address | The address of the borrower                            |
| liquidator        | address | The address of the liquidator                          |
| amountOfRepoToken | uint256 | The amount of term tokens used to cover in liquidation |

#### Return Values

| Name | Type    | Description                                                 |
| ---- | ------- | ----------------------------------------------------------- |
| \[0] | uint256 | A uint256 representing purchase value of repo tokens burned |

### grantMintExposureAccess

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

#### Parameters

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

### reopenToNewAuction

```solidity
function reopenToNewAuction(struct TermAuctionGroup termAuctionGroup) external
```

#### Parameters

| Name             | Type                    | Description                                                                                               |
| ---------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
| termAuctionGroup | struct TermAuctionGroup | A struct containing contract addresses of a Term Auction deployment to pair for a reopening of a TermRepo |

### \_isTermRepoBalanced

```solidity
function _isTermRepoBalanced() internal view returns (bool)
```

Truncation is by 4 decimal places due to the assumption that number of participants < 10000

### \_getMaxRepaymentAroundRollover

```solidity
function _getMaxRepaymentAroundRollover(address borrower) internal view returns (uint256)
```

### \_repay

```solidity
function _repay(address _borrower, address repayer_, uint256 amount_) internal
```

### \_parRedemption

```solidity
function _parRedemption(address redeemer_, uint256 amount_) internal
```

### \_proRataRedemption

```solidity
function _proRataRedemption(address redeemer_, uint256 amount_) internal
```

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


# TermRepoLocker.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This is the contract in which Term Servicer locks collateral and purchase tokens.

## TermRepoLocker

This is the contract in which Term Servicer locks collateral and purchase tokens

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

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### SERVICER\_ROLE

```solidity
bytes32 SERVICER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### transfersPaused

```solidity
bool transfersPaused
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### whileTransfersNotPaused

```solidity
modifier whileTransfersNotPaused()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, address termInitializer_) external
```

### pairTermContracts

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

### transferTokenFromWallet

```solidity
function transferTokenFromWallet(address originWallet, address token, uint256 amount) external
```

Locks tokens from origin wallet Reverts if caller doesn't have SERVICER\_ROLE

#### Parameters

| Name         | Type    | Description                              |
| ------------ | ------- | ---------------------------------------- |
| originWallet | address | The wallet from which to transfer tokens |
| token        | address | The address of token being transferred   |
| amount       | uint256 | The amount of tokens to transfer         |

### transferTokenToWallet

```solidity
function transferTokenToWallet(address destinationWallet, address token, uint256 amount) external
```

Unlocks tokens to destination wallet

*Reverts if caller doesn't have SERVICER\_ROLE*

#### Parameters

| Name              | Type    | Description                         |
| ----------------- | ------- | ----------------------------------- |
| destinationWallet | address | The wallet to unlock tokens into    |
| token             | address | The address of token being unlocked |
| amount            | uint256 | The amount of tokens to unlock      |

### pauseTransfers

```solidity
function pauseTransfers() external
```

### unpauseTransfers

```solidity
function unpauseTransfers() 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 |


# TermRepoCollateralManager.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract enforces margin maintenance rules for adding/withdrawing, and liquidating tokens.

## TermRepoCollateralManager

This contract enforces margin maintenance rules for adding/withdrawing, repurchasing and liquidating collateral

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

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTION\_LOCKER

```solidity
bytes32 AUCTION_LOCKER
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### SERVICER\_ROLE

```solidity
bytes32 SERVICER_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### ROLLOVER\_TARGET\_AUCTIONEER\_ROLE

```solidity
bytes32 ROLLOVER_TARGET_AUCTIONEER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### liquidationsPaused

```solidity
bool liquidationsPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### numOfAcceptedCollateralTokens

```solidity
uint8 numOfAcceptedCollateralTokens
```

### deMinimisMarginThreshold

```solidity
uint256 deMinimisMarginThreshold
```

### liquidateDamangesDueToProtocol

```solidity
uint256 liquidateDamangesDueToProtocol
```

### netExposureCapOnLiquidation

```solidity
uint256 netExposureCapOnLiquidation
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### purchaseToken

```solidity
address purchaseToken
```

### termPriceOracle

```solidity
contract ITermPriceOracle termPriceOracle
```

### termRepoLocker

```solidity
contract ITermRepoLocker termRepoLocker
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### collateralTokens

```solidity
address[] collateralTokens
```

### encumberedCollateralBalances

```solidity
mapping(address => uint256) encumberedCollateralBalances
```

### maintenanceCollateralRatios

```solidity
mapping(address => uint256) maintenanceCollateralRatios
```

### initialCollateralRatios

```solidity
mapping(address => uint256) initialCollateralRatios
```

### liquidatedDamages

```solidity
mapping(address => uint256) liquidatedDamages
```

### lockedCollateralLedger

```solidity
mapping(address => mapping(address => uint256)) lockedCollateralLedger
```

### isCollateralTokenAccepted

```solidity
modifier isCollateralTokenAccepted(address token)
```

### whileLiquidationsNotPaused

```solidity
modifier whileLiquidationsNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, uint256 liquidateDamangesDueToProtocol_, uint256 netExposureCapOnLiquidation_, uint256 deMinimisMarginThreshold_, address purchaseToken_, struct Collateral[] collateralTokens_, contract ITermEventEmitter emitter_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoLocker_, address termRepoServicer_, address termAuctionBidLocker_, address termAuction_, address termController_, address termPriceOracle_, address termRepoRolloverManager_, address devopsMultisig_, address adminWallet_) external
```

### externalLockCollateral

```solidity
function externalLockCollateral(address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                 |
| --------------- | ------- | ------------------------------------------- |
| collateralToken | address | The address of the collateral token to lock |
| amount          | uint256 | The amount of collateral token to lock      |

### externalUnlockCollateral

```solidity
function externalUnlockCollateral(address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                   |
| --------------- | ------- | --------------------------------------------- |
| collateralToken | address | The address of the collateral token to unlock |
| amount          | uint256 | The amount of collateral token to unlock      |

### batchLiquidation

```solidity
function batchLiquidation(address borrower, uint256[] closureAmounts) external
```

#### Parameters

| Name           | Type       | Description                                                                                                                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower       | address    | The address of the borrower                                                                                                                                            |
| closureAmounts | uint256\[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |

### batchLiquidationWithRepoToken

```solidity
function batchLiquidationWithRepoToken(address borrower, uint256[] closureRepoTokenAmounts) external
```

#### Parameters

| Name                    | Type       | Description                                                                                                                                                                                 |
| ----------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower                | address    | The address of the borrower                                                                                                                                                                 |
| closureRepoTokenAmounts | uint256\[] | An array specifying the amounts of Term Repo Tokens the liquidator proposes to cover borrower repo exposure in liquidation; an amount is required to be specified for each collateral token |

### batchDefault

```solidity
function batchDefault(address borrower, uint256[] closureAmounts) external
```

#### Parameters

| Name           | Type       | Description                                                                                                                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower       | address    | The address of the borrower                                                                                                                                            |
| closureAmounts | uint256\[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |

### calculateMintableExposure

```solidity
function calculateMintableExposure(address collateralToken, uint256 amountToLock) external view returns (struct ExponentialNoError.Exp)
```

#### Parameters

| Name            | Type    | Description                                   |
| --------------- | ------- | --------------------------------------------- |
| collateralToken | address | The collateral token address of tokens locked |
| amountToLock    | uint256 | The amount of collateral tokens to lock       |

### getCollateralBalances

```solidity
function getCollateralBalances(address borrower) external view returns (address[], uint256[])
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type       | Description                                                     |
| ---- | ---------- | --------------------------------------------------------------- |
| \[0] | address\[] | An array of collateral token addresses                          |
| \[1] | uint256\[] | An array collateral token balances locked on behalf of borrower |

### getCollateralBalance

```solidity
function getCollateralBalance(address borrower, address collateralToken) external view returns (uint256)
```

#### Parameters

| Name            | Type    | Description                           |
| --------------- | ------- | ------------------------------------- |
| borrower        | address | The address of the borrower           |
| collateralToken | address | The collateral token address to query |

#### Return Values

| Name | Type    | Description                                                        |
| ---- | ------- | ------------------------------------------------------------------ |
| \[0] | uint256 | uint256 The amount of collateralToken locked on behalf of borrower |

### encumberedCollateralRemaining

```solidity
function encumberedCollateralRemaining() external view returns (bool)
```

#### Return Values

| Name | Type | Description                                                                |
| ---- | ---- | -------------------------------------------------------------------------- |
| \[0] | bool | bool A boolean that tests whether any encumbered collateral remains locked |

### auctionLockCollateral

```solidity
function auctionLockCollateral(address bidder, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                       |
| --------------- | ------- | ------------------------------------------------- |
| bidder          | address | The bidder's address                              |
| collateralToken | address | The address of the token to be used as collateral |
| amount          | uint256 | The amount of the token to lock                   |

### auctionUnlockCollateral

```solidity
function auctionUnlockCollateral(address bidder, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                 |
| --------------- | ------- | ------------------------------------------- |
| bidder          | address | The bidder's address                        |
| collateralToken | address | The address of the token used as collateral |
| amount          | uint256 | The amount of collateral tokens to unlock   |

### acceptRolloverCollateral

```solidity
function acceptRolloverCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                             |
| --------------- | ------- | --------------------------------------- |
| borrower        | address | The address of the borrower             |
| collateralToken | address | The address of a collateral token       |
| amount          | uint256 | The amount of collateral tokens to lock |

### transferRolloverCollateral

```solidity
function transferRolloverCollateral(address borrower, uint256 rolloverProportion, address rolloverTermRepoLocker) external returns (address[], uint256[])
```

#### Parameters

| Name                   | Type    | Description                                                                                       |
| ---------------------- | ------- | ------------------------------------------------------------------------------------------------- |
| borrower               | address | The borrower's address                                                                            |
| rolloverProportion     | uint256 | The proportion of the collateral to be unlocked, equal to the proportion of the collateral repaid |
| rolloverTermRepoLocker | address | The address of the new TermRepoLocker contract to roll into                                       |

#### Return Values

| Name | Type       | Description                                                                                                    |
| ---- | ---------- | -------------------------------------------------------------------------------------------------------------- |
| \[0] | address\[] | An array representing a list of accepted collateral token addresses                                            |
| \[1] | uint256\[] | An array containing the amount of collateral tokens to pairoff and transfer to new TermRepoLocker to roll into |

### approveRolloverAuction

```solidity
function approveRolloverAuction(address rolloverAuction) external
```

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| rolloverAuction | address | The address of the rollover auction |

### unlockCollateralOnRepurchase

```solidity
function unlockCollateralOnRepurchase(address borrower) external
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

### journalBidCollateralToCollateralManager

```solidity
function journalBidCollateralToCollateralManager(address borrower, address[] collateralTokenAddresses, uint256[] collateralTokenAmounts) external
```

#### Parameters

| Name                     | Type       | Description                 |
| ------------------------ | ---------- | --------------------------- |
| borrower                 | address    | The address of the borrower |
| collateralTokenAddresses | address\[] | Collateral token addresses  |
| collateralTokenAmounts   | uint256\[] | Collateral token amounts    |

### mintOpenExposureLockCollateral

```solidity
function mintOpenExposureLockCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| borrower        | address | The address of the borrower |
| collateralToken | address | Collateral token addresse   |
| amount          | uint256 | Collateral token amount     |

### reopenToNewAuction

```solidity
function reopenToNewAuction(struct TermAuctionGroup termAuctionGroup) external
```

#### Parameters

| Name             | Type                    | Description                   |
| ---------------- | ----------------------- | ----------------------------- |
| termAuctionGroup | struct TermAuctionGroup | A struct of auction contracts |

### pauseLiquidations

```solidity
function pauseLiquidations() external
```

### unpauseLiquidations

```solidity
function unpauseLiquidations() external
```

### isBorrowerInShortfall

```solidity
function isBorrowerInShortfall(address borrower) public view returns (bool)
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type | Description                                                                  |
| ---- | ---- | ---------------------------------------------------------------------------- |
| \[0] | bool | Boolean testing whether the given borrower is in shortfall or margin deficit |

### getCollateralMarketValue

```solidity
function getCollateralMarketValue(address borrower) public view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type    | Description                                                         |
| ---- | ------- | ------------------------------------------------------------------- |
| \[0] | uint256 | The market value of borrower's locked collateral denominated in USD |

### \_lockCollateral

```solidity
function _lockCollateral(address borrower, address collateralToken, uint256 amount) internal
```

### \_unlockCollateral

```solidity
function _unlockCollateral(address borrower, address collateralToken, uint256 amount, bool decrementEncumberedCollateral) internal
```

### \_partialUnlockCollateral

```solidity
function _partialUnlockCollateral(address borrower, uint256 unlockProportion, address destinationwallet) internal returns (uint256[])
```

### \_validateBatchLiquidationForFullLiquidation

```solidity
function _validateBatchLiquidationForFullLiquidation(address borrower, address liquidator, uint256[] closureTokenAmounts) internal returns (bool)
```

*A helper function to validate various conditions required to liquidate*

#### Return Values

| Name | Type | Description                                                           |
| ---- | ---- | --------------------------------------------------------------------- |
| \[0] | bool | A boolean for whether borrower position eligible for full liquidation |

### \_unencumberRemainingBorrowerCollateralOnZeroObligation

```solidity
function _unencumberRemainingBorrowerCollateralOnZeroObligation(address borrower) internal
```

### \_withinNetExposureCapOnLiquidation

```solidity
function _withinNetExposureCapOnLiquidation(address borrower) internal view returns (bool)
```

### \_collateralSeizureAmounts

```solidity
function _collateralSeizureAmounts(uint256 amountToCover_, address collateralToken) internal view returns (uint256, uint256)
```

*returns total amount of collateral seized in liquidation and the amount of that total going protocol*

### \_transferLiquidationCollateral

```solidity
function _transferLiquidationCollateral(address borrower, address liquidator, address collateralAddress, uint256 closureAmount, uint256 collateralSeizureAmount, uint256 collateralSeizureProtocolShare, bool isDefault) internal
```

*A helper function to transfer tokens and update relevant state variables and mappings*

### \_isAcceptedCollateralToken

```solidity
function _isAcceptedCollateralToken(address token_) internal view returns (bool)
```

### \_usdValueOfBalances

```solidity
function _usdValueOfBalances(mapping(address => uint256) _tokenBalances) internal view returns (uint256)
```

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


# TermRepoRolloverManager.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract accepts and carries out borrower Term Repo rollover instructions.

## TermRepoRolloverManager

This contract accepts and carries out borrower Term Repo rollover instructions

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

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### ROLLOVER\_BID\_FULFILLER\_ROLE

```solidity
bytes32 ROLLOVER_BID_FULFILLER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### approvedRolloverAuctions

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

### rolloverElections

```solidity
mapping(address => struct TermRepoRolloverElection) rolloverElections
```

### termContractPaired

```solidity
bool termContractPaired
```

### whileNotMatured

```solidity
modifier whileNotMatured()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, contract ITermRepoServicer termRepoServicer_, contract ITermRepoCollateralManager termRepoCollateralManager_, contract ITermController termController_, address termInitializer_) external
```

### pairTermContracts

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

### electRollover

```solidity
function electRollover(struct TermRepoRolloverElectionSubmission termRepoRolloverElectionSubmission) external
```

An external function that accepted Term Repo rollover instructions

#### Parameters

| Name                               | Type                                      | Description                                        |
| ---------------------------------- | ----------------------------------------- | -------------------------------------------------- |
| termRepoRolloverElectionSubmission | struct TermRepoRolloverElectionSubmission | A struct containing borrower rollover instructions |

### getRolloverInstructions

```solidity
function getRolloverInstructions(address borrower) external view returns (struct TermRepoRolloverElection)
```

A view function that returns borrower rollover instructions

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type                            | Description                                        |
| ---- | ------------------------------- | -------------------------------------------------- |
| \[0] | struct TermRepoRolloverElection | A struct containing borrower rollover instructions |

### cancelRollover

```solidity
function cancelRollover() external
```

An external function to cancel previously submitted rollover instructions

### fulfillRollover

```solidity
function fulfillRollover(address borrower) external
```

An external function called by repo servicer to mark rollover as fulfilled

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

### approveRolloverAuction

```solidity
function approveRolloverAuction(contract ITermAuctionBidLocker auctionBidLocker, address termAuction) external
```

#### Parameters

| Name             | Type                           | Description                                                          |
| ---------------- | ------------------------------ | -------------------------------------------------------------------- |
| auctionBidLocker | contract ITermAuctionBidLocker | The ABI for ITermAuctionBidLocker interface                          |
| termAuction      | address                        | The address of TermAuction contract to mark as eligible for rollover |

### revokeRolloverApproval

```solidity
function revokeRolloverApproval(contract ITermAuctionBidLocker auctionBidLocker) external
```

#### Parameters

| Name             | Type                           | Description                                 |
| ---------------- | ------------------------------ | ------------------------------------------- |
| auctionBidLocker | contract ITermAuctionBidLocker | The ABI for ITermAuctionBidLocker interface |

### \_processRollover

```solidity
function _processRollover(address borrowerToRollover) internal
```

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


# TermRepoToken.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This is an ERC-20 contract to track claims to the aggregate repurchase obligations due on the r

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


# Protocol Class

Protocol contracts are evergreen contracts at the protocol level that govern and apply across all Term Repos.

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/0.5.31/protocol-class/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/0.5.31/protocol-class/broken-reference/README.md>
{% endcontent-ref %}

{% content-ref url="/pages/C18psSM8bLNsHx0UYmC4" %}
[TermEventEmitter.sol](/0.5.32/protocol-class/termeventemitter)
{% endcontent-ref %}

{% content-ref url="/pages/Ed9VmdwWQWjaUo812RUn" %}
[TermInitializer.sol](/0.5.32/protocol-class/terminitializer)
{% endcontent-ref %}

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/0.5.31/protocol-class/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/0.5.31/protocol-class/broken-reference/README.md>
{% endcontent-ref %}


# TermController.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract manages Term Finance protocol permissions and controls

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

### CONTROLLER\_ADMIN\_ROLE

```solidity
bytes32 CONTROLLER_ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### EVERGREEN\_MANAGEMENT\_ROLE

```solidity
bytes32 EVERGREEN_MANAGEMENT_ROLE
```

### treasuryWallet

```solidity
address treasuryWallet
```

### protocolReserveWallet

```solidity
address protocolReserveWallet
```

### termAddresses

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

### constructor

```solidity
constructor() public
```

### initialize

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

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

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

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

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# TermEventEmitter.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract is a centralized event emitter that records important events to the blockchain

## TermEventEmitter

This contract is a centralized event emitter that records important events to the blockchain

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

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### TERM\_CONTRACT

```solidity
bytes32 TERM_CONTRACT
```

### TERM\_DELISTER

```solidity
bytes32 TERM_DELISTER
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address devopsWallet_, address termDelister_, address termInitializer_) external
```

### pairTermContract

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

### emitTermAuctionInitialized

```solidity
function emitTermAuctionInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuction, uint256 auctionEndTime, string version) external
```

#### Parameters

| Name           | Type    | Description                                                  |
| -------------- | ------- | ------------------------------------------------------------ |
| termRepoId     | bytes32 | The id of the current Term Repo deployment being initialized |
| termAuctionId  | bytes32 | The id of the auction being initialized                      |
| termAuction    | address | The address of the auction contract being initialized        |
| auctionEndTime | uint256 | The end time of the auction being initialized                |
| version        | string  | The version tag of the smart contract deployed               |

### emitBidAssigned

```solidity
function emitBidAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount) external
```

#### Parameters

| Name          | Type    | Description                     |
| ------------- | ------- | ------------------------------- |
| termAuctionId | bytes32 | A Term Auction id               |
| id            | bytes32 | A bid id                        |
| amount        | uint256 | The amount assigned to this bid |

### emitOfferAssigned

```solidity
function emitOfferAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount) external
```

#### Parameters

| Name          | Type    | Description                       |
| ------------- | ------- | --------------------------------- |
| termAuctionId | bytes32 | A Term Auction id                 |
| id            | bytes32 | An offer id                       |
| amount        | uint256 | The amount assigned to this offer |

### emitAuctionCompleted

```solidity
function emitAuctionCompleted(bytes32 termAuctionId, uint256 timestamp, uint256 blockNumber, uint256 totalAssignedBids, uint256 totalAssignedOffers, uint256 clearingPrice) external
```

#### Parameters

| Name                | Type    | Description                                  |
| ------------------- | ------- | -------------------------------------------- |
| termAuctionId       | bytes32 | The Term Auction id of auction completed     |
| timestamp           | uint256 | The timestamp of the current block           |
| blockNumber         | uint256 | The number of the current block              |
| totalAssignedBids   | uint256 | The number of assigned bids in the auction   |
| totalAssignedOffers | uint256 | The number of assigned offers in the auction |
| clearingPrice       | uint256 | The clearing price of the auction            |

### emitAuctionCancelled

```solidity
function emitAuctionCancelled(bytes32 termAuctionId, bool nonViableAuction, bool auctionCancelledforWithdrawal) external
```

#### Parameters

| Name                          | Type    | Description                                                     |
| ----------------------------- | ------- | --------------------------------------------------------------- |
| termAuctionId                 | bytes32 | The id of the auction cancelled                                 |
| nonViableAuction              | bool    | Auction not viable due to bid and offer prices not intersecting |
| auctionCancelledforWithdrawal | bool    | Auction has been cancelled for manual fund withdrawal           |

### emitCompleteAuctionPaused

```solidity
function emitCompleteAuctionPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                     |
| ------------- | ------- | ----------------------------------------------- |
| termAuctionId | bytes32 | The id of the auction paused                    |
| termRepoId    | bytes32 | The Term Repo id associated with auction paused |

### emitCompleteAuctionUnpaused

```solidity
function emitCompleteAuctionUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                       |
| ------------- | ------- | ------------------------------------------------- |
| termAuctionId | bytes32 | The id of the auction unpaused                    |
| termRepoId    | bytes32 | The Term Repo id associated with auction unpaused |

### emitTermAuctionBidLockerInitialized

```solidity
function emitTermAuctionBidLockerInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuctionBidLocker, uint256 auctionStartTime, uint256 revealTime, uint256 maxBidPrice, uint256 minimumTenderAmount, uint256 dayCountFractionMantissa) external
```

#### Parameters

| Name                     | Type    | Description                                                       |
| ------------------------ | ------- | ----------------------------------------------------------------- |
| termRepoId               | bytes32 | The Term Repo id associated with BidLocker initialized            |
| termAuctionId            | bytes32 | The Term Auction id associated with BidLocker initialized         |
| termAuctionBidLocker     | address | The address of the TermAuctionBidLocker contract being intialized |
| auctionStartTime         | uint256 | The time at which auction bids will be accepted for submission    |
| revealTime               | uint256 | The time at which sealed auction bids can be revealed             |
| maxBidPrice              | uint256 | The maximum bid price for the auction                             |
| minimumTenderAmount      | uint256 | The minimum tender amount for the auction                         |
| dayCountFractionMantissa | uint256 | The day count fraction remainder                                  |

### emitBidLocked

```solidity
function emitBidLocked(bytes32 termAuctionId, struct TermAuctionBid bid, address referralAddress) external
```

#### Parameters

| Name            | Type                  | Description                                        |
| --------------- | --------------------- | -------------------------------------------------- |
| termAuctionId   | bytes32               | A Term Auction id                                  |
| bid             | struct TermAuctionBid | A struct containing details of the locked bid      |
| referralAddress | address               | The address of the referrer. Zero Address if none. |

### emitBidRevealed

```solidity
function emitBidRevealed(bytes32 termAuctionId, bytes32 id, uint256 bidPrice) external
```

#### Parameters

| Name          | Type    | Description                   |
| ------------- | ------- | ----------------------------- |
| termAuctionId | bytes32 | A Term Auction id             |
| id            | bytes32 | The bid id                    |
| bidPrice      | uint256 | The revealed price of the bid |

### emitBidUnlocked

```solidity
function emitBidUnlocked(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | A bid id          |

### emitBidInShortfall

```solidity
function emitBidInShortfall(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | A bid id          |

### emitBidLockingPaused

```solidity
function emitBidLockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                        |
| ------------- | ------- | -------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid locking is paused |
| termRepoId    | bytes32 | The Term Repo id where bid locking is paused       |

### emitBidLockingUnpaused

```solidity
function emitBidLockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid locking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where bid locking is unpaused       |

### emitBidUnlockingPaused

```solidity
function emitBidUnlockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid unlocking is paused |
| termRepoId    | bytes32 | The Term Repo id where bid unlocking is paused       |

### emitBidUnlockingUnpaused

```solidity
function emitBidUnlockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where bid unlocking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where bid unlocking is unpaused       |

### emitTermAuctionOfferLockerInitialized

```solidity
function emitTermAuctionOfferLockerInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuctionOfferLocker, uint256 auctionStartTime, uint256 revealTime, uint256 maxOfferPrice, uint256 minimumTenderAmount) external
```

#### Parameters

| Name                   | Type    | Description                                                         |
| ---------------------- | ------- | ------------------------------------------------------------------- |
| termRepoId             | bytes32 | The Term Repo id associated with OfferLocker initialized            |
| termAuctionId          | bytes32 | The Term Auction id associated with OfferLocker initialized         |
| termAuctionOfferLocker | address | The address of the TermAuctionOfferLocker contract being intialized |
| auctionStartTime       | uint256 | The time at which auction bids will be accepted for submission      |
| revealTime             | uint256 | The time at which sealed auction bids can be revealed               |
| maxOfferPrice          | uint256 | The maximum offer price for the auction                             |
| minimumTenderAmount    | uint256 | The minimum tender amount for the auction                           |

### emitOfferLocked

```solidity
function emitOfferLocked(bytes32 termAuctionId, bytes32 id, address offeror, bytes32 offerPrice, uint256 amount, address purchaseToken, address referralAddress) external
```

#### Parameters

| Name            | Type    | Description                                        |
| --------------- | ------- | -------------------------------------------------- |
| termAuctionId   | bytes32 | A Term Auction id                                  |
| id              | bytes32 | An offer id                                        |
| offeror         | address | The address of the offeror                         |
| offerPrice      | bytes32 | The offer price                                    |
| amount          | uint256 | The amount of purchase tokens offered              |
| purchaseToken   | address | The address of the purchase token being offered    |
| referralAddress | address | The address of the referrer. Zero Address if none. |

### emitOfferRevealed

```solidity
function emitOfferRevealed(bytes32 termAuctionId, bytes32 id, uint256 offerPrice) external
```

#### Parameters

| Name          | Type    | Description              |
| ------------- | ------- | ------------------------ |
| termAuctionId | bytes32 | A Term Auction id        |
| id            | bytes32 | An offer id              |
| offerPrice    | uint256 | The offer price revealed |

### emitOfferUnlocked

```solidity
function emitOfferUnlocked(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | An offer id       |

### emitOfferLockingPaused

```solidity
function emitOfferLockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where offer locking is paused |
| termRepoId    | bytes32 | The Term Repo id where offer locking is paused       |

### emitOfferLockingUnpaused

```solidity
function emitOfferLockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where offer locking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where offer locking is unpaused       |

### emitOfferUnlockingPaused

```solidity
function emitOfferUnlockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where offer unlocking is paused |
| termRepoId    | bytes32 | The Term Repo id where offer unlocking is paused       |

### emitOfferUnlockingUnpaused

```solidity
function emitOfferUnlockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                              |
| ------------- | ------- | -------------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where offer unlocking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where offer unlocking is unpaused       |

### emitTermRepoCollateralManagerInitialized

```solidity
function emitTermRepoCollateralManagerInitialized(bytes32 termRepoId, address termRepoCollateralManager, address[] collateralTokens, uint256[] initialCollateralRatios, uint256[] maintenanceCollateralRatios, uint256[] liquidatedDamagesSchedule) external
```

#### Parameters

| Name                        | Type       | Description                                                                     |
| --------------------------- | ---------- | ------------------------------------------------------------------------------- |
| termRepoId                  | bytes32    | The Term Repo id associated with collateral manger being initialized            |
| termRepoCollateralManager   | address    | The address of the TermRepoCollateralManager contract being intialized          |
| collateralTokens            | address\[] | An array containing a list of the addresses of all accepted collateral tokens   |
| initialCollateralRatios     | uint256\[] | An array containing the initial collateral ratios for each collateral token     |
| maintenanceCollateralRatios | uint256\[] | An array containing the maintenance collateral ratios for each collateral token |
| liquidatedDamagesSchedule   | uint256\[] | An array containing the liquidated damages applicable to each collateral token  |

### emitPairReopeningBidLocker

```solidity
function emitPairReopeningBidLocker(bytes32 termRepoId, address termRepoCollateralManager, address termAuctionBidLocker) external
```

#### Parameters

| Name                      | Type    | Description                                                            |
| ------------------------- | ------- | ---------------------------------------------------------------------- |
| termRepoId                | bytes32 | The Term Repo id for the Term Repo being reopened                      |
| termRepoCollateralManager | address | The TermRepoCollateralManager address for the Term Repo being reopened |
| termAuctionBidLocker      | address | The new TermAuctionBidLocker to be paired for reopening                |

### emitCollateralLocked

```solidity
function emitCollateralLocked(bytes32 termRepoId, address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                |
| --------------- | ------- | ------------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                             |
| borrower        | address | The address of the borrower                |
| collateralToken | address | The address of the collateral token locked |
| amount          | uint256 | The amount of collateral being locked      |

### emitCollateralUnlocked

```solidity
function emitCollateralUnlocked(bytes32 termRepoId, address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                |
| --------------- | ------- | ------------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                             |
| borrower        | address | The address of the borrower                |
| collateralToken | address | The address of the collateral token locked |
| amount          | uint256 | The amount of collateral being unlocked    |

### emitLiquidation

```solidity
function emitLiquidation(bytes32 termRepoId, address borrower, address liquidator, uint256 closureAmount, address collateralToken, uint256 amountLiquidated, uint256 protocolSeizureAmount, bool defaultLiquidation) external
```

#### Parameters

| Name                  | Type    | Description                                     |
| --------------------- | ------- | ----------------------------------------------- |
| termRepoId            | bytes32 | A Term Repo id                                  |
| borrower              | address | The address of the borrower                     |
| liquidator            | address | The address of the liquidator                   |
| closureAmount         | uint256 | The amount of repurchase exposure covered       |
| collateralToken       | address | The address of the collateral tokens liquidated |
| amountLiquidated      | uint256 | The amount of collateral tokens liquidated      |
| protocolSeizureAmount | uint256 |                                                 |
| defaultLiquidation    | bool    |                                                 |

### emitLiquidationPaused

```solidity
function emitLiquidationPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                       |
| ---------- | ------- | ------------------------------------------------- |
| termRepoId | bytes32 | The id of Term Repo where liquidations are paused |

### emitLiquidationUnpaused

```solidity
function emitLiquidationUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                       |
| ---------- | ------- | ------------------------------------------------- |
| termRepoId | bytes32 | The id of Term Repo where liquidation is unpaused |

### emitTermRepoServicerInitialized

```solidity
function emitTermRepoServicerInitialized(bytes32 termRepoId, address termRepoServicer, address purchaseToken, uint256 maturityTimestamp, uint256 endOfRepurchaseWindow, uint256 redemptionTimestamp, uint256 servicingFee, string version) external
```

#### Parameters

| Name                  | Type    | Description                                                         |
| --------------------- | ------- | ------------------------------------------------------------------- |
| termRepoId            | bytes32 | The Term Repo id associated with TermRepoServicer being initialized |
| termRepoServicer      | address | The address of the TermRepoServicer contract being initialized      |
| purchaseToken         | address | The address of the purchase token                                   |
| maturityTimestamp     | uint256 | The time at which repurchase is due                                 |
| endOfRepurchaseWindow | uint256 | The time at which the repurchase window ends                        |
| redemptionTimestamp   | uint256 | The time when redemption of Term Repo Tokens begins                 |
| servicingFee          | uint256 | percentage share of bid amounts charged to bidder                   |
| version               | string  | The version tag of the smart contract deployed                      |

### emitReopeningOfferLockerPaired

```solidity
function emitReopeningOfferLockerPaired(bytes32 termRepoId, address termRepoServicer, address termAuctionOfferLocker, address termAuction) external
```

#### Parameters

| Name                   | Type    | Description                                                                   |
| ---------------------- | ------- | ----------------------------------------------------------------------------- |
| termRepoId             | bytes32 | The Term Repo id for the Term Repo being reopened                             |
| termRepoServicer       | address | The address of the TermRepoServicer contract for the Term Repo being reopened |
| termAuctionOfferLocker | address | The TermAuctionOfferLocker to be paired for reopening                         |
| termAuction            | address | The address of the TermAuction contract to be paired for reopening            |

### emitOfferLockedByServicer

```solidity
function emitOfferLockedByServicer(bytes32 termRepoId, address offeror, uint256 amount) external
```

This event is not to be confused with OfferLocked by TermOfferLocker Both this event and OfferLocked will be triggered, this one specifically refers to corresponding action taken by Term Servicer

#### Parameters

| Name       | Type    | Description                   |
| ---------- | ------- | ----------------------------- |
| termRepoId | bytes32 | A Term Repo id                |
| offeror    | address | The address of the offeror    |
| amount     | uint256 | The offer amount to be locked |

### emitOfferUnlockedByServicer

```solidity
function emitOfferUnlockedByServicer(bytes32 termRepoId, address offeror, uint256 amount) external
```

This event is not to be confused with OfferUnlocked by TermOfferLocker Both this event and OfferLocked will be triggered, this one specifically refers to corresponding action taken by Term Servicer

#### Parameters

| Name       | Type    | Description                     |
| ---------- | ------- | ------------------------------- |
| termRepoId | bytes32 | A Term Repo id                  |
| offeror    | address | The address of the offeror      |
| amount     | uint256 | The offer amount to be unlocked |

### emitOfferFulfilled

```solidity
function emitOfferFulfilled(bytes32 offerId, address offeror, uint256 purchasePrice, uint256 repurchasePrice, uint256 repoTokensMinted) external
```

#### Parameters

| Name             | Type    | Description                                      |
| ---------------- | ------- | ------------------------------------------------ |
| offerId          | bytes32 | A unique offer id                                |
| offeror          | address | The address of the offeror                       |
| purchasePrice    | uint256 | The offer amount fulfilled                       |
| repurchasePrice  | uint256 | The repurchase price due to offeror at maturity  |
| repoTokensMinted | uint256 | The amount of Term Repo Tokens minted to offeror |

### emitTermRepoTokensRedeemed

```solidity
function emitTermRepoTokensRedeemed(bytes32 termRepoId, address redeemer, uint256 redemptionAmount, uint256 redemptionHaircut) external
```

#### Parameters

| Name              | Type    | Description                                                                    |
| ----------------- | ------- | ------------------------------------------------------------------------------ |
| termRepoId        | bytes32 | A Term Repo id                                                                 |
| redeemer          | address | The address of the redeemer                                                    |
| redemptionAmount  | uint256 | The amount of TermRepoTokens redeemed                                          |
| redemptionHaircut | uint256 | The haircut applied to redemptions (if any) due to unrecoverable repo exposure |

### emitBidFulfilled

```solidity
function emitBidFulfilled(bytes32 termRepoId, address bidder, uint256 purchasePrice, uint256 repurchasePrice, uint256 servicingFees) external
```

#### Parameters

| Name            | Type    | Description                          |
| --------------- | ------- | ------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                       |
| bidder          | address | The address of the bidder            |
| purchasePrice   | uint256 | The bid amount fulfilled in auction  |
| repurchasePrice | uint256 | The repurchase price due at maturity |
| servicingFees   | uint256 | The fees earned by the protocol      |

### emitExposureOpenedOnRolloverNew

```solidity
function emitExposureOpenedOnRolloverNew(bytes32 termRepoId, address borrower, uint256 purchasePrice, uint256 repurchasePrice, uint256 servicingFees) external
```

#### Parameters

| Name            | Type    | Description                                              |
| --------------- | ------- | -------------------------------------------------------- |
| termRepoId      | bytes32 | A Term Repo id                                           |
| borrower        | address | The address of the borrower                              |
| purchasePrice   | uint256 | The purchase price received from new TermRepo            |
| repurchasePrice | uint256 | The new repurchase price due at maturity of new TermRepo |
| servicingFees   | uint256 | The fees earned by the protocol                          |

### emitExposureClosedOnRolloverExisting

```solidity
function emitExposureClosedOnRolloverExisting(bytes32 termRepoId, address borrower, uint256 amountRolled) external
```

#### Parameters

| Name         | Type    | Description                                             |
| ------------ | ------- | ------------------------------------------------------- |
| termRepoId   | bytes32 | A Term Repo id                                          |
| borrower     | address | The address of the borrower                             |
| amountRolled | uint256 | The repurchase exposure balance closed on old Term Repo |

### emitRepurchasePaymentSubmitted

```solidity
function emitRepurchasePaymentSubmitted(bytes32 termRepoId, address borrower, uint256 amount) external
```

#### Parameters

| Name       | Type    | Description                         |
| ---------- | ------- | ----------------------------------- |
| termRepoId | bytes32 | A Term Repo id                      |
| borrower   | address | The address of the borrower         |
| amount     | uint256 | The amount submitted for repurchase |

### emitMintExposureAccessGranted

```solidity
function emitMintExposureAccessGranted(bytes32 termRepoId, address authedUser) external
```

#### Parameters

| Name       | Type    | Description                       |
| ---------- | ------- | --------------------------------- |
| termRepoId | bytes32 | A Term Repo id                    |
| authedUser | address | User granted mint exposure access |

### emitMintExposure

```solidity
function emitMintExposure(bytes32 termRepoId, address minter, uint256 netTokensReceived, uint256 servicingFeeTokens, uint256 repurchasePrice) external
```

#### Parameters

| Name               | Type    | Description                                                             |
| ------------------ | ------- | ----------------------------------------------------------------------- |
| termRepoId         | bytes32 | A Term Repo id                                                          |
| minter             | address | The address of the minter                                               |
| netTokensReceived  | uint256 | The amount of Term Repo Tokens received by minter net of servicing fees |
| servicingFeeTokens | uint256 | The number of Term Repo Tokens retained by protocol in servicing fees   |
| repurchasePrice    | uint256 | The repurchase exposure opened by minter against Term Repo Token mint   |

### emitBurnCollapseExposure

```solidity
function emitBurnCollapseExposure(bytes32 termRepoId, address borrower, uint256 closeAmount) external
```

#### Parameters

| Name        | Type    | Description                                |
| ----------- | ------- | ------------------------------------------ |
| termRepoId  | bytes32 | A Term Repo id                             |
| borrower    | address | The address of the borrower                |
| closeAmount | uint256 | The amount of repurchase exposure to close |

### emitTermRepoRolloverManagerInitialized

```solidity
function emitTermRepoRolloverManagerInitialized(bytes32 termRepoId, address rolloverManager) external
```

#### Parameters

| Name            | Type    | Description                                                                |
| --------------- | ------- | -------------------------------------------------------------------------- |
| termRepoId      | bytes32 | The Term Repo id associated with TermRepoRolloverManager being initialized |
| rolloverManager | address | The address of the TermRepoRolloverManager contract being initialized      |

### emitRolloverTermApproved

```solidity
function emitRolloverTermApproved(bytes32 termRepoId, bytes32 rolloverTermAuctionId) external
```

#### Parameters

| Name                  | Type    | Description                                                  |
| --------------------- | ------- | ------------------------------------------------------------ |
| termRepoId            | bytes32 | The Term Repo id of existing Term Repo                       |
| rolloverTermAuctionId | bytes32 | The Term Auction Id that rollover bid will be submitted into |

### emitRolloverTermApprovalRevoked

```solidity
function emitRolloverTermApprovalRevoked(bytes32 termRepoId, bytes32 rolloverTermAuctionId) external
```

#### Parameters

| Name                  | Type    | Description                                            |
| --------------------- | ------- | ------------------------------------------------------ |
| termRepoId            | bytes32 | The Term Repo id of existing Term Repo                 |
| rolloverTermAuctionId | bytes32 | The Term Auction Id whose rollover approval is revoked |

### emitRolloverElection

```solidity
function emitRolloverElection(bytes32 termRepoId, bytes32 rolloverTermRepoId, address borrower, address rolloverAuction, uint256 rolloverAmount, bytes32 hashedBidPrice) external
```

#### Parameters

| Name               | Type    | Description                                     |
| ------------------ | ------- | ----------------------------------------------- |
| termRepoId         | bytes32 | The Term Repo id of existing Term Repo          |
| rolloverTermRepoId | bytes32 | The Term Repo Id of Rollover Term Repo          |
| borrower           | address | The address of the borrower                     |
| rolloverAuction    | address | The address of the auction being rolled over to |
| rolloverAmount     | uint256 | The repurchase amount being rolled over         |
| hashedBidPrice     | bytes32 | The hash of the rollover bid price              |

### emitRolloverCancellation

```solidity
function emitRolloverCancellation(bytes32 termRepoId, address borrower) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The Term Repo id of existing Term Repo |
| borrower   | address | The address of the borrower            |

### emitRolloverProcessed

```solidity
function emitRolloverProcessed(bytes32 termRepoId, address borrower) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The Term Repo id of existing Term Repo |
| borrower   | address | The address of the borrower            |

### emitTermRepoLockerInitialized

```solidity
function emitTermRepoLockerInitialized(bytes32 termRepoId, address termRepoLocker) external
```

#### Parameters

| Name           | Type    | Description                                                                |
| -------------- | ------- | -------------------------------------------------------------------------- |
| termRepoId     | bytes32 | The Term Repo id associated with TermRepoLocker contract being initialized |
| termRepoLocker | address | The address of the TermRepoLocker contract being initialized               |

### emitTermRepoLockerTransfersPaused

```solidity
function emitTermRepoLockerTransfersPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| termRepoId | bytes32 | A Term Repo id |

### emitTermRepoLockerTransfersUnpaused

```solidity
function emitTermRepoLockerTransfersUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| termRepoId | bytes32 | A Term Repo id |

### emitTermRepoTokenInitialized

```solidity
function emitTermRepoTokenInitialized(bytes32 termRepoId, address termRepoToken, uint256 redemptionRatio) external
```

#### Parameters

| Name            | Type    | Description                                                                 |
| --------------- | ------- | --------------------------------------------------------------------------- |
| termRepoId      | bytes32 | The Term Repo id associated with the TermRepoToken being initalized         |
| termRepoToken   | address | The address of the TermRepoToken contract being initialized                 |
| redemptionRatio | uint256 | The number of purchase tokens redeemable per unit of Term Repo Token at par |

### emitTermRepoTokenMintingPaused

```solidity
function emitTermRepoTokenMintingPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                |
| ---------- | ------- | -------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where minting is paused |

### emitTermRepoTokenMintingUnpaused

```solidity
function emitTermRepoTokenMintingUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where minting is unpaused |

### emitTermRepoTokenBurningPaused

```solidity
function emitTermRepoTokenBurningPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                |
| ---------- | ------- | -------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where burning is paused |

### emitTermRepoTokenBurningUnpaused

```solidity
function emitTermRepoTokenBurningUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where burning is unpaused |

### emitDelistTermRepo

```solidity
function emitDelistTermRepo(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The id of the Term Repo being delisted |

### emitDelistTermAuction

```solidity
function emitDelistTermAuction(bytes32 termAuctionId) external
```

#### Parameters

| Name          | Type    | Description                               |
| ------------- | ------- | ----------------------------------------- |
| termAuctionId | bytes32 | The id of the Term Auction being delisted |

### emitTermContractUpgraded

```solidity
function emitTermContractUpgraded(address proxy, address implementation) external
```

#### Parameters

| Name           | Type    | Description                                             |
| -------------- | ------- | ------------------------------------------------------- |
| proxy          | address | address of proxy contract                               |
| implementation | address | address of new impl contract proxy has been upgraded to |

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# TermInitializer.sol

This contract provides utility methods for initializing/pairing a set of term/auction contracts

## TermInitializer

This contract provides utility methods for initializing/pairing a set of term/auction contracts

*This contract operates at the protocol level and provides utility functions for deploying terms/auctions*

### DeployingPaused

```solidity
error DeployingPaused()
```

### DEPLOYER\_ROLE

```solidity
bytes32 DEPLOYER_ROLE
```

### INITIALIZER\_APPROVAL\_ROLE

```solidity
bytes32 INITIALIZER_APPROVAL_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### controller

```solidity
contract ITermController controller
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### priceOracle

```solidity
contract TermPriceConsumerV3 priceOracle
```

### deployingPaused

```solidity
bool deployingPaused
```

### whileDeployingNotPaused

```solidity
modifier whileDeployingNotPaused()
```

### constructor

```solidity
constructor(address initializerApprovalRole_, address devopsWallet_) public
```

### pairTermContracts

```solidity
function pairTermContracts(contract ITermController controller_, contract ITermEventEmitter emitter_, contract TermPriceConsumerV3 priceOracle_) external
```

### setupTerm

```solidity
function setupTerm(struct TermContractGroup termContractGroup, address devOpsMultiSig, address adminWallet, string termVersion, string auctionVersion) external
```

Sets up a set of deployed term contracts

### setupAuction

```solidity
function setupAuction(contract TermRepoServicer termRepoServicer, contract TermRepoCollateralManager termRepoCollateralManager, contract TermAuctionOfferLocker termAuctionOfferLocker, contract TermAuctionBidLocker termAuctionBidLocker, contract TermAuction auction, address devOpsMultiSig, address adminWallet, string auctionVersion) external
```

Sets up a set of deployed term contracts

### pauseDeploying

```solidity
function pauseDeploying() external
```

### unpauseDeploying

```solidity
function unpauseDeploying() external
```


# TermPriceConsumerV3.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract is a centralized price oracle contract that feeds pricing data to all Term Repos.

## TermPriceConsumerV3

This contract is a centralized price oracle contract that feeds pricing data to all Term Repos

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

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### EVERGREEN\_MANAGEMENT\_ROLE

```solidity
bytes32 EVERGREEN_MANAGEMENT_ROLE
```

### priceFeeds

```solidity
mapping(address => contract AggregatorV3Interface) priceFeeds
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address devopsWallet_, address evergreenManagementWallet_) external
```

Intializes with an array of token addresses, followed with an array of Chainlink aggregator addresses <https://docs.chain.link/docs/ethereum-addresses/>

### addNewTokenPriceFeed

```solidity
function addNewTokenPriceFeed(address token, address tokenPriceAggregator) external
```

#### Parameters

| Name                 | Type    | Description                                              |
| -------------------- | ------- | -------------------------------------------------------- |
| token                | address | The address of the token to add a price feed for         |
| tokenPriceAggregator | address | The proxy price aggregator address for token to be added |

### removeTokenPriceFeed

```solidity
function removeTokenPriceFeed(address token) external
```

#### Parameters

| Name  | Type    | Description                                                   |
| ----- | ------- | ------------------------------------------------------------- |
| token | address | The address of the token whose price feed needs to be removed |

### usdValueOfTokens

```solidity
function usdValueOfTokens(address token, uint256 amount) external view returns (struct ExponentialNoError.Exp)
```

A function to return current market value given a token address and an amount

#### Parameters

| Name   | Type    | Description                       |
| ------ | ------- | --------------------------------- |
| token  | address | The address of the token to query |
| amount | uint256 | The amount tokens to value        |

#### Return Values

| Name | Type                          | Description                                                        |
| ---- | ----------------------------- | ------------------------------------------------------------------ |
| \[0] | struct ExponentialNoError.Exp | The current market value of tokens at the specified amount, in USD |

### \_getLatestPrice

```solidity
function _getLatestPrice(address token) internal view returns (int256)
```

#### Return Values

| Name | Type   | Description                            |
| ---- | ------ | -------------------------------------- |
| \[0] | int256 | The latest price from price aggregator |

### \_getDecimals

```solidity
function _getDecimals(address token) internal view returns (uint8)
```

#### Return Values

| Name | Type  | Description                      |
| ---- | ----- | -------------------------------- |
| \[0] | uint8 | The decimal places in price feed |

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# Solidity API - 0.5.32

Detailed specifications for Term Finance Protocol v1 contracts can be found here. The groups are broken down by category as described [here](https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/term-finance-protocol/README.md).


# Term Repo Class

Each deployment of a Term Repo is comprised of a set of smart contracts broadly divided into three groups: (i) the Term Auction Group, (ii) the Term Servicer Group and (iii) the Term Repo Token.

{% content-ref url="/pages/Znr80VpqC4npQI8lbgBl" %}
[Term Auction Group](/0.6.0/term-repo-class/term-auction-group)
{% endcontent-ref %}

{% content-ref url="/pages/abVDhjw2RWTmsgPKwAmB" %}
[Term Servicer Group](/0.5.32/term-repo-class/term-servicer-group)
{% endcontent-ref %}

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/broken-reference/README.md>
{% endcontent-ref %}


# Term Auction Group

The Term Auction group of contracts contain the logic to handle and process bid and offer submissions, determine an auction clearing price, and to settle and clear a Term Auction.

{% content-ref url="/pages/ezoC6miKFKfMlw6jWfnV" %}
[TermAuction.sol](/0.6.0/term-repo-class/term-auction-group/termauction)
{% endcontent-ref %}

{% content-ref url="/pages/3G8cER9LEZwgO1DuOks5" %}
[TermAuctionBidLocker.sol](/0.5.32/term-repo-class/term-auction-group/termauctionbidlocker)
{% endcontent-ref %}

{% content-ref url="/pages/kK57BGZlSdDaz6Ua29hO" %}
[TermAuctionOfferLocker.sol](/0.5.32/term-repo-class/term-auction-group/termauctionofferlocker)
{% endcontent-ref %}


# TermAuction.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract calculates a clearing price in a blind double auction and manages auction clearing

## TermAuction

This contract calculates a clearing price in a blind double auction and manages auction clearing and settlement

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

### ClearingPriceState

```solidity
struct ClearingPriceState {
  uint256 offerPrice;
  uint256 offerIndex;
  uint256 bidIndex;
  uint256 cumSumOffers;
  uint256 cumSumBids;
  uint256 maxClearingVolume;
  uint256 nextOfferIndex;
  uint256 nextBidIndex;
  uint256 nextCumSumOffers;
  uint256 nextCumSumBids;
  uint256 nextOfferPrice;
  uint256 nextMaxClearingVolume;
  bool minCumSumCorrection;
  uint256 nextBidPrice;
  uint256 clearingPrice;
}
```

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 THREESIXTY_DAYCOUNT_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### dayCountFractionMantissa

```solidity
uint256 dayCountFractionMantissa
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termAuctionBidLocker

```solidity
contract ITermAuctionBidLocker termAuctionBidLocker
```

### termAuctionOfferLocker

```solidity
contract ITermAuctionOfferLocker termAuctionOfferLocker
```

### purchaseToken

```solidity
contract IERC20MetadataUpgradeable purchaseToken
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### clearingPrice

```solidity
uint256 clearingPrice
```

### clearingPricePostProcessingOffset

```solidity
uint256 clearingPricePostProcessingOffset
```

### auctionCompleted

```solidity
bool auctionCompleted
```

### auctionCancelledForWithdrawal

```solidity
bool auctionCancelledForWithdrawal
```

### completeAuctionPaused

```solidity
bool completeAuctionPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### onlyWhileAuctionClosed

```solidity
modifier onlyWhileAuctionClosed()
```

This only runs if the auction is closed (after auction end time)

*This uses the block timestamp to determine if the auction is closed*

### whenCompleteAuctionNotPaused

```solidity
modifier whenCompleteAuctionNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionEndTime_, uint256 termStart_, uint256 redemptionTimestamp_, contract IERC20MetadataUpgradeable purchaseToken_, address termAuctionInitializer_, uint256 clearingPricePostProcessingOffset_) external
```

Initializes the contract

*See: <https://docs.openzeppelin.com/contracts/4.x/upgradeable>*

### pairTermContracts

```solidity
function pairTermContracts(contract ITermEventEmitter emitter_, contract ITermRepoServicer termRepoServicer_, contract ITermAuctionBidLocker termAuctionBidLocker_, contract ITermAuctionOfferLocker termAuctionOfferLocker_, address devopsMultisigAddress_, address adminWallet_, string version_) external
```

### completeAuction

```solidity
function completeAuction(struct CompleteAuctionInput completeAuctionInput) external
```

Calculates an auction's clearing price, assigns bids/offers, and returns unassigned funds

#### Parameters

| Name                 | Type                        | Description                                                                               |
| -------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| completeAuctionInput | struct CompleteAuctionInput | A struct containing all revealed and unrevealed bids and offers and expired rollover bids |

### cancelAuction

```solidity
function cancelAuction(struct CompleteAuctionInput completeAuctionInput) public
```

Cancels an auction and returns all funds to bidders and fulfillBiders

#### Parameters

| Name                 | Type                        | Description                                                                               |
| -------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| completeAuctionInput | struct CompleteAuctionInput | A struct containing all revealed and unrevealed bids and offers and expired rollover bids |

### cancelAuctionForWithdrawal

```solidity
function cancelAuctionForWithdrawal(address[] rolloverBorrowers, address[] rolloverPairOffTermRepoServicer) public
```

Cancels an auction and sets auctionCancelledForWithdrawal to true to open unlocking tenders

### \_increaseCumSumBids

```solidity
function _increaseCumSumBids(struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex, uint256 previousCumSumBids, uint256 currentPrice) internal pure returns (uint256, uint256)
```

### \_decreaseCumSumBids

```solidity
function _decreaseCumSumBids(struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex, uint256 previousCumSumBids, uint256 currentPrice) internal pure returns (uint256, uint256)
```

### \_minUint256

```solidity
function _minUint256(uint256 a, uint256 b) internal pure returns (uint256)
```

Returns the min of two `uint256` values

#### Parameters

| Name | Type    | Description                 |
| ---- | ------- | --------------------------- |
| a    | uint256 | The first value to compare  |
| b    | uint256 | The second value to compare |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The min of the two values |

### \_calculateClearingPrice

```solidity
function _calculateClearingPrice(struct TermAuctionRevealedBid[] sortedBids, struct TermAuctionRevealedOffer[] sortedOffers, uint256 clearingOffset) internal pure returns (uint256, uint256)
```

Calculates the intersection between bid/offer schedules to arrive at a clearing price

*Imagine a graph with price along the X-axis and cumsum(bid/offerAmount\*price) along the Y-axis. This function finds the point where the supply line crosses the demand line using binary search*

#### Parameters

| Name           | Type                               | Description                                                                                         |
| -------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------- |
| sortedBids     | struct TermAuctionRevealedBid\[]   | A sorted array of bids used to arrive at a demand schedule                                          |
| sortedOffers   | struct TermAuctionRevealedOffer\[] | A sorted array of offers used to arrive at a supply schedule                                        |
| clearingOffset | uint256                            | The offset to apply to the marginal bid and offer indexes when calculating the final clearing price |

#### Return Values

| Name | Type    | Description                                                   |
| ---- | ------- | ------------------------------------------------------------- |
| \[0] | uint256 | clearingPrice The price at which Term Auction will be cleared |
| \[1] | uint256 |                                                               |

### \_findFirstIndexForPrice

```solidity
function _findFirstIndexForPrice(uint256 price, struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex) internal pure returns (uint256 i, uint256 totalAmount)
```

Finds the index of the first bid with a bidPrice of `price` and calculate the cumsum of the bid amounts up to that index

#### Parameters

| Name       | Type                             | Description                       |
| ---------- | -------------------------------- | --------------------------------- |
| price      | uint256                          | The price to search for           |
| sortedBids | struct TermAuctionRevealedBid\[] | An array of sorted bids to search |
| startIndex | uint256                          | The index to start searching from |

#### Return Values

| Name        | Type    | Description                                           |
| ----------- | ------- | ----------------------------------------------------- |
| i           | uint256 | The index of the first bid with a bidPrice of `price` |
| totalAmount | uint256 | The cumsum of the bid amounts up to return index i    |

### \_findLastIndexForPrice

```solidity
function _findLastIndexForPrice(uint256 price, struct TermAuctionRevealedOffer[] sortedOffers, uint256 startIndex) internal pure returns (uint256 i, uint256 totalAmount)
```

Finds the index of the last offer with a offerPrice of `price` and calculate the cumsum of the offer amounts up to that index

#### Parameters

| Name         | Type                               | Description                       |
| ------------ | ---------------------------------- | --------------------------------- |
| price        | uint256                            | The price to search for           |
| sortedOffers | struct TermAuctionRevealedOffer\[] | An array of offers to search      |
| startIndex   | uint256                            | The index to start searching from |

#### Return Values

| Name        | Type    | Description                                              |
| ----------- | ------- | -------------------------------------------------------- |
| i           | uint256 | The index of the last offer with a offerPrice of `price` |
| totalAmount | uint256 | The cumsum of the offer amounts up to return index i     |

### \_fullyAssignBid

```solidity
function _fullyAssignBid(struct TermAuctionRevealedBid bid) internal returns (uint256)
```

Fully assigns a bid

#### Parameters

| Name | Type                          | Description       |
| ---- | ----------------------------- | ----------------- |
| bid  | struct TermAuctionRevealedBid | The bid to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_fullyAssignOffer

```solidity
function _fullyAssignOffer(struct TermAuctionRevealedOffer offer) internal returns (uint256)
```

Fully assigns an offer

#### Parameters

| Name  | Type                            | Description         |
| ----- | ------------------------------- | ------------------- |
| offer | struct TermAuctionRevealedOffer | The offer to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_partiallyAssignBid

```solidity
function _partiallyAssignBid(struct TermAuctionRevealedBid bid, uint256 assignedAmount) internal returns (uint256)
```

Partially assigns a bid

#### Parameters

| Name           | Type                          | Description          |
| -------------- | ----------------------------- | -------------------- |
| bid            | struct TermAuctionRevealedBid | The bid to assign    |
| assignedAmount | uint256                       | The amount to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_partiallyAssignOffer

```solidity
function _partiallyAssignOffer(struct TermAuctionRevealedOffer offer, uint256 assignedAmount) internal returns (uint256)
```

Partially assigns an offer

#### Parameters

| Name           | Type                            | Description          |
| -------------- | ------------------------------- | -------------------- |
| offer          | struct TermAuctionRevealedOffer | The offer to assign  |
| assignedAmount | uint256                         | The amount to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_assignRolloverBid

```solidity
function _assignRolloverBid(address borrower, uint256 purchasePrice, uint256 repurchasePrice, address rolloverPairOffTermRepoServicer) internal
```

### \_markRolloverAsProcessed

```solidity
function _markRolloverAsProcessed(address rolloverPairOffTermRepoServicer, address borrower) internal
```

### \_assignBids

```solidity
function _assignBids(struct TermAuctionRevealedBid[] sortedBids, uint256 maxAssignable, uint256 purchaseTokenDecimals) internal returns (uint256)
```

Assigns bids up to `maxAssignable`

*This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single bid*

#### Parameters

| Name                  | Type                             | Description                                                    |
| --------------------- | -------------------------------- | -------------------------------------------------------------- |
| sortedBids            | struct TermAuctionRevealedBid\[] | An array of sorted bids to process                             |
| maxAssignable         | uint256                          | The maximum bid amount that can be assigned across all bidders |
| purchaseTokenDecimals | uint256                          | The number of decimals of the purchase token                   |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The total amount assigned |

### \_assignOffers

```solidity
function _assignOffers(struct TermAuctionRevealedOffer[] sortedOffers, uint256 maxAssignable, uint256 purchaseTokenDecimals) internal returns (uint256)
```

Assigns offers up to `maxAssignable`

*This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single offer*

#### Parameters

| Name                  | Type                               | Description                                                     |
| --------------------- | ---------------------------------- | --------------------------------------------------------------- |
| sortedOffers          | struct TermAuctionRevealedOffer\[] | An array of sorted offers to process                            |
| maxAssignable         | uint256                            | The maximum offer amount that can be assigned across all offers |
| purchaseTokenDecimals | uint256                            | The number of decimals of the purchase token                    |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The total amount assigned |

### \_calculateRepurchasePrice

```solidity
function _calculateRepurchasePrice(uint256 purchasePrice) internal view returns (uint256)
```

Calculates repurchase price given a purchase price (equivalent to principal plus interest)

#### Parameters

| Name          | Type    | Description        |
| ------------- | ------- | ------------------ |
| purchasePrice | uint256 | The purchase price |

#### Return Values

| Name | Type    | Description                                                                                       |
| ---- | ------- | ------------------------------------------------------------------------------------------------- |
| \[0] | uint256 | The repurchase price obtained by applying the clearing rate on an Actual/360 day-count convention |

### \_calculateAndStoreClearingPrice

```solidity
function _calculateAndStoreClearingPrice(struct TermAuctionRevealedBid[] sortedBids, struct TermAuctionRevealedOffer[] sortedOffers) internal returns (uint256, uint256)
```

### pauseCompleteAuction

```solidity
function pauseCompleteAuction() external
```

\_This function pauses the TermAuction contract preventing public state changes See {Pausable-*pause}.*

### unpauseCompleteAuction

```solidity
function unpauseCompleteAuction() external
```

Unpuses the TermAuction contract allowing public state changes

\_See {Pausable-*unpause}.*

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


# TermAuctionBidLocker.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract handles and proceesses Term Auction bid submissions

## TermAuctionBidLocker

This contract handles and proceesses Term Auction bid submissions

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

### MAX\_BID\_PRICE

```solidity
uint256 MAX_BID_PRICE
```

### MAX\_BID\_COUNT

```solidity
uint256 MAX_BID_COUNT
```

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 THREESIXTY_DAYCOUNT_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTIONEER\_ROLE

```solidity
bytes32 AUCTIONEER_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionStartTime

```solidity
uint256 auctionStartTime
```

### revealTime

```solidity
uint256 revealTime
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### minimumTenderAmount

```solidity
uint256 minimumTenderAmount
```

### dayCountFractionMantissa

```solidity
uint256 dayCountFractionMantissa
```

### purchaseToken

```solidity
address purchaseToken
```

### collateralTokens

```solidity
mapping(contract IERC20Upgradeable => bool) collateralTokens
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termPriceOracle

```solidity
contract ITermPriceOracle termPriceOracle
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termAuction

```solidity
contract ITermAuction termAuction
```

### bids

```solidity
mapping(bytes32 => struct TermAuctionBid) bids
```

### bidCount

```solidity
uint256 bidCount
```

### termContractPaired

```solidity
bool termContractPaired
```

### lockingPaused

```solidity
bool lockingPaused
```

### unlockingPaused

```solidity
bool unlockingPaused
```

### onlyWhileAuctionOpen

```solidity
modifier onlyWhileAuctionOpen()
```

### onlyWhileAuctionRevealing

```solidity
modifier onlyWhileAuctionRevealing()
```

### onlyBidder

```solidity
modifier onlyBidder(address bidder, address authedUser)
```

### whenLockingNotPaused

```solidity
modifier whenLockingNotPaused()
```

### whenUnlockingNotPaused

```solidity
modifier whenUnlockingNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionStartTime_, uint256 revealTime_, uint256 auctionEndTime_, uint256 redemptionTimestamp_, uint256 minimumTenderAmount_, address purchaseToken_, contract IERC20Upgradeable[] collateralTokens_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termAuction_, contract ITermRepoServicer termRepoServicer_, contract ITermEventEmitter emitter_, contract ITermRepoCollateralManager termRepoCollateralManager_, contract ITermPriceOracle termPriceOracle_, address devopsMultisig_, address adminWallet_) external
```

### pairRolloverManager

```solidity
function pairRolloverManager(address rolloverManager) external
```

#### Parameters

| Name            | Type    | Description                                         |
| --------------- | ------- | --------------------------------------------------- |
| rolloverManager | address | The address of the TermRepoRolloverManager contract |

### lockBidsWithReferral

```solidity
function lockBidsWithReferral(struct TermAuctionBidSubmission[] bidSubmissions, address referralAddress) external returns (bytes32[])
```

#### Parameters

| Name            | Type                               | Description                                                                                                        |
| --------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| bidSubmissions  | struct TermAuctionBidSubmission\[] | An array of Term Auction bid submissions to borrow an amount of money at rate up to but not exceeding the bid rate |
| referralAddress | address                            | A user address that referred the submitter of this bid                                                             |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockRolloverBid

```solidity
function lockRolloverBid(struct TermAuctionBid bid) external
```

#### Parameters

| Name | Type                  | Description                            |
| ---- | --------------------- | -------------------------------------- |
| bid  | struct TermAuctionBid | A struct containing details of the bid |

### lockBids

```solidity
function lockBids(struct TermAuctionBidSubmission[] bidSubmissions) external returns (bytes32[])
```

#### Parameters

| Name           | Type                               | Description                 |
| -------------- | ---------------------------------- | --------------------------- |
| bidSubmissions | struct TermAuctionBidSubmission\[] | An array of bid submissions |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockedBid

```solidity
function lockedBid(bytes32 id) external view returns (struct TermAuctionBid)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | bytes32 | A bid Id    |

#### Return Values

| Name | Type                  | Description                                   |
| ---- | --------------------- | --------------------------------------------- |
| \[0] | struct TermAuctionBid | A struct containing details of the locked bid |

### revealBids

```solidity
function revealBids(bytes32[] ids, uint256[] prices, uint256[] nonces) external
```

#### Parameters

| Name   | Type       | Description                                           |
| ------ | ---------- | ----------------------------------------------------- |
| ids    | bytes32\[] | An array of bid ids of the bids to reveal             |
| prices | uint256\[] | An array of the bid prices to reveal                  |
| nonces | uint256\[] | An array of nonce values to generate bid price hashes |

### unlockBids

```solidity
function unlockBids(bytes32[] ids) external
```

unlockBids unlocks multiple bids and returns funds to the bidder

#### Parameters

| Name | Type       | Description               |
| ---- | ---------- | ------------------------- |
| ids  | bytes32\[] | An array of ids to unlock |

### getAllBids

```solidity
function getAllBids(bytes32[] revealedBids, bytes32[] expiredRolloverBids, bytes32[] unrevealedBids) external returns (struct TermAuctionRevealedBid[], struct TermAuctionBid[])
```

#### Parameters

| Name                | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| revealedBids        | bytes32\[] | An array of the revealed offer ids       |
| expiredRolloverBids | bytes32\[] | An array of the expired rollover bid ids |
| unrevealedBids      | bytes32\[] | An array of the unrevealed offer ids     |

#### Return Values

| Name | Type                             | Description                                                                        |
| ---- | -------------------------------- | ---------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedBid\[] | An array of TermAuctionRevealedBid structs containing details of the revealed bids |
| \[1] | struct TermAuctionBid\[]         | An array of TermAuctionBid structs containing details of the unrevealed bids       |

### auctionUnlockBid

```solidity
function auctionUnlockBid(bytes32 id, address bidder, address[] bidCollateralTokens, uint256[] amounts) external
```

#### Parameters

| Name                | Type       | Description                                   |
| ------------------- | ---------- | --------------------------------------------- |
| id                  | bytes32    | A bytes32 bid id                              |
| bidder              | address    | The address of the bidder                     |
| bidCollateralTokens | address\[] | The addresses of the token used as collateral |
| amounts             | uint256\[] | The amounts of collateral tokens to unlock    |

### \_lock

```solidity
function _lock(struct TermAuctionBidSubmission bidSubmission, address authedUser) internal returns (struct TermAuctionBid)
```

### \_lockRolloverBid

```solidity
function _lockRolloverBid(struct TermAuctionBid bid) internal
```

### \_unlock

```solidity
function _unlock(bytes32 id, address bidder, address[] bidCollateralTokens, uint256[] amounts) internal
```

### \_revealBid

```solidity
function _revealBid(bytes32 id, uint256 price, uint256 nonce) internal
```

### \_getAllBids

```solidity
function _getAllBids(bytes32[] revealedBids, bytes32[] expiredRolloverBids, bytes32[] unrevealedBids) internal returns (struct TermAuctionRevealedBid[], struct TermAuctionBid[])
```

#### Parameters

| Name                | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| revealedBids        | bytes32\[] | An array of the revealed offer ids       |
| expiredRolloverBids | bytes32\[] | An array of the expired rollover bid ids |
| unrevealedBids      | bytes32\[] | An array of the unrevealed offer ids     |

#### Return Values

| Name | Type                             | Description                                                                        |
| ---- | -------------------------------- | ---------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedBid\[] | An array of TermAuctionRevealedBid structs containing details of the revealed bids |
| \[1] | struct TermAuctionBid\[]         | An array of TermAuctionBid structs containing details of the unrevealed bids       |

### \_truncateBidStruct

```solidity
function _truncateBidStruct(struct TermAuctionBid bid) internal pure returns (struct TermAuctionRevealedBid revealed)
```

*This does not check the hash of the revealed bid price*

#### Parameters

| Name | Type                  | Description                                             |
| ---- | --------------------- | ------------------------------------------------------- |
| bid  | struct TermAuctionBid | The TermAuctionBid to convert to TermAuctionRevealedBid |

### \_processRevealedBidsForValidity

```solidity
function _processRevealedBidsForValidity(bytes32[] revealedBids, uint256 unrevealedBidCount) internal returns (struct TermAuctionBid[], uint256, uint256, uint256)
```

### \_isRolloverStillValid

```solidity
function _isRolloverStillValid(struct TermAuctionBid revealedBid, contract ITermRepoServicer pairOffServicer) internal returns (bool)
```

### \_isInInitialCollateralShortFall

```solidity
function _isInInitialCollateralShortFall(uint256 bidAmount, address[] collateralTokens_, uint256[] collateralAmounts) internal view returns (bool)
```

### \_isInMaintenanceCollateralShortFall

```solidity
function _isInMaintenanceCollateralShortFall(uint256 bidAmount, uint256 bidPrice, address[] collateralTokens_, uint256[] collateralAmounts) internal view returns (bool)
```

### \_fillRevealedBidsForAuctionClearing

```solidity
function _fillRevealedBidsForAuctionClearing(bytes32[] revealedBids, uint256 auctionBidCount) internal returns (struct TermAuctionRevealedBid[])
```

### \_generateBidId

```solidity
function _generateBidId(bytes32 id, address user) internal view returns (bytes32)
```

### \_processBidForAuction

```solidity
function _processBidForAuction(bytes32 id) internal
```

### pauseLocking

```solidity
function pauseLocking() external
```

### unpauseLocking

```solidity
function unpauseLocking() external
```

### pauseUnlocking

```solidity
function pauseUnlocking() external
```

### unpauseUnlocking

```solidity
function unpauseUnlocking() 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 |


# TermAuctionOfferLocker.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract handles and processes Term Auction offer submissions

## TermAuctionOfferLocker

This contract handles and proceesses Term Auction offer submissions

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

### MAX\_OFFER\_PRICE

```solidity
uint256 MAX_OFFER_PRICE
```

### MAX\_OFFER\_COUNT

```solidity
uint256 MAX_OFFER_COUNT
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTIONEER\_ROLE

```solidity
bytes32 AUCTIONEER_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionStartTime

```solidity
uint256 auctionStartTime
```

### revealTime

```solidity
uint256 revealTime
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### minimumTenderAmount

```solidity
uint256 minimumTenderAmount
```

### purchaseToken

```solidity
contract IERC20Upgradeable purchaseToken
```

### collateralTokens

```solidity
mapping(contract IERC20Upgradeable => bool) collateralTokens
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termAuction

```solidity
contract ITermAuction termAuction
```

### offers

```solidity
mapping(bytes32 => struct TermAuctionOffer) offers
```

### offerCount

```solidity
uint256 offerCount
```

### termContractPaired

```solidity
bool termContractPaired
```

### lockingPaused

```solidity
bool lockingPaused
```

### unlockingPaused

```solidity
bool unlockingPaused
```

### onlyWhileAuctionOpen

```solidity
modifier onlyWhileAuctionOpen()
```

### onlyWhileAuctionRevealing

```solidity
modifier onlyWhileAuctionRevealing()
```

### onlyOfferor

```solidity
modifier onlyOfferor(address offeror, address authedUser)
```

### onlyExistingOffer

```solidity
modifier onlyExistingOffer(bytes32 id)
```

### whenLockingNotPaused

```solidity
modifier whenLockingNotPaused()
```

### whenUnlockingNotPaused

```solidity
modifier whenUnlockingNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionStartTime_, uint256 revealTime_, uint256 auctionEndTime_, uint256 minimumTenderAmount_, contract IERC20Upgradeable purchaseToken_, contract IERC20Upgradeable[] collateralTokens_, address termInitializer_) external
```

### pairTermContracts

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

### lockOffersWithReferral

```solidity
function lockOffersWithReferral(struct TermAuctionOfferSubmission[] offerSubmissions, address referralAddress) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                                                                                                |
| ---------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of Term Auction offer submissions to lend an amount of money at rate no lower than the offer rate |
| referralAddress  | address                              | A user address that referred the submitter of this offer                                                   |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockOffers

```solidity
function lockOffers(struct TermAuctionOfferSubmission[] offerSubmissions) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                   |
| ---------------- | ------------------------------------ | ----------------------------- |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of offer submissions |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockedOffer

```solidity
function lockedOffer(bytes32 id) external view returns (struct TermAuctionOffer)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | bytes32 | An offer Id |

#### Return Values

| Name | Type                    | Description                                         |
| ---- | ----------------------- | --------------------------------------------------- |
| \[0] | struct TermAuctionOffer | A struct containing the details of the locked offer |

### revealOffers

```solidity
function revealOffers(bytes32[] ids, uint256[] prices, uint256[] nonces) external
```

#### Parameters

| Name   | Type       | Description                                           |
| ------ | ---------- | ----------------------------------------------------- |
| ids    | bytes32\[] | An array offer ids to reveal                          |
| prices | uint256\[] | An array of the offer prices to reveal                |
| nonces | uint256\[] | An array of nonce values to generate bid price hashes |

### unlockOffers

```solidity
function unlockOffers(bytes32[] ids) external
```

unlockOffers unlocks multiple offers and returns funds to the offeror

#### Parameters

| Name | Type       | Description           |
| ---- | ---------- | --------------------- |
| ids  | bytes32\[] | An array of offer ids |

### getAllOffers

```solidity
function getAllOffers(bytes32[] revealedOffers, bytes32[] unrevealedOffers) external returns (struct TermAuctionRevealedOffer[], struct TermAuctionOffer[])
```

#### Parameters

| Name             | Type       | Description                          |
| ---------------- | ---------- | ------------------------------------ |
| revealedOffers   | bytes32\[] | An array of the revealed offer ids   |
| unrevealedOffers | bytes32\[] | An array of the unrevealed offer ids |

#### Return Values

| Name | Type                               | Description                                                                            |
| ---- | ---------------------------------- | -------------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedOffer\[] | An array of TermAuctionRevealedOffer structs containing details of the revealed offers |
| \[1] | struct TermAuctionOffer\[]         | An array of TermAuctionOffer structs containing details of the unrevealed offers       |

### unlockOfferPartial

```solidity
function unlockOfferPartial(bytes32 id, address offeror, uint256 amount) public
```

#### Parameters

| Name    | Type    | Description                             |
| ------- | ------- | --------------------------------------- |
| id      | bytes32 | An offer Id                             |
| offeror | address | Address of the offeror                  |
| amount  | uint256 | The amount of purchase tokens to unlock |

### \_lock

```solidity
function _lock(struct TermAuctionOfferSubmission offerSubmission, address authedUser) internal returns (struct TermAuctionOffer)
```

### \_unlock

```solidity
function _unlock(bytes32 id, address offeror) internal
```

### \_revealOffer

```solidity
function _revealOffer(bytes32 id, uint256 price, uint256 nonce) internal
```

*Will revert if either the price does not match the offer price or is greater than the max offer price*

#### Parameters

| Name  | Type    | Description                                                  |
| ----- | ------- | ------------------------------------------------------------ |
| id    | bytes32 | An offer Id                                                  |
| price | uint256 | The price of the offer to reveal                             |
| nonce | uint256 | The user provided nonce value to generate the bid price hash |

### \_generateOfferId

```solidity
function _generateOfferId(bytes32 id, address user) internal view returns (bytes32)
```

### \_processOfferForAuction

```solidity
function _processOfferForAuction(bytes32 id) internal
```

### \_truncateOfferStruct

```solidity
function _truncateOfferStruct(struct TermAuctionOffer hidden, uint256 price) internal pure returns (struct TermAuctionRevealedOffer revealed)
```

*This does not check the hash of the revealed offer price*

#### Parameters

| Name   | Type                    | Description                                             |
| ------ | ----------------------- | ------------------------------------------------------- |
| hidden | struct TermAuctionOffer | TermAuctionOffer to convert to TermAuctionRevealedOffer |
| price  | uint256                 | The revealed price of the offer                         |

### pauseLocking

```solidity
function pauseLocking() external
```

### unpauseLocking

```solidity
function unpauseLocking() external
```

### pauseUnlocking

```solidity
function pauseUnlocking() external
```

### unpauseUnlocking

```solidity
function unpauseUnlocking() 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 |


# Term Servicer Group

The Term Servicer group of contracts maintain records, enforce the terms of a Term Repo arrangement and automate the settlement and collateral management functions.

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/term-servicer-group/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/term-servicer-group/broken-reference/README.md>
{% endcontent-ref %}

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/term-servicer-group/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/term-servicer-group/broken-reference/README.md>
{% endcontent-ref %}

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/term-servicer-group/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/term-servicer-group/broken-reference/README.md>
{% endcontent-ref %}

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/term-servicer-group/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/0.5.32/term-repo-class/term-servicer-group/broken-reference/README.md>
{% endcontent-ref %}


# TermRepoServicer.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract maintains records, collects and disburse repurchase payments.

## TermRepoServicer

This contract maintains records, collects and disburse repurchase payments

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

### YEAR\_SECONDS

```solidity
uint256 YEAR_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTION\_LOCKER

```solidity
bytes32 AUCTION_LOCKER
```

### AUCTIONEER

```solidity
bytes32 AUCTIONEER
```

### COLLATERAL\_MANAGER

```solidity
bytes32 COLLATERAL_MANAGER
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### SPECIALIST\_ROLE

```solidity
bytes32 SPECIALIST_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### ROLLOVER\_TARGET\_AUCTIONEER\_ROLE

```solidity
bytes32 ROLLOVER_TARGET_AUCTIONEER_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### totalOutstandingRepurchaseExposure

```solidity
uint256 totalOutstandingRepurchaseExposure
```

### totalRepurchaseCollected

```solidity
uint256 totalRepurchaseCollected
```

### maturityTimestamp

```solidity
uint256 maturityTimestamp
```

### endOfRepurchaseWindow

```solidity
uint256 endOfRepurchaseWindow
```

### redemptionTimestamp

```solidity
uint256 redemptionTimestamp
```

block timestamp at which term repo tokens can be redeemed

### servicingFee

```solidity
uint256 servicingFee
```

percentage share of bid amounts charged to bidder

### shortfallHaircutMantissa

```solidity
uint256 shortfallHaircutMantissa
```

proportion of redemption value for redemption

### purchaseToken

```solidity
address purchaseToken
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoRolloverManager

```solidity
contract ITermRepoRolloverManager termRepoRolloverManager
```

### termRepoLocker

```solidity
contract ITermRepoLocker termRepoLocker
```

### termRepoToken

```solidity
contract ITermRepoToken termRepoToken
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### repurchaseExposureLedger

```solidity
mapping(address => uint256) repurchaseExposureLedger
```

### termContractPaired

```solidity
bool termContractPaired
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, uint256 maturityTimestamp_, uint256 repurchaseWindow_, uint256 redemptionBuffer_, uint256 servicingFee_, address purchaseToken_, contract ITermController termController_, contract ITermEventEmitter emitter_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoLocker_, address termRepoCollateralManager_, address termRepoToken_, address termAuctionOfferLocker_, address termAuction_, address rolloverManager_, address devopsMultisig_, address adminWallet_, string version_) external
```

### submitRepurchasePayment

```solidity
function submitRepurchasePayment(uint256 amount) external
```

The max repurchase amount is the repurchase balance less any amounts earmarked for rollover

#### Parameters

| Name   | Type    | Description                                           |
| ------ | ------- | ----------------------------------------------------- |
| amount | uint256 | The amount of purchase token to submit for repurchase |

### burnCollapseExposure

```solidity
function burnCollapseExposure(uint256 amountToBurn) external
```

#### Parameters

| Name         | Type    | Description                          |
| ------------ | ------- | ------------------------------------ |
| amountToBurn | uint256 | The amount of TermRepoTokens to burn |

### getBorrowerRepurchaseObligation

```solidity
function getBorrowerRepurchaseObligation(address borrower) external view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                          |
| -------- | ------- | ------------------------------------ |
| borrower | address | The address of the borrower to query |

#### Return Values

| Name | Type    | Description                                                     |
| ---- | ------- | --------------------------------------------------------------- |
| \[0] | uint256 | The total repurchase price due at maturity for a given borrower |

### mintOpenExposure

```solidity
function mintOpenExposure(uint256 amount, uint256[] collateralAmounts) external
```

*This method allows SPECIALIST\_ROLE to open repurchase price exposure against a TermRepoToken mint of corresponding value outside of a Term Auction to create new supply*

#### Parameters

| Name              | Type       | Description                                                                           |
| ----------------- | ---------- | ------------------------------------------------------------------------------------- |
| amount            | uint256    | The amount of Term Repo Tokens to mint                                                |
| collateralAmounts | uint256\[] | An array containing an amount of collateral token for each token in collateral basket |

### redeemTermRepoTokens

```solidity
function redeemTermRepoTokens(address redeemer, uint256 amountToRedeem) external
```

#### Parameters

| Name           | Type    | Description                            |
| -------------- | ------- | -------------------------------------- |
| redeemer       | address | The address of redeemer                |
| amountToRedeem | uint256 | The amount of TermRepoTokens to redeem |

### isTermRepoBalanced

```solidity
function isTermRepoBalanced() external view returns (bool)
```

#### Return Values

| Name | Type | Description                                                        |
| ---- | ---- | ------------------------------------------------------------------ |
| \[0] | bool | A boolean that represents whether the term repo locker is balanced |

### lockOfferAmount

```solidity
function lockOfferAmount(address offeror, uint256 amount) external
```

#### Parameters

| Name    | Type    | Description                           |
| ------- | ------- | ------------------------------------- |
| offeror | address | The address of the offeror            |
| amount  | uint256 | The amount of purchase tokens to lock |

### unlockOfferAmount

```solidity
function unlockOfferAmount(address offeror, uint256 amount) external
```

#### Parameters

| Name    | Type    | Description                               |
| ------- | ------- | ----------------------------------------- |
| offeror | address | The address of the offeror                |
| amount  | uint256 | The amount of purchase tokens to unlocked |

### fulfillOffer

```solidity
function fulfillOffer(address offeror, uint256 purchasePrice, uint256 repurchasePrice, bytes32 offerId) external
```

#### Parameters

| Name            | Type    | Description                                     |
| --------------- | ------- | ----------------------------------------------- |
| offeror         | address | The address of the offeror                      |
| purchasePrice   | uint256 | The offer amount to fulfill                     |
| repurchasePrice | uint256 | The repurchase price due to offeror at maturity |
| offerId         | bytes32 | Unique identifier for this offer                |

### fulfillBid

```solidity
function fulfillBid(address bidder, uint256 purchasePrice, uint256 repurchasePrice, address[] collateralTokens, uint256[] collateralAmounts, uint256 dayCountFractionMantissa) external
```

#### Parameters

| Name                     | Type       | Description                                                     |
| ------------------------ | ---------- | --------------------------------------------------------------- |
| bidder                   | address    | The address of the bidder                                       |
| purchasePrice            | uint256    | The bid amount to fulfill                                       |
| repurchasePrice          | uint256    | The repurchase price due at maturity                            |
| collateralTokens         | address\[] | Collateral token addresses                                      |
| collateralAmounts        | uint256\[] | Collateral token amounts                                        |
| dayCountFractionMantissa | uint256    | Actual/360 day count fraction parameter from Term Auction Group |

### approveRolloverAuction

```solidity
function approveRolloverAuction(address termAuction) external
```

#### Parameters

| Name        | Type    | Description                                                     |
| ----------- | ------- | --------------------------------------------------------------- |
| termAuction | address | The address of a TermAuction contract to receive autioneer role |

### openExposureOnRolloverNew

```solidity
function openExposureOnRolloverNew(address borrower, uint256 purchasePrice, uint256 repurchasePrice, address previousTermRepoLocker, uint256 dayCountFractionMantissa) external returns (uint256)
```

#### Parameters

| Name                     | Type    | Description                                                     |
| ------------------------ | ------- | --------------------------------------------------------------- |
| borrower                 | address | The address of the borrower rolling into new Term Repo          |
| purchasePrice            | uint256 | The purchase price received from new TermRepo                   |
| repurchasePrice          | uint256 | The new repurchase price due at maturity of new TermRepo        |
| previousTermRepoLocker   | address | The address of the old TermRepoLocker contract                  |
| dayCountFractionMantissa | uint256 | Actual/360 day count fraction parameter from Term Auction Group |

#### Return Values

| Name | Type    | Description                                                               |
| ---- | ------- | ------------------------------------------------------------------------- |
| \[0] | uint256 | The net purchase price received in after deducing protocol servicing fees |

### closeExposureOnRolloverExisting

```solidity
function closeExposureOnRolloverExisting(address borrower, uint256 rolloverSettlementAmount) external returns (uint256)
```

#### Parameters

| Name                     | Type    | Description                                                                                                           |
| ------------------------ | ------- | --------------------------------------------------------------------------------------------------------------------- |
| borrower                 | address | The address of the borrower                                                                                           |
| rolloverSettlementAmount | uint256 | The amount of net proceeds received from new TermRepo to pay down existing repurchase obligation due to old Term Repo |

#### Return Values

| Name | Type    | Description                                                                                                                        |
| ---- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| \[0] | uint256 | A uint256 representing the proportion of total repurchase due to old Term Repo from borrower settled by proceeds from new TermRepo |

### liquidatorCoverExposure

```solidity
function liquidatorCoverExposure(address borrower, address liquidator, uint256 amountToCover) external
```

#### Parameters

| Name          | Type    | Description                                               |
| ------------- | ------- | --------------------------------------------------------- |
| borrower      | address | The address of the borrower                               |
| liquidator    | address | The address of the liquidator                             |
| amountToCover | uint256 | The amount of repurchase exposure to cover in liquidation |

### liquidatorCoverExposureWithRepoToken

```solidity
function liquidatorCoverExposureWithRepoToken(address borrower, address liquidator, uint256 amountOfRepoToken) external returns (uint256)
```

#### Parameters

| Name              | Type    | Description                                            |
| ----------------- | ------- | ------------------------------------------------------ |
| borrower          | address | The address of the borrower                            |
| liquidator        | address | The address of the liquidator                          |
| amountOfRepoToken | uint256 | The amount of term tokens used to cover in liquidation |

#### Return Values

| Name | Type    | Description                                                 |
| ---- | ------- | ----------------------------------------------------------- |
| \[0] | uint256 | A uint256 representing purchase value of repo tokens burned |

### grantMintExposureAccess

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

#### Parameters

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

### reopenToNewAuction

```solidity
function reopenToNewAuction(struct TermAuctionGroup termAuctionGroup) external
```

#### Parameters

| Name             | Type                    | Description                                                                                               |
| ---------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
| termAuctionGroup | struct TermAuctionGroup | A struct containing contract addresses of a Term Auction deployment to pair for a reopening of a TermRepo |

### \_isTermRepoBalanced

```solidity
function _isTermRepoBalanced() internal view returns (bool)
```

Truncation is by 4 decimal places due to the assumption that number of participants < 10000

### \_getMaxRepaymentAroundRollover

```solidity
function _getMaxRepaymentAroundRollover(address borrower) internal view returns (uint256)
```

### \_repay

```solidity
function _repay(address _borrower, address repayer_, uint256 amount_) internal
```

### \_parRedemption

```solidity
function _parRedemption(address redeemer_, uint256 amount_) internal
```

### \_proRataRedemption

```solidity
function _proRataRedemption(address redeemer_, uint256 amount_) internal
```

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


# TermRepoLocker.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This is the contract in which Term Servicer locks collateral and purchase tokens.

## TermRepoLocker

This is the contract in which Term Servicer locks collateral and purchase tokens

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

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### SERVICER\_ROLE

```solidity
bytes32 SERVICER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### transfersPaused

```solidity
bool transfersPaused
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### whileTransfersNotPaused

```solidity
modifier whileTransfersNotPaused()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, address termInitializer_) external
```

### pairTermContracts

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

### transferTokenFromWallet

```solidity
function transferTokenFromWallet(address originWallet, address token, uint256 amount) external
```

Locks tokens from origin wallet Reverts if caller doesn't have SERVICER\_ROLE

#### Parameters

| Name         | Type    | Description                              |
| ------------ | ------- | ---------------------------------------- |
| originWallet | address | The wallet from which to transfer tokens |
| token        | address | The address of token being transferred   |
| amount       | uint256 | The amount of tokens to transfer         |

### transferTokenToWallet

```solidity
function transferTokenToWallet(address destinationWallet, address token, uint256 amount) external
```

Unlocks tokens to destination wallet

*Reverts if caller doesn't have SERVICER\_ROLE*

#### Parameters

| Name              | Type    | Description                         |
| ----------------- | ------- | ----------------------------------- |
| destinationWallet | address | The wallet to unlock tokens into    |
| token             | address | The address of token being unlocked |
| amount            | uint256 | The amount of tokens to unlock      |

### pauseTransfers

```solidity
function pauseTransfers() external
```

### unpauseTransfers

```solidity
function unpauseTransfers() 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 |


# TermRepoCollateralManager.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract enforces margin maintenance rules for adding/withdrawing, and liquidating tokens.

## TermRepoCollateralManager

This contract enforces margin maintenance rules for adding/withdrawing, repurchasing and liquidating collateral

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

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTION\_LOCKER

```solidity
bytes32 AUCTION_LOCKER
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### SERVICER\_ROLE

```solidity
bytes32 SERVICER_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### ROLLOVER\_TARGET\_AUCTIONEER\_ROLE

```solidity
bytes32 ROLLOVER_TARGET_AUCTIONEER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### liquidationsPaused

```solidity
bool liquidationsPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### numOfAcceptedCollateralTokens

```solidity
uint8 numOfAcceptedCollateralTokens
```

### deMinimisMarginThreshold

```solidity
uint256 deMinimisMarginThreshold
```

### liquidateDamangesDueToProtocol

```solidity
uint256 liquidateDamangesDueToProtocol
```

### netExposureCapOnLiquidation

```solidity
uint256 netExposureCapOnLiquidation
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### purchaseToken

```solidity
address purchaseToken
```

### termPriceOracle

```solidity
contract ITermPriceOracle termPriceOracle
```

### termRepoLocker

```solidity
contract ITermRepoLocker termRepoLocker
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### collateralTokens

```solidity
address[] collateralTokens
```

### encumberedCollateralBalances

```solidity
mapping(address => uint256) encumberedCollateralBalances
```

### maintenanceCollateralRatios

```solidity
mapping(address => uint256) maintenanceCollateralRatios
```

### initialCollateralRatios

```solidity
mapping(address => uint256) initialCollateralRatios
```

### liquidatedDamages

```solidity
mapping(address => uint256) liquidatedDamages
```

### lockedCollateralLedger

```solidity
mapping(address => mapping(address => uint256)) lockedCollateralLedger
```

### isCollateralTokenAccepted

```solidity
modifier isCollateralTokenAccepted(address token)
```

### whileLiquidationsNotPaused

```solidity
modifier whileLiquidationsNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, uint256 liquidateDamangesDueToProtocol_, uint256 netExposureCapOnLiquidation_, uint256 deMinimisMarginThreshold_, address purchaseToken_, struct Collateral[] collateralTokens_, contract ITermEventEmitter emitter_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoLocker_, address termRepoServicer_, address termAuctionBidLocker_, address termAuction_, address termController_, address termPriceOracle_, address termRepoRolloverManager_, address devopsMultisig_, address adminWallet_) external
```

### externalLockCollateral

```solidity
function externalLockCollateral(address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                 |
| --------------- | ------- | ------------------------------------------- |
| collateralToken | address | The address of the collateral token to lock |
| amount          | uint256 | The amount of collateral token to lock      |

### externalUnlockCollateral

```solidity
function externalUnlockCollateral(address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                   |
| --------------- | ------- | --------------------------------------------- |
| collateralToken | address | The address of the collateral token to unlock |
| amount          | uint256 | The amount of collateral token to unlock      |

### batchLiquidation

```solidity
function batchLiquidation(address borrower, uint256[] closureAmounts) external
```

#### Parameters

| Name           | Type       | Description                                                                                                                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower       | address    | The address of the borrower                                                                                                                                            |
| closureAmounts | uint256\[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |

### batchLiquidationWithRepoToken

```solidity
function batchLiquidationWithRepoToken(address borrower, uint256[] closureRepoTokenAmounts) external
```

#### Parameters

| Name                    | Type       | Description                                                                                                                                                                                 |
| ----------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower                | address    | The address of the borrower                                                                                                                                                                 |
| closureRepoTokenAmounts | uint256\[] | An array specifying the amounts of Term Repo Tokens the liquidator proposes to cover borrower repo exposure in liquidation; an amount is required to be specified for each collateral token |

### batchDefault

```solidity
function batchDefault(address borrower, uint256[] closureAmounts) external
```

#### Parameters

| Name           | Type       | Description                                                                                                                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower       | address    | The address of the borrower                                                                                                                                            |
| closureAmounts | uint256\[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |

### calculateMintableExposure

```solidity
function calculateMintableExposure(address collateralToken, uint256 amountToLock) external view returns (struct ExponentialNoError.Exp)
```

#### Parameters

| Name            | Type    | Description                                   |
| --------------- | ------- | --------------------------------------------- |
| collateralToken | address | The collateral token address of tokens locked |
| amountToLock    | uint256 | The amount of collateral tokens to lock       |

### getCollateralBalances

```solidity
function getCollateralBalances(address borrower) external view returns (address[], uint256[])
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type       | Description                                                     |
| ---- | ---------- | --------------------------------------------------------------- |
| \[0] | address\[] | An array of collateral token addresses                          |
| \[1] | uint256\[] | An array collateral token balances locked on behalf of borrower |

### getCollateralBalance

```solidity
function getCollateralBalance(address borrower, address collateralToken) external view returns (uint256)
```

#### Parameters

| Name            | Type    | Description                           |
| --------------- | ------- | ------------------------------------- |
| borrower        | address | The address of the borrower           |
| collateralToken | address | The collateral token address to query |

#### Return Values

| Name | Type    | Description                                                        |
| ---- | ------- | ------------------------------------------------------------------ |
| \[0] | uint256 | uint256 The amount of collateralToken locked on behalf of borrower |

### encumberedCollateralRemaining

```solidity
function encumberedCollateralRemaining() external view returns (bool)
```

#### Return Values

| Name | Type | Description                                                                |
| ---- | ---- | -------------------------------------------------------------------------- |
| \[0] | bool | bool A boolean that tests whether any encumbered collateral remains locked |

### auctionLockCollateral

```solidity
function auctionLockCollateral(address bidder, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                       |
| --------------- | ------- | ------------------------------------------------- |
| bidder          | address | The bidder's address                              |
| collateralToken | address | The address of the token to be used as collateral |
| amount          | uint256 | The amount of the token to lock                   |

### auctionUnlockCollateral

```solidity
function auctionUnlockCollateral(address bidder, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                 |
| --------------- | ------- | ------------------------------------------- |
| bidder          | address | The bidder's address                        |
| collateralToken | address | The address of the token used as collateral |
| amount          | uint256 | The amount of collateral tokens to unlock   |

### acceptRolloverCollateral

```solidity
function acceptRolloverCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                             |
| --------------- | ------- | --------------------------------------- |
| borrower        | address | The address of the borrower             |
| collateralToken | address | The address of a collateral token       |
| amount          | uint256 | The amount of collateral tokens to lock |

### transferRolloverCollateral

```solidity
function transferRolloverCollateral(address borrower, uint256 rolloverProportion, address rolloverTermRepoLocker) external returns (address[], uint256[])
```

#### Parameters

| Name                   | Type    | Description                                                                                       |
| ---------------------- | ------- | ------------------------------------------------------------------------------------------------- |
| borrower               | address | The borrower's address                                                                            |
| rolloverProportion     | uint256 | The proportion of the collateral to be unlocked, equal to the proportion of the collateral repaid |
| rolloverTermRepoLocker | address | The address of the new TermRepoLocker contract to roll into                                       |

#### Return Values

| Name | Type       | Description                                                                                                    |
| ---- | ---------- | -------------------------------------------------------------------------------------------------------------- |
| \[0] | address\[] | An array representing a list of accepted collateral token addresses                                            |
| \[1] | uint256\[] | An array containing the amount of collateral tokens to pairoff and transfer to new TermRepoLocker to roll into |

### approveRolloverAuction

```solidity
function approveRolloverAuction(address rolloverAuction) external
```

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| rolloverAuction | address | The address of the rollover auction |

### unlockCollateralOnRepurchase

```solidity
function unlockCollateralOnRepurchase(address borrower) external
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

### journalBidCollateralToCollateralManager

```solidity
function journalBidCollateralToCollateralManager(address borrower, address[] collateralTokenAddresses, uint256[] collateralTokenAmounts) external
```

#### Parameters

| Name                     | Type       | Description                 |
| ------------------------ | ---------- | --------------------------- |
| borrower                 | address    | The address of the borrower |
| collateralTokenAddresses | address\[] | Collateral token addresses  |
| collateralTokenAmounts   | uint256\[] | Collateral token amounts    |

### mintOpenExposureLockCollateral

```solidity
function mintOpenExposureLockCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| borrower        | address | The address of the borrower |
| collateralToken | address | Collateral token addresse   |
| amount          | uint256 | Collateral token amount     |

### reopenToNewAuction

```solidity
function reopenToNewAuction(struct TermAuctionGroup termAuctionGroup) external
```

#### Parameters

| Name             | Type                    | Description                   |
| ---------------- | ----------------------- | ----------------------------- |
| termAuctionGroup | struct TermAuctionGroup | A struct of auction contracts |

### pauseLiquidations

```solidity
function pauseLiquidations() external
```

### unpauseLiquidations

```solidity
function unpauseLiquidations() external
```

### isBorrowerInShortfall

```solidity
function isBorrowerInShortfall(address borrower) public view returns (bool)
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type | Description                                                                  |
| ---- | ---- | ---------------------------------------------------------------------------- |
| \[0] | bool | Boolean testing whether the given borrower is in shortfall or margin deficit |

### getCollateralMarketValue

```solidity
function getCollateralMarketValue(address borrower) public view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type    | Description                                                         |
| ---- | ------- | ------------------------------------------------------------------- |
| \[0] | uint256 | The market value of borrower's locked collateral denominated in USD |

### \_lockCollateral

```solidity
function _lockCollateral(address borrower, address collateralToken, uint256 amount) internal
```

### \_unlockCollateral

```solidity
function _unlockCollateral(address borrower, address collateralToken, uint256 amount, bool decrementEncumberedCollateral) internal
```

### \_partialUnlockCollateral

```solidity
function _partialUnlockCollateral(address borrower, uint256 unlockProportion, address destinationwallet) internal returns (uint256[])
```

### \_validateBatchLiquidationForFullLiquidation

```solidity
function _validateBatchLiquidationForFullLiquidation(address borrower, address liquidator, uint256[] closureTokenAmounts) internal returns (bool)
```

*A helper function to validate various conditions required to liquidate*

#### Return Values

| Name | Type | Description                                                           |
| ---- | ---- | --------------------------------------------------------------------- |
| \[0] | bool | A boolean for whether borrower position eligible for full liquidation |

### \_unencumberRemainingBorrowerCollateralOnZeroObligation

```solidity
function _unencumberRemainingBorrowerCollateralOnZeroObligation(address borrower) internal
```

### \_withinNetExposureCapOnLiquidation

```solidity
function _withinNetExposureCapOnLiquidation(address borrower) internal view returns (bool)
```

### \_collateralSeizureAmounts

```solidity
function _collateralSeizureAmounts(uint256 amountToCover_, address collateralToken) internal view returns (uint256, uint256)
```

*returns total amount of collateral seized in liquidation and the amount of that total going protocol*

### \_transferLiquidationCollateral

```solidity
function _transferLiquidationCollateral(address borrower, address liquidator, address collateralAddress, uint256 closureAmount, uint256 collateralSeizureAmount, uint256 collateralSeizureProtocolShare, bool isDefault) internal
```

*A helper function to transfer tokens and update relevant state variables and mappings*

### \_isAcceptedCollateralToken

```solidity
function _isAcceptedCollateralToken(address token_) internal view returns (bool)
```

### \_usdValueOfBalances

```solidity
function _usdValueOfBalances(mapping(address => uint256) _tokenBalances) internal view returns (uint256)
```

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


# TermRepoRolloverManager.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract accepts and carries out borrower Term Repo rollover instructions.

## TermRepoRolloverManager

This contract accepts and carries out borrower Term Repo rollover instructions

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

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### ROLLOVER\_BID\_FULFILLER\_ROLE

```solidity
bytes32 ROLLOVER_BID_FULFILLER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### approvedRolloverAuctions

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

### rolloverElections

```solidity
mapping(address => struct TermRepoRolloverElection) rolloverElections
```

### termContractPaired

```solidity
bool termContractPaired
```

### whileNotMatured

```solidity
modifier whileNotMatured()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, contract ITermRepoServicer termRepoServicer_, contract ITermRepoCollateralManager termRepoCollateralManager_, contract ITermController termController_, address termInitializer_) external
```

### pairTermContracts

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

### electRollover

```solidity
function electRollover(struct TermRepoRolloverElectionSubmission termRepoRolloverElectionSubmission) external
```

An external function that accepted Term Repo rollover instructions

#### Parameters

| Name                               | Type                                      | Description                                        |
| ---------------------------------- | ----------------------------------------- | -------------------------------------------------- |
| termRepoRolloverElectionSubmission | struct TermRepoRolloverElectionSubmission | A struct containing borrower rollover instructions |

### getRolloverInstructions

```solidity
function getRolloverInstructions(address borrower) external view returns (struct TermRepoRolloverElection)
```

A view function that returns borrower rollover instructions

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type                            | Description                                        |
| ---- | ------------------------------- | -------------------------------------------------- |
| \[0] | struct TermRepoRolloverElection | A struct containing borrower rollover instructions |

### cancelRollover

```solidity
function cancelRollover() external
```

An external function to cancel previously submitted rollover instructions

### fulfillRollover

```solidity
function fulfillRollover(address borrower) external
```

An external function called by repo servicer to mark rollover as fulfilled

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

### approveRolloverAuction

```solidity
function approveRolloverAuction(contract ITermAuctionBidLocker auctionBidLocker, address termAuction) external
```

#### Parameters

| Name             | Type                           | Description                                                          |
| ---------------- | ------------------------------ | -------------------------------------------------------------------- |
| auctionBidLocker | contract ITermAuctionBidLocker | The ABI for ITermAuctionBidLocker interface                          |
| termAuction      | address                        | The address of TermAuction contract to mark as eligible for rollover |

### revokeRolloverApproval

```solidity
function revokeRolloverApproval(contract ITermAuctionBidLocker auctionBidLocker) external
```

#### Parameters

| Name             | Type                           | Description                                 |
| ---------------- | ------------------------------ | ------------------------------------------- |
| auctionBidLocker | contract ITermAuctionBidLocker | The ABI for ITermAuctionBidLocker interface |

### \_processRollover

```solidity
function _processRollover(address borrowerToRollover) internal
```

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


# TermRepoToken.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This is an ERC-20 contract to track claims to the aggregate repurchase obligations due on the r

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


# Protocol Class

Protocol contracts are evergreen contracts at the protocol level that govern and apply across all Term Repos.

{% content-ref url="/pages/GJ7XthEvgk3P7zgCki0N" %}
[TermController.sol](/0.5.31/protocol-class/termcontroller)
{% endcontent-ref %}

{% content-ref url="/pages/XFhgPGYvcKzMWA4HG1fC" %}
[TermEventEmitter.sol](/0.6.0/protocol-class/termeventemitter)
{% endcontent-ref %}

{% content-ref url="/pages/w6Ks7ih9GTT5sxOFIblO" %}
[TermInitializer.sol](/0.6.0/protocol-class/terminitializer)
{% endcontent-ref %}

{% content-ref url="/pages/35ohw6SFco2IXPJnXg9P" %}
[TermPriceConsumerV3.sol](/0.5.31/protocol-class/termpriceconsumerv3)
{% endcontent-ref %}


# TermController.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract manages Term Finance protocol permissions and controls

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

### CONTROLLER\_ADMIN\_ROLE

```solidity
bytes32 CONTROLLER_ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### treasuryWallet

```solidity
address treasuryWallet
```

### protocolReserveWallet

```solidity
address protocolReserveWallet
```

### termAddresses

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

### constructor

```solidity
constructor() public
```

### initialize

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

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

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

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

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# TermEventEmitter.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract is a centralized event emitter that records important events to the blockchain

## TermEventEmitter

This contract is a centralized event emitter that records important events to the blockchain

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

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### TERM\_CONTRACT

```solidity
bytes32 TERM_CONTRACT
```

### TERM\_DELISTER

```solidity
bytes32 TERM_DELISTER
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address devopsWallet_, address termDelister_, address termInitializer_) external
```

### pairTermContract

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

### emitTermAuctionInitialized

```solidity
function emitTermAuctionInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuction, uint256 auctionEndTime, string version) external
```

#### Parameters

| Name           | Type    | Description                                                  |
| -------------- | ------- | ------------------------------------------------------------ |
| termRepoId     | bytes32 | The id of the current Term Repo deployment being initialized |
| termAuctionId  | bytes32 | The id of the auction being initialized                      |
| termAuction    | address | The address of the auction contract being initialized        |
| auctionEndTime | uint256 | The end time of the auction being initialized                |
| version        | string  | The version tag of the smart contract deployed               |

### emitBidAssigned

```solidity
function emitBidAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount) external
```

#### Parameters

| Name          | Type    | Description                     |
| ------------- | ------- | ------------------------------- |
| termAuctionId | bytes32 | A Term Auction id               |
| id            | bytes32 | A bid id                        |
| amount        | uint256 | The amount assigned to this bid |

### emitOfferAssigned

```solidity
function emitOfferAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount) external
```

#### Parameters

| Name          | Type    | Description                       |
| ------------- | ------- | --------------------------------- |
| termAuctionId | bytes32 | A Term Auction id                 |
| id            | bytes32 | An offer id                       |
| amount        | uint256 | The amount assigned to this offer |

### emitAuctionCompleted

```solidity
function emitAuctionCompleted(bytes32 termAuctionId, uint256 timestamp, uint256 blockNumber, uint256 totalAssignedBids, uint256 totalAssignedOffers, uint256 clearingPrice) external
```

#### Parameters

| Name                | Type    | Description                                  |
| ------------------- | ------- | -------------------------------------------- |
| termAuctionId       | bytes32 | The Term Auction id of auction completed     |
| timestamp           | uint256 | The timestamp of the current block           |
| blockNumber         | uint256 | The number of the current block              |
| totalAssignedBids   | uint256 | The number of assigned bids in the auction   |
| totalAssignedOffers | uint256 | The number of assigned offers in the auction |
| clearingPrice       | uint256 | The clearing price of the auction            |

### emitAuctionCancelled

```solidity
function emitAuctionCancelled(bytes32 termAuctionId, bool nonViableAuction, bool auctionCancelledforWithdrawal) external
```

#### Parameters

| Name                          | Type    | Description                                                     |
| ----------------------------- | ------- | --------------------------------------------------------------- |
| termAuctionId                 | bytes32 | The id of the auction cancelled                                 |
| nonViableAuction              | bool    | Auction not viable due to bid and offer prices not intersecting |
| auctionCancelledforWithdrawal | bool    | Auction has been cancelled for manual fund withdrawal           |

### emitCompleteAuctionPaused

```solidity
function emitCompleteAuctionPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                     |
| ------------- | ------- | ----------------------------------------------- |
| termAuctionId | bytes32 | The id of the auction paused                    |
| termRepoId    | bytes32 | The Term Repo id associated with auction paused |

### emitCompleteAuctionUnpaused

```solidity
function emitCompleteAuctionUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                       |
| ------------- | ------- | ------------------------------------------------- |
| termAuctionId | bytes32 | The id of the auction unpaused                    |
| termRepoId    | bytes32 | The Term Repo id associated with auction unpaused |

### emitTermAuctionBidLockerInitialized

```solidity
function emitTermAuctionBidLockerInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuctionBidLocker, uint256 auctionStartTime, uint256 revealTime, uint256 maxBidPrice, uint256 minimumTenderAmount, uint256 dayCountFractionMantissa) external
```

#### Parameters

| Name                     | Type    | Description                                                       |
| ------------------------ | ------- | ----------------------------------------------------------------- |
| termRepoId               | bytes32 | The Term Repo id associated with BidLocker initialized            |
| termAuctionId            | bytes32 | The Term Auction id associated with BidLocker initialized         |
| termAuctionBidLocker     | address | The address of the TermAuctionBidLocker contract being intialized |
| auctionStartTime         | uint256 | The time at which auction bids will be accepted for submission    |
| revealTime               | uint256 | The time at which sealed auction bids can be revealed             |
| maxBidPrice              | uint256 | The maximum bid price for the auction                             |
| minimumTenderAmount      | uint256 | The minimum tender amount for the auction                         |
| dayCountFractionMantissa | uint256 | The day count fraction remainder                                  |

### emitBidLocked

```solidity
function emitBidLocked(bytes32 termAuctionId, struct TermAuctionBid bid, address referralAddress) external
```

#### Parameters

| Name            | Type                  | Description                                        |
| --------------- | --------------------- | -------------------------------------------------- |
| termAuctionId   | bytes32               | A Term Auction id                                  |
| bid             | struct TermAuctionBid | A struct containing details of the locked bid      |
| referralAddress | address               | The address of the referrer. Zero Address if none. |

### emitBidRevealed

```solidity
function emitBidRevealed(bytes32 termAuctionId, bytes32 id, uint256 bidPrice) external
```

#### Parameters

| Name          | Type    | Description                   |
| ------------- | ------- | ----------------------------- |
| termAuctionId | bytes32 | A Term Auction id             |
| id            | bytes32 | The bid id                    |
| bidPrice      | uint256 | The revealed price of the bid |

### emitBidUnlocked

```solidity
function emitBidUnlocked(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | A bid id          |

### emitBidInShortfall

```solidity
function emitBidInShortfall(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | A bid id          |

### emitBidLockingPaused

```solidity
function emitBidLockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                        |
| ------------- | ------- | -------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid locking is paused |
| termRepoId    | bytes32 | The Term Repo id where bid locking is paused       |

### emitBidLockingUnpaused

```solidity
function emitBidLockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid locking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where bid locking is unpaused       |

### emitBidUnlockingPaused

```solidity
function emitBidUnlockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid unlocking is paused |
| termRepoId    | bytes32 | The Term Repo id where bid unlocking is paused       |

### emitBidUnlockingUnpaused

```solidity
function emitBidUnlockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where bid unlocking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where bid unlocking is unpaused       |

### emitTermAuctionOfferLockerInitialized

```solidity
function emitTermAuctionOfferLockerInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuctionOfferLocker, uint256 auctionStartTime, uint256 revealTime, uint256 maxOfferPrice, uint256 minimumTenderAmount) external
```

#### Parameters

| Name                   | Type    | Description                                                         |
| ---------------------- | ------- | ------------------------------------------------------------------- |
| termRepoId             | bytes32 | The Term Repo id associated with OfferLocker initialized            |
| termAuctionId          | bytes32 | The Term Auction id associated with OfferLocker initialized         |
| termAuctionOfferLocker | address | The address of the TermAuctionOfferLocker contract being intialized |
| auctionStartTime       | uint256 | The time at which auction bids will be accepted for submission      |
| revealTime             | uint256 | The time at which sealed auction bids can be revealed               |
| maxOfferPrice          | uint256 | The maximum offer price for the auction                             |
| minimumTenderAmount    | uint256 | The minimum tender amount for the auction                           |

### emitOfferLocked

```solidity
function emitOfferLocked(bytes32 termAuctionId, bytes32 id, address offeror, bytes32 offerPrice, uint256 amount, address purchaseToken, address referralAddress) external
```

#### Parameters

| Name            | Type    | Description                                        |
| --------------- | ------- | -------------------------------------------------- |
| termAuctionId   | bytes32 | A Term Auction id                                  |
| id              | bytes32 | An offer id                                        |
| offeror         | address | The address of the offeror                         |
| offerPrice      | bytes32 | The offer price                                    |
| amount          | uint256 | The amount of purchase tokens offered              |
| purchaseToken   | address | The address of the purchase token being offered    |
| referralAddress | address | The address of the referrer. Zero Address if none. |

### emitOfferRevealed

```solidity
function emitOfferRevealed(bytes32 termAuctionId, bytes32 id, uint256 offerPrice) external
```

#### Parameters

| Name          | Type    | Description              |
| ------------- | ------- | ------------------------ |
| termAuctionId | bytes32 | A Term Auction id        |
| id            | bytes32 | An offer id              |
| offerPrice    | uint256 | The offer price revealed |

### emitOfferUnlocked

```solidity
function emitOfferUnlocked(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | An offer id       |

### emitOfferLockingPaused

```solidity
function emitOfferLockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where offer locking is paused |
| termRepoId    | bytes32 | The Term Repo id where offer locking is paused       |

### emitOfferLockingUnpaused

```solidity
function emitOfferLockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where offer locking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where offer locking is unpaused       |

### emitOfferUnlockingPaused

```solidity
function emitOfferUnlockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where offer unlocking is paused |
| termRepoId    | bytes32 | The Term Repo id where offer unlocking is paused       |

### emitOfferUnlockingUnpaused

```solidity
function emitOfferUnlockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                              |
| ------------- | ------- | -------------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where offer unlocking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where offer unlocking is unpaused       |

### emitTermRepoCollateralManagerInitialized

```solidity
function emitTermRepoCollateralManagerInitialized(bytes32 termRepoId, address termRepoCollateralManager, address[] collateralTokens, uint256[] initialCollateralRatios, uint256[] maintenanceCollateralRatios, uint256[] liquidatedDamagesSchedule) external
```

#### Parameters

| Name                        | Type       | Description                                                                     |
| --------------------------- | ---------- | ------------------------------------------------------------------------------- |
| termRepoId                  | bytes32    | The Term Repo id associated with collateral manger being initialized            |
| termRepoCollateralManager   | address    | The address of the TermRepoCollateralManager contract being intialized          |
| collateralTokens            | address\[] | An array containing a list of the addresses of all accepted collateral tokens   |
| initialCollateralRatios     | uint256\[] | An array containing the initial collateral ratios for each collateral token     |
| maintenanceCollateralRatios | uint256\[] | An array containing the maintenance collateral ratios for each collateral token |
| liquidatedDamagesSchedule   | uint256\[] | An array containing the liquidated damages applicable to each collateral token  |

### emitPairReopeningBidLocker

```solidity
function emitPairReopeningBidLocker(bytes32 termRepoId, address termRepoCollateralManager, address termAuctionBidLocker) external
```

#### Parameters

| Name                      | Type    | Description                                                            |
| ------------------------- | ------- | ---------------------------------------------------------------------- |
| termRepoId                | bytes32 | The Term Repo id for the Term Repo being reopened                      |
| termRepoCollateralManager | address | The TermRepoCollateralManager address for the Term Repo being reopened |
| termAuctionBidLocker      | address | The new TermAuctionBidLocker to be paired for reopening                |

### emitCollateralLocked

```solidity
function emitCollateralLocked(bytes32 termRepoId, address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                |
| --------------- | ------- | ------------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                             |
| borrower        | address | The address of the borrower                |
| collateralToken | address | The address of the collateral token locked |
| amount          | uint256 | The amount of collateral being locked      |

### emitCollateralUnlocked

```solidity
function emitCollateralUnlocked(bytes32 termRepoId, address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                |
| --------------- | ------- | ------------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                             |
| borrower        | address | The address of the borrower                |
| collateralToken | address | The address of the collateral token locked |
| amount          | uint256 | The amount of collateral being unlocked    |

### emitLiquidation

```solidity
function emitLiquidation(bytes32 termRepoId, address borrower, address liquidator, uint256 closureAmount, address collateralToken, uint256 amountLiquidated, uint256 protocolSeizureAmount, bool defaultLiquidation) external
```

#### Parameters

| Name                  | Type    | Description                                     |
| --------------------- | ------- | ----------------------------------------------- |
| termRepoId            | bytes32 | A Term Repo id                                  |
| borrower              | address | The address of the borrower                     |
| liquidator            | address | The address of the liquidator                   |
| closureAmount         | uint256 | The amount of repurchase exposure covered       |
| collateralToken       | address | The address of the collateral tokens liquidated |
| amountLiquidated      | uint256 | The amount of collateral tokens liquidated      |
| protocolSeizureAmount | uint256 |                                                 |
| defaultLiquidation    | bool    |                                                 |

### emitLiquidationPaused

```solidity
function emitLiquidationPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                       |
| ---------- | ------- | ------------------------------------------------- |
| termRepoId | bytes32 | The id of Term Repo where liquidations are paused |

### emitLiquidationUnpaused

```solidity
function emitLiquidationUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                       |
| ---------- | ------- | ------------------------------------------------- |
| termRepoId | bytes32 | The id of Term Repo where liquidation is unpaused |

### emitTermRepoServicerInitialized

```solidity
function emitTermRepoServicerInitialized(bytes32 termRepoId, address termRepoServicer, address purchaseToken, uint256 maturityTimestamp, uint256 endOfRepurchaseWindow, uint256 redemptionTimestamp, uint256 servicingFee, string version) external
```

#### Parameters

| Name                  | Type    | Description                                                         |
| --------------------- | ------- | ------------------------------------------------------------------- |
| termRepoId            | bytes32 | The Term Repo id associated with TermRepoServicer being initialized |
| termRepoServicer      | address | The address of the TermRepoServicer contract being initialized      |
| purchaseToken         | address | The address of the purchase token                                   |
| maturityTimestamp     | uint256 | The time at which repurchase is due                                 |
| endOfRepurchaseWindow | uint256 | The time at which the repurchase window ends                        |
| redemptionTimestamp   | uint256 | The time when redemption of Term Repo Tokens begins                 |
| servicingFee          | uint256 | percentage share of bid amounts charged to bidder                   |
| version               | string  | The version tag of the smart contract deployed                      |

### emitReopeningOfferLockerPaired

```solidity
function emitReopeningOfferLockerPaired(bytes32 termRepoId, address termRepoServicer, address termAuctionOfferLocker, address termAuction) external
```

#### Parameters

| Name                   | Type    | Description                                                                   |
| ---------------------- | ------- | ----------------------------------------------------------------------------- |
| termRepoId             | bytes32 | The Term Repo id for the Term Repo being reopened                             |
| termRepoServicer       | address | The address of the TermRepoServicer contract for the Term Repo being reopened |
| termAuctionOfferLocker | address | The TermAuctionOfferLocker to be paired for reopening                         |
| termAuction            | address | The address of the TermAuction contract to be paired for reopening            |

### emitOfferLockedByServicer

```solidity
function emitOfferLockedByServicer(bytes32 termRepoId, address offeror, uint256 amount) external
```

This event is not to be confused with OfferLocked by TermOfferLocker Both this event and OfferLocked will be triggered, this one specifically refers to corresponding action taken by Term Servicer

#### Parameters

| Name       | Type    | Description                   |
| ---------- | ------- | ----------------------------- |
| termRepoId | bytes32 | A Term Repo id                |
| offeror    | address | The address of the offeror    |
| amount     | uint256 | The offer amount to be locked |

### emitOfferUnlockedByServicer

```solidity
function emitOfferUnlockedByServicer(bytes32 termRepoId, address offeror, uint256 amount) external
```

This event is not to be confused with OfferUnlocked by TermOfferLocker Both this event and OfferLocked will be triggered, this one specifically refers to corresponding action taken by Term Servicer

#### Parameters

| Name       | Type    | Description                     |
| ---------- | ------- | ------------------------------- |
| termRepoId | bytes32 | A Term Repo id                  |
| offeror    | address | The address of the offeror      |
| amount     | uint256 | The offer amount to be unlocked |

### emitOfferFulfilled

```solidity
function emitOfferFulfilled(bytes32 offerId, address offeror, uint256 purchasePrice, uint256 repurchasePrice, uint256 repoTokensMinted) external
```

#### Parameters

| Name             | Type    | Description                                      |
| ---------------- | ------- | ------------------------------------------------ |
| offerId          | bytes32 | A unique offer id                                |
| offeror          | address | The address of the offeror                       |
| purchasePrice    | uint256 | The offer amount fulfilled                       |
| repurchasePrice  | uint256 | The repurchase price due to offeror at maturity  |
| repoTokensMinted | uint256 | The amount of Term Repo Tokens minted to offeror |

### emitTermRepoTokensRedeemed

```solidity
function emitTermRepoTokensRedeemed(bytes32 termRepoId, address redeemer, uint256 redemptionAmount, uint256 redemptionHaircut) external
```

#### Parameters

| Name              | Type    | Description                                                                    |
| ----------------- | ------- | ------------------------------------------------------------------------------ |
| termRepoId        | bytes32 | A Term Repo id                                                                 |
| redeemer          | address | The address of the redeemer                                                    |
| redemptionAmount  | uint256 | The amount of TermRepoTokens redeemed                                          |
| redemptionHaircut | uint256 | The haircut applied to redemptions (if any) due to unrecoverable repo exposure |

### emitBidFulfilled

```solidity
function emitBidFulfilled(bytes32 termRepoId, address bidder, uint256 purchasePrice, uint256 repurchasePrice, uint256 servicingFees) external
```

#### Parameters

| Name            | Type    | Description                          |
| --------------- | ------- | ------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                       |
| bidder          | address | The address of the bidder            |
| purchasePrice   | uint256 | The bid amount fulfilled in auction  |
| repurchasePrice | uint256 | The repurchase price due at maturity |
| servicingFees   | uint256 | The fees earned by the protocol      |

### emitExposureOpenedOnRolloverNew

```solidity
function emitExposureOpenedOnRolloverNew(bytes32 termRepoId, address borrower, uint256 purchasePrice, uint256 repurchasePrice, uint256 servicingFees) external
```

#### Parameters

| Name            | Type    | Description                                              |
| --------------- | ------- | -------------------------------------------------------- |
| termRepoId      | bytes32 | A Term Repo id                                           |
| borrower        | address | The address of the borrower                              |
| purchasePrice   | uint256 | The purchase price received from new TermRepo            |
| repurchasePrice | uint256 | The new repurchase price due at maturity of new TermRepo |
| servicingFees   | uint256 | The fees earned by the protocol                          |

### emitExposureClosedOnRolloverExisting

```solidity
function emitExposureClosedOnRolloverExisting(bytes32 termRepoId, address borrower, uint256 amountRolled) external
```

#### Parameters

| Name         | Type    | Description                                             |
| ------------ | ------- | ------------------------------------------------------- |
| termRepoId   | bytes32 | A Term Repo id                                          |
| borrower     | address | The address of the borrower                             |
| amountRolled | uint256 | The repurchase exposure balance closed on old Term Repo |

### emitRepurchasePaymentSubmitted

```solidity
function emitRepurchasePaymentSubmitted(bytes32 termRepoId, address borrower, uint256 amount) external
```

#### Parameters

| Name       | Type    | Description                         |
| ---------- | ------- | ----------------------------------- |
| termRepoId | bytes32 | A Term Repo id                      |
| borrower   | address | The address of the borrower         |
| amount     | uint256 | The amount submitted for repurchase |

### emitMintExposureAccessGranted

```solidity
function emitMintExposureAccessGranted(bytes32 termRepoId, address authedUser) external
```

#### Parameters

| Name       | Type    | Description                       |
| ---------- | ------- | --------------------------------- |
| termRepoId | bytes32 | A Term Repo id                    |
| authedUser | address | User granted mint exposure access |

### emitMintExposure

```solidity
function emitMintExposure(bytes32 termRepoId, address minter, uint256 netTokensReceived, uint256 servicingFeeTokens, uint256 repurchasePrice) external
```

#### Parameters

| Name               | Type    | Description                                                             |
| ------------------ | ------- | ----------------------------------------------------------------------- |
| termRepoId         | bytes32 | A Term Repo id                                                          |
| minter             | address | The address of the minter                                               |
| netTokensReceived  | uint256 | The amount of Term Repo Tokens received by minter net of servicing fees |
| servicingFeeTokens | uint256 | The number of Term Repo Tokens retained by protocol in servicing fees   |
| repurchasePrice    | uint256 | The repurchase exposure opened by minter against Term Repo Token mint   |

### emitBurnCollapseExposure

```solidity
function emitBurnCollapseExposure(bytes32 termRepoId, address borrower, uint256 closeAmount) external
```

#### Parameters

| Name        | Type    | Description                                |
| ----------- | ------- | ------------------------------------------ |
| termRepoId  | bytes32 | A Term Repo id                             |
| borrower    | address | The address of the borrower                |
| closeAmount | uint256 | The amount of repurchase exposure to close |

### emitTermRepoRolloverManagerInitialized

```solidity
function emitTermRepoRolloverManagerInitialized(bytes32 termRepoId, address rolloverManager) external
```

#### Parameters

| Name            | Type    | Description                                                                |
| --------------- | ------- | -------------------------------------------------------------------------- |
| termRepoId      | bytes32 | The Term Repo id associated with TermRepoRolloverManager being initialized |
| rolloverManager | address | The address of the TermRepoRolloverManager contract being initialized      |

### emitRolloverTermApproved

```solidity
function emitRolloverTermApproved(bytes32 termRepoId, bytes32 rolloverTermAuctionId) external
```

#### Parameters

| Name                  | Type    | Description                                                  |
| --------------------- | ------- | ------------------------------------------------------------ |
| termRepoId            | bytes32 | The Term Repo id of existing Term Repo                       |
| rolloverTermAuctionId | bytes32 | The Term Auction Id that rollover bid will be submitted into |

### emitRolloverTermApprovalRevoked

```solidity
function emitRolloverTermApprovalRevoked(bytes32 termRepoId, bytes32 rolloverTermAuctionId) external
```

#### Parameters

| Name                  | Type    | Description                                            |
| --------------------- | ------- | ------------------------------------------------------ |
| termRepoId            | bytes32 | The Term Repo id of existing Term Repo                 |
| rolloverTermAuctionId | bytes32 | The Term Auction Id whose rollover approval is revoked |

### emitRolloverElection

```solidity
function emitRolloverElection(bytes32 termRepoId, bytes32 rolloverTermRepoId, address borrower, address rolloverAuction, uint256 rolloverAmount, bytes32 hashedBidPrice) external
```

#### Parameters

| Name               | Type    | Description                                     |
| ------------------ | ------- | ----------------------------------------------- |
| termRepoId         | bytes32 | The Term Repo id of existing Term Repo          |
| rolloverTermRepoId | bytes32 | The Term Repo Id of Rollover Term Repo          |
| borrower           | address | The address of the borrower                     |
| rolloverAuction    | address | The address of the auction being rolled over to |
| rolloverAmount     | uint256 | The repurchase amount being rolled over         |
| hashedBidPrice     | bytes32 | The hash of the rollover bid price              |

### emitRolloverCancellation

```solidity
function emitRolloverCancellation(bytes32 termRepoId, address borrower) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The Term Repo id of existing Term Repo |
| borrower   | address | The address of the borrower            |

### emitRolloverProcessed

```solidity
function emitRolloverProcessed(bytes32 termRepoId, address borrower) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The Term Repo id of existing Term Repo |
| borrower   | address | The address of the borrower            |

### emitTermRepoLockerInitialized

```solidity
function emitTermRepoLockerInitialized(bytes32 termRepoId, address termRepoLocker) external
```

#### Parameters

| Name           | Type    | Description                                                                |
| -------------- | ------- | -------------------------------------------------------------------------- |
| termRepoId     | bytes32 | The Term Repo id associated with TermRepoLocker contract being initialized |
| termRepoLocker | address | The address of the TermRepoLocker contract being initialized               |

### emitTermRepoLockerTransfersPaused

```solidity
function emitTermRepoLockerTransfersPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| termRepoId | bytes32 | A Term Repo id |

### emitTermRepoLockerTransfersUnpaused

```solidity
function emitTermRepoLockerTransfersUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| termRepoId | bytes32 | A Term Repo id |

### emitTermRepoTokenInitialized

```solidity
function emitTermRepoTokenInitialized(bytes32 termRepoId, address termRepoToken, uint256 redemptionRatio) external
```

#### Parameters

| Name            | Type    | Description                                                                 |
| --------------- | ------- | --------------------------------------------------------------------------- |
| termRepoId      | bytes32 | The Term Repo id associated with the TermRepoToken being initalized         |
| termRepoToken   | address | The address of the TermRepoToken contract being initialized                 |
| redemptionRatio | uint256 | The number of purchase tokens redeemable per unit of Term Repo Token at par |

### emitTermRepoTokenMintingPaused

```solidity
function emitTermRepoTokenMintingPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                |
| ---------- | ------- | -------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where minting is paused |

### emitTermRepoTokenMintingUnpaused

```solidity
function emitTermRepoTokenMintingUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where minting is unpaused |

### emitTermRepoTokenBurningPaused

```solidity
function emitTermRepoTokenBurningPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                |
| ---------- | ------- | -------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where burning is paused |

### emitTermRepoTokenBurningUnpaused

```solidity
function emitTermRepoTokenBurningUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where burning is unpaused |

### emitDelistTermRepo

```solidity
function emitDelistTermRepo(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The id of the Term Repo being delisted |

### emitDelistTermAuction

```solidity
function emitDelistTermAuction(bytes32 termAuctionId) external
```

#### Parameters

| Name          | Type    | Description                               |
| ------------- | ------- | ----------------------------------------- |
| termAuctionId | bytes32 | The id of the Term Auction being delisted |

### emitTermContractUpgraded

```solidity
function emitTermContractUpgraded(address proxy, address implementation) external
```

#### Parameters

| Name           | Type    | Description                                             |
| -------------- | ------- | ------------------------------------------------------- |
| proxy          | address | address of proxy contract                               |
| implementation | address | address of new impl contract proxy has been upgraded to |

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# TermInitializer.sol

This contract provides utility methods for initializing/pairing a set of term/auction contracts

## TermInitializer

This contract provides utility methods for initializing/pairing a set of term/auction contracts

*This contract operates at the protocol level and provides utility functions for deploying terms/auctions*

### DeployingPaused

```solidity
error DeployingPaused()
```

### DEPLOYER\_ROLE

```solidity
bytes32 DEPLOYER_ROLE
```

### INITIALIZER\_APPROVAL\_ROLE

```solidity
bytes32 INITIALIZER_APPROVAL_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### controller

```solidity
contract ITermController controller
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### priceOracle

```solidity
contract TermPriceConsumerV3 priceOracle
```

### deployingPaused

```solidity
bool deployingPaused
```

### whileDeployingNotPaused

```solidity
modifier whileDeployingNotPaused()
```

### constructor

```solidity
constructor(address initializerApprovalRole_, address devopsWallet_) public
```

### pairTermContracts

```solidity
function pairTermContracts(contract ITermController controller_, contract ITermEventEmitter emitter_, contract TermPriceConsumerV3 priceOracle_) external
```

### setupTerm

```solidity
function setupTerm(struct TermContractGroup termContractGroup, address devOpsMultiSig, address adminWallet, string termVersion, string auctionVersion) external
```

Sets up a set of deployed term contracts

### setupAuction

```solidity
function setupAuction(contract TermRepoServicer termRepoServicer, contract TermRepoCollateralManager termRepoCollateralManager, contract TermAuctionOfferLocker termAuctionOfferLocker, contract TermAuctionBidLocker termAuctionBidLocker, contract TermAuction auction, address devOpsMultiSig, address adminWallet, string auctionVersion) external
```

Sets up a set of deployed term contracts

### pauseDeploying

```solidity
function pauseDeploying() external
```

### unpauseDeploying

```solidity
function unpauseDeploying() external
```


# TermPriceConsumerV3.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract is a centralized price oracle contract that feeds pricing data to all Term Repos.

## TermPriceConsumerV3

This contract is a centralized price oracle contract that feeds pricing data to all Term Repos

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

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### priceFeeds

```solidity
mapping(address => contract AggregatorV3Interface) priceFeeds
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address devopsWallet_) external
```

Intializes with an array of token addresses, followed with an array of Chainlink aggregator addresses <https://docs.chain.link/docs/ethereum-addresses/>

### addNewTokenPriceFeed

```solidity
function addNewTokenPriceFeed(address token, address tokenPriceAggregator) external
```

#### Parameters

| Name                 | Type    | Description                                              |
| -------------------- | ------- | -------------------------------------------------------- |
| token                | address | The address of the token to add a price feed for         |
| tokenPriceAggregator | address | The proxy price aggregator address for token to be added |

### removeTokenPriceFeed

```solidity
function removeTokenPriceFeed(address token) external
```

#### Parameters

| Name  | Type    | Description                                                   |
| ----- | ------- | ------------------------------------------------------------- |
| token | address | The address of the token whose price feed needs to be removed |

### usdValueOfTokens

```solidity
function usdValueOfTokens(address token, uint256 amount) external view returns (struct ExponentialNoError.Exp)
```

A function to return current market value given a token address and an amount

#### Parameters

| Name   | Type    | Description                       |
| ------ | ------- | --------------------------------- |
| token  | address | The address of the token to query |
| amount | uint256 | The amount tokens to value        |

#### Return Values

| Name | Type                          | Description                                                        |
| ---- | ----------------------------- | ------------------------------------------------------------------ |
| \[0] | struct ExponentialNoError.Exp | The current market value of tokens at the specified amount, in USD |

### \_getLatestPrice

```solidity
function _getLatestPrice(address token) internal view returns (int256)
```

#### Return Values

| Name | Type   | Description                            |
| ---- | ------ | -------------------------------------- |
| \[0] | int256 | The latest price from price aggregator |

### \_getDecimals

```solidity
function _getDecimals(address token) internal view returns (uint8)
```

#### Return Values

| Name | Type  | Description                      |
| ---- | ----- | -------------------------------- |
| \[0] | uint8 | The decimal places in price feed |

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# Solidity API - 0.6.0

Detailed specifications for Term Finance Protocol v1 contracts can be found here. The groups are broken down by category as described [here](https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/term-finance-protocol/README.md).


# Term Repo Class

Each deployment of a Term Repo is comprised of a set of smart contracts broadly divided into three groups: (i) the Term Auction Group, (ii) the Term Servicer Group and (iii) the Term Repo Token.

{% content-ref url="/pages/y0pOxj2gkKZk5awNw1KR" %}
[Term Auction Group](/latest/term-repo-class/term-auction-group)
{% endcontent-ref %}

{% content-ref url="/pages/IdLJeQwCAcaFmxJOtxU5" %}
[Term Servicer Group](/0.6.0/term-repo-class/term-servicer-group)
{% endcontent-ref %}

{% content-ref url="/pages/lJBqH1Ft8sfQy9lGNdEt" %}
[TermRepoToken.sol](/0.5.32/term-repo-class/termrepotoken)
{% endcontent-ref %}


# Term Auction Group

The Term Auction group of contracts contain the logic to handle and process bid and offer submissions, determine an auction clearing price, and to settle and clear a Term Auction.

{% content-ref url="<https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/0.6.0/term-repo-class/term-auction-group/broken-reference/README.md>" %}
<https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/0.6.0/term-repo-class/term-auction-group/broken-reference/README.md>
{% endcontent-ref %}

{% content-ref url="/pages/qGfswmbb4f3eywJOuJWI" %}
[TermAuctionBidLocker.sol](/0.6.0/term-repo-class/term-auction-group/termauctionbidlocker)
{% endcontent-ref %}

{% content-ref url="/pages/tMwG2CPB9vuESXJ6euic" %}
[TermAuctionOfferLocker.sol](/0.6.0/term-repo-class/term-auction-group/termauctionofferlocker)
{% endcontent-ref %}


# TermAuction.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract calculates a clearing price in a blind double auction and manages auction clearing

## TermAuction

This contract calculates a clearing price in a blind double auction and manages auction clearing and settlement

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

### ClearingPriceState

```solidity
struct ClearingPriceState {
  uint256 offerPrice;
  uint256 offerIndex;
  uint256 bidIndex;
  uint256 cumSumOffers;
  uint256 cumSumBids;
  uint256 maxClearingVolume;
  uint256 nextOfferIndex;
  uint256 nextBidIndex;
  uint256 nextCumSumOffers;
  uint256 nextCumSumBids;
  uint256 nextOfferPrice;
  uint256 nextMaxClearingVolume;
  bool minCumSumCorrection;
  uint256 nextBidPrice;
  uint256 clearingPrice;
}
```

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 THREESIXTY_DAYCOUNT_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### dayCountFractionMantissa

```solidity
uint256 dayCountFractionMantissa
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termAuctionBidLocker

```solidity
contract ITermAuctionBidLocker termAuctionBidLocker
```

### termAuctionOfferLocker

```solidity
contract ITermAuctionOfferLocker termAuctionOfferLocker
```

### purchaseToken

```solidity
contract IERC20MetadataUpgradeable purchaseToken
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### clearingPrice

```solidity
uint256 clearingPrice
```

### clearingPricePostProcessingOffset

```solidity
uint256 clearingPricePostProcessingOffset
```

### auctionCompleted

```solidity
bool auctionCompleted
```

### auctionCancelledForWithdrawal

```solidity
bool auctionCancelledForWithdrawal
```

### completeAuctionPaused

```solidity
bool completeAuctionPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### onlyWhileAuctionClosed

```solidity
modifier onlyWhileAuctionClosed()
```

This only runs if the auction is closed (after auction end time)

*This uses the block timestamp to determine if the auction is closed*

### whenCompleteAuctionNotPaused

```solidity
modifier whenCompleteAuctionNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionEndTime_, uint256 termStart_, uint256 redemptionTimestamp_, contract IERC20MetadataUpgradeable purchaseToken_, address termAuctionInitializer_, uint256 clearingPricePostProcessingOffset_) external
```

Initializes the contract

*See: <https://docs.openzeppelin.com/contracts/4.x/upgradeable>*

### pairTermContracts

```solidity
function pairTermContracts(contract ITermEventEmitter emitter_, contract ITermRepoServicer termRepoServicer_, contract ITermAuctionBidLocker termAuctionBidLocker_, contract ITermAuctionOfferLocker termAuctionOfferLocker_, address devopsMultisigAddress_, address adminWallet_, string version_) external
```

### completeAuction

```solidity
function completeAuction(struct CompleteAuctionInput completeAuctionInput) external
```

Calculates an auction's clearing price, assigns bids/offers, and returns unassigned funds

#### Parameters

| Name                 | Type                        | Description                                                                               |
| -------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| completeAuctionInput | struct CompleteAuctionInput | A struct containing all revealed and unrevealed bids and offers and expired rollover bids |

### cancelAuction

```solidity
function cancelAuction(struct CompleteAuctionInput completeAuctionInput) public
```

Cancels an auction and returns all funds to bidders and fulfillBiders

#### Parameters

| Name                 | Type                        | Description                                                                               |
| -------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| completeAuctionInput | struct CompleteAuctionInput | A struct containing all revealed and unrevealed bids and offers and expired rollover bids |

### cancelAuctionForWithdrawal

```solidity
function cancelAuctionForWithdrawal(address[] rolloverBorrowers, address[] rolloverPairOffTermRepoServicer) public
```

Cancels an auction and sets auctionCancelledForWithdrawal to true to open unlocking tenders

### \_increaseCumSumBids

```solidity
function _increaseCumSumBids(struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex, uint256 previousCumSumBids, uint256 currentPrice) internal pure returns (uint256, uint256)
```

### \_decreaseCumSumBids

```solidity
function _decreaseCumSumBids(struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex, uint256 previousCumSumBids, uint256 currentPrice) internal pure returns (uint256, uint256)
```

### \_minUint256

```solidity
function _minUint256(uint256 a, uint256 b) internal pure returns (uint256)
```

Returns the min of two `uint256` values

#### Parameters

| Name | Type    | Description                 |
| ---- | ------- | --------------------------- |
| a    | uint256 | The first value to compare  |
| b    | uint256 | The second value to compare |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The min of the two values |

### \_calculateClearingPrice

```solidity
function _calculateClearingPrice(struct TermAuctionRevealedBid[] sortedBids, struct TermAuctionRevealedOffer[] sortedOffers, uint256 clearingOffset) internal pure returns (uint256, uint256)
```

Calculates the intersection between bid/offer schedules to arrive at a clearing price

*Imagine a graph with price along the X-axis and cumsum(bid/offerAmount\*price) along the Y-axis. This function finds the point where the supply line crosses the demand line using binary search*

#### Parameters

| Name           | Type                               | Description                                                                                         |
| -------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------- |
| sortedBids     | struct TermAuctionRevealedBid\[]   | A sorted array of bids used to arrive at a demand schedule                                          |
| sortedOffers   | struct TermAuctionRevealedOffer\[] | A sorted array of offers used to arrive at a supply schedule                                        |
| clearingOffset | uint256                            | The offset to apply to the marginal bid and offer indexes when calculating the final clearing price |

#### Return Values

| Name | Type    | Description                                                   |
| ---- | ------- | ------------------------------------------------------------- |
| \[0] | uint256 | clearingPrice The price at which Term Auction will be cleared |
| \[1] | uint256 |                                                               |

### \_findFirstIndexForPrice

```solidity
function _findFirstIndexForPrice(uint256 price, struct TermAuctionRevealedBid[] sortedBids, uint256 startIndex) internal pure returns (uint256 i, uint256 totalAmount)
```

Finds the index of the first bid with a bidPrice of `price` and calculate the cumsum of the bid amounts up to that index

#### Parameters

| Name       | Type                             | Description                       |
| ---------- | -------------------------------- | --------------------------------- |
| price      | uint256                          | The price to search for           |
| sortedBids | struct TermAuctionRevealedBid\[] | An array of sorted bids to search |
| startIndex | uint256                          | The index to start searching from |

#### Return Values

| Name        | Type    | Description                                           |
| ----------- | ------- | ----------------------------------------------------- |
| i           | uint256 | The index of the first bid with a bidPrice of `price` |
| totalAmount | uint256 | The cumsum of the bid amounts up to return index i    |

### \_findLastIndexForPrice

```solidity
function _findLastIndexForPrice(uint256 price, struct TermAuctionRevealedOffer[] sortedOffers, uint256 startIndex) internal pure returns (uint256 i, uint256 totalAmount)
```

Finds the index of the last offer with a offerPrice of `price` and calculate the cumsum of the offer amounts up to that index

#### Parameters

| Name         | Type                               | Description                       |
| ------------ | ---------------------------------- | --------------------------------- |
| price        | uint256                            | The price to search for           |
| sortedOffers | struct TermAuctionRevealedOffer\[] | An array of offers to search      |
| startIndex   | uint256                            | The index to start searching from |

#### Return Values

| Name        | Type    | Description                                              |
| ----------- | ------- | -------------------------------------------------------- |
| i           | uint256 | The index of the last offer with a offerPrice of `price` |
| totalAmount | uint256 | The cumsum of the offer amounts up to return index i     |

### \_fullyAssignBid

```solidity
function _fullyAssignBid(struct TermAuctionRevealedBid bid) internal returns (uint256)
```

Fully assigns a bid

#### Parameters

| Name | Type                          | Description       |
| ---- | ----------------------------- | ----------------- |
| bid  | struct TermAuctionRevealedBid | The bid to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_fullyAssignOffer

```solidity
function _fullyAssignOffer(struct TermAuctionRevealedOffer offer) internal returns (uint256)
```

Fully assigns an offer

#### Parameters

| Name  | Type                            | Description         |
| ----- | ------------------------------- | ------------------- |
| offer | struct TermAuctionRevealedOffer | The offer to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_partiallyAssignBid

```solidity
function _partiallyAssignBid(struct TermAuctionRevealedBid bid, uint256 assignedAmount) internal returns (uint256)
```

Partially assigns a bid

#### Parameters

| Name           | Type                          | Description          |
| -------------- | ----------------------------- | -------------------- |
| bid            | struct TermAuctionRevealedBid | The bid to assign    |
| assignedAmount | uint256                       | The amount to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_partiallyAssignOffer

```solidity
function _partiallyAssignOffer(struct TermAuctionRevealedOffer offer, uint256 assignedAmount) internal returns (uint256)
```

Partially assigns an offer

#### Parameters

| Name           | Type                            | Description          |
| -------------- | ------------------------------- | -------------------- |
| offer          | struct TermAuctionRevealedOffer | The offer to assign  |
| assignedAmount | uint256                         | The amount to assign |

#### Return Values

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| \[0] | uint256 | The amount that was assigned |

### \_assignRolloverBid

```solidity
function _assignRolloverBid(address borrower, uint256 purchasePrice, uint256 repurchasePrice, address rolloverPairOffTermRepoServicer) internal
```

### \_markRolloverAsProcessed

```solidity
function _markRolloverAsProcessed(address rolloverPairOffTermRepoServicer, address borrower) internal
```

### \_assignBids

```solidity
function _assignBids(struct TermAuctionRevealedBid[] sortedBids, uint256 maxAssignable, uint256 purchaseTokenDecimals) internal returns (uint256)
```

Assigns bids up to `maxAssignable`

*This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single bid*

#### Parameters

| Name                  | Type                             | Description                                                    |
| --------------------- | -------------------------------- | -------------------------------------------------------------- |
| sortedBids            | struct TermAuctionRevealedBid\[] | An array of sorted bids to process                             |
| maxAssignable         | uint256                          | The maximum bid amount that can be assigned across all bidders |
| purchaseTokenDecimals | uint256                          | The number of decimals of the purchase token                   |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The total amount assigned |

### \_assignOffers

```solidity
function _assignOffers(struct TermAuctionRevealedOffer[] sortedOffers, uint256 maxAssignable, uint256 purchaseTokenDecimals) internal returns (uint256)
```

Assigns offers up to `maxAssignable`

*This method allocates pro-rata across an the marginal price group (pro-rata on the margin) and attempts to prevent residuals from accumulating to a single offer*

#### Parameters

| Name                  | Type                               | Description                                                     |
| --------------------- | ---------------------------------- | --------------------------------------------------------------- |
| sortedOffers          | struct TermAuctionRevealedOffer\[] | An array of sorted offers to process                            |
| maxAssignable         | uint256                            | The maximum offer amount that can be assigned across all offers |
| purchaseTokenDecimals | uint256                            | The number of decimals of the purchase token                    |

#### Return Values

| Name | Type    | Description               |
| ---- | ------- | ------------------------- |
| \[0] | uint256 | The total amount assigned |

### \_calculateRepurchasePrice

```solidity
function _calculateRepurchasePrice(uint256 purchasePrice) internal view returns (uint256)
```

Calculates repurchase price given a purchase price (equivalent to principal plus interest)

#### Parameters

| Name          | Type    | Description        |
| ------------- | ------- | ------------------ |
| purchasePrice | uint256 | The purchase price |

#### Return Values

| Name | Type    | Description                                                                                       |
| ---- | ------- | ------------------------------------------------------------------------------------------------- |
| \[0] | uint256 | The repurchase price obtained by applying the clearing rate on an Actual/360 day-count convention |

### \_calculateAndStoreClearingPrice

```solidity
function _calculateAndStoreClearingPrice(struct TermAuctionRevealedBid[] sortedBids, struct TermAuctionRevealedOffer[] sortedOffers) internal returns (uint256, uint256)
```

### pauseCompleteAuction

```solidity
function pauseCompleteAuction() external
```

\_This function pauses the TermAuction contract preventing public state changes See {Pausable-*pause}.*

### unpauseCompleteAuction

```solidity
function unpauseCompleteAuction() external
```

Unpuses the TermAuction contract allowing public state changes

\_See {Pausable-*unpause}.*

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


# TermAuctionBidLocker.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract handles and proceesses Term Auction bid submissions

## TermAuctionBidLocker

This contract handles and proceesses Term Auction bid submissions

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

### MAX\_BID\_PRICE

```solidity
uint256 MAX_BID_PRICE
```

### MAX\_BID\_COUNT

```solidity
uint256 MAX_BID_COUNT
```

### THREESIXTY\_DAYCOUNT\_SECONDS

```solidity
uint256 THREESIXTY_DAYCOUNT_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTIONEER\_ROLE

```solidity
bytes32 AUCTIONEER_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionStartTime

```solidity
uint256 auctionStartTime
```

### revealTime

```solidity
uint256 revealTime
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### minimumTenderAmount

```solidity
uint256 minimumTenderAmount
```

### dayCountFractionMantissa

```solidity
uint256 dayCountFractionMantissa
```

### purchaseToken

```solidity
address purchaseToken
```

### collateralTokens

```solidity
mapping(contract IERC20Upgradeable => bool) collateralTokens
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termPriceOracle

```solidity
contract ITermPriceOracle termPriceOracle
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termAuction

```solidity
contract ITermAuction termAuction
```

### bids

```solidity
mapping(bytes32 => struct TermAuctionBid) bids
```

### bidCount

```solidity
uint256 bidCount
```

### termContractPaired

```solidity
bool termContractPaired
```

### lockingPaused

```solidity
bool lockingPaused
```

### unlockingPaused

```solidity
bool unlockingPaused
```

### onlyWhileAuctionOpen

```solidity
modifier onlyWhileAuctionOpen()
```

### onlyWhileAuctionRevealing

```solidity
modifier onlyWhileAuctionRevealing()
```

### onlyBidder

```solidity
modifier onlyBidder(address bidder, address authedUser)
```

### whenLockingNotPaused

```solidity
modifier whenLockingNotPaused()
```

### whenUnlockingNotPaused

```solidity
modifier whenUnlockingNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionStartTime_, uint256 revealTime_, uint256 auctionEndTime_, uint256 redemptionTimestamp_, uint256 minimumTenderAmount_, address purchaseToken_, contract IERC20Upgradeable[] collateralTokens_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termAuction_, contract ITermRepoServicer termRepoServicer_, contract ITermEventEmitter emitter_, contract ITermRepoCollateralManager termRepoCollateralManager_, contract ITermPriceOracle termPriceOracle_, address devopsMultisig_, address adminWallet_) external
```

### pairRolloverManager

```solidity
function pairRolloverManager(address rolloverManager) external
```

#### Parameters

| Name            | Type    | Description                                         |
| --------------- | ------- | --------------------------------------------------- |
| rolloverManager | address | The address of the TermRepoRolloverManager contract |

### lockBidsWithReferral

```solidity
function lockBidsWithReferral(struct TermAuctionBidSubmission[] bidSubmissions, address referralAddress) external returns (bytes32[])
```

#### Parameters

| Name            | Type                               | Description                                                                                                        |
| --------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| bidSubmissions  | struct TermAuctionBidSubmission\[] | An array of Term Auction bid submissions to borrow an amount of money at rate up to but not exceeding the bid rate |
| referralAddress | address                            | A user address that referred the submitter of this bid                                                             |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockRolloverBid

```solidity
function lockRolloverBid(struct TermAuctionBid bid) external
```

#### Parameters

| Name | Type                  | Description                            |
| ---- | --------------------- | -------------------------------------- |
| bid  | struct TermAuctionBid | A struct containing details of the bid |

### lockBids

```solidity
function lockBids(struct TermAuctionBidSubmission[] bidSubmissions) external returns (bytes32[])
```

#### Parameters

| Name           | Type                               | Description                 |
| -------------- | ---------------------------------- | --------------------------- |
| bidSubmissions | struct TermAuctionBidSubmission\[] | An array of bid submissions |

#### Return Values

| Name | Type       | Description                                 |
| ---- | ---------- | ------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain bid ids. |

### lockedBid

```solidity
function lockedBid(bytes32 id) external view returns (struct TermAuctionBid)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | bytes32 | A bid Id    |

#### Return Values

| Name | Type                  | Description                                   |
| ---- | --------------------- | --------------------------------------------- |
| \[0] | struct TermAuctionBid | A struct containing details of the locked bid |

### revealBids

```solidity
function revealBids(bytes32[] ids, uint256[] prices, uint256[] nonces) external
```

#### Parameters

| Name   | Type       | Description                                           |
| ------ | ---------- | ----------------------------------------------------- |
| ids    | bytes32\[] | An array of bid ids of the bids to reveal             |
| prices | uint256\[] | An array of the bid prices to reveal                  |
| nonces | uint256\[] | An array of nonce values to generate bid price hashes |

### unlockBids

```solidity
function unlockBids(bytes32[] ids) external
```

unlockBids unlocks multiple bids and returns funds to the bidder

#### Parameters

| Name | Type       | Description               |
| ---- | ---------- | ------------------------- |
| ids  | bytes32\[] | An array of ids to unlock |

### getAllBids

```solidity
function getAllBids(bytes32[] revealedBids, bytes32[] expiredRolloverBids, bytes32[] unrevealedBids) external returns (struct TermAuctionRevealedBid[], struct TermAuctionBid[])
```

#### Parameters

| Name                | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| revealedBids        | bytes32\[] | An array of the revealed offer ids       |
| expiredRolloverBids | bytes32\[] | An array of the expired rollover bid ids |
| unrevealedBids      | bytes32\[] | An array of the unrevealed offer ids     |

#### Return Values

| Name | Type                             | Description                                                                        |
| ---- | -------------------------------- | ---------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedBid\[] | An array of TermAuctionRevealedBid structs containing details of the revealed bids |
| \[1] | struct TermAuctionBid\[]         | An array of TermAuctionBid structs containing details of the unrevealed bids       |

### auctionUnlockBid

```solidity
function auctionUnlockBid(bytes32 id, address bidder, address[] bidCollateralTokens, uint256[] amounts) external
```

#### Parameters

| Name                | Type       | Description                                   |
| ------------------- | ---------- | --------------------------------------------- |
| id                  | bytes32    | A bytes32 bid id                              |
| bidder              | address    | The address of the bidder                     |
| bidCollateralTokens | address\[] | The addresses of the token used as collateral |
| amounts             | uint256\[] | The amounts of collateral tokens to unlock    |

### \_lock

```solidity
function _lock(struct TermAuctionBidSubmission bidSubmission, address authedUser) internal returns (struct TermAuctionBid)
```

### \_lockRolloverBid

```solidity
function _lockRolloverBid(struct TermAuctionBid bid) internal
```

### \_unlock

```solidity
function _unlock(bytes32 id, address bidder, address[] bidCollateralTokens, uint256[] amounts) internal
```

### \_revealBid

```solidity
function _revealBid(bytes32 id, uint256 price, uint256 nonce) internal
```

### \_getAllBids

```solidity
function _getAllBids(bytes32[] revealedBids, bytes32[] expiredRolloverBids, bytes32[] unrevealedBids) internal returns (struct TermAuctionRevealedBid[], struct TermAuctionBid[])
```

#### Parameters

| Name                | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| revealedBids        | bytes32\[] | An array of the revealed offer ids       |
| expiredRolloverBids | bytes32\[] | An array of the expired rollover bid ids |
| unrevealedBids      | bytes32\[] | An array of the unrevealed offer ids     |

#### Return Values

| Name | Type                             | Description                                                                        |
| ---- | -------------------------------- | ---------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedBid\[] | An array of TermAuctionRevealedBid structs containing details of the revealed bids |
| \[1] | struct TermAuctionBid\[]         | An array of TermAuctionBid structs containing details of the unrevealed bids       |

### \_truncateBidStruct

```solidity
function _truncateBidStruct(struct TermAuctionBid bid) internal pure returns (struct TermAuctionRevealedBid revealed)
```

*This does not check the hash of the revealed bid price*

#### Parameters

| Name | Type                  | Description                                             |
| ---- | --------------------- | ------------------------------------------------------- |
| bid  | struct TermAuctionBid | The TermAuctionBid to convert to TermAuctionRevealedBid |

### \_processRevealedBidsForValidity

```solidity
function _processRevealedBidsForValidity(bytes32[] revealedBids, uint256 unrevealedBidCount) internal returns (struct TermAuctionBid[], uint256, uint256, uint256)
```

### \_isRolloverStillValid

```solidity
function _isRolloverStillValid(struct TermAuctionBid revealedBid, contract ITermRepoServicer pairOffServicer) internal returns (bool)
```

### \_isInInitialCollateralShortFall

```solidity
function _isInInitialCollateralShortFall(uint256 bidAmount, address[] collateralTokens_, uint256[] collateralAmounts) internal view returns (bool)
```

### \_isInMaintenanceCollateralShortFall

```solidity
function _isInMaintenanceCollateralShortFall(uint256 bidAmount, uint256 bidPrice, address[] collateralTokens_, uint256[] collateralAmounts) internal view returns (bool)
```

### \_fillRevealedBidsForAuctionClearing

```solidity
function _fillRevealedBidsForAuctionClearing(bytes32[] revealedBids, uint256 auctionBidCount) internal returns (struct TermAuctionRevealedBid[])
```

### \_generateBidId

```solidity
function _generateBidId(bytes32 id, address user) internal view returns (bytes32)
```

### \_processBidForAuction

```solidity
function _processBidForAuction(bytes32 id) internal
```

### pauseLocking

```solidity
function pauseLocking() external
```

### unpauseLocking

```solidity
function unpauseLocking() external
```

### pauseUnlocking

```solidity
function pauseUnlocking() external
```

### unpauseUnlocking

```solidity
function unpauseUnlocking() 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 |


# TermAuctionOfferLocker.sol

This contract belongs to the Term Auction group of contracts and is specific to a Term Repo deployment. This contract handles and processes Term Auction offer submissions

## TermAuctionOfferLocker

This contract handles and proceesses Term Auction offer submissions

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

### MAX\_OFFER\_PRICE

```solidity
uint256 MAX_OFFER_PRICE
```

### MAX\_OFFER\_COUNT

```solidity
uint256 MAX_OFFER_COUNT
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTIONEER\_ROLE

```solidity
bytes32 AUCTIONEER_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termAuctionId

```solidity
bytes32 termAuctionId
```

### auctionStartTime

```solidity
uint256 auctionStartTime
```

### revealTime

```solidity
uint256 revealTime
```

### auctionEndTime

```solidity
uint256 auctionEndTime
```

### minimumTenderAmount

```solidity
uint256 minimumTenderAmount
```

### purchaseToken

```solidity
contract IERC20Upgradeable purchaseToken
```

### collateralTokens

```solidity
mapping(contract IERC20Upgradeable => bool) collateralTokens
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### termAuction

```solidity
contract ITermAuction termAuction
```

### offers

```solidity
mapping(bytes32 => struct TermAuctionOffer) offers
```

### offerCount

```solidity
uint256 offerCount
```

### termContractPaired

```solidity
bool termContractPaired
```

### lockingPaused

```solidity
bool lockingPaused
```

### unlockingPaused

```solidity
bool unlockingPaused
```

### onlyWhileAuctionOpen

```solidity
modifier onlyWhileAuctionOpen()
```

### onlyWhileAuctionRevealing

```solidity
modifier onlyWhileAuctionRevealing()
```

### onlyOfferor

```solidity
modifier onlyOfferor(address offeror, address authedUser)
```

### onlyExistingOffer

```solidity
modifier onlyExistingOffer(bytes32 id)
```

### whenLockingNotPaused

```solidity
modifier whenLockingNotPaused()
```

### whenUnlockingNotPaused

```solidity
modifier whenUnlockingNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, string auctionId_, uint256 auctionStartTime_, uint256 revealTime_, uint256 auctionEndTime_, uint256 minimumTenderAmount_, contract IERC20Upgradeable purchaseToken_, contract IERC20Upgradeable[] collateralTokens_, address termInitializer_) external
```

### pairTermContracts

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

### lockOffersWithReferral

```solidity
function lockOffersWithReferral(struct TermAuctionOfferSubmission[] offerSubmissions, address referralAddress) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                                                                                                |
| ---------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of Term Auction offer submissions to lend an amount of money at rate no lower than the offer rate |
| referralAddress  | address                              | A user address that referred the submitter of this offer                                                   |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockOffers

```solidity
function lockOffers(struct TermAuctionOfferSubmission[] offerSubmissions) external returns (bytes32[])
```

#### Parameters

| Name             | Type                                 | Description                   |
| ---------------- | ------------------------------------ | ----------------------------- |
| offerSubmissions | struct TermAuctionOfferSubmission\[] | An array of offer submissions |

#### Return Values

| Name | Type       | Description                                   |
| ---- | ---------- | --------------------------------------------- |
| \[0] | bytes32\[] | A bytes32 array of unique on chain offer ids. |

### lockedOffer

```solidity
function lockedOffer(bytes32 id) external view returns (struct TermAuctionOffer)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| id   | bytes32 | An offer Id |

#### Return Values

| Name | Type                    | Description                                         |
| ---- | ----------------------- | --------------------------------------------------- |
| \[0] | struct TermAuctionOffer | A struct containing the details of the locked offer |

### revealOffers

```solidity
function revealOffers(bytes32[] ids, uint256[] prices, uint256[] nonces) external
```

#### Parameters

| Name   | Type       | Description                                           |
| ------ | ---------- | ----------------------------------------------------- |
| ids    | bytes32\[] | An array offer ids to reveal                          |
| prices | uint256\[] | An array of the offer prices to reveal                |
| nonces | uint256\[] | An array of nonce values to generate bid price hashes |

### unlockOffers

```solidity
function unlockOffers(bytes32[] ids) external
```

unlockOffers unlocks multiple offers and returns funds to the offeror

#### Parameters

| Name | Type       | Description           |
| ---- | ---------- | --------------------- |
| ids  | bytes32\[] | An array of offer ids |

### getAllOffers

```solidity
function getAllOffers(bytes32[] revealedOffers, bytes32[] unrevealedOffers) external returns (struct TermAuctionRevealedOffer[], struct TermAuctionOffer[])
```

#### Parameters

| Name             | Type       | Description                          |
| ---------------- | ---------- | ------------------------------------ |
| revealedOffers   | bytes32\[] | An array of the revealed offer ids   |
| unrevealedOffers | bytes32\[] | An array of the unrevealed offer ids |

#### Return Values

| Name | Type                               | Description                                                                            |
| ---- | ---------------------------------- | -------------------------------------------------------------------------------------- |
| \[0] | struct TermAuctionRevealedOffer\[] | An array of TermAuctionRevealedOffer structs containing details of the revealed offers |
| \[1] | struct TermAuctionOffer\[]         | An array of TermAuctionOffer structs containing details of the unrevealed offers       |

### unlockOfferPartial

```solidity
function unlockOfferPartial(bytes32 id, address offeror, uint256 amount) public
```

#### Parameters

| Name    | Type    | Description                             |
| ------- | ------- | --------------------------------------- |
| id      | bytes32 | An offer Id                             |
| offeror | address | Address of the offeror                  |
| amount  | uint256 | The amount of purchase tokens to unlock |

### \_lock

```solidity
function _lock(struct TermAuctionOfferSubmission offerSubmission, address authedUser) internal returns (struct TermAuctionOffer)
```

### \_unlock

```solidity
function _unlock(bytes32 id, address offeror) internal
```

### \_revealOffer

```solidity
function _revealOffer(bytes32 id, uint256 price, uint256 nonce) internal
```

*Will revert if either the price does not match the offer price or is greater than the max offer price*

#### Parameters

| Name  | Type    | Description                                                  |
| ----- | ------- | ------------------------------------------------------------ |
| id    | bytes32 | An offer Id                                                  |
| price | uint256 | The price of the offer to reveal                             |
| nonce | uint256 | The user provided nonce value to generate the bid price hash |

### \_generateOfferId

```solidity
function _generateOfferId(bytes32 id, address user) internal view returns (bytes32)
```

### \_processOfferForAuction

```solidity
function _processOfferForAuction(bytes32 id) internal
```

### \_truncateOfferStruct

```solidity
function _truncateOfferStruct(struct TermAuctionOffer hidden, uint256 price) internal pure returns (struct TermAuctionRevealedOffer revealed)
```

*This does not check the hash of the revealed offer price*

#### Parameters

| Name   | Type                    | Description                                             |
| ------ | ----------------------- | ------------------------------------------------------- |
| hidden | struct TermAuctionOffer | TermAuctionOffer to convert to TermAuctionRevealedOffer |
| price  | uint256                 | The revealed price of the offer                         |

### pauseLocking

```solidity
function pauseLocking() external
```

### unpauseLocking

```solidity
function unpauseLocking() external
```

### pauseUnlocking

```solidity
function pauseUnlocking() external
```

### unpauseUnlocking

```solidity
function unpauseUnlocking() 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 |


# Term Servicer Group

The Term Servicer group of contracts maintain records, enforce the terms of a Term Repo arrangement and automate the settlement and collateral management functions.

{% content-ref url="/pages/yRBoWhTAFtMACZiSSIva" %}
[TermRepoServicer.sol](/0.5.31/term-repo-class/term-servicer-group/termreposervicer)
{% endcontent-ref %}

{% content-ref url="/pages/HDoULhPgZ8RHfNtOa03U" %}
[TermRepoLocker.sol](/0.6.0/term-repo-class/term-servicer-group/termrepolocker)
{% endcontent-ref %}

{% content-ref url="/pages/EaSr1h4QU2o56l5QQ36i" %}
[TermRepoCollateralManager.sol](/0.5.31/term-repo-class/term-servicer-group/termrepocollateralmanager)
{% endcontent-ref %}

{% content-ref url="/pages/IiGwZkUM1GZ2po3b2Rme" %}
[TermRepoRolloverManager.sol](/0.6.0/term-repo-class/term-servicer-group/termreporollovermanager)
{% endcontent-ref %}


# TermRepoServicer.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract maintains records, collects and disburse repurchase payments.

## TermRepoServicer

This contract maintains records, collects and disburse repurchase payments

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

### YEAR\_SECONDS

```solidity
uint256 YEAR_SECONDS
```

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTION\_LOCKER

```solidity
bytes32 AUCTION_LOCKER
```

### AUCTIONEER

```solidity
bytes32 AUCTIONEER
```

### COLLATERAL\_MANAGER

```solidity
bytes32 COLLATERAL_MANAGER
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### SPECIALIST\_ROLE

```solidity
bytes32 SPECIALIST_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### ROLLOVER\_TARGET\_AUCTIONEER\_ROLE

```solidity
bytes32 ROLLOVER_TARGET_AUCTIONEER_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### totalOutstandingRepurchaseExposure

```solidity
uint256 totalOutstandingRepurchaseExposure
```

### totalRepurchaseCollected

```solidity
uint256 totalRepurchaseCollected
```

### maturityTimestamp

```solidity
uint256 maturityTimestamp
```

### endOfRepurchaseWindow

```solidity
uint256 endOfRepurchaseWindow
```

### redemptionTimestamp

```solidity
uint256 redemptionTimestamp
```

block timestamp at which term repo tokens can be redeemed

### servicingFee

```solidity
uint256 servicingFee
```

percentage share of bid amounts charged to bidder

### shortfallHaircutMantissa

```solidity
uint256 shortfallHaircutMantissa
```

proportion of redemption value for redemption

### purchaseToken

```solidity
address purchaseToken
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoRolloverManager

```solidity
contract ITermRepoRolloverManager termRepoRolloverManager
```

### termRepoLocker

```solidity
contract ITermRepoLocker termRepoLocker
```

### termRepoToken

```solidity
contract ITermRepoToken termRepoToken
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### repurchaseExposureLedger

```solidity
mapping(address => uint256) repurchaseExposureLedger
```

### termContractPaired

```solidity
bool termContractPaired
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, uint256 maturityTimestamp_, uint256 repurchaseWindow_, uint256 redemptionBuffer_, uint256 servicingFee_, address purchaseToken_, contract ITermController termController_, contract ITermEventEmitter emitter_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoLocker_, address termRepoCollateralManager_, address termRepoToken_, address termAuctionOfferLocker_, address termAuction_, address rolloverManager_, address devopsMultisig_, address adminWallet_, string version_) external
```

### submitRepurchasePayment

```solidity
function submitRepurchasePayment(uint256 amount) external
```

The max repurchase amount is the repurchase balance less any amounts earmarked for rollover

#### Parameters

| Name   | Type    | Description                                           |
| ------ | ------- | ----------------------------------------------------- |
| amount | uint256 | The amount of purchase token to submit for repurchase |

### burnCollapseExposure

```solidity
function burnCollapseExposure(uint256 amountToBurn) external
```

#### Parameters

| Name         | Type    | Description                          |
| ------------ | ------- | ------------------------------------ |
| amountToBurn | uint256 | The amount of TermRepoTokens to burn |

### getBorrowerRepurchaseObligation

```solidity
function getBorrowerRepurchaseObligation(address borrower) external view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                          |
| -------- | ------- | ------------------------------------ |
| borrower | address | The address of the borrower to query |

#### Return Values

| Name | Type    | Description                                                     |
| ---- | ------- | --------------------------------------------------------------- |
| \[0] | uint256 | The total repurchase price due at maturity for a given borrower |

### mintOpenExposure

```solidity
function mintOpenExposure(uint256 amount, uint256[] collateralAmounts) external
```

*This method allows SPECIALIST\_ROLE to open repurchase price exposure against a TermRepoToken mint of corresponding value outside of a Term Auction to create new supply*

#### Parameters

| Name              | Type       | Description                                                                           |
| ----------------- | ---------- | ------------------------------------------------------------------------------------- |
| amount            | uint256    | The amount of Term Repo Tokens to mint                                                |
| collateralAmounts | uint256\[] | An array containing an amount of collateral token for each token in collateral basket |

### redeemTermRepoTokens

```solidity
function redeemTermRepoTokens(address redeemer, uint256 amountToRedeem) external
```

#### Parameters

| Name           | Type    | Description                            |
| -------------- | ------- | -------------------------------------- |
| redeemer       | address | The address of redeemer                |
| amountToRedeem | uint256 | The amount of TermRepoTokens to redeem |

### isTermRepoBalanced

```solidity
function isTermRepoBalanced() external view returns (bool)
```

#### Return Values

| Name | Type | Description                                                        |
| ---- | ---- | ------------------------------------------------------------------ |
| \[0] | bool | A boolean that represents whether the term repo locker is balanced |

### lockOfferAmount

```solidity
function lockOfferAmount(address offeror, uint256 amount) external
```

#### Parameters

| Name    | Type    | Description                           |
| ------- | ------- | ------------------------------------- |
| offeror | address | The address of the offeror            |
| amount  | uint256 | The amount of purchase tokens to lock |

### unlockOfferAmount

```solidity
function unlockOfferAmount(address offeror, uint256 amount) external
```

#### Parameters

| Name    | Type    | Description                               |
| ------- | ------- | ----------------------------------------- |
| offeror | address | The address of the offeror                |
| amount  | uint256 | The amount of purchase tokens to unlocked |

### fulfillOffer

```solidity
function fulfillOffer(address offeror, uint256 purchasePrice, uint256 repurchasePrice, bytes32 offerId) external
```

#### Parameters

| Name            | Type    | Description                                     |
| --------------- | ------- | ----------------------------------------------- |
| offeror         | address | The address of the offeror                      |
| purchasePrice   | uint256 | The offer amount to fulfill                     |
| repurchasePrice | uint256 | The repurchase price due to offeror at maturity |
| offerId         | bytes32 | Unique identifier for this offer                |

### fulfillBid

```solidity
function fulfillBid(address bidder, uint256 purchasePrice, uint256 repurchasePrice, address[] collateralTokens, uint256[] collateralAmounts, uint256 dayCountFractionMantissa) external
```

#### Parameters

| Name                     | Type       | Description                                                     |
| ------------------------ | ---------- | --------------------------------------------------------------- |
| bidder                   | address    | The address of the bidder                                       |
| purchasePrice            | uint256    | The bid amount to fulfill                                       |
| repurchasePrice          | uint256    | The repurchase price due at maturity                            |
| collateralTokens         | address\[] | Collateral token addresses                                      |
| collateralAmounts        | uint256\[] | Collateral token amounts                                        |
| dayCountFractionMantissa | uint256    | Actual/360 day count fraction parameter from Term Auction Group |

### approveRolloverAuction

```solidity
function approveRolloverAuction(address termAuction) external
```

#### Parameters

| Name        | Type    | Description                                                     |
| ----------- | ------- | --------------------------------------------------------------- |
| termAuction | address | The address of a TermAuction contract to receive autioneer role |

### openExposureOnRolloverNew

```solidity
function openExposureOnRolloverNew(address borrower, uint256 purchasePrice, uint256 repurchasePrice, address previousTermRepoLocker, uint256 dayCountFractionMantissa) external returns (uint256)
```

#### Parameters

| Name                     | Type    | Description                                                     |
| ------------------------ | ------- | --------------------------------------------------------------- |
| borrower                 | address | The address of the borrower rolling into new Term Repo          |
| purchasePrice            | uint256 | The purchase price received from new TermRepo                   |
| repurchasePrice          | uint256 | The new repurchase price due at maturity of new TermRepo        |
| previousTermRepoLocker   | address | The address of the old TermRepoLocker contract                  |
| dayCountFractionMantissa | uint256 | Actual/360 day count fraction parameter from Term Auction Group |

#### Return Values

| Name | Type    | Description                                                               |
| ---- | ------- | ------------------------------------------------------------------------- |
| \[0] | uint256 | The net purchase price received in after deducing protocol servicing fees |

### closeExposureOnRolloverExisting

```solidity
function closeExposureOnRolloverExisting(address borrower, uint256 rolloverSettlementAmount) external returns (uint256)
```

#### Parameters

| Name                     | Type    | Description                                                                                                           |
| ------------------------ | ------- | --------------------------------------------------------------------------------------------------------------------- |
| borrower                 | address | The address of the borrower                                                                                           |
| rolloverSettlementAmount | uint256 | The amount of net proceeds received from new TermRepo to pay down existing repurchase obligation due to old Term Repo |

#### Return Values

| Name | Type    | Description                                                                                                                        |
| ---- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| \[0] | uint256 | A uint256 representing the proportion of total repurchase due to old Term Repo from borrower settled by proceeds from new TermRepo |

### liquidatorCoverExposure

```solidity
function liquidatorCoverExposure(address borrower, address liquidator, uint256 amountToCover) external
```

#### Parameters

| Name          | Type    | Description                                               |
| ------------- | ------- | --------------------------------------------------------- |
| borrower      | address | The address of the borrower                               |
| liquidator    | address | The address of the liquidator                             |
| amountToCover | uint256 | The amount of repurchase exposure to cover in liquidation |

### liquidatorCoverExposureWithRepoToken

```solidity
function liquidatorCoverExposureWithRepoToken(address borrower, address liquidator, uint256 amountOfRepoToken) external returns (uint256)
```

#### Parameters

| Name              | Type    | Description                                            |
| ----------------- | ------- | ------------------------------------------------------ |
| borrower          | address | The address of the borrower                            |
| liquidator        | address | The address of the liquidator                          |
| amountOfRepoToken | uint256 | The amount of term tokens used to cover in liquidation |

#### Return Values

| Name | Type    | Description                                                 |
| ---- | ------- | ----------------------------------------------------------- |
| \[0] | uint256 | A uint256 representing purchase value of repo tokens burned |

### grantMintExposureAccess

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

#### Parameters

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

### reopenToNewAuction

```solidity
function reopenToNewAuction(struct TermAuctionGroup termAuctionGroup) external
```

#### Parameters

| Name             | Type                    | Description                                                                                               |
| ---------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
| termAuctionGroup | struct TermAuctionGroup | A struct containing contract addresses of a Term Auction deployment to pair for a reopening of a TermRepo |

### \_isTermRepoBalanced

```solidity
function _isTermRepoBalanced() internal view returns (bool)
```

Truncation is by 4 decimal places due to the assumption that number of participants < 10000

### \_getMaxRepaymentAroundRollover

```solidity
function _getMaxRepaymentAroundRollover(address borrower) internal view returns (uint256)
```

### \_repay

```solidity
function _repay(address _borrower, address repayer_, uint256 amount_) internal
```

### \_parRedemption

```solidity
function _parRedemption(address redeemer_, uint256 amount_) internal
```

### \_proRataRedemption

```solidity
function _proRataRedemption(address redeemer_, uint256 amount_) internal
```

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


# TermRepoLocker.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This is the contract in which Term Servicer locks collateral and purchase tokens.

## TermRepoLocker

This is the contract in which Term Servicer locks collateral and purchase tokens

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

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### SERVICER\_ROLE

```solidity
bytes32 SERVICER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### transfersPaused

```solidity
bool transfersPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### whileTransfersNotPaused

```solidity
modifier whileTransfersNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, address termInitializer_) external
```

### pairTermContracts

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

### transferTokenFromWallet

```solidity
function transferTokenFromWallet(address originWallet, address token, uint256 amount) external
```

Locks tokens from origin wallet Reverts if caller doesn't have SERVICER\_ROLE

#### Parameters

| Name         | Type    | Description                              |
| ------------ | ------- | ---------------------------------------- |
| originWallet | address | The wallet from which to transfer tokens |
| token        | address | The address of token being transferred   |
| amount       | uint256 | The amount of tokens to transfer         |

### transferTokenToWallet

```solidity
function transferTokenToWallet(address destinationWallet, address token, uint256 amount) external
```

Unlocks tokens to destination wallet

*Reverts if caller doesn't have SERVICER\_ROLE*

#### Parameters

| Name              | Type    | Description                         |
| ----------------- | ------- | ----------------------------------- |
| destinationWallet | address | The wallet to unlock tokens into    |
| token             | address | The address of token being unlocked |
| amount            | uint256 | The amount of tokens to unlock      |

### pauseTransfers

```solidity
function pauseTransfers() external
```

### unpauseTransfers

```solidity
function unpauseTransfers() 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 |


# TermRepoCollateralManager.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract enforces margin maintenance rules for adding/withdrawing, and liquidating tokens.

## TermRepoCollateralManager

This contract enforces margin maintenance rules for adding/withdrawing, repurchasing and liquidating collateral

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

### ADMIN\_ROLE

```solidity
bytes32 ADMIN_ROLE
```

### AUCTION\_LOCKER

```solidity
bytes32 AUCTION_LOCKER
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### SERVICER\_ROLE

```solidity
bytes32 SERVICER_ROLE
```

### ROLLOVER\_MANAGER

```solidity
bytes32 ROLLOVER_MANAGER
```

### ROLLOVER\_TARGET\_AUCTIONEER\_ROLE

```solidity
bytes32 ROLLOVER_TARGET_AUCTIONEER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### liquidationsPaused

```solidity
bool liquidationsPaused
```

### termContractPaired

```solidity
bool termContractPaired
```

### numOfAcceptedCollateralTokens

```solidity
uint8 numOfAcceptedCollateralTokens
```

### deMinimisMarginThreshold

```solidity
uint256 deMinimisMarginThreshold
```

### liquidateDamangesDueToProtocol

```solidity
uint256 liquidateDamangesDueToProtocol
```

### netExposureCapOnLiquidation

```solidity
uint256 netExposureCapOnLiquidation
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### purchaseToken

```solidity
address purchaseToken
```

### termPriceOracle

```solidity
contract ITermPriceOracle termPriceOracle
```

### termRepoLocker

```solidity
contract ITermRepoLocker termRepoLocker
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### collateralTokens

```solidity
address[] collateralTokens
```

### encumberedCollateralBalances

```solidity
mapping(address => uint256) encumberedCollateralBalances
```

### maintenanceCollateralRatios

```solidity
mapping(address => uint256) maintenanceCollateralRatios
```

### initialCollateralRatios

```solidity
mapping(address => uint256) initialCollateralRatios
```

### liquidatedDamages

```solidity
mapping(address => uint256) liquidatedDamages
```

### lockedCollateralLedger

```solidity
mapping(address => mapping(address => uint256)) lockedCollateralLedger
```

### isCollateralTokenAccepted

```solidity
modifier isCollateralTokenAccepted(address token)
```

### whileLiquidationsNotPaused

```solidity
modifier whileLiquidationsNotPaused()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, uint256 liquidateDamangesDueToProtocol_, uint256 netExposureCapOnLiquidation_, uint256 deMinimisMarginThreshold_, address purchaseToken_, struct Collateral[] collateralTokens_, contract ITermEventEmitter emitter_, address termInitializer_) external
```

### pairTermContracts

```solidity
function pairTermContracts(address termRepoLocker_, address termRepoServicer_, address termAuctionBidLocker_, address termAuction_, address termController_, address termPriceOracle_, address termRepoRolloverManager_, address devopsMultisig_, address adminWallet_) external
```

### externalLockCollateral

```solidity
function externalLockCollateral(address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                 |
| --------------- | ------- | ------------------------------------------- |
| collateralToken | address | The address of the collateral token to lock |
| amount          | uint256 | The amount of collateral token to lock      |

### externalUnlockCollateral

```solidity
function externalUnlockCollateral(address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                   |
| --------------- | ------- | --------------------------------------------- |
| collateralToken | address | The address of the collateral token to unlock |
| amount          | uint256 | The amount of collateral token to unlock      |

### batchLiquidation

```solidity
function batchLiquidation(address borrower, uint256[] closureAmounts) external
```

#### Parameters

| Name           | Type       | Description                                                                                                                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower       | address    | The address of the borrower                                                                                                                                            |
| closureAmounts | uint256\[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |

### batchLiquidationWithRepoToken

```solidity
function batchLiquidationWithRepoToken(address borrower, uint256[] closureRepoTokenAmounts) external
```

#### Parameters

| Name                    | Type       | Description                                                                                                                                                                                 |
| ----------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower                | address    | The address of the borrower                                                                                                                                                                 |
| closureRepoTokenAmounts | uint256\[] | An array specifying the amounts of Term Repo Tokens the liquidator proposes to cover borrower repo exposure in liquidation; an amount is required to be specified for each collateral token |

### batchDefault

```solidity
function batchDefault(address borrower, uint256[] closureAmounts) external
```

#### Parameters

| Name           | Type       | Description                                                                                                                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| borrower       | address    | The address of the borrower                                                                                                                                            |
| closureAmounts | uint256\[] | An array specifying the amounts of Term Repo exposure the liquidator proposes to cover in liquidation; an amount is required to be specified for each collateral token |

### calculateMintableExposure

```solidity
function calculateMintableExposure(address collateralToken, uint256 amountToLock) external view returns (struct ExponentialNoError.Exp)
```

#### Parameters

| Name            | Type    | Description                                   |
| --------------- | ------- | --------------------------------------------- |
| collateralToken | address | The collateral token address of tokens locked |
| amountToLock    | uint256 | The amount of collateral tokens to lock       |

### getCollateralBalances

```solidity
function getCollateralBalances(address borrower) external view returns (address[], uint256[])
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type       | Description                                                     |
| ---- | ---------- | --------------------------------------------------------------- |
| \[0] | address\[] | An array of collateral token addresses                          |
| \[1] | uint256\[] | An array collateral token balances locked on behalf of borrower |

### getCollateralBalance

```solidity
function getCollateralBalance(address borrower, address collateralToken) external view returns (uint256)
```

#### Parameters

| Name            | Type    | Description                           |
| --------------- | ------- | ------------------------------------- |
| borrower        | address | The address of the borrower           |
| collateralToken | address | The collateral token address to query |

#### Return Values

| Name | Type    | Description                                                        |
| ---- | ------- | ------------------------------------------------------------------ |
| \[0] | uint256 | uint256 The amount of collateralToken locked on behalf of borrower |

### encumberedCollateralRemaining

```solidity
function encumberedCollateralRemaining() external view returns (bool)
```

#### Return Values

| Name | Type | Description                                                                |
| ---- | ---- | -------------------------------------------------------------------------- |
| \[0] | bool | bool A boolean that tests whether any encumbered collateral remains locked |

### auctionLockCollateral

```solidity
function auctionLockCollateral(address bidder, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                       |
| --------------- | ------- | ------------------------------------------------- |
| bidder          | address | The bidder's address                              |
| collateralToken | address | The address of the token to be used as collateral |
| amount          | uint256 | The amount of the token to lock                   |

### auctionUnlockCollateral

```solidity
function auctionUnlockCollateral(address bidder, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                 |
| --------------- | ------- | ------------------------------------------- |
| bidder          | address | The bidder's address                        |
| collateralToken | address | The address of the token used as collateral |
| amount          | uint256 | The amount of collateral tokens to unlock   |

### acceptRolloverCollateral

```solidity
function acceptRolloverCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                             |
| --------------- | ------- | --------------------------------------- |
| borrower        | address | The address of the borrower             |
| collateralToken | address | The address of a collateral token       |
| amount          | uint256 | The amount of collateral tokens to lock |

### transferRolloverCollateral

```solidity
function transferRolloverCollateral(address borrower, uint256 rolloverProportion, address rolloverTermRepoLocker) external returns (address[], uint256[])
```

#### Parameters

| Name                   | Type    | Description                                                                                       |
| ---------------------- | ------- | ------------------------------------------------------------------------------------------------- |
| borrower               | address | The borrower's address                                                                            |
| rolloverProportion     | uint256 | The proportion of the collateral to be unlocked, equal to the proportion of the collateral repaid |
| rolloverTermRepoLocker | address | The address of the new TermRepoLocker contract to roll into                                       |

#### Return Values

| Name | Type       | Description                                                                                                    |
| ---- | ---------- | -------------------------------------------------------------------------------------------------------------- |
| \[0] | address\[] | An array representing a list of accepted collateral token addresses                                            |
| \[1] | uint256\[] | An array containing the amount of collateral tokens to pairoff and transfer to new TermRepoLocker to roll into |

### approveRolloverAuction

```solidity
function approveRolloverAuction(address rolloverAuction) external
```

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| rolloverAuction | address | The address of the rollover auction |

### unlockCollateralOnRepurchase

```solidity
function unlockCollateralOnRepurchase(address borrower) external
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

### journalBidCollateralToCollateralManager

```solidity
function journalBidCollateralToCollateralManager(address borrower, address[] collateralTokenAddresses, uint256[] collateralTokenAmounts) external
```

#### Parameters

| Name                     | Type       | Description                 |
| ------------------------ | ---------- | --------------------------- |
| borrower                 | address    | The address of the borrower |
| collateralTokenAddresses | address\[] | Collateral token addresses  |
| collateralTokenAmounts   | uint256\[] | Collateral token amounts    |

### mintOpenExposureLockCollateral

```solidity
function mintOpenExposureLockCollateral(address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| borrower        | address | The address of the borrower |
| collateralToken | address | Collateral token addresse   |
| amount          | uint256 | Collateral token amount     |

### reopenToNewAuction

```solidity
function reopenToNewAuction(struct TermAuctionGroup termAuctionGroup) external
```

#### Parameters

| Name             | Type                    | Description                   |
| ---------------- | ----------------------- | ----------------------------- |
| termAuctionGroup | struct TermAuctionGroup | A struct of auction contracts |

### pauseLiquidations

```solidity
function pauseLiquidations() external
```

### unpauseLiquidations

```solidity
function unpauseLiquidations() external
```

### isBorrowerInShortfall

```solidity
function isBorrowerInShortfall(address borrower) public view returns (bool)
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type | Description                                                                  |
| ---- | ---- | ---------------------------------------------------------------------------- |
| \[0] | bool | Boolean testing whether the given borrower is in shortfall or margin deficit |

### getCollateralMarketValue

```solidity
function getCollateralMarketValue(address borrower) public view returns (uint256)
```

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type    | Description                                                         |
| ---- | ------- | ------------------------------------------------------------------- |
| \[0] | uint256 | The market value of borrower's locked collateral denominated in USD |

### \_lockCollateral

```solidity
function _lockCollateral(address borrower, address collateralToken, uint256 amount) internal
```

### \_unlockCollateral

```solidity
function _unlockCollateral(address borrower, address collateralToken, uint256 amount, bool decrementEncumberedCollateral) internal
```

### \_partialUnlockCollateral

```solidity
function _partialUnlockCollateral(address borrower, uint256 unlockProportion, address destinationwallet) internal returns (uint256[])
```

### \_validateBatchLiquidationForFullLiquidation

```solidity
function _validateBatchLiquidationForFullLiquidation(address borrower, address liquidator, uint256[] closureTokenAmounts) internal returns (bool)
```

*A helper function to validate various conditions required to liquidate*

#### Return Values

| Name | Type | Description                                                           |
| ---- | ---- | --------------------------------------------------------------------- |
| \[0] | bool | A boolean for whether borrower position eligible for full liquidation |

### \_unencumberRemainingBorrowerCollateralOnZeroObligation

```solidity
function _unencumberRemainingBorrowerCollateralOnZeroObligation(address borrower) internal
```

### \_withinNetExposureCapOnLiquidation

```solidity
function _withinNetExposureCapOnLiquidation(address borrower) internal view returns (bool)
```

### \_collateralSeizureAmounts

```solidity
function _collateralSeizureAmounts(uint256 amountToCover_, address collateralToken) internal view returns (uint256, uint256)
```

*returns total amount of collateral seized in liquidation and the amount of that total going protocol*

### \_transferLiquidationCollateral

```solidity
function _transferLiquidationCollateral(address borrower, address liquidator, address collateralAddress, uint256 closureAmount, uint256 collateralSeizureAmount, uint256 collateralSeizureProtocolShare, bool isDefault) internal
```

*A helper function to transfer tokens and update relevant state variables and mappings*

### \_isAcceptedCollateralToken

```solidity
function _isAcceptedCollateralToken(address token_) internal view returns (bool)
```

### \_usdValueOfBalances

```solidity
function _usdValueOfBalances(mapping(address => uint256) _tokenBalances) internal view returns (uint256)
```

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


# TermRepoRolloverManager.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This contract accepts and carries out borrower Term Repo rollover instructions.

## TermRepoRolloverManager

This contract accepts and carries out borrower Term Repo rollover instructions

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

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### ROLLOVER\_BID\_FULFILLER\_ROLE

```solidity
bytes32 ROLLOVER_BID_FULFILLER_ROLE
```

### termRepoId

```solidity
bytes32 termRepoId
```

### termRepoCollateralManager

```solidity
contract ITermRepoCollateralManager termRepoCollateralManager
```

### termRepoServicer

```solidity
contract ITermRepoServicer termRepoServicer
```

### termController

```solidity
contract ITermController termController
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### approvedRolloverAuctionBidLockers

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

### rolloverElections

```solidity
mapping(address => struct TermRepoRolloverElection) rolloverElections
```

### termContractPaired

```solidity
bool termContractPaired
```

### whileNotMatured

```solidity
modifier whileNotMatured()
```

### notTermContractPaired

```solidity
modifier notTermContractPaired()
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(string termRepoId_, contract ITermRepoServicer termRepoServicer_, contract ITermRepoCollateralManager termRepoCollateralManager_, contract ITermController termController_, address termInitializer_) external
```

### pairTermContracts

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

### electRollover

```solidity
function electRollover(struct TermRepoRolloverElectionSubmission termRepoRolloverElectionSubmission) external
```

An external function that accepted Term Repo rollover instructions

#### Parameters

| Name                               | Type                                      | Description                                        |
| ---------------------------------- | ----------------------------------------- | -------------------------------------------------- |
| termRepoRolloverElectionSubmission | struct TermRepoRolloverElectionSubmission | A struct containing borrower rollover instructions |

### getRolloverInstructions

```solidity
function getRolloverInstructions(address borrower) external view returns (struct TermRepoRolloverElection)
```

A view function that returns borrower rollover instructions

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

#### Return Values

| Name | Type                            | Description                                        |
| ---- | ------------------------------- | -------------------------------------------------- |
| \[0] | struct TermRepoRolloverElection | A struct containing borrower rollover instructions |

### cancelRollover

```solidity
function cancelRollover() external
```

An external function to cancel previously submitted rollover instructions

### fulfillRollover

```solidity
function fulfillRollover(address borrower) external
```

An external function called by repo servicer to mark rollover as fulfilled

#### Parameters

| Name     | Type    | Description                 |
| -------- | ------- | --------------------------- |
| borrower | address | The address of the borrower |

### approveRolloverAuction

```solidity
function approveRolloverAuction(contract ITermAuctionBidLocker auctionBidLocker) external
```

#### Parameters

| Name             | Type                           | Description                                 |
| ---------------- | ------------------------------ | ------------------------------------------- |
| auctionBidLocker | contract ITermAuctionBidLocker | The ABI for ITermAuctionBidLocker interface |

### revokeRolloverApproval

```solidity
function revokeRolloverApproval(contract ITermAuctionBidLocker auctionBidLocker) external
```

#### Parameters

| Name             | Type                           | Description                                 |
| ---------------- | ------------------------------ | ------------------------------------------- |
| auctionBidLocker | contract ITermAuctionBidLocker | The ABI for ITermAuctionBidLocker interface |

### \_processRollover

```solidity
function _processRollover(address borrowerToRollover) internal
```

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


# TermRepoToken.sol

This contract belongs to the Term Servicer group of contracts and is specific to a Term Repo deployment. This is an ERC-20 contract to track claims to the aggregate repurchase obligations due on the r

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


# Protocol Class

Protocol contracts are evergreen contracts at the protocol level that govern and apply across all Term Repos.

{% content-ref url="/pages/W1nt5LtrG0M5GH9st8v5" %}
[TermController.sol](/0.6.0/protocol-class/termcontroller)
{% endcontent-ref %}

{% content-ref url="/pages/RhH3R1J9wwJycpGq5t0a" %}
[TermEventEmitter.sol](/0.5.31/protocol-class/termeventemitter)
{% endcontent-ref %}

{% content-ref url="/pages/ijxtjBdW9Y8my10KoKKd" %}
[TermInitializer.sol](/0.5.31/protocol-class/terminitializer)
{% endcontent-ref %}

{% content-ref url="/pages/lEqMpfSkRR61740k6iDY" %}
[TermPriceConsumerV3.sol](/0.6.0/protocol-class/termpriceconsumerv3)
{% endcontent-ref %}


# TermController.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract manages Term Finance protocol permissions and controls

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

### CONTROLLER\_ADMIN\_ROLE

```solidity
bytes32 CONTROLLER_ADMIN_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### treasuryWallet

```solidity
address treasuryWallet
```

### protocolReserveWallet

```solidity
address protocolReserveWallet
```

### termAddresses

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

### constructor

```solidity
constructor() public
```

### initialize

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

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

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

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

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# TermEventEmitter.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract is a centralized event emitter that records important events to the blockchain

## TermEventEmitter

This contract is a centralized event emitter that records important events to the blockchain

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

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### INITIALIZER\_ROLE

```solidity
bytes32 INITIALIZER_ROLE
```

### TERM\_CONTRACT

```solidity
bytes32 TERM_CONTRACT
```

### TERM\_DELISTER

```solidity
bytes32 TERM_DELISTER
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address devopsWallet_, address termDelister_, address termInitializer_) external
```

### pairTermContract

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

### emitTermAuctionInitialized

```solidity
function emitTermAuctionInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuction, uint256 auctionEndTime, string version) external
```

#### Parameters

| Name           | Type    | Description                                                  |
| -------------- | ------- | ------------------------------------------------------------ |
| termRepoId     | bytes32 | The id of the current Term Repo deployment being initialized |
| termAuctionId  | bytes32 | The id of the auction being initialized                      |
| termAuction    | address | The address of the auction contract being initialized        |
| auctionEndTime | uint256 | The end time of the auction being initialized                |
| version        | string  | The version tag of the smart contract deployed               |

### emitBidAssigned

```solidity
function emitBidAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount) external
```

#### Parameters

| Name          | Type    | Description                     |
| ------------- | ------- | ------------------------------- |
| termAuctionId | bytes32 | A Term Auction id               |
| id            | bytes32 | A bid id                        |
| amount        | uint256 | The amount assigned to this bid |

### emitOfferAssigned

```solidity
function emitOfferAssigned(bytes32 termAuctionId, bytes32 id, uint256 amount) external
```

#### Parameters

| Name          | Type    | Description                       |
| ------------- | ------- | --------------------------------- |
| termAuctionId | bytes32 | A Term Auction id                 |
| id            | bytes32 | An offer id                       |
| amount        | uint256 | The amount assigned to this offer |

### emitAuctionCompleted

```solidity
function emitAuctionCompleted(bytes32 termAuctionId, uint256 timestamp, uint256 blockNumber, uint256 totalAssignedBids, uint256 totalAssignedOffers, uint256 clearingPrice) external
```

#### Parameters

| Name                | Type    | Description                                  |
| ------------------- | ------- | -------------------------------------------- |
| termAuctionId       | bytes32 | The Term Auction id of auction completed     |
| timestamp           | uint256 | The timestamp of the current block           |
| blockNumber         | uint256 | The number of the current block              |
| totalAssignedBids   | uint256 | The number of assigned bids in the auction   |
| totalAssignedOffers | uint256 | The number of assigned offers in the auction |
| clearingPrice       | uint256 | The clearing price of the auction            |

### emitAuctionCancelled

```solidity
function emitAuctionCancelled(bytes32 termAuctionId, bool nonViableAuction, bool auctionCancelledforWithdrawal) external
```

#### Parameters

| Name                          | Type    | Description                                                     |
| ----------------------------- | ------- | --------------------------------------------------------------- |
| termAuctionId                 | bytes32 | The id of the auction cancelled                                 |
| nonViableAuction              | bool    | Auction not viable due to bid and offer prices not intersecting |
| auctionCancelledforWithdrawal | bool    | Auction has been cancelled for manual fund withdrawal           |

### emitCompleteAuctionPaused

```solidity
function emitCompleteAuctionPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                     |
| ------------- | ------- | ----------------------------------------------- |
| termAuctionId | bytes32 | The id of the auction paused                    |
| termRepoId    | bytes32 | The Term Repo id associated with auction paused |

### emitCompleteAuctionUnpaused

```solidity
function emitCompleteAuctionUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                       |
| ------------- | ------- | ------------------------------------------------- |
| termAuctionId | bytes32 | The id of the auction unpaused                    |
| termRepoId    | bytes32 | The Term Repo id associated with auction unpaused |

### emitTermAuctionBidLockerInitialized

```solidity
function emitTermAuctionBidLockerInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuctionBidLocker, uint256 auctionStartTime, uint256 revealTime, uint256 maxBidPrice, uint256 minimumTenderAmount, uint256 dayCountFractionMantissa) external
```

#### Parameters

| Name                     | Type    | Description                                                       |
| ------------------------ | ------- | ----------------------------------------------------------------- |
| termRepoId               | bytes32 | The Term Repo id associated with BidLocker initialized            |
| termAuctionId            | bytes32 | The Term Auction id associated with BidLocker initialized         |
| termAuctionBidLocker     | address | The address of the TermAuctionBidLocker contract being intialized |
| auctionStartTime         | uint256 | The time at which auction bids will be accepted for submission    |
| revealTime               | uint256 | The time at which sealed auction bids can be revealed             |
| maxBidPrice              | uint256 | The maximum bid price for the auction                             |
| minimumTenderAmount      | uint256 | The minimum tender amount for the auction                         |
| dayCountFractionMantissa | uint256 | The day count fraction remainder                                  |

### emitBidLocked

```solidity
function emitBidLocked(bytes32 termAuctionId, struct TermAuctionBid bid, address referralAddress) external
```

#### Parameters

| Name            | Type                  | Description                                        |
| --------------- | --------------------- | -------------------------------------------------- |
| termAuctionId   | bytes32               | A Term Auction id                                  |
| bid             | struct TermAuctionBid | A struct containing details of the locked bid      |
| referralAddress | address               | The address of the referrer. Zero Address if none. |

### emitBidRevealed

```solidity
function emitBidRevealed(bytes32 termAuctionId, bytes32 id, uint256 bidPrice) external
```

#### Parameters

| Name          | Type    | Description                   |
| ------------- | ------- | ----------------------------- |
| termAuctionId | bytes32 | A Term Auction id             |
| id            | bytes32 | The bid id                    |
| bidPrice      | uint256 | The revealed price of the bid |

### emitBidUnlocked

```solidity
function emitBidUnlocked(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | A bid id          |

### emitBidInShortfall

```solidity
function emitBidInShortfall(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | A bid id          |

### emitBidLockingPaused

```solidity
function emitBidLockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                        |
| ------------- | ------- | -------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid locking is paused |
| termRepoId    | bytes32 | The Term Repo id where bid locking is paused       |

### emitBidLockingUnpaused

```solidity
function emitBidLockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid locking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where bid locking is unpaused       |

### emitBidUnlockingPaused

```solidity
function emitBidUnlockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where bid unlocking is paused |
| termRepoId    | bytes32 | The Term Repo id where bid unlocking is paused       |

### emitBidUnlockingUnpaused

```solidity
function emitBidUnlockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where bid unlocking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where bid unlocking is unpaused       |

### emitTermAuctionOfferLockerInitialized

```solidity
function emitTermAuctionOfferLockerInitialized(bytes32 termRepoId, bytes32 termAuctionId, address termAuctionOfferLocker, uint256 auctionStartTime, uint256 revealTime, uint256 maxOfferPrice, uint256 minimumTenderAmount) external
```

#### Parameters

| Name                   | Type    | Description                                                         |
| ---------------------- | ------- | ------------------------------------------------------------------- |
| termRepoId             | bytes32 | The Term Repo id associated with OfferLocker initialized            |
| termAuctionId          | bytes32 | The Term Auction id associated with OfferLocker initialized         |
| termAuctionOfferLocker | address | The address of the TermAuctionOfferLocker contract being intialized |
| auctionStartTime       | uint256 | The time at which auction bids will be accepted for submission      |
| revealTime             | uint256 | The time at which sealed auction bids can be revealed               |
| maxOfferPrice          | uint256 | The maximum offer price for the auction                             |
| minimumTenderAmount    | uint256 | The minimum tender amount for the auction                           |

### emitOfferLocked

```solidity
function emitOfferLocked(bytes32 termAuctionId, bytes32 id, address offeror, bytes32 offerPrice, uint256 amount, address purchaseToken, address referralAddress) external
```

#### Parameters

| Name            | Type    | Description                                        |
| --------------- | ------- | -------------------------------------------------- |
| termAuctionId   | bytes32 | A Term Auction id                                  |
| id              | bytes32 | An offer id                                        |
| offeror         | address | The address of the offeror                         |
| offerPrice      | bytes32 | The offer price                                    |
| amount          | uint256 | The amount of purchase tokens offered              |
| purchaseToken   | address | The address of the purchase token being offered    |
| referralAddress | address | The address of the referrer. Zero Address if none. |

### emitOfferRevealed

```solidity
function emitOfferRevealed(bytes32 termAuctionId, bytes32 id, uint256 offerPrice) external
```

#### Parameters

| Name          | Type    | Description              |
| ------------- | ------- | ------------------------ |
| termAuctionId | bytes32 | A Term Auction id        |
| id            | bytes32 | An offer id              |
| offerPrice    | uint256 | The offer price revealed |

### emitOfferUnlocked

```solidity
function emitOfferUnlocked(bytes32 termAuctionId, bytes32 id) external
```

#### Parameters

| Name          | Type    | Description       |
| ------------- | ------- | ----------------- |
| termAuctionId | bytes32 | A Term Auction id |
| id            | bytes32 | An offer id       |

### emitOfferLockingPaused

```solidity
function emitOfferLockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                          |
| ------------- | ------- | ---------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where offer locking is paused |
| termRepoId    | bytes32 | The Term Repo id where offer locking is paused       |

### emitOfferLockingUnpaused

```solidity
function emitOfferLockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where offer locking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where offer locking is unpaused       |

### emitOfferUnlockingPaused

```solidity
function emitOfferUnlockingPaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                            |
| ------------- | ------- | ------------------------------------------------------ |
| termAuctionId | bytes32 | The id of Term Auction where offer unlocking is paused |
| termRepoId    | bytes32 | The Term Repo id where offer unlocking is paused       |

### emitOfferUnlockingUnpaused

```solidity
function emitOfferUnlockingUnpaused(bytes32 termAuctionId, bytes32 termRepoId) external
```

#### Parameters

| Name          | Type    | Description                                              |
| ------------- | ------- | -------------------------------------------------------- |
| termAuctionId | bytes32 | The id of Term Auction where offer unlocking is unpaused |
| termRepoId    | bytes32 | The Term Repo id where offer unlocking is unpaused       |

### emitTermRepoCollateralManagerInitialized

```solidity
function emitTermRepoCollateralManagerInitialized(bytes32 termRepoId, address termRepoCollateralManager, address[] collateralTokens, uint256[] initialCollateralRatios, uint256[] maintenanceCollateralRatios, uint256[] liquidatedDamagesSchedule) external
```

#### Parameters

| Name                        | Type       | Description                                                                     |
| --------------------------- | ---------- | ------------------------------------------------------------------------------- |
| termRepoId                  | bytes32    | The Term Repo id associated with collateral manger being initialized            |
| termRepoCollateralManager   | address    | The address of the TermRepoCollateralManager contract being intialized          |
| collateralTokens            | address\[] | An array containing a list of the addresses of all accepted collateral tokens   |
| initialCollateralRatios     | uint256\[] | An array containing the initial collateral ratios for each collateral token     |
| maintenanceCollateralRatios | uint256\[] | An array containing the maintenance collateral ratios for each collateral token |
| liquidatedDamagesSchedule   | uint256\[] | An array containing the liquidated damages applicable to each collateral token  |

### emitPairReopeningBidLocker

```solidity
function emitPairReopeningBidLocker(bytes32 termRepoId, address termRepoCollateralManager, address termAuctionBidLocker) external
```

#### Parameters

| Name                      | Type    | Description                                                            |
| ------------------------- | ------- | ---------------------------------------------------------------------- |
| termRepoId                | bytes32 | The Term Repo id for the Term Repo being reopened                      |
| termRepoCollateralManager | address | The TermRepoCollateralManager address for the Term Repo being reopened |
| termAuctionBidLocker      | address | The new TermAuctionBidLocker to be paired for reopening                |

### emitCollateralLocked

```solidity
function emitCollateralLocked(bytes32 termRepoId, address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                |
| --------------- | ------- | ------------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                             |
| borrower        | address | The address of the borrower                |
| collateralToken | address | The address of the collateral token locked |
| amount          | uint256 | The amount of collateral being locked      |

### emitCollateralUnlocked

```solidity
function emitCollateralUnlocked(bytes32 termRepoId, address borrower, address collateralToken, uint256 amount) external
```

#### Parameters

| Name            | Type    | Description                                |
| --------------- | ------- | ------------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                             |
| borrower        | address | The address of the borrower                |
| collateralToken | address | The address of the collateral token locked |
| amount          | uint256 | The amount of collateral being unlocked    |

### emitLiquidation

```solidity
function emitLiquidation(bytes32 termRepoId, address borrower, address liquidator, uint256 closureAmount, address collateralToken, uint256 amountLiquidated, uint256 protocolSeizureAmount, bool defaultLiquidation) external
```

#### Parameters

| Name                  | Type    | Description                                     |
| --------------------- | ------- | ----------------------------------------------- |
| termRepoId            | bytes32 | A Term Repo id                                  |
| borrower              | address | The address of the borrower                     |
| liquidator            | address | The address of the liquidator                   |
| closureAmount         | uint256 | The amount of repurchase exposure covered       |
| collateralToken       | address | The address of the collateral tokens liquidated |
| amountLiquidated      | uint256 | The amount of collateral tokens liquidated      |
| protocolSeizureAmount | uint256 |                                                 |
| defaultLiquidation    | bool    |                                                 |

### emitLiquidationPaused

```solidity
function emitLiquidationPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                       |
| ---------- | ------- | ------------------------------------------------- |
| termRepoId | bytes32 | The id of Term Repo where liquidations are paused |

### emitLiquidationUnpaused

```solidity
function emitLiquidationUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                       |
| ---------- | ------- | ------------------------------------------------- |
| termRepoId | bytes32 | The id of Term Repo where liquidation is unpaused |

### emitTermRepoServicerInitialized

```solidity
function emitTermRepoServicerInitialized(bytes32 termRepoId, address termRepoServicer, address purchaseToken, uint256 maturityTimestamp, uint256 endOfRepurchaseWindow, uint256 redemptionTimestamp, uint256 servicingFee, string version) external
```

#### Parameters

| Name                  | Type    | Description                                                         |
| --------------------- | ------- | ------------------------------------------------------------------- |
| termRepoId            | bytes32 | The Term Repo id associated with TermRepoServicer being initialized |
| termRepoServicer      | address | The address of the TermRepoServicer contract being initialized      |
| purchaseToken         | address | The address of the purchase token                                   |
| maturityTimestamp     | uint256 | The time at which repurchase is due                                 |
| endOfRepurchaseWindow | uint256 | The time at which the repurchase window ends                        |
| redemptionTimestamp   | uint256 | The time when redemption of Term Repo Tokens begins                 |
| servicingFee          | uint256 | percentage share of bid amounts charged to bidder                   |
| version               | string  | The version tag of the smart contract deployed                      |

### emitReopeningOfferLockerPaired

```solidity
function emitReopeningOfferLockerPaired(bytes32 termRepoId, address termRepoServicer, address termAuctionOfferLocker, address termAuction) external
```

#### Parameters

| Name                   | Type    | Description                                                                   |
| ---------------------- | ------- | ----------------------------------------------------------------------------- |
| termRepoId             | bytes32 | The Term Repo id for the Term Repo being reopened                             |
| termRepoServicer       | address | The address of the TermRepoServicer contract for the Term Repo being reopened |
| termAuctionOfferLocker | address | The TermAuctionOfferLocker to be paired for reopening                         |
| termAuction            | address | The address of the TermAuction contract to be paired for reopening            |

### emitOfferLockedByServicer

```solidity
function emitOfferLockedByServicer(bytes32 termRepoId, address offeror, uint256 amount) external
```

This event is not to be confused with OfferLocked by TermOfferLocker Both this event and OfferLocked will be triggered, this one specifically refers to corresponding action taken by Term Servicer

#### Parameters

| Name       | Type    | Description                   |
| ---------- | ------- | ----------------------------- |
| termRepoId | bytes32 | A Term Repo id                |
| offeror    | address | The address of the offeror    |
| amount     | uint256 | The offer amount to be locked |

### emitOfferUnlockedByServicer

```solidity
function emitOfferUnlockedByServicer(bytes32 termRepoId, address offeror, uint256 amount) external
```

This event is not to be confused with OfferUnlocked by TermOfferLocker Both this event and OfferLocked will be triggered, this one specifically refers to corresponding action taken by Term Servicer

#### Parameters

| Name       | Type    | Description                     |
| ---------- | ------- | ------------------------------- |
| termRepoId | bytes32 | A Term Repo id                  |
| offeror    | address | The address of the offeror      |
| amount     | uint256 | The offer amount to be unlocked |

### emitOfferFulfilled

```solidity
function emitOfferFulfilled(bytes32 offerId, address offeror, uint256 purchasePrice, uint256 repurchasePrice, uint256 repoTokensMinted) external
```

#### Parameters

| Name             | Type    | Description                                      |
| ---------------- | ------- | ------------------------------------------------ |
| offerId          | bytes32 | A unique offer id                                |
| offeror          | address | The address of the offeror                       |
| purchasePrice    | uint256 | The offer amount fulfilled                       |
| repurchasePrice  | uint256 | The repurchase price due to offeror at maturity  |
| repoTokensMinted | uint256 | The amount of Term Repo Tokens minted to offeror |

### emitTermRepoTokensRedeemed

```solidity
function emitTermRepoTokensRedeemed(bytes32 termRepoId, address redeemer, uint256 redemptionAmount, uint256 redemptionHaircut) external
```

#### Parameters

| Name              | Type    | Description                                                                    |
| ----------------- | ------- | ------------------------------------------------------------------------------ |
| termRepoId        | bytes32 | A Term Repo id                                                                 |
| redeemer          | address | The address of the redeemer                                                    |
| redemptionAmount  | uint256 | The amount of TermRepoTokens redeemed                                          |
| redemptionHaircut | uint256 | The haircut applied to redemptions (if any) due to unrecoverable repo exposure |

### emitBidFulfilled

```solidity
function emitBidFulfilled(bytes32 termRepoId, address bidder, uint256 purchasePrice, uint256 repurchasePrice, uint256 servicingFees) external
```

#### Parameters

| Name            | Type    | Description                          |
| --------------- | ------- | ------------------------------------ |
| termRepoId      | bytes32 | A Term Repo id                       |
| bidder          | address | The address of the bidder            |
| purchasePrice   | uint256 | The bid amount fulfilled in auction  |
| repurchasePrice | uint256 | The repurchase price due at maturity |
| servicingFees   | uint256 | The fees earned by the protocol      |

### emitExposureOpenedOnRolloverNew

```solidity
function emitExposureOpenedOnRolloverNew(bytes32 termRepoId, address borrower, uint256 purchasePrice, uint256 repurchasePrice, uint256 servicingFees) external
```

#### Parameters

| Name            | Type    | Description                                              |
| --------------- | ------- | -------------------------------------------------------- |
| termRepoId      | bytes32 | A Term Repo id                                           |
| borrower        | address | The address of the borrower                              |
| purchasePrice   | uint256 | The purchase price received from new TermRepo            |
| repurchasePrice | uint256 | The new repurchase price due at maturity of new TermRepo |
| servicingFees   | uint256 | The fees earned by the protocol                          |

### emitExposureClosedOnRolloverExisting

```solidity
function emitExposureClosedOnRolloverExisting(bytes32 termRepoId, address borrower, uint256 amountRolled) external
```

#### Parameters

| Name         | Type    | Description                                             |
| ------------ | ------- | ------------------------------------------------------- |
| termRepoId   | bytes32 | A Term Repo id                                          |
| borrower     | address | The address of the borrower                             |
| amountRolled | uint256 | The repurchase exposure balance closed on old Term Repo |

### emitRepurchasePaymentSubmitted

```solidity
function emitRepurchasePaymentSubmitted(bytes32 termRepoId, address borrower, uint256 amount) external
```

#### Parameters

| Name       | Type    | Description                         |
| ---------- | ------- | ----------------------------------- |
| termRepoId | bytes32 | A Term Repo id                      |
| borrower   | address | The address of the borrower         |
| amount     | uint256 | The amount submitted for repurchase |

### emitMintExposureAccessGranted

```solidity
function emitMintExposureAccessGranted(bytes32 termRepoId, address authedUser) external
```

#### Parameters

| Name       | Type    | Description                       |
| ---------- | ------- | --------------------------------- |
| termRepoId | bytes32 | A Term Repo id                    |
| authedUser | address | User granted mint exposure access |

### emitMintExposure

```solidity
function emitMintExposure(bytes32 termRepoId, address minter, uint256 netTokensReceived, uint256 servicingFeeTokens, uint256 repurchasePrice) external
```

#### Parameters

| Name               | Type    | Description                                                             |
| ------------------ | ------- | ----------------------------------------------------------------------- |
| termRepoId         | bytes32 | A Term Repo id                                                          |
| minter             | address | The address of the minter                                               |
| netTokensReceived  | uint256 | The amount of Term Repo Tokens received by minter net of servicing fees |
| servicingFeeTokens | uint256 | The number of Term Repo Tokens retained by protocol in servicing fees   |
| repurchasePrice    | uint256 | The repurchase exposure opened by minter against Term Repo Token mint   |

### emitBurnCollapseExposure

```solidity
function emitBurnCollapseExposure(bytes32 termRepoId, address borrower, uint256 closeAmount) external
```

#### Parameters

| Name        | Type    | Description                                |
| ----------- | ------- | ------------------------------------------ |
| termRepoId  | bytes32 | A Term Repo id                             |
| borrower    | address | The address of the borrower                |
| closeAmount | uint256 | The amount of repurchase exposure to close |

### emitTermRepoRolloverManagerInitialized

```solidity
function emitTermRepoRolloverManagerInitialized(bytes32 termRepoId, address rolloverManager) external
```

#### Parameters

| Name            | Type    | Description                                                                |
| --------------- | ------- | -------------------------------------------------------------------------- |
| termRepoId      | bytes32 | The Term Repo id associated with TermRepoRolloverManager being initialized |
| rolloverManager | address | The address of the TermRepoRolloverManager contract being initialized      |

### emitRolloverTermApproved

```solidity
function emitRolloverTermApproved(bytes32 termRepoId, bytes32 rolloverTermAuctionId) external
```

#### Parameters

| Name                  | Type    | Description                                                  |
| --------------------- | ------- | ------------------------------------------------------------ |
| termRepoId            | bytes32 | The Term Repo id of existing Term Repo                       |
| rolloverTermAuctionId | bytes32 | The Term Auction Id that rollover bid will be submitted into |

### emitRolloverTermApprovalRevoked

```solidity
function emitRolloverTermApprovalRevoked(bytes32 termRepoId, bytes32 rolloverTermAuctionId) external
```

#### Parameters

| Name                  | Type    | Description                                            |
| --------------------- | ------- | ------------------------------------------------------ |
| termRepoId            | bytes32 | The Term Repo id of existing Term Repo                 |
| rolloverTermAuctionId | bytes32 | The Term Auction Id whose rollover approval is revoked |

### emitRolloverElection

```solidity
function emitRolloverElection(bytes32 termRepoId, bytes32 rolloverTermRepoId, address borrower, address rolloverAuction, uint256 rolloverAmount, bytes32 hashedBidPrice) external
```

#### Parameters

| Name               | Type    | Description                                     |
| ------------------ | ------- | ----------------------------------------------- |
| termRepoId         | bytes32 | The Term Repo id of existing Term Repo          |
| rolloverTermRepoId | bytes32 | The Term Repo Id of Rollover Term Repo          |
| borrower           | address | The address of the borrower                     |
| rolloverAuction    | address | The address of the auction being rolled over to |
| rolloverAmount     | uint256 | The repurchase amount being rolled over         |
| hashedBidPrice     | bytes32 | The hash of the rollover bid price              |

### emitRolloverCancellation

```solidity
function emitRolloverCancellation(bytes32 termRepoId, address borrower) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The Term Repo id of existing Term Repo |
| borrower   | address | The address of the borrower            |

### emitRolloverProcessed

```solidity
function emitRolloverProcessed(bytes32 termRepoId, address borrower) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The Term Repo id of existing Term Repo |
| borrower   | address | The address of the borrower            |

### emitTermRepoLockerInitialized

```solidity
function emitTermRepoLockerInitialized(bytes32 termRepoId, address termRepoLocker) external
```

#### Parameters

| Name           | Type    | Description                                                                |
| -------------- | ------- | -------------------------------------------------------------------------- |
| termRepoId     | bytes32 | The Term Repo id associated with TermRepoLocker contract being initialized |
| termRepoLocker | address | The address of the TermRepoLocker contract being initialized               |

### emitTermRepoLockerTransfersPaused

```solidity
function emitTermRepoLockerTransfersPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| termRepoId | bytes32 | A Term Repo id |

### emitTermRepoLockerTransfersUnpaused

```solidity
function emitTermRepoLockerTransfersUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description    |
| ---------- | ------- | -------------- |
| termRepoId | bytes32 | A Term Repo id |

### emitTermRepoTokenInitialized

```solidity
function emitTermRepoTokenInitialized(bytes32 termRepoId, address termRepoToken, uint256 redemptionRatio) external
```

#### Parameters

| Name            | Type    | Description                                                                 |
| --------------- | ------- | --------------------------------------------------------------------------- |
| termRepoId      | bytes32 | The Term Repo id associated with the TermRepoToken being initalized         |
| termRepoToken   | address | The address of the TermRepoToken contract being initialized                 |
| redemptionRatio | uint256 | The number of purchase tokens redeemable per unit of Term Repo Token at par |

### emitTermRepoTokenMintingPaused

```solidity
function emitTermRepoTokenMintingPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                |
| ---------- | ------- | -------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where minting is paused |

### emitTermRepoTokenMintingUnpaused

```solidity
function emitTermRepoTokenMintingUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where minting is unpaused |

### emitTermRepoTokenBurningPaused

```solidity
function emitTermRepoTokenBurningPaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                |
| ---------- | ------- | -------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where burning is paused |

### emitTermRepoTokenBurningUnpaused

```solidity
function emitTermRepoTokenBurningUnpaused(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                                                                  |
| ---------- | ------- | ---------------------------------------------------------------------------- |
| termRepoId | bytes32 | The Term Repo id associated with the TermRepoToken where burning is unpaused |

### emitDelistTermRepo

```solidity
function emitDelistTermRepo(bytes32 termRepoId) external
```

#### Parameters

| Name       | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| termRepoId | bytes32 | The id of the Term Repo being delisted |

### emitDelistTermAuction

```solidity
function emitDelistTermAuction(bytes32 termAuctionId) external
```

#### Parameters

| Name          | Type    | Description                               |
| ------------- | ------- | ----------------------------------------- |
| termAuctionId | bytes32 | The id of the Term Auction being delisted |

### emitTermContractUpgraded

```solidity
function emitTermContractUpgraded(address proxy, address implementation) external
```

#### Parameters

| Name           | Type    | Description                                             |
| -------------- | ------- | ------------------------------------------------------- |
| proxy          | address | address of proxy contract                               |
| implementation | address | address of new impl contract proxy has been upgraded to |

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# TermInitializer.sol

This contract provides utility methods for initializing/pairing a set of term/auction contracts

## TermInitializer

This contract provides utility methods for initializing/pairing a set of term/auction contracts

*This contract operates at the protocol level and provides utility functions for deploying terms/auctions*

### DeployingPaused

```solidity
error DeployingPaused()
```

### DEPLOYER\_ROLE

```solidity
bytes32 DEPLOYER_ROLE
```

### INITIALIZER\_APPROVAL\_ROLE

```solidity
bytes32 INITIALIZER_APPROVAL_ROLE
```

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### controller

```solidity
contract ITermController controller
```

### emitter

```solidity
contract ITermEventEmitter emitter
```

### priceOracle

```solidity
contract TermPriceConsumerV3 priceOracle
```

### deployingPaused

```solidity
bool deployingPaused
```

### whileDeployingNotPaused

```solidity
modifier whileDeployingNotPaused()
```

### constructor

```solidity
constructor(address initializerApprovalRole_, address devopsWallet_) public
```

### pairTermContracts

```solidity
function pairTermContracts(contract ITermController controller_, contract ITermEventEmitter emitter_, contract TermPriceConsumerV3 priceOracle_) external
```

### setupTerm

```solidity
function setupTerm(struct TermContractGroup termContractGroup, address devOpsMultiSig, address adminWallet, string termVersion, string auctionVersion) external
```

Sets up a set of deployed term contracts

### setupAuction

```solidity
function setupAuction(contract TermRepoServicer termRepoServicer, contract TermRepoCollateralManager termRepoCollateralManager, contract TermAuctionOfferLocker termAuctionOfferLocker, contract TermAuctionBidLocker termAuctionBidLocker, contract TermAuction auction, address devOpsMultiSig, address adminWallet, string auctionVersion) external
```

Sets up a set of deployed term contracts

### pauseDeploying

```solidity
function pauseDeploying() external
```

### unpauseDeploying

```solidity
function unpauseDeploying() external
```


# TermPriceConsumerV3.sol

This contract operates at the protocol level and governs all instances of a Term Repo. This contract is a centralized price oracle contract that feeds pricing data to all Term Repos.

## TermPriceConsumerV3

This contract is a centralized price oracle contract that feeds pricing data to all Term Repos

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

### DEVOPS\_ROLE

```solidity
bytes32 DEVOPS_ROLE
```

### priceFeeds

```solidity
mapping(address => contract AggregatorV3Interface) priceFeeds
```

### constructor

```solidity
constructor() public
```

### initialize

```solidity
function initialize(address devopsWallet_) external
```

Intializes with an array of token addresses, followed with an array of Chainlink aggregator addresses <https://docs.chain.link/docs/ethereum-addresses/>

### addNewTokenPriceFeed

```solidity
function addNewTokenPriceFeed(address token, address tokenPriceAggregator) external
```

#### Parameters

| Name                 | Type    | Description                                              |
| -------------------- | ------- | -------------------------------------------------------- |
| token                | address | The address of the token to add a price feed for         |
| tokenPriceAggregator | address | The proxy price aggregator address for token to be added |

### removeTokenPriceFeed

```solidity
function removeTokenPriceFeed(address token) external
```

#### Parameters

| Name  | Type    | Description                                                   |
| ----- | ------- | ------------------------------------------------------------- |
| token | address | The address of the token whose price feed needs to be removed |

### usdValueOfTokens

```solidity
function usdValueOfTokens(address token, uint256 amount) external view returns (struct ExponentialNoError.Exp)
```

A function to return current market value given a token address and an amount

#### Parameters

| Name   | Type    | Description                       |
| ------ | ------- | --------------------------------- |
| token  | address | The address of the token to query |
| amount | uint256 | The amount tokens to value        |

#### Return Values

| Name | Type                          | Description                                                        |
| ---- | ----------------------------- | ------------------------------------------------------------------ |
| \[0] | struct ExponentialNoError.Exp | The current market value of tokens at the specified amount, in USD |

### \_getLatestPrice

```solidity
function _getLatestPrice(address token) internal view returns (int256)
```

#### Return Values

| Name | Type   | Description                            |
| ---- | ------ | -------------------------------------- |
| \[0] | int256 | The latest price from price aggregator |

### \_getDecimals

```solidity
function _getDecimals(address token) internal view returns (uint8)
```

#### Return Values

| Name | Type  | Description                      |
| ---- | ----- | -------------------------------- |
| \[0] | uint8 | The decimal places in price feed |

### \_authorizeUpgrade

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

*required override by the OpenZeppelin UUPS module*


# Solidity API - 0.9.0

Detailed specifications for Term Finance Protocol v1 contracts can be found here. The groups are broken down by category as described [here](https://github.com/term-finance/term-finance-developer-docs/tree/main/solidity-api/term-finance-protocol/README.md).


# Term Repo Class

Each deployment of a Term Repo is comprised of a set of smart contracts broadly divided into three groups: (i) the Term Auction Group, (ii) the Term Servicer Group and (iii) the Term Repo Token.

{% content-ref url="/pages/EW3Eu8h0seWrVisLVLHw" %}
[Term Auction Group](/0.9.0/term-repo-class/term-auction-group)
{% endcontent-ref %}

{% content-ref url="/pages/QMcmLUHyBLq2sT3JD26t" %}
[Term Servicer Group](/0.9.0/term-repo-class/term-servicer-group)
{% endcontent-ref %}

{% content-ref url="/pages/K9L4J6LozOL2b6ICk5b7" %}
[TermRepoToken.sol](/0.9.0/term-repo-class/termrepotoken)
{% endcontent-ref %}




---

[Next Page](/llms-full.txt/1)

