From 093e6925733b62b4ae4ae7fad528d15b6c9779af Mon Sep 17 00:00:00 2001 From: eboado Date: Tue, 24 Nov 2020 15:11:02 +0100 Subject: [PATCH] - Unexcluded types/ on contracts libraries --- .gitignore | 2 +- .../protocol/libraries/types/DataTypes.sol | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 contracts/protocol/libraries/types/DataTypes.sol diff --git a/.gitignore b/.gitignore index 626ee868..e6704cbb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ dist/ build/ .vscode .idea -types +/types deployed-contracts.json diff --git a/contracts/protocol/libraries/types/DataTypes.sol b/contracts/protocol/libraries/types/DataTypes.sol new file mode 100644 index 00000000..a0498f51 --- /dev/null +++ b/contracts/protocol/libraries/types/DataTypes.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: agpl-3.0 +pragma solidity 0.6.12; + +library DataTypes { + // refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties. + struct ReserveData { + //stores the reserve configuration + ReserveBitmap configuration; + //the liquidity index. Expressed in ray + uint128 liquidityIndex; + //variable borrow index. Expressed in ray + uint128 variableBorrowIndex; + //the current supply rate. Expressed in ray + uint128 currentLiquidityRate; + //the current variable borrow rate. Expressed in ray + uint128 currentVariableBorrowRate; + //the current stable borrow rate. Expressed in ray + uint128 currentStableBorrowRate; + uint40 lastUpdateTimestamp; + //tokens addresses + address aTokenAddress; + address stableDebtTokenAddress; + address variableDebtTokenAddress; + //address of the interest rate strategy + address interestRateStrategyAddress; + //the id of the reserve. Represents the position in the list of the active reserves + uint8 id; + } + + struct ReserveBitmap { + //bit 0-15: LTV + //bit 16-31: Liq. threshold + //bit 32-47: Liq. bonus + //bit 48-55: Decimals + //bit 56: Reserve is active + //bit 57: reserve is frozen + //bit 58: borrowing is enabled + //bit 59: stable rate borrowing enabled + //bit 60-63: reserved + //bit 64-79: reserve factor + uint256 data; + } + + struct UserBitmap { + uint256 data; + } + + enum InterestRateMode {NONE, STABLE, VARIABLE} +}