Submit Loan Request

In order to submit a new loan request, a borrower can call the function submitBid() on the TellerV2 contract.

The submitBid() function consists of multiple parameters:

  • Principal: The amount of tokens to borrow

  • Lending token address: The contract address of the token to borrow

  • Pool id: The unique pool identifier, where the loan will be created. Each pool has different parameters which can be found here: Pool Settings.

  • Loan Duration: The number of seconds for which the loan will be active. Must be greater than the market payment cycle duration.

  • Interest Rate (APR): The interest rate requested for this loan

  • Receiver Address: The public address of the account that will receive the borrowed funds when this loan request is accepted by a lender

/**
 * @notice Function for a borrower to create a bid for a loan.
 * @param _lendingToken The lending token asset requested to be borrowed.
 * @param _principal The principal amount of the loan bid.
 * @param _duration The length of time, in seconds, the loan will remain active.
 * @param _APY The proposed interest rate for the loan bid.
 * @param _paymentCycle The recurrent length of time before which a payment is due.
 * @param _metadataURI The URI for additional borrower loan information as part of loan bid.
 */
function submitBid(
    address _lendingToken,
    uint256 _marketplaceId,
    uint256 _principal,
    uint32 _duration,
    uint16 _APY,
    uint32 _paymentCycle,
    bytes32 _metadataURI,
    address _receiver
)

When a new loan request (a 'bid') is submitted by a borrower using the Teller V2 Protocol, a lender can then review and manually accept the bid. Once this occurs, the principal funds are moved from the lender's wallet to the borrower's wallet and the collateral is moved from the borrower's wallet to the collateral escrow contract until the finalization of the loan repayment.

An alternate submitBid function exists, which additionally accepts an array of Collateral Data. The collateral are the assets that will be transferred from the borrower's wallet and then held in escrow until the finalization of the loan.

 /**
 * @notice Function for a borrower to create a bid for a loan with Collateral.
 * @param _lendingToken The lending token asset requested to be borrowed.
 * @param _marketplaceId The unique id of the marketplace for the bid.
 * @param _principal The principal amount of the loan bid.
 * @param _duration The recurrent length of time before which a payment is due.
 * @param _APR The proposed interest rate for the loan bid.
 * @param _metadataURI The URI for additional borrower loan information as part of loan bid.
 * @param _receiver The address where the loan amount will be sent to.
 * @param _collateralInfo Additional information about the collateral asset.
 */
function submitBid(
    address _lendingToken,
    uint256 _marketplaceId,
    uint256 _principal,
    uint32 _duration,
    uint16 _APR,
    string calldata _metadataURI,
    address _receiver,
    Collateral[] calldata _collateralInfo
) public override whenNotPaused returns (uint256 bidId_)

Submitted bids each have a unique id. The market parameter bidExpirationTime is an expiration time that begins when a bid is submitted and after which point a bid can no longer be accepted by a lender. Borrowers who wish to cancel their bid request prior to the expiration time can so it by calling the function cancelBid().

/**
 * @notice Function for users to cancel a bid.
 * @param _bidId The id of the bid to be cancelled.
 */
function cancelBid(uint256 _bidId)

Last updated