# Smart Contracts

Tydro is built on a modular set of smart contracts, all available on [<mark style="color:blue;">GitHub</mark>](https://github.com/aave-dao/aave-v3-origin).\
Developers can integrate contract addresses directly into Solidity or JavaScript projects using the [<mark style="color:blue;">Tydro Address Book</mark>.](https://docs.tydro.com/resources/addresses)

The repository is organized into the following categories:

* Pool
* Configuration
* Logic
* Tokenization
* Helpers
* Misc

### Pool

#### Pool

The [Pool](https://docs.tydro.com/developers/smart-contracts/pool) is the central entry point to Tydro. All core user interactions such as supplying, borrowing, and repaying flow through this contract. Ownership of the Pool is tracked by the PoolAddressesProvider, and admin-level actions (like changing parameters) are routed through the PoolConfigurator.

#### L2Pool

The [L2Pool](https://docs.tydro.com/developers/smart-contracts/l2-pool) is an optimized version of the Pool contract, designed specifically for rollups.\
It enables gas-efficient interactions by accepting compact, byte-encoded calldata. This reduces transaction costs while maintaining the same functionality as the Pool.

#### PoolConfigurator

The [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) manages risk parameters and configuration for the Pool. Only addresses with the appropriate permissions, assigned through the ACLManager, can call its write functions.

### Configuration

ACLManager

The [ACLManager](https://docs.tydro.com/developers/smart-contracts/aclmanager) is the registry of protocol roles and permissions. It defines and enforces access control across the system.

#### PoolAddressesProvider

The [PoolAddressesProvider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) is a registry of various components of the protocol, including the ACLManager and Pool contracts. It has the ability to  update pointers and proxy implementations to support upgrades.

### Logic

[Libraries](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/libraries/logic/) that implement the underlying mechanics of protocol operations. These libraries ensure that Pool interactions execute reliably and securely.

### Tokenization

#### aToken

Supplying assets mints [aTokens](https://docs.tydro.com/developers/smart-contracts/tokenization) which represent the depositor’s balance and automatically accrue yield. aTokens are burned when assets are withdrawn from the Pool

#### VariableDebtToken

Borrowing at a variable rate issues [VariableDebtTokens](https://docs.tydro.com/developers/smart-contracts/tokenization). These non-transferable tokens track a borrower’s position and increase automatically as interest accrues.

### Helpers

#### L2Encoder

The [L2Encoder](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) is a helper contract to encode calldata that is passed to the L2Pool. It is used to optimize calldata size in L2Pool for transaction cost reduction. It is only intended to help generate calldata for users/frontends.

#### TydroProtocolDataProvider

The [TydroProtocolDataProvider](https://docs.tydro.com/developers/view-contracts#view-contracts) and formats data from the Pool, making it easier for applications to access key protocol information.

### Misc

#### TydroOracle

The [TydroOracle](https://docs.tydro.com/developers/oracles#aaveoracle) manages reserve oracles and provides reference prices for assets. It ensures accurate pricing and updates sources as needed.

#### DefaultReserveInterestRateStrategy

The [DefaultReserveInterestRateStrategy](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy) calculates borrowing costs and yields based on the state of each reserve. It defines the parameters and logic used to update interest rates dynamically.

#### PriceOracleSentinel

The [PriceOracleSentinel](https://docs.tydro.com/developers/smart-contracts/oracles) safeguards the protocol during oracle disruptions. If a price feed becomes unavailable, it restricts operations until recovery and provides users with a grace period to restore healthy positions.
