ICollateralManager
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.16;
import { DataTypes } from "../protocol/libraries/types/DataTypes.sol";
interface ICollateralManager {
struct UpdateVars {
address borrowAsset;
uint256 accruedBorrowAmount;
uint256 updatedBorrowAmount;
}
/**
* @dev Emitted when a borrow is created
* @param initiator The address initiating the action
*/
event BorrowCreated(
address indexed initiator,
address indexed onBehalfOf,
uint256 indexed borrowId,
address collateral,
uint256 tokenId,
uint256 tokenValue,
address asset,
uint256 amount,
uint256 duration,
uint256 borrowIndex,
uint256 tokenizedId
);
/**
* @dev Emitted when a borrow is updated
* @param initiator The address initiating the action
*/
event BorrowUpdated(
address indexed initiator,
uint256 indexed borrowId,
address collateral,
uint256 tokenId,
address asset,
uint256 amountAdded,
uint256 amountTaken,
uint256 borrowIndex
);
/**
* @dev Emitted when a borrow is repaid by the borrower
* @param initiator The address initiating the action
*/
event BorrowRepaid(
address indexed initiator,
uint256 indexed borrowId,
address collateral,
uint256 tokenId,
address asset,
uint256 amount,
uint256 borrowIndex
);
/**
* @dev Emitted when a borrow is refinanced by the borrower
* @param initiator The address initiating the action
*/
event BorrowRefinanced(
address indexed initiator,
uint256 indexed borrowId,
address collateral,
uint256 tokenId,
address asset,
uint256 borrowAmount,
uint256 amountAdded,
uint256 amountTaken,
uint256 duration,
uint256 timestamp
);
/**
* @dev Emitted when a borrow is liquidate by the liquidator
* @param initiator The address initiating the action
*/
event BorrowLiquidated(
address indexed initiator,
uint256 indexed borrowId,
address collateral,
uint256 tokenId,
address asset,
uint256 amount,
uint256 borrowIndex
);
function borrowerOf(
uint256 borrowId
)
external
view
returns(address);
function getNumNftBorrows(address collateral) external view returns (uint256);
function getNumUserNftBorrows(address user, address collateral) external view returns (uint256);
function getBorrow(uint256 borrowId) external view returns (DataTypes.Borrow memory);
function getBorrowId(address collateral, uint256 tokenId) external view returns (uint256);
function setBorrowStatus(
uint256 borrowId,
DataTypes.BorrowStatus status
)
external
returns (bool);
function createBorrow(
address initiator,
address onBehalfOf,
address collateral,
uint256 tokenId,
uint256 tokenValue,
address asset,
uint256 amount,
uint256 duration,
uint256 borrowIndex,
uint256 reserveId
)
external
returns (
uint256 borrowId,
uint256 tokenizedId
);
function updateBorrow(
address initiator,
uint256 borrowId,
uint256 amountAdded,
uint256 amountTaken,
uint256 borrowIndex
)
external;
function repayBorrow(
address initiator,
uint256 borrowId,
uint256 amount,
uint256 borrowIndex
)
external;
function refinanceBorrow(
address initiator,
uint256 borrowId,
uint256 borrowAmount,
uint256 amountAdded,
uint256 amountTaken,
uint256 duration
)
external;
function getBorrowAmount(
uint256 borrowId
)
external
view
returns (address, uint256, address, uint256);
function getBorrowNumTokens(
uint256 borrowId
)
external
view
returns (uint256);
function getAuctionPrice(
uint256 borrowId
)
external
view
returns (uint256);
function getScaledAmount(
uint256 borrowId
)
external
view
returns(address, uint256);
function setBorrowAuctionCall(
uint256 borrowId,
uint256 auctionStartPrice,
uint256 auctionEndPrice,
uint256 auctionTimestamp,
address auctionCaller
)
external;
function liquidateBorrow(
uint256 borrowId
)
external;
function setBlacklisted(address collateral, uint256 tokenId, bool isBlacklisted_) external;
function isBlacklisted(address collateral, uint256 tokenId) external view returns (bool);
}
Last updated