Wildcat Protocol Documentation
  • The Wildcat Protocol
  • Overview
    • The Elevator Pitch
    • Whitepaper
    • FAQs
  • Using Wildcat
    • Terminology
    • Onboarding
    • Day-To-Day Usage
      • Borrowers
      • Lenders
      • Market Access Via Policies/Hooks
      • The Sentinel
    • Protocol Usage Fees
    • Delinquency
  • Technical Overview
    • Security/Developer Dives
      • The Scale Factor
      • Core Behaviour
      • V1 -> V2 Changelog
      • Known Issues
      • Hooks
        • How Hooks Work
        • Access Control Hooks
        • Fixed Term Loan Hooks
    • Function/Event Signatures
      • /access
        • AccessControlHooks.sol
        • IRoleProvider.sol
        • MarketConstraintHooks.sol
      • /interfaces
        • IHooks.sol
        • IMarketEventsAndErrors.sol
        • IWildcatArchController.sol
        • IWildcatSanctionsEscrow.sol
        • IWildcatSanctionsSentinel.sol
      • /market
        • WildcatMarketConfig.sol
        • WildcatMarketToken.sol
        • WildcatMarketWithdrawals.sol
        • WildcatMarketBase.sol
      • /spherex
        • ISphereXEngine.sol
        • ISphereXProtectedRegisteredBase.sol
        • SphereXConfig.sol
      • HooksFactory.sol
      • IHooksFactory.sol
      • WildcatArchController.sol
      • WildcatSanctionsEscrow.sol
      • WildcatSanctionsSentinel.sol
    • Protocol Structs
    • Contract Deployments
  • Security Measures
    • Code Security Reviews
    • SphereX Protection
    • Bug Bounty Program
  • Legal
    • Wildcat Terms Of Use
    • Risk Disclosure Statement
    • Template MLA
    • Privacy Policy
Powered by GitBook
On this page
  1. Miscellaneous
  2. DEPRECATED DOCUMENTATION
  3. V1 Component Overview
  4. Wildcat Market Overview

WildcatMarketWithdrawals.sol

Last updated 1 year ago

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 .

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);

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:

  • 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 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:

  • Update the withdrawal queue

  • Update the account status

  • Transfers the underlying asset to the account

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:

  • Apply withdrawal batch payment

  • Remove the batch if fully paid

Reverts if:

  • the reentrancy lock is engaged.

  • the withdrawal batch queue is empty.

Logs:

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

Scale the amount by the

the caller's vault tokens to the vault

the caller's is less than the amount.

Return the amount scaled by the

current state
current state
scale factor
scale factor
Transfer
WithdrawalBatchCreated
WithdrawalBatchPayment
WithdrawalExecuted
WithdrawalBatchClosed
WithdrawalBatchPayment
Transfer
balance
Update the vault state
Update the vault state
Update the vault state