PosManager
Position manager is responsible for managing individual positions, including debt shares and collaterals.
View Functions
nextNonces
Get a user's next nonce for calculating the creation of position id.
core
InitCore contract address.
maxCollCount
Max collateral count allowed.
pendingRewards
Position's pending reward token amounts.
isCollateralized
Get whether the wrapped LP token id is already collateralized to the position.
getPosBorrInfo
Get a position's borrow information.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get borrow info |
Returns:
Name | Type | Description |
---|---|---|
|
| array of lending pool addresses that the position borrows from |
|
| array of debt shares of each borrow token |
getPosBorrExtraInfo
Get a position's borrow extra information.
totalInterest
may not be exact. Use with caution.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get borrow extra info |
|
| lending pool address to get borrow extra info |
Returns:
Name | Type | Description |
---|---|---|
|
| total interest that the lending pool has accrued borrow interest |
|
| the last known debt amount |
getPosCollInfo
Get a position's collateral information.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get collateral info |
Returns:
Name | Type | Description |
---|---|---|
|
| array of lending addresses that the position puts as collateral |
|
| array of lending pool collateralization amounts |
|
| array of wrapped LP addresses |
|
| array of array of wrapped LP's token ids |
|
| array of array of wrapped LP's token amount for each token id |
getCollAmt
Get a position's collateral amount of the specified lending pool.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get collateral amount |
|
| lending pool to get collateral amount |
Returns:
Name | Type | Description |
---|---|---|
|
| collateral amount |
getCollWLpAmt
Get a position's collateral amount of the specified wrapped LP.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get collateral wLp amount |
|
| wrapped LP contract address to get collateral amount |
|
| wrapped LP token id to get collateral amount |
Returns:
Name | Type | Description |
---|---|---|
|
| collateral amount |
getPosCollCount
Get a position's collateral count of a given position id.
This count does not include wLp collaterals.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get collateral count |
Returns:
Name | Type | Description |
---|---|---|
|
| collateral count |
getPosCollWLpCount
Get a position's wrapped LP collateral count of a given position id.
This count does not include regular lending pool collaterals.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get wLp collateral count |
Returns:
Name | Type | Description |
---|---|---|
|
| collateral count |
getPosInfo
Get a position's general information.
If the position does not exist, the viewer will be address(0)
and mode will be 0.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get information |
Returns:
Name | Type | Description |
---|---|---|
|
| viewer address of the position |
|
| position's current mode |
getPosMode
Get a position's mode.
If a position does not exist, the mode will be 0.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get mode |
Returns:
Name | Type | Description |
---|---|---|
|
| position mode |
getPosDebtShares
Get a position's debt shares (without borrow interest accrual).
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to get debt shares information |
|
| lending pool address to get debt shares of |
Returns:
Name | Type | Description |
---|---|---|
|
| lending pool debt shares of the position |
getViewerPosIdsAt
Get a reverse-mapping lookup for the specified viewer address and the array index.
If the index can be out-of-bounds if it exceeds the array length.
Parameters:
Name | Type | Description |
---|---|---|
|
| viewer address to get position id |
|
| array index to query |
Returns:
Name | Type | Description |
---|---|---|
|
| position id |
getViewerPosIdsLength
Get a reverse-mapping lookup array length for the specified viewer address.
Parameters:
Name | Type | Description |
---|---|---|
|
| viewer address to get position id count |
Returns:
Name | Type | Description |
---|---|---|
|
| position id count corresponding to the viewer |
isAuthorized
Check whether the account is authorized for modifying the position.
Parameters:
Name | Type | Description |
---|---|---|
|
| address to check authorization |
|
| position id to check authorization |
Returns:
Name | Type | Description |
---|---|---|
|
| whether the account is authorized to modify the position id |
External Functions
harvestTo
Harvest reward tokens of the specified wrapped LP to the target address.
Can only be called by an authorized party of the position.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to harvest rewards from |
|
| wrapped LP contract address to harvest rewards |
|
| wrapped LP token id to harvest rewards |
|
| address to receive the reward tokens |
Returns:
Name | Type | Description |
---|---|---|
|
| array of reward token addresses |
|
| array of reward token amounts transferred |
claimPendingRewards
Claim pending reward tokens from the position.
This function is intended to be called in cases when the position gets liquidated, and reward tokens get accrued in the position.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to claim pending rewards |
|
| array of reward tokens to claim |
|
| address to receive the reward tokens |
Returns:
Name | Type | Description |
---|---|---|
|
| array of reward token amounts |
setPosViewer
Set a new viewer to the position.
Can only be called by an authorized party of the position.
Parameters:
Name | Type | Description |
---|---|---|
|
| position id to set new viewer address |
|
| new viewer address to set |
Last updated