Fintroller
Controls the financial permissions and risk parameters for the Hifi protocol.
Constant Functions
getBond
function getBond(
contract IHToken bond
) external returns (struct IFintroller.Bond)
Returns the Bond struct instance associated to the given address.
It is not an error to provide an invalid address.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The address of the bond contract. |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct IFintroller.Bond | The bond object. |
getBorrowAllowed
function getBorrowAllowed(
contract IHToken bond
) external returns (bool)
Checks if the account should be allowed to borrow hTokens.
The bond must be listed.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The bond to make the check against. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool true = allowed, false = not allowed. |
getCollateral
function getCollateral(
contract IErc20 collateral
) external returns (struct IFintroller.Collateral)
Returns the Collateral struct instance associated to the given address.
It is not an error to provide an invalid address.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The address of the collateral contract. |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct IFintroller.Collateral | The collateral object. |
getCollateralCeiling
function getCollateralCeiling(
contract IErc20 collateral
) external returns (uint256)
Returns the collateral ceiling.
It is not an error to provide an invalid address.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The address of the collateral contract. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The collateral ceiling as a uint256, or zero if an invalid address was provided. |
getCollateralRatio
function getCollateralRatio(
contract IErc20 collateral
) external returns (uint256)
Returns the collateral ratio.
It is not an error to provide an invalid address.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The address of the collateral contract. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The collateral ratio, or zero if an invalid address was provided. |
getDebtCeiling
function getDebtCeiling(
contract IHToken bond
) external returns (uint256)
Returns the debt ceiling for the given bond.
It is not an error to provide an invalid address.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The address of the bond contract. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The debt ceiling as a uint256, or zero if an invalid address was provided. |
getDepositCollateralAllowed
function getDepositCollateralAllowed(
contract IErc20 collateral
) external returns (bool)
Checks if collateral deposits are allowed.
The collateral must be listed.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The collateral to make the check against. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool true = allowed, false = not allowed. |
getDepositUnderlyingAllowed
function getDepositUnderlyingAllowed(
contract IHToken bond
) external returns (bool)
Checks if underlying deposits are allowed.
The bond must be listed.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The bond to make the check against. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool true = allowed, false = not allowed. |
getLiquidationIncentive
function getLiquidationIncentive(
contract IErc20 collateral
) external returns (uint256)
Returns the liquidation incentive of the given collateral.
It is not an error to provide an invalid address.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The address of the collateral contract. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The liquidation incentive, or zero if an invalid address was provided. |
getLiquidateBorrowAllowed
function getLiquidateBorrowAllowed(
contract IHToken bond
) external returns (bool)
Checks if the account should be allowed to liquidate hToken borrows.
The bond must be listed.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The bond to make the check against. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool true = allowed, false = not allowed. |
getRepayBorrowAllowed
function getRepayBorrowAllowed(
contract IHToken bond
) external returns (bool)
Checks if the account should be allowed to repay borrows.
The bond must be listed.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The bond to make the check against. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool true = allowed, false = not allowed. |
isBondListed
function isBondListed(
contract IHToken bond
) external returns (bool)
Checks if the bond is listed.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The bond to make the check against. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool true = listed, otherwise not. |
isCollateralListed
function isCollateralListed(
contract IErc20 collateral
) external returns (bool)
Checks if the collateral is listed.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The collateral to make the check against. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool true = listed, otherwise not. |
maxBonds
function maxBonds() external returns (uint256)
Returns the maximum number of bond markets a single account can enter.
maxCollaterals
function maxCollaterals() external returns (uint256)
Returns the maximum number of Collaterals a single account can deposit.
Non-Constant Functions
listBond
function listBond(
contract IHToken bond
) external
Marks the bond as listed in this registry.
It is not an error to list a bond twice. Emits a {ListBond} event.
Requirements:
- The caller must be the owner.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The hToken contract to list. |
listCollateral
function listCollateral(
contract IErc20 collateral
) external
Marks the collateral as listed in this registry.
Emits a {ListCollateral} event. It is not an error to list a bond twice.
Requirements:
- The caller must be the owner.
- The collateral must have between 1 and 18 decimals.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The collateral contract to list. |
setBorrowAllowed
function setBorrowAllowed(
contract IHToken bond,
bool state
) external
Updates the state of the permission accessed by the hToken before a borrow.
Emits a {SetBorrowAllowed} event.
Requirements:
- The caller must be the owner.
- The bond must be listed.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The bond to update the permission for. |
state | bool | The new state to put in storage. |
setCollateralCeiling
function setCollateralCeiling(
contract IHToken collateral,
uint256 newCollateralCeiling
) external
Updates the collateral ceiling.
Emits a {SetCollateralCeiling} event.
Requirements:
- The caller must be the owner.
- The collateral must be listed.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IHToken | The collateral to update the ceiling for. |
newCollateralCeiling | uint256 | The new collateral ceiling. |
setCollateralRatio
function setCollateralRatio(
contract IErc20 collateral,
uint256 newCollateralRatio
) external
Updates the collateral ratio.
Emits a {SetCollateralRatio} event.
Requirements:
- The caller must be the owner.
- The collateral must be listed.
- The new collateral ratio cannot be higher than the maximum collateral ratio.
- The new collateral ratio cannot be lower than the minimum collateral ratio.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The collateral to update the collateral ratio for. |
newCollateralRatio | uint256 | The new collateral ratio. |
setDebtCeiling
function setDebtCeiling(
contract IHToken bond,
uint256 newDebtCeiling
) external
Updates the debt ceiling for the given bond.
Emits a {SetDebtCeiling} event.
Requirements:
- The caller must be the owner.
- The bond must be listed.
- The debt ceiling cannot fall below the current total supply of hTokens.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The bond to update the debt ceiling for. |
newDebtCeiling | uint256 | The new debt ceiling. |
setDepositCollateralAllowed
function setDepositCollateralAllowed(
contract IErc20 collateral,
bool state
) external
Updates the state of the permission accessed by the BalanceSheet before a collateral deposit.
Emits a {SetDepositCollateralAllowed} event.
Requirements:
- The caller must be the owner.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The collateral to update the permission for. |
state | bool | The new state to put in storage. |
setDepositUnderlyingAllowed
function setDepositUnderlyingAllowed(
contract IHToken bond,
bool state
) external
Updates the state of the permission accessed by the hToken before an underlying deposit.
Emits a {SetDepositUnderlyingAllowed} event.
Requirements:
- The caller must be the owner.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The bond to update the permission for. |
state | bool | The new state to put in storage. |
setLiquidationIncentive
function setLiquidationIncentive(
contract IErc20 collateral,
uint256 newLiquidationIncentive
) external
Updates the collateral liquidation incentive.
Emits a {SetLiquidationIncentive} event.
Requirements:
- The caller must be the owner.
- The collateral must be listed.
- The new liquidation incentive cannot be higher than the maximum liquidation incentive.
- The new liquidation incentive cannot be lower than the minimum liquidation incentive.
Parameters
Name | Type | Description |
---|---|---|
collateral | contract IErc20 | The collateral to update the liquidation incentive for. |
newLiquidationIncentive | uint256 | The new liquidation incentive. |
setLiquidateBorrowAllowed
function setLiquidateBorrowAllowed(
contract IHToken bond,
bool state
) external
Updates the state of the permission accessed by the hToken before a liquidate borrow.
Emits a {SetLiquidateBorrowAllowed} event.
Requirements:
- The caller must be the owner.
- The bond must be listed.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The hToken contract to update the permission for. |
state | bool | The new state to put in storage. |
setMaxBonds
function setMaxBonds(
uint256 newMaxBonds
) external
Sets max bonds value, which controls how many bond markets a single account can enter.
Emits a {SetMaxBonds} event.
Requirements:
- The caller must be the owner.
Parameters
Name | Type | Description |
---|---|---|
newMaxBonds | uint256 | New max bonds value. |
setMaxCollaterals
function setMaxCollaterals(
uint256 newMaxCollaterals
) external
Sets max collaterals value, which controls how many collaterals a single account can deposit.
Emits a {SetMaxCollaterals} event.
Requirements:
- The caller must be the owner.
Parameters
Name | Type | Description |
---|---|---|
newMaxCollaterals | uint256 | New max collaterals value. |
setRepayBorrowAllowed
function setRepayBorrowAllowed(
contract IHToken bond,
bool state
) external
Updates the state of the permission accessed by the hToken before a repay borrow.
Emits a {SetRepayBorrowAllowed} event.
Requirements:
- The caller must be the owner.
- The bond must be listed.
Parameters
Name | Type | Description |
---|---|---|
bond | contract IHToken | The hToken contract to update the permission for. |
state | bool | The new state to put in storage. |
Events
ListBond
event ListBond(
address owner,
contract IHToken bond
)
Emitted when a new bond is listed.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
bond | contract IHToken | The newly listed bond. |
ListCollateral
event ListCollateral(
address owner,
contract IErc20 collateral
)
Emitted when a new collateral is listed.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
collateral | contract IErc20 | The newly listed collateral. |
SetBorrowAllowed
event SetBorrowAllowed(
address owner,
contract IHToken bond,
bool state
)
Emitted when the borrow permission is updated.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
bond | contract IHToken | The related HToken. |
state | bool | True if borrowing is allowed. |
SetCollateralCeiling
event SetCollateralCeiling(
address owner,
contract IErc20 collateral,
uint256 oldCollateralCeiling,
uint256 newCollateralCeiling
)
Emitted when the collateral ceiling is updated.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
collateral | contract IErc20 | The related collateral. |
oldCollateralCeiling | uint256 | The old collateral ceiling. |
newCollateralCeiling | uint256 | The new collateral ceiling. |
SetCollateralRatio
event SetCollateralRatio(
address owner,
contract IErc20 collateral,
uint256 oldCollateralRatio,
uint256 newCollateralRatio
)
Emitted when the collateral ratio is updated.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
collateral | contract IErc20 | The related HToken. |
oldCollateralRatio | uint256 | The old collateral ratio. |
newCollateralRatio | uint256 | the new collateral ratio. |
SetDebtCeiling
event SetDebtCeiling(
address owner,
contract IHToken bond,
uint256 oldDebtCeiling,
uint256 newDebtCeiling
)
Emitted when the debt ceiling for a bond is updated.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
bond | contract IHToken | The related HToken. |
oldDebtCeiling | uint256 | The old debt ceiling. |
newDebtCeiling | uint256 | The new debt ceiling. |
SetDepositCollateralAllowed
event SetDepositCollateralAllowed(
address owner,
contract IErc20 collateral,
bool state
)
Emitted when the deposit collateral permission is updated.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
collateral | contract IErc20 | |
state | bool | True if depositing collateral is allowed. |
SetDepositUnderlyingAllowed
event SetDepositUnderlyingAllowed(
address owner,
contract IHToken bond,
bool state
)
Emitted when the deposit underlying permission is set.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
bond | contract IHToken | The related HToken. |
state | bool | True if deposit underlying is allowed. |
SetLiquidateBorrowAllowed
event SetLiquidateBorrowAllowed(
address owner,
contract IHToken bond,
bool state
)
Emitted when the liquidate borrow permission is updated.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
bond | contract IHToken | The related HToken. |
state | bool | True if liquidating borrow is allowed. |
SetLiquidationIncentive
event SetLiquidationIncentive(
address owner,
contract IErc20 collateral,
uint256 oldLiquidationIncentive,
uint256 newLiquidationIncentive
)
Emitted when the collateral liquidation incentive is set.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
collateral | contract IErc20 | The related collateral. |
oldLiquidationIncentive | uint256 | The old liquidation incentive. |
newLiquidationIncentive | uint256 | The new liquidation incentive. |
SetMaxBonds
event SetMaxBonds(
address owner,
uint256 oldMaxBonds,
uint256 newMaxBonds
)
Emitted when a new max bonds value is set.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address indexed owner. |
oldMaxBonds | uint256 | The old max bonds value. |
newMaxBonds | uint256 | The new max bonds value. |
SetMaxCollaterals
event SetMaxCollaterals(
address owner,
uint256 oldMaxCollaterals,
uint256 newMaxCollaterals
)
Emitted when a new max collaterals value is set.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address indexed owner. |
oldMaxCollaterals | uint256 | The old max collaterals value. |
newMaxCollaterals | uint256 | The new max collaterals value. |
SetRepayBorrowAllowed
event SetRepayBorrowAllowed(
address owner,
contract IHToken bond,
bool state
)
Emitted when the repay borrow permission is updated.
Parameters
Name | Type | Description |
---|---|---|
owner | address | The address of the contract owner. |
bond | contract IHToken | The related HToken. |
state | bool | True if repaying borrow is allowed. |
Custom Errors
Fintroller__BondNotListed
error Fintroller__BondNotListed(contract IHToken bond)
Emitted when interacting with a bond that is not listed.
Fintroller__BondBorrowAllowedWithLiquidateBorrowDisallowed
error Fintroller__BondBorrowAllowedWithLiquidateBorrowDisallowed()
Emitted when allowing borrow for a bond when liquidate borrow is disallowed.
Fintroller__BondLiquidateBorrowAllowedWithRepayBorrowDisallowed
error Fintroller__BondLiquidateBorrowAllowedWithRepayBorrowDisallowed()
Emitted when allowing liquidate borrow for a bond when repay borrow is disallowed.
Fintroller__BondLiquidateBorrowDisallowedWithBorrowAllowed
error Fintroller__BondLiquidateBorrowDisallowedWithBorrowAllowed()
Emitted when disallowing liquidate borrow for a bond when borrow is allowed.
Fintroller__BondRepayBorrowDisallowedWithLiquidateBorrowAllowed
error Fintroller__BondRepayBorrowDisallowedWithLiquidateBorrowAllowed()
Emitted when disallowing repay borrow for a bond when liquidate borrow is allowed.
Fintroller__CollateralDecimalsOverflow
error Fintroller__CollateralDecimalsOverflow(uint256 decimals)
Emitted when listing a collateral that has more than 18 decimals.
Fintroller__CollateralDecimalsZero
error Fintroller__CollateralDecimalsZero()
Emitted when listing a collateral that has zero decimals.
Fintroller__CollateralNotListed
error Fintroller__CollateralNotListed(contract IErc20 collateral)
Emitted when interacting with a collateral that is not listed.
Fintroller__CollateralRatioBelowLiquidationIncentive
error Fintroller__CollateralRatioBelowLiquidationIncentive(uint256 newCollateralRatio)
Emitted when setting a new collateral ratio that is below the liquidation incentive
Fintroller__CollateralRatioOverflow
error Fintroller__CollateralRatioOverflow(uint256 newCollateralRatio)
Emitted when setting a new collateral ratio that is above the upper bound.
Fintroller__CollateralRatioUnderflow
error Fintroller__CollateralRatioUnderflow(uint256 newCollateralRatio)
Emitted when setting a new collateral ratio that is below the lower bound.
Fintroller__DebtCeilingUnderflow
error Fintroller__DebtCeilingUnderflow(uint256 newDebtCeiling, uint256 totalSupply)
Emitted when setting a new debt ceiling that is below the total supply of hTokens.
Fintroller__LiquidationIncentiveAboveCollateralRatio
error Fintroller__LiquidationIncentiveAboveCollateralRatio(uint256 newLiquidationIncentive)
Emitted when setting a new liquidation incentive that is higher than the collateral ratio.
Fintroller__LiquidationIncentiveOverflow
error Fintroller__LiquidationIncentiveOverflow(uint256 newLiquidationIncentive)
Emitted when setting a new liquidation incentive that is above the upper bound.
Fintroller__LiquidationIncentiveUnderflow
error Fintroller__LiquidationIncentiveUnderflow(uint256 newLiquidationIncentive)
Emitted when setting a new liquidation incentive that is below the lower bound.