ReserveConfiguration
Author: Aave
Implements the bitmap logic to handle the reserve configuration
State Variables
LTV_MASK
uint256 constant LTV_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000;
LIQUIDATION_THRESHOLD_MASK
uint256 constant LIQUIDATION_THRESHOLD_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF;
LIQUIDATION_BONUS_MASK
uint256 constant LIQUIDATION_BONUS_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF;
DECIMALS_MASK
uint256 constant DECIMALS_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFF;
ACTIVE_MASK
uint256 constant ACTIVE_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFF;
FROZEN_MASK
uint256 constant FROZEN_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFF;
BORROWING_MASK
uint256 constant BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFF;
STABLE_BORROWING_MASK
uint256 constant STABLE_BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFF;
RESERVE_FACTOR_MASK
uint256 constant RESERVE_FACTOR_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFF;
LIQUIDATION_THRESHOLD_START_BIT_POSITION
For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed
uint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16;
LIQUIDATION_BONUS_START_BIT_POSITION
uint256 constant LIQUIDATION_BONUS_START_BIT_POSITION = 32;
RESERVE_DECIMALS_START_BIT_POSITION
uint256 constant RESERVE_DECIMALS_START_BIT_POSITION = 48;
IS_ACTIVE_START_BIT_POSITION
uint256 constant IS_ACTIVE_START_BIT_POSITION = 56;
IS_FROZEN_START_BIT_POSITION
uint256 constant IS_FROZEN_START_BIT_POSITION = 57;
BORROWING_ENABLED_START_BIT_POSITION
uint256 constant BORROWING_ENABLED_START_BIT_POSITION = 58;
STABLE_BORROWING_ENABLED_START_BIT_POSITION
uint256 constant STABLE_BORROWING_ENABLED_START_BIT_POSITION = 59;
RESERVE_FACTOR_START_BIT_POSITION
uint256 constant RESERVE_FACTOR_START_BIT_POSITION = 64;
MAX_VALID_LTV
uint256 constant MAX_VALID_LTV = 65535;
MAX_VALID_LIQUIDATION_THRESHOLD
uint256 constant MAX_VALID_LIQUIDATION_THRESHOLD = 65535;
MAX_VALID_LIQUIDATION_BONUS
uint256 constant MAX_VALID_LIQUIDATION_BONUS = 65535;
MAX_VALID_DECIMALS
uint256 constant MAX_VALID_DECIMALS = 255;
MAX_VALID_RESERVE_FACTOR
uint256 constant MAX_VALID_RESERVE_FACTOR = 65535;
Functions
setLtv
Sets the Loan to Value of the reserve
function setLtv(DataTypes.ReserveConfigurationMap memory self, uint256 ltv) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
ltv | uint256 | the new ltv |
getLtv
Gets the Loan to Value of the reserve
function getLtv(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The loan to value |
setLiquidationThreshold
Sets the liquidation threshold of the reserve
function setLiquidationThreshold(DataTypes.ReserveConfigurationMap memory self, uint256 threshold) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
threshold | uint256 | The new liquidation threshold |
getLiquidationThreshold
Gets the liquidation threshold of the reserve
function getLiquidationThreshold(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The liquidation threshold |
setLiquidationBonus
Sets the liquidation bonus of the reserve
function setLiquidationBonus(DataTypes.ReserveConfigurationMap memory self, uint256 bonus) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
bonus | uint256 | The new liquidation bonus |
getLiquidationBonus
Gets the liquidation bonus of the reserve
function getLiquidationBonus(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The liquidation bonus |
setDecimals
Sets the decimals of the underlying asset of the reserve
function setDecimals(DataTypes.ReserveConfigurationMap memory self, uint256 decimals) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
decimals | uint256 | The decimals |
getDecimals
Gets the decimals of the underlying asset of the reserve
function getDecimals(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The decimals of the asset |
setActive
Sets the active state of the reserve
function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
active | bool | The active state |
getActive
Gets the active state of the reserve
function getActive(DataTypes.ReserveConfigurationMap memory self) internal pure returns (bool);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | The active state |
setFrozen
Sets the frozen state of the reserve
function setFrozen(DataTypes.ReserveConfigurationMap memory self, bool frozen) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
frozen | bool | The frozen state |
getFrozen
Gets the frozen state of the reserve
function getFrozen(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | The frozen state |
setBorrowingEnabled
Enables or disables borrowing on the reserve
function setBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self, bool enabled) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
enabled | bool | True if the borrowing needs to be enabled, false otherwise |
getBorrowingEnabled
Gets the borrowing state of the reserve
function getBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self) internal pure returns (bool);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | The borrowing state |
setStableRateBorrowingEnabled
Enables or disables stable rate borrowing on the reserve
function setStableRateBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self, bool enabled) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
enabled | bool | True if the stable rate borrowing needs to be enabled, false otherwise |
getStableRateBorrowingEnabled
Gets the stable rate borrowing state of the reserve
function getStableRateBorrowingEnabled(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | The stable rate borrowing state |
setReserveFactor
Sets the reserve factor of the reserve
function setReserveFactor(DataTypes.ReserveConfigurationMap memory self, uint256 reserveFactor) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
reserveFactor | uint256 | The reserve factor |
getReserveFactor
Gets the reserve factor of the reserve
function getReserveFactor(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The reserve factor |
getFlags
Gets the configuration flags of the reserve
function getFlags(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool, bool, bool, bool);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled |
<none> | bool | |
<none> | bool | |
<none> | bool |
getParams
Gets the configuration paramters of the reserve
function getParams(DataTypes.ReserveConfigurationMap storage self)
internal
view
returns (uint256, uint256, uint256, uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 |
getParamsMemory
Gets the configuration paramters of the reserve from a memory object
function getParamsMemory(DataTypes.ReserveConfigurationMap memory self)
internal
pure
returns (uint256, uint256, uint256, uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 |
getFlagsMemory
Gets the configuration flags of the reserve from a memory object
function getFlagsMemory(DataTypes.ReserveConfigurationMap memory self) internal pure returns (bool, bool, bool, bool);
Parameters
Name | Type | Description |
---|---|---|
self | DataTypes.ReserveConfigurationMap | The reserve configuration |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled |
<none> | bool | |
<none> | bool | |
<none> | bool |