AuctionModule
Last updated
Last updated
Inherits: , IncreAccessControl, Pausable, ReentrancyGuard
Author: webthethird
Handles auctioning tokens slashed by the SafetyModule, triggered by governance in the event of an insolvency in the vault which cannot be covered by the insurance fund
SafetyModule contract which manages staked token rewards, slashing and auctions
Payment token used to purchase lots in auctions
ID of the next auction
Mapping of auction IDs to auction information
Mapping of auction IDs to the number of tokens sold in that auction
Mapping of auction IDs to the number of payment tokens raised in that auction
Mapping of ERC20 tokens to the internally tracked balance of this contract
Used to enforce that only one auction may be active for a given token at a time
Modifier for functions that should only be called by the SafetyModule
AuctionModule constructor
Parameters
_safetyModule
ISafetyModule
SafetyModule contract to manage this contract
_paymentToken
IERC20
ERC20 token used to purchase lots in auctions
Returns the current lot size of the auction
Lot size starts at auction.initialLotSize
and increases by auction.lotIncreaseIncrement
every auction.lotIncreasePeriod
seconds, unless the lot size times the number of remaining lots reaches the contract's total balance of tokens, then the size remains fixed at totalBalance / auction.remainingLots
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Current number of tokens per lot
Returns the number of lots still available for sale in the auction
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Number of lots still available for sale
Returns the price of each lot in the auction
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Price of each lot in payment tokens
Returns the number of tokens by which the lot size increases each period
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Size of each lot increase
Returns the amount of time between each lot size increase
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Number of seconds between each lot size increase
Returns the address of the token being auctioned
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
IERC20
The ERC20 token being auctioned
Returns the timestamp when the auction started
The auction starts when the SafetyModule calls startAuction
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Timestamp when the auction started
Returns the timestamp when the auction ends
Auction can end early if all lots are sold or if the auction is terminated by the SafetyModule
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Timestamp when the auction ends
Returns the number of tokens sold in the auction
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Number of tokens sold
Returns the amount of funds raised in the auction
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
uint256
Number of payment tokens raised
Returns the ID of the next auction
Returns
<none>
uint256
ID of the next auction
Returns whether the auction is still active
Parameters
_auctionId
uint256
ID of the auction
Returns
<none>
bool
True if the auction is still active, false otherwise
Returns whether any auction is still active
Returns
<none>
bool
True if any auction is still active, false otherwise
Buys one or more lots at the current lot size, and ends the auction if all lots are sold
The caller must approve this contract to transfer the lotPrice x numLotsToBuy in payment tokens
Parameters
_auctionId
uint256
ID of the auction
_numLotsToBuy
uint8
Number of lots to buy
Ends an auction after the time limit has been reached and approves the transfer of unsold tokens and funds raised
This function can be called by anyone, but only after the auction's end time has passed
Parameters
_auctionId
uint256
ID of the auction
Indicates whether auctions are currently paused
Contract is paused if either this contract or the SafetyModule has been paused
Returns
<none>
bool
True if paused, false otherwise
Starts a new auction
Only callable by the SafetyModule
Parameters
_token
IERC20
The ERC20 token to auction
_numLots
uint8
Number of lots in the auction
_lotPrice
uint128
Price of each lot of tokens in payment tokens
_initialLotSize
uint128
Initial number of tokens in each lot
_lotIncreaseIncrement
uint96
Amount of tokens by which the lot size increases each period
_lotIncreasePeriod
uint16
Number of seconds between each lot size increase
_timeLimit
uint32
Number of seconds before the auction ends if all lots are not sold
Returns
<none>
uint256
ID of the auction
Terminates an auction early and approves the transfer of unsold tokens and funds raised
Only callable by the SafetyModule
Parameters
_auctionId
uint256
ID of the auction
Sets the token required for payments in all auctions
Only callable by governance
Parameters
_newPaymentToken
IERC20
ERC20 token to use for payment
Replaces the SafetyModule contract
Only callable by governance
Parameters
_newSafetyModule
ISafetyModule
Address of the new SafetyModule contract
Pause the contract
Only callable by governance
Unpause the contract
Only callable by governance
Struct representing an auction
Properties
token
IERC20
Address of the token being auctioned
active
bool
Whether the auction is still active
lotPrice
uint128
Price of each lot of tokens, denominated in payment tokens
initialLotSize
uint128
Initial size of each lot
numLots
uint8
Total number of lots in the auction
remainingLots
uint8
Number of lots that have not been sold
startTime
uint64
Timestamp when the auction started
endTime
uint64
Timestamp when the auction ends
lotIncreasePeriod
uint16
Number of seconds between each lot size increase
lotIncreaseIncrement
uint96
Amount of tokens by which the lot size increases each period