Skip to main content

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

NameTypeDescription
bondcontract IHTokenThe address of the bond contract.

Return Values

NameTypeDescription
[0]struct IFintroller.BondThe 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

NameTypeDescription
bondcontract IHTokenThe bond to make the check against.

Return Values

NameTypeDescription
[0]boolbool 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

NameTypeDescription
collateralcontract IErc20The address of the collateral contract.

Return Values

NameTypeDescription
[0]struct IFintroller.CollateralThe 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

NameTypeDescription
collateralcontract IErc20The address of the collateral contract.

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
collateralcontract IErc20The address of the collateral contract.

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
bondcontract IHTokenThe address of the bond contract.

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
collateralcontract IErc20The collateral to make the check against.

Return Values

NameTypeDescription
[0]boolbool 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

NameTypeDescription
bondcontract IHTokenThe bond to make the check against.

Return Values

NameTypeDescription
[0]boolbool 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

NameTypeDescription
collateralcontract IErc20The address of the collateral contract.

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
bondcontract IHTokenThe bond to make the check against.

Return Values

NameTypeDescription
[0]boolbool 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

NameTypeDescription
bondcontract IHTokenThe bond to make the check against.

Return Values

NameTypeDescription
[0]boolbool true = allowed, false = not allowed.

isBondListed

function isBondListed(
contract IHToken bond
) external returns (bool)

Checks if the bond is listed.

Parameters

NameTypeDescription
bondcontract IHTokenThe bond to make the check against.

Return Values

NameTypeDescription
[0]boolbool true = listed, otherwise not.

isCollateralListed

function isCollateralListed(
contract IErc20 collateral
) external returns (bool)

Checks if the collateral is listed.

Parameters

NameTypeDescription
collateralcontract IErc20The collateral to make the check against.

Return Values

NameTypeDescription
[0]boolbool 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

NameTypeDescription
bondcontract IHTokenThe 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

NameTypeDescription
collateralcontract IErc20The 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

NameTypeDescription
bondcontract IHTokenThe bond to update the permission for.
stateboolThe 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

NameTypeDescription
collateralcontract IHTokenThe collateral to update the ceiling for.
newCollateralCeilinguint256The 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

NameTypeDescription
collateralcontract IErc20The collateral to update the collateral ratio for.
newCollateralRatiouint256The 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

NameTypeDescription
bondcontract IHTokenThe bond to update the debt ceiling for.
newDebtCeilinguint256The 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

NameTypeDescription
collateralcontract IErc20The collateral to update the permission for.
stateboolThe 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

NameTypeDescription
bondcontract IHTokenThe bond to update the permission for.
stateboolThe 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

NameTypeDescription
collateralcontract IErc20The collateral to update the liquidation incentive for.
newLiquidationIncentiveuint256The 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

NameTypeDescription
bondcontract IHTokenThe hToken contract to update the permission for.
stateboolThe 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

NameTypeDescription
newMaxBondsuint256New 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

NameTypeDescription
newMaxCollateralsuint256New 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

NameTypeDescription
bondcontract IHTokenThe hToken contract to update the permission for.
stateboolThe new state to put in storage.

Events

ListBond

event ListBond(
address owner,
contract IHToken bond
)

Emitted when a new bond is listed.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
bondcontract IHTokenThe newly listed bond.

ListCollateral

event ListCollateral(
address owner,
contract IErc20 collateral
)

Emitted when a new collateral is listed.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
collateralcontract IErc20The newly listed collateral.

SetBorrowAllowed

event SetBorrowAllowed(
address owner,
contract IHToken bond,
bool state
)

Emitted when the borrow permission is updated.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
bondcontract IHTokenThe related HToken.
stateboolTrue if borrowing is allowed.

SetCollateralCeiling

event SetCollateralCeiling(
address owner,
contract IErc20 collateral,
uint256 oldCollateralCeiling,
uint256 newCollateralCeiling
)

Emitted when the collateral ceiling is updated.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
collateralcontract IErc20The related collateral.
oldCollateralCeilinguint256The old collateral ceiling.
newCollateralCeilinguint256The new collateral ceiling.

SetCollateralRatio

event SetCollateralRatio(
address owner,
contract IErc20 collateral,
uint256 oldCollateralRatio,
uint256 newCollateralRatio
)

Emitted when the collateral ratio is updated.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
collateralcontract IErc20The related HToken.
oldCollateralRatiouint256The old collateral ratio.
newCollateralRatiouint256the 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

NameTypeDescription
owneraddressThe address of the contract owner.
bondcontract IHTokenThe related HToken.
oldDebtCeilinguint256The old debt ceiling.
newDebtCeilinguint256The new debt ceiling.

SetDepositCollateralAllowed

event SetDepositCollateralAllowed(
address owner,
contract IErc20 collateral,
bool state
)

Emitted when the deposit collateral permission is updated.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
collateralcontract IErc20
stateboolTrue if depositing collateral is allowed.

SetDepositUnderlyingAllowed

event SetDepositUnderlyingAllowed(
address owner,
contract IHToken bond,
bool state
)

Emitted when the deposit underlying permission is set.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
bondcontract IHTokenThe related HToken.
stateboolTrue if deposit underlying is allowed.

SetLiquidateBorrowAllowed

event SetLiquidateBorrowAllowed(
address owner,
contract IHToken bond,
bool state
)

Emitted when the liquidate borrow permission is updated.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
bondcontract IHTokenThe related HToken.
stateboolTrue 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

NameTypeDescription
owneraddressThe address of the contract owner.
collateralcontract IErc20The related collateral.
oldLiquidationIncentiveuint256The old liquidation incentive.
newLiquidationIncentiveuint256The new liquidation incentive.

SetMaxBonds

event SetMaxBonds(
address owner,
uint256 oldMaxBonds,
uint256 newMaxBonds
)

Emitted when a new max bonds value is set.

Parameters

NameTypeDescription
owneraddressThe address indexed owner.
oldMaxBondsuint256The old max bonds value.
newMaxBondsuint256The new max bonds value.

SetMaxCollaterals

event SetMaxCollaterals(
address owner,
uint256 oldMaxCollaterals,
uint256 newMaxCollaterals
)

Emitted when a new max collaterals value is set.

Parameters

NameTypeDescription
owneraddressThe address indexed owner.
oldMaxCollateralsuint256The old max collaterals value.
newMaxCollateralsuint256The new max collaterals value.

SetRepayBorrowAllowed

event SetRepayBorrowAllowed(
address owner,
contract IHToken bond,
bool state
)

Emitted when the repay borrow permission is updated.

Parameters

NameTypeDescription
owneraddressThe address of the contract owner.
bondcontract IHTokenThe related HToken.
stateboolTrue 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.