💜
FluidNFT Docs
  • 👋Welcome to Fluid!
  • Overview
    • 🌊What we do
    • ✨Our Features
    • 🤩About Us
  • Product Guides
    • 💜For Borrowers
      • Get a Loan
      • Repay a Loan
      • Refinance a Loan
      • Get Help Repaying
    • 🖼️For Creators
      • Add a Collection
      • Deposit ETH / Tokens
      • Withdraw ETH / Tokens
    • 💫For the Community
      • Trigger an Auction
      • Purchase NFTs at Auction
  • Risk Management
    • ✳️Risk Framework
      • 👩‍🏫Data
      • 👩‍🔬Methodology
      • ⚙️Risk Parameters
      • 🛰️Risk Monitoring
      • 📊Price Discovery
      • 🔃Recovery / Liquidation
  • Technical Resources
    • 🤖Protocol Overview
      • 📝Whitepaper
    • 🔐Security
      • 🔎Audits
      • 📗Test Report
    • 👩‍💻Developers
      • 🎊Contract Integration
        • ⛓️Deployed Contracts
      • 📚Contract Reference
        • Collateral Manager
          • ICollateralManager
        • LendingPool
          • ILendingPool
        • Address Provider
          • IAddressProvider
        • Address Provider Registry
          • IAddressProviderRegistry
        • Execution Manager
          • IExecutionManager
        • Execution Delegate
          • IExecutionDelegate
        • Configurator
          • IConfigurator
        • Interest Rate Strategy
          • IInterestRateStrategy
        • Lending Rate Manager
          • ILendingRateManager
        • F Tokens
          • IFToken
        • Debt Tokens
          • IStableDebtToken
          • IVariableDebtToken
        • Obligation Receipt
          • IObligationReceipt
        • WETH Gateway
          • IWETHGateway
      • 🛠️SDK
      • 📡Subgraph
Powered by GitBook
On this page
  1. Technical Resources
  2. Developers
  3. Contract Reference
  4. Debt Tokens

IStableDebtToken

// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;

import { IInitializableDebtToken } from "./IInitializableDebtToken.sol";
import { IPoolIncentivesController } from "./IPoolIncentivesController.sol";

/**
 * @title IStableDebtToken
 * @notice Defines the interface for the stable debt token
 * @dev It does not inherit from IERC20 to save in code size
 * @author FluidNFT
 **/

interface IStableDebtToken is IInitializableDebtToken {
  /**
   * @dev Emitted when new stable debt is minted
   * @param user The address of the user who triggered the minting
   * @param onBehalfOf The recipient of stable debt tokens
   * @param amount The amount minted
   * @param currentBalance The current balance of the user
   * @param balanceIncrease The increase in balance since the last action of the user
   * @param newRate The rate of the debt after the minting
   * @param avgStableRate The new average stable rate after the minting
   * @param newTotalSupply The new total supply of the stable debt token after the action
   **/
  event Mint(
    address indexed user,
    address indexed onBehalfOf,
    uint256 amount,
    uint256 currentBalance,
    uint256 balanceIncrease,
    uint256 newRate,
    uint256 avgStableRate,
    uint256 newTotalSupply
  );

  /**
   * @dev Emitted when new stable debt is burned
   * @param user The address of the user
   * @param amount The amount being burned
   * @param currentBalance The current balance of the user
   * @param balanceIncrease The the increase in balance since the last action of the user
   * @param avgStableRate The new average stable rate after the burning
   * @param newTotalSupply The new total supply of the stable debt token after the action
   **/
  event Burn(
    address indexed user,
    uint256 amount,
    uint256 currentBalance,
    uint256 balanceIncrease,
    uint256 avgStableRate,
    uint256 newTotalSupply
  );

  function initialize(
      address addressProvider,
      address underlyingCollateral,
      address underlyingAsset,
      uint256 underlyingMaxTokenId,
      uint256 underlyingMinTokenId,
      uint8 debtTokenDecimals,
      string memory debtTokenName,
      string memory debtTokenSymbol
  ) external;

  /**
   * @dev Mints debt token to the `onBehalfOf` address.
   * - The resulting rate is the weighted average between the rate of the new debt
   * and the rate of the previous debt
   * @param user The address receiving the borrowed underlying, being the delegatee in case
   * of credit delegate, or same as `onBehalfOf` otherwise
   * @param onBehalfOf The address receiving the debt tokens
   * @param amount The amount of debt tokens to mint
   * @param rate The rate of the debt being minted
   **/
  function mint(
    address user,
    address onBehalfOf,
    uint256 amount,
    uint256 rate
  ) external returns (bool);

  /**
   * @dev Burns debt of `user`
   * - The resulting rate is the weighted average between the rate of the new debt
   * and the rate of the previous debt
   * @param user The address of the user getting his debt burned
   * @param amount The amount of debt tokens getting burned
   **/
  function burn(address user, uint256 amount) external;

  /**
   * @dev Returns the average rate of all the stable rate loans.
   * @return The average stable rate
   **/
  function getAverageStableRate() external view returns (uint256);

  /**
   * @dev Returns the stable rate of the user debt
   * @return The stable rate of the user
   **/
  function getUserStableRate(address user) external view returns (uint256);

  /**
   * @dev Returns the timestamp of the last update of the user
   * @return The timestamp
   **/
  function getUserLastUpdated(address user) external view returns (uint40);

  /**
   * @dev Returns the principal, the total supply and the average stable rate
   **/
  function getSupplyData()
    external
    view
    returns (
      uint256,
      uint256,
      uint256,
      uint40
    );

  /**
   * @dev Returns the timestamp of the last update of the total supply
   * @return The timestamp
   **/
  function getTotalSupplyLastUpdated() external view returns (uint40);

  /**
   * @dev Returns the total supply and the average stable rate
   **/
  function getTotalSupplyAndAvgRate() external view returns (uint256, uint256);

  /**
   * @dev Returns the principal debt balance of the user
   * @return The debt balance of the user since the last burn/mint action
   **/
  function principalBalanceOf(address user) external view returns (uint256);

  /**
   * @dev Returns the address of the incentives controller contract
   **/
  function getPoolIncentivesController() external view returns (IPoolIncentivesController);
}
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;

import { ILendingPool } from './ILendingPool.sol';
import { IPoolIncentivesController } from './IPoolIncentivesController.sol';

/**
 * @title IInitializableDebtToken
 * @notice Interface for the initialize function common between debt tokens
 * @author FluidNFT
 **/
interface IInitializableDebtToken {
    /**
     * @dev Emitted when a debt token is initialized
     * @param underlyingCollateral The address of the underlying collateral
     * @param underlyingAsset The address of the underlying asset
     * @param pool The address of the associated lending pool
     * @param incentivesController The address of the incentives controller for this aToken
     * @param debtTokenDecimals the decimals of the debt token
     * @param debtTokenName the name of the debt token
     * @param debtTokenSymbol the symbol of the debt token
     **/
    event Initialized(
        address indexed underlyingCollateral,
        address indexed underlyingAsset,
        address indexed pool,
        address incentivesController,
        uint8 debtTokenDecimals,
        string debtTokenName,
        string debtTokenSymbol
    );

    /**
    * @dev Initializes the debt token.
    * @param addressProvider The address provider 
    * @param underlyingCollateral The address of the underlying collateral of this debtToken
    * @param underlyingAsset The address of the underlying asset of this debtToken
    * @param underlyingMaxTokenId The max tokenId of the underlying collateral of this debtToken
    * @param underlyingMinTokenId The min tokenId of the underlying collateral of this debtToken
    * @param debtTokenDecimals The decimals of the debtToken, same as the underlying asset's
    * @param debtTokenName The name of the token
    * @param debtTokenSymbol The symbol of the token
    */
    function initialize(
        address addressProvider,
        address underlyingCollateral,
        address underlyingAsset,
        uint256 underlyingMaxTokenId,
        uint256 underlyingMinTokenId,
        uint8 debtTokenDecimals,
        string memory debtTokenName,
        string memory debtTokenSymbol
    ) 
        external;
}
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;
pragma abicoder v2;

import { IScaledBalanceToken } from "./IScaledBalanceToken.sol";

interface IPoolIncentivesController {
    event RewardsAccrued(address indexed _user, uint256 _amount);

    event RewardsClaimed(address indexed _user, uint256 _amount);

    /**
     * @dev Configure assets for a certain rewards emission
     * @param _assets The assets to incentivize
     * @param _emissionsPerSecond The emission for each asset
     */
    function configureAssets(
        IScaledBalanceToken[] calldata _assets,
        uint256[] calldata _emissionsPerSecond
    ) external;

    /**
     * @dev Called by the corresponding asset on any update that affects the rewards distribution
     * @param _user The address of the user
     * @param _totalSupply The total supply of the asset in the lending pool
     * @param _userBalance The balance of the user of the asset in the lending pool
     **/
    function handleAction(
        address _user,
        uint256 _totalSupply,
        uint256 _userBalance
    ) external;

    /**
     * @dev Returns the total of rewards of an user, already accrued + not yet accrued
     * @param _assets The assets to incentivize
     * @param _user The address of the user
     * @return The rewards
     **/
    function getRewardsBalance(
        IScaledBalanceToken[] calldata _assets,
        address _user
    ) external view returns (uint256);

    /**
     * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
     * @param _assets The assets to incentivize
     * @param _amount Amount of rewards to claim
     * @return Rewards claimed
     **/
    function claimRewards(
        IScaledBalanceToken[] calldata _assets,
        uint256 _amount
    ) external returns (uint256);

    /**
     * @dev returns the unclaimed rewards of the user
     * @param _user the address of the user
     * @return the unclaimed user rewards
     */
    function getUserUnclaimedRewards(address _user)
        external
        view
        returns (uint256);
}
PreviousDebt TokensNextIVariableDebtToken

Last updated 1 year ago

👩‍💻
📚