WildcatMarket.sol
The WildcatMarket
is the final contract, containing all vault-related logic.
updateState
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
Deposits up to a given amount.
Procedures:
Reduce amount if it would exceed total supply
Scale the mint amount by the scale factor
Transfer deposit from the caller
Increase the total supply
Update the delinquency state
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
Calls depositUpTo internally then checks the total supply would have been exceeded.
Reverts if:
amount would have exceeded the total supply.
collectFees
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
Borrows an amount from the market and updates the market state.
Reverts if:
the reentrancy guard is engaged.
the caller is not the borrower.
the amount is greater than the borrowable assets.
Logs:
closeMarket
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