ILoanConfigManager

Git Source

Inherits: ILoanManagerBase

Author: bull.haus

Manages all loan configurations.

Functions

createLoanConfig

Create loan configuration.

When collateral.interest is an empty array, collateral.acceptedInterest == collateral.acceptedCollateral.

Setting config.config.maxTotal to UINT_MAX disables maxTotal checks.

function createLoanConfig(LoanConfigUser calldata config, LoanConfigAssetUsage calldata assetUsage) external;

Parameters

NameTypeDescription
configLoanConfigUserloan configuration
assetUsageLoanConfigAssetUsageaccepted assets and their usage in the loan

deleteLoanConfig

Delete loan configuration.

Loan configurations can only be deleted when there are no open loans using this configuration.

function deleteLoanConfig(uint256 configId) external;

Parameters

NameTypeDescription
configIduint256configuration id of loan config to delete

updateLoanConfigEnabledStatus

Enable / disable loan configuration.

Loans can only be created for enabled loan configurations.

function updateLoanConfigEnabledStatus(uint256 configId, bool enabled) external;

Parameters

NameTypeDescription
configIduint256configuration id of loan config to enable / disable
enabledbooltrue to enable, false to disable

Events

LoanConfigCreated

Emitted when a loan configuration has been created.

event LoanConfigCreated(
    uint256 indexed configId, address indexed lender, uint256 indexed assetId, uint256 interestPromille, uint256 terms
);

LoanConfigDeleted

Emitted when a loan configuration has been deleted.

event LoanConfigDeleted(uint256 indexed configId);

LoanConfigEnabledStatusUpdated

Emitted when a loan configuration has been enabled / disabled.

event LoanConfigEnabledStatusUpdated(uint256 indexed configId, bool indexed enabled);

Errors

LoanConfigInUse

Deleting a loan config which has open loans, reverts with ConfigInUse.

error LoanConfigInUse();

InsufficientFunds

Creating loan configs with higher limits than currently in the lender's deposit reverts with InsufficientFunds.

error InsufficientFunds();

InvalidConfig

Creating loan configs with invalid configurations reverts with InvalidConfig.

See method's documentation for the meaning of each possible check value.

error InvalidConfig(uint256 check);

MaxConfigsReached

Creating more loan configs per asset than limits allow, reverts with MaxConfigsReached.

error MaxConfigsReached();