ConversionQueue
Inherits: LenderQueue, MortgageQueue, IConversionQueue
Title: ConversionQueue
Author: SocksNFlops
The ConversionQueue contract is responsible for converting mortgages by reducing the principal and collateral as a result of a withdrawal request
State Variables
nativeWrapper
Get the native token wrapper contract (whype/weth/etc).
address public immutable override nativeWrapper
generalManager
Get the GeneralManager contract.
address public immutable override generalManager
decimals
The number of decimals of the collateral
uint8 public immutable override decimals
Functions
constructor
Constructor
constructor(
address asset_,
uint8 decimals_,
address consol_,
address nativeWrapper_,
address generalManager_,
address admin_
) LenderQueue(asset_, consol_, admin_);
Parameters
| Name | Type | Description |
|---|---|---|
asset_ | address | The address of the asset to convert |
decimals_ | uint8 | The number of decimals of the asset |
consol_ | address | The address of the Consol contract |
nativeWrapper_ | address | The address of the native wrapper contract |
generalManager_ | address | The address of the GeneralManager contract |
admin_ | address | The address of the admin |
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(LenderQueue, MortgageQueue)
returns (bool);
convertingPrice
The current price of the collateral in USD
function convertingPrice() public view override returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The price of the collateral in USD |
_calculateCollateralToUse
Calculates the collateral to use out of a mortgage position for a withdrawal request
function _calculateCollateralToUse(MortgagePosition memory mortgagePosition, uint256 amountToUse)
internal
view
returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
mortgagePosition | MortgagePosition | The mortgage position to calculate the collateral to use for |
amountToUse | uint256 | The amount of principal to use for the withdrawal request |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The collateral to use for the withdrawal request |
enqueueMortgage
Enqueues a mortgage position into the conversion queue. If the mortgage position is already in the queue, it will be removed and enqueued again with a potentially new price.
function enqueueMortgage(uint256 mortgageTokenId, uint256 hintPrevId)
external
payable
override
whenNotPaused
nonReentrant;
Parameters
| Name | Type | Description |
|---|---|---|
mortgageTokenId | uint256 | The tokenId of the mortgage position |
hintPrevId | uint256 | The hintPrevId of the mortgage position |
processWithdrawalRequests
Process the requests from the front of the USDX withdrawal queue. Callable by anyone by contracts with the PROCESSOR_ROLE.
function processWithdrawalRequests(uint256 iterations, address receiver)
external
override(ILenderQueue, LenderQueue)
nonReentrant
whenNotPaused
onlyRole(Roles.PROCESSOR_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
iterations | uint256 | The number of iterations to process. Each iteration returns collected gas fees. |
receiver | address | The address to receive the gas fees |
dequeueMortgage
Dequeues a mortgage position from the conversion queue. Only callable on an inactive mortgage position.
function dequeueMortgage(uint256 mortgageTokenId) external override;
Parameters
| Name | Type | Description |
|---|---|---|
mortgageTokenId | uint256 | The tokenId of the mortgage position |