Function: endAuction()
This function is used to end the auction. If the auction is successful, the reserve tokens are transferred to the auction, and the coupon tokens are transferred to the beneficiary. If the auction is unsuccessful, the state is updated to FAILED_UNDERSOLD
or FAILED_LIQUIDATION
.
Branches and code coverage
Intended branches
Update the state to
SUCCEEDED
if the auction is successful.Update the state to
FAILED_UNDERSOLD
if the auction is unsuccessful due to being undersold.Update the state to
FAILED_LIQUIDATION
if the auction is unsuccessful due to liquidation.Transfer the reserve tokens to the auction if the auction is successful.
Transfer the coupon tokens to the beneficiary if the auction is successful.
Negative behavior
Reverts if the auction has already ended.
Function call analysis
Pool(this.pool).transferReserveToAuction(this.totalSellReserveAmount)
What is controllable?
totalSellReserveAmount
.If the return value is controllable, how is it used and how can it go wrong? Nothing.
What happens if it reverts, reenters or does other unusual control flow? If it reverts, the auction will not end.