DeltasLib
Author: Morpho Labs
Library used to ease delta reads and writes.
Functions
increaseP2P
Increases the peer-to-peer amounts following a promotion.
function increaseP2P(
Types.Deltas storage deltas,
address underlying,
uint256 promoted,
uint256 amount,
Types.Indexes256 memory indexes,
bool borrowSide
) internal returns (uint256 p2pBalanceIncrease);
Parameters
Name | Type | Description |
---|---|---|
deltas | Types.Deltas | The market deltas to update. |
underlying | address | The underlying address. |
promoted | uint256 | The amount to increase the promoted side peer-to-peer total (in underlying). Must be lower than or equal to amount. |
amount | uint256 | The amount to increase the opposite side peer-to-peer total (in underlying). |
indexes | Types.Indexes256 | The current indexes. |
borrowSide | bool | True if this follows borrower promotions. False for supplier promotions. |
Returns
Name | Type | Description |
---|---|---|
p2pBalanceIncrease | uint256 | The scaled balance amount in peer-to-peer to increase. |
decreaseP2P
Decreases the peer-to-peer amounts following a demotion.
function decreaseP2P(
Types.Deltas storage deltas,
address underlying,
uint256 demoted,
uint256 amount,
Types.Indexes256 memory indexes,
bool borrowSide
) internal;
Parameters
Name | Type | Description |
---|---|---|
deltas | Types.Deltas | The market deltas to update. |
underlying | address | The underlying address. |
demoted | uint256 | The amount to decrease the demoted side peer-to-peer total (in underlying). Must be lower than or equal to amount. |
amount | uint256 | The amount to decrease the opposite side peer-to-peer total (in underlying). |
indexes | Types.Indexes256 | The current indexes. |
borrowSide | bool | True if this follows borrower demotions. False for supplier demotions. |