HelpersOperate ​
Inherits:Helpers
Fluid vault protocol helper methods. Mostly used for operate() and liquidate() methods of CoreModule.
Functions ​
_updateTickHasDebt ​
sets tick_ as having debt or no debt in storage tickHasDebt depending on addOrRemove_
solidity
function _updateTickHasDebt(int256 tick_, bool addOrRemove_) internal;Parameters
| Name | Type | Description |
|---|---|---|
tick_ | int256 | tick to add or remove from tickHasDebt |
addOrRemove_ | bool | if true then add else remove |
_fetchNextTopTick ​
gets next perfect top tick (tick which is not liquidated)
solidity
function _fetchNextTopTick(int256 topTick_) internal view returns (int256 nextTick_);Parameters
| Name | Type | Description |
|---|---|---|
topTick_ | int256 | current top tick which will no longer be top tick |
Returns
| Name | Type | Description |
|---|---|---|
nextTick_ | int256 | next top tick which will become the new top tick |
_addDebtToTickWrite ​
adding debt to a particular tick
solidity
function _addDebtToTickWrite(uint256 totalColRaw_, uint256 netDebtRaw_)
internal
returns (int256 tick_, uint256 tickId_, uint256 userRawDebt_, uint256 rawDust_);Parameters
| Name | Type | Description |
|---|---|---|
totalColRaw_ | uint256 | total raw collateral of position |
netDebtRaw_ | uint256 | net raw debt (total debt - dust debt) |
Returns
| Name | Type | Description |
|---|---|---|
tick_ | int256 | tick where the debt is being added |
tickId_ | uint256 | tick current id |
userRawDebt_ | uint256 | user's total raw debt |
rawDust_ | uint256 | dust debt used for adjustment |
_setNewTopTick ​
sets new top tick. If it comes to this function then that means current top tick is perfect tick. if next top tick is liquidated then unitializes the current non liquidated branch and make the liquidated branch as current branch
solidity
function _setNewTopTick(int256 topTick_, uint256 vaultVariables_)
internal
returns (uint256 newVaultVariables_, int256 newTopTick_);Parameters
| Name | Type | Description |
|---|---|---|
topTick_ | int256 | current top tick |
vaultVariables_ | uint256 | vaultVariables of storage but with newer updates |
Returns
| Name | Type | Description |
|---|---|---|
newVaultVariables_ | uint256 | newVaultVariables_ updated vault variable internally to this function |
newTopTick_ | int256 | new top tick |
constructor ​
solidity
constructor(ConstantViews memory constants_) Helpers(constants_);
