WildcatMarketWithdrawals.sol

The WildcatMarketWithdrawals is the withdrawal-related logic contract containing function to handle withdrawal queueing, processing, executing, and viewing.

getUnpaidBatchExpiries

function getUnpaidBatchExpiries() external view nonReentrantView returns (uint32[] memory);

Gets the unpaid, expired withdrawals.

Reverts if:

  • the reentrancy lock is engaged.

getWithdrawalBatch

function getWithdrawalBatch(uint32 expiry)
    external
    view
    nonReentrantView
    returns (WithdrawalBatch memory);

Gets a withdrawal for a given expiry based on the current state.

Reverts if:

  • the reentrancy lock is engaged.

getAccountWithdrawalStatus

function getAccountWithdrawalStatus(address accountAddress, uint32 expiry)
    external
    view
    nonReentrantView
    returns (AccountWithdrawalStatus memory);

Gets an account's withdrawal status for a given expiry.

Reverts if:

  • the reentrancy lock is engaged.

getAvailableWithdrawalAmount

function getAvailableWithdrawalAmount(address accountAddress, uint32 expiry)
    external
    view
    nonReentrantView
    returns (uint256);

Gets the amount available for an account to withdrawal for a given expiry based on the current state.

Reverts if:

  • the reentrancy lock is engaged.

  • the expiry is greater than the current timestamp.

queueWithdrawal

function queueWithdrawal(uint256 amount) external nonReentrant;

Queues a withdrawal.

Procedures:

  • Scale the amount by the scale factor

  • Transfer the caller's vault tokens to the vault

  • If there is a pending withdrawal batch:

    • Queue the withdrawal

  • Otherwise:

    • Create a new withdrawal batch

    • Queue the withdrawal

  • If the pool contains enough liquidity to cover the withdrawal:

    • Process withdrawal payment

  • Otherwise:

    • Process as much of the withdrawal as possible and leave the rest to the queue

Reverts if:

  • the reentrancy lock is engaged.

  • the caller is blacklisted.

  • the caller is not authorized to withdraw.

  • the caller's balance is less than the amount.

  • the scaled amount is zero.

Logs:

executeWithdrawal

function executeWithdrawal(address accountAddress, uint32 expiry)
    external
    nonReentrant
    returns (uint256);

Executes a withdrawal for an account with a given expiry.

Procedures:

Reverts if:

  • the reentrancy lock is engaged.

  • the expiry is greater than the current timestamp.

Logs:

processUnpaidWithdrawalBatch

function processUnpaidWithdrawalBatch() external nonReentrant;

Processes the first unpaid withdrawal batch in the queue.

Procedures:

Reverts if:

  • the reentrancy lock is engaged.

  • the withdrawal batch queue is empty.

Logs:

Last updated