Skip to main content

ConversionQueue

Git Source

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

NameTypeDescription
asset_addressThe address of the asset to convert
decimals_uint8The number of decimals of the asset
consol_addressThe address of the Consol contract
nativeWrapper_addressThe address of the native wrapper contract
generalManager_addressThe address of the GeneralManager contract
admin_addressThe 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

NameTypeDescription
<none>uint256The 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

NameTypeDescription
mortgagePositionMortgagePositionThe mortgage position to calculate the collateral to use for
amountToUseuint256The amount of principal to use for the withdrawal request

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
mortgageTokenIduint256The tokenId of the mortgage position
hintPrevIduint256The 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

NameTypeDescription
iterationsuint256The number of iterations to process. Each iteration returns collected gas fees.
receiveraddressThe 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

NameTypeDescription
mortgageTokenIduint256The tokenId of the mortgage position