Liquidation Mechanism

Conditions when liquidation can happen

There are 3 conditions that a user's borrow position can be liquidated.
  1. 1.
    When the user failed to pay back the minimum payment when the minimum payment is due.
  2. 2.
    When the user failed to pay back the total loan when the loan is due.
  3. 3.
    When the users total liquidity reaches 0.

Liquidation Trigger

When any of the above conditions are met, any user can trigger liquidation by calling the function liquidateNft. The zNft liquidated will be temporarily sent to the corresponding provisioning pool contract. Meanwhile, AuctionMarket starts the auction process.
To trigger an auction:
// contract: ProvisioningPool.sol
// @notice This function can be called when a ZNft tokenId satisfy the liquidation threshold
// That is, when a borrower is missing interest payments or his borrowed position is under water
// This contract repays the owed amount first, and then initiate the auction for the ZNft tokenId
// @param tokenId The ZNft tokenId to be liquidated
function liquidateZNft(uint256 tokenId)
Auction Flow
It would last up to 3 days but it could get extended if no one bids. After a successful auction, the proceeds will go to Zumer's provisioning pool, or back to the original owner (after deducting the outstanding debts/costs from Zumer) if it’s self listed auction. Bidders would get refunded if they’re not the highest bidder. For self listed auction, users are allowed to set a desired minimum bid price that must be at least collateral factor * NFT price. For the liquidated auction, if no one bids, the auction price would move lower when the auction period gets extended until the collateral is sold. In this case, the liquidity providers to the provisioning pool (the underwriters) would suffer from reduced returns.
To bid on an NFT:
// contract: AuctionMarket.sol
// @notice This function can be used to submit a bid
// Note that it is the msg.sender that is to pay for the bid amount, and the msg.sender is to be recorded as the bidder
// @param tokenId The token Id of the ZNft to be bidded for
// @param ZNft The znft being auctioned off
// @param amount The amount of underlying tokens for the bid
function bid(
uint256 tokenId,
address ZNft,
uint256 amount
) external
To win an NFT:
// contract: AuctionMarket.sol
// @notice This function can be called by anyone to finish off a concluded auction, send the ZNft to the winner,
// if any, and send the winning bid amount back to provisioningPool
// @param ZNft The ZNft being auctioned off
// @param tokenId The token Id of the ZNft
function winBid(address ZNft, uint256 tokenId) external