Skip to content

Commit

Permalink
chore(release): merge v3.2.0
Browse files Browse the repository at this point in the history
- liquid eModes
- deprecation of stable debt
  • Loading branch information
sakulstra authored Sep 26, 2024
2 parents 3aad8ca + d0c6da2 commit c5ef87e
Show file tree
Hide file tree
Showing 616 changed files with 22,735 additions and 22,557 deletions.
56 changes: 35 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,45 @@ update:; forge update
test :; forge test -vvv --no-match-contract DeploymentsGasLimits
test-contract :; forge test --match-contract ${filter} -vvv
test-watch :; forge test --watch -vvv --no-match-contract DeploymentsGasLimits
coverage :; forge coverage --report lcov && \
lcov --remove ./lcov.info -o ./lcov.info.p \
'scripts/*' \
'tests/*' \
'src/deployments/*' \
'src/periphery/contracts/v3-config-engine/*' \
'src/periphery/contracts/treasury/*' \
'src/periphery/contracts/dependencies/openzeppelin/ReentrancyGuard.sol' \
'src/periphery/contracts/misc/UiIncentiveDataProviderV3.sol' \
'src/periphery/contracts/misc/UiPoolDataProviderV3.sol' \
'src/periphery/contracts/misc/WalletBalanceProvider.sol' \
'src/periphery/contracts/mocks/*' \
'src/core/contracts/mocks/*' \
'src/core/contracts/dependencies/*' \
'src/core/contracts/misc/AaveProtocolDataProvider.sol' \
'src/core/contracts/protocol/libraries/configuration/*' \
'src/core/contracts/protocol/libraries/logic/GenericLogic.sol' \
'src/core/contracts/protocol/libraries/logic/ReserveLogic.sol' \
&& genhtml ./lcov.info.p -o report --branch-coverage \
&& coverage=$$(awk -F '[<>]' '/headerCovTableEntryHi/{print $3}' ./report/index.html | sed 's/[^0-9.]//g' | head -n 1); \

# Coverage
coverage-base :; forge coverage --report lcov --no-match-coverage "(scripts|tests|deployments|mocks)"
coverage-clean :; lcov --rc derive_function_end_line=0 --remove ./lcov.info -o ./lcov.info.p \
'src/contracts/extensions/v3-config-engine/*' \
'src/contracts/treasury/*' \
'src/contracts/dependencies/openzeppelin/ReentrancyGuard.sol' \
'src/contracts/helpers/UiIncentiveDataProviderV3.sol' \
'src/contracts/helpers/UiPoolDataProviderV3.sol' \
'src/contracts/helpers/WalletBalanceProvider.sol' \
'src/contracts/dependencies/*' \
'src/contracts/helpers/AaveProtocolDataProvider.sol' \
'src/contracts/protocol/libraries/configuration/*' \
'src/contracts/protocol/libraries/logic/GenericLogic.sol' \
'src/contracts/protocol/libraries/logic/ReserveLogic.sol'
coverage-report :; genhtml ./lcov.info.p -o report --branch-coverage --rc derive_function_end_line=0 --parallel
coverage-badge :; coverage=$$(awk -F '[<>]' '/headerCovTableEntryHi/{print $3}' ./report/index.html | sed 's/[^0-9.]//g' | head -n 1); \
wget -O ./report/coverage.svg "https://img.shields.io/badge/coverage-$${coverage}%25-brightgreen"
coverage :
make coverage-base
make coverage-clean
make coverage-report
make coverage-badge

# Utilities
download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${address} ${address}
git-diff :
@mkdir -p diffs
@npx prettier ${before} ${after} --write
@printf '%s\n%s\n%s\n' "\`\`\`diff" "$$(git diff --no-index --diff-algorithm=patience --ignore-space-at-eol ${before} ${after})" "\`\`\`" > diffs/${out}.md
@printf '%s\n%s\n%s\n' "\`\`\`diff" "$$(git diff --no-index --ignore-space-at-eol ${before} ${after})" "\`\`\`" > diffs/${out}.md

# Deploy
deploy-libs-one :;
forge script scripts/misc/LibraryPreCompileOne.sol --rpc-url ${chain} --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify --slow --broadcast
deploy-libs-two :;
forge script scripts/misc/LibraryPreCompileTwo.sol --rpc-url ${chain} --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify --slow --broadcast

deploy-libs :
make deploy-libs-one chain=${chain}
npx catapulta-verify -b broadcast/LibraryPreCompileOne.sol/${chainId}/run-latest.json
make deploy-libs-two chain=${chain}
npx catapulta-verify -b broadcast/LibraryPreCompileTwo.sol/${chainId}/run-latest.json
20 changes: 10 additions & 10 deletions certora/applyHarness.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
diff -ruN core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol
--- core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol 2024-03-27 12:57:15.497294747 +0200
+++ core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol 2024-03-27 13:08:22.155984803 +0200
diff -ruN contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol
--- contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol 2024-03-27 12:57:15.497294747 +0200
+++ contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol 2024-03-27 13:08:22.155984803 +0200
@@ -34,7 +34,7 @@
}

/// @inheritdoc IScaledBalanceToken
- function scaledBalanceOf(address user) external view override returns (uint256) {
+ function scaledBalanceOf(address user) public view override returns (uint256) {
return super.balanceOf(user);
}
diff -ruN core/instances/ATokenInstance.sol core/instances/ATokenInstance.sol
--- core/instances/ATokenInstance.sol 2024-03-27 12:57:15.497294747 +0200
+++ core/instances/ATokenInstance.sol 2024-03-27 13:14:17.971198372 +0200

diff -ruN contracts/instances/ATokenInstance.sol contracts/instances/ATokenInstance.sol
--- contracts/instances/ATokenInstance.sol 2024-03-27 12:57:15.497294747 +0200
+++ contracts/instances/ATokenInstance.sol 2024-03-27 13:14:17.971198372 +0200
@@ -35,15 +35,15 @@

_domainSeparator = _calculateDomainSeparator();

- emit Initialized(
- underlyingAsset,
- address(POOL),
Expand Down
16 changes: 7 additions & 9 deletions certora/conf/NEW-pool-no-summarizations.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
"files": [
"certora/harness/ATokenHarness.sol",
"certora/harness/PoolHarness.sol",
"certora/harness/StableDebtTokenHarness.sol",
"certora/harness/SimpleERC20.sol",
"src/core/instances/VariableDebtTokenInstance.sol",
"src/core/contracts/misc/AaveProtocolDataProvider.sol",
"src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol",
"src/core/contracts/protocol/configuration/ACLManager.sol",
"src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol",
"src/core/contracts/protocol/configuration/PriceOracleSentinel.sol",
"src/core/contracts/protocol/configuration/PoolAddressesProvider.sol",
"src/contracts/instances/VariableDebtTokenInstance.sol",
"src/contracts/helpers/AaveProtocolDataProvider.sol",
"src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol",
"src/contracts/protocol/configuration/ACLManager.sol",
"src/contracts/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol",
"src/contracts/misc/PriceOracleSentinel.sol",
"src/contracts/protocol/configuration/PoolAddressesProvider.sol",
],
"link": [
"ATokenHarness:POOL=PoolHarness",
Expand All @@ -20,7 +19,6 @@
],
"struct_link": [
"PoolHarness:aTokenAddress=ATokenHarness",
"PoolHarness:stableDebtTokenAddress=StableDebtTokenHarness",
"PoolHarness:variableDebtTokenAddress=VariableDebtTokenInstance",
"PoolHarness:interestRateStrategyAddress=DefaultReserveInterestRateStrategyV2",
],
Expand Down
12 changes: 5 additions & 7 deletions certora/conf/NEW-pool-simple-properties.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"files": [
"certora/harness/ATokenHarness.sol",
"certora/harness/PoolHarness.sol",
"certora/harness/StableDebtTokenHarness.sol",
"certora/harness/SimpleERC20.sol",
"src/core/instances/VariableDebtTokenInstance.sol",
"src/core/contracts/misc/AaveProtocolDataProvider.sol",
"src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol",
"src/core/contracts/protocol/libraries/types/DataTypes.sol",
"src/core/contracts/protocol/configuration/PoolAddressesProvider.sol",
"src/contracts/instances/VariableDebtTokenInstance.sol",
"src/contracts/helpers/AaveProtocolDataProvider.sol",
"src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol",
"src/contracts/protocol/libraries/types/DataTypes.sol",
"src/contracts/protocol/configuration/PoolAddressesProvider.sol",
],
"link": [
"ATokenHarness:POOL=PoolHarness",
Expand All @@ -17,7 +16,6 @@
],
"struct_link": [
"PoolHarness:aTokenAddress=ATokenHarness",
"PoolHarness:stableDebtTokenAddress=StableDebtTokenHarness",
"PoolHarness:variableDebtTokenAddress=VariableDebtTokenInstance",
"PoolHarness:interestRateStrategyAddress=DefaultReserveInterestRateStrategyV2",
],
Expand Down
19 changes: 0 additions & 19 deletions certora/conf/StableDebtToken.conf

This file was deleted.

12 changes: 6 additions & 6 deletions certora/harness/ATokenHarness.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.19;

import {Pool} from '../munged/core/contracts/protocol/pool/Pool.sol';
import {ATokenInstance} from '../munged/core/instances/ATokenInstance.sol';
import {WadRayMath} from '../munged/core/contracts/protocol/libraries/math/WadRayMath.sol';
import {ScaledBalanceTokenBase} from '../munged/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol';
import {IScaledBalanceToken} from '../munged/core/contracts/interfaces/IScaledBalanceToken.sol';
import {Pool} from '../munged/contracts/protocol/pool/Pool.sol';
import {ATokenInstance} from '../munged/contracts/instances/ATokenInstance.sol';
import {WadRayMath} from '../munged/contracts/protocol/libraries/math/WadRayMath.sol';
import {ScaledBalanceTokenBase} from '../munged/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol';
import {IScaledBalanceToken} from '../munged/contracts/interfaces/IScaledBalanceToken.sol';

/**
/*
* @title Certora harness for Aave ERC20 AToken
*
* @dev Certora's harness contract for the verification of Aave ERC20 AToken.
Expand Down
19 changes: 7 additions & 12 deletions certora/harness/PoolHarness.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import {PoolInstance} from '../munged/core/instances/PoolInstance.sol';
import {DataTypes} from '../munged/core/contracts/protocol/libraries/types/DataTypes.sol';
import {ReserveLogic} from '../munged/core/contracts/protocol/libraries/logic/ReserveLogic.sol';
import {IPoolAddressesProvider} from '../munged/core/contracts/interfaces/IPoolAddressesProvider.sol';
import {PoolInstance} from '../munged/contracts/instances/PoolInstance.sol';
import {DataTypes} from '../munged/contracts/protocol/libraries/types/DataTypes.sol';
import {ReserveLogic} from '../munged/contracts/protocol/libraries/logic/ReserveLogic.sol';
import {IPoolAddressesProvider} from '../munged/contracts/interfaces/IPoolAddressesProvider.sol';

import {IERC20} from '../../src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
import {ReserveConfiguration} from '../munged/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
import {IERC20} from '../../src/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
import {ReserveConfiguration} from '../munged/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';

contract PoolHarness is PoolInstance {
using ReserveLogic for DataTypes.ReserveData;
Expand All @@ -23,8 +23,7 @@ contract PoolHarness is PoolInstance {

function getTotalDebt(address asset) public view returns (uint256) {
uint256 totalVariable = IERC20(_reserves[asset].variableDebtTokenAddress).totalSupply();
uint256 totalStable = IERC20(_reserves[asset].stableDebtTokenAddress).totalSupply();
return totalVariable + totalStable;
return totalVariable;
}

function getTotalATokenSupply(address asset) public view returns (uint256) {
Expand All @@ -35,10 +34,6 @@ contract PoolHarness is PoolInstance {
return _reserves[asset].liquidityIndex;
}

function getReserveStableBorrowRate(address asset) public view returns (uint256) {
return _reserves[asset].currentStableBorrowRate;
}

function getReserveVariableBorrowIndex(address asset) public view returns (uint256) {
return _reserves[asset].variableBorrowIndex;
}
Expand Down
25 changes: 5 additions & 20 deletions certora/harness/ReserveConfigurationHarness.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;
pragma experimental ABIEncoderV2;

import {ReserveConfiguration} from '../munged/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
import {DataTypes} from '../munged/core/contracts/protocol/libraries/types/DataTypes.sol';
import {ReserveConfiguration} from '../munged/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
import {DataTypes} from '../munged/contracts/protocol/libraries/types/DataTypes.sol';

contract ReserveConfigurationHarness {
DataTypes.ReserveConfigurationMap public reservesConfig;
Expand Down Expand Up @@ -130,18 +131,6 @@ contract ReserveConfigurationHarness {
return ReserveConfiguration.getBorrowingEnabled(reservesConfig);
}

// Enables or disables stable rate borrowing on the reserve
function setStableRateBorrowingEnabled(bool enabled) public {
DataTypes.ReserveConfigurationMap memory configNew = reservesConfig;
ReserveConfiguration.setStableRateBorrowingEnabled(configNew, enabled);
reservesConfig.data = configNew.data;
}

// Gets the stable rate borrowing state of the reserve
function getStableRateBorrowingEnabled() public view returns (bool) {
return ReserveConfiguration.getStableRateBorrowingEnabled(reservesConfig);
}

// Sets the reserve factor of the reserve
function setReserveFactor(uint256 reserveFactor) public {
DataTypes.ReserveConfigurationMap memory configNew = reservesConfig;
Expand Down Expand Up @@ -301,16 +290,14 @@ contract ReserveConfigurationHarness {

// Executes a setter of a bool parameter according to the given id
function executeBoolSetterById(uint256 id, bool val) public {
require(id >= 0 && id <= 5);
require(id >= 0 && id <= 4);
if (id == 0) {
setActive(val);
} else if (id == 1) {
setFrozen(val);
} else if (id == 2) {
setBorrowingEnabled(val);
} else if (id == 3) {
setStableRateBorrowingEnabled(val);
} else if (id == 4) {
setPaused(val);
} else {
setBorrowableInIsolation(val);
Expand All @@ -319,16 +306,14 @@ contract ReserveConfigurationHarness {

// Executes a getter of a bool parameter according to the given id
function executeBoolGetterById(uint256 id) public view returns (bool) {
require(id >= 0 && id <= 5);
require(id >= 0 && id <= 4);
if (id == 0) {
return getActive();
} else if (id == 1) {
return getFrozen();
} else if (id == 2) {
return getBorrowingEnabled();
} else if (id == 3) {
return getStableRateBorrowingEnabled();
} else if (id == 4) {
return getPaused();
} else {
return getBorrowableInIsolation();
Expand Down
4 changes: 2 additions & 2 deletions certora/harness/SimpleERC20.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import {IERC20} from '../munged/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
import {IERC20} from '../munged/contracts/dependencies/openzeppelin/contracts/IERC20.sol';

/**
A simple ERC implementation used as the underlying_asset for the verification process.
Expand Down
17 changes: 0 additions & 17 deletions certora/harness/StableDebtTokenHarness.sol

This file was deleted.

3 changes: 2 additions & 1 deletion certora/harness/SymbolicPriceOracle.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import {IPriceOracleGetter} from '../munged/interfaces/IPriceOracleGetter.sol';
import {IPriceOracleGetter} from '../munged/contracts/interfaces/IPriceOracleGetter.sol';

contract SymbolicPriceOracle is IPriceOracleGetter {
address public base;
Expand Down
7 changes: 4 additions & 3 deletions certora/harness/UserConfigurationHarness.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;
pragma experimental ABIEncoderV2;

import {UserConfiguration} from '../munged/core/contracts/protocol/libraries/configuration/UserConfiguration.sol';
import {DataTypes} from '../munged/core/contracts/protocol/libraries/types/DataTypes.sol';
import {PoolStorage} from '../munged/core/contracts/protocol/pool/PoolStorage.sol';
import {UserConfiguration} from '../munged/contracts/protocol/libraries/configuration/UserConfiguration.sol';
import {DataTypes} from '../munged/contracts/protocol/libraries/types/DataTypes.sol';
import {PoolStorage} from '../munged/contracts/protocol/pool/PoolStorage.sol';

/*
A wrapper contract for calling functions from the library UserConfiguration.
Expand Down
6 changes: 3 additions & 3 deletions certora/harness/VariableDebtTokenHarness.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

import {VariableDebtTokenInstance} from '../munged/core/instances/VariableDebtTokenInstance.sol';
import {WadRayMath} from '../munged/core/contracts/protocol/libraries/math/WadRayMath.sol';
import {IPool} from '../munged/core/contracts/interfaces/IPool.sol';
import {VariableDebtTokenInstance} from '../munged/contracts/instances/VariableDebtTokenInstance.sol';
import {WadRayMath} from '../munged/contracts/protocol/libraries/math/WadRayMath.sol';
import {IPool} from '../munged/contracts/interfaces/IPool.sol';

contract VariableDebtTokenHarness is VariableDebtTokenInstance {
using WadRayMath for uint256;
Expand Down
5 changes: 0 additions & 5 deletions certora/specs/NEW-pool-base.spec
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ methods {
function _.getACLManager() external => DISPATCHER(true);
//function _.isBridge(address) external => DISPATCHER(true);

// StableDebt
function _.mint(address user, address onBehalfOf, uint256 amount, uint256 rate) external => DISPATCHER(true);
function _.burn(address user, uint256 amount) external => DISPATCHER(true);
function _.getSupplyData() external => DISPATCHER(true);

// variableDebt
function _.burn(address user, uint256 amount, uint256 index) external => DISPATCHER(true);

Expand Down
Loading

0 comments on commit c5ef87e

Please sign in to comment.