Create Commitment

Lenders can pre-commit capital using specific collateralization requirements so that borrowers can instantly create loans using that capital without having to wait for the lender to manually accept.

Create a Loan Commitment

A new commitment will be created using the specified parameters. This commitment represents the lenders (msg sender) willingness to provide principal towards loans.

/**
* @notice Creates a loan commitment from a lender for a market.
* @param _commitment The new commitment data expressed as a struct
* @param _borrowerAddressList The array of borrowers that are allowed to accept loans using this commitment
* @return commitmentId_ returns the commitmentId for the created commitment
*/
function createCommitment(
   Commitment calldata _commitment,
   address[] calldata _borrowerAddressList
) public returns (uint256 commitmentId_) 

Commitment Data Structure

struct Commitment {
    uint256 maxPrincipal;
    uint32 expiration;
    uint32 maxDuration;
    uint16 minInterestRate;
    address collateralTokenAddress;
    uint256 collateralTokenId;
    uint256 maxPrincipalPerCollateralAmount;
    CommitmentCollateralType collateralTokenType;
    address lender;
    uint256 marketId;
    address principalTokenAddress;
}

maxPrincipal - The amount of capital to commit, specified in base units of the principal token.

principalTokenAddress - The contract address of the principal token currency

marketId - The id for the Teller lending market that this commitment may be used for

lender - The address of the lender (must be msg.sender when creating new commitments)

maxDuration - The duration for loans which are created using this commitment

minInterestRate - The interest rate for loans which are created using this commitment

expiration - The unix timestamp (seconds) after which time no new loans can be created using this commitment

collateralTokenAddress - The contract address of the collateral token

collateralTokenType - The type of collateral, specified by an Enum (see CommitmentCollateralType)

collateralTokenId - The tokenId of the collateral, used if the type is ERC721 or ERC1155

maxPrincipalPerCollateralAmount - The amount of principal that a loan is allowed to borrow per the collateral amount provided. This amount is expanded by both the principal token decimals and the collateral token decimals. Use the helper function in ‘Teller Math Lib’ to help compute this value.

Commitment Collateral Type

enum CommitmentCollateralType {
    NONE, 
    ERC20,
    ERC721,
    ERC1155,
    ERC721_ANY_ID,
    ERC1155_ANY_ID
}

NONE - This commitment requires no collateralization

ERC20 - The collateral is a standard ERC20 token

ERC721 - The collateral is a standard ERC712 token and a specific tokenId is required

ERC1155 - The collateral is a standard ERC 1155 token and a specific tokenId is required

ERC721_ANY_ID - The collateral is a standard ERC712 token and any tokenId can be used (tokenId is ignored)

ERC1155_ANY_ID - The collateral is a standard ERC1155 token and any tokenId can be used (tokenId is ignored)

Last updated