erc_4626.vault_protocol.wildcat.state
Documentation for eth_defi.erc_4626.vault_protocol.wildcat.state Python module.
Wildcat version 2 market state and the values derived from it.
Module Attributes
ABI type of the version 2 |
Classes
Version 2 |
- MARKET_STATE_ABI_TYPE = '(bool,uint128,uint128,uint128,uint104,uint104,uint32,bool,uint32,uint16,uint16,uint16,uint112,uint32)'
ABI type of the version 2
MarketStatestruct returned bycurrentState().
- 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
- scaled_pending_withdrawals: int
Queued, unpaid withdrawals in scaled units, across all unpaid batches.
- 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.
Underlying assets per scaled market token.
- 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