> For the complete documentation index, see [llms.txt](https://docs.fathom.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fathom.fi/lending/interfaces/l2pool.md).

# L2Pool

The `L2Pool` contract is a calldata-optimized extension of the Pool contract in the Fathom lending protocol. It allows users to interact with the protocol using a compact calldata representation, reducing transaction costs on rollups. Users can supply, withdraw, borrow, repay, and perform other standard lending operations with optimized calldata.

### Storage Variables

* `POOL_REVISION`: Version of the pool contract.
* `ADDRESSES_PROVIDER`: Reference to the PoolAddressesProvider contract.

### Functions

#### **Initialization:**

* `initialize`: Initializes the pool with the PoolAddressesProvider.

#### **Set Functions:**

* `setReserveInterestRateStrategyAddress`: Sets the interest rate strategy address for a reserve.
* `setConfiguration`: Sets the configuration for a reserve.
* `updateBridgeProtocolFee`: Updates the bridge protocol fee.
* `updateFlashloanPremiums`: Updates the flash loan premiums.
* `configureEModeCategory`: Configures an e-mode category.
* `setUserEMode`: Sets the user's e-mode category.
* `resetIsolationModeTotalDebt`: Resets the isolation mode total debt for a reserve.
* `rescueTokens`: Rescues tokens sent to the contract.

#### **Get Functions:**

* `getReserveData`: Returns the reserve data for an asset.
* `getUserAccountData`: Returns the user's account data.
* `getConfiguration`: Returns the configuration of a reserve.
* `getUserConfiguration`: Returns the user's configuration.
* `getReserveNormalizedIncome`: Returns the normalized income for a reserve.
* `getReserveNormalizedVariableDebt`: Returns the normalized variable debt for a reserve.
* `getReservesList`: Returns the list of reserves.
* `getReserveAddressById`: Returns the address of a reserve by its ID.
* `MAX_STABLE_RATE_BORROW_SIZE_PERCENT`: Returns the maximum stable rate borrow size percentage.
* `BRIDGE_PROTOCOL_FEE`: Returns the bridge protocol fee.
* `FLASHLOAN_PREMIUM_TOTAL`: Returns the total flash loan premium.
* `FLASHLOAN_PREMIUM_TO_PROTOCOL`: Returns the protocol's share of the flash loan premium.
* `MAX_NUMBER_RESERVES`: Returns the maximum number of reserves.
* `getEModeCategoryData`: Returns the data of an e-mode category.
* `getUserEMode`: Returns the e-mode category of a user.

#### **Supply Functions:**

* `supply`: Supplies assets to the pool.
* `supplyWithPermit`: Supplies assets to the pool with a permit.

#### **Withdraw Functions:**

* `withdraw`: Withdraws assets from the pool.

#### **Borrow Functions:**

* `borrow`: Borrows assets from the pool.
* `repay`: Repays borrowed assets.
* `repayWithPermit`: Repays borrowed assets with a permit.
* `repayWithFmTokens`: Repays borrowed assets using FM tokens.
* `swapBorrowRateMode`: Swaps the borrow rate mode.
* `rebalanceStableBorrowRate`: Rebalances the stable borrow rate.
* `setUserUseReserveAsCollateral`: Sets a user's reserve as collateral.
* `liquidationCall`: Executes a liquidation call.

#### **Flash Loan Functions:**

* `flashLoan`: Executes a flash loan.
* `flashLoanSimple`: Executes a simple flash loan.

#### **Finalization Functions:**

* `finalizeTransfer`: Finalizes a transfer of assets.

#### **Reserve Management Functions:**

* `initReserve`: Initializes a reserve.
* `dropReserve`: Drops a reserve.

#### **Emergency Functions:**

* `rescueTokens`: Rescues tokens from the contract

### Events

#### **Pool Events** (Inherited from `Pool` contract):

* **Supply**: Emitted when assets are supplied to the pool.
* **Withdraw**: Emitted when assets are withdrawn from the pool.
* **Borrow**: Emitted when assets are borrowed from the pool.
* **Repay**: Emitted when borrowed assets are repaid.
* **FlashLoan**: Emitted when a flash loan is executed.
* **SwapBorrowRateMode**: Emitted when the borrow rate mode is swapped.
* **RebalanceStableBorrowRate**: Emitted when the stable borrow rate is rebalanced.
* **SetUserUseReserveAsCollateral**: Emitted when a user sets a reserve as collateral.
* **LiquidationCall**: Emitted when a liquidation call is executed.
* **ReserveDataUpdated**: Emitted when reserve data is updated.
* **MintUnbacked**: Emitted when unbacked assets are minted.
* **BackUnbacked**: Emitted when unbacked assets are backed.
* **MintToTreasury**: Emitted when assets are minted to the treasury.
* **InitializeReserve**: Emitted when a reserve is initialized.
* **DropReserve**: Emitted when a reserve is dropped.
* **SetReserveInterestRateStrategyAddress**: Emitted when the interest rate strategy address for a reserve is set.
* **SetConfiguration**: Emitted when the configuration of a reserve is set.
* **UpdateBridgeProtocolFee**: Emitted when the bridge protocol fee is updated.
* **UpdateFlashloanPremiums**: Emitted when flash loan premiums are updated.
* **ConfigureEModeCategory**: Emitted when an e-mode category is configured.
* **SetUserEMode**: Emitted when a user's e-mode category is set.
* **ResetIsolationModeTotalDebt**: Emitted when the isolation mode total debt is reset.
* **RescueTokens**: Emitted when tokens are rescued.

#### **L2Pool Specific Events**:

* There are no additional events defined specifically in the `L2Pool` contract. It leverages the compact calldata representation to optimize the inherited functionalities from the `Pool` contract without adding new events.
