# Table of Contents - [Overview | Tydro Documentation](#overview-tydro-documentation) - [Concepts | Tydro Documentation](#concepts-tydro-documentation) - [Supply | Tydro Documentation](#supply-tydro-documentation) - [Lending Protocol | Tydro Documentation](#lending-protocol-tydro-documentation) - [Smart Contracts | Tydro Documentation](#smart-contracts-tydro-documentation) - [L2 Pool | Tydro Documentation](#l2-pool-tydro-documentation) - [Borrow | Tydro Documentation](#borrow-tydro-documentation) - [Repay | Tydro Documentation](#repay-tydro-documentation) - [Withdraw | Tydro Documentation](#withdraw-tydro-documentation) - [Liquidations | Tydro Documentation](#liquidations-tydro-documentation) - [Liquidity Pool | Tydro Documentation](#liquidity-pool-tydro-documentation) - [Reserve | Tydro Documentation](#reserve-tydro-documentation) - [Incentives | Tydro Documentation](#incentives-tydro-documentation) - [Flash Loans | Tydro Documentation](#flash-loans-tydro-documentation) - [Wrapped Token Gateway | Tydro Documentation](#wrapped-token-gateway-tydro-documentation) - [Oracle | Tydro Documentation](#oracle-tydro-documentation) - [Glossary | Tydro Documentation](#glossary-tydro-documentation) - [Interest Rate Strategy | Tydro Documentation](#interest-rate-strategy-tydro-documentation) - [ACLManager | Tydro Documentation](#aclmanager-tydro-documentation) - [Oracles | Tydro Documentation](#oracles-tydro-documentation) - [Credit Delegation | Tydro Documentation](#credit-delegation-tydro-documentation) - [Pool Addresses Provider | Tydro Documentation](#pool-addresses-provider-tydro-documentation) - [Risks | Tydro Documentation](#risks-tydro-documentation) - [Addresses | Tydro Documentation](#addresses-tydro-documentation) - [Incentives | Tydro Documentation](#incentives-tydro-documentation) - [Testing & Debugging | Tydro Documentation](#testing-debugging-tydro-documentation) - [Code Licensing | Tydro Documentation](#code-licensing-tydro-documentation) - [Risk Parameters | Tydro Documentation](#risk-parameters-tydro-documentation) - [Web3 | Tydro Documentation](#web3-tydro-documentation) - [Bridge to INK | Tydro Documentation](#bridge-to-ink-tydro-documentation) - [Tokenization | Tydro Documentation](#tokenization-tydro-documentation) - [Pool Configurator | Tydro Documentation](#pool-configurator-tydro-documentation) - [View Contracts | Tydro Documentation](#view-contracts-tydro-documentation) - [Pool | Tydro Documentation](#pool-tydro-documentation) - [Overview | Tydro Documentation](#overview-tydro-documentation) - [Liquidity Pool | Tydro Documentation](#liquidity-pool-tydro-documentation) - [Smart Contracts | Tydro Documentation](#smart-contracts-tydro-documentation) --- # Overview | Tydro Documentation [hashtag](https://docs.tydro.com/#tydro-documentation) Tydro Documentation ------------------------------------------------------------------------------- Tydro is a non-custodial lending protocol for onchain capital markets. Powered by Aave and built on Ink, it enables trustless borrowing, flexible collateral, and seamless coordination across the Ink ecosystem and beyond. Suppliers earn interest by providing liquidity to supported markets. Borrowers access capital by providing collateral that exceeds the borrowed amount. [Concepts](https://docs.tydro.com/introduction/concepts) [Liquidity Protocol](https://docs.tydro.com/primitives/liquidity-pool) [Reserve](https://docs.tydro.com/primitives/reserve) [Oracle](https://docs.tydro.com/primitives/oracle) [Flash Loans](https://docs.tydro.com/primitives/flash-loans) [Smart Contracts](https://docs.tydro.com/developers/smart-contracts) [Resources](https://docs.tydro.com/resources/risks) [FAQsarrow-up-right](https://tydro-page.webflow.io/faq) ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FlmqeIPg1imb4ONREn9yj%252F58-3.png%3Falt%3Dmedia%26token%3Dedd458fa-62cc-4e21-8936-39fd72b3b897&width=768&dpr=3&quality=100&sign=1de7faa&sv=2) [NextConceptschevron-right](https://docs.tydro.com/introduction/concepts) Last updated 3 months ago --- # Concepts | Tydro Documentation ### [hashtag](https://docs.tydro.com/introduction/concepts#tydro) Tydro Basics to know when building on the Tydro [**Lending Protocol**](https://docs.tydro.com/introduction/concepts/lending-protocol) [**Supply**](https://docs.tydro.com/introduction/concepts/supply) [**Borrow**](https://docs.tydro.com/introduction/concepts/borrow) [**Repay**](https://docs.tydro.com/introduction/concepts/repay) [**Withdraw**](https://docs.tydro.com/introduction/concepts/withdraw) [**Liquidations**](https://docs.tydro.com/introduction/concepts/liquidations) [PreviousOverviewchevron-left](https://docs.tydro.com/) [NextLending Protocolchevron-right](https://docs.tydro.com/introduction/concepts/lending-protocol) Last updated 3 months ago --- # Supply | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252F1JgR0sZiMBuiPXo8TrRZ%252F87.png%3Falt%3Dmedia%26token%3D646cba91-c374-4d59-a758-9611638f3299&width=768&dpr=3&quality=100&sign=a81e9c6c&sv=2) Supplying tokens to Tydro allows users to earn interest on their digital assets and utilise supplied tokens as collateral. When tokens are supplied, they are transferred to Tydro’s liquidity pools, a system of smart contracts that facilitates overcollateralised borrowing of tokens. In Tydro, supplied tokens automatically accrue interest based on the current market supply rate. As the balance of supplied tokens increases, interest is accrued dynamically, reflecting the current rate allocated to suppliers. Interest rates for supplied tokens are determined by protocol parameters such as the borrow utilisation rate, which measures the proportion of assets currently borrowed against the total supplied in the pool. These parameters are adjusted through internal configurations that influence incentives across markets, directing capital either towards lenders or borrowers by modifying the effective yield or borrowing cost. As liquidity is supplied, borrowed, repaid, or withdrawn from the pool, the interest rates are updated accordingly. [PreviousLending Protocolchevron-left](https://docs.tydro.com/introduction/concepts/lending-protocol) [NextBorrowchevron-right](https://docs.tydro.com/introduction/concepts/borrow) Last updated 3 months ago --- # Lending Protocol | Tydro Documentation A lending protocol is a decentralised system of smart contracts that allows users to supply and borrow digital assets. Tydro operates on a collateralised lending model, where users deposit assets into protocol-managed pools to earn interest, and other users borrow from those pools by providing collateral that exceeds the borrowed amount. The protocol is deployed within the Ink ecosystem, ensuring seamless integration with ecosystem-aligned assets and applications Tydro is non-custodial, meaning users retain full control over their assets. All interactions take place through self-custodial wallets, with supply and borrow actions executed by permissionless smart contracts. These contracts enforce rules such as interest rates, loan-to-value ratios, and liquidation thresholds, providing a transparent and trust-minimised experience. Liquidity on Tydro flows through Aave-powered pools, leveraging Aave’s battle-tested infrastructure to support efficient and secure lending at scale. Tydro also includes features such as INK rewards and real-time LTV alerts, and supports ecosystem-aligned assets like USDG, kBTC, and GHO. As part of the broader Ink ecosystem, it provides secure and efficient access to capital through a minimal and composable lending layer [PreviousConceptschevron-left](https://docs.tydro.com/introduction/concepts) [NextSupplychevron-right](https://docs.tydro.com/introduction/concepts/supply) Last updated 4 months ago --- # Smart Contracts | Tydro Documentation Tydro is built on a modular set of smart contracts, all available on [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin) . Developers can integrate contract addresses directly into Solidity or JavaScript projects using the [Tydro Address Book.](https://docs.tydro.com/resources/addresses) The repository is organized into the following categories: * Pool * Configuration * Logic * Tokenization * Helpers * Misc ### [hashtag](https://docs.tydro.com/developers/smart-contracts#pool) Pool #### [hashtag](https://docs.tydro.com/developers/smart-contracts#pool-1) 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. #### [hashtag](https://docs.tydro.com/developers/smart-contracts#l2pool) 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. #### [hashtag](https://docs.tydro.com/developers/smart-contracts#poolconfigurator) 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. ### [hashtag](https://docs.tydro.com/developers/smart-contracts#configuration) 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. #### [hashtag](https://docs.tydro.com/developers/smart-contracts#pooladdressesprovider) 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. ### [hashtag](https://docs.tydro.com/developers/smart-contracts#logic) Logic [Librariesarrow-up-right](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. ### [hashtag](https://docs.tydro.com/developers/smart-contracts#tokenization) Tokenization #### [hashtag](https://docs.tydro.com/developers/smart-contracts#atoken) 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 #### [hashtag](https://docs.tydro.com/developers/smart-contracts#variabledebttoken) 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. ### [hashtag](https://docs.tydro.com/developers/smart-contracts#helpers) Helpers #### [hashtag](https://docs.tydro.com/developers/smart-contracts#l2encoder) L2Encoder The [L2Encoderarrow-up-right](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. #### [hashtag](https://docs.tydro.com/developers/smart-contracts#tydroprotocoldataprovider) TydroProtocolDataProvider The [TydroProtocolDataProvider](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-contracts) and formats data from the Pool, making it easier for applications to access key protocol information. ### [hashtag](https://docs.tydro.com/developers/smart-contracts#misc) Misc #### [hashtag](https://docs.tydro.com/developers/smart-contracts#tydrooracle) TydroOracle The [TydroOracle](https://docs.tydro.com/developers/smart-contracts/oracles#aaveoracle) manages reserve oracles and provides reference prices for assets. It ensures accurate pricing and updates sources as needed. #### [hashtag](https://docs.tydro.com/developers/smart-contracts#defaultreserveinterestratestrategy) 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. #### [hashtag](https://docs.tydro.com/developers/smart-contracts#priceoraclesentinel) 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. [PreviousFlash Loanschevron-left](https://docs.tydro.com/primitives/flash-loans) [NextPoolchevron-right](https://docs.tydro.com/developers/smart-contracts/pool) Last updated 3 months ago --- # L2 Pool | Tydro Documentation On Layer 2 networks, the main cost of transactions comes from calldata. To reduce this cost, Tydro uses a specialised contract on L2 that compresses the calldata of Pool methods. The L2Pool contract provides the L2-optimised user-facing methods of the protocol. It accepts byte-encoded input arguments and exposes the same liquidity management functions available in the standard Pool contract. Users can interact with L2Pool through Solidity or Web3 libraries. By using compact calldata representations, L2Pool helps lower transaction costs on rollups. Not all methods are redefined in L2Pool.sol. Functions such as `flashLoan` and `setUserEMode` remain identical to their implementation in the base Pool contract. For those functions, refer to the [Pool](https://docs.tydro.com/developers/smart-contracts/pool) documentation. Because L2 networks use a limited set of supported assets, each asset is assigned an individual 16-bit asset ID, which replaces the standard 160-bit asset address in encoded arguments. The source code is available on [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/pool/L2Pool.sol) . Tydro also provides an [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract with view methods to encode transaction parameters for the compressed L2Pool functions. This ensures developers can efficiently generate the calldata required for low-cost interactions. ### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#methods) Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#supply) supply Copy function supply(bytes32 args) external override Calldata efficient wrapper of the supply function on behalf of the caller. Supplies asset into the protocol, minting the same amount of corresponding aTokens, and transferring them to msg.sender. You can use data returned from encodeSupplyParams() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method. **Input Parameters:** Name Type Description args bytes32 Arguments for the supply function packed in one bytes32 bit 0-15: uint16 assetId - the index of the asset in the reservesList bit 16-143: uint128 shortenedAmount - cast to 256 bits at decode time, if type(uint128).max the value will be expanded to type(uint256).max bit 144-159: uint16 referralCode - used for 3rd party integrations #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#supplywithpermit) supplyWithPermit Copy function supplyWithPermit(bytes32 args, bytes32 r, bytes32 s) external override Calldata efficient wrapper of the supplyWithPermit function on behalf of the caller. Supply with transfer approval of supplied asset via permit function. This method removes the need for separate approval transaction before supplying asset to the pool. You can use data returned from encodeSupplyWithPermitParams() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method. **Input Parameters:** Name Type Description args bytes32 Arguments for the supply function packed in one bytes32 bit 0-15: uint16 assetId - the index of the asset in the reservesList bit 16-143: uint128 shortenedAmount - cast to 256 bits at decode time, if type(uint128).max the value will be expanded to type(uint256).max bit 144-159: uint16 referralCode - used for 3rd party integrations bit 160-191: uint32 shortenedDeadline - shortened deadline from the original uint256 bit 192-199: uint8 permitV - the V parameter of ERC712 permit signature r bytes32 The R parameter of ERC712 permit signature s bytes32 The S parameter of ERC712 permit signature #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#withdraw) withdraw Copy function withdraw(bytes32 args) external override returns (uint256) Calldata efficient wrapper of the withdraw function, withdrawing to the caller. Withdraws amount of the underlying asset, i.e. redeems the underlying token and burns the aTokens. If the user has any existing debt backed by the underlying token, the maximum amount available to withdraw is the amount that will not leave the user with a health factor < 1 after the withdrawal. You can use data returned from encodeWithdrawParams() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method. **Input Parameters:** Name Type Description args bytes32 Arguments for the withdraw function packed in one bytes32 bit 0-15: uint16 assetId - the index of the asset in the reservesList bit 16-143: uint128 shortenedAmount - cast to 256 bits at decode time, if type(uint128).max the value will be expanded to type(uint256).max **Return Value:** Name Type Description amount uint256 The final amount of the underlying asset withdrawn, denominated in the base unit of the asset (e.g., wei for ETH, smallest unit for ERC-20 tokens). This is the amount actually transferred to the caller, accounting for constraints like liquidity and health factor. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#borrow) borrow Copy function borrow(bytes32 args) external override Calldata efficient wrapper of the borrow function, borrowing on behalf of the caller. Borrows amount of asset with interestRateMode, sending the amount to msg.sender, with the debt being incurred by onBehalfOf. You can use data returned from encodeBorrowParams() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method. **Input Parameters:** Name Type Description args bytes32 Arguments for the borrow function packed in one bytes32 bit 0-15: uint16 assetId - the index of the asset in the reservesList bit 16-143: uint128 shortenedAmount - cast to 256 bits at decode time, if type(uint128).max the value will be expanded to type(uint256).max bit 144 - 151: uint8 shortenedInterestRateMode bit 152 - 167: uint16 referralCode - used for 3rd party integrations #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#repay) repay Copy function repay(bytes32 args) external override returns (uint256) Calldata efficient wrapper of the repay function, repaying on behalf of the caller. Repays debt of an asset for the given interestRateMode. You can use data returned from encodeRepayParams() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method. **Input Parameters:** Name Type Description args bytes32 Arguments for the repay function packed in one bytes32 bit 0-15: uint16 assetId - the index of the asset in the reservesList bit 16-143: uint128 shortenedAmount - cast to 256 bits at decode time, if type(uint128).max the value will be expanded to type(uint256).max bit 144 - 151: uint8 shortenedInterestRateMode **Return Values:** Type Description uint256 The final amount repaid #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#repaywithpermit) repayWithPermit Copy function repayWithPermit(bytes32 args, bytes32 r, bytes32 s) external override returns (uint256) Calldata efficient wrapper of the repayWithPermit function, repaying on behalf of the caller. Repay with transfer approval of borrowed asset via permit function. This method removes the need for separate approval transaction before repaying asset to the pool. You can use data returned from encodeRepayWithPermitParams() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method.​ **Input Parameters:** Name Type Description args bytes32 Arguments for the repayWithPermit function packed in one bytes32 bit 0-15: uint16 assetId - the index of the asset in the reservesList bit 16-143: uint128 shortenedAmount - cast to 256 bits at decode time, if type(uint128).max the value will be expanded to type(uint256).max bit 144 - 151: uint8 shortenedInterestRateMode bit 152-183: uint32 shortenedDeadline - shortened deadline from original uint256 bit 184-191: uint8 permitV - the V parameter of ERC712 permit signature r bytes32 The R parameter of ERC712 permit signature s bytes32 The S parameter of ERC712 permit signature **Return Values:** Type Description uint256 The final amount repaid #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#repaywithatokens) repayWithATokens Copy function repayWithATokens(bytes32 args) external override returns (uint256) Calldata efficient wrapper of the repayWithATokens function. Allows user to repay with aTokens of the underlying debt asset without any approvals, for example, Pay DAI debt using aDAI tokens. You can use data data returned from encodeRepayWithATokensParams() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method. **Input Parameters:** Name Type Description args bytes32 Arguments for the repayWithATokens function packed in one bytes32 bit 0-15: uint16 assetId - the index of the asset in the reservesList bit 16-143: uint128 shortenedAmount - cast to 256 bits at decode time, if type(uint128).max the value will be expanded to type(uint256).max bit 144 - 151: uint8 shortenedInterestRateMode **Return Values:** Type Description uint256 The final amount repaid #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#setuserusereserveascollateral) setUserUseReserveAsCollateral Copy function setUserUseReserveAsCollateral(bytes32 args) external override Calldata efficient wrapper of the setUserUseReserveAsCollateral function. Sets the asset of msg.sender to be used as collateral or not. You can use data returned from encodeSetUserUseReserveAsCollateral() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method.​ **Input Parameters:** Name Type Description args bytes32 Arguments for the setUserUseReserveAsCollateral function packed in one bytes32 bit 0-15: uint16 assetId - the index of the asset in the reservesList bit 16: 0 => enable useAsCollateral, 1 => disable useAsCollateral #### [hashtag](https://docs.tydro.com/developers/smart-contracts/l2-pool#liquidationcall) liquidationCall Copy function liquidationCall(bytes32 args1, bytes32 args2) external override Calldata efficient wrapper of the liquidationCall function. Liquidate positions with a health factor below 1. You can use data returned from encodeLiquidationCall() method in [L2Encoderarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/L2Encoder.sol) helper contract to pass to this method.​ **Input Parameters:** Name Type Description args1 bytes32 Part of the arguments for the liquidationCall function packed in one bytes32 bit 0-15: uint16 collateralAssetId - the index of the collateral asset in the reservesList bit 16-31: uint16 debtAssetId - the index of the debt asset in the reservesList bit 32-191: address of the user being liquidated args2 bytes32 Part of the arguments for the liquidationCall function packed in one bytes32 bit 0-127: uint128 shortenedDebtToCover is cast to 256 bits at decode time, if type(uint128).max the value will be expanded to type(uint256).max bit 128: receiveAToken - 0 => receive aToken, 1 => receive underlying asset [PreviousPoolchevron-left](https://docs.tydro.com/developers/smart-contracts/pool) [NextWrapped Token Gatewaychevron-right](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway) Last updated 4 months ago --- # Borrow | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FySN7qnR9B5xqMC3QPkaN%252F87-2.png%3Falt%3Dmedia%26token%3Dab6974c6-21d9-45cd-83fa-b769a1eabd78&width=768&dpr=3&quality=100&sign=88de94a4&sv=2) Borrowing tokens from Tydro allows users to unlock liquidity by using their supplied tokens as collateral, accessing capital without selling their assets. However, borrowers are exposed to liquidation risk if the value of their collateral drops below the required threshold. Interest rates are set dynamically based on protocol parameters such as the borrow utilisation rate, which represents the percentage of total supplied liquidity currently borrowed, and internal configurations that direct incentives across markets. These parameters influence the effective rates earned by suppliers and paid by borrowers by adjusting how capital flows between the two sides of the pool. When utilisation increases, borrowing demand rises, causing interest rates to adjust upward to maintain balance and attract additional liquidity. Each market operates with specific parameters designed to incentivise both borrowers and suppliers. To maintain a healthy ratio and avoid liquidation risk, borrowers should actively monitor their collateral levels. Tools like real-time LTV alerts help ensure borrow positions remain safely overcollateralised as markets move or interest accrues. [PreviousSupplychevron-left](https://docs.tydro.com/introduction/concepts/supply) [NextRepaychevron-right](https://docs.tydro.com/introduction/concepts/repay) Last updated 3 months ago --- # Repay | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FMPFrCYD0xKGOa7nLr9jF%252F86-4.png%3Falt%3Dmedia%26token%3D6559cd2c-094c-4840-b566-5de15fc200e4&width=768&dpr=3&quality=100&sign=806aeae4&sv=2) Repaying borrowed tokens in Tydro is an important step in managing active borrow positions. Borrowers can repay using the same tokens they borrowed, or by using aTokens representing the same underlying asset. In supported cases, repayment may also be done using other tokens such as collateral assets through periphery contracts that handle asset conversions automatically. This flexibility makes it easier for borrowers to manage and close their positions when needed. Repayment improves the health factor of a position by increasing the collateralisation ratio. By reducing the outstanding debt relative to the collateral posted, repayment lowers liquidation risk and may allow borrowers to safely withdraw a portion of their collateral. [PreviousBorrowchevron-left](https://docs.tydro.com/introduction/concepts/borrow) [NextWithdrawchevron-right](https://docs.tydro.com/introduction/concepts/withdraw) Last updated 3 months ago --- # Withdraw | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FAtLeohASNb6WXFO8HM16%252F79.png%3Falt%3Dmedia%26token%3Df6fa87da-863d-4305-bea9-2a1539082035&width=768&dpr=3&quality=100&sign=7ca0ffaf&sv=2) Tydro allows suppliers to withdraw their supplied tokens, including accrued interest, as long as there is sufficient unborrowed liquidity in the reserve. The withdrawal amount is limited by the available underlying assets, and that the user’s ability to maintain a sufficient collateral ratio for their borrow position. Periphery contracts with features such as withdraw and switch, allow users to redeem their supplied liquidity in a different token, providing more options for efficient asset management. When withdrawing with an active borrow position, it’s crucial to maintain a healthy collateralisation ratio to avoid liquidation. Reducing collateral can lower the health factor, increasing the risk of liquidation. To remain safe, after the withdrawal, the account must stay above the liquidation threshold parameters. Therefore, withdrawals require careful management and consideration of the overall borrow positions to avoid liquidation. [PreviousRepaychevron-left](https://docs.tydro.com/introduction/concepts/repay) [NextLiquidationschevron-right](https://docs.tydro.com/introduction/concepts/liquidations) Last updated 4 months ago --- # Liquidations | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FFJNq2b49TC8fLstAeG7A%252F78.png%3Falt%3Dmedia%26token%3D9dafb8cf-5a23-4703-99d1-a6e6f3a6d4f6&width=768&dpr=3&quality=100&sign=2b1113d&sv=2) The health factor is a key metric in Tydro that indicates the safety of a borrow position. It is calculated as: Copy Health Factor = (Total Collateral Value × Liquidation Threshold) / Total Borrow Value A health factor above 1 means the position is safely overcollateralised. If it falls below 1, the position becomes eligible for liquidation. Each asset has its own liquidation threshold, defined through protocol parameters. These parameters determine how much collateral must be maintained for an open loan. For example, the liquidation threshold for most assets will typically be around 75–80% LTV, meaning the loan can reach up to 75–80% of the collateral value before liquidation becomes possible. For example, if a user supplies $10,000 in ETH with an 80% liquidation threshold and borrows $6,000 in USDG, the health factor would be 1.33. The health factor changes with market conditions. If the value of the collateral increases, the health factor improves. If it decreases, the health factor drops, increasing liquidation risk. Users can raise their health factor by supplying more collateral or repaying part of their borrow position. There is no fixed “safe” health factor. What is considered safe depends on the volatility and correlation of the assets. Lower health factors may be acceptable for stable or correlated assets like stablecoins, while more volatile assets require higher buffers. When a position is liquidated, up to 50% of the borrowed amount can be repaid by a liquidator. In return, the liquidator receives a portion of the collateral along with a liquidation bonus. This process is permissionless, meaning anyone can initiate a liquidation if the conditions are met. Liquidations are competitive. Liquidators monitor positions closely and aim to execute transactions quickly when a borrower's health factor falls below the threshold. Tydro includes real-time LTV alerts to help borrowers track their position safety. Monitoring the health factor regularly is essential to avoid liquidation. ### [hashtag](https://docs.tydro.com/introduction/concepts/liquidations#tools-for-managing-health-factor) Tools for Managing Health Factor * Simulate health factor changes: [DeFi Simulatorarrow-up-right](https://defisim.xyz/) * Auto-repay borrow position: [DeFi Saverarrow-up-right](https://defisaver.com/) For more information on participating as a liquidator, see the developer guide. [PreviousWithdrawchevron-left](https://docs.tydro.com/introduction/concepts/withdraw) [NextLiquidity Poolchevron-right](https://docs.tydro.com/primitives/liquidity-pool) Last updated 3 months ago --- # Liquidity Pool | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FFYjeoTH5oPUl5FHFstph%252F77-2.png%3Falt%3Dmedia%26token%3D51234915-6975-4024-b0ce-97aa28b753bf&width=768&dpr=3&quality=100&sign=b241809&sv=2) A liquidity pool is a Tydro market instance that enables users to participate as suppliers or borrowers. Parameters such as reserve configurations and collateralisation thresholds define each pool. Suppliers deposit liquidity into the pool that borrowers can access through overcollateralised positions. In return, suppliers earn interest while borrowers gain access to liquidity, all facilitated through decentralised smart contracts. Tydro liquidity pools operate across supported blockchain networks. Smart contracts enforce pool parameters and automate borrowing, repayment, and liquidation without intermediaries. This decentralised design enhances the transparency, efficiency, and security of financial interactions within the pool [PreviousLiquidationschevron-left](https://docs.tydro.com/introduction/concepts/liquidations) [NextReservechevron-right](https://docs.tydro.com/primitives/reserve) Last updated 4 months ago --- # Reserve | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FjPSC1BekmME6TZM3z2mg%252F90.png%3Falt%3Dmedia%26token%3Da416d3d8-b0ad-4c5f-b292-4cb26d43c4aa&width=768&dpr=3&quality=100&sign=e3d086fb&sv=2) A reserve is an instance of a token within a Tydro liquidity pool. Each reserve is governed by a set of parameters that manage risk and optimise liquidity. ### [hashtag](https://docs.tydro.com/primitives/reserve#key-reserve-parameters) **Key Reserve Parameters** **Loan-to-Value (LTV)** The maximum amount that can be borrowed relative to the value of the collateral. For example, a 75 percent LTV allows borrowing up to 75 percent of the collateral’s value. Assets with zero percent LTV cannot be used as collateral. **Liquidation Threshold** The point at which a position becomes at risk of liquidation. If the value of the collateral falls below this threshold, the position may be liquidated to repay the borrower's debt. **Borrowing Enabled** Specifies whether users can borrow liquidity from this reserve. **Caps** Supply and borrow caps limit the total amount of a token that can be supplied or borrowed from a reserve. These caps help manage liquidity and reduce exposure during volatile market conditions. **Interest Rate Model** Interest rates in Tydro adjust dynamically based on the utilisation of liquidity. As more funds are borrowed, interest rates increase to ensure sufficient liquidity remains available for withdrawals and liquidations. Rates are determined by parameters that define the base rate and how steeply rates rise with utilisation. [PreviousLiquidity Poolchevron-left](https://docs.tydro.com/primitives/liquidity-pool) [NextIncentiveschevron-right](https://docs.tydro.com/primitives/incentives) Last updated 4 months ago --- # Incentives | Tydro Documentation The [UiIncentiveDataProvider](https://docs.tydro.com/developers/smart-contracts/view-contracts) contract provides methods to query all active incentive emissions and the claimable user incentives for a specific Tydro market. This contract is primarily used by frontends to display incentive information for suppliers and borrowers. [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#rewardscontroller) RewardsController ---------------------------------------------------------------------------------------------------------------- * Rewards accrue automatically for users holding incentivised ERC-20 assets. No staking or locking is required. * Users can claim all rewards in a single transaction or claim individual rewards with more granularity. * On every transfer, incentivised assets call the `handleAction` method to account for updated reward balances. Key properties: The RewardsController is the main rewards contract where users interact to claim rewards from their Tydro positions. It is designed as an abstract template that can be extended to create distributor contracts for ERC-20 rewards. The source code is available on [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/rewards/RewardsController.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#write-methods) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#initialize) initialize Copy function initialize(address) external initializer Initialize RewardsController instance. **Input Parameters:** Type Description address Unused but required due to being initialized by PoolAddressProvider.\_updateImpl() #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#configureassets) configureAssets Copy function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external override onlyEmissionManager Configure assets to incentivize with an emission of rewards per second until the end of distribution. **Input Parameters:** Name Type Description config RewardsDataTypes.RewardsConfigInput\[\] The emission per second following rewards unit decimals The [RewardsDataTypes.RewardsConfigInputarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/rewards/libraries/RewardsDataTypes.sol) struct is composed of the following fields: Name Type Description emissionPerSecond uint88 The emission per second following rewards unit decimals totalSupply uint256 The total supply of the asset to incentivize distributionEnd uint32 The end of the distribution of the incentives for an asset asset address The asset address to incentivize reward address The reward token address transferStrategy ITransferStrategy The TransferStrategy address with the install hook and claim logic rewardOracle IEACAggregatorProxy The Price Oracle of a reward to visualize the incentives at the UI frontend. Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#settransferstrategy) setTransferStrategy Copy function setTransferStrategy(address reward, ITransferStrategyBase transferStrategy) external onlyEmissionManager Sets a TransferStrategy logic contract that determines the logic of the rewards transfer. **Input Parameters:** Name Type Description reward address The address of the reward token transferStrategy address The address of the TransferStrategy logic contract #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#setrewardoracle) setRewardOracle Copy function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external onlyEmissionManager Sets an Aave Oracle contract to enforce rewards with a source of value. At the moment of reward configuration, the Incentives Controller performs a check to see if the reward asset oracle is compatible with IEACAggregator proxy. This check is enforced for integrators to show incentives at the current Aave UI without needing to set up an external price registry. **Input Parameters:** Name Type Description reward address The address of the reward to set the price aggregator rewardOracle IEACAggregatorProxy The address of price aggregator that follows the IEACAggregatorProxy interface #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#handleaction) handleAction Copy function handleAction(address user, uint256 totalSupply, uint256 userBalance) external override Called by the corresponding asset on transfer hook to update the rewards distribution of a user. **Input Parameters:** Name Type Description user address The address of the user totalSupply uint256 The user balance of the asset userBalance uint256 The total supply of the asset #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#claimrewards) claimRewards Copy function claimRewards( address[] calldata assets, uint256 amount, address to, address reward) external override returns (uint256) Claims reward for a user to the desired address, on all the assets of the pool, accumulating the pending rewards. Rewards are received by the to address. **Input Parameters:** Name Type Description assets address\[\] The list of assets to check eligible distributions before claiming rewards. Pass a/s/vToken addresses amount uint256 The amount of rewards to claim, expressed in wei. Pass MAX\_UINT to claim the entire unclaimed reward balance to address The address that will be receiving the rewards reward address The address of the reward token (e.g., stkAAVE) **Return Values:** Type Description uint256 The amount of rewards claimed for one specific reward The msg.sender must be an authorized claimer set using the setClaimer() method #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#claimrewardsonbehalf) claimRewardsOnBehalf Copy function claimAllRewardsOnBehalf( address[] calldata assets, address user, address to ) external override onlyAuthorizedClaimers(msg.sender, user) returns (address[] memory rewardsList, uint256[] memory claimedAmounts) Claims rewards for a user on behalf, on all the assets of the pool, accumulating the pending rewards of the assets passed by the first argument. The caller must be whitelisted via the allowClaimOnBehalf function by the EmissionManager role held by Tydro. Rewards are received by the Press to address. address. **Input Parameters:** Name Type Description assets address\[\] The list of assets to check eligible distributions before claiming rewards. Pass a/s/vToken addresses amount uint256 The amount of rewards to claim, expressed in wei. Pass MAX\_UINT to claim the entire unclaimed reward balance user address The address to check and claim rewards to address The address that will be receiving the rewards reward address The address of the reward token being claimed (e.g., stkAAVE) **Return Values:** Type Description uint256 The amount of rewards claimed #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#claimrewardstoself) claimRewardsToSelf Copy function claimRewardsToSelf(address[] calldata assets, uint256 amount, address reward) external override returns (uint256) Claims reward for msg.sender, on all the assets of the pool, accumulating the pending rewards passed by the first input parameter. Rewards are received by msg.sender. **Input Parameters:** Name Type Description assets address\[\] The list of assets to check eligible distributions before claiming rewards. Pass a/s/vToken addresses amount uint256 The amount of rewards to claim, expressed in wei. Pass MAX\_UINT to claim the entire unclaimed reward balance reward address The address of the reward token **Return Values:** Type Description uint256 The amount of rewards claimed for one specific reward #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#claimallrewards) claimAllRewards Copy function claimAllRewards(address[] calldata assets, address to) external override returns (address[] memory rewardsList, uint256[] memory claimedAmounts) Claims all rewards for a user to the desired address, on all the assets of the pool, accumulating the pending rewards passed by the first input parameter. Rewards are received by the toaddress. **Input Parameters:** Name Type Description assets address\[\] The list of assets to check eligible distributions before claiming rewards (aToken or variableDebtToken addresses) to address The address that will be receiving the rewards **Return Values:** Name Type Description rewardsList address\[\] The list of addresses of the reward tokens claimedAmounts uint256\[\] The list that contains the claimed amount per reward, following the same order as rewardsList #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#claimallrewardsonbehalf) claimAllRewardsOnBehalf Copy function claimAllRewardsOnBehalf( address[] calldata assets, address user, address to) external override onlyAuthorizedClaimers(msg.sender, user) returns (address[] memory rewardsList, uint256[] memory claimedAmounts) Claims all rewards for a user on behalf, on all the assets of the pool, accumulating the pending rewards passed by the first input parameter. The caller must be whitelisted via the allowClaimOnBehalf function by the EmissionManager role held by Tydro. Rewards are received by the to address. **Input Parameters:** Name Type Description assets address\[\] The list of assets to check eligible distributions before claiming rewards. Pass a/s/vToken addresses user address The address to check and claim rewards to address The address that will be receiving the rewards **Return Values:** Name Type Description rewardsList address\[\] The list of addresses of the reward tokens claimedAmounts uint256\[\] The list that contains the claimed amount per reward, following the same order as rewardsList #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#claimallrewardstoself) claimAllRewardsToSelf Copy function claimAllRewardsToSelf(address[] calldata assets) external override returns (address[] memory rewardsList, uint256[] memory claimedAmounts) Claims all rewards accrued by msg.sender, on all assets of the pool, accumulating the pending rewards by the first input parameter. Rewards are received by msg.sender. **Input Parameters:** Name Type Description assets address\[\] The list of assets to check eligible distributions before claiming rewards. Pass a/s/vToken addresses **Return Values:** Name Type Description rewardsList address\[\] The list of addresses of the reward tokens claimedAmounts uint256\[\] The list that contains the claimed amount per reward, following the same order as rewardsList #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#setclaimer) setClaimer Copy function setClaimer(address user, address caller) external override onlyEmissionManager Whitelists an address to claim rewards on behalf of another address. Can only be called by the EmissionManager help by Tydro **Input Parameters:** Name Type Description user address The address of the user caller address The address of the claimer ### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#getclaimer) getClaimer Copy function getClaimer(address user) external view override returns (address) Returns the whitelisted claimer for a certain address. It returns the 0x0 address if it is not set. **Input Parameters:** Name Type Description user address The address of the user **Return Values:** Type Description address The claimer address #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#getrewardoracle) getRewardOracle Copy function getRewardOracle(address reward) external view override returns (address) Get the price aggregator oracle address. Name Type Description reward address The address of the reward token **Return Values:** Type Description address The address of the reward oracle #### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#gettransferstrategy) getTransferStrategy Copy function getTransferStrategy(address reward) external view override returns (address) Returns the Transfer Strategy implementation contract address being used for a reward address. Name Type Description reward address The address of the reward **Return Values:** Type Description address The address of the TransferStrategy contract ### [hashtag](https://docs.tydro.com/developers/smart-contracts/incentives#pure-methods) Pure Methods Copy function getRevision() internal pure override returns (uint256) Returns the revision of the implementation contract. **Return Values:** Type Description uint256 The current revision version [PreviousView Contractschevron-left](https://docs.tydro.com/developers/smart-contracts/view-contracts) [NextTokenizationchevron-right](https://docs.tydro.com/developers/smart-contracts/tokenization) Last updated 3 months ago --- # Flash Loans | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FO84zoQllqBMKK1x34OOZ%252F69.png%3Falt%3Dmedia%26token%3De77870f7-b044-451b-a63e-ec837cef3089&width=768&dpr=3&quality=100&sign=b5f75a7a&sv=2) Flash Loans let you borrow an asset without posting collateral, provided the borrowed amount plus a fee is returned before the transaction ends. Because everything settles within a single transaction, you may see these referred to as "one-block borrows" There is no real-world equivalent for flash loans; they rely on how blockchain state is updated within a block. This is an advanced feature intended for developers who are comfortable with the EVM, Solidity, and smart contract patterns. ### [hashtag](https://docs.tydro.com/primitives/flash-loans#overview) Overview Flash loans allow access to pool liquidity (only for reserves where borrowing is enabled) for the duration of one transaction, as long as either: * the borrowed amount + fee is returned by the end, or * a debt position is opened by the end (if permitted). Tydro exposes two methods: #### [hashtag](https://docs.tydro.com/primitives/flash-loans#flashloan) `flashLoan()` * Borrow from multiple reserves in a single transaction. * At completion you may 1) repay amount + fee, or 2) open a variable-rate debt position backed by posted collateral or via credit delegation. * Note: the flash loan fee can be waived for approved `flashBorrowers` (managed by ACLManager). #### [hashtag](https://docs.tydro.com/primitives/flash-loans#flashloansimple) `flashLoanSimple()` * Borrow from a single reserve for the transaction. * The fee is not waived and no debt position can be opened at the end. * Optimized for gas when you only need a basic, single-asset flash loan. ### [hashtag](https://docs.tydro.com/primitives/flash-loans#execution-flow) Execution Flow Practical mental model for implementation: 1. Request: Your contract calls the Pool and requests a flash loan of specific amount(s) of one or more reserve(s) via `flashLoanSimple()` or `flashLoan()`. 2. Transfer + Callback: After checks, the Pool transfers the requested amounts to your contract and then calls your receiver’s `executeOperation()`. 3. Your Logic: With funds in hand, your contract runs arbitrary logic. 4. Settlement: * For `flashLoanSimple()`: before finishing, approve the Pool to pull back amount + fee. * For `flashLoan()`: for each reserve, depending on the `interestRateMode` you passed, either a) approve the Pool for amount + fee, or b) ensure sufficient collateral or credit delegation is in place to open a debt position. 5. Atomicity: If the owed amount is not available (insufficient balance, missing approval, or insufficient collateral for debt), the entire transaction reverts. 6. Block scope: Everything above happens within a single transaction (i.e., one block). ### [hashtag](https://docs.tydro.com/primitives/flash-loans#applications-of-flash-loans) Applications of Flash Loans Tydro Flash Loans are already used with Tydro for liquidity switch feature. Other examples in the wild (and supported with Tydro) include: * **Arbitrage**: Arbitrage between assets, without needing to have the principal amount to execute the arbitrage. * **Liquidations:** Liquidating borrow positions, without having to repay the debt of the positions and using discounted collateral claimed to payoff flashLoan amount + fee. ### [hashtag](https://docs.tydro.com/primitives/flash-loans#flash-loan-fee) Flash loan fee * The flash loan fee is initialized at **0.05%**. The current value can be queried through `FLASHLOAN_PREMIUM_TOTAL`. * The total fee paid by borrowers can be shared between LPs and the protocol treasury: * Fee to LPs: `FLASHLOAN_PREMIUM_TOTAL - FLASHLOAN_PREMIUM_TO_PROTOCOL` * Fee to Protocol: `FLASHLOAN_PREMIUM_TO_PROTOCOL` * At initialization, `FLASHLOAN_PREMIUM_TO_PROTOCOL` = 0. ### [hashtag](https://docs.tydro.com/primitives/flash-loans#step-by-step) Step by step #### [hashtag](https://docs.tydro.com/primitives/flash-loans#id-1.-setting-up) 1\. Setting Up * Your receiver must implement [`IFlashLoanSimpleReceiver`arrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/misc/flashloan/interfaces/IFlashLoanSimpleReceiver.sol) or [`IFlashLoanReceiver`arrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/misc/flashloan/interfaces/IFlashLoanReceiver.sol) , including the `executeOperation()` function. * Because the Pool pulls repayment, your contract must approve the Pool to spend the borrowed amount + premium. #### [hashtag](https://docs.tydro.com/primitives/flash-loans#id-2.-calling-flashloan-or-flashloansimple) 2\. Calling flashLoan() or flashLoanSimple() There are three ways to initiate: * From an EOA: Send a transaction to the Pool calling `flashLoan()` or `flashLoanSimple()`. See the Pool docs for parameters, and use your receiver address from step 1 as `receiverAddress`. * From a different contract: Same as above; ensure `receiverAddress` is your receiver from step 1. * From the same contract: Call the method with `receiverAddress = address(this)`. > **Security note:** Do **not** keep funds permanently on your receiver / [`FlashLoanReceiverBase`arrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/misc/flashloan/interfaces/IFlashLoanReceiver.sol) > . Idle funds can be griefed (e.g., siphoned during forced interactions). #### [hashtag](https://docs.tydro.com/primitives/flash-loans#id-3.-completing-the-flash-loan) 3\. Completing the flash loan **Immediate repayment** * If you used `flashLoanSimple()` or passed `interestRateMode = 0` for any asset in the `modes` parameter of `flashLoan()`, you must repay immediately. * Ensure your contract holds amount + premium for each relevant asset. You can compute this from the `amounts`and `premiums` arrays received in `executeOperation()`. * You do not manually transfer funds back; the Pool pulls repayment when your call returns. **Incurring a debt** * If you passed `mode = 1` or `mode = 2` for any asset in `modes`, the `onBehalfOf` address will incur the debt, provided it has previously approved the `msg.sender` to borrow on its behalf. * You can mix behaviors: some assets repaid immediately, others converted into debt. ### [hashtag](https://docs.tydro.com/primitives/flash-loans#notes) Notes * Tydro does **not offer a UI** for flash loans. This is a **developer-only feature** available via smart contracts. [PreviousOraclechevron-left](https://docs.tydro.com/primitives/oracle) [NextSmart Contractschevron-right](https://docs.tydro.com/developers/smart-contracts) Last updated 3 months ago --- # Wrapped Token Gateway | Tydro Documentation Tydro operates exclusively with ERC-20 [reserve](https://docs.tydro.com/primitives/reserve) tokens. To support native gas tokens such as ETH or POL, Tydro provides the WrappedTokenGateway (previously called WETHGateway). This helper contract allows users to wrap or unwrap gas tokens so they can interact with Pool methods. Through WrappedTokenGateway, users can: * Supply gas tokens * Borrow gas tokens * Repay positions using gas tokens * Withdraw supplied gas tokens The smart contract source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/WrappedTokenGatewayV3.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway#write-methods) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway#depositeth) depositETH Copy function depositETH( address, address onBehalfOf, uint16 referralCode ) external payable override Wraps and supplies gas tokens to Tydro. A corresponding amount of the wrapped aTokens are minted to the onBehalfOf address. The amount of network gas tokens to be supplied is specified in the msg.value field of the transaction. **Input Parameters:** Name Type Description onBehalfOf address The address of the user who will receive the aTokens representing the supplied tokens referralCode uint16 Inactive, can pass 0 as placeholder #### [hashtag](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway#withdraweth) withdrawETH Copy function withdrawETH( address, uint256 amount, address to ) external override Withdraws amount of the supplied wrapped gas token, unwraps it and transfers to the toaddress. If the amount is uint(-1), the entire balance is withdrawn. The WrappedTokenGateway contract must have an approved token allowance to spend aWETH on behalf of the user, example:IERC20(aWETHAddress).approve(wrappedTokenGatewayAddress, amount) **Input Parameters:** Name Type Description amount uint256 amount of aWETH to withdraw and receive native ETH to address The address of the user who will receive native ETH #### [hashtag](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway#repayeth) repayETH Copy function repayETH( address, uint256 amount, uint256 rateMode, address onBehalfOf ) external payable override Repays a borrow position of onBehalfOf's address for the specified amount (or for the whole amount, if amount of uint256(-1) is passed). The amount of network gas token to be repaid must also be specified in the msg.value field of the transaction. **Input Parameters:** Name Type Description amount uint256 The amount to repay, or uint256(-1) if the user wants to repay everything rateMode uint256 Should always be passed a value of 2 (variable rate mode) onBehalfOf address The address for which msg.sender is repaying #### [hashtag](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway#borroweth) borrowETH Copy function borrowETH( address, uint256 amount, uint256 interestRateMode, uint16 referralCode ) external override Borrows amount of unwrapped network gas tokens to msg.sender. The WrappedTokenGateway contract must have an approved [credit delegation](https://docs.tydro.com/developers/credit-delegation) to borrow WETH (or corresponding wrapped gas token of the network) on behalf of the the caller, example:IVariableDebtToken(wethAddress).approveDelegation(wrappedTokenGatewayAddress, amount) **Input Parameters:** Name Type Description amount uint256 The amount of ETH to borrow interestRateMode uint256 Should always be passed a value of 2 (variable rate mode) referralCode uint16 Integrators are assigned a referral code and can potentially receive rewards #### [hashtag](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway#withdrawethwithpermit) withdrawETHWithPermit Copy function withdrawETHWithPermit( address, uint256 amount, address to, uint256 deadline, uint8 permitV, bytes32 permitR, bytes32 permitS ) external override Withdraws amount of the supplied wrapped gas token, unwraps it and transfers to the toaddress. If the amount is uint(-1), the entire balance is withdrawn. **Input Parameters:** Name Type Description amount uint256 The amount of aWETH to withdraw and receive native ETH to address The address of the user who will receive native ETH deadline uint256 Timestamp of signature expiration permitV uint8 V parameter of ERC712 permit sig permitR bytes32 R parameter of ERC712 permit sig permitS bytes32 S parameter of ERC712 permit sig ### [hashtag](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway#getwethaddress) getWETHAddress Copy function getWETHAddress() external view returns (address) Get WETH address used by WrappedTokenGatewayV3. **Return Values:** Type Description address The WETH address used by WrappedTokenGatewayV3 [PreviousL2 Poolchevron-left](https://docs.tydro.com/developers/smart-contracts/l2-pool) [NextView Contractschevron-right](https://docs.tydro.com/developers/smart-contracts/view-contracts) Last updated 3 months ago --- # Oracle | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FfmMFBD0z2tbkdhuhK0gC%252F68-2.png%3Falt%3Dmedia%26token%3Dbf78fc88-2940-4e1e-9ee2-c306d7ebc301&width=768&dpr=3&quality=100&sign=39eb9d44&sv=2) Each reserve within Tydro is associated with an oracle contract. These contracts report the market price of assets in the protocol, which is essential for determining collateral requirements and enabling secure borrowing and liquidation processes. Tydro has partnered with Chaos Labs to power Oracles, with price data submitted automatically by predefined oracle contracts. Updates are triggered according to predefined logic, such as time-based intervals or deviation thresholds. ### [hashtag](https://docs.tydro.com/primitives/oracle#types-of-oracles-in-use) **Types of Oracles in Use** #### [hashtag](https://docs.tydro.com/primitives/oracle#edge-price-feeds) **Edge Price Feeds** Decentralised Edge oracles by Chaos Labs, deliver reliable and tamper-resistant price data. These feeds aggregate prices from multiple off-chain sources to minimise manipulation and improve accuracy. #### [hashtag](https://docs.tydro.com/primitives/oracle#correlated-asset-price-oracle-capo) **Correlated Asset Price Oracle (CAPO)** Designed for assets strongly tied to other token prices - such as wrapped assets - CAPO mirrors the price of an underlying asset using logic that tracks and adjusts based on correlation. This enables efficient pricing for derivative tokens. Tydro relies on these oracle systems to ensure consistent, decentralised, and secure pricing across all supported markets. [PreviousIncentiveschevron-left](https://docs.tydro.com/primitives/incentives) [NextFlash Loanschevron-right](https://docs.tydro.com/primitives/flash-loans) Last updated 3 months ago --- # Glossary | Tydro Documentation Term Description aTokens Interest-bearing tokens received by users when they supply assets to Tydro. aTokens represent the user’s share of the liquidity pool and accrue interest in real time. APY Annual Percentage Yield, which is the yield or interest earned over a year including compounding. This differs from APR, which does not account for compounding. Borrow Cap A limit on the maximum amount of a specific asset that can be borrowed from the protocol. Borrow caps help manage exposure and reduce systemic risk. Collateral An asset supplied to Tydro to secure a borrowing position. The collateral value must exceed the borrowed amount to ensure solvency. Cooldown Period A mandatory waiting period that users must observe before unstaking their tokens from a staking or safety module Credit Delegation A feature that allows one user to delegate their borrowing power to another user. The delegate can then take out loans using the delegator’s collateral, facilitated through Tydro’s smart contracts Debt Ceiling The maximum amount of debt that can be issued against an isolated asset, used to limit risk exposure to a single collateral type. E-Mode Efficiency Mode allows borrowers to access higher borrowing power when using correlated assets (e.g., stablecoins). Flash Loan A type of uncollateralised loan offered by Tydro, which must be borrowed and repaid within a single transaction block. GHO A decentralised, overcollateralised stablecoin that is fully backed, transparent, and native to the Ink ecosystem. Health Factor A ratio that determines the safety of a user’s loan position. It compares the user’s collateral value against borrowed assets. A health factor below 1 triggers liquidation. Isolation Mode A mode that restricts borrowing certain assets in isolation to mitigate risk. It limits exposure by restricting debt expansion to a single collateral type. Liquidation The process triggered when a borrower’s health factor falls below 1. Collateral is sold to repay part of the debt and restore the position to a safer level. Liquidation Bonus An additional incentive paid to liquidators when purchasing undercollateralised assets during liquidation. Expressed as a percentage. Liquidation Threshold The collateral-to-debt ratio at which a loan becomes eligible for liquidation. Defined per asset. Liquidity Index Tracks cumulative interest earned by a reserve over time, used to calculate interest accrual accurately. Loan To Value (LTV) The maximum percentage of a collateral asset’s value that can be borrowed. For example, an LTV of 75% means 1 ETH of collateral allows borrowing up to 0.75 ETH. Network Risk Risks associated with the underlying blockchains where Tydro is deployed, such as congestion, security vulnerabilities, or downtime. Oracle A decentralised service providing external data (such as asset prices) to Tydro. Oracles are critical for determining collateral values and triggering liquidations. Ray units A unit of precision with 27 decimals used internally by Tydro for calculations such as interest and exchange rates. Reserve Factor A portion of interest paid by borrowers that is allocated to the protocol treasury to support long-term sustainability. Risk Admin An entity or automated process responsible for adjusting risk parameters such as LTVs, borrow caps, or liquidation thresholds. These adjustments ensure the protocol remains secure and aligned with market conditions. Safety Module A staking mechanism where tokens are staked as insurance in case of a shortfall event. Stakers may earn rewards but are exposed to slashing risk. Siloed Borrowing A restriction that allows certain assets to be borrowed only in isolation. This helps mitigate risks of illiquid or volatile assets. Supply Cap A limit on the total amount of a specific asset that can be supplied to the protocol. Helps control exposure to risky assets. Utilization Rate The ratio of borrowed assets to total supplied assets in a reserve. Higher utilisation indicates stronger borrowing demand. [PreviousWeb3chevron-left](https://docs.tydro.com/resources/web3) Last updated 3 months ago --- # Interest Rate Strategy | Tydro Documentation This contract implements the calculation of interest rates based on the state of each reserve. The model follows a **two-slope structure**: * One slope applies when utilisation is below the `OPTIMAL_USAGE_RATIO`. * A steeper slope applies once utilisation rises above the optimal point, up to 100%. Each Tydro market deploys its own instance of the interest rate strategy contract, as it caches the [`PoolAddressesProvider`](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) and cannot be shared across markets The source code is available on [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy#getvariablerateslope1) getVariableRateSlope1 Copy function getVariableRateSlope1(address reserve) external view returns (uint256) Returns the variable rate slope below the optimal usage ratio for the specified reserve. This is the variable rate when the usage ratio is between 0 and OPTIMAL\_USAGE\_RATIO. **Input Parameters:** Name Type Description reserve address The address of the reserve **Return Values:** Type Description uint256 The variable rate slope #### [hashtag](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy#getvariablerateslope2) getVariableRateSlope2 Copy function getVariableRateSlope2(address reserve) external view returns (uint256) Returns the variable rate slope above the optimal usage ratio for the specified reserve. This is the variable rate when the usage ratio is greater than OPTIMAL\_USAGE\_RATIO. **Input Parameters:** Name Type Description reserve address The address of the reserve **Return Values:** Type Description uint256 The variable rate slope #### [hashtag](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy#getbasevariableborrowrate) getBaseVariableBorrowRate Copy function getBaseVariableBorrowRate(address reserve) external view override returns (uint256) Returns the base variable borrow rate for the specified reserve. **Input Parameters:** Name Type Description reserve address The address of the reserve **Return Values:** Type Description uint256 The base variable borrow rate, expressed in ray #### [hashtag](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy#getmaxvariableborrowrate) getMaxVariableBorrowRate Copy function getMaxVariableBorrowRate(address reserve) external view override returns (uint256) Returns the maximum variable borrow rate for the specified reserve. **Input Parameters:** Name Type Description reserve address The address of the reserve **Return Values:** Type Description uint256 The maximum variable borrow rate, expressed in ray #### [hashtag](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy#calculateinterestrates) calculateInterestRates Copy function calculateInterestRates( DataTypes.CalculateInterestRatesParams memory params) external view override returns (uint256, uint256) Calculates the interest rates depending on the reserve's state and configurations. This function returns only two values: the liquidity rate and the variable borrow rate. **Input Parameters:** Name Type Description params DataTypes.CalculateInterestRatesParams The parameters needed to calculate interest rates The DataTypes.CalculateInterestRatesParams struct is composed of the following fields: Name Type Description unbacked uint256 The amount of unbacked tokens liquidityAdded uint256 The liquidity added during the operation liquidityTaken uint256 The liquidity taken during the operation totalDebt uint256 The total borrowed from the reserve reserveFactor uint256 The reserve portion of the interest that goes to the treasury of the market reserve address The address of the reserve usingVirtualBalance bool Flag to indicate if the virtual balance is being used virtualUnderlyingBalance uint256 The virtual balance of underlying asset used for mintable assets **Return Values:** Name Type Description liquidityRate uint256 The liquidity rate, expressed in ray variableBorrowRate uint256 The variable borrow rate, expressed in ray [PreviousTokenizationchevron-left](https://docs.tydro.com/developers/smart-contracts/tokenization) [NextACLManagerchevron-right](https://docs.tydro.com/developers/smart-contracts/aclmanager) Last updated 4 months ago --- # ACLManager | Tydro Documentation The ACLManager (Access Control List Manager) is the registry of roles and permissions within Tydro. It ensures that sensitive operations are restricted to authorised addresses and that responsibilities are clearly separated across different roles. Tydro implements an access control list to segregate powers and/or benefits that can be allocated to different entities on the protocol. The ACL\_MANAGER contract is managed by the [PoolAddressesProvider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) contract. ACLManager keeps track of the individual roles and its holders, and allows a _Role Admin_ to manage roles. _Role Admin_ is itself a role that is managed by the DEFAULT\_ADMIN\_ROLE. The DEFAULT\_ADMIN\_ROLE is held by the [ACL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#acl_admin) , and should be initialized in the [PoolAddressesProvider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) beforehand. ### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#roles) Roles Below we outline the responsibilities/powers of the roles and the specific methods that are only accessible to the holders of these roles. The [FLASH\_BORROWER](https://docs.tydro.com/developers/smart-contracts/aclmanager#flash_borrower) and [BRIDGE](https://docs.tydro.com/developers/smart-contracts/aclmanager#bridge) roles have few direct responsibilities and can primarily access specific features of the protocol, while ADMIN roles have the power and responsibility to handle risk or configuration parameters. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#flash_borrower) FLASH\_BORROWER Holders of this role will have the premium on flash loans waived (this does not include the simple flash loan). **Methods Accessible:** [**Pool**](https://docs.tydro.com/developers/smart-contracts/pool) : **Methods Accessible:** [**Pool**](https://docs.tydro.com/developers/smart-contracts/pool) : * [mintUnbacked()](https://docs.tydro.com/developers/smart-contracts/pool#mintunbacked) * [backUnbacked()](https://docs.tydro.com/developers/smart-contracts/pool#backunbacked) #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#asset_listing_admin) ASSET\_LISTING\_ADMIN Holders of this role can: * Update asset oracle sources and the fallback oracle. * Add new assets to the Tydro market. **Methods Accessible:** [TydroOracles:](https://docs.tydro.com/developers/smart-contracts/oracles) * [setAssetSources()](https://docs.tydro.com/developers/smart-contracts/oracles#setassetsources) * [setFallbackOracle()](https://docs.tydro.com/developers/smart-contracts/oracles#setfallbackoracle) [**PoolConfigurator**](https://docs.tydro.com/developers/smart-contracts/pool-configurator) : * [initReserves()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#initreserves) #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) RISK\_ADMIN Holders of this role can: * Update the grace period of Oracle Sentinels. * Update reserve parameters such as reserve factor, caps, E-Mode category, borrowing enabled, freeze/unfreeze, LTV, liquidation threshold, liquidation bonus (cannot pause/unpause or activate/deactivate a reserve). * Create new and update existing E-Mode categories (not category 0). * Update unbacked mint cap and liquidation protocol fee. **Methods Accessible:** [**PoolConfigurator**](https://docs.tydro.com/developers/smart-contracts/pool-configurator) : * [setReserveBorrowing()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveborrowing) * [configureReserveAsCollateral()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#configurereserveascollateral) * [setReserveFreeze()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreservefreeze) * [setBorrowableInIsolation()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setborrowableinisolation) * [setReserveFactor()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreservefactor) * [setDebtCeiling()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setdebtceiling) * [setSiloedBorrowing()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setsiloedborrowing) * [setBorrowCap()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setborrowcap) * [setSupplyCap()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setsupplycap) * [setLiquidationProtocolFee()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setliquidationprotocolfee) * [setEModeCategory()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setemodecategory) * [setAssetCollateralInEMode()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setassetcollateralinemode) * [setUnbackedMintCap()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setunbackedmintcap) * [setReserveInterestRateStrategyAddress()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveinterestratestrategyaddress) * [setReserveInterestRateData()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveinterestratedata) * [disableLiquidationGracePeriod()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#disableliquidationgraceperiod) * [setReserveFlashLoaning()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveflashloaning) [**PriceOracleSentinel**](https://docs.tydro.com/developers/smart-contracts/oracles) : * [setGracePeriod()](https://docs.tydro.com/developers/smart-contracts/oracles#setgraceperiod) #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#acl_admin) ACL\_ADMIN Holders of this role manage the role admins in the ACLManager. The DEFAULT\_ADMIN\_ROLE is held by the ACL\_ADMIN, and should be initialized in the PoolAddressesProvider beforehand. **Methods Accessible:** [**ACLManager**](https://docs.tydro.com/developers/smart-contracts/aclmanager) : * [setRoleAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#setroleadmin) * [addPoolAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#addpooladmin) * [removePoolAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#removepooladmin) * [addEmergencyAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#addemergencyadmin) * [removeEmergencyAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#removeemergencyadmin) * [addRiskAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#addriskadmin) * [removeRiskAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#removeriskadmin) * [addFlashBorrower()](https://docs.tydro.com/developers/smart-contracts/aclmanager#addflashborrower) * [removeFlashBorrower()](https://docs.tydro.com/developers/smart-contracts/aclmanager#removeflashborrower) * [addBridge()](https://docs.tydro.com/developers/smart-contracts/aclmanager#addbridge) * [removeBridge()](https://docs.tydro.com/developers/smart-contracts/aclmanager#removebridge) * [addAssetListingAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#addassetlistingadmin) * [removeAssetListingAdmin()](https://docs.tydro.com/developers/smart-contracts/aclmanager#removeassetlistingadmin) #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#emergency_admin) EMERGENCY\_ADMIN Holders of this role can pause and unpause the pool or an individual reserve. **Methods Accessible:** [**PoolConfigurator**](https://docs.tydro.com/developers/smart-contracts/pool-configurator) : * [setReservePause()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreservepause) * [setPoolPause()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setpoolpause) * [setReserveActive()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveactive) * [setReserveFreeze()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreservefreeze) #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) POOL\_ADMIN Holders of this role can update token implementations, drop, (un)pause and (de)activate reserves, update premiums along with everything the [ASSET\_LISTING\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#asset_listing_admin) and [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) can do. The [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) role is governed by the Guardians multisig. **Methods Accessible:** All methods accessible to ASSET\_LISTING\_ADMIN. All methods accessible to RISK\_ADMIN. [**AToken**](https://docs.tydro.com/developers/smart-contracts/tokenization) : * [rescueTokens()](https://docs.tydro.com/developers/smart-contracts/tokenization#rescuetokens) [**Pool**](https://docs.tydro.com/developers/smart-contracts/pool) : * [rescueTokens()](https://docs.tydro.com/developers/smart-contracts/pool#rescuetokens) [**PoolConfigurator**](https://docs.tydro.com/developers/smart-contracts/pool-configurator) : * [dropReserve()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#dropreserve) * [updateAToken()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updateatoken) * [updateVariableDebtToken()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updatevariabledebttoken) * [setReserveActive()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveactive) * [updateBridgeProtocolFee()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updatebridgeprotocolfee) * [updateFlashloanPremiumTotal()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updateflashloanpremiumtotal) * [updateFlashloanPremiumToProtocol()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updateflashloanpremiumtoprotocol) * [setAssetBorrowableInEMode()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setassetborrowableinemode) * [setReserveInterestRateData()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveinterestratedata) * [setReserveInterestRateStrategyAddress()](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveinterestratestrategyaddress) [**PriceOracleSentinel**](https://docs.tydro.com/developers/smart-contracts/oracles) : * [setSequencerOracle()](https://docs.tydro.com/developers/smart-contracts/oracles#setsequenceroracle) ### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#write-methods) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#setroleadmin) setRoleAdmin Copy function setRoleAdmin(bytes32 role, bytes32 adminRole) external override onlyRole(DEFAULT_ADMIN_ROLE) Sets the role as admin of a specific role. By default, the adminRole for all roles is [DEFAULT\_ADMIN\_ROLE](https://docs.tydro.com/developers/smart-contracts/aclmanager#acl_admin) . This method can only be called by an address with [DEFAULT\_ADMIN\_ROLE](https://docs.tydro.com/developers/smart-contracts/aclmanager#acl_admin) . **Input Parameters:** Name Type Description role bytes32 The role to be managed by the admin role - keccak256 hash of one of the following: POOL\_ADMIN, EMERGENCY\_ADMIN, RISK\_ADMIN, FLASH\_BORROWER, BRIDGE, ASSET\_LISTING\_ADMIN adminRole bytes32 The admin role. 0x00 is reserved for the DEFAULT\_ADMIN\_ROLE #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#addpooladmin) addPoolAdmin Copy function addPoolAdmin(address admin) external override Adds a new admin as _Pool Admin_. The address is added to the list of members with the [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#acl_admin) role. Holders of this role can update token implementations, drop, (un)pause and (de)activate reserves, update premiums and do everything the [ASSET\_LISTING\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#asset_listing_admin) and [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) can do. This method can only be called by the _Role Admin_, specified by Tydro, responsible for managing the [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) role. **Input Parameters:** Name Type Description admin address The address which will be granted the POOL\_ADMIN role #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#removepooladmin) removePoolAdmin Copy function removePoolAdmin(address admin) external override Removes an admin as _Pool Admin_. The given address is removed from the list of members with the [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) role. This method can only be called by the _Role Admin_, specified by Tydro, responsible for managing the [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) role. **Input Parameters:** Name Type Description admin address The address for which the POOL\_ADMIN role permissions will be removed #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#addemergencyadmin) addEmergencyAdmin Copy function addEmergencyAdmin(address admin) external override Adds a new admin as an _Emergency Admin_. The address is added to the list of members with the [EMERGENCY\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#emergency_admin) role. Holders of this role can pause and unpause the pool or an individual reserve. This method can only be called by the _Role Admin_, specified by Tydro, responsible for managing the [EMERGENCY\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#emergency_admin) role. **Input Parameters:** Name Type Description admin address The address which will be granted the EMERGENCY\_ADMIN role #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#removeemergencyadmin) removeEmergencyAdmin Copy function removeEmergencyAdmin(address admin) external override Removes an admin as _Emergency Admin_. The given address is removed from the list of members with the [EMERGENCY\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#emergency_admin) role. This method can only be called by the _Role Admin_, specified by Tydro, responsible for managing the [EMERGENCY\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#emergency_admin) role. **Input Parameters:** Name Type Description admin address The address for which the EMERGENCY\_ADMIN role permissions will be removed #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#addriskadmin) addRiskAdmin Copy function addRiskAdmin(address admin) external override Adds a new admin as a _Risk Admin_. The address is added to the list of members with the [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) role. Holders of this role can update grace period of Oracle Sentinels, reserve params, unbacked mint cap, liquidation fee and eMode categories. **Input Parameters:** Name Type Description admin address The address which will be granted the RISK\_ADMIN role #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#removeriskadmin) removeRiskAdmin Copy function removeRiskAdmin(address admin) external override Removes an admin as _Risk Admin_. The given address is removed from the list of members with the [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) role. **Input Parameters:** Name Type Description admin address The address for which the RISK\_ADMIN role permissions will be removed #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#addflashborrower) addFlashBorrower Copy function addFlashBorrower(address borrower) external override Adds a new borrower address as _Flash Borrower_. The address is added to the list of members with the [FLASH\_BORROWER](https://docs.tydro.com/developers/smart-contracts/aclmanager#flash_borrower) role. Holders of this role do not pay premium for flash loan (does not apply to flashLoanSimple). **Input Parameters:** Name Type Description borrower address The address which will be granted the FLASH\_BORROWER role #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#removeflashborrower) removeFlashBorrower Copy function removeFlashBorrower(address borrower) external override Removes an admin as _Flash Borrower_. The given borrower address is removed from the list of members with the [FLASH\_BORROWER](https://docs.tydro.com/developers/smart-contracts/aclmanager#flash_borrower) role. **Input Parameters:** Name Type Description borrower address The address for which the FLASH\_BORROWER role permissions will be removed **Input Parameters:** Name Type Description bridge address The address which will be granted BRIDGE role #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#addassetlistingadmin) addAssetListingAdmin Copy function addAssetListingAdmin(address admin) external override Adds a new admin as _Asset Listing Admin_. The address is added to the list of members with the [ASSET\_LISTING\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#asset_listing_admin) role. Holder of this role can update oracles and add new assets to the Aave market. **Input Parameters:** Name Type Description admin address The address which will be granted ASSET\_LISTING\_ADMIN role #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#removeassetlistingadmin) removeAssetListingAdmin Copy function removeAssetListingAdmin(address admin) external override Removes an admin as _Asset Listing Admin_. The given address is removed from the list of members with the [ASSET\_LISTING\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#asset_listing_admin) role. **Input Parameters:** Name Type Description admin address The address for which ASSET\_LISTING\_ADMIN role permissions will be removed ### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#ispooladmin) isPoolAdmin Copy function isPoolAdmin(address admin) external view override returns (bool) Returns true if the address has the [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) role, false otherwise. **Input Parameters:** Name Type Description admin address The address to check **Return Values:** Type Description bool true if the given address is POOL\_ADMIN, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#isemergencyadmin) isEmergencyAdmin Copy function isEmergencyAdmin(address admin) external view override returns (bool) Returns true if the address has the [EMERGENCY\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#emergency_admin) role, false otherwise. **Input Parameters:** Name Type Description admin address The address to check **Return Values:** Type Description bool true if the given address is EMERGENCY\_ADMIN, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#isriskadmin) isRiskAdmin Copy function isRiskAdmin(address admin) external view override returns (bool) Returns true if the address has the [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) role, false otherwise. **Input Parameters:** Name Type Description admin address The address to check **Return Values:** Type Description bool true if the given address is RISK\_ADMIN, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#isflashborrower) isFlashBorrower Copy function isFlashBorrower(address borrower) external view override returns (bool) Returns true if the address has the [FLASH\_BORROWER](https://docs.tydro.com/developers/smart-contracts/aclmanager#flash_borrower) role, false otherwise. **Input Parameters:** Name Type Description borrower address The address to check **Return Values:** Type Description bool true if the given address is FLASH\_BORROWER, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#isbridge) isBridge Copy function isBridge(address bridge) external view override returns (bool) Returns true if the address has [BRIDGE](https://docs.tydro.com/developers/smart-contracts/aclmanager#isbridge) role, false otherwise. **Input Parameters:** Name Type Description bridge address The address to check **Return Values:** Type Description bool true if the given address is BRIDGE, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/aclmanager#isassetlistingadmin) isAssetListingAdmin Copy function isAssetListingAdmin(address admin) external view override returns (bool) Returns true if the address has the [ASSET\_LISTING\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#asset_listing_admin) role, false otherwise. **Input Parameters:** Name Type Description admin address The address to check **Return Values:** Type Description bool true if the given address is ASSET\_LISTING\_ADMIN, false otherwise [PreviousInterest Rate Strategychevron-left](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy) [NextOracleschevron-right](https://docs.tydro.com/developers/smart-contracts/oracles) Last updated 3 months ago --- # Oracles | Tydro Documentation Contract to get asset prices and manage price sources. The source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/misc/AaveOracle.sol) . circle-info This contract is owned by Tydro ### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#write-methods) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#setassetsources) setAssetSources Copy function setAssetSources(address[] calldata assets, address[] calldata sources) external override onlyAssetListingOrPoolAdmins Sets the price sources for given list of assets. This method can only be called by a POOL\_ADMIN or ASSET\_LISTING\_ADMIN. Please look at the [ACLManager](https://docs.tydro.com/developers/smart-contracts/aclmanager) contract for further details on system roles. **Input Parameters:** Name Type Description assets address\[\] The addresses of the assets for which source is being set sources address\[\] The address of the source of each asset. Length of assets and sources array should be same #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#setfallbackoracle) setFallbackOracle Copy function setFallbackOracle(address fallbackOracle) external override onlyAssetListingOrPoolAdmins Sets/updates the fallbackOracle. This method can only be called by a POOL\_ADMIN or ASSET\_LISTING\_ADMIN. Please look at the [ACLManager](https://docs.tydro.com/developers/smart-contracts/aclmanager) contract for further details on system roles. **Input Parameters:** Name Type Description fallbackOracle address The address of the fallback oracle ### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#getassetprice) getAssetPrice Copy function getAssetPrice(address asset) public view override returns (uint256) Returns the price of the supported asset in [BASE\_CURRENCYarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/interfaces/IPriceOracleGetter.sol) of the Tydro market in wei. **Input Parameters:** Name Type Description asset address The address of the asset **Return Values:** Type Description uint256 The price of the asset in BASE\_CURRENCY of the Tydro market in wei #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#getassetsprices) getAssetsPrices Copy function getAssetsPrices(address[] calldata assets) external view override returns (uint256[] memory) Returns a list of prices from a list of the supported assets addresses in [BASE\_CURRENCYarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/interfaces/IPriceOracleGetter.sol) of the Tydro market. All prices are in wei. **Input Parameters:** Name Type Description assets address\[\] The list of assets addresses for which price is being queried **Return Values:** Type Description uint256\[\] The prices of the given assets in BASE\_CURRENCY of the Tydro market in wei #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#getsourceofasset) getSourceOfAsset Copy function getSourceOfAsset(address asset) external view override returns (address) Returns the address of the price source for an asset address. **Input Parameters:** Name Type Description asset address The address of the asset **Return Values:** Type Description address The address of the source #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#getfallbackoracle) getFallbackOracle Copy function getFallbackOracle() external view returns (address) Returns the address of the fallback oracle. **Return Values:** Type Description address The address of the fallback oracle [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#priceoraclesentinel) PriceOracleSentinel ----------------------------------------------------------------------------------------------------------------- The PriceOracleSentinel contract validates if the operations are allowed depending on the PriceOracle health. This feature introduces a grace period for liquidations and disables borrowing under specific circumstances. This feature has been specifically designed for L2s to handle eventual downtime of the sequencer (but can be extended to handle other cases, even on L1s, in the future). Once the PriceOracle gets up after an outage or downtime, users can make their positions healthy during a grace period. The PriceOracle is considered healthy once its completely up and the grace period has passed. The source code is available on [Githubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/misc/PriceOracleSentinel.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#write-methods-1) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#setsequenceroracle) setSequencerOracle Copy function setSequencerOracle(address newSequencerOracle) external onlyPoolAdmin Updates the address of the sequencer oracle. This method can only be called by PoolAdmin. This method can only be called by the _Role Admin_, responsible for managing the [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) role. **Input Parameters:** Name Type Description newSequencerOracle address The address of the new Sequencer Oracle to be set #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#setgraceperiod) setGracePeriod Copy function setGracePeriod(uint256 newGracePeriod) public onlyRiskOrPoolAdmins Updates the duration of the grace period. Can only be called by PoolAdmin or RiskAdmin. **Input Parameters:** Name Type Description newGracePeriod uint256 The duration of new grace period in seconds ### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#view-methods-1) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#isborrowallowed) isBorrowAllowed Copy function isBorrowAllowed() external view override returns (bool) Returns true if the borrow operation is allowed. The operation is not allowed when PriceOracleis down or the grace period has not passed. **Return Values:** Type Description bool Returns true if the borrow operation is allowed (the PriceOracle is up and grace period has passed), false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#isliquidationallowed) isLiquidationAllowed Copy function isLiquidationAllowed() external view override returns (bool) Returns true if the liquidation operation is allowed. The operation is not allowed when PriceOracle is down or the grace period has not passed. **Return Values:** Type Description bool Returns true if the liquidation operation is allowed (the PriceOracle is up and grace period has passed), false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#getsequenceroracle) getSequencerOracle Copy function getSequencerOracle() external view returns (address) Returns the SequencerOracle. **Return Values:** Type Description address The address of the sequencer oracle contract #### [hashtag](https://docs.tydro.com/developers/smart-contracts/oracles#getgraceperiod) getGracePeriod Copy function getGracePeriod() external view returns (uint256) Returns the grace period. **Return Values:** Type Description uint256 The duration of the grace period in seconds [PreviousACLManagerchevron-left](https://docs.tydro.com/developers/smart-contracts/aclmanager) [NextPool Addresses Providerchevron-right](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) Last updated 3 months ago --- # Credit Delegation | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FyFCA496EApU8nq29YPmA%252F63.png%3Falt%3Dmedia%26token%3D40e80cf7-4bef-44d3-bfa7-538c33f92125&width=768&dpr=3&quality=100&sign=ce7c9082&sv=2) Credit delegation allows a supplier to contribute liquidity to Tydro to earn interest, and delegate their borrowing power (i.e. their credit) to another address. The enforcement of the borrow position and its terms are agreed upon between the supplier (delegator) and the borrower (delegatee), which can happen either off-chain (via legal agreements) or on-chain (via smart contracts). This enables: * The delegator to earn extra yield on top of their base lending yield * The delegatee to access uncollateralized liquidity Borrowing by a delegatee must be consistent with the delegator’s eMode category. For example, if a delegator is in the STABLECOINS eMode: * Delegatee can only borrow assets within the STABLECOINS category * If a delegatee attempts to borrow a non-STABLECOIN asset (e.g. WETH), the transaction will revert Additionally, the delegatee cannot cause liquidation of the delegator. If a delegated borrow causes the delegator’s Health Factor to drop below the liquidation threshold, the transaction will fail. ### [hashtag](https://docs.tydro.com/developers/credit-delegation#approving-the-delegation) Approving the delegation The approveDelegation or delegationWithSig function on the [VariableDebtToken](https://docs.tydro.com/developers/smart-contracts/tokenization#variabledebttoken) contract must be called by the supplier (delegator), approving the borrower (delegatee) a certain amount. This is done for each debt token that needs to be delegated. The delegator does not need to already have supplied funds in the protocol to approveDelegation. However, **before** the delegatee executes borrow, there must be sufficient collateral supplied by delegator in the protocol. ### [hashtag](https://docs.tydro.com/developers/credit-delegation#borrowing-the-credit) Borrowing the credit The borrower (delegatee) calls the borrow function on the [Pool](https://docs.tydro.com/developers/smart-contracts/pool) , using the supplier's (delegator's) address in final parameter onBehalfOf. The borrower's available credit is reduced by the borrowed amount. ### [hashtag](https://docs.tydro.com/developers/credit-delegation#repaying-the-credit) Repaying the credit Anyone can repay the borrow position _OnBehalf_ of the user, by calling one of the following [Pool](https://docs.tydro.com/developers/smart-contracts/pool) functions - repay or repayWithPermit. The supplier (aka creditor) can also use the repayWithATokens function to repay a borrow position with their _aTokens_ of the underlying asset in the same pool. [PreviousPool Configuratorchevron-left](https://docs.tydro.com/developers/smart-contracts/pool-configurator) [NextTesting & Debuggingchevron-right](https://docs.tydro.com/developers/testing-and-debugging) Last updated 4 months ago --- # Pool Addresses Provider | Tydro Documentation The PoolAddressesProvider is the central registry of addresses for Tydro. It stores the addresses of all core modules and permissioned roles within a specific market. The PoolAddressesProvider also works as the admin of proxy contracts and can update their implementations when needed. For example: * Updating the address of the [ACLManager](https://docs.tydro.com/developers/smart-contracts/aclmanager) * Updating the implementation of the [Pool](https://docs.tydro.com/developers/smart-contracts/pool) This contract defines the initial holder of the [DEFAULT\_ADMIN\_ROLE](https://docs.tydro.com/developers/smart-contracts/aclmanager#acl_admin) , which is immutable once set. When interacting with the Pool, it is recommended to always fetch the address directly from the PoolAddressesProvider to ensure the correct implementation is used. The source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/configuration/PoolAddressesProvider.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#write-methods) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setmarketid) setMarketId Copy function setMarketId(string memory newMarketId) external override onlyOwner Updates the identifier of the Aave market by associating an id with a specific PoolAddressesProvider. This can be used to create an on-chain registry of pool addresses providers to identify and validate multiple Aave markets. **Input Parameters:** Name Type Description newMarketId string The new id of the market #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setaddress) setAddress Copy function setAddress(bytes32 id, address newAddress) external override onlyOwner Sets the address of the protocol contract stored at the given id, replacing the address saved in the addresses map. For example, utils.keccak256(utils.toUtf8Bytes("INCENTIVES\_CONTROLLER")), is set to the address of INCENTIVES\_CONTROLLER. Use this function carefully, as it will do a hard replacement of the current address in the addresses map. **Input Parameters:** Name Type Description id bytes32 keccak256 hash of UTF8Bytes string representing contract newAddress address The new address to be set corresponding to the id #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setaddressasproxy) setAddressAsProxy Copy function setAddressAsProxy(bytes32 id, address newImplementationAddress) external override onlyOwner Updates the implementation address of a proxy contract with a specified id. If there is no proxy registered, it will instantiate one and set the implementation as the newImplementationAddress. Use this function carefully, only for ids that do not have an explicit setter function in order to avoid unexpected consequences. **Input Parameters:** Name Type Description id bytes32 The id of the proxy contract newImplementationAddress address The address of new implementation contract corresponding to the proxy #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setpoolimpl) setPoolImpl Copy function setPoolImpl(address newPoolImpl) external override onlyOwner Updates the implementation of the [Pool](https://docs.tydro.com/developers/smart-contracts/pool) contract, or creates a proxy. **Input Parameters:** Name Type Description newPoolImpl address The address of new Pool implementation contract #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setpoolconfiguratorimpl) setPoolConfiguratorImpl Copy function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external override onlyOwner Updates the implementation of the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract, or creates a proxy. **Input Parameters:** Name Type Description newPoolConfiguratorImpl address The address of new PoolConfigurator implementation contract #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setpriceoracle) setPriceOracle Copy function setPriceOracle(address newPriceOracle) external override onlyOwner Updates the address of the price oracle. **Input Parameters:** Name Type Description newPriceOracle address The address of new price oracle #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setaclmanager) setACLManager Copy function setACLManager(address newAclManager) external override onlyOwner Updates the address of the Access Control List Manager. **Input Parameters:** Name Type Description newAclManager address The address of the new ACLManager #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setacladmin) setACLAdmin Copy function setACLAdmin(address newAclAdmin) external override onlyOwner Updates the address of the Access Control List Admin. **Input Parameters:** Name Type Description newAclAdmin address The address of new ACLAdmin #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setpriceoraclesentinel) setPriceOracleSentinel Copy function setPriceOracleSentinel(address newPriceOracleSentinel) external override onlyOwner Updates the address of the price oracle sentinel. **Input Parameters:** Name Type Description newPriceOracleSentinel address The address of new PriceOracleSentinel #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#setpooldataprovider) setPoolDataProvider Copy function setPoolDataProvider(address newDataProvider) external override onlyOwner Updates the address of the data provider. **Input Parameters:** Name Type Description newDataProvider address The address of new DataProvider ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getmarketid) getMarketId Copy function getMarketId() external view override returns (string memory) Returns the market id of the associated Tydro market. **Return Values:** Type Description string A string representation of the market id #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getaddress) getAddress Copy function getAddress(bytes32 id) public view override returns (address) Returns the address of protocol contract stored at the given id. The returned address might be an EOA or a contract, which may be proxied. It will return ZERO if there is no registered address with the given id. **Input Parameters:** Name Type Description id bytes32 The id. For example, the Protocol Data Provider uses id 0x1 **Return Values:** Type Description address The address associated with the id passed **Example:** Copy // Get address of incentive controllerimport { utils } from "@ethers/lib/utils"; const id = utils.keccak256(utils.toUtf8Bytes("INCENTIVES_CONTROLLER"));const address = poolAddressProvider.getAddress(id); #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getpool) getPool Copy function getPool() external view override returns (address) Returns the address of the latest Pool proxy contract. **Return Values:** Type Description address The address of the associated Pool proxy #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getpoolconfigurator) getPoolConfigurator Copy function getPoolConfigurator() external view override returns (address) Returns the address of the PoolConfigurator proxy. Used for configuration methods, like init reserves or update token implementation etc, of the market. **Return Values:** Type Description address The PoolConfigurator proxy address #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getpriceoracle) getPriceOracle Copy function getPriceOracle() external view override returns (address) Returns the address of the Price Oracle used by the market. **Return Values:** Type Description address The address of the price oracle used by the associated market #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getaclmanager) getACLManager Copy function getACLManager() external view override returns (address) Returns the address of the Access Control List Manager (ACLManager) that manages the system role of the market. **Return Values:** Type Description address The address of the ACLManger contract managing the system role of the associated market #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getacladmin) getACLAdmin Copy function getACLAdmin() external view override returns (address) Returns the address of the Access Control List Admin (ACLAdmin) of the market which holds the DEFAULT\_ADMIN\_ROLE in ACLManager. **Return Values:** Type Description address The address of the Access Control List admin of the associated market #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getpriceoraclesentinel) getPriceOracleSentinel Copy function getPriceOracleSentinel() external view override returns (address) Returns the address of the price oracle sentinel. **Return Values:** Type Description address The address of the PriceOracleSentinel of the associated market #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider#getpooldataprovider) getPoolDataProvider Copy function getPoolDataProvider() external view override returns (address) Returns the address of latest pool data provider. **Return Values:** Type Description address The address of the pool data provider of the associated market [PreviousOracleschevron-left](https://docs.tydro.com/developers/smart-contracts/oracles) [NextPool Configuratorchevron-right](https://docs.tydro.com/developers/smart-contracts/pool-configurator) Last updated 3 months ago --- # Risks | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FYwqu1YvajkrXJ9fPZTpm%252F65.png%3Falt%3Dmedia%26token%3Dfb232cb6-bde7-403b-bf07-79794b6ace39&width=768&dpr=3&quality=100&sign=35b7a360&sv=2) Tydro offers non-custodial access to onchain liquidity but, like any DeFi system, it carries certain risks. Robust risk management measures, including smart contract audits and security frameworks, are in place to help mitigate them. Below is an overview of key risks and mitigation efforts. ### [hashtag](https://docs.tydro.com/resources/risks#smart-contract-risk) **Smart Contract Risk** Tydro’s lending engine is powered entirely by decentralised smart contracts. All actions including supplying, borrowing, and liquidation are executed through permissionless contracts, which reduces custodial risk. These contracts undergo audits and security reviews, but no system is entirely free from potential bugs or vulnerabilities. Users should remain aware of the risks involved when interacting with smart contracts. ### [hashtag](https://docs.tydro.com/resources/risks#oracle-risk) **Oracle Risk** Tydro relies on external oracles for price feeds and data, including redemption ratios for liquid staking tokens. If an oracle fails or is compromised, it could lead to incorrect asset valuations. To mitigate this, Tydro uses decentralised oracle networks such as Chainlink, which are designed to deliver tamper-resistant and reliable data. ### [hashtag](https://docs.tydro.com/resources/risks#collateral-risk) **Collateral Risk** The value and liquidity of assets used as collateral can fluctuate. A significant drop in collateral value may result in undercollateralisation or liquidation. To manage this, each asset listed on Tydro is configured with loan-to-value ratios and liquidation thresholds that reflect current market conditions. ### [hashtag](https://docs.tydro.com/resources/risks#network-bridge-risk) Network / Bridge Risk Tydro is deployed across multiple blockchains. While the protocol does not depend on cross-chain bridges to move liquidity, multichain deployment increases exposure to network-specific risks such as congestion, downtime, or chain vulnerabilities. These risks are assessed before expanding to new networks. For additional information on Tydro risk management, see Security & Audits. [PreviousTesting & Debuggingchevron-left](https://docs.tydro.com/developers/testing-and-debugging) [NextAddresseschevron-right](https://docs.tydro.com/resources/addresses) Last updated 3 months ago --- # Addresses | Tydro Documentation Name Address TydroProtocolDataProvider 0x96086C25d13943C80Ff9a19791a40Df6aFC08328 ACLAdmin 0x1dF462e2712496373A347f8ad10802a5E95f053D ACLManager 0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809 Collector 0x9138E2cAdFEB23AFFdc0419F2912CaB8F135dba9 ConfigEngine 0xea9989569Cf2D860597b4d649c9A963c15ab84fa ATokenInstance 0xd8247C7926841337E8adf9fD9E87026992C45062 DefaultIncentivesController 0xD93e3Ae8f69D04d484d1652Ca569d4b0522414DF VaraibleDebtToken 0x294daB91f3539f5a74Ed995a59235eE62A14A345 Dustbin 0xb50881a9e7Ca0d1c08A59f4da1dE2f3D75B1E34E EmissionManager 0x9CbcEf2c44cF28ff2aa36Bff7BaB315398209A79 L2Encoder 0x988B5d3863bdEE83339Be41cD31344Dfd9FD197c TydroOracle 0x4758213271BFdC72224A7a8742dC865fC97756e1 Pool 0x2816cf15F6d2A220E789aA011D5EE4eB6c47FEbA PoolAddressesProvider 0x4172E6aAEC070ACB31aaCE343A58c93E4C70f44D PoolAddressesProviderRegistry 0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741 PoolConfigurator 0x4f221e5c0B7103f7e3291E10097de6D9e3BfC02d PoolConfiguratorInstance 0xe892E40C92c2E4D281Be59b2E6300F271d824E75 L2PoolInstance 0x2aB3580a805fB10CbAd567212C70e26C1B6769eC StataFactory 0x5362dBb1e601abF3a4c14c22ffEdA64042E5eAA3 UIIncentiveDataProvider 0x25Ec457d1778b0E5316e7f38f3c22baF413F1A8C UIPoolDataProvider 0x39bc1bfDa2130d6Bb6DBEfd366939b4c7aa7C697 WalletBalanceProvider 0xB1532b76D054c9F9E61b25c4d91f69B4133E4671 WETHGateway 0xDe090EfCD6ef4b86792e2D84E55a5fa8d49D25D2 BorrowLogic 0xFeD9871528E713B5038c4c44BbE7a315f56cAdc6 EModeLogic 0xD1bddC05A3BB5A7907d82A1b4F1E21dBCE69c3d5 FlashLoanLogic 0x5e84CEe2afb7B37d2AB14722C39A7c1C26F5B0BB LiquidationLogic 0x36Ae486289bB807C3C79A1427b9c3D934294ef43 PoolLogic 0xE51B69e5722Bf547866A4d7Bc190c6e81b626806 SupplyLogic 0x034Fd14b9Ae6bB066a1F9f85A55e990b0b25c168 [PreviousRiskschevron-left](https://docs.tydro.com/resources/risks) [NextRisk Parameterschevron-right](https://docs.tydro.com/resources/risk-parameters) Last updated 4 months ago --- # Incentives | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FxIh0XlhTqKN89goIi6y6%252F74.png%3Falt%3Dmedia%26token%3D4cb5d364-dbdd-4cd6-8ffe-726b21a72966&width=768&dpr=3&quality=100&sign=640929d4&sv=2) Incentives within Tydro encourage active participation from both suppliers and borrowers, enhancing liquidity and the overall efficiency of the system. Incentive programs can originate from various sources, including ecosystem-aligned initiatives and external contributors interested in supporting liquidity for specific reserves. **$INK Rewards** $INK is the native token of the Ink ecosystem. Users who supply or borrow eligible assets on Tydro earn INK rewards proportional to their activity. Rewards accrue continuously and can be claimed through the Tydro interface. This incentive model is designed to strengthen market depth, encourage usage, and promote sustained participation in the protocol. It aligns user activity with the long-term health and growth of Tydro markets. #### [hashtag](https://docs.tydro.com/primitives/incentives#flexibility) Flexibility Additional incentive programs or changes to reward parameters may be introduced, such as adjusting emission rates, adding new incentivised markets, or launching ecosystem-funded campaigns to support liquidity. [PreviousReservechevron-left](https://docs.tydro.com/primitives/reserve) [NextOraclechevron-right](https://docs.tydro.com/primitives/oracle) Last updated 3 months ago --- # Testing & Debugging | Tydro Documentation This guide explains how to test and debug Tydro integrations effectively. ### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#testing) Testing There are two main ways to test with Tydro: 1. Using a **testnet** 2. Creating **fork networks** ### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#testnet) Testnet Tydro is available on the Sepolia testnet. You can connect to the Sepolia market through the Tydro app by enabling testnet mode in the top-right corner. To get started: 1. Open the Sepolia test market in the Tydro app. 2. Use the Faucet tab to claim test tokens available in the market. 3. Supply those tokens into the protocol. 4. Try operations such as borrowing, repaying, and withdrawing to confirm functionality. #### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#fork-networks) Fork Networks A fork network replicates the state of a live chain, letting you test in a controlled sandbox that mirrors mainnet conditions. This is useful for scenarios that depend on deployed contracts or existing liquidity. Popular tools for forking include: * Tenderly: transaction simulations, debugging, and dashboards * Foundry: modular toolkit for smart contract development * Hardhat: local Ethereum development environment On a fork, you can fund your account by impersonating an address that holds tokens (findable via block explorers) and transferring assets. **Connecting a Fork to the UI** The Tydro app can also connect directly to a forked network. This requires setting specific variables through the browser console. See the integration guide for full instructions. **Debugging** When working with Tydro contracts, you may hit errors or failed transactions. This section covers error codes, debugging tools, and common issues. #### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#error-codes) Error Codes Tydro uses dedicated error codes to explain why a transaction reverted. Each protocol version defines them in its own `Errors.sol` file. * Tydro V3 Error Codes: `Errors.sol` * Tydro V2 Error Codes: `Errors.sol` Understanding these codes is essential for resolving failures. #### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#debugging-tools) Debugging Tools * Tenderly: Simulate transactions by providing `to`, `from`, `data`, and `value`. Step through execution, see error codes, and review stack traces. * Hardhat: Run a local chain, fork mainnet, log from Solidity, and inspect detailed stack traces. * Foundry: Portable toolkit with `forge` for testing/debugging contracts and simulating transactions. **Understanding “Gas Estimation Failed”** This error means the transaction would revert if executed. To debug: 1. Collect the transaction’s `to`, `from`, `data`, and `value`. 2. Simulate the call using Tenderly, Hardhat, or Foundry. 3. Identify the specific error code or exception. 4. Trace the call stack to pinpoint the issue. ### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#common-errors) Common Errors #### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#pool-interactions) Pool Interactions * Token Approval: Before supplying or repaying, you must approve the Tydro Pool to transfer your ERC-20 tokens. Call `approve()` on the token contract with the Pool as spender. * Insufficient Collateral: Borrowing requires enough collateral at or above the required Loan-to-Value (LTV). Supply additional assets or check your ratios. * Borrow Cap Reached: If an asset’s borrow cap is maxed out, no new borrows are possible until positions are repaid or more liquidity is supplied. #### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#loan-to-value-0-ltv0) Loan To Value = 0% (LTV0) If a reserve’s LTV is set to 0%, the asset behaves differently: * It does not contribute to borrowing power. * It cannot be enabled as collateral. * If received via transfer, it won’t auto-enable as collateral. * To withdraw other assets, you must first disable LTV0 assets as collateral (via `Pool.setUserUseReserveAsCollateral`) or fully withdraw them. #### [hashtag](https://docs.tydro.com/developers/testing-and-debugging#wrappedtokengateway) WrappedTokenGateway When dealing with ETH in Tydro, the WrappedTokenGateway handles wrapping/unwrapping ETH into WETH. Common issues include: * Not sending ETH along with a deposit transaction * Calling the wrong function for wrapping/unwrapping Check the WrappedTokenGateway docs for full usage and potential revert cases. [PreviousCredit Delegationchevron-left](https://docs.tydro.com/developers/credit-delegation) [NextRiskschevron-right](https://docs.tydro.com/resources/risks) Last updated 3 months ago --- # Code Licensing | Tydro Documentation Tydro, a fork of the Aave Protocol operates on decentralized blockchain networks, with smart contracts that are self-executing and publicly auditable. These smart contracts and peripheral interfaces are licensed to define and regulate the use of the underlying code. The code exists across multiple GitHub repositories, and below are examples of some key licenses that apply to different Aave components: * **Aave v3.3 Smart Contracts**: Business Source License 1.1 permits non-commercial use and modification, restricting competitive use for four years, with a transition to the MIT License on March 6, 2027​. ([GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/LICENSE) ) * **Aave v3.2 Smart Contracts**: Business Source License 1.1 permits non-commercial use and modification, restricting competitive use for four years, with a transition to the MIT License on March 6, 2027​. ([GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/LICENSE) ) * **GHO Stablecoin**: MIT License grants free and unrestricted rights to use, copy, modify, and distribute the software, provided the original copyright notice and license are included. The software is provided "as is," with no warranties or liabilities for any issues arising from its use. ([GitHubarrow-up-right](https://github.com/aave/gho-core/blob/main/LICENSE) ) * **Aave v2 Smart Contracts**: GNU Affero General Public License ([GitHubarrow-up-right](https://github.com/aave/protocol-v2/blob/master/LICENSE.md) ) * **Aave v1 Smart Contracts**: GNU Affero General Public License ([GitHubarrow-up-right](https://github.com/aave/aave-protocol/blob/master/LICENSE.md) ) * **Aave Labs Interface**: All Rights Reserved. ([GitHubarrow-up-right](https://github.com/aave/interface/blob/main/LICENSE.md) ) [PreviousRisk Parameterschevron-left](https://docs.tydro.com/resources/risk-parameters) [NextBridge to INKchevron-right](https://docs.tydro.com/resources/bridge-to-ink) Last updated 4 months ago --- # Risk Parameters | Tydro Documentation **Parameter** **KBTC** **USDG** **USDT0** **WETH** Isolation Mode No No No No Borrowable Yes Yes Yes Yes Collateral Enabled Yes No Yes Yes Supply Cap 1,500 50,000,000 250,000,000 40,000 Borrow Cap 200 40,000,000 220,000,000 10,000 Debt Ceiling \- \- \- \- LTV 72% \- 75% 80% LT 77% \- 78% 83% Liquidation Bonus 7.5% \- 4.5% 7.5% Liquidation Protocol Fee 10% \- 10% 10% Variable Base 0% 0% 0% 0% Variable Slope1 4.0% 5.5% 5.5% 2.7% Variable Slope2 80% 50% 40% 40% Uoptimal 45% 80% 90% 90% Reserve Factor 50% 10% 10% 15% [PreviousAddresseschevron-left](https://docs.tydro.com/resources/addresses) [NextCode Licensingchevron-right](https://docs.tydro.com/resources/code-licensing) Last updated 4 months ago --- # Web3 | Tydro Documentation Web3 is the next evolution of the internet, where people have ownership and control over their data, digital identity, and online relationships. Together, these elements form what is often called social capital. In Web2, companies like Amazon, Google, and Meta store user data on private servers and monetise it by selling to advertisers. While this model created free and easy-to-use applications, it also led to issues such as privacy loss, data manipulation, and limited opportunities for users to benefit directly from their activity. Web3 addresses these challenges by using blockchain technology, which is designed around user ownership. People can monetise their data on their own terms, move their profiles and assets across platforms, and interact on a more equal footing with applications. The result is a more open and balanced internet, where users have both a stake and a voice. [hashtag](https://docs.tydro.com/resources/web3#blockchain) Blockchain --------------------------------------------------------------------------- A blockchain is a decentralised, distributed ledger that records and verifies transactions across a network of computers. Unlike traditional databases controlled by central authorities, a blockchain is maintained collectively by its participants (nodes), each of which stores a complete copy of the ledger. Transactions are grouped into units called blocks. Once validated by the network through consensus, a block is added sequentially to the chain. Each block references the one before it, creating a chronological record that is tamper-resistant and transparent. Altering past data would require rewriting all subsequent blocks with majority approval, making the system highly secure. [hashtag](https://docs.tydro.com/resources/web3#smart-contracts) Smart Contracts ------------------------------------------------------------------------------------- Smart contracts are programs that automatically execute predefined actions when conditions are met, such as transferring tokens or updating balances. They eliminate the need for intermediaries, making transactions faster, cheaper, and less prone to error or manipulation. Smart contracts run on decentralised networks like Ethereum, where their code is executed deterministically by all nodes. This guarantees that contracts run exactly as written, providing both transparency and immutability. As a result, smart contracts are a foundation for decentralised applications in areas like finance, identity, and governance. [hashtag](https://docs.tydro.com/resources/web3#defi) DeFi --------------------------------------------------------------- DeFi uses blockchains and smart contracts to provide financial services without centralised intermediaries such as banks or brokers. The goal is to create a system that is open, transparent, and accessible to anyone with an internet connection. In DeFi, transactions are validated by decentralised networks instead of middlemen. This reduces costs, lowers barriers to entry, and increases efficiency. DeFi applications first grew on Ethereum and now extend to Layer 2 networks like Arbitrum, Optimism, and zkSync, offering faster and cheaper transactions. [hashtag](https://docs.tydro.com/resources/web3#stablecoins) Stablecoins ----------------------------------------------------------------------------- Stablecoins are digital assets designed to maintain a stable value relative to a reference asset, usually a fiat currency like the US dollar. They are widely used for payments, remittances, trading, and as safe havens during volatility. Common use cases: * Remittances: Faster, cheaper cross-border transfers. * DeFi: Used for supplying, borrowing, and yield strategies. * Hedging: Moving out of volatile assets without converting to fiat. * Payments: Merchants can accept them without price risk. Types of stablecoins: * Fiat-collateralised: Backed 1:1 by reserves of fiat (e.g., USDT, USDC). * Decentralised: Issued and managed by smart contracts using on-chain collateral (e.g., GHO). * Algorithmic: Maintain their peg through supply adjustments like minting and burning. Stablecoins serve as a bridge between traditional finance and decentralised systems, enabling predictable value transfer inside Web3. [PreviousBridge to INKchevron-left](https://docs.tydro.com/resources/bridge-to-ink) [NextGlossarychevron-right](https://docs.tydro.com/resources/glossary) Last updated 3 months ago --- # Bridge to INK | Tydro Documentation To participate in the Tydro ecosystem, users may need to transfer assets from other blockchains into Ink. This is achieved through cross-chain bridges, which are independent protocols that enable tokens to move between networks. Bridging allows users to bring liquidity securely into Ink while maintaining compatibility with Tydro and other Ink-based applications. The Ink protocol does not operate a native bridge. All bridging is managed by third-party services that have added support for the Ink network. Bridges use different mechanisms to move liquidity. Some rely on liquidity pools and relayers, while others use lock and mint or burn and redeem models. Each approach carries its own trade-offs in terms of speed, cost, security, and trust. Users should select the provider that best matches their needs. Here are some of the ways you can bridge assets into Ink: #### [hashtag](https://docs.tydro.com/resources/bridge-to-ink#bungee-exchange) Bungee Exchange Bungee is an aggregator of multiple bridges, providing a simple and unified interface for transferring assets to INK. It automatically routes your transfer through the most efficient bridge, minimizing cost and time. Best For: Users who want to bridge quickly and cheaply without manually selecting routes or understanding underlying protocols. Bridge to INK: [Bungee Bridgearrow-up-right](https://www.bungee.exchange/?fromChainId=10&fromTokenAddress=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&toChainId=57073&toTokenAddress=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) ​ #### [hashtag](https://docs.tydro.com/resources/bridge-to-ink#superbridge) Superbridge Superbridge focuses on simplicity and user experience, offering a streamlined interface for bridging ETH and other assets to INK. It abstracts the technical details while maintaining reliability and minimal slippage. Best For:Users bridging ETH or native assets who want a clean UX and little slippage. Bridge to INK: [Superbridgearrow-up-right](https://superbridge.app/optimism) ​ #### [hashtag](https://docs.tydro.com/resources/bridge-to-ink#usdt0-native-transfer) USDT0 Native Transfer USDT0 is a native stablecoin transfer mechanism designed for direct movement of USDT between supported Superchain networks and INK. It eliminates traditional bridging complexity by using canonical token contracts on each network, ensuring instant settlement and no wrapping or synthetic assets. Best For: Users who want to bridge stablecoins such as USDT or USDT0 into INK quickly, securely, and without conversion risk. Bridge to INK: [USDT0 Sitearrow-up-right](https://usdt0.to/transfer?source=ethereum&destination=ink) ​ #### [hashtag](https://docs.tydro.com/resources/bridge-to-ink#eco-bridge) Eco Bridge Eco focuses on simplicity and user experience. It provides a straightforward interface for moving assets into Ink without exposing much of the underlying complexity. Eco is often the best choice for users who want to bridge stablecoins only. Bridge to INK: [Eco Portalarrow-up-right](https://portal.eco.com/) ​ #### [hashtag](https://docs.tydro.com/resources/bridge-to-ink#across) Across Across is optimised for speed and low cost, particularly when transferring from Ethereum mainnet and Layer 2 networks. It relies on a relayer network that fronts liquidity to deliver funds quickly, with settlement finalised on the source chain later. Across is well-suited for users who want fast transfers from rollups with minimal fees Bridge to INK: [Across Bridge arrow-up-right](https://app.across.to/bridge?) #### [hashtag](https://docs.tydro.com/resources/bridge-to-ink#eco-bridge-1) Aave (GHO Bridge) Aave is a leading DeFi protocol for lending and borrowing crypto assets. It also launched GHO, a decentralized stablecoin that users can mint by supplying collateral. GHO is available across multiple networks and supports native bridging via Aave’s cross-chain system. Best For: Purchasing or minting GHO and bridging it from Ethereum, Base, or Arbitrum to INK. Supported Assets: GHO Bridge to INK: [Aave Marketsarrow-up-right](https://app.aave.com/markets/) [hashtag](https://docs.tydro.com/resources/bridge-to-ink#bridge-comparison-table) **Bridge Comparison Table** ------------------------------------------------------------------------------------------------------------------ **Bridge** **Best For** **Supported Assets** **Approx. Fee** **Link** **Bungee** Cheapest, fastest option across multiple bridges ETH, USDT0, USDC, GHO Varies (auto-routed) [Bungee Bridgearrow-up-right](https://www.notion.so/Updated-Bridge-Doc-29759f6be93380b19c2cc71e83bfe0dc?pvs=21) **Superbridge** Bridging ETH from Ethereum mainnet with zero fees ETH, others ETH: **Free**; Others: 0.05% [Superbridgearrow-up-right](https://www.notion.so/Updated-Bridge-Doc-29759f6be93380b19c2cc71e83bfe0dc?pvs=21) **USDT0** Simple & safe USDT bridging with no wrapping USDT / USDT0 ~**0.1** [USDT0 Sitearrow-up-right](https://usdt0.to/transfer?source=ethereum&destination=ink) **Across** Fast ETH transfers from Layer 2s ETH Varies by network [Across Bridgearrow-up-right](https://www.notion.so/Updated-Bridge-Doc-29759f6be93380b19c2cc71e83bfe0dc?pvs=21) **Aave** \*\*Aave (GHO)\*\*Purchasing or minting **GHO** and bridging it to INKGHO GHO Varies by network [Aave Marketsarrow-up-right](https://app.aave.com/markets/) #### [hashtag](https://docs.tydro.com/resources/bridge-to-ink#tip-a-simple-way-to-get-started) **Tip: A Simple Way to Get Started** One of the smoothest ways to get major assets into Ink and start using Tydro is: 1. Bridge USDT to INK using [USDT0arrow-up-right](https://usdt0.to/transfer?source=ethereum&destination=ink) 2. Then, swap USDT0 for other tokens on [Velodrome (DEX)arrow-up-right](https://velodrome.finance/swap) This route minimizes steps and lets you access key assets on Ink with less friction. [PreviousCode Licensingchevron-left](https://docs.tydro.com/resources/code-licensing) [NextWeb3chevron-right](https://docs.tydro.com/resources/web3) Last updated 2 months ago --- # Tokenization | Tydro Documentation ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#atoken) AToken aTokens are tokens minted when assets are supplied to a Tydro market and burned when assets are withdrawn. They represent both the amount of crypto assets supplied and the yield earned on those assets. * The value of an aToken is pegged 1:1 to the underlying asset. * aTokens can be stored, transferred, or traded like standard ERC-20 tokens. * Yield is distributed directly to aToken holders by continuously increasing their wallet balance. The aToken contract is the interest-bearing token implementation for Tydro. It inherits from [ScaledBalanceTokenBasearrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol) and [EIP712Basearrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/tokenization/base/EIP712Base.sol) token contracts. All standard ERC-20 methods are implemented, including: * `balanceOf` * `transfer` * `transferFrom` * `approve` * `totalSupply` The `balanceOf` function always returns the most up-to-date user balance, combining both the principal supplied and the yield earned. The source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/tokenization/AToken.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#write-methods) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#initialize) initialize Copy function initialize( IPool initializingPool, address treasury, address underlyingAsset, IAaveIncentivesController incentivesController, uint8 aTokenDecimals, string calldata aTokenName, string calldata aTokenSymbol, bytes calldata params ) public virtual Called when aToken instance is initialized. **Input Parameters:** Name Type Description initializingPool IPool The address of the associated pool treasury address The address of the treasury underlyingAsset address The address of the underlying asset incentivesController IAaveIncentivesController The address of the incentives controller for this aToken aTokenDecimals uint8 The decimals of the underlying asset aTokenName string The name of the aToken aTokenSymbol string The symbol of the aToken params bytes A set of encoded parameters for additional initialization #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#mint) mint Copy function mint( address caller, address onBehalfOf, uint256 amount, uint256 index ) external virtual override onlyPool returns (bool) Mints amount aTokens to user. **Input Parameters:** Name Type Description caller address The address performing the mint onBehalfOf address The address of the user that will receive the minted aTokens amount uint256 The amount of tokens getting minted index uint256 The next liquidity index of the reserve **Return Values:** Type Description bool true if the the previous balance of the user was 0 #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#burn) burn Copy function burn( address from, address receiverOfUnderlying, uint256 amount, uint256 index ) external virtual override onlyPool In some instances, the mint event could be emitted from a burn transaction if the amount to burn is less than the interest that the user accrued. **Input Parameters:** Name Type Description from address The address from which the aTokens will be burned receiverOfUnderlying address The address that will receive the underlying asset amount uint256 The amount of tokens that will be burned index uint256 The next liquidity index of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#minttotreasury) mintToTreasury Copy function mintToTreasury(uint256 amount, uint256 index) external override onlyPool Mints aTokens to the reserve treasury. **Input Parameters:** Name Type Description amount uint256 The amount of tokens getting minted index uint256 The address that will receive the underlying asset #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#transferonliquidation) transferOnLiquidation Copy function transferOnLiquidation( address from, address to, uint256 value ) virtual override onlyPool Transfers aTokens in the event of a borrow being liquidated, in case the liquidator reclaims the aToken. **Input Parameters:** Name Type Description from address The address getting liquidated, current owner of the aTokens to address The recipient of aTokens value uint256 The amount of tokens getting transferred #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#transferunderlyingto) transferUnderlyingTo Copy function transferUnderlyingTo(address target, uint256 amount) external virtual override onlyPool Transfers the underlying asset to target. Used by the [Pool](https://docs.tydro.com/developers/smart-contracts/pool) to transfer assets in borrow(), withdraw() and flashLoan(). **Input Parameters:** Name Type Description user address The recipient of the underlying amount uint256 The amount getting transferred #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#handlerepayment) handleRepayment Copy function handleRepayment(address user, address onBehalfOf, uint256 amount) external virtual override onlyPool Handles the underlying received by the aToken after the transfer has been completed. The default implementation is empty as with standard ERC20 tokens, nothing needs to be done after the transfer is concluded. However in the future there may be aTokens that allow for example to stake the underlying to receive LM rewards. In that case, handleRepayment() would perform the staking of the underlying asset. **Input Parameters:** Name Type Description user address The user executing the repayment onBehalfOf address\` The address for which the borrow position is repaid amount uint256 The amount getting repaid #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#permit) permit Copy function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override Allows a user to permit another account (or contract) to use their funds using a signed message. This enables gas-less transactions and single approval/transfer transactions. Allow passing a signed message to approve spending. Implements the permit function as for EIP-2612. **Input Parameters:** Name Type Description owner address The owner of the funds spender address The spender of the funds value uint256 The amount the spender is permitted to spend deadline uint256 The deadline timestamp, use type(uint256).max for max/no deadline v uint8 The V signature parameter r bytes32 The R signature parameter s bytes32 The S signature parameter Example of signing and utilizing permit: Copy import { signTypedData_v4 } from "eth-sig-util"; import { fromRpcSig } from "ethereumjs-util"; // ... other imports import aTokenAbi from "./aTokenAbi.json"; // ... setup your web3 provider const aTokenAddress = "ATOKEN_ADDRESS"; const aTokenContract = new web3.eth.Contract(aTokenAbi, aTokenAddress); const privateKey = "YOUR_PRIVATE_KEY_WITHOUT_0x"; const chainId = 1; const owner = "OWNER_ADDRESS"; const spender = "SPENDER_ADDRESS"; const value = 100; // Amount the spender is permitted const nonce = 1; // The next valid nonce, use `_nonces()` const deadline = 1600093162; const permitParams = { types: { EIP712Domain: [\ { name: "name", type: "string" },\ { name: "version", type: "string" },\ { name: "chainId", type: "uint256" },\ { name: "verifyingContract", type: "address" },\ ], Permit: [\ { name: "owner", type: "address" },\ { name: "spender", type: "address" },\ { name: "value", type: "uint256" },\ { name: "nonce", type: "uint256" },\ { name: "deadline", type: "uint256" },\ ], }, primaryType: "Permit", domain: { name: "aTOKEN_NAME", version: "1", chainId: chainId, verifyingContract: aTokenAddress, }, message: { owner, spender, value, nonce, deadline, }, }; const signature = signTypedData_v4(Buffer.from(privateKey, "hex"), { data: permitParams, }); // The signature can now be used to execute the transaction const { v, r, s } = fromRpcSig(signature); await aTokenContract.methods .permit({ owner, spender, value, deadline, v, r, s, }) .send() .catch((e) => { throw Error(`Error permitting: ${e.message}`); }); #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#rescuetokens) rescueTokens Copy function rescueTokens( address token, address to, uint256 amount ) external override onlyPoolAdmin Rescue and transfer tokens locked in this contract. Only callable by [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager) . **Input Parameters:** Name Type Description token address The address of the token to address The address of the recipient amount uint256 The amount of token to transfer ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#balanceof) balanceOf Copy function balanceOf(address user) public view virtual override(IncentivizedERC20, IERC20) returns (uint256) Returns the amount of tokens owned by user. Overrides the base function. **Input Parameters:** Name Type Description user address The address of the user **Return Values:** Type Description uint256 The amount of tokens owned by user #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#totalsupply) totalSupply Copy function totalSupply() public view virtual override(IncentivizedERC20, IERC20 returns (uint256) Returns the amount of tokens in existence. Overrides the base function. **Return Values:** Type Description uint256 The amount of tokens in existence #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#reserve_treasury_address) RESERVE\_TREASURY\_ADDRESS Copy function RESERVE_TREASURY_ADDRESS() external view override returns (address) Returns the address of the Tydro treasury, controlled by Tydro, receiving the fees on this aToken. **Return Values:** Type Description address The address of the Aave treasury #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#underlying_asset_address) UNDERLYING\_ASSET\_ADDRESS Copy function UNDERLYING_ASSET_ADDRESS() external view override returns (address) Returns the address of the underlying reserve asset of this aToken (E.g. WETH for aWETH). **Return Values:** Type Description address The address of the underlying asset #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#domain_separator) DOMAIN\_SEPARATOR Copy function DOMAIN_SEPARATOR() public view override(IAToken, EIP712Base) returns (bytes32) Get the domain separator for the token at the current chain. Return cached value if chainId matches cache, otherwise recomputes separator. Overrides the base function to fully implement IAToken. **Return Values:** Type Description bytes32 The domain separator of the token at current chain #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#nonces) nonces Copy function nonces(address owner) public view override(IAToken, EIP712Base) returns (uint256) Returns the nonce value for address specified as parameter. This is the nonce used when calling permit(). Overrides the base function to fully implement IAToken. **Input Parameters:** Name Type Description owner address The address of the owner **Return Values:** Type Description uint256 The nonce of the owner Example: Copy const token = new Contract(aTokenAddress, aToken.abi, provider); await token.nonces(user); ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#pure-methods) Pure Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#getrevision) getRevision Copy function getRevision() internal pure virtual override returns (uint256) Returns the revision number of the contract. Needs to be defined in the inherited class as a constant. Returns 0x1. **Return Values:** Type Description uint256 The revision number [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#staticatokenfactory) StaticATokenFactory ---------------------------------------------------------------------------------------------------------------------- The StataTokenFactory is a factory and registry contract that manages all deployed StataToken instances for a specified Aave pool. It allows deploying new StataToken instances on demand and validates that there is only one StataToken instance per underlying asset. This contract maintains a mapping between underlying assets and their corresponding StataTokenaddresses. StataTokens are ERC-4626 compliant tokens that wrap Aave's aTokens to provide a non-rebasing yield accrual mechanism. The source code is available on Aave's [GitHub.arrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/tokenization/StataTokenFactory.sol) ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#write-methods-1) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#initialize-1) initialize Copy function initialize() external initializer Initializes the StataTokenFactory contract. This function is part of the Initializable pattern and is required to initialize the contract after deployment. In this implementation, it does not perform any actions. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#createstatatokens) createStataTokens Copy function createStataTokens(address[] memory underlyings) external returns (address[] memory) Creates new StataToken instances for the given underlying assets if they do not already exist. For each provided underlying asset, the function checks if a StataToken already exists. If it does, the existing StataToken address is returned. If not, it deploys a new StataToken for that underlying asset, registers it, and returns the new address. **Input Parameters:** Name Type Description underlyings address\[\] An array of underlying asset addresses **Return Values:** Type Description address\[\] An array of StataToken addresses corresponding to the provided underlying assets **Emits:** * StataTokenCreated(address indexed stataToken, address indexed underlying) event for each new StataToken created. **Reverts:** * NotListedUnderlying(address underlying) if the underlying asset is not listed in the Aave pool. ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#view-methods-1) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#getstatatokens) getStataTokens Copy function getStataTokens() external view returns (address[] memory) Returns all StataToken instances deployed via this factory. **Return Values:** Type Description address\[\] An array of all StataToken contract addresses #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#getstatatoken) getStataToken Copy function getStataToken(address underlying) external view returns (address) Returns the StataToken address for a given underlying asset. **Input Parameters:** Name Type Description underlying address The address of the underlying asset **Return Values:** Type Description address The address of the corresponding StataToken; returns address(0) if not found #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#pool) POOL Copy function POOL() external view returns (IPool) Returns the address of the Aave pool associated with this factory. **Return Values:** Type Description IPool The address of the associated Aave pool #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#proxy_admin) PROXY\_ADMIN Copy function PROXY_ADMIN() external view returns (address) Returns the address of the proxy admin used for the StataToken proxies. **Return Values:** Type Description address The address of the proxy admin #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#transparent_proxy_factory) TRANSPARENT\_PROXY\_FACTORY Copy function TRANSPARENT_PROXY_FACTORY() external view returns (ITransparentProxyFactory) Returns the address of the transparent proxy factory used for creating new StataToken proxies. **Return Values:** Type Description ITransparentProxyFactory The address of the transparent proxy factory #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#stata_token_impl) STATA\_TOKEN\_IMPL Copy function STATA_TOKEN_IMPL() external view returns (address) Returns the address of the StataToken implementation used when deploying new StataTokeninstances. **Return Values:** Type Description address The address of the StataToken implementation [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#variabledebttoken) VariableDebtToken ------------------------------------------------------------------------------------------------------------------ Implements a variable debt token to track the borrowing positions of users at variable rate mode. transfer and approve functionalities are disabled as variable debt tokens are non-transferable. The vToken value is pegged 1:1 to the value of underlying borrowed asset and represents the current total amount owed to the protocol i.e. principal debt + interest accrued. The VariableDebtToken contract inherits the [DebtTokenBasearrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/tokenization/base/DebtTokenBase.sol) and [ScaledBalanceTokenBasearrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol) token contracts. The source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/tokenization/VariableDebtToken.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#write-methods-2) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#initialize-2) initialize Copy function initialize( IPool initializingPool, address underlyingAsset, IAaveIncentivesController incentivesController, uint8 debtTokenDecimals, string memory debtTokenName, string memory debtTokenSymbol, bytes calldata params ) external virtual Called when variableDebtToken instance is initialised. **Input Parameters:** Name Type Description initializingPool IPool The pool contract that is initializing this contract underlyingAsset address The address of the underlying asset of this aToken (E.g. WETH for aWETH) incentivesController IAaveIncentivesController The smart contract managing potential incentives distribution debtTokenDecimals uint8 The decimals of the variableDebtToken, same as the underlying asset's debtTokenName string The name of the variable debt token debtTokenSymbol string The symbol of the variable debt token params bytes A set of encoded parameters for additional initialization #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#mint-1) mint Copy function mint( address user, address onBehalfOf, uint256 amount, uint256 index ) external virtual override onlyPool returns (bool, uint256) Mints the variable debt token to the onBehalfOf address. **Input Parameters:** Name Type Description user address The address receiving the borrowed underlying, being the delegatee in case of credit delegate, or same as onBehalfOf otherwise onBehalfOf address The address receiving the variable debt tokens amount uint256 The amount of variable debt tokens to mint index uint256 The variable debt index of the reserve **Return Values:** Type Description bool true if the previous balance of the user is 0, false otherwise uint256 The scaled total debt of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#burn-1) burn Copy function burn( address from, uint256 amount, uint256 index ) external virtual override onlyPool returns (uint256) Burns user variable debt. In some instances, a burn transaction will emit a mint event if the amount to burn is less than the interest that the user accrued. **Input Parameters:** Name Type Description from address The address from which the debt will be burned amount uint256 The amount of debt tokens that will be burned index uint256 The variable debt index of the reserve **Return Values:** Type Description uint256 The scaled total debt of the reserve ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#view-methods-2) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#underlying_asset_address-1) UNDERLYING\_ASSET\_ADDRESS Copy function UNDERLYING_ASSET_ADDRESS() external view override returns (address) Returns the address of the underlying asset of this variableDebtToken (e.g. WETH for variableDebtWETH) **Return Values:** Type Description address The address of the underlying asset #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#balanceof-1) balanceOf Copy function balanceOf(address account) public view virtual override returns (uint256) Returns the amount of tokens owned by account - the most up to date accumulated debt (principal + interest) of the user. Standard ERC20 function. **Input Parameters:** Name Type Description account address The balance of this address **Return Values:** Type Description uint256 The amount of tokens owned by account #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#totalsupply-1) totalSupply Copy function totalSupply() public view virtual override returns (uint256) Returns the amount of tokens in existence - the most up to date total debt accrued by all protocol users for that specific variable rate of debt token. Standard ERC20 function. **Return Values:** Type Description uint256 The amount of tokens in existence ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#pure-methods-1) Pure Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#getrevision-1) getRevision Copy function getRevision() internal pure virtual override returns (uint256) Returns the revision number of the contract. Needs to be defined in the inherited class as a constant. Returns 0x1. **Return Values:** Type Description uint256 The revision number ### [hashtag](https://docs.tydro.com/developers/smart-contracts/tokenization#not-supported-operations) NOT SUPPORTED OPERATIONS Being non-transferrable, the variable debt token does not implement any of the standard ERC20 functions for transfer and allowance. The following functions below will revert with the error code 80, OPERATION\_NOT\_SUPPORTED: transfer, allowance, approve, transferFrom, increaseAllowance, decreaseAllowance. [PreviousIncentiveschevron-left](https://docs.tydro.com/developers/smart-contracts/incentives) [NextInterest Rate Strategychevron-right](https://docs.tydro.com/developers/smart-contracts/interest-rate-strategy) Last updated 3 months ago --- # Pool Configurator | Tydro Documentation The PoolConfigurator contract contains the configuration methods for Tydro. These methods control how reserves and markets are set up and maintained. The write methods exposed by PoolConfigurator are restricted to specific permissioned roles, which are managed by the [ACLManager](https://docs.tydro.com/developers/smart-contracts/aclmanager) The source code is available on [Aave's Githubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/pool/PoolConfigurator.sol) ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#write-methods) Write Methods ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#only-asset-listing-or-pool-admins-methods) Only Asset Listing Or Pool Admins Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#initreserves) initReserves Copy function initReserves(ConfiguratorInputTypes.InitReserveInput[] calldata input) external override onlyAssetListingOrPoolAdmins Initialzes multiple reserves using the array of initialization parameters as input. **Input Parameters:** Name Type Description input ConfiguratorInputTypes.InitReserveInput\[\] The array of initialization parameters The [ConfiguratorInputTypes.InitReserveInput\[\]arrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol) struct is composed of the following fields: Name Type Description aTokenImpl address The address of the aToken contract implementation variableDebtTokenImpl address The address of the variable debt token contract useVirtualBalance bool true if reserve is utilising virtual balance accounting interestRateStrategyAddress address The address of the interest rate strategy contract for this reserve underlyingAsset address The address of the underlying asset treasury address The address of the treasury incentivesController address The address of the incentives controller for this aToken aTokenName string The name of the aToken aTokenSymbol string The symbol of the aToken variableDebtTokenName string The name of the variable debt token variableDebtTokenSymbol string The symbol of the variable debt token params bytes A set of encoded parameters for additional initialization interestRateData bytes Encoded interest rate strategy data ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#only-emergency-admin-methods) Only Emergency Admin Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setpoolpause) setPoolPause Copy function setPoolPause(bool paused) external override onlyEmergencyOrPoolAdmin Pauses or unpauses all the protocol reserves. In the paused state all the protocol interactions are suspended. **Input Parameters:** Name Type Description paused bool true if the protocol needs to be paused, otherwise false ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#only-emergency-or-pool-admin-methods) Only Emergency Or Pool Admin Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreservepause) setReservePause Copy function setReservePause(address asset, bool paused) public override onlyEmergencyOrPoolAdmin Pauses a reserve. A paused reserve does not allow any interaction (supply, borrow, repay, liquidate, atoken transfers). **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve paused bool true if pausing the reserve, false if unpausing the reserve ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#only-pool-admin-methods) Only Pool Admin Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#dropreserve) dropReserve Copy function dropReserve(address asset) external override onlyPoolAdmin Drops a reserve entirely. **Input Parameters:** Name Type Description asset address The address of the reserve to drop #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updateatoken) updateAToken Copy function updateAToken(ConfiguratorInputTypes.UpdateATokenInput calldata input) external override onlyPoolAdmin Updates the aToken implementation for the reserve. Takes the aToken update parameters as input. **Input Parameters:** Name Type Description input ConfiguratorInputTypes.UpdateATokenInput The aToken update parameters The [ConfiguratorInputTypes.UpdateATokenInputarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol) struct is composed of the following fields: Name Type Description asset address The address of the underlying asset of the reserve treasury address The address of the treasury incentivesController address The address of the incentives controller for this aToken name string The name of the aToken symbol string The symbol of the aToken implementation address The new aToken implementation params bytes A set of encoded parameters for additional initialization #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updatevariabledebttoken) updateVariableDebtToken Copy function updateVariableDebtToken(ConfiguratorInputTypes.UpdateDebtTokenInput calldata input) external override onlyPoolAdmin **Input Parameters:** Name Type Description input ConfiguratorInputTypes.UpdateDebtTokenInput The variableDebtToken update parameters The [ConfiguratorInputTypes.UpdateDebtTokenInputarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol) struct is composed of the following fields: Name Type Description asset address The address of the underlying asset of the reserve incentivesController address The address of the incentives controller for this variableDebtToken name string The name of the variableDebtToken symbol string The symbol of the variableDebtToken implementation address The new variableDebtToken implementation params bytes A set of encoded parameters for additional initialization #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveactive) setReserveActive Copy function setReserveActive(address asset, bool active) external override onlyPoolAdmin Activate or deactivate a reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve active bool true if the reserve needs to be active, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updatebridgeprotocolfee) updateBridgeProtocolFee Copy function updateBridgeProtocolFee(uint256 newBridgeProtocolFee) external override onlyPoolAdmin Updates the bridge fee collected by the protocol reserves. **Input Parameters:** Name Type Description newBridgeProtocolFee uint256 The part of the fee sent to the protocol treasury, expressed in bps #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveflashloaning) setReserveFlashLoaning Copy function setReserveFlashLoaning(address asset, bool enabled) external override onlyRiskOrPoolAdmins Enables or disables flash loans for a reserve. **Input Parameters:** Name Type Description asset address Address of the reserve asset enabled bool true to enable, false to disable #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updateflashloanpremiumtotal) updateFlashloanPremiumTotal Copy function updateFlashloanPremiumTotal(uint128 newFlashloanPremiumTotal) external override onlyPoolAdmin Updates the total flash loan premium. The premium is calculated on the total amount borrowed, and is expressed in bps. The total flash loan premium consists of two parts: * A part is sent to aToken holders as extra balance, and * A part is collected by the protocol reserves. **Input Parameters:** Name Type Description newFlashloanPremiumTotal uint128 The total flashloan premium #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#updateflashloanpremiumtoprotocol) updateFlashloanPremiumToProtocol Copy function updateFlashloanPremiumToProtocol(uint128 newFlashloanPremiumToProtocol) external override onlyPoolAdmin Updates the flash loan premium collected by protocol reserves. The premium to protocol is calculated on the total flashloan premium, and is expressed in bps. **Input Parameters:** Name Type Description newFlashloanPremiumToProtocol uint128 The part of the flashloan premium sent to the protocol treasury ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#only-risk-or-pool-admins-methods) Only Risk Or Pool Admins Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveborrowing) setReserveBorrowing Copy function setReserveBorrowing(address asset, bool enabled) external override onlyRiskOrPoolAdmins **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve enabled bool true if borrowing needs to be enabled, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#configurereserveascollateral) configureReserveAsCollateral Copy function configureReserveAsCollateral( address asset, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus ) external override onlyRiskOrPoolAdmins Configures the reserve collateralization parameters. All the values are expressed in bps. A value of 10000 results in 100.00%. The liquidationBonus is always above 100%. A value of 105% means the liquidator will receive a 5% bonus. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve ltv uint256 The loan to value of the asset when used as collateral liquidationThreshold uint256 The threshold at which loans using this asset as collateral will be considered undercollateralized liquidationBonus uint256 The bonus liquidators receive to liquidate this asset #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreservefreeze) setReserveFreeze Copy function setReserveFreeze(address asset, bool freeze) external override onlyRiskOrPoolAdmins Freeze or unfreeze a reserve. A frozen reserve doesn't allow any new supply or borrow but allows repayments, liquidations, rate rebalances and withdrawals. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve freeze bool true if the reserve needs to be frozen, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setborrowableinisolation) setBorrowableInIsolation Copy function setBorrowableInIsolation(address asset, bool borrowable) external override onlyRiskOrPoolAdmins Sets the borrowable in isolation flag for the reserve. When this flag is set to true, the asset will be borrowable against isolated collaterals and the borrowed amount will be accumulated in the isolated collateral's total debt exposure. Only assets of the same family (e.g. USD stablecoins) should be borrowable in isolation mode to keep consistency in the debt ceiling calculations. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve borrowable bool true if the asset should be borrowable in isolation, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreservefactor) setReserveFactor Copy function setReserveFactor(address asset, uint256 newReserveFactor) external override onlyRiskOrPoolAdmins Updates the reserve factor of a reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve newReserveFactor uint256 The new reserve factor of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setdebtceiling) setDebtCeiling Copy function setDebtCeiling(address asset, uint256 newDebtCeiling) external override onlyRiskOrPoolAdmins Sets the debt ceiling for an asset. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve newDebtCeiling uint256 The new debt ceiling #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setsiloedborrowing) setSiloedBorrowing Copy function setSiloedBorrowing(address asset, bool newSiloed) external override onlyRiskOrPoolAdmins Sets siloed borrowing for an asset **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve newSiloed bool The new siloed borrowing state - enable or disable siloed borrowing for the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setborrowcap) setBorrowCap Copy function setBorrowCap(address asset, uint256 newBorrowCap) external override onlyRiskOrPoolAdmins Updates the borrow cap of a reserve. Allows [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) and [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) to add/update cap on the total borrow that can be borrowed from the reserve. Once the borrow cap is reached, no more borrow positions for the given reserve asset can be initiated. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve newBorrowCap uint256 The new borrow cap of the reserve in whole tokens. A borrow cap of 0 signifies that there is no cap #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setsupplycap) setSupplyCap Copy function setSupplyCap(address asset, uint256 newSupplyCap) external override onlyRiskOrPoolAdmins Updates the supply cap of a reserve. Allows [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) and [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) to add/update liquidity supply cap on the reserve. Once the supply cap is reached, no more liquidity for the given reserve asset can be supplied to the pool. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve newSupplyCap uint256 The new supply cap of the reserve in whole tokens. A supply cap of 0 signifies that there is no cap #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#disableliquidationgraceperiod) disableLiquidationGracePeriod Copy function disableLiquidationGracePeriod(address asset) external override onlyEmergencyOrPoolAdmin Disables the liquidation grace period for a reserve. **Input Parameters** Name Type Description asset address Address of the reserve asset #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setliquidationprotocolfee) setLiquidationProtocolFee Copy function setLiquidationProtocolFee(address asset, uint256 newFee) external override onlyRiskOrPoolAdmins Updates the liquidation protocol fee of reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve newFee uint256 The new liquidation protocol fee of the reserve, expressed in bps #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setemodecategory) setEModeCategory Copy function setEModeCategory( uint8 categoryId, uint16 ltv, uint16 liquidationThreshold, uint16 liquidationBonus, string calldata label ) external override onlyRiskOrPoolAdmins Adds a new efficiency mode (eMode) category. Allows [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) and [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) to configure existing or add new eModeCategory If zero is provided as oracle address, the default asset oracles will be used to compute the overall debt and overcollateralization of the users using this category. The new ltv and liquidation threshold must be greater than the base ltvs and liquidation thresholds of all assets within the eMode category. **Input Parameters:** Name Type Description categoryId uint8 The id of the category to be configured. categoryId ≠ 0. NOTE: category 0 is reserved for the default category i.e. non-eMode ltv uint16 The loan to value for the associated eMode category. It must be less than or equal to the liquidationThreshold liquidationThreshold uint16 The liquidation threshold associated with the category liquidationBonus uint16 The liquidation bonus associated with the category label string A custom label identifying the category #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setassetcollateralinemode) setAssetCollateralInEMode Copy function setAssetCollateralInEMode(address asset, uint8 categoryId, bool allowed) external override onlyRiskOrPoolAdmins Assign collateral status to an asset for a particular efficiency mode (eMode) category. Allows [RISK\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#risk_admin) and [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager#pool_admin) to configure eModeCategory of an asset. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve categoryId uint8 eMode category id to set asset collateral status for allowed bool true if asset is enabled as collateral in designated categoryId #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setassetborrowableinemode) setAssetBorrowableInEMode Copy function setAssetBorrowableInEMode(address asset, uint8 categoryId, bool borrowable) external override onlyRiskOrPoolAdmins Configures if an asset can be borrowed in a specific eMode category. **Input Parameters:** Name Type Description asset address Address of the reserve asset categoryId uint8 eMode category ID borrowable bool true to enable, false to disable #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setunbackedmintcap) setUnbackedMintCap Copy function setUnbackedMintCap(address asset, uint256 newUnbackedMintCap) external override onlyRiskOrPoolAdmins Updates the unbacked mint cap of reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve newUnbackedMintCap uint256 The new unbacked mint cap of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveinterestratedata) setReserveInterestRateData Copy function setReserveInterestRateData(address asset, bytes calldata rateData) external onlyRiskOrPoolAdmins Sets custom interest rate parameters for a reserve. **Input Parameters:** Name Type Description asset address Address of the reserve asset rateData bytes Encodes rate strategy parameters #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#setreserveinterestratestrategyaddress) setReserveInterestRateStrategyAddress Copy function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress, bytes calldata rateData) external override onlyRiskOrPoolAdmins Sets the interest rate strategy of a reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve rateStrategyAddress address The address of the interest strategy contract rateData bytes Encoded interst rate strategy data ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#pure-methods) Pure Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool-configurator#getrevision) getRevision Copy function getRevision() internal pure virtual override returns (uint256) Returns the revision number of the contract. Needs to be defined in the inherited class as a constant. Returns 0x1. **Return Values:** Type Description uint256 The revision number [PreviousPool Addresses Providerchevron-left](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) [NextCredit Delegationchevron-right](https://docs.tydro.com/developers/credit-delegation) Last updated 3 months ago --- # View Contracts | Tydro Documentation [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-contracts) View Contracts -------------------------------------------------------------------------------------------------------------- Tydro has several view contracts to assist with querying onchain data. ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#uipooldataprovider) UiPoolDataProvider Contract that returns an array of all reserve or user data for a particular market (for example, liquidity, token addresses, rate strategy), used by the [Tydro Interfacearrow-up-right](https://tydro-page.webflow.io/) to display Markets and Dashboard data. The [Utilities SDKarrow-up-right](https://github.com/aave/aave-utilities) includes an interface to make calls to this contract, and functions to format the response for frontend use-cases The source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/UiPoolDataProviderV3.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getreserveslist) getReservesList Copy function getReservesList(IPoolAddressesProvider provider) public view override returns (address[] memory) Returns the list of initialised reserves in the Pool associated with the given [provider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) . **Input Parameters:** Name Type Description provider IPoolAddressesProvider The given provider for the associated pool **Return Values:** Type Description address\[\] The list of initialised reserves in the Pool #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getreservesdata) getReservesData Returns BaseCurrencyInfo of the Pool and AggregatedReserveData\[\] for all the initialised reserves in the Pool associated with the given [provider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) . **Input Parameters:** Name Type Description provider IPoolAddressesProvider The given provider for the associated pool **Return Values:** Type Description BaseCurrencyInfo The base currency information AggregatedReserveData\[\] The aggregated reserve data The BaseCurrencyInfo struct is composed of the following fields: Name Type Description marketReferenceCurrencyUnit uint256 Reference aka base currency of the Tydro market marketReferenceCurrencyPriceInUsd int256 Price of reference aka base currency in USD networkBaseTokenPriceInUsd int256 Price of native token of the network/chain in USD networkBaseTokenPriceDecimals uint8 Decimals of native token of the network/chain The AggregatedReserveData struct is composed of the following fields: Name Type Description underlyingAsset address The address of the underlying asset of the reserve name string The name of the underlying reserve asset symbol string The symbol of the underlying reserve asset decimals uint256 The number of decimals of the reserve baseLTVasCollateral uint256 The ltv of the reserve reserveLiquidationThreshold uint256 The liquidation threshold of the reserve reserveLiquidationBonus uint256 The liquidation bonus of the resurve reserveFactor uint256 The reserve factor of the reserve usageAsCollateralEnabled bool true if the asset is enabled to be used as collateral, false otherwise borrowingEnabled bool true if borrowing is enabled, false otherwise isActive bool true if reserve is active, false otherwise isFrozen bool true if reserve is frozen, false otherwise BASE DATA liquidityIndex uint128 The liquidity index of the reserve variableBorrowIndex uint128 The variable borrow index of the reserve liquidityRate uint128 The liquidity rate of the reserve variableBorrowRate uint128 The variable borrow rate of the reserve lastUpdateTimestamp uint40 The timestamp of the last update of the reserve aTokenAddress address The AToken address of the reserve variableDebtTokenAddress address The VariableDebtToken address of the reserve interestRateStrategyAddress address The address of the Interest Rate strategy availableLiquidity uint256 The liquidity available totalScaledVariableDebt uint256 The total scaled variable debt priceInMarketReferenceCurrency uint256 Price of reference aka base currency of Tydro market priceOracle address The address of the price oracle used by the associated market variableRateSlope1 uint256 The variable rate slope variableRateSlope2 uint256 The variable rate slope baseVariableBorrowRate uint256 The base variable borrow rate, expressed in ray optimalUsageRatio uint256 The optimal usage ratio V3 ONLY isPaused bool true if the pool is paused, false otherwise isSiloedBorrowing bool true if the asset is siloed for borrowing accruedToTreasury uint128 The amount of tokens accrued to treasury that is to be minted unbacked uint128 The amount of unbacked aTokens of the reserve isolationModeTotalDebt uint128 The outstanding debt borrowed against this asset in isolation mode flashLoanEnabled bool true is asset is available to borrow in flash loan transaction debtCeiling uint256 The debt ceiling of the reserve debtCeilingDecimals uint256 The debt ceiling decimals eModeCategoryId uint8 The eMode id of the reserve borrowCap uint256 The borrow cap of the reserve supplyCap uint256 The supply cap of the reserve borrowableInIsolation bool true is asset available to borrow against isolated collateral assets v3.1 virtualAccActive bool true if virtual accounting is enabled for a reserve virtualUnderlyingBalance uint128 Balance of reserve if virtual accounting is used #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getuserreservesdata) getUserReservesData Returns UserReserveData\[\] for all user reserves in the Pool associated with the given [provider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) . **Input Parameters:** Name Type Description provider IPoolAddressesProvider The given provider for the associated pool user address The address of the user #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#userreservedata) UserReserveData Type Description UserReserveData\[\] The user reserve data The [UserReserveDataarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/interfaces/IUiPoolDataProviderV3.sol) struct is composed of the following fields: Name Type Description underlyingAsset address The address of the underlying asset supplied/borrowed scaledATokenBalance uint256 The scaled balance of the aToken. scaledBalance = balance/liquidityIndex usageAsCollateralEnabledOnUser bool true if the supplied asset is enabled to be used as collateral, false otherwise scaledVariableDebt uint256 The scaled balance of borrow position: (current balance = scaled balance \* liquidity index) #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getemodes) getEModes Returns an array of all available E-mode categories in the Pool associated with the [provider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) . **Input Parameters:** Name Type Description provider IPoolAddressesProvider The PoolAddressesProvider for the associated Pool to fetch EMode categories for **Return Parameters:** Name Type Description categories Emode\[\] The list of E-Modes available in the pool **Emode** The Emode struct is composed of the following fields: Name Type Description id uint8 The unique identifier of the E-Mode eMode DataTypes.EModeCategory The E-Mode configuration details **DataTypes.EModeCategory** The EModeCategory struct is composed of the following fields: Name Type Description ltv uint16 Loan-to-Value ratio for the E-Mode category liquidationThreshold uint16 The threshold at which liquidation is triggered liquidationBonus uint16 The bonus applied during liquidation collateralBitmap uint128 Bitmap representing eligible collateral for this E-Mode label string The label describing the E-Mode category borrowableBitmap uint128 Bitmap representing borrowable assets for this E-Mode ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#walletbalanceprovider) WalletBalanceProvider Fetches tokens balances for all underlying tokens of Tydro reserves for one user address. This contract is not used within the Tydro. It is an accessory contract used to reduce the number of calls towards the blockchain from the Tydro backend. For getting ETH (native chain token) balance use MOCK\_ETH\_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE. The source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/WalletBalanceProvider.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods-1) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#balanceof) balanceOf Checks the token balance of a wallet in a token contract. Returns the balance of the token for user (ETH included with MOCK\_ETH\_ADDRESS). **Input Parameters:** Name Type Description user address The address of the user token address The address of the token **Return Values:** Type Description uint256 The balance of the token for user. Returns 0 for a non-contract address #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#batchbalanceof) batchBalanceOf Returns balances for a list of users and tokens (ETH included with MOCK\_ETH\_ADDRESS). **Input Parameters:** Name Type Description users address\[\] The list of users tokens address\[\] The list of tokens **Return Values:** Type Description uint256\[\] A list of balances for each user #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getuserwalletbalances) getUserWalletBalances Provides balances of user wallet for all reserves available on the pool. **Input Parameters:** Name Type Description provider address The address of the provider user address The address of the user **Return Values:** Type Description address\[\] A list of user wallets uint256\[\] A list of balances for each user [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#uiincentivedataproviderv3) UiIncentiveDataProviderV3 ------------------------------------------------------------------------------------------------------------------------------------ Contract that returns an array of all reserve incentives or user claimable rewards within a particular market, used by the Tydro Interface to display incentives data. The Tydro Utilties SDK includes an interface to make calls to this contract, and functions to format the response for frontend use-cases. The source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/UiIncentiveDataProviderV3.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods-2) View Methods **getFullReservesIncentiveData** Returns both AggregatedReserveIncentiveData\[\] and UserReserveIncentiveData\[\] for the given user for the pool associated with the given [provider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) . **Input Parameters:** Name Type Description provider IPoolAddressesProvider The given provider for the associated pool user address The address of the user **Return Values:** Type Description AggregatedReserveIncentiveData\[\] The aggregated reserve incentive data UserReserveIncentiveData\[\] The user reserve incentive data The AggregatedReserveIncentiveData struct is composed of the following fields: Name Type Description underlyingAsset address Address of the asset supplied/borrowed in Pool aIncentiveData IncentiveData Details of rewards distributed for supplying to Tydro Pool i.e. rewards for aToken holders vIncentiveData IncentiveData Details of rewards distributed for variable debt borrowed from Tydro Pool i.e. rewards for vToken holders The UserReserveIncentiveData struct is composed of the following fields: Name Type Description underlyingAsset address Address of the asset supplied/borrowed in Pool aTokenIncentivesUserData UserIncentiveData Details of user rewards received for supplying to Tydro Pool i.e. rewards for aToken vTokenIncentivesUserData UserIncentiveData Details of user rewards received for borrowing at variable rate from Tydro Pool i.e. rewards for vToken **getReservesIncentivesData** Returns AggregatedReserveIncentiveData\[\] for the pool associated with the given [provider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) . **Input Parameters:** Name Type Description provider IPoolAddressesProvider The given provider for the associated pool **Return Values:** Type Description AggregatedReserveIncentiveData\[\] The aggregated reserve incentive data The AggregatedReserveIncentiveData struct is composed of the following fields: Name Type Description underlyingAsset address Address of the asset supplied/borrowed in Pool aIncentiveData IncentiveData Details of rewards distributed for supplying to Tydro Pool i.e. rewards for aToken holders vIncentiveData IncentiveData Details of rewards distributed for variable debt borrowed from Tydro Pool i.e. rewards for vToken holders **getUserReservesIncentivesData** Returns the UserReserveIncentiveData\[\] for the given user for the pool associated with the given [provider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) . **Input Parameters:** Name Type Description provider IPoolAddressesProvider The given provider for the associated pool **Return Values:** Type Description UserReserveIncentiveData\[\] The user reserve incentive data The UserReserveIncentiveData struct is composed of the following fields: Name Type Description underlyingAsset address Address of the asset supplied/borrowed in Pool aTokenIncentivesUserData UserIncentiveData Details of user rewards received for supplying to Tydro Pool i.e. rewards for aToken vTokenIncentivesUserData UserIncentiveData Details of user rewards received for borrowing at variable rate from Tydro Pool i.e. rewards for vToken ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#tydroprotocoldataprovider) TydroProtocolDataProvider The TydroProtocolDataProvider is a peripheral contract to collect and pre-process information from the [Pool](https://docs.tydro.com/developers/smart-contracts/pool) . This contract contains methods for querying token addresses, reserve parameters, and user account information. The methods of the PoolDataProvider are more granular than the UiPoolDataProvider, which queries data for reserve tokens or user balances simultaneously. The source code is available on Aave's [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/helpers/AaveProtocolDataProvider.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods-3) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getallreservestokens) getAllReservesTokens Returns a list of the existing reserves in the pool, pairs include the symbol and tokenAddress. Handles MKR and ETH in a different way since they do not have standard symbol functions. **Return Values:** Type Description TokenData\[\] The list of reserves, pairs of symbols and addresses The TokenData struct is composed of the following fields: Name Type Description symbol string The symbol of the underlying reserve asset tokenAddress address The address of the underlying reserve asset #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getallatokens) getAllATokens Returns a list of the existing ATokens in the pool, pairs include the symbol and tokenAddress. **Return Values:** Type Description TokenData\[\] The list of ATokens, pairs of symbols and addresses The TokenData struct is composed of the following fields: Name Type Description symbol string The symbol of aToken of the reserve tokenAddress address The address of aToken of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getreserveconfigurationdata) getReserveConfigurationData Returns the configuration data of the reserve as described below. Does not return borrow and supply caps, nor pause flag for compatibility. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Name Type Description decimals uint256 The number of decimals of the reserve ltv uint256 The ltv of the reserve liquidationThreshold uint256 The liquidation threshold of the reserve liquidationBonus uint256 The liquidation bonus of the reserve reserveFactor uint256 The reserve factor of the reserve usageAsCollateralEnabled bool true if the usage as collateral is enabled, false otherwise borrowingEnabled bool true if borrowing is enabled, false otherwise stableBorrowRateEnabled bool Always false (deprecated) isActive bool true if reserve is active, false otherwise isFrozen bool true if reserve is frozen, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getreservecaps) getReserveCaps Returns the caps parameters of the reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#return-values) Return Values: Name Type Description borrowCap uint256 The borrow cap of the reserve supplyCap uint256 The supply cap of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getpaused) getPaused Returns true if the pool isPaused. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Name Type Description isPaused bool true if the pool is paused, false otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getsiloedborrowing) getSiloedBorrowing Returns the siloed borrowing flag. It returns true if the asset is siloed for borrowing. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description bool true if the asset is siloed for borrowing #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getliquidationprotocolfee) getLiquidationProtocolFee Returns the protocol fee on the liquidation bonus. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description uint256 The protocol fee on liquidation #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getunbackedmintcap) getUnbackedMintCap Returns the unbacked mint cap of the reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description uint256 The unbacked mint cap of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getdebtceiling) getDebtCeiling Returns the debt ceiling of the reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description uint256 The debt ceiling of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getreservedata) getReserveData Returns the reserve data. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Name Type Description unbacked uint256 The amount of unbacked aTokens of the reserve accruedToTreasuryScaled uint256 The scaled amount of tokens accrued to treasury that is to be minted totalAToken uint256 The total supply of the aToken totalStableDebt uint256 The total stable debt of the reserve (deprecated) totalVariableDebt uint256 The total variable debt of the reserve liquidityRate uint256 The liquidity rate of the reserve variableBorrowRate uint256 The variable borrow rate of the reserve stableBorrowRate uint256 The stable borrow rate of the reserve (deprecated) averageStableBorrowRate uint256 The average stable borrow rate of the reserve (deprecated) liquidityIndex uint256 The liquidity index of the reserve variableBorrowIndex uint256 The variable borrow index of the reserve lastUpdateTimestamp uint40 The timestamp of the last update of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getatokentotalsupply) getATokenTotalSupply Returns the total supply of aTokens for a given asset. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description uint256 The total supply of the aToken #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#gettotaldebt) getTotalDebt Returns the total debt for a given asset. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description uint256 The total borrows for an asset #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getuserreservedata) getUserReserveData Returns the following user reserve data. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve user address The address of the user **Return Values:** Name Type Description currentATokenBalance uint256 The current AToken balance of the user currentStableDebt uint256 The current stable debt of the user (deprecated) currentVariableDebt uint256 The current variable debt of the user principalStableDebt uint256 The principal stable debt of the user (deprecated) scaledVariableDebt uint256 The scaled variable debt of the user stableBorrowRate uint256 The stable borrow rate of the user (deprecated) liquidityRate uint256 The liquidity rate of the reserve stableRateLastUpdated uint40 The timestamp of the last update of the user stable rate (deprecated) usageAsCollateralEnabled bool true if the user is using the asset as collateral, else false #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getreservetokensaddresses) getReserveTokensAddresses Returns the addresses of the aToken, stableDebtToken and variableDebtToken of the reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Name Type Description aTokenAddress address The AToken address of the reserve stableDebtTokenAddress address The StableDebtToken address of the reserve (deprecated) variableDebtTokenAddress address The VariableDebtToken address of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getinterestratestrategyaddress) getInterestRateStrategyAddress Returns the address of the Interest Rate strategy. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Name Type Description irStrategyAddress address The address of the Interest Rate strategy #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getreservedeficit) getReserveDeficit **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description uint256 Current reserve deficit from undercollateralized borrow positions ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#pure-methods) Pure Methods **getDebtCeilingDecimals** Returns the debt ceiling decimals. **Return Values:** Type Description uint256 The debt ceiling decimals ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#liquidationdataprovider) LiquidationDataProvider This contract is a utility for fetching and pre-processing liquidation-related parameters for a given user. It aggregates data from the underlying Pool and Price Oracle to determine a user’s position, collateral, borrow details, and liquidation limits according to the protocol parameters. The source code is available on [GitHubarrow-up-right](https://github.com/bgd-labs/aave-v3-origin/blob/1f4df52c1be2633b720b3638a299d74b3d5dcbb7/src/contracts/helpers/LiquidationDataProvider.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods-4) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getuserpositionfullinfo) getUserPositionFullInfo Returns aggregated position information for a user including total collateral, total debt, available borrows, current liquidation threshold, loan-to-value (LTV), and health factor. All values are denominated in the base currency. **Input Parameters:** Name Type Description user address The address of the user whose position is queried **Return Values:** Name Type Description UserPositionFullInfo struct The aggregated position information of the user The UserPositionFullInfo struct is composed of the following fields: Name Type Description totalCollateralInBaseCurrency uint256 Total collateral in base currency totalDebtInBaseCurrency uint256 Total debt in base currency availableBorrowsInBaseCurrency uint256 Available borrows in base currency currentLiquidationThreshold uint256 Current liquidation threshold ltv uint256 Loan-to-value ratio healthFactor uint256 Health factor of the user’s position #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getcollateralfullinfo) getCollateralFullInfo Returns detailed information regarding a user’s collateral for a given asset. The returned struct includes the asset’s unit (based on decimals), its current price (via the Price Oracle), the associated aToken address, the raw collateral balance, and its equivalent value in the base currency. **Input Parameters:** Name Type Description user address The address of the user collateralAsset address The address of the collateral asset to fetch information for **Return Values:** Name Type Description CollateralFullInfo struct Detailed collateral information for the specified asset The CollateralFullInfo struct is composed of the following fields: Name Type Description assetUnit uint256 The unit value of the asset (10^decimals) price uint256 Current price of the asset from the Price Oracle aToken address Address of the aToken associated with the asset collateralBalance uint256 The raw collateral balance of the user collateralBalanceInBaseCurrency uint256 Collateral balance denominated in the base currency #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getdebtfullinfo) getDebtFullInfo Returns detailed information regarding a user’s debt for a given asset. The returned struct includes the asset’s unit, current price, the associated variable debt token address, the debt balance, and its equivalent value in the base currency. **Input Parameters:** Name Type Description user address The address of the user debtAsset address The address of the debt asset to fetch information for **Return Values:** Name Type Description DebtFullInfo struct Detailed debt information for the specified asset The DebtFullInfo struct is composed of the following fields: Name Type Description assetUnit uint256 The unit value of the asset (10^decimals) price uint256 Current price of the asset from the Price Oracle variableDebtToken address Address of the variable debt token associated with the asset debtBalance uint256 The raw debt balance of the user debtBalanceInBaseCurrency uint256 Debt balance denominated in the base currency #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getliquidationinfo-without-custom-debt-amount) getLiquidationInfo (without custom debt amount) A convenience function that returns liquidation parameters for a user using the maximum possible debt liquidation amount. Internally, it calls the overloaded version with debtLiquidationAmount set to the maximum (type(uint256).max). **Input Parameters:** Name Type Description user address The address of the user collateralAsset address The address of the collateral asset debtAsset address The address of the debt asset **Return Values:** Name Type Description LiquidationInfo struct Detailed liquidation information for the specified user and assets The LiquidationInfo struct is composed of the following fields: Name Type Description userInfo struct Aggregated position details of the user (UserPositionFullInfo above) collateralInfo struct Detailed collateral information (CollateralFullInfo above) debtInfo struct Detailed debt information (DebtFullInfo above) maxCollateralToLiquidate uint256 Maximum collateral that can be liquidated maxDebtToLiquidate uint256 Maximum debt that can be liquidated liquidationProtocolFee uint256 Protocol fee applied on the liquidation bonus amountToPassToLiquidationCall uint256 Adjusted debt amount for the liquidation call #### [hashtag](https://docs.tydro.com/developers/smart-contracts/view-contracts#getliquidationinfo-with-custom-debt-liquidation-amount) getLiquidationInfo (with custom debt liquidation amount) Returns comprehensive liquidation parameters for a user given a specific collateral asset and debt asset, considering a custom maximum debt liquidation amount. The function aggregates the user’s position, collateral and debt details, checks if liquidation conditions are met, and computes the optimal amounts for liquidation—including any applicable protocol fees. **Input Parameters:** Name Type Description user address The address of the user collateralAsset address The address of the collateral asset to be liquidated debtAsset address The address of the debt asset to be repaid debtLiquidationAmount uint256 The maximum debt amount that can be liquidated (if lower than the user’s debt balance) **Return Values:** Name Type Description LiquidationInfo struct Detailed liquidation information for the specified user and assets The LiquidationInfo struct is composed of the following fields: Name Type Description userInfo struct Aggregated position details of the user (UserPositionFullInfo above) collateralInfo struct Detailed collateral information (CollateralFullInfo above) debtInfo struct Detailed debt information (DebtFullInfo above) maxCollateralToLiquidate uint256 Maximum collateral that can be liquidated maxDebtToLiquidate uint256 Maximum debt that can be liquidated liquidationProtocolFee uint256 Protocol fee applied on the liquidation bonus amountToPassToLiquidationCall uint256 Adjusted debt amount for the liquidation call [PreviousWrapped Token Gatewaychevron-left](https://docs.tydro.com/developers/smart-contracts/wrapped-token-gateway) [NextIncentiveschevron-right](https://docs.tydro.com/developers/smart-contracts/incentives) Last updated 3 months ago * [View Contracts](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-contracts) * [UiPoolDataProvider](https://docs.tydro.com/developers/smart-contracts/view-contracts#uipooldataprovider) * [View Methods](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods) * [WalletBalanceProvider](https://docs.tydro.com/developers/smart-contracts/view-contracts#walletbalanceprovider) * [View Methods](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods-1) * [UiIncentiveDataProviderV3](https://docs.tydro.com/developers/smart-contracts/view-contracts#uiincentivedataproviderv3) * [View Methods](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods-2) * [TydroProtocolDataProvider](https://docs.tydro.com/developers/smart-contracts/view-contracts#tydroprotocoldataprovider) * [View Methods](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods-3) * [Pure Methods](https://docs.tydro.com/developers/smart-contracts/view-contracts#pure-methods) * [LiquidationDataProvider](https://docs.tydro.com/developers/smart-contracts/view-contracts#liquidationdataprovider) * [View Methods](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-methods-4) Copy function getReservesData(IPoolAddressesProvider provider) public view override returns (AggregatedReserveData[] memory, BaseCurrencyInfo memory) Copy function getUserReservesData(IPoolAddressesProvider provider, address user) external view override returns (UserReserveData[] memory, uint8) Copy function getEModes(IPoolAddressesProvider provider) external view returns (Emode[] memory) Copy function balanceOf(address user, address token) public view returns (uint256) Copy function batchBalanceOf(address[] calldata users, address[] calldata tokens) external view returns (uint256[] memory) Copy function getUserWalletBalances(address provider, address user) external view returns (address[] memory, uint256[] memory) Copy function getFullReservesIncentiveData(IPoolAddressesProvider provider, address user) external view override returns (AggregatedReserveIncentiveData[] memory, UserReserveIncentiveData[] memory) Copy function getReservesIncentivesData(IPoolAddressesProvider provider) external view override returns (AggregatedReserveIncentiveData[] memory) Copy function getUserReservesIncentivesData(IPoolAddressesProvider provider, address user) external view override returns (UserReserveIncentiveData[] memory) Copy function getAllReservesTokens() external view returns (TokenData[] memory) Copy function getAllATokens() external view returns (TokenData[] memory) Copy function getReserveConfigurationData(address asset) external view returns ( uint256 decimals, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive, bool isFrozen) Copy function getReserveCaps(address asset) external view returns (uint256 borrowCap, uint256 supplyCap) Copy function getPaused(address asset) external view returns (bool isPaused) Copy function getSiloedBorrowing(address asset) external view override returns (bool) Copy function getLiquidationProtocolFee(address asset) external view override returns (uint256) Copy function getUnbackedMintCap(address asset) external view override returns (uint256) Copy function getDebtCeiling(address asset) external view override returns (uint256) Copy function getReserveData(address asset) external view override returns ( uint256 unbacked, uint256 accruedToTreasuryScaled, uint256 totalAToken, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp) Copy function getATokenTotalSupply(address asset) external view override returns (uint256) Copy function getTotalDebt(address asset) external view override returns (uint256) Copy function getUserReserveData(address asset, address user) external view returns ( uint256 currentATokenBalance, uint256 currentStableDebt, uint256 currentVariableDebt, uint256 principalStableDebt, uint256 scaledVariableDebt, uint256 stableBorrowRate, uint256 liquidityRate, uint40 stableRateLastUpdated, bool usageAsCollateralEnabled) Copy function getReserveTokensAddresses(address asset) external view override returns ( address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress) Copy function getInterestRateStrategyAddress(address asset) external view override returns (address irStrategyAddress) Copy function getReserveDeficit(address asset) external view override returns (uint256) Copy function getDebtCeilingDecimals() external pure override returns (uint256) Copy getUserPositionFullInfo(address user) public view override returns (UserPositionFullInfo memory) Copy getCollateralFullInfo(address user, address collateralAsset) external view override returns (CollateralFullInfo memory) Copy getDebtFullInfo(address user, address debtAsset) external view override returns (DebtFullInfo memory) Copy getLiquidationInfo(address user, address collateralAsset, address debtAsset) public view override returns (LiquidationInfo memory) Copy getLiquidationInfo(address user, address collateralAsset, address debtAsset, uint256 debtLiquidationAmount) public view override returns (LiquidationInfo memory) --- # Pool | Tydro Documentation This contract is the main user-facing contract. Most user interactions with Tydro occur via the Pool contract. It exposes the liquidity management methods that can be invoked using either _**Solidity**_ or _**Web3**_ libraries. The Pool contract is the main entry point for users in Tydro. Most interactions such as supplying, borrowing, repaying, or managing collateral are executed through this contract. It exposes all core liquidity functions and can be called directly in Solidity or through Web3 libraries. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#functions-available-through-pool) Functions available through Pool Users can interact with the Pool contract to: * Supply assets into the protocol * Withdraw supplied assets * Borrow against collateral * Repay borrowed assets * Enable or disable assets as collateral * Liquidate undercollateralised positions The Pool contract is deployed behind a proxy and registered with the [PoolAddressesProvider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) of each market. Administrative actions are routed through the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract referenced in the [PoolAddressesProvider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) . The source code is available on [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/pool/Pool.sol) . ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#write-methods) Write Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#initialize) initialize Copy function initialize(IPoolAddressesProvider provider) external virtual Initializes the Pool. Function is invoked by the proxy contract when the Pool contract is added to the [PoolAddressesProvider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) of the market. Caches the address of the [PoolAddressesProvider](https://docs.tydro.com/developers/smart-contracts/pool-addresses-provider) in order to reduce gas consumption on subsequent operations. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#input-parameters) Input Parameters: Name Type Description provider `address` The address of the PoolAddressesProvider #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#supply) supply Supplies a certain amount of an asset into the protocol, minting the same amount of corresponding aTokens and transferring them to the onBehalfOf address. For example, if a user supplies 100 USDC and onBehalfOf address is the same as msg.sender, they will get 100 aUSDC in return. The referralCode is emitted in Supply event and can be for third-party referral integrations. To activate the referral feature and obtain a unique referral code, integrators need to submit a proposal to Tydro. > ⚠️ **Warning:** When supplying, the `Pool` contract must have `allowance()` to spend funds on behalf of `msg.sender` for at least the amount for the asset being supplied. This can be done via the standard ERC20 `approve()` method on the underlying token contract. circle-info Referral supply is currently inactive, you can pass 0 as referralCode. This program may be activated in the future through a Tydro proposal. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#input-parameters-1) Input Parameters: Name Type Description asset `address` The address of the underlying asset being supplied to the pool amount `uint256` The amount of asset to be supplied onBehalfOf `address` The address that will receive the corresponding aTokens. This is the only address that will be able to withdraw the asset from the pool. This will be the same as `msg.sender` if the user wants to receive aTokens into their own wallet, or use a different address if the beneficiary of aTokens is a different wallet. referralCode `uint16` Referral supply is currently inactive, you can pass `0`. This code is used to register the integrator originating the operation, for potential rewards. `0` if the action is executed directly by the user, without any middle-men. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#supplywithpermit) supplyWithPermit Supply with transfer approval of the asset to be supplied via permit function. This method removes the need for separate approval tx before supplying asset to the pool. See: [https://eips.ethereum.org/EIPS/eip-2612arrow-up-right](https://eips.ethereum.org/EIPS/eip-2612) . circle-info Permit signature must be signed by msg.sender with spender as Pool address. circle-info Referral program is currently inactive, you can pass 0 as referralCode. This program may be activated in the future through a Tydro proposal. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#input-parameters-2) Input Parameters: Name Type Description asset `address` The address of underlying asset being supplied. The same asset as used in permit `v`, `s`, and `r` amount `uint256` The amount of asset to be supplied and signed for approval. The same amount as used in permit `v`, `s`, and `r` onBehalfOf `address` The address that will receive the aTokens. This will be the same as `msg.sender` if the user wants to receive aTokens into their own wallet, or use a different address if the beneficiary of aTokens is a different wallet referralCode `uint16` Referral supply is currently inactive, you can pass `0`. This code is used to register the integrator originating the operation, for potential rewards. `0` if the action is executed directly by the user, without any middle-men deadline `uint256` The unix timestamp up until which the permit signature is valid permitV `uint8` The `v` parameter of the ERC712 permit signature permitR `bytes32` The `r` parameter of the ERC712 permit signature permitS `bytes32` The `s` parameter of the ERC712 permit signature #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#withdraw) withdraw Withdraws an amount of underlying asset from the reserve, burning the equivalent aTokens owned. For example, if a user has 100 aUSDC and calls withdraw(), they will receive 100 USDC, burning the 100 aUSDC. If user has any existing debt backed by the underlying token, then the maximum amountavailable to withdraw is the amount that will not leave user's health factor < 1 after withdrawal. circle-info When withdrawing to another address, msg.sender should have aToken that will be burned by Pool. circle-info Reserves with a Loan To Value parameter of 0% must be disabled as collateral (using Pool.setUserUseReserveAsCollateral or by fully withdrawing the supplied balance) before other assets can be withdrawn. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#input-parameters-3) Input Parameters: Name Type Description asset `address` The address of the underlying asset to withdraw, not the aToken amount `uint256` The underlying amount to be withdrawn (the amount supplied), expressed in wei units. Use `type(uint).max` to withdraw the entire aToken balance to `address` The address that will receive the underlying `asset`. This will be the same as `msg.sender` if the user wants to receive the tokens into their own wallet, or use a different address if the beneficiary is a different wallet #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#return-values) Return Values: Type Description `uint256` The final amount withdrawn #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#borrow) borrow Allows users to borrow a specific amount of the reserve underlying asset, provided the borrower has already supplied enough collateral, or they were given enough allowance by a credit delegator on the corresponding debt token (VariableDebtToken). For example, if a user borrows 100 USDC passing their own address as onBehalfOf, they will receive 100 USDC into their wallet and 100 variable debt tokens. circle-info NOTE: If onBehalfOf is not the same as msg.sender, then onBehalfOf must have supplied enough collateral via supply() and have delegated credit to msg.sender via approveDelegation(). circle-info Referral program is currently inactive, you can pass 0 as referralCode. This program may be activated in the future. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#input-parameters-4) Input Parameters: Name Type Description asset `address` The address of the underlying asset to borrow amount `uint256` The amount to be borrowed, expressed in wei units interestRateMode `uint256` Should always be passed a value of `2` (variable rate mode) referralCode `uint16` Referral supply is currently inactive, you can pass `0`. This code is used to register the integrator originating the operation, for potential rewards. `0` if the action is executed directly by the user, without any middle-men onBehalfOf `address` This should be the address of the borrower calling the function if they want to borrow against their own collateral, or the address of the credit delegator if the caller has been given credit delegation allowance repay Repays a borrowed amount on a specific reserve, burning the equivalent debt tokens owned. For example, if a user repays 100 USDC, the 100 variable debt tokens owned by the onBehalfOfaddress will be burned. > ⚠️ **Warning:** When repaying, the `Pool` contract must have allowance to spend funds on behalf of `msg.sender` for at least the `amount` for the asset you are repaying with. This can be done via the standard ERC20 `approve()` method on the underlying token contract. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#input-parameters-5) Input Parameters: Name Type Description asset `address` The address of the borrowed underlying asset previously borrowed amount `uint256` The amount to repay, expressed in wei units. Use `type(uint256).max` in order to repay the whole debt, ONLY when the repayment is not executed on behalf of a 3rd party. In case of repayments on behalf of another user, it's recommended to send an amount slightly higher than the current borrowed amount interestRateMode `uint256` Only available option is `2` (variableRateMode) onBehalfOf `address` The address of the user who will get their debt reduced/removed. This should be the address of the user calling the function if they want to reduce/remove their own debt, or the address of any other borrower whose debt should be removed #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#repaywithpermit) repayWithPermit Repay with transfer approval of the borrowed asset to be repaid, done via permit function. This method removes the need for separate approval tx before repaying asset to the pool. See: [https://eips.ethereum.org/EIPS/eip-2612arrow-up-right](https://eips.ethereum.org/EIPS/eip-2612) . circle-info Permit signature must be signed by msg.sender with spender value as Pool address. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#input-parameters-6) Input Parameters: Name Type Description asset `address` The address of the borrowed underlying asset previously borrowed. The same asset as used in permit `v`, `r`, and `s` amount `uint256` The amount to repay, expressed in wei units. Use `type(uint256).max` in order to repay the whole debt to pay without leaving aToken dust. The same amount as used in permit `v`,`r`,`s` interestRateMode `uint256` Only available option is `2` (variableRateMode) onBehalfOf `address` The address of the user who will get their debt reduced/removed. This should be the address of the user calling the function if they want to reduce/remove their own debt, or the address of any other borrower whose debt should be removed deadline `uint256` The unix timestamp up until which the permit signature is valid permitV `uint8` The `v` parameter of the ERC712 permit signature permitR `bytes32` The `r` parameter of the ERC712 permit signature permitS `bytes32` The `s` parameter of the ERC712 permit signature **Return Values:** Type Description `uint256` The final amount repaid repayWithATokens Allows a user to repay a borrowed amount on a specific reserve using the reserve aTokens, burning the equivalent debt tokens. For example, a user repays 100 USDC using 100 aUSDC, burning 100 variable debt tokens. Passing uint256.maxas the amount will clean up any residual aToken dust balance, if the user aToken balance is not enough to cover the whole debt. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#input-parameters-7) Input Parameters: Name Type Description asset `address` The address of the borrowed underlying asset previously borrowed amount `uint256` The amount to repay. Use `type(uint256).max` in order to repay the whole debt for `asset` to pay without leaving aToken dust interestRateMode `uint256` Only available option is `2` (variableRateMode) **Return Values:** Type Description `uint256` The final amount repaid #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#setuserusereserveascollateral) setUserUseReserveAsCollateral Allows suppliers to enable/disable a specific supplied asset as collateral. Sets the asset of msg.sender to be used as collateral or not. circle-info An asset in Isolation Mode can be enabled to use as collateral only if no other asset is already enabled to use as collateral. circle-info An asset with LTV parameter of 0% cannot be enabled as collateral. circle-info The user won’t be able to disable an asset as collateral if they have an outstanding debt position which could be left with the Health Factor < HEALTH\_FACTOR\_LIQUIDATION\_THRESHOLD on disabling the given asset as collateral. **Input Parameters:** Name Type Description asset `address` The address of the underlying asset supplied useAsCollateral `bool` `true` if the user wants to use the supply as collateral, `false` otherwise #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#liquidationcall) liquidationCall Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1. When the health factor of a position is below 1, the caller (liquidator) repays the debtToCoveramount of debt of the user getting liquidated. This is part or all of the outstanding borrowed amount on behalf of the borrower. The caller then receives a proportional amount of the collateralAsset (discounted amount of collateral) plus a liquidation bonus to cover market risk. Liquidators can decide if they want to receive an equivalent amount of collateral aTokens instead of the underlying asset. When the liquidation is completed successfully, the health factor of the position is increased, bringing the health factor above 1. Liquidators can only close a certain amount of collateral defined by a close factor. Currently the **close factor is 0.5**. In other words, liquidators can only liquidate a maximum of 50% of the amount pending to be repaid in a position. The liquidation discount applies to this amount. * _In most scenarios_, profitable liquidators will choose to liquidate as much as they can (50% of the user position). * debtToCover parameter can be set to uint(-1) and the protocol will proceed with the highest possible liquidation allowed by the close factor. * To check a user's health factor, use \[getUserAccountData()\]. circle-info Liquidators must approve() the Pool contract to use debtToCover of the underlying ERC20 of the asset used for the liquidation. **Input Parameters:** Name Type Description collateralAsset `address` The address of the underlying asset used as collateral, to receive as result of the liquidation debtAsset `address` The address of the underlying borrowed asset to be repaid with the liquidation user `address` The address of the borrower getting liquidated debtToCover `uint256` The debt amount of borrowed `asset` the liquidator will repay receiveAToken `bool` `true` if the liquidator wants to receive the aTokens equivalent of the purchased collateral, `false` if they want to receive the underlying collateral asset directly #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#flashloan) flashLoan Allows users to access liquidity of the pool for a given list of assets within one transaction, as long as the amount taken plus a fee is returned. The receiver must approve the Pool contract for at least the _amount borrowed + fee_, otherwise the transaction will revert. The flash loan fee is waived for approved FLASH\_BORROWER. There are security concerns for developers of flashloan receiver contracts that must be taken into consideration. For further details, visit [Flash Loan Developers Guide](https://docs.tydro.com/primitives/flash-loans) . circle-info Referral program is currently inactive, you can pass 0 as referralCode. This program may be activated in the future through a Tydro proposal. **Input Parameters:** Name Type Description receiverAddress address The address of the contract receiving the flash-borrowed funds, implementing the IFlashLoanReceiver interface assets address\[\] The addresses of the assets being flash-borrowed amounts uint256\[\] The amounts of the assets being flash-borrowed. This needs to contain the same number of entries as assets interestRateModes uint256\[\] The types of the debt position to open if the flash loan is not returned: 0 -> Don't open any debt, the amount + fee must be paid in this case or just revert if the funds can't be transferred from the receiver. 2 -> Open variable rate borrow position for the value of the amount flash-borrowed to the onBehalfOf address onBehalfOf address The address that will receive the debt if the associated interestRateModes is 1 or 2. onBehalfOf must already have approved sufficient borrow allowance of the associated asset to msg.sender params bytes Variadic packed params to pass to the receiver as extra information referralCode uint16 Referral supply is currently inactive, you can pass 0. This code is used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-men #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#flashloansimple) flashLoanSimple Allows users to access liquidity of the pool for a given asset within one transaction, as long as the amount taken plus a fee is returned. The receiver must approve the Pool contract for at least the _amount borrowed + fee_, otherwise the transaction will revert. This function does not waive the fee for approved FLASH\_BORROWER, nor does it allow for opening a debt position instead of repaying. There are security concerns for developers of flashloan receiver contracts that must be kept into consideration. Referral program is currently inactive, you can pass 0 as referralCode. This program may be activated in the future through an Tydro proposal **Input Parameters:** Name Type Description receiverAddress address The address of the contract receiving the flash-borrowed funds, implementing the IFlashLoanReceiver interface asset address The address of the asset being flash-borrowed amount uint256 The amount of the asset being flash-borrowed params bytes Variadic packed params to pass to the receiver as extra information referralCode uint16 Referral supply is currently inactive, you can pass 0. This code is used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-men #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#minttotreasury) mintToTreasury Mints the assets accrued through the reserve factor to the treasury in the form of aTokens for the given list of assets. **Input Parameters:** Name Type Description assets address\[\] The list of reserves for which the minting needs to be executed #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#finalizetransfer) finalizeTransfer Validates and finalizes an aToken transfer. It is only callable by the overlying aToken of the asset. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the aToken from address The user from which the aTokens are transferred to address The user receiving the aTokens amount uint256 The amount being transferred/withdrawn balanceFromBefore uint256 The aToken balance of the from user before the transfer balanceToBefore uint256 The aToken balance of the to user before the transfer #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#setuseremode) setUserEMode Allows a user to use the protocol in efficiency mode. The category id must be a valid id already defined by _Pool or Risk Admins_. Will revert if user is borrowing non-compatible asset or if the change will drop the Health Factor < HEALTH\_FACTOR\_LIQUIDATION\_THRESHOLD. **Input Parameters:** Name Type Description categoryId uint8 The eMode category id (0 - 255) defined by Risk or Pool Admins. categoryId set to 0 is a non eMode category #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#mintunbacked) mintUnbacked Allows contracts with BRIDGE role permission to mint an amount of unbacked aTokens to the `onBehalfOf` address. Only available to the addresses with BRIDGE role. Bridge addresses can be whitelisted by Tydro. Referral program is currently inactive, you can pass 0 as referralCode. This program may be activated in the future through a Tydro proposal. **Input Parameters:** Name Type Description asset address The address of the underlying asset to mint amount uint256 The amount to mint onBehalfOf address The address that will receive the aTokens referralCode uint16 Referral supply is currently inactive, you can pass 0. This code is used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-men #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#backunbacked) backUnbacked Allows contracts with BRIDGE role permission to back the current unbacked underlying aTokens with amount and pay fee Only available to the addresses with BRIDGE role. Bridge addresses can be whitelisted by Tydro. **Input Parameters:** Name Type Description asset address The address of the underlying asset to back amount uint256 The amount of asset supplied to back the unbacked tokens fee uint256 The amount paid in fees **Return Value:** Type Description uint256 The final amount backed, representing the portion of assets that were successfully supplied to back the unbacked aTokens, including any fees that were taken into account. #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#initreserve) initReserve Initializes a reserve, activating it, assigning an aToken and debt tokens and an interest rate strategy. Only callable by the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve aTokenAddress address The address of the aToken that will be assigned to the reserve stableDebtAddress address The address of the StableDebtToken that will be assigned to the reserve (deprecated) variableDebtAddress address The address of the VariableDebtToken that will be assigned to the reserve interestRateStrategyAddress address The address of the interest rate strategy contract #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#dropreserve) dropReserve Drop a reserve. Only callable by the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#setreserveinterestratestrategyaddress) setReserveInterestRateStrategyAddress Updates the address of the interest rate strategy contract. Only callable by the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve rateStrategyAddress address The address of the interest rate strategy contract #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#setconfiguration) setConfiguration Sets the configuration bitmap of the reserve as a whole. Only callable by the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve configuration DataTypes.ReserveConfigurationMap The new configuration bitmap The [DataTypes.ReserveConfigurationMaparrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L79) struct is composed of the following fields: bit Description 0-15 LTV 16-31 Liquidation threshold 32-47 Liquidation bonus 48-55 Decimals 56 Reserve is active 57 Reserve is frozen 58 Borrowing is enabled 59 Stable rate borrowing enabled (deprecated) 60 Asset is paused 61 Borrowing in isolation mode is enabled 62 Siloed borrowing is enabled 63 Flashloaning is enabled 64-79 Reserve factor 80-115 Borrow cap in whole tokens, borrowCap == 0 => no cap 116-151 Supply cap in whole tokens, supplyCap == 0 => no cap 152-167 Liquidation protocol fee 168-175 eMode category (deprecated) 176-211 Unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled 212-251 Debt ceiling for isolation mode with (ReserveConfiguration::DEBT\_CEILING\_DECIMALS) decimals 252 Virtual accounting is enabled 253-255 Unused #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#updatebridgeprotocolfee) updateBridgeProtocolFee Updates the protocol fee on the bridging. Only callable by the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract. **Input Parameters:** Name Type Description protocolFee uint256 The part of the premium sent to the protocol treasury #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#updateflashloanpremiums) updateFlashloanPremiums Updates flash loan premiums. A flash loan premium consists of two parts: * A part is sent to aToken holders as extra, one time accumulated interest * A part is collected by the protocol treasury The total premium is calculated on the total borrowed amount. The premium to protocol is calculated on the total premium, being a percentage of flashLoanPremiumTotal. Only callable by the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract. **Input Parameters:** Name Type Description flashLoanPremiumTotal uint128 The total premium, expressed in bps flashLoanPremiumToProtocol uint128 The part of the premium sent to the protocol treasury, expressed in bps #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#configureemodecategory) configureEModeCategory Configures a new category for the eMode. In eMode, the protocol allows very high borrowing power to borrow assets of the same category. The category 0 is reserved for volatile heterogeneous assets and it's always disabled. Each eMode category has a custom ltv and liquidation threshold. Each eMode category may or may not have a custom oracle to override the individual assets price oracles. Only callable by the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract. **Input Parameters:** Name Type Description id uint8 The total premium, expressed in bps category DataTypes.EModeCategory The configuration of the category The [DataTypes.EModeCategoryarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L114) struct is composed of the following fields: Name Type Description ltv uint16 The custom Loan to Value for the eMode category liquidationThreshold uint16 The custom liquidation threshold for the eMode category liquidationBonus uint16 The liquidation bonus for the eMode category collateralBitmap uint128 Bitmap of collateral assets in the category label string The custom label describing the eMode category borrowableBitmap uint128 Bitmap of borrowable assets in the category #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#resetisolationmodetotaldebt) resetIsolationModeTotalDebt Resets the isolation mode total debt of the given asset to zero. It requires the given asset to have a zero debt ceiling. Only callable by the [PoolConfigurator](https://docs.tydro.com/developers/smart-contracts/pool-configurator) contract. **Input Parameters:** Name Type Description asset address The address of the underlying asset to reset the isolationModeTotalDebt #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#rescuetokens) rescueTokens Rescue and transfer tokens locked in this contract. Only available to [POOL\_ADMIN](https://docs.tydro.com/developers/smart-contracts/aclmanager) role. The Pool Admin is designated by Tydro. **Input Parameters:** Name Type Description token address The address of the token to address The address of the recipient amount uint256 The amount of token to transfer #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#eliminatereservedeficit) eliminateReserveDeficit Covers the deficit of a specified reserve by burning the equivalent aToken amount for assets with virtual accounting enabled or the equivalent amount of underlying for assets with virtual accounting disabled (e.g. GHO). Only callable by address with onlyUmbrella modifier. **Input Parameters:** Name Type Description asset address Underlying token address amount uint256 The amount to be covered, in aToken or underlying on non-virtual accounted assets ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#view-methods) View Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getuseraccountdata) getUserAccountData Returns the user account data across all the reserves. **Input Parameters:** Name Type Description user address The address of the user **Return Values:** Name Type Description totalCollateralBase uint256 The total collateral of the user in the base currency used by the price feed totalDebtBase uint256 The total debt of the user in the base currency used by the price feed availableBorrowsBase uint256 The borrowing power left of the user in the base currency used by the price feed currentLiquidationThreshold uint256 The liquidation threshold of the user ltv uint256 The loan to value of the user healthFactor uint256 The current health factor of the user #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getconfiguration) getConfiguration Returns the configuration of the reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description DataTypes.ReserveConfigurationMap The configuration of the reserve The [DataTypes.ReserveConfigurationMaparrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L79) struct is composed of the following fields: bit Description 0-15 LTV 16-31 Liquidation threshold 32-47 Liquidation bonus 48-55 Decimals 56 Reserve is active 57 Reserve is frozen 58 Borrowing is enabled 59 Stable rate borrowing enabled (deprecated) 60 Asset is paused 61 Borrowing in isolation mode is enabled 62 Siloed borrowing enabled 63 Flashloaning enabled 64-79 Reserve factor 80-115 Borrow cap in whole tokens, borrowCap == 0 => no cap 116-151 Supply cap in whole tokens, supplyCap == 0 => no cap 152-167 Liquidation protocol fee 168-175 eMode category (deprecated) 176-211 Unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled 212-251 Debt ceiling for isolation mode with (ReserveConfiguration::DEBT\_CEILING\_DECIMALS) decimals 252 Virtual accounting is enabled for the reserve 253-255 Unused #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getuserconfiguration) getUserConfiguration Returns the configuration of the user across all the reserves. **Input Parameters:** Name Type Description user address The user address **Return Values:** Type Description DataTypes.UserConfigurationMap The configuration of the user The [DataTypes.UserConfigurationMaparrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L105) struct is composed of the following fields: Name Type Description Data uint256 Bitmap of the users collaterals and borrows. It is divided into pairs of bits, one pair per asset. The first bit indicates if an asset is used as collateral by the user, the second whether an asset is borrowed by the user. The corresponding assets are in the same position as getReservesList(). For example, if the hex value returned is 0x40020, which represents a decimal value of 262176, then in binary it is 1000000000000100000. If we format the binary value into pairs, starting from the right, we get 1 00 00 00 00 00 00 10 00 00. If we start from the right and move left in the above binary pairs, the third pair is 10. Therefore the 1 indicates that third asset from the reserveList is used as collateral, and 0 indicates it has not been borrowed by this user #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getreservenormalizedincome) getReserveNormalizedIncome Returns the ongoing normalized income for the reserve. A value of 1e27 means there is no income. As time passes, the yield is accrued. A value of 2\*1e27 means for each unit of asset, one unit of income has been accrued. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description uint256 The reserve's normalized income #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getreservenormalizedvariabledebt) getReserveNormalizedVariableDebt Returns the normalized variable debt per unit of asset. A value of 1e27 means there is no debt. As time passes, the debt is accrued. A value of 2\*1e27means that for each unit of debt, one unit worth of interest has been accumulated. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description uint256 The reserve normalized variable debt #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getreserveslist) getReservesList Returns the list of the underlying assets of all the initialized reserves. It does not include dropped reserves. **Return Values:** Type Description address\[\] The addresses of the underlying assets of the initialized reserves #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getreserveaddressbyid) getReserveAddressById Returns the address of the underlying asset of a reserve by the reserve id as stored in the [DataTypes.ReserveDataarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L42) struct. **Input Parameters:** Name Type Description id uint16 The id of the reserve as stored in the [DataTypes.ReserveDataarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L42) struct **Return Values:** Type Description address The address of the reserve associated with id #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getemodecategorydata) getEModeCategoryData Returns the data of an eMode category. Each eMode category has a custom LTV and liquidation threshold. Each eMode category may or may not have a custom oracle to override the individual assets' price oracles. **Input Parameters:** Name Type Description id uint8 The id of the category **Return Values:** Type Description DataTypes.EModeCategory The configuration data of the category The [DataTypes.EModeCategoryarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L114) struct is composed of the following fields: Name Type Description ltv uint16 The custom Loan to Value for the eMode category liquidationThreshold uint16 The custom liquidation threshold for the eMode category liquidationBonus uint16 The liquidation bonus for the eMode category collateralBitmap uint128 Bitmap of collateral assets in the category label string The custom label describing the eMode category borrowableBitmap uint128 Bitmap of borrowable assets in the category #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getreservedata) getReserveData Returns the state and configuration of the reserve. **Input Parameters:** Name Type Description asset address The address of the underlying asset of the reserve **Return Values:** Type Description DataTypes.ReserveData The state and configuration data of the reserve The [DataTypes.ReserveDataarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L42) struct is composed of the following fields: Name Type Description configuration ReserveConfigurationMap Stores the [reserve configurationarrow-up-right](https://github.com/aave-dao/aave-v3-origin/blob/3aad8ca184159732e4b3d8c82cd56a8707a106a2/src/core/contracts/protocol/libraries/types/DataTypes.sol#L42) liquidityIndex uint128 The yield generated by the reserve during time interval since lastUpdatedTimestamp. Expressed in ray currentLiquidityRate uint128 The current supply rate. Expressed in ray variableBorrowIndex uint128 The yield accrued by reserve during time interval since lastUpdatedTimestamp. Expressed in ray currentVariableBorrowRate uint128 The current variable borrow rate. Expressed in ray \_\_deprecatedStableBorrowRate uint128 DEPRECATED on v3.2.0 lastUpdateTimestamp uint40 The timestamp of when reserve data was last updated. Used for yield calculation id uint16 The id of the reserve. It represents the reserve’s position in the list of active reserves liquidationGracePeriodUntil uint40 The timestamp until liquidations are not allowed on the reserve. If set to the past, liquidations will be allowed aTokenAddress address The address of associated aToken \_\_deprecatedStableDebtTokenAddress address DEPRECATED on v3.2.0 variableDebtTokenAddress address The address of associated variable debt token interestRateStrategyAddress address The address of interest rate strategy accruedToTreasury uint128 The current treasury balance (scaled) unbacked uint128 The outstanding unbacked aTokens minted through the bridging feature isolationModeTotalDebt uint128 The outstanding debt borrowed against this asset in isolation mode virtualUnderlyingBalance uint128 The virtual balance of the underlying asset for yield calculation purposes #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getuseremode) getUserEMode Returns eMode the user is using. 0 is a non eMode category. **Input Parameters:** Name Type Description user address The address of the user **Return Values:** Type Description uint256 The eMode id #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#flashloan_premium_total) FLASHLOAN\_PREMIUM\_TOTAL Returns the percent of total flashloan premium paid by the borrower. A part of this premium is added to reserve's liquidity index i.e. paid to the liquidity provider and the other part is paid to the protocol i.e. accrued to the treasury. **Return Values:** Type Description uint128 The total fee on flashloans #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#bridge_protocol_fee) BRIDGE\_PROTOCOL\_FEE Returns the part of the bridge fees sent to protocol. **Return Values:** Type Description uint256 The percentage of available liquidity to borrow, expressed in bps #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#flashloan_premium_to_protocol) FLASHLOAN\_PREMIUM\_TO\_PROTOCOL Returns the percent of flashloan premium that is accrued to the treasury. **Return Values:** Type Description uint128 The percentage of available liquidity to borrow, expressed in bps #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#max_number_reserves) MAX\_NUMBER\_RESERVES Returns the maximum number of reserves supported to be listed in this Pool. **Return Values:** Type Description uint16 The maximum number of reserves supported #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getliquidationgraceperiod) getLiquidationGracePeriod Returns the liquidation grace period of the given asset **Input Parameters:** Name Type Description asset address Underlying token address **Return Values:** Type Description uint256 Timestamp when the liquidation grace period will end #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getreservedeficit) getReserveDeficit Returns the current deficit of a reserve. **Input Parameters:** Name Type Description asset address Underlying token address **Return Values:** Type Description uint256 Current reserve deficit from undercollateralized borrow positions #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getreserveatoken) getReserveAToken Returns the aToken address of a reserve. **Input Parameters:** Name Type Description asset address Underlying token address **Return Values:** Type Description address The address of the AToken #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getreservevariabledebttoken) getReserveVariableDebtToken Returns the variableDebtToken address of a reserve. **Input Parameters:** Name Type Description asset address Underlying token address **Return Values:** Type Description address The address of the VariableDebtToken ### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#pure-methods) Pure Methods #### [hashtag](https://docs.tydro.com/developers/smart-contracts/pool#getrevision) getRevision Returns the revision number of the contract. Needs to be defined in the inherited class as a constant. Returns 0x1. **Return Values:** Type Description uint256 The revision number [PreviousSmart Contractschevron-left](https://docs.tydro.com/developers/smart-contracts) [NextL2 Poolchevron-right](https://docs.tydro.com/developers/smart-contracts/l2-pool) Last updated 3 months ago * [Write Methods](https://docs.tydro.com/developers/smart-contracts/pool#write-methods) * [View Methods](https://docs.tydro.com/developers/smart-contracts/pool#view-methods) * [Pure Methods](https://docs.tydro.com/developers/smart-contracts/pool#pure-methods) Copy function supply( address asset, uint256 amount, address onBehalfOf, uint16 referralCode ) public virtual override Copy function supplyWithPermit( address asset, uint256 amount, address onBehalfOf, uint16 referralCode, uint256 deadline, uint8 permitV, bytes32 permitR, bytes32 permitS ) public virtual override Copy function withdraw(address asset, uint256 amount, address to) public virtual override returns (uint256) Copy function borrow( address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf ) public virtual override Copy function repay( address asset, uint256 amount, uint256 interestRateMode, address onBehalfOf ) public virtual override returns (uint256) Copy function repayWithPermit( address asset, uint256 amount, uint256 interestRateMode, address onBehalfOf, uint256 deadline, uint8 permitV, bytes32 permitR, bytes32 permitS ) public virtual override returns (uint256) Copy function repayWithATokens(address asset, uint256 amount, uint256 interestRateMode ) public virtual override returns (uint256) Copy function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) public virtual override Copy function liquidationCall( address collateralAsset, address debtAsset, address user, uint256 debtToCover, bool receiveAToken ) public virtual override Copy function flashLoan( address receiverAddress, address[] calldata assets, uint256[] calldata amounts, uint256[] calldata interestRateModes, address onBehalfOf, bytes calldata params, uint16 referralCode ) public virtual override Copy function flashLoanSimple( address receiverAddress, address asset, uint256 amount, bytes calldata params, uint16 referralCode) public virtual override Copy function mintToTreasury(address[] calldata assets) external virtual override Copy function finalizeTransfer( address asset, address from, address to, uint256 amount, uint256 balanceFromBefore, uint256 balanceToBefore) external virtual override Copy function setUserEMode(uint8 categoryId) external virtual override Copy function mintUnbacked( address asset, uint256 amount, address onBehalfOf, uint16 referralCode ) external virtual override onlyBridge Copy function backUnbacked( address asset, uint256 amount, uint256 fee) external virtual override onlyBridge returns (uint256) Copy function initReserve( address asset, address aTokenAddress, address stableDebtAddress, address variableDebtAddress, address interestRateStrategyAddress) external virtual override onlyPoolConfigurator Copy function dropReserve(address asset) external virtual override onlyPoolConfigurator Copy function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress) external virtual override onlyPoolConfigurator Copy function setConfiguration(address asset, DataTypes.ReserveConfigurationMap calldata configuration) external virtual override onlyPoolConfigurator Copy function updateBridgeProtocolFee(uint256 protocolFee) external virtual override onlyPoolConfigurator Copy function updateFlashloanPremiums(uint128 flashLoanPremiumTotal, uint128 flashLoanPremiumToProtocol) external virtual override onlyPoolConfigurator Copy function configureEModeCategory(uint8 id, DataTypes.EModeCategory memory category) external virtual override onlyPoolConfigurator Copy function resetIsolationModeTotalDebt(address asset) external virtual override onlyPoolConfigurator Copy function rescueTokens( address token, address to, uint256 amount ) external virtual override onlyPoolAdmin Copy function eliminateReserveDeficit(address asset, uint256 amount) external; Copy function getUserAccountData(address user) external view virtual override returns ( uint256 totalCollateralBase, uint256 totalDebtBase, uint256 availableBorrowsBase, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor) Copy function getConfiguration(address asset) external view virtual override returns (DataTypes.ReserveConfigurationMap memory) Copy function getUserConfiguration(address user) external view virtual override returns (DataTypes.UserConfigurationMap memory) Copy function getReserveNormalizedIncome(address asset) external view virtual override returns (uint256) Copy function getReserveNormalizedVariableDebt(address asset) external view virtual override returns (uint256) Copy function getReservesList() external view virtual override returns (address[] memory) Copy function getReserveAddressById(uint16 id) external view returns (address) Copy function getEModeCategoryData(uint8 id) external view virtual override returns (DataTypes.EModeCategory memory) Copy function getReserveData(address asset) external view virtual override returns (DataTypes.ReserveData memory) Copy function getUserEMode(address user) external view virtual override returns (uint256) Copy function FLASHLOAN_PREMIUM_TOTAL() public view virtual override returns (uint128) Copy function BRIDGE_PROTOCOL_FEE() public view virtual override returns (uint256) Copy function FLASHLOAN_PREMIUM_TO_PROTOCOL() public view virtual override returns (uint128) Copy function MAX_NUMBER_RESERVES() public view virtual override returns (uint16) Copy function getLiquidationGracePeriod(address asset) external view virtual override returns (uint40) Copy function getReserveDeficit(address asset) external view returns (uint256); Copy function getReserveAToken(address asset) external view returns (address); Copy function getReserveVariableDebtToken(address asset) external view returns (address); Copy function getRevision() internal pure virtual override returns (uint256) --- # Overview | Tydro Documentation [hashtag](https://docs.tydro.com/introduction#tydro-documentation) Tydro Documentation ------------------------------------------------------------------------------------------- Tydro is a non-custodial lending protocol for onchain capital markets. Powered by Aave and built on Ink, it enables trustless borrowing, flexible collateral, and seamless coordination across the Ink ecosystem and beyond. Suppliers earn interest by providing liquidity to supported markets. Borrowers access capital by providing collateral that exceeds the borrowed amount. [Concepts](https://docs.tydro.com/introduction/concepts) [Liquidity Protocol](https://docs.tydro.com/primitives/liquidity-pool) [Reserve](https://docs.tydro.com/primitives/reserve) [Oracle](https://docs.tydro.com/primitives/oracle) [Flash Loans](https://docs.tydro.com/primitives/flash-loans) [Smart Contracts](https://docs.tydro.com/developers/smart-contracts) [Resources](https://docs.tydro.com/resources/risks) [FAQsarrow-up-right](https://tydro-page.webflow.io/faq) ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FlmqeIPg1imb4ONREn9yj%252F58-3.png%3Falt%3Dmedia%26token%3Dedd458fa-62cc-4e21-8936-39fd72b3b897&width=768&dpr=3&quality=100&sign=1de7faa&sv=2) [NextConceptschevron-right](https://docs.tydro.com/introduction/concepts) Last updated 3 months ago --- # Liquidity Pool | Tydro Documentation ![](https://docs.tydro.com/~gitbook/image?url=https%3A%2F%2F710064532-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUBm7pNGfoWEDcBs1hL6I%252Fuploads%252FFYjeoTH5oPUl5FHFstph%252F77-2.png%3Falt%3Dmedia%26token%3D51234915-6975-4024-b0ce-97aa28b753bf&width=768&dpr=3&quality=100&sign=b241809&sv=2) A liquidity pool is a Tydro market instance that enables users to participate as suppliers or borrowers. Parameters such as reserve configurations and collateralisation thresholds define each pool. Suppliers deposit liquidity into the pool that borrowers can access through overcollateralised positions. In return, suppliers earn interest while borrowers gain access to liquidity, all facilitated through decentralised smart contracts. Tydro liquidity pools operate across supported blockchain networks. Smart contracts enforce pool parameters and automate borrowing, repayment, and liquidation without intermediaries. This decentralised design enhances the transparency, efficiency, and security of financial interactions within the pool [PreviousLiquidationschevron-left](https://docs.tydro.com/introduction/concepts/liquidations) [NextReservechevron-right](https://docs.tydro.com/primitives/reserve) Last updated 4 months ago --- # Smart Contracts | Tydro Documentation Tydro is built on a modular set of smart contracts, all available on [GitHubarrow-up-right](https://github.com/aave-dao/aave-v3-origin) . Developers can integrate contract addresses directly into Solidity or JavaScript projects using the [Tydro Address Book.](https://docs.tydro.com/resources/addresses) The repository is organized into the following categories: * Pool * Configuration * Logic * Tokenization * Helpers * Misc ### [hashtag](https://docs.tydro.com/developers#pool) Pool #### [hashtag](https://docs.tydro.com/developers#pool-1) 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. #### [hashtag](https://docs.tydro.com/developers#l2pool) 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. #### [hashtag](https://docs.tydro.com/developers#poolconfigurator) 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. ### [hashtag](https://docs.tydro.com/developers#configuration) 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. #### [hashtag](https://docs.tydro.com/developers#pooladdressesprovider) 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. ### [hashtag](https://docs.tydro.com/developers#logic) Logic [Librariesarrow-up-right](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. ### [hashtag](https://docs.tydro.com/developers#tokenization) Tokenization #### [hashtag](https://docs.tydro.com/developers#atoken) 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 #### [hashtag](https://docs.tydro.com/developers#variabledebttoken) 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. ### [hashtag](https://docs.tydro.com/developers#helpers) Helpers #### [hashtag](https://docs.tydro.com/developers#l2encoder) L2Encoder The [L2Encoderarrow-up-right](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. #### [hashtag](https://docs.tydro.com/developers#tydroprotocoldataprovider) TydroProtocolDataProvider The [TydroProtocolDataProvider](https://docs.tydro.com/developers/smart-contracts/view-contracts#view-contracts) and formats data from the Pool, making it easier for applications to access key protocol information. ### [hashtag](https://docs.tydro.com/developers#misc) Misc #### [hashtag](https://docs.tydro.com/developers#tydrooracle) TydroOracle The [TydroOracle](https://docs.tydro.com/developers/smart-contracts/oracles#aaveoracle) manages reserve oracles and provides reference prices for assets. It ensures accurate pricing and updates sources as needed. #### [hashtag](https://docs.tydro.com/developers#defaultreserveinterestratestrategy) 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. #### [hashtag](https://docs.tydro.com/developers#priceoraclesentinel) 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. [PreviousFlash Loanschevron-left](https://docs.tydro.com/primitives/flash-loans) [NextPoolchevron-right](https://docs.tydro.com/developers/smart-contracts/pool) Last updated 3 months ago ---