MarketSideDeltaLib
Author: Morpho Labs
Library used to ease increase or decrease deltas.
Functions
increaseDelta
Given variables from a market side, updates the market side delta according to the demoted amount.
function increaseDelta(
Types.MarketSideDelta storage delta,
address underlying,
uint256 amount,
Types.MarketSideIndexes256 memory indexes,
bool borrowSide
) internal;
Parameters
Name | Type | Description |
---|---|---|
delta | Types.MarketSideDelta | The market deltas to update. |
underlying | address | The underlying address. |
amount | uint256 | The amount to supply/borrow (in underlying). |
indexes | Types.MarketSideIndexes256 | The current indexes. |
borrowSide | bool | Whether the market side is borrow. |
decreaseDelta
Given variables from a market side, matches the delta and calculates the amount to supply/borrow from delta. Updates the market side delta accordingly.
function decreaseDelta(
Types.MarketSideDelta storage delta,
address underlying,
uint256 amount,
uint256 poolIndex,
bool borrowSide
) internal returns (uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
delta | Types.MarketSideDelta | The market deltas to update. |
underlying | address | The underlying address. |
amount | uint256 | The amount to supply/borrow (in underlying). |
poolIndex | uint256 | The current pool index. |
borrowSide | bool | Whether the market side is borrow. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The amount left to process (in underlying) and the amount to repay/withdraw (in underlying). |
<none> | uint256 |