#
Lending Pool
#
Address
X7LendingPoolV1 is deployed at:
#
Contract Events
#
EcosystemRecipientSet
event EcosystemRecipientSet(address oldAddress, address newAddress);
Triggered when the ecosystem recipient address is changed.
#
RouterSet
event RouterSet(address oldAddress, address newAddress);
Fired when the router address is updated.
#
WETHSet
event WETHSet(address oldAddress, address newAddress);
Announces a change in the WETH address.
#
X7DSet
event X7DSet(address oldAddress, address newAddress);
Triggered when the X7D token address is updated.
#
LoanTermActiveStateSet
event LoanTermActiveStateSet(address indexed newAddress, bool isActive);
Reports the change in the active state of a loan term.
#
LiquidationRewardSet
event LiquidationRewardSet(uint256 oldReward, uint256 newReward);
Denotes a change in the liquidation reward amount.
#
OriginationSharesSet
event OriginationSharesSet(
uint256 oldEcosystemSplitterOriginationShare,
uint256 oldX7DAOOriginationShare,
uint256 oldX7100OriginationShare,
uint256 oldLendingPoolOriginationShare,
uint256 newEcosystemSplitterOriginationShare,
uint256 newX7DAOOriginationShare,
uint256 newX7100OriginationShare,
uint256 newLendingPoolOriginationShare
);
Marks changes in the origination shares distribution across different entities.
#
PremiumSharesSet
event PremiumSharesSet(
uint256 oldEcosystemSplitterOriginationShare,
uint256 oldX7DAOOriginationShare,
uint256 oldX7100OriginationShare,
uint256 oldLendingPoolOriginationShare,
uint256 newEcosystemSplitterOriginationShare,
uint256 newX7DAOOriginationShare,
uint256 newX7100OriginationShare,
uint256 newLendingPoolOriginationShare
);
Indicates updates to the premium shares distribution.
#
EcosystemSplitterSet
event EcosystemSplitterSet(address oldAddress, address newAddress);
Triggered when the ecosystem splitter address is updated.
#
X7100ReserveRecipientSet
event X7100ReserveRecipientSet(address oldAddress, address newAddress);
Signals a change in the X7100 reserve recipient address.
#
X7DAORewardRecipientSet
event X7DAORewardRecipientSet(address oldAddress, address newAddress);
Fired when the X7DAO reward recipient address is changed.
#
DiscountAuthoritySet
event DiscountAuthoritySet(address oldAddress, address newAddress);
Announces a change in the discount authority address.
#
RetainedFeeNumeratorSet
event RetainedFeeNumeratorSet(uint256 oldValue, uint256 newValue);
Indicates an update in the retained fee numerator value.
#
LendingPoolReserveSet
event LendingPoolReserveSet(address oldAddress, address newAddress);
Reports changes to the lending pool reserve address.
#
LendingHalted
event LendingHalted();
Notifies that lending operations have been halted.
#
LendingCommenced
event LendingCommenced();
Announces the resumption of lending operations.
#
AuthorizedCapitalManagerSet
event AuthorizedCapitalManagerSet(address managerAddress, bool isTrusted);
Signals the authorization state of a capital manager.
#
LoanBuyoutAllowed
event LoanBuyoutAllowed(bool isAllowed);
Reports the permission status for loan buyouts.
#
SyncSafeGasAmountSet
event SyncSafeGasAmountSet(uint256 oldValue, uint256 newValue);
Indicates a change in the sync safe gas amount.
#
LoanBoughtOut
event LoanBoughtOut(address indexed buyer, uint256 indexed loanID);
Reports a loan buyout by a particular buyer.
#
Read-Only Functions
#
getDiscountedQuote
function getDiscountedQuote(
address borrower,
IX7InitialLiquidityLoanTerm loanTerm,
uint256 loanAmount,
uint256 loanDurationSeconds
) external view returns (uint256[7] memory)
Used to get a quote for a loan according to a specific borrower, loan term, amount, and duration.
#
canLiquidate
function canLiquidate(uint256 loanID) external view returns (uint256)
Used to see the amount of the loan that can be liquidated. If the amount is greater than 0 the loan is eligible for a liquidation event. For the initial loan terms, any past due payments make the entire loan eligible for liquidation.
#
State-Changing Functions
#
getInitialLiquidityLoan
function getInitialLiquidityLoan(
address tokenAddress,
uint256 amount,
address loanTermContract,
uint256 loanAmount,
uint256 loanDurationSeconds,
address liquidityReceiver,
uint256 deadline
) external lock payable returns (uint256 loanID)
Used to originate the actual loan.
#
payLiability
function payLiability(uint256 loanID) external lock payable
Used to pay against any outstanding loan liability. See the loan term contract to understand how payment is applied.
#
liquidate
function liquidate(uint256 loanID) external lock
Used to liquidate the loan. If the loan term allows, this will only be a partial liquidation. The initial loan terms all liquidate in full.
#
buyoutLoanQuote
function buyoutLoanQuote(uint256 loanID) external view returns (uint256)
Used to check the cost to buyout the loan (this is the remaining principal due).
#
buyoutLoan
function buyoutLoan(uint256 loanID) external payable
Used to buy out the loan. Doing so will cause the loan term NFT to be transferred to the caller.
#
buyoutLoanTo
function buyoutLoanTo(uint256 loanID, address to) external payable
Used to buy out the loan to a specific address. This will cause the loan term NFT to be transferred to the specified address.
pragma solidity ^0.8.0
interface IX7LendingPoolV1 {
// View functions
function activeLoansByBorrower(address borrower) external view returns (uint256)
function countOfActiveLoanTerms() external view returns (uint256)
function availableCapital() external view returns (uint256)
function getDiscountedQuote(
address borrower,
IX7InitialLiquidityLoanTerm loanTerm,
uint256 loanAmount,
uint256 loanDurationSeconds
) external view returns (uint256[7] memory)
function canLiquidate(uint256 loanID) external view returns (uint256)
function getPrincipalDue(uint256 loanID, uint256 asOf) external view returns (uint256)
function getPremiumsDue(uint256 loanID, uint256 asOf) external view returns (uint256)
function getTotalDue(uint256 loanID, uint256 asOf) external view returns (uint256);
function getRemainingLiability(uint256 loanID) external view returns (uint256);
function getPremiumPaymentSchedule(uint256 loanID) external view returns (uint256[] memory, uint256[] memory);
function getPrincipalPaymentSchedule(uint256 loanID) external view returns (uint256[] memory, uint256[] memory);
function getQuote(
address borrower,
IX7InitialLiquidityLoanTerm loanTerm,
uint256 loanAmount,
uint256 loanDurationSeconds
) external view returns (uint256[5])
function buyoutLoanQuote(uint256 loanID) external view returns (uint256);
function getInitialLiquidityLoan(
address tokenAddress,
uint256 amount,
address loanTermContract,
uint256 loanAmount,
uint256 loanDurationSeconds,
address liquidityReceiver,
uint256 deadline) external view returns (uint256);
// External payable functions
function payLiability(uint256 loanID) external payable;
function liquidate(uint256 loanID) external;
function buyoutLoan(uint256 loanID) external payable;
function buyoutLoanTo(uint256 loanID, address to) external payable;
function depositETH() external payable;
function depositETHForRecipient(address recipient) external payable;
function returnETHToLendingPoolReserve(uint256 amount) external;
function returnETH() external payable;
}