ILendingPool
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;
import { IAddressProvider } from "../interfaces/IAddressProvider.sol";
import { ConfigTypes } from "../protocol/libraries/types/ConfigTypes.sol";
import { DataTypes } from "../protocol/libraries/types/DataTypes.sol";
interface ILendingPool {
/**
* @dev Emitted when the pause is triggered.
*/
event Paused();
/**
* @dev Emitted when the pause is lifted.
*/
event Unpaused();
/**
* @dev Emitted when the pause time is updated.
*/
event PausedTimeUpdated(uint256 startTime, uint256 durationTime);
/**
* @notice Emitted when an asset deposit is made.
* @param initiator The address initiating the deposit.
* @param collateral The Lending Pool underlying reserve collateral.
* @param asset The ERC20, reserve asset address.
* @param amount The amount of ERC20 tokens.
* @param onBehalfOf The address that will receive the fTokens, same as msg.sender if the user wants to receive them on their own wallet, different if the benefitiary is a different wallet.
* @param referalCode Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man
**/
event Deposit(
address initiator,
address collateral,
address asset,
uint256 indexed reserveId,
uint256 amount,
address indexed onBehalfOf,
uint16 indexed referalCode
);
/**
* @notice Emitted when an asset withdraw is made.
* @param initiator The address initiating the withdrawl / owner of fTokens.
* @param collateral The Lending Pool underlying reserve collateral.
* @param asset The ERC20, reserve asset address.
* @param amount The amount of ERC20 tokens.
* @param to The address that will receive the underlying
**/
event Withdraw(
address indexed initiator,
address collateral,
address asset,
uint256 indexed reserveId,
uint256 amount,
address indexed to
);
/**
* @dev Emitted on borrow() when loan needs to be opened
* @param initiator The address of the user initiating the borrow(), receiving the funds
* @param reserveId The id of the underlying reserve
* @param asset The address of the borrowed asset
* @param amount The amount borrowed
* @param duration The duration of the loan
* @param collateral The address of the underlying NFT used as collateral
* @param tokenId The token id of the underlying NFT used as collateral
* @param onBehalfOf The address that will be getting the loan
* @param referral The referral code used
**/
event Borrow(
address initiator,
uint256 indexed reserveId,
address asset,
uint256 amount,
uint256 duration,
address collateral,
uint256 tokenId,
address indexed onBehalfOf,
uint256 borrowRate,
uint256 borrowId,
uint16 indexed referral
);
/**
* @dev Emitted on repay()
* @param initiator The address of the user initiating the repay(), providing the funds
* @param reserveId The id of the underlying reserve
* @param asset The address of the borrowed asset
* @param amount The amount repaid
* @param collateral The address of the underlying NFT used as collateral
* @param tokenId The token id of the underlying NFT used as collateral
* @param borrower The beneficiary of the repayment, getting his debt reduced
* @param borrowId The borrow ID of the NFT borrows
**/
event Repay(
address initiator,
uint256 indexed reserveId,
address asset,
uint256 amount,
address indexed collateral,
uint256 tokenId,
address indexed borrower,
uint256 borrowId
);
/**
* @dev Emitted on refinance()
* @param initiator The address of the user initiating the refinance(), providing the funds
* @param borrower The address of the borrower
* @param borrowId The id of the borrow
* @param collateral The address of the underlying NFT used as collateral
* @param tokenId The token id of the underlying NFT used as collateral
* @param asset The address of the borrowed asset
* @param amount The final refinanced amount
* @param amountAdded The amount added to the original borrow
* @param amountTaken The amount taken from the original borrow
* @param defaultFee The fee paid due to refinancing after loan due date (0 if before)
* @param duration The duration of the refinanced borrow
* @param timestamp The timestamp of the refinanced borrow
**/
event Refinanced(
address initiator,
address indexed borrower,
uint256 indexed reserveId,
uint256 indexed borrowId,
address collateral,
uint256 tokenId,
address asset,
uint256 amount,
uint256 amountAdded,
uint256 amountTaken,
uint256 defaultFee,
uint256 duration,
uint256 timestamp
);
/**
* @dev Emitted when a borrower's loan is liquidated.
* @param user The address of the user initiating the auction
* @param reserveId The id of the reserve
* @param collateral The NFT used as collateral
* @param tokenId The tokenId of the NFT used as collateral
* @param borrower The borrower of the liquidated borrow
* @param borrowId The borrow ID of the NFT borrows
* @param paymentAsset The asset used for payment by the liquidator
* @param paymentAmount The amount of paymentAsset paid by the liquidator
* @param onBehalfOf The address of the user to receive the underlying NFT
**/
event Liquidate(
address user,
uint256 indexed reserveId,
address indexed collateral,
uint256 tokenId,
address indexed borrower,
uint256 borrowId,
address paymentAsset,
uint256 paymentAmount,
address onBehalfOf
);
function initReserve(
ConfigTypes.InitReserveInput calldata input,
address fTokenAddress,
address stableDebtTokenAddress,
address variableDebtTokenAddress
)
external
returns (uint256);
function deposit(
uint256 amount,
uint256 reserveId,
address onBehalfOf,
uint16 referralCode
)
external;
function batchDeposit(
uint256[] calldata amounts,
uint256[] calldata reserveIds,
address[] calldata onBehalfOfs,
uint16[] calldata referralCodes
)
external;
function withdraw(
uint256 amount,
uint256 reserveId,
address to
)
external;
function batchWithdraw(
uint256[] calldata amounts,
uint256[] calldata reserveIds,
address[] calldata tos
)
external;
function borrow(
uint256 amount,
uint256 tokenId,
uint256 tokenValue,
uint256 reserveId,
uint256 duration,
address onBehalfOf,
uint16 referralCode
)
external;
function batchBorrow(
uint256[] calldata amounts,
uint256[] calldata tokenIds,
uint256[] calldata tokenValues,
uint256[] calldata reserveIds,
uint256 duration,
address onBehalfOf,
uint16 referralCode
)
external;
function repay(
uint256 borrowId,
uint256 amount
)
external;
function batchRepay(
uint256[] calldata borrowIds,
uint256[] calldata amounts
)
external;
function refinance(
uint256 borrowId,
uint256 amount,
uint256 duration
)
external;
function batchRefinance(
uint256[] calldata borrowIds,
uint256[] calldata amounts,
uint256[] calldata durations
)
external;
function auction(
uint256 borrowId,
address onBehalfOf
)
external;
function batchAuction(
uint256[] calldata borrowIds,
address[] calldata onBehalfOfs
)
external;
function bid(
address asset,
uint256 amount,
uint256 borrowId,
address onBehalfOf
)
external;
function batchBid(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata borrowIds,
address[] calldata onBehalfOfs
)
external;
function getReserveConfiguration(
uint256 reserveId
)
external
returns (DataTypes.ReserveConfigurationMap memory);
function getAuctionConfiguration(uint256 reserveId) external view returns (uint256, uint256);
function getReserveNormalizedIncome(
uint256 reserveId
)
external
view
returns (uint256);
function getReserveUserStableRate(
uint256 reserveId,
address user
)
external
view
returns (uint256);
/**
* @dev Set the _pause state of a reserve
* - Only callable by the LendPool contract
* @param val `true` to pause the reserve, `false` to un-pause it
*/
function setPause(bool val) external;
function setPausedTime(uint256 startTime, uint256 durationTime) external;
/**
* @dev Returns if the LendPool is paused
*/
function paused() external view returns (bool);
function getPausedTime() external view returns (uint256, uint256);
function getAddressesProvider() external view returns (IAddressProvider);
function finalizeTransfer(
uint256 reserveId,
address from,
address to,
uint256 amount,
uint256 balanceFromBefore,
uint256 balanceToBefore
) external view;
function getReserveNormalizedVariableDebt(
uint256 reserveId
)
external view returns (uint256);
function getReserve(uint256 reserveId) external view returns (DataTypes.Reserve memory);
function getReserveId(
address collateral,
address asset,
uint256 maxTokenId,
uint256 minTokenId
)
external
view
returns (uint256);
function getReservesList() external view returns (uint256[] memory);
function getInitializedCollaterals() external view returns (address[] memory);
function getInitializedAssets() external view returns (address[] memory);
function setMaxNumberOfReserves(uint256 val) external;
function getMaxNumberOfReserves() external view returns (uint256);
function setReserveMaxSupply(
uint256 reserveId,
uint256 maxSupply
)
external;
function setReserveInterestRateAddress(
uint256 reserveId,
address rateAddress
)
external;
function setReserveConfiguration(
uint256 reserveId,
uint256 configuration
)
external;
function setReserveCreatorAddress(uint256 reserveId, address creator) external;
function setReserveCreatorPercentage(uint256 reserveId, uint256 percentage) external;
function getBorrowHealthFactor(uint256 borrowId) external view returns (uint256, uint256, 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;
}
}
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;
library DataTypes {
/// -----------------------------------------------------------------------
/// Exec
/// -----------------------------------------------------------------------
struct ExecItemParams {
address target;
bytes payload;
}
struct ExecBatchItemParams {
address[] targets;
bytes[] payloads;
bool[] allowErrors;
}
/// -----------------------------------------------------------------------
/// P2Pool
/// -----------------------------------------------------------------------
enum BorrowStatus {
None, // Default zero
Active, // Open
Repaid, // Closed, paid by borrower
Auction, // In Auction
Liquidated // Closed, paid by liquidator
}
enum PriceGroupStatus {
None, // Default zero
Active, // Able to set / get prices
Paused, // Not able to perform any operation
Protected // Only able to get prices
}
struct Reserve {
ReserveConfigurationMap configuration;
address collateral;
address asset;
address fTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
address interestRateAddress;
string assetPriceFeed;
uint256 id;
uint256 maxTokenSupply;
uint256 maxTokenId;
uint256 minTokenId;
uint128 liquidityIndex;
uint128 variableBorrowIndex;
uint128 currentLiquidityRate;
uint128 currentVariableBorrowRate;
uint40 lastUpdateTimestamp;
}
struct ReserveData {
address collateral;
address asset;
uint256 maxTokenId;
uint256 minTokenId;
}
struct InitReserveData {
uint256 reserveId;
address collateral;
address asset;
uint256 maxTokenId;
uint256 minTokenId;
address fTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
address interestRateAddress;
string assetPriceFeed;
}
struct ReserveConfigurationMap {
//bit 0-15: LTV
//bit 16-31: Liq. threshold
//bit 32-47: Liq. bonus
//bit 48-55: Decimals
//bit 56: Reserve is active
//bit 57: reserve is frozen
//bit 58: borrowing is enabled
//bit 59: variable rate borrowing enabled
//bit 60-63: reserved
//bit 64-79: reserve factor
//bit 80-95: grace period
//bit 96-111: auction duration
//bit 112-127: auction start price multiple
uint256 data;
}
struct NFTPriceGroup {
NFTPriceGroupConfigurationMap configuration;
PriceGroupStatus status;
address[15] nfts;
uint256[15] reserveIds;
uint256[15] traitIds;
uint256[15] basePrices;
uint256 id;
}
struct NFTPriceGroupConfigurationMap {
//bit 0-15: DELTA_01
//bit 16-31: DELTA_02
//bit 32-47: DELTA_03
//bit 48-63: DELTA_04
//bit 64-79: DELTA_05
//bit 80-95: DELTA_06
//bit 96-111: DELTA_07
//bit 112-127: DELTA_08
//bit 128-143: DELTA_09
//bit 144-159: DELTA_10
//bit 160-175: DELTA_11
//bit 176-191: DELTA_12
//bit 192-207: DELTA_13
//bit 208-223: DELTA_14
//bit 224-239: DELTA_15
//bit 240: SIGN_01
//bit 241: SIGN_02
//bit 242: SIGN_03
//bit 243: SIGN_04
//bit 244: SIGN_05
//bit 245: SIGN_06
//bit 246: SIGN_07
//bit 247: SIGN_08
//bit 248: SIGN_09
//bit 249: SIGN_10
//bit 250: SIGN_11
//bit 251: SIGN_12
//bit 252: SIGN_13
//bit 253: SIGN_14
//bit 254: SIGN_15
uint256 data;
}
struct Auction {
address caller;
uint256 startPrice;
uint256 endPrice;
uint256 timestamp;
}
struct Borrow {
BorrowStatus status;
Collateral collateral;
Auction auction;
address borrower;
address erc20Token;
uint256 borrowAmount;
uint256 scaledAmount;
uint256 timestamp;
uint256 duration;
uint256 reserveId;
uint256 tokenizedId;
}
struct ExecuteDepositParams {
address initiator;
uint256 amount;
uint256 reserveId;
address onBehalfOf;
uint16 referralCode;
}
struct ExecuteBatchDepositParams {
address initiator;
uint256[] amounts;
uint256[] reserveIds;
address[] onBehalfOfs;
uint16[] referralCodes;
}
struct ExecuteWithdrawParams {
address initiator;
uint256 amount;
uint256 reserveId;
address to;
}
struct ExecuteBatchWithdrawParams {
address initiator;
uint256[] amounts;
uint256[] reserveIds;
address[] tos;
}
struct ExecuteBorrowParams {
address initiator;
uint256 amount;
uint256 tokenId;
uint256 tokenValue;
uint256 reserveId;
uint256 duration;
address onBehalfOf;
uint16 referralCode;
}
struct ExecuteBatchBorrowParams {
address initiator;
uint256[] amounts;
uint256[] tokenIds;
uint256[] tokenValues;
uint256[] reserveIds;
uint256 duration;
address onBehalfOf;
uint16 referralCode;
}
struct ExecuteRepayParams {
address initiator;
uint256 borrowId;
uint256 amount;
}
struct ExecuteBatchRepayParams {
address initiator;
uint256[] borrowIds;
uint256[] amounts;
}
struct ExecuteRefinanceParams {
address initiator;
uint256 borrowId;
uint256 amount;
uint256 duration;
}
struct ExecuteBatchRefinanceParams {
address initiator;
uint256[] borrowIds;
uint256[] amounts;
uint256[] durations;
}
struct ExecuteAuctionParams {
address initiator;
uint256 borrowId;
address onBehalfOf;
}
struct ExecuteBatchAuctionParams {
address initiator;
uint256[] borrowIds;
address[] onBehalfOfs;
}
struct ExecuteBidParams {
address initiator;
address asset;
uint256 amount;
uint256 borrowId;
address onBehalfOf;
}
struct ExecuteBatchBidParams {
address initiator;
address[] assets;
uint256[] amounts;
uint256[] borrowIds;
address[] onBehalfOfs;
}
/// -----------------------------------------------------------------------
/// Tokenized
/// -----------------------------------------------------------------------
struct TokenizedLoan {
address collateral;
uint256 tokenId;
uint256 id;
}
/// -----------------------------------------------------------------------
/// P2Peer
/// -----------------------------------------------------------------------
enum LoanStatus {
None, // Default zero
Escrow, // Open
Repaid, // Closed, lender received repayment
Refinanced, // Closed, lender received repayment
Foreclosed // Closed, lender received collateral
}
enum Side { Offer, Listing }
enum SignatureVersion { Single, Bulk }
enum CollateralType { ERC721, ERC1155 } //TODO
enum LoanType {
Loan,
Trait,
Collection,
Bundle,
Renegotiation,
Refinancing
}
struct Terms {
LoanType loanType;
/* Order collaterlTypes - empty item if not isBundle. */
CollateralType[] collateralTypes;
CollateralType collateralType;
/* Order collaterals & tokenIds - empty if not isBundle. */
address[] collaterals;
uint256[] tokenIds;
/* Order values - empty item if not ERC1155. */
uint256[] values;
/* Order collateral & tokenId - address(0) if isBundle. */
address collateral;
uint256 tokenId;
/* Order value - empty item if not ERC1155. */
uint256 value;
address asset;
uint256 amount;
/* Order maximumRepayment - used for both fixed price and pro-rata loans. */
uint256 maximumRepayment;
/* Order minimumRepayment - used for pro-rata loans, 0 if none */
uint256 minimumRepayment;
/* Order interestRateInBasisPoints - used for pro-rata loans. */
uint256 interestRateInBasisPoints;
uint256 duration;
/* Loan isProRata - used enable pro-rata loan repayments. */
bool isProRata;
bool isBundle;
/* Order loanId - 0 if creating a new loan. */
uint256 loanId;
/* Order fee - paid on renegotiation. */
uint256 fee;
}
struct Order {
address user;
/* Referrer - for new loans & refinancing (borrower-side). */
address referrer;
Side side;
Terms terms;
/* Order counterparty - address(0) for open order. */
address counterparty;
bool isInstantExecution;
/* Order loanRepayment - for refinancing. */
uint256 loanRepayment;
uint256 listingTime;
uint256 expirationTime;
uint256 salt;
/* Order message - for renegotiations. */
string message;
bytes extraParams;
/* Borrow Id - for p2pool orders. */
uint256 borrowId;
/* Reserve Id - for fToken orders. */
uint256 reserveId;
}
struct Input {
Order order;
uint8 v;
bytes32 r;
bytes32 s;
bytes extraSignature;
SignatureVersion signatureVersion;
uint256 blockNumber;
}
struct Execution {
Input offer;
Input listing;
}
struct Collateral {
/* Loan collateralType - ERC721 or ERC1155. */
CollateralType collateralType;
address collateral;
uint256 tokenId;
/* Loan value - collateral token amount (ERC1155, only). */
uint256 value;
}
struct Collaterals {
/* Loan collateralType - ERC721 or ERC1155. */
CollateralType[] collateralTypes;
address[] collaterals;
uint256[] tokenIds;
/* Loan value - collateral token amount (ERC1155, only). */
uint256[] values;
}
struct Principal {
address asset;
uint256 amount;
}
struct Interest {
/* Loan:Interest rate - in basis points (1/100th of a percent), used in pro-rata loans. */
uint256 rate;
/* Loan.Interest isProRata - to enable pro-rata loan repayments. */
bool isProRata;
}
struct Repayment {
/* Loan Repayment.maximum - used in both fixed price & pro-rata loans. */
uint256 maximum;
/* Loan Repayment.minimum - (optional) used in pro-rata loans. */
uint256 minimum;
}
struct Loan {
LoanStatus status;
Collateral collateral;
Principal principal;
Interest interest;
Repayment repayment;
address borrower;
address lender;
address referrer;
uint256 timestamp;
uint256 duration;
/* Loan tokenizedId - tokenId of promissoryNote and obligationReceipt. */
uint256 tokenizedId;
}
struct LoanBundle {
LoanStatus status;
Collaterals collaterals;
Principal principal;
Interest interest;
Repayment repayment;
address borrower;
address lender;
address referrer;
uint256 timestamp;
uint256 duration;
/* Loan tokenizedId - tokenId of promissoryNote and obligationReceipt. */
uint256 tokenizedId;
}
struct ExecuteNewLoanParams {
DataTypes.Terms terms;
address borrower;
address lender;
address referrer;
/* Borrow Id - for p2pool Orders */
uint256 borrowId;
/* Reserve Id - for fToken Orders */
uint256 reserveId;
}
struct ExecuteRepayLoanParams {
uint256 loanId;
uint256 lendingFactor;
/* Reserve Id - for fToken repayment */
uint256 reserveId;
}
struct ExecuteForecloseLoanParams {
uint256 loanId;
}
struct ExecuteRenegotiateLoanParams {
DataTypes.Terms terms;
address borrower;
address lender;
/* Reserve Ids - for fToken Orders */
uint256 borrowerReserveId;
uint256 lenderReserveId;
}
struct ExecuteRefinanceLoanParams {
DataTypes.Terms terms;
address borrower;
address lender;
address referrer;
uint256 loanRepayment;
uint256 lendingFactor;
/* Reserve Ids - for fToken Orders */
uint256 borrowerReserveId;
uint256 lenderReserveId;
}
}
Last updated