IPrimaryLendingPlatform
Overview
License: MIT
interface IPrimaryLendingPlatform
Structs info
Ratio
struct Ratio {
uint8 numerator;
uint8 denominator;
}
ProjectTokenInfo
struct ProjectTokenInfo {
bool isListed;
bool isDepositPaused;
bool isWithdrawPaused;
IPrimaryLendingPlatform.Ratio loanToValueRatio;
}
LendingTokenInfo
struct LendingTokenInfo {
bool isListed;
bool isPaused;
address bLendingToken;
}
DepositPosition
struct DepositPosition {
uint256 depositedProjectTokenAmount;
}
BorrowPosition
struct BorrowPosition {
uint256 loanBody;
uint256 accrual;
}
Functions info
grantRole (0x2f2ff15d)
function grantRole(bytes32 role, address newModerator) external
Grants the role to a new account.
Parameters:
role
bytes32
The role to grant.
newModerator
address
The address of the account receiving the role.
revokeRole (0xd547741f)
function revokeRole(bytes32 role, address moderator) external
Revokes the moderator role from an account.
Parameters:
role
bytes32
The role to revoke.
moderator
address
The address of the account losing the role.
setPrimaryLendingPlatformModeratorModerator (0xa0290239)
function setPrimaryLendingPlatformModeratorModerator(
address newModeratorContract
) external
Sets the address of the new moderator contract by the admin.
Parameters:
newModeratorContract
address
The address of the new moderator contract.
setPriceOracle (0x530e784f)
function setPriceOracle(address newPriceOracle) external
Sets the address of the new price oracle by the moderator contract.
Parameters:
newPriceOracle
address
The address of the new price oracle contract.
setPrimaryLendingPlatformLeverage (0xa1ab5419)
function setPrimaryLendingPlatformLeverage(
address newPrimaryLendingPlatformLeverage
) external
Sets the address of the new primary index token leverage contract by the moderator contract.
Parameters:
newPrimaryLendingPlatformLeverage
address
The address of the new primary index token leverage contract.
setRelatedContract (0xdcb4252a)
function setRelatedContract(address relatedContract, bool isRelated) external
Sets whether an address is a related contract or not by the moderator contract.
Parameters:
relatedContract
address
The address of the contract to be set as related.
isRelated
bool
Boolean to indicate whether the contract is related or not.
removeProjectToken (0x3af44bfa)
function removeProjectToken(
uint256 projectTokenId,
address projectToken
) external
Removes a project token from the list by the moderator contract.
Parameters:
projectTokenId
uint256
The ID of the project token to be removed.
projectToken
address
The address of the project token to be removed.
removeLendingToken (0xc1ab02ee)
function removeLendingToken(
uint256 lendingTokenId,
address lendingToken
) external
Removes a lending token from the list by the moderator contract.
Parameters:
lendingTokenId
uint256
The ID of the lending token to be removed.
lendingToken
address
The address of the lending token to be removed.
setBorrowLimitPerCollateralAsset (0x8e85cdfa)
function setBorrowLimitPerCollateralAsset(
address projectToken,
uint256 newBorrowLimit
) external
Sets the borrow limit per collateral by the moderator contract.
Parameters:
projectToken
address
The address of the project token.
newBorrowLimit
uint256
The new borrow limit.
setBorrowLimitPerLendingAsset (0x92a39190)
function setBorrowLimitPerLendingAsset(
address lendingToken,
uint256 newBorrowLimit
) external
Sets the borrow limit per lending asset by the moderator contract.
Parameters:
lendingToken
address
The address of the lending token.
newBorrowLimit
uint256
The new borrow limit.
setProjectTokenInfo (0x4a5333bc)
function setProjectTokenInfo(
address projectToken,
bool isDepositPaused,
bool isWithdrawPaused,
uint8 loanToValueRatioNumerator,
uint8 loanToValueRatioDenominator
) external
Sets the parameters for a project token
Parameters:
projectToken
address
The address of the project token
isDepositPaused
bool
The new pause status for deposit
isWithdrawPaused
bool
The new pause status for withdrawal
loanToValueRatioNumerator
uint8
The numerator of the loan-to-value ratio for the project token
loanToValueRatioDenominator
uint8
The denominator of the loan-to-value ratio for the project token
setLendingTokenInfo (0x821363a0)
function setLendingTokenInfo(
address lendingToken,
address bLendingToken,
bool isPaused,
uint8 loanToValueRatioNumerator,
uint8 loanToValueRatioDenominator
) external
Sets the bLendingToken and paused status of a lending token.
Parameters:
lendingToken
address
The address of the lending token.
bLendingToken
address
The address of the bLendingToken.
isPaused
bool
Boolean indicating whether the lending token is paused or unpaused.
loanToValueRatioNumerator
uint8
The numerator of the loan-to-value ratio for the lending token.
loanToValueRatioDenominator
uint8
The denominator of the loan-to-value ratio for the lending token.
deposit (0x47e7ef24)
function deposit(address projectToken, uint256 projectTokenAmount) external
Deposits project tokens and calculates the deposit position.
Parameters:
projectToken
address
The address of the project token to be deposited.
projectTokenAmount
uint256
The amount of project tokens to be deposited.
depositFromRelatedContracts (0xbf423b75)
function depositFromRelatedContracts(
address projectToken,
uint256 projectTokenAmount,
address user,
address beneficiary
) external
Deposits project tokens on behalf of a user from a related contract and calculates the deposit position.
Parameters:
projectToken
address
The address of the project token to be deposited.
projectTokenAmount
uint256
The amount of project tokens to be deposited.
user
address
The address of the user who representative deposit.
beneficiary
address
The address of the beneficiary whose deposit position will be updated.
calcAndTransferDepositPosition (0x556d4704)
function calcAndTransferDepositPosition(
address projectToken,
uint256 projectTokenAmount,
address user,
address receiver
) external returns (uint256)
Decreases the deposited project token amount of the user's deposit position by the given amount, transfers the given amount of project tokens to the receiver, and returns the amount transferred.
Parameters:
projectToken
address
The address of the project token being withdrawn
projectTokenAmount
uint256
The amount of project tokens being withdrawn
user
address
The address of the user whose deposit position is being updated
receiver
address
The address of the user receiving the withdrawn project tokens
Return values:
[0]
uint256
The amount of project tokens transferred to the receiver
calcDepositPosition (0xdf5e6bed)
function calcDepositPosition(
address projectToken,
uint256 projectTokenAmount,
address user
) external
Calculates the deposit position for a user's deposit of a given amount of a project token.
Parameters:
projectToken
address
The address of the project token being deposited
projectTokenAmount
uint256
The amount of project tokens being deposited
user
address
The address of the user making the deposit
withdraw (0xf3fef3a3)
function withdraw(address projectToken, uint256 projectTokenAmount) external
Allows a user to withdraw a given amount of a project token from their deposit position.
Parameters:
projectToken
address
The address of the project token being withdrawn
projectTokenAmount
uint256
The amount of project tokens being withdrawn
withdrawFromRelatedContracts (0x1132a65f)
function withdrawFromRelatedContracts(
address projectToken,
uint256 projectTokenAmount,
address user,
address beneficiary
) external returns (uint256)
Allows a related contract to initiate a withdrawal of a given amount of a project token from a user's deposit position.
Parameters:
projectToken
address
The address of the project token being withdrawn
projectTokenAmount
uint256
The amount of project tokens being withdrawn
user
address
The address of the user whose deposit position is being withdrawn from
beneficiary
address
The address of the user receiving the withdrawn project tokens
Return values:
[0]
uint256
amount of project tokens withdrawn and transferred to the beneficiary
withdraw (0x127b642e)
function withdraw(
address projectToken,
uint256 projectTokenAmount,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable
Allows a user to withdraw a given amount of a project token from their deposit position.
Parameters:
projectToken
address
The address of the project token being withdrawn
projectTokenAmount
uint256
The amount of project tokens being withdrawn
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
withdrawFromRelatedContracts (0x9afab2ec)
function withdrawFromRelatedContracts(
address projectToken,
uint256 projectTokenAmount,
address user,
address beneficiary,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256)
Allows a related contract to initiate a withdrawal of a given amount of a project token from a user's deposit position.
Parameters:
projectToken
address
The address of the project token being withdrawn
projectTokenAmount
uint256
The amount of project tokens being withdrawn
user
address
The address of the user whose deposit position is being withdrawn from
beneficiary
address
The address of the user receiving the withdrawn project tokens
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
[0]
uint256
amount of project tokens withdrawn and transferred to the beneficiary
borrow (0xf6c0b770)
function borrow(
address projectToken,
address lendingToken,
uint256 lendingTokenAmount,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable
Allows a user to borrow lending tokens by providing project tokens as collateral.
Parameters:
projectToken
address
The address of the project token being used as collateral.
lendingToken
address
The address of the lending token being borrowed.
lendingTokenAmount
uint256
The amount of lending tokens to be borrowed.
borrowFromRelatedContract (0x07f4a25c)
function borrowFromRelatedContract(
address projectToken,
address lendingToken,
uint256 lendingTokenAmount,
address user,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256 amount)
Allows a related contract to borrow lending tokens on behalf of a user by providing project tokens as collateral.
Parameters:
projectToken
address
The address of the project token being used as collateral.
lendingToken
address
The address of the lending token being borrowed.
lendingTokenAmount
uint256
The amount of lending tokens to be borrowed.
user
address
The address of the user on whose behalf the lending tokens are being borrowed.
Return values:
amount
uint256
of lending tokens borrowed
borrow (0x5224372c)
function borrow(
address projectToken,
address lendingToken,
uint256 lendingTokenAmount
) external
Allows a user to borrow lending tokens by providing project tokens as collateral.
Parameters:
projectToken
address
The address of the project token being used as collateral.
lendingToken
address
The address of the lending token being borrowed.
lendingTokenAmount
uint256
The amount of lending tokens to be borrowed.
borrowFromRelatedContract (0x284a211e)
function borrowFromRelatedContract(
address projectToken,
address lendingToken,
uint256 lendingTokenAmount,
address user
) external returns (uint256 amount)
Allows a related contract to borrow lending tokens on behalf of a user by providing project tokens as collateral.
Parameters:
projectToken
address
The address of the project token being used as collateral.
lendingToken
address
The address of the lending token being borrowed.
lendingTokenAmount
uint256
The amount of lending tokens to be borrowed.
user
address
The address of the user on whose behalf the lending tokens are being borrowed.
Return values:
amount
uint256
of lending tokens borrowed
getCollateralAvailableToWithdraw (0x72620613)
function getCollateralAvailableToWithdraw(
address account,
address projectToken,
address lendingToken
) external returns (uint256 collateralProjectToWithdraw)
Calculates the collateral available for withdrawal based on the loan-to-value ratio of a specific project token.
Parameters:
account
address
Address of the user.
projectToken
address
Address of the project token.
lendingToken
address
Address of the lending token.
Return values:
collateralProjectToWithdraw
uint256
The amount of collateral available for withdrawal in the project token.
supply (0xd07ab026)
function supply(
address lendingToken,
uint256 lendingTokenAmount,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable
Supplies a specified amount of a lending token to the platform.
Allows a user to supply a specified amount of a lending token to the platform.
Parameters:
lendingToken
address
The address of the lending token being supplied.
lendingTokenAmount
uint256
The amount of the lending token being supplied.
priceIds
bytes32[]
An array of price identifiers used to update the price oracle.
updateData
bytes[]
An array of update data used to update the price oracle.
Requirements:
The lending token is listed.
The lending token is not paused.
The lending token amount is greater than 0.
Minting the bLendingTokens is successful and the minted amount is greater than 0.
Effects:
Mints the corresponding bLendingTokens and credits them to the user. |
supplyFromRelatedContract (0xac160433)
function supplyFromRelatedContract(
address lendingToken,
uint256 lendingTokenAmount,
address user,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable
Supplies a certain amount of lending tokens to the platform from a specific user.
Requirements:
The lending token is listed.
Called by a related contract.
The lending token is not paused.
The lending token amount is greater than 0.
Minting the bLendingTokens is successful and the minted amount is greater than 0.
Effects:
Mints the corresponding bLendingTokens and credits them to the user.
Parameters:
lendingToken
address
Address of the lending token.
lendingTokenAmount
uint256
Amount of lending tokens to be supplied.
user
address
Address of the user.
priceIds
bytes32[]
An array of price identifiers used to update the price oracle.
updateData
bytes[]
An array of update data used to update the price oracle.
redeem (0xe9bae8a8)
function redeem(
address lendingToken,
uint256 bLendingTokenAmount,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable
Redeems a specified amount of bLendingToken from the platform.
Function that performs the redemption of bLendingToken and returns the corresponding lending token to user.
Requirements:
The lendingToken is listed.
The lending token should not be paused.
The bLendingTokenAmount should be greater than zero.
The redemption of bLendingToken should not result in a redemption error.
Effects:
Burns the bLendingTokens from the user.
Transfers the corresponding lending tokens to the user.
Parameters:
lendingToken
address
Address of the lending token.
bLendingTokenAmount
uint256
Amount of bLending tokens to be redeemed.
priceIds
bytes32[]
An array of price identifiers used to update the price oracle.
updateData
bytes[]
An array of update data used to update the price oracle.
redeemFromRelatedContract (0xa62b7bd7)
function redeemFromRelatedContract(
address lendingToken,
uint256 bLendingTokenAmount,
address user,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable
Function that performs the redemption of bLendingToken on behalf of a user and returns the corresponding lending token to the user by related contract.
Requirements:
The lendingToken is listed. _ - Called by a related contract.
The lending token should not be paused.
The bLendingTokenAmount should be greater than zero.
The redemption of bLendingToken should not result in a redemption error.
Effects:
Burns the bLendingTokens from the user.
Transfers the corresponding lending tokens to the user.
Parameters:
lendingToken
address
Address of the lending token.
bLendingTokenAmount
uint256
Amount of bLending tokens to be redeemed.
user
address
Address of the user.
priceIds
bytes32[]
An array of price identifiers used to update the price oracle.
updateData
bytes[]
An array of update data used to update the price oracle.
redeemUnderlying (0xb78deb78)
function redeemUnderlying(
address lendingToken,
uint256 lendingTokenAmount,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable
Redeems a specified amount of lendingToken from the platform.
Function that performs the redemption of lending token and returns the corresponding underlying token to user.
Requirements:
The lending token is listed.
The lending token should not be paused.
The lendingTokenAmount should be greater than zero.
The redemption of lendingToken should not result in a redemption error.
Effects:
Transfers the corresponding underlying tokens to the user.
Parameters:
lendingToken
address
Address of the lending token.
lendingTokenAmount
uint256
Amount of lending tokens to be redeemed.
priceIds
bytes32[]
An array of price identifiers used to update the price oracle.
updateData
bytes[]
An array of update data used to update the price oracle.
redeemUnderlyingFromRelatedContract (0x3898b641)
function redeemUnderlyingFromRelatedContract(
address lendingToken,
uint256 lendingTokenAmount,
address user,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable
Function that performs the redemption of lending token on behalf of a user and returns the corresponding underlying token to the user by related contract.
Requirements:
The lending token is listed.
Called by a related contract.
The lending token should not be paused.
The lendingTokenAmount should be greater than zero.
The redemption of lendingToken should not result in a redemption error.
Effects:
Transfers the corresponding underlying tokens to the user.
Parameters:
lendingToken
address
Address of the lending token.
lendingTokenAmount
uint256
Amount of lending tokens to be redeemed.
user
address
Address of the user.
calcBorrowPosition (0x2dfee307)
function calcBorrowPosition(
address borrower,
address projectToken,
address lendingToken,
uint256 lendingTokenAmount,
address currentLendingToken
) external
Allows a related contract to calculate the new borrow position of a user.
Parameters:
borrower
address
The address of the user for whom the borrow position is being calculated.
projectToken
address
The address of the project token being used as collateral.
lendingToken
address
The address of the lending token being borrowed.
lendingTokenAmount
uint256
The amount of lending tokens being borrowed.
currentLendingToken
address
The address of the current lending token being used as collateral.
getLendingAvailableToBorrow (0x07445b52)
function getLendingAvailableToBorrow(
address account,
address projectToken,
address lendingToken
) external returns (uint256 availableToBorrow)
Calculates the lending token available amount for borrowing.
Parameters:
account
address
Address of the user.
projectToken
address
Address of the project token.
lendingToken
address
Address of the lending token.
Return values:
availableToBorrow
uint256
The amount of lending token available amount for borrowing.
repay (0x1da649cf)
function repay(
address projectToken,
address lendingToken,
uint256 lendingTokenAmount
) external returns (uint256)
Allows a borrower to repay their outstanding loan for a given project token and lending token.
Parameters:
projectToken
address
The project token's address
lendingToken
address
The lending token's address
lendingTokenAmount
uint256
The amount of lending tokens to repay
Return values:
[0]
uint256
amount of lending tokens actually repaid
repayFromRelatedContract (0xf432e4e2)
function repayFromRelatedContract(
address projectToken,
address lendingToken,
uint256 lendingTokenAmount,
address repairer,
address borrower
) external returns (uint256)
Allows a related contract to repay the outstanding loan for a given borrower's project token and lending token.
Parameters:
projectToken
address
The project token's address
lendingToken
address
The lending token's address
lendingTokenAmount
uint256
The amount of lending tokens to repay
repairer
address
The address that initiated the repair transaction
borrower
address
The borrower's address
Return values:
[0]
uint256
amount of lending tokens actually repaid
updateInterestInBorrowPositions (0x9a812edd)
function updateInterestInBorrowPositions(
address account,
address lendingToken
) external
This function is called to update the interest in a borrower's borrow position.
Parameters:
account
address
Address of the borrower.
lendingToken
address
Address of the lending token.
getTokensUpdateFinalPrices (0xef290120)
function getTokensUpdateFinalPrices(
address projectToken,
address actualLendingToken,
bool isBorrow
) external view returns (address[] memory)
This function is called when performing operations using token prices, to determine which tokens will need to update their final price.
Parameters:
projectToken
address
Address of the project token.
actualLendingToken
address
Address of the lending token.
isBorrow
bool
Whether getting the list of tokens for updateFinalPrices is related to the borrowing operation or not.
Return values:
[0]
address[]
Array of tokens that need to update final price.
priceOracle (0x2630c12f)
function priceOracle() external view returns (address)
return address of price oracle with interface of PriceProviderAggregator
projectTokens (0xb269449f)
function projectTokens(uint256 projectTokenId) external view returns (address)
return address project token in array projectTokens
Parameters:
projectTokenId
uint256
- index of project token in array projectTokens
. Numerates from 0 to array length - 1
lendingTokens (0x6f5f74f2)
function lendingTokens(uint256 lendingTokenId) external view returns (address)
return address lending token in array lendingTokens
Parameters:
lendingTokenId
uint256
- index of lending token in array lendingTokens
. Numerates from 0 to array length - 1
projectTokenInfo (0x85f4da5c)
function projectTokenInfo(
address projectToken
) external view returns (IPrimaryLendingPlatform.ProjectTokenInfo memory)
Returns the info of the project token.
Return values:
[0]
struct IPrimaryLendingPlatform.ProjectTokenInfo
The address of the project token
lendingTokenInfo (0x3299093b)
function lendingTokenInfo(
address lendingToken
) external view returns (IPrimaryLendingPlatform.LendingTokenInfo memory)
Returns the address of the lending token.
Return values:
[0]
struct IPrimaryLendingPlatform.LendingTokenInfo
The address of the lending token.
getRelatedContract (0x2060128e)
function getRelatedContract(
address relatedContract
) external view returns (bool)
Returns whether an address is a related contract or not.
Parameters:
relatedContract
address
The address of the contract to check.
Return values:
[0]
bool
isRelated Boolean indicating whether the contract is related or not.
borrowLimitPerLendingToken (0x9f9184db)
function borrowLimitPerLendingToken(
address lendingToken
) external view returns (uint256)
Returns the borrow limit per lending token.
Return values:
[0]
uint256
The address of the lending token.
borrowLimitPerCollateral (0x739d7547)
function borrowLimitPerCollateral(
address projectToken
) external view returns (uint256)
Returns the borrow limit per collateral token.
Return values:
[0]
uint256
The address of the project token.
totalDepositedProjectToken (0xef867f0f)
function totalDepositedProjectToken(
address projectToken
) external view returns (uint256)
return total amount of deposited project token
Parameters:
projectToken
address
- address of project token in array projectTokens
. Numerates from 0 to array length - 1
totalBorrow (0xb090cf22)
function totalBorrow(
address projectToken,
address lendingToken
) external view returns (uint256)
return total borrow amount of lendingToken
by projectToken
Parameters:
projectToken
address
- address of project token
lendingToken
address
- address of lending token
pit (0x72d456af)
function pit(
address account,
address projectToken,
address lendingToken
) external view returns (uint256)
Returns the PIT (primary index token) value for a given account and position after a position is opened
Parameters:
account
address
Address of the account.
projectToken
address
Address of the project token.
lendingToken
address
Address of the lending token.
Return values:
[0]
uint256
The PIT value.
Formula: pit = $ * LVR
pitCollateral (0x1893be9f)
function pitCollateral(
address account,
address projectToken
) external view returns (uint256)
Returns the PIT (primary index token) value for a given account and collateral before a position is opened
Parameters:
account
address
Address of the account.
projectToken
address
Address of the project token.
Return values:
[0]
uint256
The PIT value.
Formula: pit = $ * LVR
getLendingToken (0x2ce36230)
function getLendingToken(
address user,
address projectToken
) external view returns (address actualLendingToken)
Returns the actual lending token of a user's borrow position for a specific project token
Parameters:
user
address
The address of the user's borrow position
projectToken
address
The address of the project token
Return values:
actualLendingToken
address
The address of the actual lending token
pitRemaining (0xd1a3d2ae)
function pitRemaining(
address account,
address projectToken,
address lendingToken
) external view returns (uint256 remaining)
Returns the remaining PIT (primary index token) of a user's borrow position
Parameters:
account
address
The address of the user's borrow position
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
Return values:
remaining
uint256
The remaining PIT of the user's borrow position
totalOutstanding (0xac15382f)
function totalOutstanding(
address account,
address projectToken,
address lendingToken
) external view returns (uint256)
Returns the total outstanding amount of a user's borrow position for a specific project token and lending token
Parameters:
account
address
The address of the user's borrow position
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
Return values:
[0]
uint256
total outstanding amount of the user's borrow position
healthFactor (0xcc224bff)
function healthFactor(
address account,
address projectToken,
address lendingToken
) external view returns (uint256 numerator, uint256 denominator)
Returns the health factor of a user's borrow position for a specific project token and lending token
Parameters:
account
address
The address of the user's borrow position
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
Return values:
numerator
uint256
The numerator of the health factor
denominator
uint256
The denominator of the health factor
getTokenEvaluation (0x3598a7a9)
function getTokenEvaluation(
address token,
uint256 tokenAmount
)
external
view
returns (uint256 collateralEvaluation, uint256 capitalEvaluation)
Returns the evaluation of a specific token amount in USD
Parameters:
token
address
The address of the token to evaluate
tokenAmount
uint256
The amount of the token to evaluate
Return values:
collateralEvaluation
uint256
the USD evaluation of token by its tokenAmount
in collateral price
capitalEvaluation
uint256
the USD evaluation of token by its tokenAmount
in capital price
lendingTokensLength (0x2412b575)
function lendingTokensLength() external view returns (uint256)
Returns the length of the lending tokens array
Return values:
[0]
uint256
The length of the lending tokens array
projectTokensLength (0x4a41d29e)
function projectTokensLength() external view returns (uint256)
Returns the length of the project tokens array
Return values:
[0]
uint256
The length of the project tokens array
getPosition (0x713390f5)
function getPosition(
address account,
address projectToken,
address lendingToken
)
external
view
returns (
uint256 depositedProjectTokenAmount,
uint256 loanBody,
uint256 accrual,
uint256 healthFactorNumerator,
uint256 healthFactorDenominator
)
Returns the details of a user's borrow position for a specific project token and lending token
Parameters:
account
address
The address of the user's borrow position
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
Return values:
depositedProjectTokenAmount
uint256
The amount of project tokens deposited by the user
loanBody
uint256
The amount of the lending token borrowed by the user
accrual
uint256
The accrued interest of the borrow position
healthFactorNumerator
uint256
The numerator of the health factor
healthFactorDenominator
uint256
The denominator of the health factor
getDepositedAmount (0x0fefc251)
function getDepositedAmount(
address projectToken,
address user
) external view returns (uint256)
Returns the amount of project tokens deposited by a user for a specific project token and collateral token
Parameters:
projectToken
address
The address of the project token
user
address
The address of the user
Return values:
[0]
uint256
amount of project tokens deposited by the user
getTotalBorrowPerCollateral (0x65647a59)
function getTotalBorrowPerCollateral(
address projectToken
) external view returns (uint256)
Get total borrow amount in USD per collateral for a specific project token
Parameters:
projectToken
address
The address of the project token
Return values:
[0]
uint256
The total borrow amount in USD
getTotalBorrowPerLendingToken (0x961540e1)
function getTotalBorrowPerLendingToken(
address lendingToken
) external view returns (uint256)
Get total borrow amount in USD for a specific lending token
Parameters:
lendingToken
address
The address of the lending token
Return values:
[0]
uint256
The total borrow amount in USD
totalOutstandingInUSD (0xb189b70a)
function totalOutstandingInUSD(
address account,
address projectToken,
address lendingToken
) external view returns (uint256)
Convert the total outstanding amount of a user's borrow position to USD
Parameters:
account
address
The address of the user account
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
Return values:
[0]
uint256
The total outstanding amount in USD
getLoanToValueRatio (0xe84dc1b3)
function getLoanToValueRatio(
address projectToken,
address lendingToken
) external view returns (uint256 lvrNumerator, uint256 lvrDenominator)
Get the loan to value ratio of a position taken by a project token and a lending token
Parameters:
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
Return values:
lvrNumerator
uint256
The numerator of the loan to value ratio
lvrDenominator
uint256
The denominator of the loan to value ratio
pitCollateralWithUpdatePrices (0x902b6286)
function pitCollateralWithUpdatePrices(
address account,
address projectToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256)
Returns the PIT (primary index token) value for a given account and collateral before a position is opened after update price.
Parameters:
account
address
Address of the account.
projectToken
address
Address of the project token.
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
[0]
uint256
The PIT value.
Formula: pit = $ * LVR
pitRemainingWithUpdatePrices (0xe662d5c5)
function pitRemainingWithUpdatePrices(
address account,
address projectToken,
address lendingToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256)
Returns the remaining PIT (primary index token) of a user's borrow position after update price.
Parameters:
account
address
The address of the user's borrow position
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
[0]
uint256
remaining The remaining PIT of the user's borrow position
estimatedPitRemainingWithUpdatePrices (0x0c0e14a3)
function estimatedPitRemainingWithUpdatePrices(
address account,
address projectToken,
address lendingToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256)
Returns the estimated remaining PIT (primary index token) of a user's borrow position
Parameters:
account
address
The address of the user's borrow position
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
[0]
uint256
remaining The estimated remaining PIT of the user's borrow position
getTokenEvaluationWithUpdatePrices (0x4d247b46)
function getTokenEvaluationWithUpdatePrices(
address token,
uint256 tokenAmount,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256)
Returns the evaluation of a specific token amount in USD after update price.
Parameters:
token
address
The address of the token to evaluate
tokenAmount
uint256
The amount of the token to evaluate
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
[0]
uint256
The evaluated token amount in USD
getPositionWithUpdatePrices (0xa767ebd3)
function getPositionWithUpdatePrices(
address account,
address projectToken,
address lendingToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
)
external
payable
returns (
uint256 depositedProjectTokenAmount,
uint256 loanBody,
uint256 accrual,
uint256 healthFactorNumerator,
uint256 healthFactorDenominator
)
Returns the details of a user's borrow position for a specific project token and lending token after update price
Parameters:
account
address
The address of the user's borrow position
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
depositedProjectTokenAmount
uint256
The amount of project tokens deposited by the user
loanBody
uint256
The amount of the lending token borrowed by the user
accrual
uint256
The accrued interest of the borrow position
healthFactorNumerator
uint256
The numerator of the health factor
healthFactorDenominator
uint256
The denominator of the health factor
totalEstimatedOutstandingInUSDWithUpdatePrices (0x7b78a351)
function totalEstimatedOutstandingInUSDWithUpdatePrices(
address account,
address projectToken,
address lendingToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256)
Returns the total estimated outstanding amount of a user's borrow position to USD after update price.
Parameters:
account
address
The address of the user account
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
[0]
uint256
The total estimated outstanding amount in USD
convertPitRemainingWithUpdatePrices (0x07a0e36c)
function convertPitRemainingWithUpdatePrices(
address account,
address projectToken,
address lendingToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256)
Convert the remaining pit amount to the corresponding lending token amount after update price.
Parameters:
account
address
The address of the user account
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
[0]
uint256
The converted lending token amount
convertEstimatedPitRemainingWithUpdatePrices (0x7200b1ef)
function convertEstimatedPitRemainingWithUpdatePrices(
address account,
address projectToken,
address lendingToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256)
Convert the estimated remaining pit amount to the corresponding lending token amount after update price.
Parameters:
account
address
The address of the user account
projectToken
address
The address of the project token
lendingToken
address
The address of the lending token
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
[0]
uint256
The estimated lending token amount
getCollateralAvailableToWithdrawWithUpdatePrices (0x45f0219c)
function getCollateralAvailableToWithdrawWithUpdatePrices(
address account,
address projectToken,
address lendingToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256 collateralProjectToWithdraw)
Calculates the collateral available for withdrawal based on the loan-to-value ratio of a specific project token after update price.
Parameters:
account
address
Address of the user.
projectToken
address
Address of the project token.
lendingToken
address
Address of the lending token.
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
collateralProjectToWithdraw
uint256
The amount of collateral available for withdrawal in the project token.
getLendingAvailableToBorrow (0xdc8b040b)
function getLendingAvailableToBorrow(
address account,
address projectToken,
address lendingToken,
bytes32[] memory priceIds,
bytes[] calldata updateData
) external payable returns (uint256 availableToBorrow)
Calculates the lending token available amount for borrowing after update price.
Parameters:
account
address
Address of the user.
projectToken
address
Address of the project token.
lendingToken
address
Address of the lending token.
priceIds
bytes32[]
The priceIds need to update.
updateData
bytes[]
The updateData provided by PythNetwork.
Return values:
availableToBorrow
uint256
The amount of lending token available amount for borrowing.
Last updated