Skip to content

sparkdotfi/sparklend-advanced

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SparkLend Advanced Contracts

This repository contains advanced features to improve SparkLend beyond the core contracts. This repository is mostly focused on improving security and automating governance processes.

Available Contracts

Oracles

Please note all these oracles are designed for consumption by AaveOracle which assumes 8 decimal places.

FixedPriceOracle: A hardcoded oracle price that never changes. Used for: DAI/USDC/USDT markets

CappedOracle: Returns min(market price, hardcoded max price). Not currently used.

WSTETHExchangeRateOracle: Provides wstETH/USD by multiplying the wstETH exchange rate by ETH/USD. Used for: wstETH market

RETHExchangeRateOracle: Provides rETH/USD by multiplying the rETH exchange rate by ETH/USD. Used for: rETH market

WEETHExchangeRateOracle: Provides weETH/USD by multiplying the weETH exchange rate by ETH/USD. Used for: weETH market

RSETHExchangeRateOracle: Provides rsETH/USD by multiplying the rsETH exchange rate by ETH/USD. Used for: rsETH market

EZETHExchangeRateOracle: Provides ezETH/USD by multiplying the ezETH exchange rate by ETH/USD. Used for: ezETH market

SPETHExchangeRateOracle: Provides spETH/USD by multiplying the spETH (ERC-4626) exchange rate by ETH/USD. Used for: spETH market

WEETHRatioOracle: Provides eETH/ETH by dividing the weETH/ETH price by the weETH exchange rate. Used for: KillSwitch monitoring

CBBTCRatioOracle: Provides cbBTC/BTC by dividing the cbBTC/USD price by the BTC/USD price. Used for: KillSwitch monitoring

RETHRatioOracle: Provides rETH/ETH by dividing the rETH/ETH price by the rETH exchange rate. Used for: KillSwitch monitoring

MorphoUpgradableOracle: Allows Spark Governance to change an oracle for Morpho Blue markets. Planned to be used in Morpho Blue.

Custom Interest Rate Strategies

VariableBorrowInterestRateStrategy: Modified version of DefaultReserveInterestRateStrategy that removes the stable borrow logic.

RateTargetBaseInterestRateStrategy: Overridden version of VariableBorrowInterestRateStrategy that sets the base variable borrow rate to match an external rate source with a fixed spread. Used for: DAI market

RateTargetKinkInterestRateStrategy: Overridden version of VariableBorrowInterestRateStrategy that sets the variable slope 1 rate to match an external rate source with a fixed spread. Used for: ETH/USDC/USDT markets

Rate Sources

PotRateSource: Adapter to convert DSR into APR which can be consumed by one of the rate target interest rate strategies. Used for: DAI/USDC/USDT markets

CappedFallbackRateSource: Wraps another rate source, caps the rate and protects against reverts with a fallback value. Used for: ETH market

Ratio Oracles

All ratio-style oracles are not reporting the actual value of collateral within the protocols, as they are relying on cached prices, but stale price feeds are acceptable here since they are just used for monitoring purposes.

Usage

forge build

Test

forge test

About

Advanced features to improve SparkLend beyond the core contracts. This repository is mostly focused on improving security and automating governance processes.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors