Comment on page
Shortfall
Shortfall is an auction contract designed to auction off the
convertibleBaseAsset
accumulated in RiskFund
. The convertibleBaseAsset
is auctioned in exchange for users paying off the pool's bad debt. An auction can be started by anyone once a pool's bad debt has reached a minimum value. This value is set and can be changed by the authorized accounts. If the pool’s bad debt exceeds the risk fund plus a 10% incentive, then the auction winner is determined by who will pay off the largest percentage of the pool's bad debt. The auction winner then exchanges for the entire risk fund. Otherwise, if the risk fund covers the pool's bad debt plus the 10% incentive, then the auction winner is determined by who will take the smallest percentage of the risk fund in exchange for paying off all the pool's bad debt.enum AuctionType {
LARGE_POOL_DEBT,
LARGE_RISK_FUND
}
enum AuctionStatus {
NOT_STARTED,
STARTED,
ENDED
}
struct Auction {
uint256 startBlock;
enum Shortfall.AuctionType auctionType;
enum Shortfall.AuctionStatus status;
contract VToken[] markets;
uint256 seizedRiskFund;
address highestBidder;
uint256 highestBidBps;
uint256 highestBidBlock;
uint256 startBidBps;
mapping(contract VToken => uint256) marketDebt;
mapping(contract VToken => uint256) bidAmount;
}
Pool registry address
address poolRegistry
Risk fund address
contract IRiskFund riskFund
Minimum USD debt in pool for shortfall to trigger
uint256 minimumPoolBadDebt
Incentive to auction participants, initial value set to 1000 or 10%
uint256 incentiveBps
Time to wait for next bidder. Initially waits for 100 blocks
uint256 nextBidderBlockLimit
Boolean of if auctions are paused
bool auctionsPaused
Time to wait for first bidder. Initially waits for 100 blocks
uint256 waitForFirstBidder
Auctions for each pool
mapping(address => struct Shortfall.Auction) auctions
Initialize the shortfall contract
function initialize(contract IRiskFund riskFund_, uint256 minimumPoolBadDebt_, address accessControlManager_) external
Parameters
Name | Type | Description |
---|---|---|
riskFund_ | contract IRiskFund | RiskFund contract address |
minimumPoolBadDebt_ | uint256 | Minimum bad debt in base asset for a pool to start auction |
accessControlManager_ | address | AccessControlManager contract address |
❌ Errors
- ZeroAddressNotAllowed is thrown when convertible base asset address is zero
- ZeroAddressNotAllowed is thrown when risk fund address is zero
Place a bid greater than the previous in an ongoing auction
function placeBid(address comptroller, uint256 bidBps, uint256 auctionStartBlock) external
Parameters
Name | Type | Description |
---|---|---|
comptroller | address | Comptroller address of the pool |
bidBps | uint256 | The bid percent of the risk fund or bad debt depending on auction type |
auctionStartBlock | uint256 | The block number when auction started |
📅 Events
- Emits BidPlaced event on success
Close an auction
function closeAuction(address comptroller) external
Parameters
Name | Type | Description |
---|---|---|
comptroller | address | Comptroller address of the pool |
📅 Events
- Emits AuctionClosed event on successful close
Start a auction when there is not currently one active
function startAuction(address comptroller) external
Parameters
Name | Type | Description |
---|---|---|
comptroller | address | Comptroller address of the pool |
📅 Events
- Emits AuctionStarted event on success
- Errors if auctions are paused
Restart an auction
function restartAuction(address comptroller) external
Parameters
Name | Type | Description |
---|---|---|
comptroller | address | Address of the pool |
📅 Events
- Emits AuctionRestarted event on successful restart
Update next bidder block limit which is used determine when an auction can be closed
function updateNextBidderBlockLimit(uint256 _nextBidderBlockLimit) external
Parameters
Name | Type | Description |
---|---|---|
_nextBidderBlockLimit | uint256 | New next bidder block limit |
📅 Events
- Emits NextBidderBlockLimitUpdated on success
⛔️ Access Requirements
- Restricted by ACM
Updates the incentive BPS
function updateIncentiveBps(uint256 _incentiveBps) external
Parameters
Name | Type | Description |
---|---|---|
_incentiveBps | uint256 | New incentive BPS |
📅 Events
- Emits IncentiveBpsUpdated on success
⛔️ Access Requirements
- Restricted by ACM
Update minimum pool bad debt to start auction
function updateMinimumPoolBadDebt(uint256 _minimumPoolBadDebt) external
Parameters
Name | Type | Description |
---|---|---|
_minimumPoolBadDebt | uint256 | Minimum bad debt in the base asset for a pool to start auction |
📅 Events
- Emits MinimumPoolBadDebtUpdated on success
⛔️ Access Requirements
- Restricted by ACM
Update wait for first bidder block count. If the first bid is not made within this limit, the auction is closed and needs to be restarted
function updateWaitForFirstBidder(uint256 _waitForFirstBidder) external
Parameters
Name | Type | Description |
---|---|---|
_waitForFirstBidder | uint256 | New wait for first bidder block count |
📅 Events
- Emits WaitForFirstBidderUpdated on success
⛔️ Access Requirements
- Restricted by ACM
Update the pool registry this shortfall supports
function updatePoolRegistry(address poolRegistry_) external
Parameters
Name | Type | Description |
---|---|---|
poolRegistry_ | address | Address of pool registry contract |
📅 Events
- Emits PoolRegistryUpdated on success
⛔️ Access Requirements
- Restricted to owner
❌ Errors
- ZeroAddressNotAllowed is thrown when pool registry address is zero
Pause auctions. This disables starting new auctions but lets the current auction finishes
function pauseAuctions() external
📅 Events
- Emits AuctionsPaused on success
⛔️ Access Requirements
- Restricted by ACM
❌ Errors
- Errors is auctions are paused
Resume paused auctions.
function resumeAuctions() external
📅 Events
- Emits AuctionsResumed on success
⛔️ Access Requirements
- Restricted by ACM
❌ Errors
- Errors is auctions are active
Last modified 1mo ago