WildcatMarket.sol

The WildcatMarket is the final contract, containing all vault-related logic.

updateState

 function updateState() external;

Updates the market state.

Procedures:

  • If the timestamp is that of the last state update:

    • Return the market state as is, performing no additional computations

  • Otherwise:

    • If a withdrawal batch has expired:

      • Update the market state with the expiry timestamp for:

        • fees

        • delinquency when applicable

        • scale factor

        • withdrawal batch state

      • Process the expired withdrawal batch

    • Otherwise, continue

    • If the block timestamp is still not that of the last state update:

      • Update the market state with the expiry timestamp for:

        • fees

        • delinquency when applicable

        • scale factor

        • withdrawal batch state

    • Update the delinquency state

Logs:

depositUpTo

 function depositUpTo(uint256 amount)
   public virtual nonReentrant returns (uint256);

Deposits up to a given amount.

Procedures:

Reverts if:

  • the reentrancy guard is engaged.

  • the scaled mint amount is zero.

  • the caller is blacklisted.

  • the caller is not authorized to deposit.

Logs:

deposit

 function deposit(uint256 amount)
   external virtual;

Calls depositUpTo internally then checks the total supply would have been exceeded.

Reverts if:

collectFees

 function collectFees()
   external nonReentrant;

Collects protocol fees and updates the market state.

Coverage for deposits takes precedence over fee revenue.

Reverts if:

  • the reentrancy guard is engaged.

  • the total assets is less than the liquidity required for withdrawals.

Logs:

borrow

 function borrow(uint256 amount)
   external onlyBorrower nonReentrant;

Borrows an amount from the market and updates the market state.

Reverts if:

Logs:

closeMarket

 function closeMarket()
   external onlyController nonReentrant;

Sets the market to 0% APR, updates the market state, and transfers the outstanding balance for full redemption.

Reverts if:

  • the reentrancy guard is engaged.

  • the caller is not the controller.

Logs:

  • MarketClosed

Last updated