Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3.2.0 #33

Merged
merged 109 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
83b245a
DRAFT: stable rate removal
kyzia551 Apr 23, 2024
cf0fec2
more cleanup
kyzia551 Apr 24, 2024
04d762a
fix backwords capability of getReserveData
kyzia551 Apr 24, 2024
57129ac
DRAFT: Add intensive init reserve tests
kyzia551 Apr 24, 2024
ebefc49
fix underlying decimals with bound
kyzia551 Apr 25, 2024
f2f6237
fix of test_reverts_initReserves_maxAssets test
kyzia551 Apr 25, 2024
0102427
add fuzing to notAdmin_initReserves test
kyzia551 Apr 26, 2024
109595d
Merge pull request #3 from bgd-labs/feat/improvment-init-reserve-tests
kyzia551 Apr 26, 2024
7925194
Merge branch 'v3.2.0' into feat/stable-rate-removal
kyzia551 Apr 26, 2024
bbb7aea
remove i from vars in flashLoan
kyzia551 Apr 26, 2024
9ec96c5
renamed stableBorrowRate back on ReserveDataLegacy
kyzia551 Apr 26, 2024
6d91b62
removed local vars in updateInterestRatesAndVirtualBalance
kyzia551 Apr 26, 2024
acd27e7
change require to not NONE in getDebtRepayAmount
kyzia551 Apr 26, 2024
305834e
remove unused comment
kyzia551 Apr 26, 2024
1c79784
feat: repo refactor
brotherlymite Apr 29, 2024
b77eb71
fix: lint
brotherlymite Apr 29, 2024
cab9796
chore: add reports dir
brotherlymite Apr 29, 2024
d25f6d9
Update src/core/contracts/protocol/pool/PoolConfigurator.sol
kyzia551 May 2, 2024
09dda76
Merge branch 'main' into feat/repo-reorg
brotherlymite May 6, 2024
03a0f73
chore: fix conflicts
brotherlymite May 6, 2024
0d47804
Merge branch 'v3.2.0' into feat/repo-reorg
brotherlymite May 6, 2024
9d80072
fix: remove static-a-token, config engine tests and the deployments
brotherlymite May 6, 2024
4d2b070
fix: tests
brotherlymite May 6, 2024
3244a5b
fix: lint
brotherlymite May 6, 2024
b6694d1
Merge pull request #5 from bgd-labs/feat/repo-reorg
brotherlymite May 6, 2024
6fb27f3
Merge branch 'v3.2.0' into feat/stable-rate-removal
kyzia551 May 7, 2024
f6e6ae6
remove outdated RatesOverflow
kyzia551 May 7, 2024
e7b9354
Merge branch 'main' into v3.2.0
kyzia551 May 7, 2024
db9698b
Merge branch 'v3.2.0' into feat/stable-rate-removal
kyzia551 May 7, 2024
35342e4
Merge branch 'main' into v3.2.0
kyzia551 Aug 14, 2024
d309f3e
Merge branch 'v3.2.0' into feat/stable-rate-removal
kyzia551 Aug 19, 2024
a9ee50a
updated InterestRates flag validation, tests
kyzia551 Aug 20, 2024
2a26198
helpers removal, stable debt test fix
kyzia551 Aug 20, 2024
07e503e
remove unused struct, cleanup
kyzia551 Aug 20, 2024
70f8834
removed unused error STABLE_DEBT_NOT_ZERO
kyzia551 Aug 20, 2024
1a15b4e
refactor: move static-a-token to extensions
brotherlymite Aug 20, 2024
8710e54
change error from DEPRECATED_BORROW_RATE_MODE to existing INVALID_INT…
kyzia551 Aug 21, 2024
0e71105
Merge pull request #36 from bgd-labs/fix/refactor
kyzia551 Aug 21, 2024
c699b1e
Merge branch 'v3.2.0' into feat/stable-rate-removal
kyzia551 Aug 21, 2024
9b90fb8
remove unused stable related events
kyzia551 Aug 21, 2024
489e897
update comments on ColldataLogic
kyzia551 Aug 23, 2024
2b43157
remove unrelated comment
kyzia551 Aug 23, 2024
9631de6
refactor: remove eModeOracle
sakulstra Aug 23, 2024
496cf89
feat: add borrowable in eMode
sakulstra Aug 23, 2024
08b1182
feat: multi eModes
sakulstra Aug 23, 2024
185918d
remove TODO, fix test_revert_flashloan_borrow_stable
kyzia551 Aug 26, 2024
3c56e13
typo: fix
sakulstra Aug 26, 2024
24de1df
fix: rename some things & update gas diff
sakulstra Aug 27, 2024
62aaf85
fix: improve tests
sakulstra Aug 27, 2024
a772a28
test: improve test coverage
sakulstra Aug 27, 2024
deadd2c
fix: add ui pool data provider method
sakulstra Aug 27, 2024
73e83a4
fix: lint code
sakulstra Aug 27, 2024
294dfef
feat: config engine refactor
sakulstra Aug 27, 2024
b24f5e7
fix: refactor testbase
sakulstra Aug 27, 2024
045e691
tests: improve tests
sakulstra Aug 27, 2024
92c9b0c
fix: push configurator patch
sakulstra Aug 28, 2024
9616047
fix: cleanup logic
sakulstra Aug 28, 2024
351d3f3
Update src/contracts/mocks/helpers/MockReserveConfiguration.sol
sakulstra Aug 29, 2024
99c3afc
fix: linting
sakulstra Aug 29, 2024
93cc1a6
fix: update gas diff
sakulstra Aug 29, 2024
8edfae9
Update tests/protocol/pool/Pool.EMode.sol
sakulstra Aug 29, 2024
10b46b8
fix lint
kyzia551 Aug 30, 2024
3b5dc5e
remove unused stableDebtToken field from the MarketReport struct
kyzia551 Aug 30, 2024
ee38602
oppimisation of if condition in calculateAvailableBorrows
kyzia551 Aug 30, 2024
3151bda
Merge branch 'feat/stable-rate-removal' into feat/eMode-umbrella
kyzia551 Aug 30, 2024
9081415
fix: remove unncessary import
sakulstra Aug 30, 2024
58971e5
fix: add deprecated note
sakulstra Aug 30, 2024
c21fc46
fix: remove unnecessary using
sakulstra Aug 30, 2024
2a2d185
remove unused deprecatedd events: StableDebtTokenUpgraded and Reserve…
kyzia551 Aug 30, 2024
c2d4ba1
removal of the borrowRate prameter on borrowETH and repayETH methods …
kyzia551 Aug 30, 2024
2544236
Merge branch 'feat/stable-rate-removal' into feat/eMode-umbrella
kyzia551 Aug 30, 2024
6954d19
fix: cleanup test base
sakulstra Aug 31, 2024
726069f
refactor: remove unnecessary _getConfigurationData
sakulstra Aug 31, 2024
e129ac9
fix: add notice about hole
sakulstra Aug 31, 2024
3716b69
fix: rename params as they are not masks themselfes
sakulstra Aug 31, 2024
304348d
fix: patch test
sakulstra Aug 31, 2024
be90691
feat: allow asset to be borrowable in eMode, while being non borrowable
sakulstra Sep 1, 2024
a8690a4
fix: improve tests
sakulstra Sep 1, 2024
c5af437
revert: add back the requirement on borrowable outside eMode
sakulstra Sep 2, 2024
01c3490
fix: rename mask to bitmap
sakulstra Sep 2, 2024
a3bd352
Update src/contracts/helpers/UiPoolDataProviderV3.sol
sakulstra Sep 2, 2024
03e8225
fix: improve docs
sakulstra Sep 2, 2024
a484911
fix: fix grammar
sakulstra Sep 3, 2024
6424af8
refactor: engine refactor (#44)
sakulstra Sep 11, 2024
9a72720
fix: oxorio #5 unused local variable
sakulstra Sep 8, 2024
477d9ed
fix: oxorio #4 - unnecessary casts
sakulstra Sep 8, 2024
78406a1
fix: oxorio #7 - align comment with code
sakulstra Sep 9, 2024
2741875
fix: oxorio #6 - ensure asset exists
sakulstra Sep 9, 2024
4fcf2d6
fix: enigma #4 - misc (#48)
sakulstra Sep 12, 2024
dbdb739
fix: enigma #1 (issue #3) - remove unnecessary allocation (#47)
sakulstra Sep 12, 2024
740d0a8
fix: add getEModes to interface (#46)
sakulstra Sep 12, 2024
55c9bc9
fix: resolve conflicts
sakulstra Sep 12, 2024
6ca352b
fix: merge back 3.2.0 & resolve conflicts
sakulstra Sep 12, 2024
5dc61d1
fix: add deprecated to interface (#53)
sakulstra Sep 16, 2024
47e89db
fix: skip if eMode is the same (#54)
sakulstra Sep 17, 2024
dd0bbec
refactor: add independent getters and setters for better backwards co…
sakulstra Sep 17, 2024
a1240df
fix: typo fixes (#59)
sakulstra Sep 19, 2024
ea10324
docs: migration guide (#52)
sakulstra Sep 19, 2024
cdd24e1
Merge branch 'feat/stable-rate-removal' into feat/eMode-umbrella
sakulstra Sep 19, 2024
0645793
Merge liquid eModes
sakulstra Sep 19, 2024
dd50736
Merge pull request #2 from bgd-labs/feat/stable-rate-removal
sakulstra Sep 19, 2024
4beb9b8
fix: resolve merge conflicts
sakulstra Sep 19, 2024
f02fcb2
refactor(configEngine): rename `asset` to `assets` for consistency wi…
sakulstra Sep 19, 2024
2d4f5a4
chore: bump revisions (#27)
sakulstra Sep 22, 2024
ea32100
feat: improve snapshots (#28)
sakulstra Sep 23, 2024
e8d17a5
fix: upgrade aave-cli
sakulstra Sep 23, 2024
fd4f033
feat: add updated coverage report (#31)
sakulstra Sep 24, 2024
be45428
feat: script (#32)
sakulstra Sep 24, 2024
d0c6da2
Merge branch 'main' into v3.2.0
sakulstra Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: improve test coverage
sakulstra committed Aug 27, 2024
commit a772a28983412c5a91198e303deb5316cc14c2e1
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ library EModeConfiguration {
* @param reserveIndex The index of the reserve in the bitmap
* @param collateral True if the asset should be collateral, false otherwise
*/
function setCollateralAsset(
function setCollateral(
DataTypes.EModeCategory memory self,
uint256 reserveIndex,
bool collateral
2 changes: 1 addition & 1 deletion src/contracts/protocol/pool/PoolConfigurator.sol
Original file line number Diff line number Diff line change
@@ -427,7 +427,7 @@ abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator
) external override onlyRiskOrPoolAdmins {
DataTypes.EModeCategory memory categoryData = _pool.getEModeCategoryData(categoryId);
DataTypes.ReserveDataLegacy memory reserveData = _pool.getReserveData(asset);
categoryData.setCollateralAsset(reserveData.id, allowed);
categoryData.setCollateral(reserveData.id, allowed);
_pool.configureEModeCategory(categoryId, categoryData);
emit AssetCollateralInEModeChanged(asset, uint8(categoryId), allowed);
}
88 changes: 69 additions & 19 deletions tests/protocol/pool/pool-configurator/PoolConfigurator.eMode.sol
Original file line number Diff line number Diff line change
@@ -6,11 +6,13 @@ import 'forge-std/Test.sol';
import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
import {PercentageMath} from '../../../../src/contracts/protocol/libraries/math/PercentageMath.sol';
import {ReserveConfiguration, DataTypes} from '../../../../src/contracts/protocol/pool/PoolConfigurator.sol';
import {EModeConfiguration} from '../../../../src/contracts/protocol/libraries/configuration/EModeConfiguration.sol';
import {TestnetProcedures} from '../../../utils/TestnetProcedures.sol';

contract PoolConfiguratorEModeConfigTests is TestnetProcedures {
using PercentageMath for uint256;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using EModeConfiguration for DataTypes.EModeCategory;

event EModeCategoryAdded(
uint8 indexed categoryId,
@@ -22,6 +24,10 @@ contract PoolConfiguratorEModeConfigTests is TestnetProcedures {
);

event AssetCollateralInEModeChanged(address indexed asset, uint8 categoryId, bool allowed);
event AssetBorrowableInEModeChanged(address indexed asset, uint8 categoryId, bool borrowable);

// EModeConfiguration only works with storage, so definint a temp placeholder for assertions
DataTypes.EModeCategory internal tempConfig;

function setUp() public {
initTestEnvironment();
@@ -40,24 +46,26 @@ contract PoolConfiguratorEModeConfigTests is TestnetProcedures {
assertEq(emodeConfig.liquidationThreshold, ct.lt);
assertEq(emodeConfig.liquidationBonus, ct.lb);
assertEq(emodeConfig.label, ct.label);
assertEq(emodeConfig.collateralMask, 0);
assertEq(emodeConfig.borrowableMask, 0);
}

function test_updateEModeCategory() public {
EModeCategoryInput memory ogCategory = _genCategoryOne();
test_configureEmodeCategory();
EModeCategoryInput memory ct = _genCategoryOne();
DataTypes.EModeCategory memory ogCategory = contracts.poolProxy.getEModeCategoryData(ct.id);
EModeCategoryInput memory updatedCategory = EModeCategoryInput(
ogCategory.id,
ct.id,
90_00,
92_00,
101_00,
'GROUP_B'
);

test_configureEmodeCategory();

vm.prank(poolAdmin);
vm.expectEmit(address(contracts.poolConfiguratorProxy));
emit EModeCategoryAdded(
ogCategory.id,
ct.id,
updatedCategory.ltv,
updatedCategory.lt,
updatedCategory.lb,
@@ -66,20 +74,20 @@ contract PoolConfiguratorEModeConfigTests is TestnetProcedures {
);

contracts.poolConfiguratorProxy.setEModeCategory(
ogCategory.id,
ct.id,
updatedCategory.ltv,
updatedCategory.lt,
updatedCategory.lb,
updatedCategory.label
);

DataTypes.EModeCategory memory emodeConfig = contracts.poolProxy.getEModeCategoryData(
ogCategory.id
);
DataTypes.EModeCategory memory emodeConfig = contracts.poolProxy.getEModeCategoryData(ct.id);
assertEq(emodeConfig.ltv, updatedCategory.ltv);
assertEq(emodeConfig.liquidationThreshold, updatedCategory.lt);
assertEq(emodeConfig.liquidationBonus, updatedCategory.lb);
assertEq(emodeConfig.label, updatedCategory.label);
assertEq(emodeConfig.collateralMask, ogCategory.collateralMask);
assertEq(emodeConfig.borrowableMask, ogCategory.borrowableMask);
}

function test_reverts_setEmodeCategory_zero_ltv() public {
@@ -142,29 +150,71 @@ contract PoolConfiguratorEModeConfigTests is TestnetProcedures {
emit AssetCollateralInEModeChanged(tokenList.usdx, input.id, true);
vm.prank(poolAdmin);
contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, input.id, true);
tempConfig = contracts.poolProxy.getEModeCategoryData(input.id);
DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
tokenList.usdx
);
assertEq(tempConfig.isCollateralAsset(reserveData.id), true);
}

function test_updateAssetEModeCategory() public {
EModeCategoryInput memory ct = _genCategoryTwo();
function test_addAnotherAssetCollateralInEMode() public {
EModeCategoryInput memory input = _genCategoryOne();
test_setAssetCollateralInEMode();

vm.prank(poolAdmin);
contracts.poolConfiguratorProxy.setEModeCategory(ct.id, ct.ltv, ct.lt, ct.lb, ct.label);

vm.expectEmit(address(contracts.poolConfiguratorProxy));
emit AssetCollateralInEModeChanged(tokenList.usdx, ct.id, true);

vm.prank(poolAdmin);
contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, ct.id, true);
contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, input.id, true);
tempConfig = contracts.poolProxy.getEModeCategoryData(input.id);
DataTypes.ReserveDataLegacy memory reserveDataUSDX = contracts.poolProxy.getReserveData(
tokenList.usdx
);
DataTypes.ReserveDataLegacy memory reserveDataWBTC = contracts.poolProxy.getReserveData(
tokenList.wbtc
);
assertEq(tempConfig.isCollateralAsset(reserveDataUSDX.id), true);
assertEq(tempConfig.isCollateralAsset(reserveDataWBTC.id), true);
}

function test_removeEModeCategoryFromAsset() public {
function test_removeCollateralFromEmode() public {
EModeCategoryInput memory prevCt = _genCategoryOne();
test_setAssetCollateralInEMode();
vm.expectEmit(address(contracts.poolConfiguratorProxy));
emit AssetCollateralInEModeChanged(tokenList.usdx, prevCt.id, false);

vm.prank(poolAdmin);
contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, prevCt.id, false);

tempConfig = contracts.poolProxy.getEModeCategoryData(prevCt.id);
DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
tokenList.usdx
);
assertEq(tempConfig.isCollateralAsset(reserveData.id), false);
}

function test_setAssetBorrowableInEMode() public {
EModeCategoryInput memory input = _genCategoryOne();
test_configureEmodeCategory();
vm.expectEmit(address(contracts.poolConfiguratorProxy));
emit AssetBorrowableInEModeChanged(tokenList.usdx, input.id, true);
vm.prank(poolAdmin);
contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.usdx, input.id, true);
tempConfig = contracts.poolProxy.getEModeCategoryData(input.id);
DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
tokenList.usdx
);
assertEq(tempConfig.isBorrowable(reserveData.id), true);
}

function test_removeBorrowableFromEmode() public {
EModeCategoryInput memory input = _genCategoryOne();
test_configureEmodeCategory();
vm.expectEmit(address(contracts.poolConfiguratorProxy));
emit AssetBorrowableInEModeChanged(tokenList.usdx, input.id, false);
vm.prank(poolAdmin);
contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.usdx, input.id, false);
tempConfig = contracts.poolProxy.getEModeCategoryData(input.id);
DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
tokenList.usdx
);
assertEq(tempConfig.isBorrowable(reserveData.id), false);
}
}