ILoanConfigManager
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
Name | Type | Description |
---|---|---|
config | LoanConfigUser | loan configuration |
assetUsage | LoanConfigAssetUsage | accepted 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
Name | Type | Description |
---|---|---|
configId | uint256 | configuration 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
Name | Type | Description |
---|---|---|
configId | uint256 | configuration id of loan config to enable / disable |
enabled | bool | true 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();