LiquiditySlotsLink

Git Source

library that helps in reading / working with storage slot data of Fluid Liquidity.

as all data for Fluid Liquidity is internal, any data must be fetched directly through manual slot reading through this library or, if gas usage is less important, through the FluidLiquidityResolver.

State Variables

LIQUIDITY_STATUS_SLOT

storage slot for status at Liquidity

uint256 internal constant LIQUIDITY_STATUS_SLOT = 1;

LIQUIDITY_AUTHS_MAPPING_SLOT

storage slot for auths mapping at Liquidity

uint256 internal constant LIQUIDITY_AUTHS_MAPPING_SLOT = 2;

LIQUIDITY_GUARDIANS_MAPPING_SLOT

storage slot for guardians mapping at Liquidity

uint256 internal constant LIQUIDITY_GUARDIANS_MAPPING_SLOT = 3;

LIQUIDITY_USER_CLASS_MAPPING_SLOT

storage slot for user class mapping at Liquidity

uint256 internal constant LIQUIDITY_USER_CLASS_MAPPING_SLOT = 4;

LIQUIDITY_EXCHANGE_PRICES_MAPPING_SLOT

storage slot for exchangePricesAndConfig mapping at Liquidity

uint256 internal constant LIQUIDITY_EXCHANGE_PRICES_MAPPING_SLOT = 5;

LIQUIDITY_RATE_DATA_MAPPING_SLOT

storage slot for rateData mapping at Liquidity

uint256 internal constant LIQUIDITY_RATE_DATA_MAPPING_SLOT = 6;

LIQUIDITY_TOTAL_AMOUNTS_MAPPING_SLOT

storage slot for totalAmounts mapping at Liquidity

uint256 internal constant LIQUIDITY_TOTAL_AMOUNTS_MAPPING_SLOT = 7;

LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT

storage slot for user supply double mapping at Liquidity

uint256 internal constant LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT = 8;

LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT

storage slot for user borrow double mapping at Liquidity

uint256 internal constant LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT = 9;

LIQUIDITY_LISTED_TOKENS_ARRAY_SLOT

storage slot for listed tokens array at Liquidity

uint256 internal constant LIQUIDITY_LISTED_TOKENS_ARRAY_SLOT = 10;

BITS_EXCHANGE_PRICES_BORROW_RATE

uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_RATE = 0;

BITS_EXCHANGE_PRICES_FEE

uint256 internal constant BITS_EXCHANGE_PRICES_FEE = 16;

BITS_EXCHANGE_PRICES_UTILIZATION

uint256 internal constant BITS_EXCHANGE_PRICES_UTILIZATION = 30;

BITS_EXCHANGE_PRICES_UPDATE_THRESHOLD

uint256 internal constant BITS_EXCHANGE_PRICES_UPDATE_THRESHOLD = 44;

BITS_EXCHANGE_PRICES_LAST_TIMESTAMP

uint256 internal constant BITS_EXCHANGE_PRICES_LAST_TIMESTAMP = 58;

BITS_EXCHANGE_PRICES_SUPPLY_EXCHANGE_PRICE

uint256 internal constant BITS_EXCHANGE_PRICES_SUPPLY_EXCHANGE_PRICE = 91;

BITS_EXCHANGE_PRICES_BORROW_EXCHANGE_PRICE

uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_EXCHANGE_PRICE = 155;

BITS_EXCHANGE_PRICES_SUPPLY_RATIO

uint256 internal constant BITS_EXCHANGE_PRICES_SUPPLY_RATIO = 219;

BITS_EXCHANGE_PRICES_BORROW_RATIO

uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_RATIO = 234;

BITS_RATE_DATA_VERSION

uint256 internal constant BITS_RATE_DATA_VERSION = 0;

BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_ZERO

uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_ZERO = 4;

BITS_RATE_DATA_V1_UTILIZATION_AT_KINK

uint256 internal constant BITS_RATE_DATA_V1_UTILIZATION_AT_KINK = 20;

BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_KINK

uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_KINK = 36;

BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_MAX

uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_MAX = 52;

BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_ZERO

uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_ZERO = 4;

BITS_RATE_DATA_V2_UTILIZATION_AT_KINK1

uint256 internal constant BITS_RATE_DATA_V2_UTILIZATION_AT_KINK1 = 20;

BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK1

uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK1 = 36;

BITS_RATE_DATA_V2_UTILIZATION_AT_KINK2

uint256 internal constant BITS_RATE_DATA_V2_UTILIZATION_AT_KINK2 = 52;

BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK2

uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK2 = 68;

BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_MAX

uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_MAX = 84;

BITS_TOTAL_AMOUNTS_SUPPLY_WITH_INTEREST

uint256 internal constant BITS_TOTAL_AMOUNTS_SUPPLY_WITH_INTEREST = 0;

BITS_TOTAL_AMOUNTS_SUPPLY_INTEREST_FREE

uint256 internal constant BITS_TOTAL_AMOUNTS_SUPPLY_INTEREST_FREE = 64;

BITS_TOTAL_AMOUNTS_BORROW_WITH_INTEREST

uint256 internal constant BITS_TOTAL_AMOUNTS_BORROW_WITH_INTEREST = 128;

BITS_TOTAL_AMOUNTS_BORROW_INTEREST_FREE

uint256 internal constant BITS_TOTAL_AMOUNTS_BORROW_INTEREST_FREE = 192;

BITS_USER_SUPPLY_MODE

uint256 internal constant BITS_USER_SUPPLY_MODE = 0;

BITS_USER_SUPPLY_AMOUNT

uint256 internal constant BITS_USER_SUPPLY_AMOUNT = 1;

BITS_USER_SUPPLY_PREVIOUS_WITHDRAWAL_LIMIT

uint256 internal constant BITS_USER_SUPPLY_PREVIOUS_WITHDRAWAL_LIMIT = 65;

BITS_USER_SUPPLY_LAST_UPDATE_TIMESTAMP

uint256 internal constant BITS_USER_SUPPLY_LAST_UPDATE_TIMESTAMP = 129;

BITS_USER_SUPPLY_EXPAND_PERCENT

uint256 internal constant BITS_USER_SUPPLY_EXPAND_PERCENT = 162;

BITS_USER_SUPPLY_EXPAND_DURATION

uint256 internal constant BITS_USER_SUPPLY_EXPAND_DURATION = 176;

BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT

uint256 internal constant BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT = 200;

BITS_USER_SUPPLY_IS_PAUSED

uint256 internal constant BITS_USER_SUPPLY_IS_PAUSED = 255;

BITS_USER_BORROW_MODE

uint256 internal constant BITS_USER_BORROW_MODE = 0;

BITS_USER_BORROW_AMOUNT

uint256 internal constant BITS_USER_BORROW_AMOUNT = 1;

BITS_USER_BORROW_PREVIOUS_BORROW_LIMIT

uint256 internal constant BITS_USER_BORROW_PREVIOUS_BORROW_LIMIT = 65;

BITS_USER_BORROW_LAST_UPDATE_TIMESTAMP

uint256 internal constant BITS_USER_BORROW_LAST_UPDATE_TIMESTAMP = 129;

BITS_USER_BORROW_EXPAND_PERCENT

uint256 internal constant BITS_USER_BORROW_EXPAND_PERCENT = 162;

BITS_USER_BORROW_EXPAND_DURATION

uint256 internal constant BITS_USER_BORROW_EXPAND_DURATION = 176;

BITS_USER_BORROW_BASE_BORROW_LIMIT

uint256 internal constant BITS_USER_BORROW_BASE_BORROW_LIMIT = 200;

BITS_USER_BORROW_MAX_BORROW_LIMIT

uint256 internal constant BITS_USER_BORROW_MAX_BORROW_LIMIT = 218;

BITS_USER_BORROW_IS_PAUSED

uint256 internal constant BITS_USER_BORROW_IS_PAUSED = 255;

Functions

calculateMappingStorageSlot

Calculating the slot ID for Liquidity contract for single mapping at slot_ for key_

function calculateMappingStorageSlot(uint256 slot_, address key_) internal pure returns (bytes32);

calculateDoubleMappingStorageSlot

Calculating the slot ID for Liquidity contract for double mapping at slot_ for key1_ and key2_

function calculateDoubleMappingStorageSlot(uint256 slot_, address key1_, address key2_)
    internal
    pure
    returns (bytes32);
Table of Contents