Accept Commitment

Lenders can pre-commit capital for loans so that borrowers can initiate loans instantly with that capital without having to wait for the lender to review and accept the loan request.

Accept a Loan Commitment

Initiates a loan through the TellerV2 protocol as a borrower using the commitment specified by _commitmentId. The principal for the loan in the amount of _principalAmount will be transferred from the lender’s wallet through the TellerV2 contract and ultimately to the borrower’s wallet. If collateral is specified, then _collateralAmount will be transferred from the borrower’s wallet to CollateralEscrow for the loan until the finalization of the loan.

/**
 * @notice Accept the commitment to submitBid and acceptBid using the funds
 * @dev LoanDuration must be longer than the market payment cycle
 * @param _commitmentId The id of the commitment being accepted.
 * @param _principalAmount The amount of currency to borrow for the loan.
 * @param _collateralAmount The amount of collateral to use for the loan.
 * @param _collateralTokenId The tokenId of collateral to use for the loan if ERC721 or ERC1155.
 * @param _collateralTokenAddress The contract address to use for the loan collateral token.s
 * @param _interestRate The interest rate APY to use for the loan in basis points.
 * @param _loanDuration The overall duratiion for the loan.  Must be longer than market payment cycle duration.
 * @return bidId The ID of the loan that was created on TellerV2
 */
function acceptCommitment(
    uint256 _commitmentId,
    uint256 _principalAmount,
    uint256 _collateralAmount,
    uint256 _collateralTokenId,
    address _collateralTokenAddress,
    uint16 _interestRate, 
    uint32 _loanDuration
)

Prerequisites

  • Lender must approve principal token to the TellerV2 contract

  • Borrower must approve collateral token to the LenderCommitmentForwarder contract

  • Lender must call approveMarketForwarder for the LenderCommitmentForwarder contract

  • Borrower must call approveMarketForwarder for the LenderCommitmentForwarder contract

  • The market owner for the corresponding marketId must call setTrustedMarketForwarder for the LenderCommitmentForwarder contract

If the prerequisite conditions have not been met, the commitment will not be able to be accepted by the borrower.

Last updated