> For the complete documentation index, see [llms.txt](https://betafinance.gitbook.io/betafinance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://betafinance.gitbook.io/betafinance/protocol-overview.md).

# Protocol Overview

The Beta Finance repository can be found [on Github here](https://github.com/beta-finance/beta).

## Main Contracts

The main contracts of Beta Finance and their purposes are listed below. To see the functions in each of the contracts, you may look at the verified contracts on Etherscan or view them in the Github repo.

### [BetaBank](https://github.com/beta-finance/beta/blob/master/contracts/BetaBank.sol)

This is the main contract of Beta Finance. Most interactions with the Beta Finance protocol will go through this contract. [Liquidators](https://github.com/beta-finance/beta/blob/master/contracts/BetaBank.sol#L367-L399) will call this contract to liquidate positions.&#x20;

### [BToken](https://github.com/beta-finance/beta/blob/master/contracts/BToken.sol)

This contract is responsible for the interest bearing token deposits on the protocol. The contract implements most of the ERC20 token methods in addition to a few others.

### [BetaRunnerUniswapV2](https://github.com/beta-finance/beta/blob/master/contracts/BetaRunnerUniswapV2.sol)

This contract is responsible for interfacing with DEXs (Sushiswap and Uniswap) for short selling on Beta Finance.

## Supporting Contracts

The supporting contracts of Beta Finance and their purposes are listed below. To see the functions in each of the contracts, you may look at the verified contracts on Etherscan or view them in the Github repo.

### [BTokenDeployer](https://github.com/beta-finance/beta/blob/master/contracts/BTokenDeployer.sol)

This contract is responsible for deploying new BToken contracts for a given token.

### [BetaConfig](https://github.com/beta-finance/beta/blob/master/contracts/BetaConfig.sol)

This contract is responsible for setting the risk configurations, risk levels, and collateral factors for assets on Beta Finance.

### [BetaOracleUniswapV2](https://github.com/beta-finance/beta/blob/master/contracts/BetaOracleUniswapV2.sol)

This contract is responsible for obtaining the price of tokens through an external oracle or Uniswap V2 TWAP. Currently, the protocol only uses the external oracle, which is the Alpha Oracle Aggregator with data from Band Protocol and Chainlink.

### [BetaInterestModelV1](https://github.com/beta-finance/beta/blob/master/contracts/BetaInterestModelV1.sol)

This contract is responsible for the interest rate model that is used to determine the interest rate for tokens being lended and borrowed. The model determines the next interest rate based off of the utilization of the lending pool.

### [BetaRunnerLending](https://github.com/beta-finance/beta/blob/master/contracts/BetaRunnerLending.sol) and [BetaRunnerBase](https://github.com/beta-finance/beta/blob/master/contracts/BetaRunnerBase.sol)

These two contracts support the main BetaRunner contract for short selling positions by interacting with the BetaBank contract.

### [WETHGateway](https://github.com/beta-finance/beta/blob/master/contracts/WETHGateway.sol)

This contract is responsible for wrapping and unwrapping WETH for the bWETH contract.&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://betafinance.gitbook.io/betafinance/protocol-overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
