Skip to content

WintermuteResearch/wildcat-market-oracle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wrapped Wildcat Market Oracle

The Wildcat Market Oracle is a Morpho Blue oracle that prices ERC-4626 wrapped Wildcat market tokens.

WildcatMarketOracle

WildcatMarketOracle prices the ERC-4626 wrapped Wildcat market token from:

  • the Wildcat market scaleFactor
  • the Wildcat market timeDelinquent
  • three discount phases based on timeDelinquent

This data is from the market's currentState(), which returns a cached value. For active markets this should not be a problem, but for ones that are less active, there may be a periodic call to updateState() needed.

The price formula is:

price = 1e36 * scaleFactor / 1e27 * (10000 - discountBps) / 10000

WildcatOracleChainlinkFeed

WildcatOracleChainlinkFeed is a wrapper around the WildcatMarketOracle for usage with MorphoChainlinkOracleV2. A MorphoChainlinkOracleV2 for this oracle can be deployed with baseFeed1 set to WildcatOracleChainlinkFeed.

Phases

The current oracle has three phases, triggered when timeDelinquent > 0:

  1. Grace phase 0% -> gracePenaltyBps over gracePeriod

  2. Intermediary phase gracePenaltyBps -> intermediaryPenaltyBps over intermediaryPeriod

  3. Final phase intermediaryPenaltyBps -> maxDiscountBps over finalPeriod, then capped

gracePeriod is read from the Wildcat market itself through market.delinquencyGracePeriod().

intermediaryPeriod, intermediaryPenaltyBps, finalPeriod, and maxDiscountBps are configured in the constructor.

Example

Settings:

  • gracePeriod = 2 days
  • gracePenaltyBps = 100 (1%)
  • intermediaryPeriod = 7 days
  • intermediary slope = 1.25% per day
  • intermediaryPenaltyBps = 975 (1% + 1.25%*7 = 9.75%)
  • total delinquency time to 0 = 60 days

To reach 60 days in this case

  • phase 1: 2 days
  • phase 2: 7 days
  • phase 3: 51 days

So this example uses:

  • finalPeriod = 51 days
  • maxDiscount = 100%

Note: the current contract requires maxDiscountBps < 10000, so price can't actually go to zero.

Day Phase Discount Remaining Value
0 healthy 0.00% 100.00%
1 grace 0.50% 99.50%
2 grace end 1.00% 99.00%
3 intermediary 2.25% 97.75%
5 intermediary 4.75% 95.25%
7 intermediary 7.25% 92.75%
9 intermediary end 9.75% 90.25%
15 final 20.37% 79.63%
30 final 46.91% 53.09%
45 final 73.46% 26.54%
60 final end 100.00% 0.00%

Deployments

Market MorphoChainlinkOracleV2 WildcatOracleChainlinkFeed WildcatMarketOracle
wmtUSDC 0x6969A0296d9fEC77e794651469e362105d2307e8 0xe44DCF74Ab26eC2E23c4F0922DCB9765379F0Aae 0xD89124a031f75d5cae29fE15376DFcD86B7cF844

About

Wildcat Market Oracle is a Morpho Blue oracle that prices ERC-4626 wrapped Wildcat market tokens for use in Morpho markets

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors