IFToken
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;
// import {IAddressProvider} from "./IAddressProvider.sol";
import { IPoolIncentivesController } from "./IPoolIncentivesController.sol";
import { IScaledBalanceToken } from "./IScaledBalanceToken.sol";
import { IAddressProvider } from "./IAddressProvider.sol";
import { ConfigTypes } from "../protocol/libraries/types/ConfigTypes.sol";
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import { IERC20MetadataUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
interface IFToken is IScaledBalanceToken, IERC20Upgradeable, IERC20MetadataUpgradeable {
/**
* @dev Emitted when an fToken is initialized
* @param underlyingCollateral The address of the underlying collateral
* @param underlyingAsset The address of the underlying asset
* @param lendingPool The address of the associated lending pool
* @param incentivesController The address of the incentives controller for this fToken
* @param treasury The address of the treasury
* @param creatorPercentage The address of the creator
* @param creator The address of the creator
* @param creator The address of the creator
**/
event Initialized(
address indexed underlyingCollateral,
address indexed underlyingAsset,
address indexed lendingPool,
address incentivesController,
address treasury,
address creator,
uint256 creatorPercentage,
uint256 auctionCallerPercentage,
uint256 auctionCreatorPercentage
);
/**
* @dev Emitted after the mint action
* @param from The address performing the mint
* @param value The amount being
* @param index The new liquidity index of the reserve
**/
event Mint(address indexed from, uint256 value, uint256 index);
/**
* @dev Emitted after fTokens are burned
* @param from The owner of the fTokens, getting them burned
* @param target The address that will receive the underlying
* @param value The amount being burned
* @param index The new liquidity index of the reserve
**/
event Burn(address indexed from, address indexed target, uint256 value, uint256 index);
/**
* @dev Emitted during the transfer action
* @param from The user whose tokens are being transferred
* @param to The recipient
* @param value The amount being transferred
* @param index The new liquidity index of the reserve
**/
event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);
/**
* @dev Emitted when creator address is updated
* @param creatorAddress is the new address
**/
event CreatorAddressUpdated(uint256 creatorAddress);
/**
* @dev Emitted when creator percentage is updated
* @param creatorPercentage is the new percentage
**/
event CreatorPecentageUpdated(uint256 creatorPercentage);
function initialize(
IAddressProvider addressProvider,
ConfigTypes.InitReserveInput calldata input
) external;
function mint(
address user,
uint256 amount,
uint256 index
) external returns (bool);
function burn(
address user,
address receiverOfUnderlying,
uint256 amount,
uint256 index
) external;
function mintVariableDebtRepaymentToStakeholders(uint256 amount, uint256 index) external;
function mintStableDebtRepaymentToStakeholders(address user, uint256 amount, uint256 index) external;
function mintAuctionPaymentToStakeholders(
address user,
address caller,
address owner,
uint256 amount,
uint256 liquidationFee,
uint256 index
) external;
// /**
// * @dev Invoked to execute actions on the fToken side after a repayment.
// * @param user The user executing the repayment
// * @param amount The amount getting repaid
// **/
// function handleRepayment(address user, uint256 amount) external;
// function handleAuctionPayment(address user, address caller, address owner, uint256 amount, uint256 fee) external;
function transferUnderlyingTo(address user, uint256 amount) external returns (uint256);
function getReserveNormalizationFactor() external view returns (uint256);
function getPoolIncentivesController() external view returns (IPoolIncentivesController);
function exchangeRate() external view returns (uint256);
function setReserveCreatorAddress(address creator) external;
function getReserveCreatorAddress() external view returns (address);
function setReserveCreatorPercentage(uint256 percentage) external;
function getReserveCreatorPercentage() external view returns (uint256);
function setAuctionCallerPercentage(uint256 percentage) external;
function getAuctionCallerPercentage() external view returns (uint256);
function setAuctionCreatorPercentage(uint256 percentage) external;
function getAuctionCreatorPercentage() external view returns (uint256);
function RESERVE_TREASURY_ADDRESS() external view returns (address);
function UNDERLYING_COLLATERAL_ADDRESS() external view returns (address);
function UNDERLYING_ASSET_ADDRESS() external view returns (address);
function UNDERLYING_MAX_TOKEN_ID() external view returns (uint256);
function UNDERLYING_MIN_TOKEN_ID() external view returns (uint256);
}
// 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);
}
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;
interface IScaledBalanceToken {
/**
* @dev Returns the scaled balance of the user. The scaled balance is the sum of all the
* updated stored balance divided by the reserve's liquidity index at the moment of the update
* @param user The user whose balance is calculated
* @return The scaled balance of the user
**/
function scaledBalanceOf(address user) external view returns (uint256);
/**
* @dev Returns the scaled balance of the user and the scaled total supply.
* @param user The address of the user
* @return The scaled balance of the user
* @return The scaled balance and the scaled total supply
**/
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
/**
* @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
* @return The scaled total supply
**/
function scaledTotalSupply() external view returns (uint256);
}
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;
/**
* @title AddressProvider contract
* @dev Main registry of addresses part of or connected to the protocol, including permissioned roles
* - Acting also as factory of proxies and admin of those, so with right to change its implementations
* - Owned by the FluidNFT Governance
* @author FluidNFT
**/
interface IAddressProvider {
event MarketIdSet(string newMarketId);
event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy);
event ExecutionDelegateUpdated(address indexed newAddress);
event ExecutionManagerUpdated(address indexed newAddress);
event LendingUpdated(address indexed newAddress);
event PromissoryNoteUpdated(address indexed newAddress);
event PromissoryNoteBundleUpdated(address indexed newAddress);
event ObligationReceiptUpdated(address indexed newAddress);
event ObligationReceiptBundleUpdated(address indexed newAddress);
event LendingPoolUpdated(address indexed newAddress);
event ConfiguratorUpdated(address indexed newAddress);
event CollateralManagerUpdated(address indexed newAddress);
event PeerAdminUpdated(address indexed newAddress);
event PoolAdminUpdated(address indexed newAddress);
event EmergencyAdminUpdated(address indexed newAddress);
event PriceConsumerUpdated(address indexed newAddress);
event FluidTokenUpdated(address indexed newAddress);
event PoolIncentivesControllerUpdated(address indexed newAddress);
event PeerIncentivesControllerUpdated(address indexed newAddress);
event ReferralManagerUpdated(address indexed newAddress);
event TreasuryUpdated(address indexed newAddress);
event DelegationRegistryUpdated(address indexed newAddress);
event ProxyCreated(bytes32 id, address indexed newAddress);
event FTokenImplUpdated(address indexed newAddress);
event DebtTokenImplUpdated(address indexed newAddress);
event NFTPriceOracleUpdated(address indexed newAddress);
event LendingRateManagerUpdated(address indexed newAddress);
event WETHUpdated(address indexed newAddress);
event WETHGatewayUpdated(address indexed newAddress);
function getMarketId() external view returns (string memory);
function setMarketId(string calldata marketId) external;
function getAddress(bytes32 id) external view returns (address);
function setAddress(bytes32 id, address newAddress) external;
function setAddressAsProxy(
bytes32 id,
address impl
) external;
function getExecutionDelegate() external view returns (address);
function setExecutionDelegate(address executionDelegate) external;
function getExecutionManager() external view returns (address);
function setExecutionManager(address executionManager) external;
function getLending() external view returns (address);
function setLending(address lending) external;
function getPromissoryNote() external view returns (address);
function setPromissoryNote(address promissoryNote) external;
function getPromissoryNoteBundle() external view returns (address);
function setPromissoryNoteBundle(address promissoryNote) external;
function getObligationReceipt() external view returns (address);
function setObligationReceipt(address obligationReceipt) external;
function getObligationReceiptBundle() external view returns (address);
function setObligationReceiptBundle(address obligationReceipt) external;
function getLendingPool() external view returns (address);
function setLendingPool(address pool) external;
function getConfigurator() external view returns (address);
function setConfigurator(address configurator) external;
function setConfiguratorImpl(address configurator) external;
function getCollateralManager() external view returns (address);
function setCollateralManager(address collateralManager) external;
function getPeerAdmin() external view returns (address);
function setPeerAdmin(address admin) external;
function getPoolAdmin() external view returns (address);
function setPoolAdmin(address admin) external;
function getEmergencyAdmin() external view returns (address);
function setEmergencyAdmin(address admin) external;
function getNFTPriceOracle() external view returns (address);
function setNFTPriceOracle(address nftPriceOracle) external;
function getLendingRateManager() external view returns (address);
function setLendingRateManager(address lendingRateManager) external;
function getPriceConsumerV3() external view returns (address);
function setPriceConsumerV3(address priceConsumerV3) external;
function getFluidToken() external view returns (address);
function setFluidToken(address fluidToken) external;
function getPoolIncentivesController() external view returns (address);
function setPoolIncentivesController(address controller) external;
function getPeerIncentivesController() external view returns (address);
function setPeerIncentivesController(address controller) external;
function getReferralManager() external view returns (address);
function setReferralManager(address referralManager) external;
function getTreasury() external view returns (address);
function setTreasury(address treasury) external;
function getDelegationRegistry() external view returns (address);
function setDelegationRegistry(address delegationRegistry) external;
function getFTokenImpl() external view returns (address);
function setFTokenImpl(address fTokenImpl) external;
function getDebtTokenImpl() external view returns (address);
function setDebtTokenImpl(address debtTokenImpl) external;
function getWETH() external view returns (address);
function setWETH(address weth) external;
function getWETHGateway() external view returns (address);
function setWETHGateway(address weth) external;
}
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;
library ConfigTypes {
struct InitReserveInput {
//collateral params
address underlyingCollateral;
string underlyingCollateralName;
string underlyingCollateralSymbol;
uint256 underlyingMaxTokenId;
uint256 underlyingMinTokenId;
//asset params
address underlyingAsset;
string underlyingAssetName;
string underlyingAssetSymbol;
uint8 underlyingAssetDecimals;
//fToken params
address fTokenImpl;
string fTokenName;
string fTokenSymbol;
//stable debtToken params
address stableDebtTokenImpl;
string stableDebtTokenName;
string stableDebtTokenSymbol;
//variable debtToken params
address variableDebtTokenImpl;
string variableDebtTokenName;
string variableDebtTokenSymbol;
//risk params
address interestRateStrategy;
uint256 baseLTV;
//account params
address treasury;
address creator;
//fee params
uint256 creatorPercentage;
//auction params
uint256 auctionCallerPercentage;
uint256 auctionCreatorPercentage;
//oracle params
string assetPriceFeed;
}
struct ConfigReserveInput {
//reserve params
uint256 reserveId;
uint256 reserveFactor;
//collateral params
uint256 ltv;
//asset params
uint256 decimals;
//default params
uint256 gracePeriod;
uint256 liquidationBonus;
uint256 liquidationThreshold;
//auction params
uint256 auctionDuration;
uint256 auctionPriceMultiple;
//conditional params
bool borrowingEnabled;
}
struct InitNFTPriceGroupDataInput {
address[15] nfts;
uint256[15] reserveIds;
uint256[15] traitIds;
uint256[15] basePrices;
}
struct BasePriceInput {
uint256 groupId;
address[15] nfts;
uint256[15] traitIds;
uint256[15] basePrices;
}
struct DeltaInput {
uint256 groupId;
uint256[15] nfts;
uint256[15] currentPrices;
}
struct UpdateFTokenInput {
address collateral;
address asset;
address implementation;
uint256 reserveId;
bytes encodedCallData;
}
struct UpdateDebtTokenInput {
address collateral;
address asset;
address implementation;
uint256 reserveId;
bytes encodedCallData;
}
}
Last updated