Due to the liquidation, temporary liabilities are incurred, and the liquidated UDT needs to be auctioned to repay the liabilities.
The current contract contains two processes: creation and bidding of an auction.

Create an auction list

Take debt and the corresponding UDT as input, UDT and auction order as output, and assemble the transaction.
The corresponding test case reference


All auctions have a one-day publicity period, followed by a one-day bidding period.
In order to reduce unnecessary fees incurred, we use Dutch Auctions. That is, starting at twice the borrowing amount, the price will be reduced linearly by time and will be reduced to 0 after day 1. The first person to bid will get the assets during the auction period.
For example: I stake 1 ETH and borrowed 2000 TAI. And I got liquidated due to the drop in the price of ETH. This 1 ETH will be auctioned-off. The starting price will be 4000 TAI, and your bid requirement is greater than "4000*(starting time + 24 hours - current time) / 24 hours".
Bid price: 4000*(starting time + 24 hours - current time) / 24 hours. At the 12th hour, the price is equal to the loan amount. At the 24th hour, the price goes to 0.
The funds for the auction will be divided into 3 parts:
  1. 1.
    Burn TAI corresponding to the loan.
  2. 2.
    10% of the loan goes to the community treasury (revenue).
  3. 3.
    Return the surplus to the borrower (if there is no surplus, ignore it)
If the closing price is lower than the amount of the loan, systemic liabilities will be generated, which will be repaid by contract proceeds.