Constants
RESERVE_CONTRACT
contract IFluidReserveContract RESERVE_CONTRACT
LIQUIDITY
contract IFluidLiquidity LIQUIDITY
SUPPLY_TOKEN
address SUPPLY_TOKEN
supply token at Liquidity which borrow rate is based on
BORROW_TOKEN
address BORROW_TOKEN
borrow token at Liquidity for which the borrow rate is managed
RATE_BUFFER_KINK1
int256 RATE_BUFFER_KINK1
buffer at kink1 for the rate. borrow rate = supply rate + buffer. In percent (100 = 1%, 1 = 0.01%)
RATE_BUFFER_KINK2
int256 RATE_BUFFER_KINK2
buffer at kink2 for the rate. borrow rate = supply rate + buffer. In percent (100 = 1%, 1 = 0.01%)
only used if CURRENT borrow rate mode at Liquidity is V2 (with 2 kinks).
MIN_UPDATE_DIFF
uint256 MIN_UPDATE_DIFF
minimum percent difference to trigger an update. In percent (100 = 1%, 1 = 0.01%)
_LIQUDITY_SUPPLY_TOTAL_AMOUNTS_SLOT
bytes32 _LIQUDITY_SUPPLY_TOTAL_AMOUNTS_SLOT
_LIQUDITY_SUPPLY_EXCHANGE_PRICES_AND_CONFIG_SLOT
bytes32 _LIQUDITY_SUPPLY_EXCHANGE_PRICES_AND_CONFIG_SLOT
_LIQUDITY_BORROW_RATE_DATA_SLOT
bytes32 _LIQUDITY_BORROW_RATE_DATA_SLOT
EXCHANGE_PRICES_PRECISION
uint256 EXCHANGE_PRICES_PRECISION
DEFAULT_EXPONENT_SIZE
uint256 DEFAULT_EXPONENT_SIZE
DEFAULT_EXPONENT_MASK
uint256 DEFAULT_EXPONENT_MASK
X14
uint256 X14
X16
uint256 X16
X64
uint256 X64
FOUR_DECIMALS
uint256 FOUR_DECIMALS
Events
LogUpdateRate
event LogUpdateRate(uint256 supplyRate, uint256 oldRateKink1, uint256 newRateKink1, uint256 oldRateKink2, uint256 newRateKink2)
emitted when borrow rate for BORROW_TOKEN
is updated based on
supply rate of SUPPLY_TOKEN
+ buffer.
FluidBufferRateHandler
Sets borrow rate for BORROW_TOKEN
at Liquidaty based on supply rate of SUPPLY_TOKEN
+ buffer.
validAddress
modifier validAddress(address value_)
Validates that an address is not the zero address
onlyRebalancer
modifier onlyRebalancer()
Validates that an address is a rebalancer (taken from reserve contract)
constructor
constructor(contract IFluidReserveContract reserveContract_, contract IFluidLiquidity liquidity_, address supplyToken_, address borrowToken_, int256 rateBufferKink1_, int256 rateBufferKink2_, uint256 minUpdateDiff_) public
configPercentDiff
function configPercentDiff() public view returns (uint256 configPercentDiff_)
returns how much the new config would be different from current config in percent (100 = 1%, 1 = 0.01%).
rebalance
function rebalance() external
Rebalances the configs at Fluid Liquidity based on config handler target. Reverts if no update is needed. Can only be called by an authorized rebalancer.
calcBorrowRates
function calcBorrowRates() public view returns (uint256 rateKink1_, uint256 rateKink2_)
returns the current calculcated borrow rates at kink1 and kink 2 (for rate data v2).
supplyTokenLendingRate
function supplyTokenLendingRate() public view returns (uint256 rate_)
get current SUPPLY_TOKEN
lending rate_
at Liquidity
_calcBorrowRates
function _calcBorrowRates(uint256 supplyRate_, uint256 rateConfig_) internal view returns (uint256 rateKink1_, uint256 rateKink2_)
calculates current borrow rates at kinks for supply rate and current rate data
_percentDiffForValue
function _percentDiffForValue(uint256 oldValue_, uint256 newValue_) internal pure returns (uint256 configPercentDiff_)
_gets the percentage difference between oldValue_
andnewValue*
in relation tooldValue*
_
_rebalanceRateV1
function _rebalanceRateV1(uint256 supplyRate_, uint256 rateConfig_) internal
rebalances for a RateV1 config
_rebalanceRateV2
function _rebalanceRateV2(uint256 supplyRate_, uint256 rateConfig_) internal
rebalances for a RateV2 config
- Constants
- RESERVE_CONTRACT
- LIQUIDITY
- SUPPLY_TOKEN
- BORROW_TOKEN
- RATE_BUFFER_KINK1
- RATE_BUFFER_KINK2
- MIN_UPDATE_DIFF
- _LIQUDITY_SUPPLY_TOTAL_AMOUNTS_SLOT
- _LIQUDITY_SUPPLY_EXCHANGE_PRICES_AND_CONFIG_SLOT
- _LIQUDITY_BORROW_RATE_DATA_SLOT
- EXCHANGE_PRICES_PRECISION
- DEFAULT_EXPONENT_SIZE
- DEFAULT_EXPONENT_MASK
- X14
- X16
- X64
- FOUR_DECIMALS
- Events
- FluidBufferRateHandler