IRevolvingCreditLine
Methods
borrow
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
Name | Type | Description |
---|---|---|
to | address | Receiving address of the borrowed funds |
amount | uint256 | Amount of funds to borrow emits a {Borrowed} event and one {TickBorrowed} event per borrowed tick |
cancelTimelock
Cancel a timelock emits a {TimelockCancelled} event
deposit
Deposit funds to the target rate tick
Parameters
Name | Type | Description |
---|---|---|
rate | uint256 | Rate to which deposit funds |
amount | uint256 | Amount of funds to deposit |
to | address | Receiving address of the position |
Returns
Name | Type | Description |
---|---|---|
positionId | uint256 | ID of the newly minted position emits a {Deposited} event |
detach
Withdrawn the unborrowed part of a borrowed position
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | ID of the position emits a {Detached} event |
executeTimelock
Execute a ready timelock emits a {TimelockExecuted} event
exit
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
Name | Type | Description |
---|---|---|
positionId | uint256 | ID of the position |
borrowedAmountToExit | uint256 | Address of the fees controller emits an {Exited} event and one {ExitedAmountRedistributedInTick} event per recipient tick |
getCurrentAccruals
Retrieves the current accruals of the ongoing loan
Returns
Name | Type | Description |
---|---|---|
currentAccruals | uint256 | undefined |
getEpoch
Gets the target epoch data
Parameters
Name | Type | Description |
---|---|---|
rate | uint256 | Rate of the queried tick |
epochId | uint256 | ID of the queried epoch |
Returns
Name | Type | Description |
---|---|---|
deposited | uint256 | Amount of funds deposited into the epoch |
borrowed | uint256 | Amount of funds borrowed from the epoch |
accruals | uint256 | Accruals generated by the epoch |
loanId | uint256 | ID of the first loan of the epoch |
isBaseEpoch | bool | Boolean to signify whether the epoch is a base epoch or not |
precedingLoanId | uint256 | Id of the loan before that epoch loan |
positionsCount | uint256 | Number of positions in the epoch |
getLoanDuration
Retrieve the pool loan duration
Returns
Name | Type | Description |
---|---|---|
loanDuration | uint256 | The pool loan duration |
getMaturity
Retrieve the current maturity
Returns
Name | Type | Description |
---|---|---|
maturity | uint256 | The current maturity |
getPosition
Retrieve the general high level information of a position
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | ID of the position |
Returns
Name | Type | Description |
---|---|---|
owner | address | Owner of the position |
rate | uint256 | Rate of the position |
depositedAmount | uint256 | Base deposit of the position |
status | enum PositionStatus | Current status of the position |
getPositionCurrentValue
Retrieve the current overall value of the position, including both borrowed and unborrowed amounts
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | ID of the position |
Returns
Name | Type | Description |
---|---|---|
positionCurrentValue | uint256 | Current value of the position |
getPositionRepartition
Retrieve the repartition between borrowed amount and unborrowed amount of the position
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | ID of the position |
Returns
Name | Type | Description |
---|---|---|
unborrowedAmount | uint256 | Amount that is not currently borrowed, and can be withdrawn |
borrowedAmount | uint256 | Amount that is currently borrowed |
getTimelock
Retrieve the current timelock
Returns
Name | Type | Description |
---|---|---|
timelock | PoolTimelock | The current timelock, may be empty |
optOut
Opt out a borrowed position from a loan and remove it from the borrowable funds
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | The ID of the position emits an {OptedOut} event |
repay
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
Set the fees controller contract address
Parameters
Name | Type | Description |
---|---|---|
feesController | contract IFeesController | Address of the fees controller emits a {FeesControllerSet} event |
setMaxBorrowableAmount
Update the maximum borrowable amount
Parameters
Name | Type | Description |
---|---|---|
maxBorrowableAmount | uint256 | New value of the maximum borrowable amount emits a {MaxBorrowableAmountSet} event |
setMinDepositAmount
Update the minimum deposit amount
Parameters
Name | Type | Description |
---|---|---|
minDepositAmount | uint256 | New value of the minimum deposit amount emits a {MinDepositAmountSet} event |
setPositionDescriptor
Set the position descriptor contract address
Parameters
Name | Type | Description |
---|---|---|
positionDescriptor | contract IPositionDescriptor | Address of the position descriptor emits a {PositionDescriptorSet} event |
setRolloverPeriod
Update the loan finalization period
Parameters
Name | Type | Description |
---|---|---|
rolloverPeriod | uint256 | New value of the loan finalization period emits a {RolloverPeriodSet} event |
startNonStandardRepaymentProcedure
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
Name | Type | Description |
---|---|---|
nonStandardRepaymentModule | contract INonStandardRepaymentModule | Address of the non standard repayment module contract |
delay | uint256 | Timelock delay emits a {NonStandardRepaymentProcedureStarted} event |
startRescueProcedure
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
Name | Type | Description |
---|---|---|
recipient | address | Address to which the funds will be sent |
delay | uint256 | Timelock delay emits a {RescueProcedureStarted} event |
togglePool
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
Update the rate of a position
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | ID of the position |
newRate | uint256 | New rate of the position emits a {RateUpdated} event |
withdraw
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
Name | Type | Description |
---|---|---|
positionId | uint256 | ID of the position |
amountToWithdraw | uint256 | Address of the fees controller emits a {Withdrawn} event |
withdrawFees
Withdraw fees to the fees controller emits a {FeesWithdrawn} event
Events
Borrowed
Emitted during a borow
Parameters
Name | Type | Description |
---|---|---|
borrowedAmount | uint256 | undefined |
fees | uint256 | undefined |
to | address | undefined |
Closed
Emitted when the pool is closed
Deposited
Emitted when a deposit is made on the pool
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | undefined |
to | address | undefined |
amount | uint256 | undefined |
rate | uint256 | undefined |
epochId | uint256 | undefined |
Detached
Emitted when the unborrowed part of a borrowed position is detached
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | undefined |
receivedAmount | uint256 | undefined |
withdrawalFees | uint256 | undefined |
Exited
Emitted when a position is fully exited
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | undefined |
isFullyExited | bool | undefined |
unborrowedAmount | uint256 | undefined |
borrowedAmountToExit | uint256 | undefined |
receivedAmount | uint256 | undefined |
exitFees | uint256 | undefined |
FeesControllerSet
Emitted when the fees controller is set
Parameters
Name | Type | Description |
---|---|---|
feesController | address | undefined |
FeesWithdrawn
Emitted when fees are withdrawn to the fees controller
Parameters
Name | Type | Description |
---|---|---|
fees | uint256 | undefined |
MaxBorrowableAmountSet
Emitted when the maximum borrowable amount has been set
Parameters
Name | Type | Description |
---|---|---|
maxBorrowableAmount | uint256 | undefined |
MinDepositAmountSet
Emitted when the minimum deposit amount has been set
Parameters
Name | Type | Description |
---|---|---|
minDepositAmount | uint256 | undefined |
NonStandardRepaymentProcedureStarted
Emitted when a non-standard repayment procedure has started
Parameters
Name | Type | Description |
---|---|---|
nonStandardRepaymentModule | address | undefined |
delay | uint256 | undefined |
Opened
Emitted when the pool is opened
OptedOut
Emitted when a borrowed position is signalling its intention to not be a part of the next loan
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | undefined |
loanId | uint256 | undefined |
PositionDescriptorSet
Emitted when the position descriptor is set
Parameters
Name | Type | Description |
---|---|---|
positionDescriptor | address | undefined |
RateUpdated
Emitted when a position's rate is updated
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | undefined |
newRate | uint256 | undefined |
movedAmount | uint256 | undefined |
Repaid
Emitted during a repayment
Parameters
Name | Type | Description |
---|---|---|
repaidAmount | uint256 | undefined |
fees | uint256 | undefined |
RescueProcedureStarted
Emitted when a rescue procedure has started
Parameters
Name | Type | Description |
---|---|---|
recipient | address | undefined |
delay | uint256 | undefined |
RolloverPeriodSet
Emitted when the loan finalization period has been set
Parameters
Name | Type | Description |
---|---|---|
rolloverPeriod | uint256 | undefined |
TimelockCancelled
Emitted when a timelock has been cancelled
TimelockExecuted
Emitted when a timelock has been executed
Parameters
Name | Type | Description |
---|---|---|
transferredAmount | uint256 | undefined |
Withdrawn
Emitted when a position is withdrawn
Parameters
Name | Type | Description |
---|---|---|
positionId | uint256 | undefined |
amountToWithdraw | uint256 | undefined |
receivedAmount | uint256 | undefined |
withdrawalFees | uint256 | undefined |
Errors
TIMELOCK_ALREADY_EXECUTED
Thrown when trying to interact with an already executed timelock
TIMELOCK_ALREADY_INITIATED
Thrown when trying to interact with an already initiated timelock
TIMELOCK_DELAY_TOO_SMALL
Thrown when the input delay for a timelock is too small
TIMELOCK_INEXISTANT
Thrown when trying to interact with inexistant timelock
TIMELOCK_NOT_READY
Thrown when trying to interact with an already executed timelock
Last updated