WildcatMarketBase.sol
The WildcatMarketBase
is the base contract containing core state mutation and computation logic as well as storage variables and immutable values.
sentinel
Address with blacklist control, used for blocking sanctioned addresses.
borrower
Address with authority to borrow assets from the market.
feeRecipient
Address that receives protocol fees.
protocolFeeBips
Protocol fee added to interest paid by borrower.
One protocol fee bip is 0.01% of an APR bip.
delinquencyFeeBips
Penalty fee added to interest earned by lenders, does not affect protocol fee.
delinquencyGracePeriod
Time after which delinquency incurs penalty fee.
controller
Address of the market controller.
asset
Address of the underlying asset.
withdrawalBatchDuration
Time before withdrawal batches are processed.
decimals
Token decimals, derived from underlying asset.
name
Token name, derived from underlying asset.
symbol
Token symbol, derived from underlying asset.
coverageLiquidity
Liquidity required based on the current market state.
Reverts if:
the reentrancy lock is engaged.
scaleFactor
Scale factor based on the current market state.
Reverts if:
the reentrancy lock is engaged.
totalAssets
Total market balance of the underlying asset.
borrowableAssets
Amount of the underlying asset that may be borrowed based on the current market state.
Reverts if:
the reentrancy lock is engaged.
accruedProtocolFees
Amount of accrued protocol fees based on the current market state.
Reverts if:
the reentrancy lock is engaged.
previousState
Returns the state of the market from the last state update, performing no computation or mutations.
currentState
Calculates the current market state by applying fees and accrued interest from the last update.
This function does not update the global state, all mutations and computations are performed on a cached version of the market and withdrawal state in memory.
Procedures:
If the timestamp matches that of the most recent 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
Otherwise, continue
Update the market state with the current timestamp for the following:
fees
delinquency when applicable
scale factor
Reverts if:
the reentrancy lock is engaged.
scaledTotalSupply
Returns the total supply of the current market state scaled by the scale factor.
Reverts if:
the reentrancy lock is engaged.
scaledBalanceOf
Returns the balance of an account scaled by the scale factor.
Reverts if:
the reentrancy lock is engaged.
the account is blacklisted.
effectiveBorrowerAPR
Effective interest rate paid by the borrower, based on the current market state.
The borrower is responsible for base APR, protocol fee, and penalty APR in place.
effectiveLenderAPR
Effective interest rate earned by the lenders, based on the current market state.
The lender earns the base APR and any penalty APR in place.
Last updated