fTokenAdmin ​
Inherits:fTokenCore, fTokenViews, IFTokenAdmin
fToken admin related methods. fToken admins are Lending Factory auths. Possible actions are updating rewards, funding rewards, and rescuing any stuck funds (fToken contract itself never holds any funds).
Functions ​
_checkIsLendingFactoryAuth ​
checks if msg.sender is an allowed auth at LendingFactory. internal method instead of modifier to reduce bytecode size.
function _checkIsLendingFactoryAuth() internal view;_checkRewardsConfigAuth ​
LendingFactory auth, or wired _rewardsRateModel setting only itself / address(0).
function _checkRewardsConfigAuth(address newModel_) internal view;updateRewards ​
updates the rewards rate model contract. Callable by LendingFactory auths, or by the currently wired rewards rate model (so startRewards can re-activate without permanent factory auth on the model). Wired-model callers may only set themselves or address(0).
function updateRewards(IFluidLendingRewardsRateModel rewardsRateModel_) external;Parameters
| Name | Type | Description |
|---|---|---|
rewardsRateModel_ | IFluidLendingRewardsRateModel | the new rewards rate model contract address. can be set to address(0) to set no rewards (to save gas) |
updateStaticRewards ​
updates the static rewards rate model contract. Callable by LendingFactory auths, or by the currently wired rate model (so setStaticRate can settle/re-wire without permanent factory auth on the model). Wired-model callers may only set themselves or address(0).
Mirrors updateRewards: settles the current rate via updateRates() before re-wiring the model. Re-enables _rewardsActive when re-wiring after a prior rewardsEnded_ shutdown (same as streaming startRewards calling updateRewards). Callable by LendingFactory auths or the currently wired rate model (so setStaticRate does not require permanent factory auth). Wired-model callers may only set themselves or address(0).
function updateStaticRewards(IFluidLendingStaticRateModel staticRateModel_) external;Parameters
| Name | Type | Description |
|---|---|---|
staticRateModel_ | IFluidLendingStaticRateModel | the new static rewards rate model contract address. can be set to address(0) to disable rewards (to save gas) |
isStaticRateModelActive ​
Returns whether the wired rewards rate model is a static (TVL-independent) rate model.
function isStaticRateModelActive() public view returns (bool);rebalance ​
Balances out the difference between fToken supply at Liquidity vs totalAssets(). When totalAssets() exceeds the Liquidity balance, deposits underlying from the rebalancer (rewards direction). When the Liquidity balance exceeds totalAssets(), withdraws the excess to the rebalancer (fees direction). Does not mint shares in either case. Only callable by rebalancer.
function rebalance() external payable virtual nonReentrant returns (uint256 assets_);Returns
| Name | Type | Description |
|---|---|---|
assets_ | uint256 | absolute amount deposited to or withdrawn from Liquidity |
updateRebalancer ​
Updates the rebalancer address (ReserveContract). Only callable by LendingFactory auths.
function updateRebalancer(address newRebalancer_) public validAddress(newRebalancer_);updateRates ​
gets the liquidity exchange price of the underlying asset, calculates the updated exchange price (with reward rates) and writes those values to storage. Callable by anyone.
function updateRates() public returns (uint256 tokenExchangePrice_, uint256 liquidityExchangePrice_);Returns
| Name | Type | Description |
|---|---|---|
tokenExchangePrice_ | uint256 | exchange price of fToken share to underlying asset |
liquidityExchangePrice_ | uint256 | exchange price at Liquidity for the underlying asset |
rescueFunds ​
sends any potentially stuck funds to Liquidity contract. Only callable by LendingFactory auths.
function rescueFunds(address token_) external virtual nonReentrant;