Search
⌃K

Extensions

Purpose

The Extensions.sol contract handles the logic necessary to request and vote on extensions. During the course of a loan, the borrower has the opportunity to for a single extension of the instalment deadline. Lenders in favour of the extension are required to vote in support for it, wherein their voting power is proportional to their balance of the pool tokens. While only one extension can be granted, the borrower can place a request multiple times during the loan period (of course, once an extension has been granted, further requests are rejected automatically).
Extensions for a given period need to be requested before the grace period of the interval in question ends. Lenders are also required to cast their vote before that deadline - thus, borrowers are expected to plan in advance if they wish to receive an extension.
Extensions can be requested by borrower in case they are unable to pay the interest for a period. If approved, borrower can skip the repayment for the period and repay it together with the next installment repayment. Only one extension can be availed in the lifecycle of a pool. Even if extension is rejected, as long as extension wasn't previously granted for pool, extension can be requested again.

Roles

Borrower

Assignment

  • by pool creation

Permissions

  • can place extension requests

Lender

Assignment

  • Having possession of the pool's tokens

Permissions

  • can vote on extensions

Functionality

Requesting an extension

Function

function requestExtension(address _pool)
external onlyBorrower(_pool) {

Approvals

  • None

Restrictions

  • an extension request must not be currently active (require(block.timestamp > _extensionVoteEndTime,)
  • extension must not have been granted before (require(extensions[_pool].periodWhenExtensionIsPassed == 0, )
  • msg.sender should be the borrower

Arguments

  • _pool: address of the pool for which extension is being requested

Vote on extension requests

Lenders of a particular pool vote on any extension requests by the borrower. Whether a user is a valid lender or not is checked by their balance of the relevant pool tokens. Votes are made only in support of the extension request - those who are against it are not required to vote.

Function

function voteOnExtension(address _pool) external {

Approvals

  • None

Restrictions

  • Voting period should be active
  • msg.sender must have pool token balance
  • msg.sender should not have voted for the current request before

Arguments

  • _pool: address of the pool for which msg.sender is voting

Granting extensions

This function is called internally by the voteOnExtension() function if the threshold for passing the extension request is reached.

Function

function grantExtension(address _pool) internal {

Approvals

  • None

Restrictions

  • Internal function, can only be called by voteOnExtension()

Arguments

  • _pool: address of the pool that is being granted an extension
Borrower can request for extension using
function requestExtension(address pool)
  • msg.sender: Borrower of the pool
  • pool: Pool address
Note: Extension can only be availed once in the lifecycle of a pool.