WildcatMarketState
Documentation for eth_defi.erc_4626.vault_protocol.wildcat.state.WildcatMarketState Python class.
- class WildcatMarketState
Bases:
objectVersion 2
MarketStatereturned bycurrentState().Field order follows the
MarketStatestruct, so the decoded tuple can be passed positionally. Amounts are raw integers in market token units, andscaled*amounts must be multiplied byscale_factor / 1e27.https://github.com/wildcat-finance/v2-protocol/blob/main/src/libraries/MarketState.sol
Attributes summary
Whether the borrower has closed the market.
Deposit cap in normalised units.
Protocol fees owed by the borrower and held in the market.
Paid withdrawals not yet claimed by lenders.
Total lender supply in scaled units, including pending withdrawals.
Queued, unpaid withdrawals in scaled units, across all unpaid batches.
Expiry of the current withdrawal batch, or zero.
Delinquency flag stored at the last state update.
Accumulated delinquent seconds, accrued to the read block.
Share of interest paid to the protocol by the borrower, in bips.
Base lender APR in bips.
Liquidity the borrower must keep in the market, in bips.
Ray-precision share price.
Timestamp of the last interest accrual.
Raw remaining deposit capacity, zero for a closed market.
Underlying assets per scaled market token.
Raw lender supply, equal to the market's
totalSupply().Methods summary
__init__(is_closed, max_total_supply, ...)Calculate available liquidity and utilisation from market cash.
decode(data)Decode raw
currentState()return data.normalise(scaled_amount)Convert a scaled amount to market token units.
- is_closed: bool
Whether the borrower has closed the market.
- max_total_supply: int
Deposit cap in normalised units.
- accrued_protocol_fees: int
Protocol fees owed by the borrower and held in the market.
- normalized_unclaimed_withdrawals: int
Paid withdrawals not yet claimed by lenders.
- scaled_total_supply: int
Total lender supply in scaled units, including pending withdrawals.
- scaled_pending_withdrawals: int
Queued, unpaid withdrawals in scaled units, across all unpaid batches.
- pending_withdrawal_expiry: int
Expiry of the current withdrawal batch, or zero.
- is_delinquent: bool
Delinquency flag stored at the last state update.
- time_delinquent: int
Accumulated delinquent seconds, accrued to the read block.
- protocol_fee_bips: int
Share of interest paid to the protocol by the borrower, in bips.
- annual_interest_bips: int
Base lender APR in bips.
- reserve_ratio_bips: int
Liquidity the borrower must keep in the market, in bips.
- scale_factor: int
Ray-precision share price.
- last_interest_accrued_timestamp: int
Timestamp of the last interest accrual.
- classmethod decode(data)
Decode raw
currentState()return data.- Parameters
data (bytes) – ABI-encoded
MarketStatestruct.- Returns
Decoded state.
- Return type
eth_defi.erc_4626.vault_protocol.wildcat.state.WildcatMarketState
- normalise(scaled_amount)
Convert a scaled amount to market token units.
Uses the contract’s half-up
rayMulrounding.
- property total_supply: int
Raw lender supply, equal to the market’s
totalSupply().
- property share_price: decimal.Decimal
Underlying assets per scaled market token.
- property max_deposit: int
Raw remaining deposit capacity, zero for a closed market.
- calculate_lending_metrics(cash)
Calculate available liquidity and utilisation from market cash.
Paid-but-unclaimed withdrawals and accrued protocol fees sit in the market’s cash but belong to withdrawn lenders and the protocol. Utilisation is lent-out debt over lender supply, equal to the version 1
outstandingDebt() / totalSupply(). Pending withdrawals are deducted only from available liquidity, because older unpaid batches would otherwise pin utilisation at 100%.
- __init__(is_closed, max_total_supply, accrued_protocol_fees, normalized_unclaimed_withdrawals, scaled_total_supply, scaled_pending_withdrawals, pending_withdrawal_expiry, is_delinquent, time_delinquent, protocol_fee_bips, annual_interest_bips, reserve_ratio_bips, scale_factor, last_interest_accrued_timestamp)
- Parameters
is_closed (bool) –
max_total_supply (int) –
accrued_protocol_fees (int) –
normalized_unclaimed_withdrawals (int) –
scaled_total_supply (int) –
scaled_pending_withdrawals (int) –
pending_withdrawal_expiry (int) –
is_delinquent (bool) –
time_delinquent (int) –
protocol_fee_bips (int) –
annual_interest_bips (int) –
reserve_ratio_bips (int) –
scale_factor (int) –
last_interest_accrued_timestamp (int) –
- Return type
None