# Open Source Smart Contract

### Github links

[**https://github.com/Blend-Blend/blend-contract**](https://github.com/Blend-Blend/blend-contract)

### Core Contracts <a href="#core-contracts" id="core-contracts"></a>

Core protocol contracts fall in following 4 categories:

* Configuration
* Pool logic
* Tokenization
* Misc

#### Configuration <a href="#configuration" id="configuration"></a>

<mark style="color:blue;">**ACLManager**</mark>

Blend Protocol implements an access control list to segregate powers and/or benefits that can be allocated to different entities on the protocol. The roles and holders are managed in the <mark style="color:blue;">`ACLManager.sol`</mark>, which keeps track of the individual roles and its holders.

<mark style="color:blue;">**PoolAddressesProvider**</mark>

The main addresses register of the protocol, containing address of *core protocol contracts* and *ACL admin*. It acts as factory of proxies and admin of those. The owner of this contract has the right to set/update implementation of the upgradable contracts. The latest contract addresses should be retrieved from this contract by making the appropriate calls.

<mark style="color:blue;">**PoolAddressesProviderRegistry**</mark>

Contains a list of active `PoolAddressProvider` addresses, for different markets. It is used for indexing all Blend protocol’s markets.

<mark style="color:blue;">**PriceOracleSentinel**</mark>

Oracle Sentinel validates if operations are allowed depending on the PriceOracle health. Once the *PriceOracle* gets up after an outage/downtime, users can make their positions healthy during a grace period.

#### Pool Logic <a href="#pool-logic" id="pool-logic"></a>

**DefaultReserveInterestRateStrategy**

Implements the calculation of the interest rates depending on the reserve state. This contract holds the information needed to calculate and update the yield relating to specific liquidity pools.

Each contract stores the optimised base curves using the corresponding parameters of each asset. This means that there is a mathematical function which determines the yield of each liquidity pool, with the yield changing based on the amount of borrowed funds and the total liquidity (i.e. utilisation) of the pool.

<mark style="color:blue;">**Pool**</mark>

The main entry point into the Blend Protocol. Most user interactions with the Blend Protocol occur via the Pool contract. Pool is owned by the PoolAddressesProvider of the specific market. All admin functions are callable by the PoolConfigurator contract, which is defined in PoolAddressesProvider.

<mark style="color:blue;">**PoolConfigurator**</mark>

Provider configuration methods for the Pool contract. The write methods of this contract can only be called by addresses with corresponding permission-ed system roles that are managed by ACLManager.

#### Tokenization <a href="#tokenization" id="tokenization"></a>

<mark style="color:blue;">**bToken**</mark>

Yield-generating tokens that are minted and burnt upon supply and withdraw of assets to Blend Pool

<mark style="color:blue;">**DelegationAwareBToken**</mark>

The special type of bToken that are minted and burnt upon supply and withdraw of assets that has voting power associated (which can be delegated) with them.

<mark style="color:blue;">**StableDebtToken**</mark>

The non-transferable interest accruing, stable rate tokenised borrows.

<mark style="color:blue;">**VariableDebtToken**</mark>

The non-transferable interest accruing, variable rate tokenised borrows.

#### Misc <a href="#misc" id="misc"></a>

<mark style="color:blue;">**BlendOracle**</mark>

Contract to get asset prices, manage price sources and update the fallback oracle.

<mark style="color:blue;">**BlendProtocolDataProvider**</mark>

Peripheral contract to collect and pre-process information from the Pool.

### Peripheral Contracts <a href="#peripheral-contracts" id="peripheral-contracts"></a>

#### Rewards <a href="#rewards" id="rewards"></a>

<mark style="color:blue;">**RewardsController**</mark>

This contract is responsible for configuring the different rewards and the claim process.

**Transfer Strategies**

These are isolated contracts that manages the procedure of the rewards transfer at claim. This allows the RewardsController to support any custom rewards like Staked $Blend, common ERC20 or even NFT.

#### Misc <a href="#misc-1" id="misc-1"></a>

<mark style="color:blue;">**UiIncentiveDataProviderV3**</mark>

Helper contract to fetch Incentives Data. It is used by Blend UI for reward balance info.

<mark style="color:blue;">**UiPoolDataProviderV3**</mark>

Helper contract, used by Blend UI, to fetch Pool Data such reserves list, all reserves data like liquidity, token addresses, rate strategy etc.

<mark style="color:blue;">**WalletBalanceProvider**</mark>

Used for getting multiple tokens balance for one user address. This contract is used by Blend backend to reduce the number of blockchain calls for fetching user balance.
