Fintroller
Introduction
The Fintroller is the administrator of the Hifi protocol. It can set the value of important variables like the liquidation incentive and can toggle on and off the operations that are allowed to be performed on fyTokens.
Gas Costs
Action
Typical Gas Cost
List Bond
<80K
Set Bond Collateralization Ratio
<40K
Set Bond Debt Ceiling
<50K
Set Borrow Allowed
<30K
Set Liquidate Borrow Allowed
<30K
Set Liquidation Incentive
<30K
Set Oracle
<50K
Set Redeem FyTokens Allowed
<30K
Set Repay Borrow Allowed
<30K
Set Supply Underlying Allowed
<30K
Storage Properties
Liquidation Incentive Mantissa
Multiplier representing the discount on collateral that a liquidator receives.
uint256 public liquidationIncentiveMantissa;
Oracle
The contract that provides price data for the collateral and the underlying asset.
ChainlinkOperatorInterface public oracle;
Oracle Price Precision Scalar
The ratio between mantissa precision (1e18) and the oracle price precision (1e6).
uint256 public constant oraclePricePrecisionScalar = 1.0e12;
Constant Functions
Get Bond
Reads all the storage properties of a bond struct.
function getBond(FyTokenInterface fyToken) external view returns (uint256, uint256, bool, bool, bool, bool, bool, bool, bool)
fyToken
: The address of the bond contract.
It is not an error to provide an invalid fyToken address. The returned values would all be zero.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
(
uint256 collateralizationRatioMantissa,
uint256 debtCeiling,
bool isBorrowAllowed,
bool isDepositCollateralAllowed,
bool isLiquidateBorrowAllowed,
bool isListed,
bool isRedeemFyTokenAllowed,
bool isRepayBorrowAllowed,
bool isSupplyUnderlyingAllowed
) = fintroller.getBond(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const bond = await fintroller.getBond(fyTokenAddress);
Get Bond Collateralization Ratio
Reads the collateralization ratio of the given bond.
function getBondCollateralizationRatio(FyTokenInterface fyToken) external view returns (uint256)
fyToken
: The address of the bond contract.
It is not an error to provide an invalid fyToken address.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
uint256 bondCollateralizationRatio = fintroller.getBondCollateralizationRatio(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const bondCollateralizationRatio = await fintroller.getBondCollateralizationRatio(fyTokenAddress);
Get Bond Debt Ceiling
Reads the debt ceiling of the given bond.
function getBondDebtCeiling(FyTokenInterface fyToken) external view returns (uint256)
fyToken
: The address of the bond contract.
It is not an error to provide an invalid fyToken address.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
uint256 bondDebtCeiling = fintroller.getBondDebtCeiling(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const bondDebtCeiling = await fintroller.getBondDebtCeiling(fyTokenAddress);
Get Borrow Allowed
Checks if the account should be allowed to borrow fyTokens.
function getBorrowAllowed(FyTokenInterface fyToken) external view returns (bool)
fyToken
: The bond to make the check against.
Requirements:
The bond must be listed.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
bool isBorrowAllowed = fintroller.getBorrowAllowed(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const isBorrowAllowed = await fintroller.getBorrowAllowed(fyTokenAddress);
Get Deposit Collateral Allowed
Checks if the account should be allowed to deposit collateral.
function getDepositCollateralAllowed(FyTokenInterface fyToken) external view returns (bool)
fyToken
: The bond to make the check against.
Requirements:
The bond must be listed.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
bool isDepositCollateralAllowed = fintroller.getDepositCollateralAllowed(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const isDepositCollateralAllowed = await fintroller.getDepositCollateralAllowed(fyTokenAddress);
Get Liquidate Borrow Allowed
Checks if the account should be allowed to liquidate fyToken borrows.
function getLiquidateBorrowAllowed(FyTokenInterface fyToken) external view returns (bool)
fyToken
: The bond to make the check against.
Requirements:
The bond must be listed.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
bool isLiquidateBorrowAllowed = fintroller.getLiquidateBorrowAllowed(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const isLiquidateBorrowAllowed = await fintroller.getLiquidateBorrowAllowed(fyTokenAddress);
Get Redeem FyTokens Allowed
Checks if the account should be allowed to redeem the underlying asset from the RedemptionPool.
function getRedeemFyTokensAllowed(FyTokenInterface fyToken) external view returns (bool)
fyToken
: The bond to make the check against.
Requirements:
The bond must be listed.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
bool isRedeemFyTokensAllowed = fintroller.getRedeemFyTokensAllowed(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const isRedeemFyTokensAllowed = await fintroller.getRedeemFyTokensAllowed(fyTokenAddress);
Get Repay Borrow Allowed
Checks if the account should be allowed to repay borrows.
function getRepayBorrowAllowed(FyTokenInterface fyToken) external view returns (bool)
fyToken
: The bond to make the check against.
Requirements:
The bond must be listed.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
bool isRepayBorrowAllowed = fintroller.getRepayBorrowAllowed(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const isRepayBorrowAllowed = await fintroller.getRepayBorrowAllowed(fyTokenAddress);
Get Supply Underlying Allowed
Checks if the account should be allowed to the supply underlying asset to the RedemptionPool.
function getSupplyUnderlyingAllowed(FyTokenInterface fyToken) external view returns (bool)
fyToken
: The bond to make the check against.
Requirements:
The bond must be listed.
Solidity
Fintroller fintroller = Fintroller(0xabcd...);
address fyTokenAddress = 0x1234;
bool isSupplyUnderlyingAllowed = fintroller.getSupplyUnderlyingAllowed(fyTokenAddress);
Ethers.js
const fintroller = new ethers.Contract(0xabcd..., fintrollerABI, signer);
const fyTokenAddress = 0x1234;
const isSupplyUnderlyingAllowed = await fintroller.getSupplyUnderlyingAllowed(fyTokenAddress);
Non-Constant Functions
List Bond
Marks the bond as listed in this Fintroller's registry. Emits a "ListBond" event.
function listBond(FyTokenInterface fyToken) external override returns (bool)
fyToken
: The fyToken contract to list.RETURN
: true = success, otherwise it reverts.
It is not an error to list a bond twice.
Requirements:
The caller must be the admin.
The fyToken must pass the inspection.
Set Bond Collateralization Ratio
Updates the bond's collateralization ratio. Emits a "SeBondCollateralizationRatio" event.
function setBondCollateralizationRatio(FyTokenInterface fyToken, uint256 newCollateralizationRatioMantissa) external returns (bool)
fyToken
: The bond for which to update the collateralization ratio.newCollateralizationRatioMantissa
: The new collateralization ratio as a mantissa.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
The bond must be listed.
The new collateralization ratio cannot be higher than the maximum collateralization ratio.
The new collateralization ratio cannot be lower than the minimum collateralization ratio.
Set Bond Debt Ceiling
Updates the debt ceiling, which limits how much debt can be created in the bond market. Emits a "SetBondDebtCeiling" event.
function setBondDebtCeiling(FyTokenInterface fyToken, uint256 newDebtCeiling) external returns (bool)
fyToken
: The bond for which to update the debt ceiling.newDebtCeiling
: The uint256 value of the new debt ceiling, specified in the bond's decimal system.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
The bond must be listed.
The debt ceiling cannot be zero.
The debt ceiling cannot fall below the current total supply of fyTokens.
Set Borrow Allowed
Updates the state of the permission accessed by the fyToken before a borrow. Emits a "SetBorrowAllowed" event.
function setBorrowAllowed(FyTokenInterface fyToken, bool state) externalreturns (bool)
fyToken
: The fyToken contract to update the permission for.state
: The new state to put in storage.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
The bond must be listed.
Set Deposit Collateral Allowed
Updates the state of the permission accessed by the fyToken before a collateral deposit. Emits a "SetDepositCollateralAllowed" event.
function setDepositCollateralAllowed(FyTokenInterface fyToken, bool state) external returns (bool)
fyToken
: The fyToken contract to update the permission for.state
: The new state to put in storage.RETURN
: true = success, otherwise it reverts.
Set Liquidate Borrow Allowed
Updates the state of the permission accessed by the fyToken before a liquidate borrow. Emits a "SetLiquidateBorrowAllowed" event.
function setLiquidateBorrowAllowed(FyTokenInterface fyToken, bool state) external returns (bool)
fyToken
: The fyToken contract to update the permission for.state
: The new state to put in storage.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
The bond must be listed.
Set Liquidation Incentive
Sets a new value for the liquidation incentive, which is applicable to all listed bonds. Emits a "SetLiquidationIncentive" event.
function setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (bool)
newLiquidationIncentiveMantissa
: The new liquidation incentive as a mantissa.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
The new liquidation incentive cannot be higher than the maximum liquidation incentive.
The new liquidation incentive cannot be lower than the minimum liquidation incentive.
Set Oracle
Updates the oracle contract's address saved in storage. Emits a "SetOracle" event.
function setOracle(ChainlinkOperaorInterface newOracle) external returns (bool)
newOracle
: The new oracle contract.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
The new address cannot be the zero address.
Set Redeem FyTokens Allowed
Updates the state of the permission accessed by the RedemptionPool before a redemption of underlying. Emits a "SetRedeemFyTokensAllowed" event.
function setRedeemFyTokensAllowed(FyTokenInterface fyToken, bool state) external returns (bool)
fyToken
: The fyToken contract to update the permission for.state
: The new state to put in storage.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
The bond must be listed.
Set Repay Borrow Allowed
Updates the state of the permission accessed by the fyToken before a repay borrow. Emits a "SetRepayBorrowAllowed" event.
function setRepayBorrowAllowed(FyTokenInterface fyToken, bool state) external returns (bool)
fyToken
: The fyToken contract to update the permission for.state
: The new state to put in storage.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
The bond must be listed.
Set Supply Underlying Allowed
Updates the state of the permission accessed by the "RedemptionPool" before a supply of underlying. Emits a "SetSupplyUnderlyingAllowed" event.
function setSupplyUnderlyingAllowed(FyTokenInterface fyToken, bool state) external returns (bool)
fyToken
: The fyToken contract to update the permission for.state
: The new state to put in storage.RETURN
: true = success, otherwise it reverts.
Requirements:
The caller must be the admin.
Last updated
Was this helpful?