Helpers ​
Inherits:Variables, ConstantVariables, Events, TokenTransfers
Fluid vault protocol helper methods. Mostly used for operate() and liquidate() methods of CoreModule.
Functions ​
_dexFromAddress ​
solidity
modifier _dexFromAddress();updateExchangePrices ​
Calculates new vault exchange prices. Does not update values in storage.
solidity
function updateExchangePrices(uint256 vaultVariables2_)
public
view
returns (
uint256 liqSupplyExPrice_,
uint256 liqBorrowExPrice_,
uint256 vaultSupplyExPrice_,
uint256 vaultBorrowExPrice_
);Parameters
| Name | Type | Description |
|---|---|---|
vaultVariables2_ | uint256 | exactly same as vaultVariables2 from storage |
Returns
| Name | Type | Description |
|---|---|---|
liqSupplyExPrice_ | uint256 | latest liquidity's supply token supply exchange price |
liqBorrowExPrice_ | uint256 | latest liquidity's borrow token borrow exchange price |
vaultSupplyExPrice_ | uint256 | latest vault's supply token exchange price |
vaultBorrowExPrice_ | uint256 | latest vault's borrow token exchange price |
fetchLatestPosition ​
fetches new user's position after liquidation. The new liquidated position's debt is decreased by 0.01% to make sure that branch's liquidity never becomes 0 as if it would have gotten 0 then there will be multiple cases that we would need to tackle.
solidity
function fetchLatestPosition(int256 positionTick_, uint256 positionTickId_, uint256 positionRawDebt_, uint256 tickData_)
public
view
returns (int256, uint256, uint256 positionRawCol_, uint256 branchId_, uint256 branchData_);Parameters
| Name | Type | Description |
|---|---|---|
positionTick_ | int256 | position's tick when it was last updated through operate |
positionTickId_ | uint256 | position's tick Id. This stores the debt factor and branch to make the first connection |
positionRawDebt_ | uint256 | position's raw debt when it was last updated through operate |
tickData_ | uint256 | position's tick's tickData just for minor comparison to know if data is moved to tick Id or is still in tick data |
Returns
| Name | Type | Description |
|---|---|---|
<none> | int256 | final tick position after all the liquidation |
<none> | uint256 | final debt of position after all the liquidation |
positionRawCol_ | uint256 | final collateral of position after all the liquidation |
branchId_ | uint256 | final branch's ID where the position is at currently |
branchData_ | uint256 | final branch's data where the position is at currently |
constructor ​
solidity
constructor(ConstantViews memory constants_) ConstantVariables(constants_);
