You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function addLiquidity(address_onBehalfOf, uint128_sendAmount, uint256_deadline, uint256_referralCode) external nonpayable
Function which adds to an LPs current position
This function will update loanIdxsWhereSharesChanged only if not the first add. If address on behalf of is not sender, then sender must have permission.
Parameters
Name
Type
Description
_onBehalfOf
address
Recipient of the LP shares
_sendAmount
uint128
Amount of loan currency LP wishes to deposit
_deadline
uint256
Last timestamp after which function will revert
_referralCode
uint256
Will possibly be used later to reward referrals
borrow
function borrow(address_onBehalf, uint128_sendAmount, uint128_minLoanLimit, uint128_maxRepayLimit, uint256_deadline, uint256_referralCode) external nonpayable
Parameters
Name
Type
Description
_onBehalf
address
undefined
_sendAmount
uint128
undefined
_minLoanLimit
uint128
undefined
_maxRepayLimit
uint128
undefined
_deadline
uint256
undefined
_referralCode
uint256
undefined
claim
function claim(address_onBehalfOf, uint256[] _loanIdxs, bool_isReinvested, uint256_deadline) external nonpayable
Function which handles individual claiming by LPs
This function is more expensive, but needs to be used when LP changes position size in the middle of smallest aggregation block or if LP wants to claim some of the loans before the expiry time of the last loan in the aggregation block. _loanIdxs must be increasing array. If address on behalf of is not sender, then sender must have permission to claim. As well if reinvestment ootion is chosen, sender must have permission to add liquidity
Parameters
Name
Type
Description
_onBehalfOf
address
LP address which is owner or has approved sender to claim on their behalf (and possibly reinvest)
_loanIdxs
uint256[]
Loan indices on which LP wants to claim
_isReinvested
bool
Flag for if LP wants claimed loanCcy to be re-invested
_deadline
uint256
Deadline if reinvestment occurs. (If no reinvestment, this is ignored)
claimCreator
function claimCreator() external nonpayable
Function to claim proposed creator role
claimFromAggregated
function claimFromAggregated(address_onBehalfOf, uint256[] _aggIdxs, bool_isReinvested, uint256_deadline) external nonpayable
Function which handles aggregate claiming by LPs
This function is much more efficient, but can only be used when LPs position size did not change over the entire interval LP would like to claim over. _aggIdxs must be increasing array. the first index of _aggIdxs is the from loan index to start aggregation, the rest of the indices are the end loan indexes of the intervals he wants to claim. If address on behalf of is not sender, then sender must have permission to claim. As well if reinvestment option is chosen, sender must have permission to add liquidity
Parameters
Name
Type
Description
_onBehalfOf
address
LP address which is owner or has approved sender to claim on their behalf (and possibly reinvest)
_aggIdxs
uint256[]
From index and end indices of the aggregation that LP wants to claim
_isReinvested
bool
Flag for if LP wants claimed loanCcy to be re-invested
_deadline
uint256
Deadline if reinvestment occurs. (If no reinvestment, this is ignored)
getClaimsFromAggregated
function getClaimsFromAggregated(uint256_fromLoanIdx, uint256_toLoanIdx, uint256_shares) externalviewreturns (uint256repayments, uint256collateral)
Function which returns claims for a given aggregated from and to index and amount of sharesOverTime
This function is called internally, but also can be used by other protocols so has some checks which are unnecessary if it was solely an internal function
Parameters
Name
Type
Description
_fromLoanIdx
uint256
Loan index on which he wants to start aggregate claim (must be mod 0 wrt 100)
_toLoanIdx
uint256
End loan index of the aggregation
_shares
uint256
Amount of sharesOverTime which the LP owned over this given aggregation period
Returns
Name
Type
Description
repayments
uint256
undefined
collateral
uint256
undefined
getLpInfo
function getLpInfo(address_lpAddr) externalviewreturns (uint32fromLoanIdx, uint32earliestRemove, uint32currSharePtr, uint256[] sharesOverTime, uint256[] loanIdxsWhereSharesChanged)
Function which gets all LP info
fromLoanIdx = 0 can be utilized for checking if someone had been an LP in the pool
Parameters
Name
Type
Description
_lpAddr
address
Address for which LP info is being retrieved
Returns
Name
Type
Description
fromLoanIdx
uint32
Lower bound loan idx (incl.) from which LP is entitled to claim
earliestRemove
uint32
Earliest timestamp from which LP is allowed to remove liquidity
currSharePtr
uint32
Current pointer for the shares over time array
sharesOverTime
uint256[]
Array with elements representing number of LP shares for their past and current positions
loanIdxsWhereSharesChanged
uint256[]
Array with elements representing upper loan idx bounds (excl.), where LP can claim
function getRateParams() externalviewreturns (uint256_liquidityBnd1, uint256_liquidityBnd2, uint256_r1, uint256_r2)
Function which returns rate parameters need for interest rate calculation
This function can be used to get parameters needed for interest rate calculations
Returns
Name
Type
Description
_liquidityBnd1
uint256
Amount of liquidity the pool needs to end the reciprocal (hyperbola) range and start "target" range
_liquidityBnd2
uint256
Amount of liquidity the pool needs to end the "target" range and start flat rate
_r1
uint256
Rate that is used at start of target range
_r2
uint256
Minimum rate at end of target range. This is minimum allowable rate
isApproved
function isApproved(address, address, enum IBasePool.ApprovalTypes) externalviewreturns (bool)
Function returns if owner or beneficiary has approved a sender address for a given type
Parameters
Name
Type
Description
_0
address
undefined
_1
address
undefined
_2
enum IBasePool.ApprovalTypes
undefined
Returns
Name
Type
Description
_0
bool
True if approved, false otherwise
loanIdxToBorrower
function loanIdxToBorrower(uint256) externalviewreturns (address)
Getter which returns the borrower for a given loan idx
Parameters
Name
Type
Description
_0
uint256
undefined
Returns
Name
Type
Description
_0
address
The borrower address
loanIdxToLoanInfo
function loanIdxToLoanInfo(uint256) externalviewreturns (uint128repayment, uint128collateral, uint128totalLpShares, uint32expiry, boolrepaid)
Parameters
Name
Type
Description
_0
uint256
undefined
Returns
Name
Type
Description
repayment
uint128
undefined
collateral
uint128
undefined
totalLpShares
uint128
undefined
expiry
uint32
undefined
repaid
bool
undefined
loanTerms
function loanTerms(uint128_inAmountAfterFees) externalviewreturns (uint128loanAmount, uint128repaymentAmount, uint128pledgeAmount, uint256_creatorFee, uint256_totalLiquidity)
Function which calculates loan terms
Parameters
Name
Type
Description
_inAmountAfterFees
uint128
Amount of collateral currency after fees are deducted
Returns
Name
Type
Description
loanAmount
uint128
Amount of loan currency to be trasnferred to the borrower
repaymentAmount
uint128
Amount of loan currency borrower must repay to reclaim collateral
pledgeAmount
uint128
Amount of collateral currency borrower retrieves upon repayment
_creatorFee
uint256
Amount of collateral currency to be transferred to treasury
_totalLiquidity
uint256
The total liquidity of the pool (pre-borrow) that is available for new loans
overrideSharePointer
function overrideSharePointer(uint256_newSharePointer) external nonpayable
Function will update the share pointer for the LP
This function will allow an LP to skip his pointer ahead but caution should be used since once an LP has updated their from index they lose all rights to any outstanding claims before that from index
Parameters
Name
Type
Description
_newSharePointer
uint256
New location of the LP's current share pointer
proposeNewCreator
function proposeNewCreator(addressnewAddr) external nonpayable
Parameters
Name
Type
Description
newAddr
address
undefined
removeLiquidity
function removeLiquidity(address_onBehalfOf, uint128numShares) external nonpayable
Parameters
Name
Type
Description
_onBehalfOf
address
undefined
numShares
uint128
undefined
repay
function repay(uint256_loanIdx, address_recipient, uint128_sendAmount) external nonpayable
Function which allows repayment of a loan
The sent amount of loan currency must be sufficient to account for any fees on transfer (if any)
Parameters
Name
Type
Description
_loanIdx
uint256
Index of the loan to be repaid
_recipient
address
Address that will receive the collateral transfer
_sendAmount
uint128
Amount of loan currency sent for repayment.
rollOver
function rollOver(uint256_loanIdx, uint128_minLoanLimit, uint128_maxRepayLimit, uint256_deadline, uint128_sendAmount) external nonpayable
Function which allows repayment of a loan and roll over into new loan
The old loan gets repaid and then a new loan with a new loan Id is taken out. No actual transfers are made other than the interest
Parameters
Name
Type
Description
_loanIdx
uint256
Index of the loan to be repaid
_minLoanLimit
uint128
Minimum amount of loan currency acceptable from new loan.
_maxRepayLimit
uint128
Maximum allowable loan currency amount borrower for new loan.
_deadline
uint256
Timestamp after which transaction will be void
_sendAmount
uint128
Amount of loan currency borrower needs to send to pay difference in repayment and loan amount
setApprovals
function setApprovals(address_approvee, uint256_packedApprovals) external nonpayable
Function which sets approval for another to perform a certain function on sender's behalf
Parameters
Name
Type
Description
_approvee
address
This address is being given approval for the action(s) by the current sender
_packedApprovals
uint256
Packed boolean flags to set which actions are approved or not approved, where e.g. "00001" refers to ApprovalTypes.Repay (=0) and "10000" to ApprovalTypes.Claim (=4)