IRevolvingCreditLine

Methods

borrow

function borrow(address to, uint256 amount) external nonpayable

To borrow funds from the pool against the order book, the to address has to have a borrowed role. It is not possible to borrow after the current loan maturity has passed.

TickBorrowed event is declared in BorrowerLogic library

Parameters

cancelTimelock

function cancelTimelock() external nonpayable

Cancel a timelock emits a {TimelockCancelled} event

deposit

function deposit(uint256 rate, uint256 amount, address to) external nonpayable returns (uint256 positionId)

Deposit funds to the target rate tick

Parameters

Returns

detach

function detach(uint256 positionId) external nonpayable

Withdrawn the unborrowed part of a borrowed position

Parameters

executeTimelock

function executeTimelock() external nonpayable

Execute a ready timelock emits a {TimelockExecuted} event

exit

function exit(uint256 positionId, uint256 borrowedAmountToExit) external nonpayable

Exit a position from the current loan

Will reallocate the borrowed part of the position as well as realized accrualas, and withdraw the unborrowed part of the positionborrowedAmountToExit set to type(uint256).max means a full exitpartial exits are only possible for fully matched positionsfull exits will burn the position and need pool approval to transfer itExitedAmountRedistributedInTick event is declared in LenderLogic library

Parameters

getCurrentAccruals

function getCurrentAccruals() external nonpayable returns (uint256 currentAccruals)

Retrieves the current accruals of the ongoing loan

Returns

getEpoch

function getEpoch(uint256 rate, uint256 epochId) external view returns (uint256 deposited, uint256 borrowed, uint256 accruals, uint256 loanId, bool isBaseEpoch, uint256 precedingLoanId, uint256 positionsCount)

Gets the target epoch data

Parameters

Returns

getLoanDuration

function getLoanDuration() external view returns (uint256 loanDuration)

Retrieve the pool loan duration

Returns

getMaturity

function getMaturity() external view returns (uint256 maturity)

Retrieve the current maturity

Returns

getPosition

function getPosition(uint256 positionId) external view returns (address owner, uint256 rate, uint256 depositedAmount, enum PositionStatus status)

Retrieve the general high level information of a position

Parameters

Returns

getPositionCurrentValue

function getPositionCurrentValue(uint256 positionId) external view returns (uint256 positionCurrentValue)

Retrieve the current overall value of the position, including both borrowed and unborrowed amounts

Parameters

Returns

getPositionRepartition

function getPositionRepartition(uint256 positionId) external view returns (uint256 unborrowedAmount, uint256 borrowedAmount)

Retrieve the repartition between borrowed amount and unborrowed amount of the position

Parameters

Returns

getTimelock

function getTimelock() external view returns (struct PoolTimelock timelock)

Retrieve the current timelock

Returns

optOut

function optOut(uint256 positionId) external nonpayable

Opt out a borrowed position from a loan and remove it from the borrowable funds

Parameters

repay

function repay() external nonpayable

Repay borrowed funds with interest to the pool emits a {Repaid} event and one {TickRepaid} event per repayed tick

TickRepaid event is declared in BorrowerLogic library

setFeesController

function setFeesController(contract IFeesController feesController) external nonpayable

Set the fees controller contract address

Parameters

setMaxBorrowableAmount

function setMaxBorrowableAmount(uint256 maxBorrowableAmount) external nonpayable

Update the maximum borrowable amount

Parameters

setMinDepositAmount

function setMinDepositAmount(uint256 minDepositAmount) external nonpayable

Update the minimum deposit amount

Parameters

setPositionDescriptor

function setPositionDescriptor(contract IPositionDescriptor positionDescriptor) external nonpayable

Set the position descriptor contract address

Parameters

setRolloverPeriod

function setRolloverPeriod(uint256 rolloverPeriod) external nonpayable

Update the loan finalization period

Parameters

startNonStandardRepaymentProcedure

function startNonStandardRepaymentProcedure(contract INonStandardRepaymentModule nonStandardRepaymentModule, uint256 delay) external nonpayable

Starts a non-standard repayment procedure by initiating a timelock for - Stops all native actions possible in the pool - Sends the unborrowed funds to the non standard repayment procedure contract - Initializes the non standard repayment procedure contract

Parameters

startRescueProcedure

function startRescueProcedure(address recipient, uint256 delay) external nonpayable

Start a rescue procedure by initiating a timelock for - Stops all native actions possible in the pool - Sends the unborrowed funds to a recipient address

Parameters

togglePool

function togglePool() external nonpayable

Closes and Opens the pool If the pool is OPEN, changes the pool phase to CLOSED, stops all actions in the pool If the pool is CLOSED, changes the pool phase to OPEN, opens up all actions in the pool again Emits a {Open} or {Closed} event

updateRate

function updateRate(uint256 positionId, uint256 newRate) external nonpayable

Update the rate of a position

Parameters

withdraw

function withdraw(uint256 positionId, uint256 amountToWithdraw) external nonpayable

Withdraw funds from the order book

amountToWithdraw set to type(uint256).max means a full withdrawamountToWithdraw must be set between 0 and positionCurrentValuefull withdrawals need the pool approval to transfer the positiona successful full withdraw will burn the position

Parameters

withdrawFees

function withdrawFees() external nonpayable

Withdraw fees to the fees controller emits a {FeesWithdrawn} event

Events

Borrowed

event Borrowed(uint256 borrowedAmount, uint256 fees, address to)

Emitted during a borow

Parameters

Closed

event Closed()

Emitted when the pool is closed

Deposited

event Deposited(uint256 indexed positionId, address to, uint256 amount, uint256 rate, uint256 epochId)

Emitted when a deposit is made on the pool

Parameters

Detached

event Detached(uint256 indexed positionId, uint256 receivedAmount, uint256 withdrawalFees)

Emitted when the unborrowed part of a borrowed position is detached

Parameters

Exited

event Exited(uint256 indexed positionId, bool isFullyExited, uint256 unborrowedAmount, uint256 borrowedAmountToExit, uint256 receivedAmount, uint256 exitFees)

Emitted when a position is fully exited

Parameters

FeesControllerSet

event FeesControllerSet(address feesController)

Emitted when the fees controller is set

Parameters

FeesWithdrawn

event FeesWithdrawn(uint256 fees)

Emitted when fees are withdrawn to the fees controller

Parameters

MaxBorrowableAmountSet

event MaxBorrowableAmountSet(uint256 maxBorrowableAmount)

Emitted when the maximum borrowable amount has been set

Parameters

MinDepositAmountSet

event MinDepositAmountSet(uint256 minDepositAmount)

Emitted when the minimum deposit amount has been set

Parameters

NonStandardRepaymentProcedureStarted

event NonStandardRepaymentProcedureStarted(address nonStandardRepaymentModule, uint256 delay)

Emitted when a non-standard repayment procedure has started

Parameters

Opened

event Opened()

Emitted when the pool is opened

OptedOut

event OptedOut(uint256 indexed positionId, uint256 loanId)

Emitted when a borrowed position is signalling its intention to not be a part of the next loan

Parameters

PositionDescriptorSet

event PositionDescriptorSet(address positionDescriptor)

Emitted when the position descriptor is set

Parameters

RateUpdated

event RateUpdated(uint256 indexed positionId, uint256 newRate, uint256 movedAmount)

Emitted when a position's rate is updated

Parameters

Repaid

event Repaid(uint256 repaidAmount, uint256 fees)

Emitted during a repayment

Parameters

RescueProcedureStarted

event RescueProcedureStarted(address recipient, uint256 delay)

Emitted when a rescue procedure has started

Parameters

RolloverPeriodSet

event RolloverPeriodSet(uint256 rolloverPeriod)

Emitted when the loan finalization period has been set

Parameters

TimelockCancelled

event TimelockCancelled()

Emitted when a timelock has been cancelled

TimelockExecuted

event TimelockExecuted(uint256 transferredAmount)

Emitted when a timelock has been executed

Parameters

Withdrawn

event Withdrawn(uint256 indexed positionId, uint256 amountToWithdraw, uint256 receivedAmount, uint256 withdrawalFees)

Emitted when a position is withdrawn

Parameters

Errors

TIMELOCK_ALREADY_EXECUTED

error TIMELOCK_ALREADY_EXECUTED()

Thrown when trying to interact with an already executed timelock

TIMELOCK_ALREADY_INITIATED

error TIMELOCK_ALREADY_INITIATED()

Thrown when trying to interact with an already initiated timelock

TIMELOCK_DELAY_TOO_SMALL

error TIMELOCK_DELAY_TOO_SMALL()

Thrown when the input delay for a timelock is too small

TIMELOCK_INEXISTANT

error TIMELOCK_INEXISTANT()

Thrown when trying to interact with inexistant timelock

TIMELOCK_NOT_READY

error TIMELOCK_NOT_READY()

Thrown when trying to interact with an already executed timelock

Last updated